Fil-C on Nix

Filnix wiki

the formal campaign

rocq/theories/Steps.v

What one step of Semantics.v's step does to the running frame, as Campaign 3's run-level invariant (Persistence.v) reads it.

step is one function over every point of a frame; the invariant asks, point by point, what the frame looks like after it: after a variadic callee's snapshot (step_snapshot), at a block's entry (step_enter), at an instruction (step_exec_cons) and at a return (return_step_next). The other lemmas say which instructions allocate, call or keep the locals, and how a doomed frame comes about and stays.

From Stdlib Require Import String ZArith List Bool Lia
From Nanofil Require Import Term Maps Syntax Cfg Values Memory Runtime Ops Semantics Machine Validate Coverage Evidence Walk
Import ListNotations
Open Scope Z_scope

What a step does to the frame

A function that find_direct finds by the name n among the items of a module is one of its functions.

23Lemma find_direct_in
∀ n items g
find_directn items = SomeDefinedg
InIFuncg items
Explore proof 5 tactics

Initial goal

⊢
∀n : name items : module g : func, find_directn items = SomeDefinedg → InIFuncg items

induction items as | it items IH ; simpl ; intros g H ; discriminate H |

n :
it :
items :
listitem
IH :
∀g : func, find_directn items = SomeDefinedg → InIFuncg items
g :
H :
match it with
⇒
else
⇒
→
SomeOutsidef
else
_
⇒
=
SomeDefinedg
⊢
it = IFuncg ∨ InIFuncg items

destruct it ; try right ; apply IH ; exact H;match type of H withcontext [if name_eqb?x n then _ else _]⇒destruct name_eqbx nend;try right ; apply IH ; exact H;try discriminate H

n :
f :
items :
listitem
IH :
∀g : func, find_directn items = SomeDefinedg → InIFuncg items
g :
H :
SomeDefinedf = SomeDefinedg
⊢
IFuncf = IFuncg ∨ InIFuncg items

injection H as ←

n :
f :
items :
listitem
IH :
∀g : func, find_directn items = SomeDefinedg → InIFuncg items
⊢
IFuncf = IFuncf ∨ InIFuncf items

left

n :
f :
items :
listitem
IH :
∀g : func, find_directn items = SomeDefinedg → InIFuncg items
⊢

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
induction items as | it items IH ; simpl ; intros g H ; discriminate H |
destruct it ; try right ; apply IH ; exact H;match type of H withcontext [if name_eqb?x n then _ else _]⇒destruct name_eqbx nend;try right ; apply IH ; exact H;try discriminate H
injection H as ←
left
reflexivity

A function that find_fn finds by name, directly or through an alias, is a function of the running module.

34Lemma find_fn_in
∀ ge n g
find_fnge n = SomeDefinedg
Explore proof 6 tactics

Initial goal

⊢
∀ge : genv n : name g : func, find_fnge n = SomeDefinedg → InIFuncg ge_modulege

unfold find_fn

⊢
∀ ge : genv n : name g : func  ,
match find_directn ge_modulege with
Somed
⇒
Somed
None
⇒
=
SomeDefinedg
→

intros ge n g H

ge :
n :
g :
H :
match find_directn ge_modulege with
Somed
⇒
Somed
None
⇒
=
SomeDefinedg

destruct find_directn ge_modulege eqn: E

2 open

ge :
n :
g :
E :
H :
Somef = SomeDefinedg
focused goal
ge :
n :
g :
E :
H :

–injection H as →

2 open

deferred goal
ge :
n :
g :
E :
H :

eapply find_direct_in ; eauto

deferred goal
ge :
n :
g :
E :
H :

–destruct find_aliasn ge_modulege ; eapply find_direct_in ; eauto | discriminate H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
unfold find_fn
intros ge n g H
destruct find_directn ge_modulege eqn: E
–injection H as →
eapply find_direct_in ; eauto
–destruct find_aliasn ge_modulege ; eapply find_direct_in ; eauto | discriminate H

An instruction i that continues (IContinue) keeps the locals l of the frame fr, its invocation's named locals.

43Lemma inst_step_locals
∀ ge fr m i e l m′
inst_stepge fr m i = SomeIContinuee l m′
l = fr_localsfr
Explore proof 4 tactics

Initial goal

⊢
∀ge : genv fr : frame m : Memory.mem i : inst e : env l : listname × optionZ m′ : Memory.mem, inst_stepge fr m i = SomeIContinuee l m′ → l = fr_localsfr

intros ge fr m i e l m′ H

ge :
fr :
m :
Memory.mem
i :
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m i = SomeIContinuee l m′
⊢
l = fr_localsfr

destruct i

8 open

ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Letd k o args = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Flightd o args lower = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m RawStorew off v a = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
es :
listeffect
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m RawStorePointeroff v a es = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Callr callee args = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m RawCallr callee args = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m LocalAllocx size = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
file :
line :
Z
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Locfile line = SomeIContinuee l m′
⊢
l = fr_localsfr

1: destruct special_leto eqn: Es ; destruct o ; try discriminate Es | rewrite inst_step_let_ _ _ _ _ _ _ Es in H

11 open

ge :
fr :
m :
Memory.mem
d :
x :
off, bytes :
Z
align :
Z
args :
listvalue
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Letd k CheckLocalx off bytes r align args = SomeIContinuee l m′
Es :
special_letCheckLocalx off bytes r align = true
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
args :
listvalue
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Letd k CheckFunction args = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
args :
listvalue
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Letd k VaArgs args = SomeIContinuee l m′
Es :
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
let e ≔ fr_envfr in
let locals ≔ fr_localsfr in
let* classes ≔ op_arg_classeso k in
let* xs ≔ map2_optionvalue_xge e classes args in
match op_reso k xs m with
SomeOpResr m′
⇒
Somebind_resd r e locals m′
SomeOpUBwhy
⇒
SomeIStopUBwhy
SomeOpAllocq kont
⇒
Some
λ base : Z  ⇒
let x, m′ ≔ kontbase in
putd x e, locals, m′
None
⇒
None
=
SomeIContinuee l m′
Es :
special_leto = false
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Flightd o args lower = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m RawStorew off v a = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
es :
listeffect
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m RawStorePointeroff v a es = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Callr callee args = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m RawCallr callee args = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m LocalAllocx size = SomeIContinuee l m′
⊢
l = fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
file :
line :
Z
e :
l :
listname × optionZ
m′ :
Memory.mem
H :
inst_stepge fr m Locfile line = SomeIContinuee l m′
⊢
l = fr_localsfr

all: unfold inst_step , external_call , bind_res , store_out in H ; cases H ; inversion H ; subst ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge fr m i e l m′ H
destruct i
1: destruct special_leto eqn: Es ; destruct o ; try discriminate Es | rewrite inst_step_let_ _ _ _ _ _ _ Es in H
all: unfold inst_step , external_call , bind_res , store_out in H ; cases H ; inversion H ; subst ; reflexivity

An operation whose result allocates (OpAlloc) is an alloc.

54Lemma op_res_alloc_op
∀ o k xs m q kont
op_reso k xs m = SomeOpAllocq kont
∃al, o = Allocal
Explore proof 2 tactics

Initial goal

⊢
∀o : op k : class xs : listword m : Memory.mem q : alloc_req kont : Z → word × Memory.mem, op_reso k xs m = SomeOpAllocq kont → ∃al : Z, o = Allocal

intros o k xs m q kont H

o :
xs :
listword
m :
Memory.mem
kont :
Z → word × Memory.mem
H :
op_reso k xs m = SomeOpAllocq kont
⊢
∃al : Z, o = Allocal

destruct o ; unfold op_res , op_res_int , float_integer in H ; cases H ; inversion H ; subst ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros o k xs m q kont H
destruct o ; unfold op_res , op_res_int , float_integer in H ; cases H ; inversion H ; subst ; eauto

An instruction that allocates a fresh object (IFresh) is an alloc, which keeps the frame's locals whatever base the object gets, or the allocation of a named local x, which gives x that base.

64Lemma inst_step_fresh_shape
∀ ge fr m i q k
inst_stepge fr m i = SomeIFreshq k
∃d c al args, i = Letd c Allocal args ∧ ∀base, sndfstkbase = fr_localsfr ∨ ∃x size, i = LocalAllocx size ∧ ∀base, sndfstkbase = putx Somebase fr_localsfr
Explore proof 17 tactics

Initial goal

⊢
∀ge : genv fr : frame m : Memory.mem i : inst q : alloc_req k : Z → env × listname × optionZ × Memory.mem, inst_stepge fr m i = SomeIFreshq k → ∃d : name c : class al : Z args : listvalue, i = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, i = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr

intros ge fr m i q k H

ge :
fr :
m :
Memory.mem
i :
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m i = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, i = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, i = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr

destruct i

8 open

ge :
fr :
m :
Memory.mem
d :
k0 :
o :
args :
listvalue
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Letd k0 o args = SomeIFreshq k
⊢
∃d0 : name c : class al : Z args0 : listvalue, Letd k0 o args = Letd0 c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Letd k0 o args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Flightd o args lower = SomeIFreshq k
⊢
∃d0 : name c : class al : Z args0 : listvalue, Flightd o args lower = Letd0 c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Flightd o args lower = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m RawStorew off v a = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, RawStorew off v a = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, RawStorew off v a = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
es :
listeffect
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m RawStorePointeroff v a es = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, RawStorePointeroff v a es = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, RawStorePointeroff v a es = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Callr callee args = SomeIFreshq k
⊢
∃d : name c : class al : Z args0 : listvalue, Callr callee args = Letd c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Callr callee args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m RawCallr callee args = SomeIFreshq k
⊢
∃d : name c : class al : Z args0 : listvalue, RawCallr callee args = Letd c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, RawCallr callee args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m LocalAllocx size = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstkbase = putx0 Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
file :
line :
Z
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Locfile line = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, Locfile line = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Locfile line = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr

1: destruct special_leto eqn: Es ; destruct o ; try discriminate Es | rewrite inst_step_let_ _ _ _ _ _ _ Es in H

11 open

ge :
fr :
m :
Memory.mem
d :
k0 :
x :
off, bytes :
Z
align :
Z
args :
listvalue
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Letd k0 CheckLocalx off bytes r align args = SomeIFreshq k
Es :
special_letCheckLocalx off bytes r align = true
⊢
∃d0 : name c : class al : Z args0 : listvalue, Letd k0 CheckLocalx off bytes r align args = Letd0 c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x0 : name size : Z, Letd k0 CheckLocalx off bytes r align args = LocalAllocx0 size ∧ ∀base : Z, sndfstkbase = putx0 Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Letd k0 CheckFunction args = SomeIFreshq k
⊢
∃d0 : name c : class al : Z args0 : listvalue, Letd k0 CheckFunction args = Letd0 c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Letd k0 CheckFunction args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Letd k0 VaArgs args = SomeIFreshq k
Es :
⊢
∃d0 : name c : class al : Z args0 : listvalue, Letd k0 VaArgs args = Letd0 c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Letd k0 VaArgs args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
k0 :
o :
args :
listvalue
k :
Z → env × listname × optionZ × Memory.mem
H :
let e ≔ fr_envfr in
let locals ≔ fr_localsfr in
let* classes ≔ op_arg_classeso k0 in
let* xs ≔ map2_optionvalue_xge e classes args in
match op_reso k0 xs m with
SomeOpResr m′
⇒
Somebind_resd r e locals m′
SomeOpUBwhy
⇒
SomeIStopUBwhy
SomeOpAllocq kont
⇒
Some
λ base : Z  ⇒
let x, m′ ≔ kontbase in
putd x e, locals, m′
None
⇒
None
=
SomeIFreshq k
Es :
special_leto = false
⊢
∃d0 : name c : class al : Z args0 : listvalue, Letd k0 o args = Letd0 c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Letd k0 o args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Flightd o args lower = SomeIFreshq k
⊢
∃d0 : name c : class al : Z args0 : listvalue, Flightd o args lower = Letd0 c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Flightd o args lower = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m RawStorew off v a = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, RawStorew off v a = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, RawStorew off v a = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
es :
listeffect
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m RawStorePointeroff v a es = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, RawStorePointeroff v a es = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, RawStorePointeroff v a es = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Callr callee args = SomeIFreshq k
⊢
∃d : name c : class al : Z args0 : listvalue, Callr callee args = Letd c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Callr callee args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m RawCallr callee args = SomeIFreshq k
⊢
∃d : name c : class al : Z args0 : listvalue, RawCallr callee args = Letd c Allocal args0 ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, RawCallr callee args = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m LocalAllocx size = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstkbase = putx0 Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
file :
line :
Z
k :
Z → env × listname × optionZ × Memory.mem
H :
inst_stepge fr m Locfile line = SomeIFreshq k
⊢
∃d : name c : class al : Z args : listvalue, Locfile line = Letd c Allocal args ∧ ∀base : Z, sndfstkbase = fr_localsfr ∨ ∃x : name size : Z, Locfile line = LocalAllocx size ∧ ∀base : Z, sndfstkbase = putx Somebase fr_localsfr

all: unfold inst_step , external_call , bind_res , store_out in H ; cases H ; inversion H ; subst

2 open

ge :
fr :
m :
Memory.mem
d :
k0 :
o :
args :
listvalue
l :
listclass
Heqo0 :
op_arg_classeso k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Heqo2 :
op_reso k0 l0 m = SomeOpAllocq k1
Es :
special_leto = false
⊢
∃ d0 : name c : class al : Z args0 : listvalue  ,
Letd k0 o args = Letd0 c Allocal args0
∧
∀ base : Z  ,
snd
fst
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
∨
∃ x : name size : Z  ,
Letd k0 o args = LocalAllocx size
∧
∀ base : Z  ,
snd
fst
let x0, m′ ≔ k1base in
putd x0 fr_envfr, fr_localsfr, m′
=
putx Somebase fr_localsfr
focused goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

–match goal withE : op_res_ _ _ _ = SomeOpAlloc_ _ |- _⇒destruct op_res_alloc_op_ _ _ _ _ _ E as al →end

2 open

ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
⊢
∃ d0 : name c : class al0 : Z args0 : listvalue  ,
Letd k0 Allocal args = Letd0 c Allocal0 args0
∧
∀ base : Z  ,
snd
fst
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
∨
∃ x : name size : Z  ,
Letd k0 Allocal args = LocalAllocx size
∧
∀ base : Z  ,
snd
fst
let x0, m′ ≔ k1base in
putd x0 fr_envfr, fr_localsfr, m′
=
putx Somebase fr_localsfr
deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

left

2 open

ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
⊢
∃ d0 : name c : class al0 : Z args0 : listvalue  ,
Letd k0 Allocal args = Letd0 c Allocal0 args0
∧
∀ base : Z  ,
snd
fst
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

eexists ; eexists ; eexists ; eexists

6 open

ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
⊢
Letd k0 Allocal args = Let?d ?c Alloc?al ?args
∧
∀ base : Z  ,
snd
fst
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr
shelved goal
ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
⊢
shelved goal
ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
shelved goal
ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
⊢
Z
shelved goal
ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
⊢
listvalue

split ; reflexivity |

2 open

ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
⊢
∀ base : Z  ,
snd
fst
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

intros base

2 open

ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
base :
Z
⊢
snd
fst
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

simpl

2 open

ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
base :
Z
⊢
snd
fst
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

match goal with|- sndfstlet _, _ ≔ ?t in _ = _⇒destruct tend

2 open

ge :
fr :
m :
Memory.mem
d :
k0 :
args :
listvalue
l :
listclass
al :
Z
Heqo0 :
op_arg_classesAllocal k0 = Somel
l0 :
listword
Heqo1 :
map2_optionvalue_xge fr_envfr l args = Somel0
k1 :
Z → word × Memory.mem
H :
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
=
Some
λ base : Z  ⇒
let x, m′ ≔ k1base in
putd x fr_envfr, fr_localsfr, m′
Es :
special_letAllocal = false
Heqo2 :
op_resAllocal k0 l0 m = SomeOpAllocq k1
base :
Z
w :
m0 :
Memory.mem
⊢
sndfstputd w fr_envfr, fr_localsfr, m0 = fr_localsfr
deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

reflexivity

deferred goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃d : name c : class al : Z args : listvalue, LocalAllocx size = Letd c Allocal args ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = fr_localsfr ∨ ∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

–right

ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∃x0 : name size0 : Z, LocalAllocx size = LocalAllocx0 size0 ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx0 Somebase fr_localsfr

eexists ; eexists

3 open

ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
LocalAllocx size = LocalAlloc?x ?size ∧ ∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = put?x Somebase fr_localsfr
shelved goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
shelved goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
Z

split ; reflexivity |

ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
⊢
∀base : Z, sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx Somebase fr_localsfr

intros base

ge :
fr :
m :
Memory.mem
x :
size :
Z
Heqo :
lookupx fr_localsfr = SomeNone
H :
SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = SomeIFreshlocal_reqsize λbase : Z ⇒ fr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base
base :
Z
⊢
sndfstfr_envfr, putx Somebase fr_localsfr, allocatedm local_reqsize base = putx Somebase fr_localsfr

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge fr m i q k H
destruct i
1: destruct special_leto eqn: Es ; destruct o ; try discriminate Es | rewrite inst_step_let_ _ _ _ _ _ _ Es in H
all: unfold inst_step , external_call , bind_res , store_out in H ; cases H ; inversion H ; subst
–match goal withE : op_res_ _ _ _ = SomeOpAlloc_ _ |- _⇒destruct op_res_alloc_op_ _ _ _ _ _ E as al →end
left
eexists ; eexists ; eexists ; eexists
split ; reflexivity |
intros base
simpl
match goal with|- sndfstlet _, _ ≔ ?t in _ = _⇒destruct tend
reflexivity
–right
eexists ; eexists
split ; reflexivity |
intros base
reflexivity

An instruction that calls (ICall) the function g is a call or a raw call, and g is a function of the module.

84Lemma inst_step_call_shape
∀ ge fr m i g xs pd
inst_stepge fr m i = SomeICallg xs pd
InIFuncg ge_modulege ∧ ∃r callee args, i = Callr callee args ∨ ∃r callee args, i = RawCallr callee args
Explore proof 5 tactics

Initial goal

⊢
∀ge : genv fr : frame m : Memory.mem i : inst g : func xs : listword pd : pending, inst_stepge fr m i = SomeICallg xs pd → InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, i = Callr callee args ∨ ∃r : call_result callee : value args : listarg, i = RawCallr callee args

intros ge fr m i g xs pd H

ge :
fr :
m :
Memory.mem
i :
g :
xs :
listword
H :
inst_stepge fr m i = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, i = Callr callee args ∨ ∃r : call_result callee : value args : listarg, i = RawCallr callee args

destruct i

8 open

ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
g :
xs :
listword
H :
inst_stepge fr m Letd k o args = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args0 : listarg, Letd k o args = Callr callee args0 ∨ ∃r : call_result callee : value args0 : listarg, Letd k o args = RawCallr callee args0
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
g :
xs :
listword
H :
inst_stepge fr m Flightd o args lower = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args0 : listarg, Flightd o args lower = Callr callee args0 ∨ ∃r : call_result callee : value args0 : listarg, Flightd o args lower = RawCallr callee args0
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
g :
xs :
listword
H :
inst_stepge fr m RawStorew off v a = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, RawStorew off v a = Callr callee args ∨ ∃r : call_result callee : value args : listarg, RawStorew off v a = RawCallr callee args
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
es :
listeffect
g :
xs :
listword
H :
inst_stepge fr m RawStorePointeroff v a es = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, RawStorePointeroff v a es = Callr callee args ∨ ∃r : call_result callee : value args : listarg, RawStorePointeroff v a es = RawCallr callee args
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
g :
xs :
listword
H :
inst_stepge fr m Callr callee args = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r0 : call_result callee0 : value args0 : listarg, Callr callee args = Callr0 callee0 args0 ∨ ∃r0 : call_result callee0 : value args0 : listarg, Callr callee args = RawCallr0 callee0 args0
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
g :
xs :
listword
H :
inst_stepge fr m RawCallr callee args = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r0 : call_result callee0 : value args0 : listarg, RawCallr callee args = Callr0 callee0 args0 ∨ ∃r0 : call_result callee0 : value args0 : listarg, RawCallr callee args = RawCallr0 callee0 args0
focused goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
g :
xs :
listword
H :
inst_stepge fr m LocalAllocx size = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, LocalAllocx size = Callr callee args ∨ ∃r : call_result callee : value args : listarg, LocalAllocx size = RawCallr callee args
focused goal
ge :
fr :
m :
Memory.mem
file :
line :
Z
g :
xs :
listword
H :
inst_stepge fr m Locfile line = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, Locfile line = Callr callee args ∨ ∃r : call_result callee : value args : listarg, Locfile line = RawCallr callee args

1: destruct special_leto eqn: Es ; destruct o ; try discriminate Es | rewrite inst_step_let_ _ _ _ _ _ _ Es in H

11 open

ge :
fr :
m :
Memory.mem
d :
x :
off, bytes :
Z
align :
Z
args :
listvalue
g :
xs :
listword
H :
inst_stepge fr m Letd k CheckLocalx off bytes r align args = SomeICallg xs pd
Es :
special_letCheckLocalx off bytes r align = true
⊢
InIFuncg ge_modulege ∧ ∃r0 : call_result callee : value args0 : listarg, Letd k CheckLocalx off bytes r align args = Callr0 callee args0 ∨ ∃r0 : call_result callee : value args0 : listarg, Letd k CheckLocalx off bytes r align args = RawCallr0 callee args0
focused goal
ge :
fr :
m :
Memory.mem
d :
args :
listvalue
g :
xs :
listword
H :
inst_stepge fr m Letd k CheckFunction args = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args0 : listarg, Letd k CheckFunction args = Callr callee args0 ∨ ∃r : call_result callee : value args0 : listarg, Letd k CheckFunction args = RawCallr callee args0
focused goal
ge :
fr :
m :
Memory.mem
d :
args :
listvalue
g :
xs :
listword
H :
inst_stepge fr m Letd k VaArgs args = SomeICallg xs pd
Es :
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args0 : listarg, Letd k VaArgs args = Callr callee args0 ∨ ∃r : call_result callee : value args0 : listarg, Letd k VaArgs args = RawCallr callee args0
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
g :
xs :
listword
H :
let e ≔ fr_envfr in
let locals ≔ fr_localsfr in
let* classes ≔ op_arg_classeso k in
let* xs ≔ map2_optionvalue_xge e classes args in
match op_reso k xs m with
SomeOpResr m′
⇒
Somebind_resd r e locals m′
SomeOpUBwhy
⇒
SomeIStopUBwhy
SomeOpAllocq kont
⇒
Some
λ base : Z  ⇒
let x, m′ ≔ kontbase in
putd x e, locals, m′
None
⇒
None
=
SomeICallg xs pd
Es :
special_leto = false
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args0 : listarg, Letd k o args = Callr callee args0 ∨ ∃r : call_result callee : value args0 : listarg, Letd k o args = RawCallr callee args0
focused goal
ge :
fr :
m :
Memory.mem
d :
o :
args :
g :
xs :
listword
H :
inst_stepge fr m Flightd o args lower = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args0 : listarg, Flightd o args lower = Callr callee args0 ∨ ∃r : call_result callee : value args0 : listarg, Flightd o args lower = RawCallr callee args0
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
g :
xs :
listword
H :
inst_stepge fr m RawStorew off v a = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, RawStorew off v a = Callr callee args ∨ ∃r : call_result callee : value args : listarg, RawStorew off v a = RawCallr callee args
focused goal
ge :
fr :
m :
Memory.mem
off :
Z
v, a :
es :
listeffect
g :
xs :
listword
H :
inst_stepge fr m RawStorePointeroff v a es = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, RawStorePointeroff v a es = Callr callee args ∨ ∃r : call_result callee : value args : listarg, RawStorePointeroff v a es = RawCallr callee args
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
g :
xs :
listword
H :
inst_stepge fr m Callr callee args = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r0 : call_result callee0 : value args0 : listarg, Callr callee args = Callr0 callee0 args0 ∨ ∃r0 : call_result callee0 : value args0 : listarg, Callr callee args = RawCallr0 callee0 args0
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
g :
xs :
listword
H :
inst_stepge fr m RawCallr callee args = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r0 : call_result callee0 : value args0 : listarg, RawCallr callee args = Callr0 callee0 args0 ∨ ∃r0 : call_result callee0 : value args0 : listarg, RawCallr callee args = RawCallr0 callee0 args0
focused goal
ge :
fr :
m :
Memory.mem
x :
size :
Z
g :
xs :
listword
H :
inst_stepge fr m LocalAllocx size = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, LocalAllocx size = Callr callee args ∨ ∃r : call_result callee : value args : listarg, LocalAllocx size = RawCallr callee args
focused goal
ge :
fr :
m :
Memory.mem
file :
line :
Z
g :
xs :
listword
H :
inst_stepge fr m Locfile line = SomeICallg xs pd
⊢
InIFuncg ge_modulege ∧ ∃r : call_result callee : value args : listarg, Locfile line = Callr callee args ∨ ∃r : call_result callee : value args : listarg, Locfile line = RawCallr callee args

all: unfold inst_step , external_call , bind_res , store_out in H ; cases H ; inversion H ; subst

3 open

ge :
fr :
m :
Memory.mem
args :
listarg
g :
xs :
listword
s :
H :
SomeICallg xs pd_res ≔ r; pd_conv ≔ None = SomeICallg xs pd_res ≔ r; pd_conv ≔ None
Heqo :
map_optionarg_xge fr_envfr args = Somexs
Heqo0 :
find_fnge s = SomeDefinedg
⊢
InIFuncg ge_modulege ∧ ∃r0 : call_result callee : value args0 : listarg, Callr Globals args = Callr0 callee args0 ∨ ∃r0 : call_result callee : value args0 : listarg, Callr Globals args = RawCallr0 callee args0
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
g :
p :
Heqo :
value_xge fr_envfr F callee = SomeWPtrp
l :
listword
Heqo0 :
map_optionarg_xge fr_envfr args = Somel
r0 :
resunit
Heqo1 :
function_check_resge p = Somer0
x :
unit
Heqr1 :
f :
Heqc :
ptr_capp = Fnf
Heqo2 :
find_fnge f = SomeDefinedg
ys :
listword
words :
optionlistclass × listclass
H :
SomeICallg ys ++ skipnDatatypes.lengthfn_paramsg l pd_res ≔ r; pd_conv ≔ words = SomeICallg ys ++ skipnDatatypes.lengthfn_paramsg l pd_res ≔ r; pd_conv ≔ words
Heqb :
variadic_funcg = true
Heqo3 :
indirect_call_convg r args l = SomeConvertedys words
⊢
InIFuncg ge_modulege ∧ ∃r1 : call_result callee0 : value args0 : listarg, RawCallr callee args = Callr1 callee0 args0 ∨ ∃r1 : call_result callee0 : value args0 : listarg, RawCallr callee args = RawCallr1 callee0 args0
focused goal
ge :
fr :
m :
Memory.mem
callee :
args :
listarg
g :
p :
Heqo :
value_xge fr_envfr F callee = SomeWPtrp
l :
listword
Heqo0 :
map_optionarg_xge fr_envfr args = Somel
r0 :
resunit
Heqo1 :
function_check_resge p = Somer0
x :
unit
Heqr1 :
f :
Heqc :
ptr_capp = Fnf
Heqo2 :
find_fnge f = SomeDefinedg
ys :
listword
words :
optionlistclass × listclass
H :
SomeICallg ys ++ [ ] pd_res ≔ r; pd_conv ≔ words = SomeICallg ys ++ [ ] pd_res ≔ r; pd_conv ≔ words
Heqb :
variadic_funcg = false
Heqo3 :
indirect_call_convg r args l = SomeConvertedys words
⊢
InIFuncg ge_modulege ∧ ∃r1 : call_result callee0 : value args0 : listarg, RawCallr callee args = Callr1 callee0 args0 ∨ ∃r1 : call_result callee0 : value args0 : listarg, RawCallr callee args = RawCallr1 callee0 args0

all: split ; eapply find_fn_in ; eassumption | eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge fr m i g xs pd H
destruct i
1: destruct special_leto eqn: Es ; destruct o ; try discriminate Es | rewrite inst_step_let_ _ _ _ _ _ _ Es in H
all: unfold inst_step , external_call , bind_res , store_out in H ; cases H ; inversion H ; subst
all: split ; eapply find_fn_in ; eassumption | eauto

The evidence pass keeps no facts before a call (relies).

97Lemma call_relies
∀ s r callee args
reliess Callr callee args = false
Explore proof 1 tactics

Initial goal

⊢
∀s : src r : call_result callee : value args : listarg, reliess Callr callee args = false

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity

The pass keeps no facts before a raw call.

101Lemma raw_call_relies
∀ s r callee args
reliess RawCallr callee args = false
Explore proof 1 tactics

Initial goal

⊢
∀s : src r : call_result callee : value args : listarg, reliess RawCallr callee args = false

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity

The pass keeps no facts before an alloc.

105Lemma alloc_relies
∀ s d c al args
reliess Letd c Allocal args = false
Explore proof 2 tactics

Initial goal

⊢
∀s : src d : name c : class al : Z args : listvalue, reliess Letd c Allocal args = false

intros s d c al args

s :
d :
al :
Z
args :
listvalue
⊢
reliess Letd c Allocal args = false

destruct c ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s d c al args
destruct c ; reflexivity

The pass keeps no facts before a named local's allocation.

109Lemma local_alloc_relies
∀ s x size
reliess LocalAllocx size = false
Explore proof 1 tactics

Initial goal

⊢
∀s : src x : name size : Z, reliess LocalAllocx size = false

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity

The pass keeps its facts before every ahead-transparent instruction, one that may come between a check_ahead and its access.

114Lemma transparent_relies
∀ s i
reliess i = true
Explore proof 5 tactics

Initial goal

⊢
∀s : src i : inst, ahead_transparenti = true → reliess i = true

unfold ahead_transparent , relies

⊢
∀ s : src i : inst  ,
&&
match i with
Let_ _ Div _ | Let_ _ Udiv _ | Let_ _ Rem _ | Let_ _ Urem _
⇒
false
_
⇒
true
=
true
→
||
match raw_accessi with
Some_
⇒
true
None
⇒
false
=
true

intros s i H

s :
i :
H :
&&
match i with
Let_ _ Div _ | Let_ _ Udiv _ | Let_ _ Rem _ | Let_ _ Urem _
⇒
false
_
⇒
true
=
true
⊢
||
match raw_accessi with
Some_
⇒
true
None
⇒
false
=
true

apply andb_true_iff in H as H _

s :
i :
⊢
||
match raw_accessi with
Some_
⇒
true
None
⇒
false
=
true

rewrite H

s :
i :
⊢
||
match raw_accessi with
Some_
⇒
true
None
⇒
false
=
true

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s i H
apply andb_true_iff in H as H _
rewrite H
reflexivity

As doomed_result/5 in a frame fr that is not doomed: the result od is the instruction's result out as it is, or, for a doomed check_ahead, one that goes on with its pointer and dooms the frame.

122Lemma doomed_result_fresh
∀ ge fr m i out od
fr_doomedfr = None
doomed_resultge fr m i out = Someod
od = out, None ∨ ∃e w, od = IContinuee fr_localsfr m, Somew
Explore proof 12 tactics

Initial goal

⊢
∀ge : genv fr : frame m : Memory.mem i : inst out : inst_out od : inst_out × optionreason, fr_doomedfr = None → doomed_resultge fr m i out = Someod → od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

intros ge fr m i out od Hd H

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

destruct ahead_insti eqn: Ea

2 open

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = true
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew
focused goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

–destruct i as d k o args | | | | | | | ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m Letd k o args out = Someod
Ea :
ahead_instLetd k o args = true
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

destruct k ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m Letd A o args out = Someod
Ea :
ahead_instLetd A o args = true
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

destruct o ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
lo, hi :
Z
align, ahi :
Z
args :
listvalue
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m Letd A CheckAheadlo hi r align ahi args out = Someod
Ea :
ahead_instLetd A CheckAheadlo hi r align ahi args = true
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

destruct args as | v | v′ args ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
lo, hi :
Z
align, ahi :
Z
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m Letd A CheckAheadlo hi r align ahi v out = Someod
Ea :
ahead_instLetd A CheckAheadlo hi r align ahi v = true
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

unfold doomed_result in H

2 open

ge :
fr :
m :
Memory.mem
d :
lo, hi :
Z
align, ahi :
Z
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
match out with
⇒
let* p ≔ value_xge fr_envfr P v in
Some
match fr_doomedfr with
Somew
⇒
Somew
None
⇒
Somewhy
⇒
match fr_doomedfr with
Somewhy
⇒
match w with
⇒
Someout, fr_doomedfr
None
⇒
Someout, None
_
⇒
Someout, fr_doomedfr
=
Someod
Ea :
ahead_instLetd A CheckAheadlo hi r align ahi v = true
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

rewrite Hd in H

2 open

ge :
fr :
m :
Memory.mem
d :
lo, hi :
Z
align, ahi :
Z
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
match out with
⇒
let* p ≔ value_xge fr_envfr P v in
SomeIContinueputd p fr_envfr fr_localsfr m, Somewhy
_
⇒
Someout, None
=
Someod
Ea :
ahead_instLetd A CheckAheadlo hi r align ahi v = true
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

cases H ; inversion H ; subst ; eauto

deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

–rewrite doomed_result_other_ _ _ _ _ Ea in H

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
match out with
⇒
match fr_doomedfr with
Somewhy
⇒
match w with
⇒
Someout, fr_doomedfr
None
⇒
Someout, None
_
⇒
Someout, fr_doomedfr
=
Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

rewrite Hd in H

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr = None
H :
match out with
IContinue_ _ _ | _
⇒
Someout, None
=
Someod
Ea :
ahead_insti = false
⊢
od = out, None ∨ ∃e : env w : reason, od = IContinuee fr_localsfr m, Somew

cases H ; inversion H ; subst ; auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge fr m i out od Hd H
destruct ahead_insti eqn: Ea
–destruct i as d k o args | | | | | | | ; try discriminate Ea
destruct k ; try discriminate Ea
destruct o ; try discriminate Ea
destruct args as | v | v′ args ; try discriminate Ea
unfold doomed_result in H
rewrite Hd in H
cases H ; inversion H ; subst ; eauto
–rewrite doomed_result_other_ _ _ _ _ Ea in H
rewrite Hd in H
cases H ; inversion H ; subst ; auto

In a doomed frame, doomed_result/5 keeps it doomed, and the result is the instruction's own, a check_ahead that goes on, or an outcome.

135Lemma doomed_result_doomed
∀ ge fr m i out od
fr_doomedfr ≠ None
doomed_resultge fr m i out = Someod
sndod ≠ None ∧ fstod = out ∨ ∃e, fstod = IContinuee fr_localsfr m ∨ ∃o, fstod = IStopo
Explore proof 13 tactics

Initial goal

⊢
∀ge : genv fr : frame m : Memory.mem i : inst out : inst_out od : inst_out × optionreason, fr_doomedfr ≠ None → doomed_resultge fr m i out = Someod → sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

intros ge fr m i out od Hd H

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
Hd :
fr_doomedfr ≠ None
H :
doomed_resultge fr m i out = Someod
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

destruct fr_doomedfr as w0 | eqn: Ew ; | congruence

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

destruct ahead_insti eqn: Ea

2 open

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = true
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo
focused goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

–destruct i as d k o args | | | | | | | ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m Letd k o args out = Someod
Ea :
ahead_instLetd k o args = true
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o0 : outcome, fstod = IStopo0
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

destruct k ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
o :
args :
listvalue
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m Letd A o args out = Someod
Ea :
ahead_instLetd A o args = true
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o0 : outcome, fstod = IStopo0
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

destruct o ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
lo, hi :
Z
align, ahi :
Z
args :
listvalue
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m Letd A CheckAheadlo hi r align ahi args out = Someod
Ea :
ahead_instLetd A CheckAheadlo hi r align ahi args = true
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

destruct args as | v | v′ args ; try discriminate Ea

2 open

ge :
fr :
m :
Memory.mem
d :
lo, hi :
Z
align, ahi :
Z
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m Letd A CheckAheadlo hi r align ahi v out = Someod
Ea :
ahead_instLetd A CheckAheadlo hi r align ahi v = true
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

unfold doomed_result in H

2 open

ge :
fr :
m :
Memory.mem
d :
lo, hi :
Z
align, ahi :
Z
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
match out with
⇒
let* p ≔ value_xge fr_envfr P v in
Some
match fr_doomedfr with
Somew
⇒
Somew
None
⇒
Somewhy
⇒
match fr_doomedfr with
Somewhy
⇒
match w with
⇒
Someout, fr_doomedfr
None
⇒
Someout, None
_
⇒
Someout, fr_doomedfr
=
Someod
Ea :
ahead_instLetd A CheckAheadlo hi r align ahi v = true
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

rewrite Ew in H

2 open

⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo
deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

cases H ; inversion H ; subst ; simpl ; split ; discriminate | eauto

deferred goal
ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
doomed_resultge fr m i out = Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

–rewrite doomed_result_other_ _ _ _ _ Ea in H

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
match out with
⇒
match fr_doomedfr with
Somewhy
⇒
match w with
⇒
Someout, fr_doomedfr
None
⇒
Someout, None
_
⇒
Someout, fr_doomedfr
=
Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

rewrite Ew in H

ge :
fr :
m :
Memory.mem
i :
od :
inst_out × optionreason
w0 :
Ew :
fr_doomedfr = Somew0
Hd :
Somew0 ≠ None
H :
=
Someod
Ea :
ahead_insti = false
⊢
sndod ≠ None ∧ fstod = out ∨ ∃e : env, fstod = IContinuee fr_localsfr m ∨ ∃o : outcome, fstod = IStopo

cases H ; inversion H ; subst ; simpl ; split ; discriminate | eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge fr m i out od Hd H
destruct fr_doomedfr as w0 | eqn: Ew ; | congruence
destruct ahead_insti eqn: Ea
–destruct i as d k o args | | | | | | | ; try discriminate Ea
destruct k ; try discriminate Ea
destruct o ; try discriminate Ea
destruct args as | v | v′ args ; try discriminate Ea
unfold doomed_result in H
rewrite Ew in H
cases H ; inversion H ; subst ; simpl ; split ; discriminate | eauto
–rewrite doomed_result_other_ _ _ _ _ Ea in H
rewrite Ew in H
cases H ; inversion H ; subst ; simpl ; split ; discriminate | eauto

The next configuration after an instruction's result that is not an outcome: the same frame, at the instructions rest, with the new environment, locals and memory of a result that continues, or the callee's frame on top of the caller's, waiting at rest, for a call.

154Lemma inst_next_next
∀ c l rest j out d c′
inst_nextc l rest j out d = Nextc′
∃e1 l1 m1, out = IContinuee1 l1 m1 ∧ c′ = mkConfigmkFramefr_fnc_framec e1 l1 d Execl rest j c_callersc m1 c_fuelc ∨ ∃g xs pd callee, out = ICallg xs pd ∧ call_frameg xs = Somecallee ∧ c′ = mkConfigcallee mkFramefr_fnc_framec fr_envc_framec fr_localsc_framec d Execl rest j, pd :: c_callersc c_memc c_fuelc
Explore proof 10 tactics

Initial goal

⊢
∀c : config l : name rest : listinst j : jump out : inst_out d : optionreason c′ : config, inst_nextc l rest j out d = Nextc′ → ∃e1 : env l1 : listname × optionZ m1 : Memory.mem, out = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs : listword pd : pending callee : frame, out = ICallg xs pd ∧ call_frameg xs = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

unfold inst_next

⊢
∀ c : config l : name rest : listinst j : jump out : inst_out d : optionreason c′ : config  ,
match out with
IContinuee locals m′
⇒
Nextc_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
ICallg xs pd
⇒
match call_frameg xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
⇒
λ base : Z  ⇒
let p, m′ ≔ kbase in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
⇒
Stuck"outside the core subset"
=
Nextc′
→
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, out = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs : listword pd : pending callee : frame, out = ICallg xs pd ∧ call_frameg xs = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

intros c l rest j out d c′ H

l :
rest :
listinst
j :
d :
optionreason
c′ :
H :
match out with
IContinuee locals m′
⇒
Nextc_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
ICallg xs pd
⇒
match call_frameg xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
⇒
λ base : Z  ⇒
let p, m′ ≔ kbase in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
⇒
Stuck"outside the core subset"
=
Nextc′
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, out = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs : listword pd : pending callee : frame, out = ICallg xs pd ∧ call_frameg xs = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

destruct out ; try discriminate H

2 open

l :
rest :
listinst
j :
e :
locals :
listname × optionZ
m :
Memory.mem
d :
optionreason
c′ :
H :
Nextc_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m; c_fuel ≔ c_fuelc = Nextc′
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, IContinuee locals m = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs : listword pd : pending callee : frame, IContinuee locals m = ICallg xs pd ∧ call_frameg xs = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
focused goal
l :
rest :
listinst
j :
f :
xs :
listword
d :
optionreason
c′ :
H :
match call_framef xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
=
Nextc′
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, ICallf xs pd = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs0 : listword pd0 : pending callee : frame, ICallf xs pd = ICallg xs0 pd0 ∧ call_frameg xs0 = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd0 :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

–injection H as ←

2 open

l :
rest :
listinst
j :
e :
locals :
listname × optionZ
m :
Memory.mem
d :
optionreason
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, IContinuee locals m = IContinuee1 l1 m1 ∧ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m; c_fuel ≔ c_fuelc = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs : listword pd : pending callee : frame, IContinuee locals m = ICallg xs pd ∧ call_frameg xs = Somecallee ∧ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m; c_fuel ≔ c_fuelc = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
deferred goal
l :
rest :
listinst
j :
f :
xs :
listword
d :
optionreason
c′ :
H :
match call_framef xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
=
Nextc′
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, ICallf xs pd = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs0 : listword pd0 : pending callee : frame, ICallf xs pd = ICallg xs0 pd0 ∧ call_frameg xs0 = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd0 :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

left

2 open

l :
rest :
listinst
j :
e :
locals :
listname × optionZ
m :
Memory.mem
d :
optionreason
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, IContinuee locals m = IContinuee1 l1 m1 ∧ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m; c_fuel ≔ c_fuelc = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc
deferred goal
l :
rest :
listinst
j :
f :
xs :
listword
d :
optionreason
c′ :
H :
match call_framef xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
=
Nextc′
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, ICallf xs pd = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs0 : listword pd0 : pending callee : frame, ICallf xs pd = ICallg xs0 pd0 ∧ call_frameg xs0 = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd0 :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

eauto

deferred goal
l :
rest :
listinst
j :
f :
xs :
listword
d :
optionreason
c′ :
H :
match call_framef xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
=
Nextc′
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, ICallf xs pd = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs0 : listword pd0 : pending callee : frame, ICallf xs pd = ICallg xs0 pd0 ∧ call_frameg xs0 = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd0 :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

–destruct call_framef xs eqn: E ; | discriminate H

l :
rest :
listinst
j :
f :
xs :
listword
d :
optionreason
c′ :
f0 :
E :
call_framef xs = Somef0
H :
Nextc_frame ≔ f0; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc = Nextc′
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, ICallf xs pd = IContinuee1 l1 m1 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs0 : listword pd0 : pending callee : frame, ICallf xs pd = ICallg xs0 pd0 ∧ call_frameg xs0 = Somecallee ∧ c′ = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd0 :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

injection H as ←

l :
rest :
listinst
j :
f :
xs :
listword
d :
optionreason
f0 :
E :
call_framef xs = Somef0
⊢
∃e1 : env l1 : listname × optionZ m1 : Memory.mem, ICallf xs pd = IContinuee1 l1 m1 ∧ c_frame ≔ f0; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e1; fr_locals ≔ l1; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m1; c_fuel ≔ c_fuelc ∨ ∃g : func xs0 : listword pd0 : pending callee : frame, ICallf xs pd = ICallg xs0 pd0 ∧ call_frameg xs0 = Somecallee ∧ c_frame ≔ f0; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd0 :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

right

l :
rest :
listinst
j :
f :
xs :
listword
d :
optionreason
f0 :
E :
call_framef xs = Somef0
⊢
∃g : func xs0 : listword pd0 : pending callee : frame, ICallf xs pd = ICallg xs0 pd0 ∧ call_frameg xs0 = Somecallee ∧ c_frame ≔ f0; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc = c_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd0 :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc

eauto 7

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
unfold inst_next
intros c l rest j out d c′ H
destruct out ; try discriminate H
–injection H as ←
left
eauto
–destruct call_framef xs eqn: E ; | discriminate H
injection H as ←
right
eauto 7

After a result that allocates, the next configuration for each base the object can get is the same frame, at the instructions rest, with what the instruction makes of that base.

171Lemma inst_next_fresh
∀ c l rest j out d q k
inst_nextc l rest j out d = Freshq k
∃ k0  ,
out = IFreshq k0
∧
∀ base  ,
kbase
=
match k0base with
e, locals, m′
⇒
Explore proof 8 tactics

Initial goal

⊢
∀ c : config l : name rest : listinst j : jump out : inst_out d : optionreason q : alloc_req k : Z → config  ,
inst_nextc l rest j out d = Freshq k
→
∃ k0 : Z → env × listname × optionZ × Memory.mem  ,
out = IFreshq k0
∧
∀ base : Z  ,
kbase
=
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc

unfold inst_next

⊢
∀ c : config l : name rest : listinst j : jump out : inst_out d : optionreason q : alloc_req k : Z → config  ,
match out with
IContinuee locals m′
⇒
Nextc_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
ICallg xs pd
⇒
match call_frameg xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
IFreshq0 k0
⇒
λ base : Z  ⇒
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
⇒
Stuck"outside the core subset"
=
→
∃ k0 : Z → env × listname × optionZ × Memory.mem  ,
out = IFreshq k0
∧
∀ base : Z  ,
kbase
=
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc

intros c l rest j out d q k H

l :
rest :
listinst
j :
d :
optionreason
k :
Z → config
H :
match out with
IContinuee locals m′
⇒
Nextc_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
ICallg xs pd
⇒
match call_frameg xs with
Somecallee
⇒
Nextc_frame ≔ callee; c_callers ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ d; fr_at ≔ Execl rest j, pd :: c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc
None
⇒
Stuck"call"
⇒
λ base : Z  ⇒
let p, m′ ≔ kbase in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
⇒
Stuck"outside the core subset"
=
⊢
∃ k0 : Z → env × listname × optionZ × Memory.mem  ,
out = IFreshq k0
∧
∀ base : Z  ,
kbase
=
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc

destruct out ; try discriminate H;|match type of H withcontext [call_frame?g ?x]⇒destruct call_frameg xend;discriminate H|

l :
rest :
listinst
j :
k0 :
Z → env × listname × optionZ × Memory.mem
d :
optionreason
k :
Z → config
H :
λ base : Z  ⇒
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
=
⊢
∃ k1 : Z → env × listname × optionZ × Memory.mem  ,
IFreshq0 k0 = IFreshq k1
∧
∀ base : Z  ,
kbase
=
let p, m′ ≔ k1base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc

injection H as ← ←

l :
rest :
listinst
j :
k0 :
Z → env × listname × optionZ × Memory.mem
d :
optionreason
⊢
∃ k1 : Z → env × listname × optionZ × Memory.mem  ,
IFreshq0 k0 = IFreshq0 k1
∧
∀ base : Z  ,
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
=
let p, m′ ≔ k1base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc

eexists

2 open

l :
rest :
listinst
j :
k0 :
Z → env × listname × optionZ × Memory.mem
d :
optionreason
⊢
IFreshq0 k0 = IFreshq0 ?k0
∧
∀ base : Z  ,
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
=
let p, m′ ≔ ?k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
shelved goal
l :
rest :
listinst
j :
k0 :
Z → env × listname × optionZ × Memory.mem
d :
optionreason
⊢
Z → env × listname × optionZ × Memory.mem

split ; reflexivity |

l :
rest :
listinst
j :
k0 :
Z → env × listname × optionZ × Memory.mem
d :
optionreason
⊢
∀ base : Z  ,
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
=
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc

intros base

l :
rest :
listinst
j :
k0 :
Z → env × listname × optionZ × Memory.mem
d :
optionreason
base :
Z
⊢
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc
=
let p, m′ ≔ k0base in
let e, locals ≔ p in
c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ locals; fr_doomed ≔ d; fr_at ≔ Execl rest j; c_callers ≔ c_callersc; c_mem ≔ m′; c_fuel ≔ c_fuelc

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
unfold inst_next
intros c l rest j out d q k H
destruct out ; try discriminate H;|match type of H withcontext [call_frame?g ?x]⇒destruct call_frameg xend;discriminate H|
injection H as ← ←
eexists
split ; reflexivity |
intros base
reflexivity

A step at the instruction i that neither ends the run nor gets stuck runs in a frame that is not doomed or at an ahead-transparent i, and is inst_step, then doomed_result/5, then inst_next.

189Lemma step_exec_cons
∀ ge c l i rest j r
fr_atc_framec = Execl i :: rest j
stepge c = r
∀o, r ≠ Doneo
∀why, r ≠ Stuckwhy
fr_doomedc_framec = None ∨ ahead_transparenti = true ∧ ∃out0 od, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r
Explore proof 15 tactics

Initial goal

⊢
∀ge : genv c : config l : name i : inst rest : listinst j : jump r : step_result, fr_atc_framec = Execl i :: rest j → stepge c = r → ∀o : outcome, r ≠ Doneo → ∀why : string, r ≠ Stuckwhy → fr_doomedc_framec = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

intros ge c l i rest j r Ha Hs Hd Hst

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Hs :
stepge c = r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
fr_doomedc_framec = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

unfold step in Hs

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Hs :
match fr_atc_framec with
Snapshot_ :: _ as xs l
⇒
negbforallbsnapshot_word xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthxs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesxs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc
Enterl from
⇒
else
or_stuck"block"
Execl [ ] j
⇒
jump_stepge c l j
Execl i :: rest j
⇒
match let* why ≔ fr_doomedc_framec in if ahead_transparenti then None else Somewhy with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
fr_doomedc_framec = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

rewrite Ha in Hs

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Hs :
match let* why ≔ fr_doomedc_framec in if ahead_transparenti then None else Somewhy with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
fr_doomedc_framec = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

destruct fr_doomedc_framec as w | eqn: Ew

2 open

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
match if ahead_transparenti then None else Somew with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
Somew = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r
focused goal
ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
None = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

–destruct ahead_transparenti eqn: Et ; | subst r ; exfalso ; eapply Hd ; reflexivity

2 open

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Et :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
Somew = None ∨ true = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r
deferred goal
ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
None = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

split ; right ; reflexivity |

2 open

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Et :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r
deferred goal
ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
None = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

destruct inst_stepge c_framec c_memc i as out0 | eqn: Ei ; | subst r ; exfalso ; eapply Hst ; reflexivity

2 open

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Et :
out0 :
Ei :
inst_stepge c_framec c_memc i = Someout0
Hs :
or_stuck"instruction"
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
∃out1 : inst_out od : inst_out × optionreason, Someout0 = Someout1 ∧ doomed_resultge c_framec c_memc i out1 = Someod ∧ inst_nextc l rest j fstod sndod = r
deferred goal
ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
None = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

destruct doomed_resultge c_framec c_memc i out0 as od | eqn: Eo ; | subst r ; exfalso ; eapply Hst ; reflexivity

2 open

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Et :
out0 :
Ei :
inst_stepge c_framec c_memc i = Someout0
od :
inst_out × optionreason
Eo :
doomed_resultge c_framec c_memc i out0 = Someod
Hs :
or_stuck"instruction" Someinst_nextc l rest j fstod sndod = r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
∃out1 : inst_out od0 : inst_out × optionreason, Someout0 = Someout1 ∧ doomed_resultge c_framec c_memc i out1 = Someod0 ∧ inst_nextc l rest j fstod0 sndod0 = r
deferred goal
ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
None = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

exists out0, od

2 open

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Et :
out0 :
Ei :
inst_stepge c_framec c_memc i = Someout0
od :
inst_out × optionreason
Eo :
doomed_resultge c_framec c_memc i out0 = Someod
Hs :
or_stuck"instruction" Someinst_nextc l rest j fstod sndod = r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
Someout0 = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r
deferred goal
ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
None = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

split ; first exact Ei | reflexivity | split ; first exact Eo | reflexivity | exact Hs

deferred goal
ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
None = None ∨ ahead_transparenti = true ∧ ∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

–split ; left ; reflexivity |

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
Hs :
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
∃out0 : inst_out od : inst_out × optionreason, inst_stepge c_framec c_memc i = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

destruct inst_stepge c_framec c_memc i as out0 | eqn: Ei ; | subst r ; exfalso ; eapply Hst ; reflexivity

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
out0 :
Ei :
inst_stepge c_framec c_memc i = Someout0
Hs :
or_stuck"instruction"
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
∃out1 : inst_out od : inst_out × optionreason, Someout0 = Someout1 ∧ doomed_resultge c_framec c_memc i out1 = Someod ∧ inst_nextc l rest j fstod sndod = r

destruct doomed_resultge c_framec c_memc i out0 as od | eqn: Eo ; | subst r ; exfalso ; eapply Hst ; reflexivity

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
out0 :
Ei :
inst_stepge c_framec c_memc i = Someout0
od :
inst_out × optionreason
Eo :
doomed_resultge c_framec c_memc i out0 = Someod
Hs :
or_stuck"instruction" Someinst_nextc l rest j fstod sndod = r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
∃out1 : inst_out od0 : inst_out × optionreason, Someout0 = Someout1 ∧ doomed_resultge c_framec c_memc i out1 = Someod0 ∧ inst_nextc l rest j fstod0 sndod0 = r

exists out0, od

ge :
l :
i :
rest :
listinst
j :
Ha :
fr_atc_framec = Execl i :: rest j
Ew :
out0 :
Ei :
inst_stepge c_framec c_memc i = Someout0
od :
inst_out × optionreason
Eo :
doomed_resultge c_framec c_memc i out0 = Someod
Hs :
or_stuck"instruction" Someinst_nextc l rest j fstod sndod = r
Hd :
∀o : outcome, r ≠ Doneo
Hst :
∀why : string, r ≠ Stuckwhy
⊢
Someout0 = Someout0 ∧ doomed_resultge c_framec c_memc i out0 = Someod ∧ inst_nextc l rest j fstod sndod = r

split ; first exact Ei | reflexivity | split ; first exact Eo | reflexivity | exact Hs

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge c l i rest j r Ha Hs Hd Hst
unfold step in Hs
rewrite Ha in Hs
destruct fr_doomedc_framec as w | eqn: Ew
–destruct ahead_transparenti eqn: Et ; | subst r ; exfalso ; eapply Hd ; reflexivity
split ; right ; reflexivity |
destruct inst_stepge c_framec c_memc i as out0 | eqn: Ei ; | subst r ; exfalso ; eapply Hst ; reflexivity
destruct doomed_resultge c_framec c_memc i out0 as od | eqn: Eo ; | subst r ; exfalso ; eapply Hst ; reflexivity
exists out0, od
split ; first exact Ei | reflexivity | split ; first exact Eo | reflexivity | exact Hs
–split ; left ; reflexivity |
destruct inst_stepge c_framec c_memc i as out0 | eqn: Ei ; | subst r ; exfalso ; eapply Hst ; reflexivity
destruct doomed_resultge c_framec c_memc i out0 as od | eqn: Eo ; | subst r ; exfalso ; eapply Hst ; reflexivity
exists out0, od
split ; first exact Ei | reflexivity | split ; first exact Eo | reflexivity | exact Hs

Entering the block labelled l from the block from: the block is found, its phis bind the environment, and the frame goes on at the block's instructions with the same locals and memory, one fuel less.

217Lemma step_enter
∀ ge c l from c′
stepge c = Nextc′
Explore proof 9 tactics

Initial goal

⊢
∀ge : genv c : config l : name from : optionname c′ : config, fr_atc_framec = Enterl from → stepge c = Nextc′ → ∃b : block e : env, find_blockl fn_blocksfr_fnc_framec = Someb ∧ phis_envge b_phisb from fr_envc_framec = Somee ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

intros ge c l from c′ Ha H

ge :
l :
from :
optionname
c′ :
Ha :
H :
stepge c = Nextc′
⊢
∃b : block e : env, find_blockl fn_blocksfr_fnc_framec = Someb ∧ phis_envge b_phisb from fr_envc_framec = Somee ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

unfold step in H

ge :
l :
from :
optionname
c′ :
Ha :
H :
match fr_atc_framec with
Snapshot_ :: _ as xs l
⇒
negbforallbsnapshot_word xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthxs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesxs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc
Enterl from
⇒
else
or_stuck"block"
Execl [ ] j
⇒
jump_stepge c l j
Execl i :: rest j
⇒
match let* why ≔ fr_doomedc_framec in if ahead_transparenti then None else Somewhy with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
Nextc′
⊢
∃b : block e : env, find_blockl fn_blocksfr_fnc_framec = Someb ∧ phis_envge b_phisb from fr_envc_framec = Somee ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

rewrite Ha in H

ge :
l :
from :
optionname
c′ :
Ha :
H :
else
or_stuck"block"
=
Nextc′
⊢
∃b : block e : env, find_blockl fn_blocksfr_fnc_framec = Someb ∧ phis_envge b_phisb from fr_envc_framec = Somee ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

destruct c_fuelc =? 0 ; discriminate H |

ge :
l :
from :
optionname
c′ :
Ha :
H :
or_stuck"block"
=
Nextc′
⊢
∃b : block e : env, find_blockl fn_blocksfr_fnc_framec = Someb ∧ phis_envge b_phisb from fr_envc_framec = Somee ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

apply or_stuck_next in H

ge :
l :
from :
optionname
c′ :
Ha :
H :
=
SomeNextc′
⊢
∃b : block e : env, find_blockl fn_blocksfr_fnc_framec = Someb ∧ phis_envge b_phisb from fr_envc_framec = Somee ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

destruct find_block_ _ as b | ; | discriminate H

ge :
l :
from :
optionname
c′ :
Ha :
H :
let* e ≔ phis_envge b_phisb from fr_envc_framec in
=
SomeNextc′
⊢
∃b0 : block e : env, Someb = Someb0 ∧ phis_envge b_phisb0 from fr_envc_framec = Somee ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb0 b_jumpb0; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

destruct phis_envge b_phisb from fr_envc_framec as e | eqn: Ep ; | discriminate H

ge :
l :
from :
optionname
c′ :
Ha :
e :
Ep :
phis_envge b_phisb from fr_envc_framec = Somee
H :
SomeNextc_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1 = SomeNextc′
⊢
∃b0 : block e0 : env, Someb = Someb0 ∧ phis_envge b_phisb0 from fr_envc_framec = Somee0 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e0; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb0 b_jumpb0; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

injection H as ←

ge :
l :
from :
optionname
Ha :
e :
Ep :
phis_envge b_phisb from fr_envc_framec = Somee
⊢
∃b0 : block e0 : env, Someb = Someb0 ∧ phis_envge b_phisb0 from fr_envc_framec = Somee0 ∧ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1 = c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ e0; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Execl b_instsb0 b_jumpb0; c_callers ≔ c_callersc; c_mem ≔ c_memc; c_fuel ≔ c_fuelc − 1

eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge c l from c′ Ha H
unfold step in H
rewrite Ha in H
destruct c_fuelc =? 0 ; discriminate H |
apply or_stuck_next in H
destruct find_block_ _ as b | ; | discriminate H
destruct phis_envge b_phisb from fr_envc_framec as e | eqn: Ep ; | discriminate H
injection H as ←
eauto

Entering a block never allocates.

233Lemma step_enter_fresh
∀ ge c l from q k
stepge c ≠ Freshq k
Explore proof 9 tactics

Initial goal

⊢
∀ge : genv c : config l : name from : optionname q : alloc_req k : Z → config, fr_atc_framec = Enterl from → stepge c ≠ Freshq k

intros ge c l from q k Ha H

ge :
l :
from :
optionname
k :
Z → config
Ha :
H :
stepge c = Freshq k
⊢
False

unfold step in H

ge :
l :
from :
optionname
k :
Z → config
Ha :
H :
match fr_atc_framec with
Snapshot_ :: _ as xs l
⇒
negbforallbsnapshot_word xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthxs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesxs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc
Enterl from
⇒
else
or_stuck"block"
Execl [ ] j
⇒
jump_stepge c l j
Execl i :: rest j
⇒
match let* why ≔ fr_doomedc_framec in if ahead_transparenti then None else Somewhy with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
⊢
False

rewrite Ha in H

ge :
l :
from :
optionname
k :
Z → config
Ha :
H :
else
or_stuck"block"
=
⊢
False

destruct c_fuelc =? 0 ; discriminate H |

ge :
l :
from :
optionname
k :
Z → config
Ha :
H :
or_stuck"block"
=
⊢
False

apply or_stuck_fresh in H

ge :
l :
from :
optionname
k :
Z → config
Ha :
H :
=
SomeFreshq k
⊢
False

destruct find_block_ _ as b | ; simpl in H ; | discriminate H

ge :
l :
from :
optionname
k :
Z → config
Ha :
H :
let* e ≔ phis_envge b_phisb from fr_envc_framec in
=
SomeFreshq k
⊢
False

unfold phis_env in H

ge :
l :
from :
optionname
k :
Z → config
Ha :
H :
let* e ≔
match from with
Somepred
⇒
fold_left
λ acc : optionlistname × word ph : phi  ⇒
let* e ≔ acc in
match ph with
Phid k pairs
⇒
let* v ≔ lookuppred pairs in
let* x ≔ value_xge fr_envc_framec k v in
Someputd x e
None
⇒
match b_phisb with
[ ]
⇒
_ :: _
⇒
None
in
=
SomeFreshq k
⊢
False

destruct from ; | destruct b_phisb ; simpl in H ; try discriminate H

ge :
l, n :
k :
Z → config
Ha :
fr_atc_framec = Enterl Somen
H :
let* e ≔
fold_left
λ acc : optionlistname × word ph : phi  ⇒
let* e ≔ acc in
match ph with
Phid k pairs
⇒
let* v ≔ lookupn pairs in
let* x ≔ value_xge fr_envc_framec k v in
Someputd x e
in
=
SomeFreshq k
⊢
False

destruct fold_left_ _ _ ; discriminate H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge c l from q k Ha H
unfold step in H
rewrite Ha in H
destruct c_fuelc =? 0 ; discriminate H |
apply or_stuck_fresh in H
destruct find_block_ _ as b | ; simpl in H ; | discriminate H
unfold phis_env in H
destruct from ; | destruct b_phisb ; simpl in H ; try discriminate H
destruct fold_left_ _ _ ; discriminate H

A variadic callee's snapshot of its arguments xs enters the entry block l, with the same callers, function, locals and doom.

245Lemma step_snapshot
∀ ge c xs l c′
stepge c = Nextc′
Explore proof 5 tactics

Initial goal

⊢
∀ge : genv c : config xs : listword l : name c′ : config, fr_atc_framec = Snapshotxs l → stepge c = Nextc′ → c_callersc′ = c_callersc ∧ fr_fnc_framec′ = fr_fnc_framec ∧ fr_localsc_framec′ = fr_localsc_framec ∧ fr_doomedc_framec′ = fr_doomedc_framec ∧ fr_atc_framec′ = Enterl None

intros ge c xs l c′ Ha H

ge :
xs :
listword
l :
c′ :
H :
stepge c = Nextc′

unfold step in H

ge :
xs :
listword
l :
c′ :
H :
match fr_atc_framec with
Snapshot_ :: _ as xs l
⇒
negbforallbsnapshot_word xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthxs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesxs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc
Enterl from
⇒
else
or_stuck"block"
Execl [ ] j
⇒
jump_stepge c l j
Execl i :: rest j
⇒
match let* why ≔ fr_doomedc_framec in if ahead_transparenti then None else Somewhy with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
Nextc′

rewrite Ha in H

ge :
xs :
listword
l :
c′ :
H :
match xs with
_ :: _
⇒
negbforallbsnapshot_word xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthxs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesxs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc
=
Nextc′

destruct xs ; injection H as ← ; simpl ; auto |

ge :
w :
xs :
listword
l :
c′ :
Ha :
fr_atc_framec = Snapshotw :: xs l
H :
negbforallbsnapshot_word w :: xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthw :: xs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesw :: xs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthw :: xs base; c_fuel ≔ c_fuelc
=
Nextc′

destruct negb_ ; discriminate H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge c xs l c′ Ha H
unfold step in H
rewrite Ha in H
destruct xs ; injection H as ← ; simpl ; auto |
destruct negb_ ; discriminate H

Where a snapshot allocates, it enters the entry block l with the same callers, function, locals and doom, whatever base the object gets.

258Lemma step_snapshot_fresh
∀ ge c xs l q k base
stepge c = Freshq k
Explore proof 8 tactics

Initial goal

⊢
∀ge : genv c : config xs : listword l : name q : alloc_req k : Z → config, fr_atc_framec = Snapshotxs l → stepge c = Freshq k → ∀base : Z, c_callerskbase = c_callersc ∧ fr_fnc_framekbase = fr_fnc_framec ∧ fr_localsc_framekbase = fr_localsc_framec ∧ fr_doomedc_framekbase = fr_doomedc_framec ∧ fr_atc_framekbase = Enterl None

intros ge c xs l q k Ha H base

ge :
xs :
listword
l :
k :
Z → config
H :
stepge c = Freshq k
base :
Z
⊢

unfold step in H

ge :
xs :
listword
l :
k :
Z → config
H :
match fr_atc_framec with
Snapshot_ :: _ as xs l
⇒
negbforallbsnapshot_word xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthxs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesxs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc
Enterl from
⇒
else
or_stuck"block"
Execl [ ] j
⇒
jump_stepge c l j
Execl i :: rest j
⇒
match let* why ≔ fr_doomedc_framec in if ahead_transparenti then None else Somewhy with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stepge c_framec c_memc i in
let* od ≔ doomed_resultge c_framec c_memc i out0 in
Someinst_nextc l rest j fstod sndod
=
base :
Z
⊢

rewrite Ha in H

ge :
xs :
listword
l :
k :
Z → config
H :
match xs with
_ :: _
⇒
negbforallbsnapshot_word xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthxs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesxs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc
=
base :
Z
⊢

destruct xs ; discriminate H |

ge :
w :
xs :
listword
l :
k :
Z → config
Ha :
fr_atc_framec = Snapshotw :: xs l
H :
negbforallbsnapshot_word w :: xs
→
Stuck"snapshot"
else
Freshheap_req16 8 × Z.of_natDatatypes.lengthw :: xs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesw :: xs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthw :: xs base; c_fuel ≔ c_fuelc
=
base :
Z
⊢

destruct negb_ ; discriminate H |

ge :
w :
xs :
listword
l :
k :
Z → config
Ha :
fr_atc_framec = Snapshotw :: xs l
H :
Freshheap_req16 8 × Z.of_natDatatypes.lengthw :: xs λbase : Z ⇒ c_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ snapshot_valuesw :: xs base allocatedc_memc heap_req16 8 × Z.of_natDatatypes.lengthw :: xs base; c_fuel ≔ c_fuelc = Freshq k
base :
Z
⊢

injection H as _ ←

ge :
w :
xs :
listword
l :
Ha :
fr_atc_framec = Snapshotw :: xs l
base :
Z
⊢
c_callersc_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ match w with WIntn ⇒ snapshot_valuesxs base + 8 store_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 n | WPtrp ⇒ snapshot_valuesxs base + 8 store_auxstore_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 ptr_addrp base ptr_capp | WLimit_ _ ⇒ snapshot_valuesxs base + 8 allocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base end; c_fuel ≔ c_fuelc = c_callersc ∧ fr_fnc_framec_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ match w with WIntn ⇒ snapshot_valuesxs base + 8 store_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 n | WPtrp ⇒ snapshot_valuesxs base + 8 store_auxstore_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 ptr_addrp base ptr_capp | WLimit_ _ ⇒ snapshot_valuesxs base + 8 allocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base end; c_fuel ≔ c_fuelc = fr_fnc_framec ∧ fr_localsc_framec_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ match w with WIntn ⇒ snapshot_valuesxs base + 8 store_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 n | WPtrp ⇒ snapshot_valuesxs base + 8 store_auxstore_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 ptr_addrp base ptr_capp | WLimit_ _ ⇒ snapshot_valuesxs base + 8 allocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base end; c_fuel ≔ c_fuelc = fr_localsc_framec ∧ fr_doomedc_framec_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ match w with WIntn ⇒ snapshot_valuesxs base + 8 store_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 n | WPtrp ⇒ snapshot_valuesxs base + 8 store_auxstore_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 ptr_addrp base ptr_capp | WLimit_ _ ⇒ snapshot_valuesxs base + 8 allocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base end; c_fuel ≔ c_fuelc = fr_doomedc_framec ∧ fr_atc_framec_frame ≔ fr_fn ≔ fr_fnc_framec; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec; fr_locals ≔ fr_localsc_framec; fr_doomed ≔ fr_doomedc_framec; fr_at ≔ Enterl None; c_callers ≔ c_callersc; c_mem ≔ match w with WIntn ⇒ snapshot_valuesxs base + 8 store_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 n | WPtrp ⇒ snapshot_valuesxs base + 8 store_auxstore_bytesallocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base base 8 ptr_addrp base ptr_capp | WLimit_ _ ⇒ snapshot_valuesxs base + 8 allocatedc_memc heap_req16 Z.posPosDef.Pos.of_succ_natDatatypes.lengthxs~0~0~0 base end; c_fuel ≔ c_fuelc = Enterl None

simpl

ge :
w :
xs :
listword
l :
Ha :
fr_atc_framec = Snapshotw :: xs l
base :
Z

auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge c xs l q k Ha H base
unfold step in H
rewrite Ha in H
destruct xs ; discriminate H |
destruct negb_ ; discriminate H |
injection H as _ ←
simpl
auto

A return of the outcome o resumes the caller where it was waiting, with its function, locals, doom and point, and an environment given the callee's result.

273Lemma return_step_next
∀ c o c′
return_stepc o = Nextc′
∃caller pd callers e m′, c_callersc = caller, pd :: callers ∧ c′ = mkConfigmkFramefr_fncaller e fr_localscaller fr_doomedcaller fr_atcaller callers m′ c_fuelc
Explore proof 9 tactics

Initial goal

⊢
∀c : config o : outcome c′ : config, return_stepc o = Nextc′ → ∃caller : frame pd : pending callers : listframe × pending e : env m′ : Memory.mem, c_callersc = caller, pd :: callers ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m′; c_fuel ≔ c_fuelc

unfold return_step

⊢
∀ c : config o : outcome c′ : config  ,
or_stuck"return"
match c_callersc with
[ ]
⇒
SomeDoneo
caller, pd :: callers
⇒
let* o′ ≔
match pd_convpd with
Somecw, kw
⇒
None
⇒
Someo
in
let* e ≔ returned_envpd_respd o′ fr_envcaller in
SomeNextc_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc
=
Nextc′
→
∃caller : frame pd : pending callers : listframe × pending e : env m′ : Memory.mem, c_callersc = caller, pd :: callers ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m′; c_fuel ≔ c_fuelc

intros c o c′ H

c′ :
H :
or_stuck"return"
match c_callersc with
[ ]
⇒
SomeDoneo
caller, pd :: callers
⇒
let* o′ ≔
match pd_convpd with
Somecw, kw
⇒
None
⇒
Someo
in
let* e ≔ returned_envpd_respd o′ fr_envcaller in
SomeNextc_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc
=
Nextc′
⊢
∃caller : frame pd : pending callers : listframe × pending e : env m′ : Memory.mem, c_callersc = caller, pd :: callers ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m′; c_fuel ≔ c_fuelc

apply or_stuck_next in H

c′ :
H :
match c_callersc with
[ ]
⇒
SomeDoneo
caller, pd :: callers
⇒
let* o′ ≔
match pd_convpd with
Somecw, kw
⇒
None
⇒
Someo
in
let* e ≔ returned_envpd_respd o′ fr_envcaller in
SomeNextc_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc
=
SomeNextc′
⊢
∃caller : frame pd : pending callers : listframe × pending e : env m′ : Memory.mem, c_callersc = caller, pd :: callers ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m′; c_fuel ≔ c_fuelc

destruct invalidate_locals_ _ as m | ; | discriminate H

c′ :
m :
Memory.mem
H :
match c_callersc with
[ ]
⇒
SomeDoneo
caller, pd :: callers
⇒
let* o′ ≔
match pd_convpd with
Somecw, kw
⇒
None
⇒
Someo
in
let* e ≔ returned_envpd_respd o′ fr_envcaller in
SomeNextc_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc
=
SomeNextc′
⊢
∃caller : frame pd : pending callers : listframe × pending e : env m′ : Memory.mem, c_callersc = caller, pd :: callers ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m′; c_fuel ≔ c_fuelc

destruct c_callersc as | caller pd callers ; discriminate H |

c′ :
m :
Memory.mem
caller :
callers :
listframe × pending
H :
let* o′ ≔
match pd_convpd with
Somecw, kw
⇒
None
⇒
Someo
in
let* e ≔ returned_envpd_respd o′ fr_envcaller in
SomeNextc_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc
=
SomeNextc′
⊢
∃caller0 : frame pd0 : pending callers0 : listframe × pending e : env m′ : Memory.mem, caller, pd :: callers = caller0, pd0 :: callers0 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller0; fr_env ≔ e; fr_locals ≔ fr_localscaller0; fr_doomed ≔ fr_doomedcaller0; fr_at ≔ fr_atcaller0; c_callers ≔ callers0; c_mem ≔ m′; c_fuel ≔ c_fuelc

destruct match pd_convpd with None ⇒ Someo | Somecw, kw ⇒ converted_outcomecw kw o end ; | discriminate H

c′ :
m :
Memory.mem
caller :
callers :
listframe × pending
H :
let* e ≔ returned_envpd_respd o0 fr_envcaller in
SomeNextc_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc
=
SomeNextc′
⊢
∃caller0 : frame pd0 : pending callers0 : listframe × pending e : env m′ : Memory.mem, caller, pd :: callers = caller0, pd0 :: callers0 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller0; fr_env ≔ e; fr_locals ≔ fr_localscaller0; fr_doomed ≔ fr_doomedcaller0; fr_at ≔ fr_atcaller0; c_callers ≔ callers0; c_mem ≔ m′; c_fuel ≔ c_fuelc

destruct returned_env_ _ _ as e | ; | discriminate H

c′ :
m :
Memory.mem
caller :
callers :
listframe × pending
e :
H :
SomeNextc_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc = SomeNextc′
⊢
∃caller0 : frame pd0 : pending callers0 : listframe × pending e0 : env m′ : Memory.mem, caller, pd :: callers = caller0, pd0 :: callers0 ∧ c′ = c_frame ≔ fr_fn ≔ fr_fncaller0; fr_env ≔ e0; fr_locals ≔ fr_localscaller0; fr_doomed ≔ fr_doomedcaller0; fr_at ≔ fr_atcaller0; c_callers ≔ callers0; c_mem ≔ m′; c_fuel ≔ c_fuelc

injection H as ←

m :
Memory.mem
caller :
callers :
listframe × pending
e :
⊢
∃caller0 : frame pd0 : pending callers0 : listframe × pending e0 : env m′ : Memory.mem, caller, pd :: callers = caller0, pd0 :: callers0 ∧ c_frame ≔ fr_fn ≔ fr_fncaller; fr_env ≔ e; fr_locals ≔ fr_localscaller; fr_doomed ≔ fr_doomedcaller; fr_at ≔ fr_atcaller; c_callers ≔ callers; c_mem ≔ m; c_fuel ≔ c_fuelc = c_frame ≔ fr_fn ≔ fr_fncaller0; fr_env ≔ e0; fr_locals ≔ fr_localscaller0; fr_doomed ≔ fr_doomedcaller0; fr_at ≔ fr_atcaller0; c_callers ≔ callers0; c_mem ≔ m′; c_fuel ≔ c_fuelc

eauto 8

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros c o c′ H
apply or_stuck_next in H
destruct invalidate_locals_ _ as m | ; | discriminate H
destruct c_callersc as | caller pd callers ; discriminate H |
destruct match pd_convpd with None ⇒ Someo | Somecw, kw ⇒ converted_outcomecw kw o end ; | discriminate H
destruct returned_env_ _ _ as e | ; | discriminate H
injection H as ←
eauto 8

A raw call through q, whose pointer p passed its function check (function_check_res), does not stop as unchecked.

290Lemma raw_call_checked
∀ ge fr m r q args p why
lookupq fr_envfr = SomeWPtrp
inst_stepge fr m RawCallr Tmpq args ≠ SomeIStopUncheckedwhy
Explore proof 9 tactics

Initial goal

⊢
∀ge : genv fr : frame m : Memory.mem r : call_result q : name args : listarg p : ptr why : reason, lookupq fr_envfr = SomeWPtrp → function_check_resge p = Someok → inst_stepge fr m RawCallr Tmpq args ≠ SomeIStopUncheckedwhy

intros ge fr m r q args p why Hq Hc H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
H :
inst_stepge fr m RawCallr Tmpq args = SomeIStopUncheckedwhy
⊢
False

unfold inst_step , value_x in H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
H :
let* x ≔
let* x ≔ lookupq fr_envfr in
in
let* xs ≔ map_optionarg_xge fr_envfr args in
match x with
⇒
let* chk ≔ function_check_resge p in
match raw_reschk with
⇒
match ptr_capp with
⇒
match find_fnge g with
SomeDefinedgf
⇒
match indirect_call_convgf r args xs with
SomeConvTrapwhy
⇒
SomeIStopTrapwhy
SomeConvertedys words
⇒
Some
ys
++
→
skipnDatatypes.lengthfn_paramsgf xs
else
[ ]
pd_res ≔ r; pd_conv ≔ words
None
⇒
None
SomeOutsideg′
⇒
SomeICallOutsideg′
None
⇒
None
_
⇒
None
_
⇒
None
=
⊢
False

rewrite Hq in H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
H :
let* x ≔ word_at_classF WPtrp in
let* xs ≔ map_optionarg_xge fr_envfr args in
match x with
⇒
let* chk ≔ function_check_resge p in
match raw_reschk with
⇒
match ptr_capp with
⇒
match find_fnge g with
SomeDefinedgf
⇒
match indirect_call_convgf r args xs with
SomeConvTrapwhy
⇒
SomeIStopTrapwhy
SomeConvertedys words
⇒
Some
ys
++
→
skipnDatatypes.lengthfn_paramsgf xs
else
[ ]
pd_res ≔ r; pd_conv ≔ words
None
⇒
None
SomeOutsideg′
⇒
SomeICallOutsideg′
None
⇒
None
_
⇒
None
_
⇒
None
=
⊢
False

cbn [ word_at_class ] in H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
H :
let* xs ≔ map_optionarg_xge fr_envfr args in
let* chk ≔ function_check_resge p in
match raw_reschk with
⇒
match ptr_capp with
⇒
match find_fnge g with
SomeDefinedgf
⇒
match indirect_call_convgf r args xs with
SomeConvTrapwhy
⇒
SomeIStopTrapwhy
SomeConvertedys words
⇒
Some
ys
++
→
skipnDatatypes.lengthfn_paramsgf xs
else
[ ]
pd_res ≔ r; pd_conv ≔ words
None
⇒
None
SomeOutsideg′
⇒
SomeICallOutsideg′
None
⇒
None
_
⇒
None
=
⊢
False

destruct map_option_ args ; | discriminate H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
l :
listword
H :
let* chk ≔ function_check_resge p in
match raw_reschk with
⇒
match ptr_capp with
⇒
match find_fnge g with
SomeDefinedgf
⇒
match indirect_call_convgf r args l with
SomeConvTrapwhy
⇒
SomeIStopTrapwhy
SomeConvertedys words
⇒
Some
ys
++
→
skipnDatatypes.lengthfn_paramsgf l
else
[ ]
pd_res ≔ r; pd_conv ≔ words
None
⇒
None
SomeOutsideg′
⇒
SomeICallOutsideg′
None
⇒
None
_
⇒
None
=
⊢
False

cbv beta iota zeta in H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
l :
listword
H :
let* chk ≔ function_check_resge p in
match raw_reschk with
⇒
match ptr_capp with
⇒
match find_fnge g with
SomeDefinedgf
⇒
match indirect_call_convgf r args l with
SomeConvTrapwhy
⇒
SomeIStopTrapwhy
SomeConvertedys words
⇒
Some
ys
++
→
skipnDatatypes.lengthfn_paramsgf l
else
[ ]
pd_res ≔ r; pd_conv ≔ words
None
⇒
None
SomeOutsideg′
⇒
SomeICallOutsideg′
None
⇒
None
_
⇒
None
=
⊢
False

rewrite Hc in H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
l :
listword
H :
match raw_resok with
⇒
match ptr_capp with
⇒
match find_fnge g with
SomeDefinedgf
⇒
match indirect_call_convgf r args l with
SomeConvTrapwhy
⇒
SomeIStopTrapwhy
SomeConvertedys words
⇒
Some
ys
++
→
skipnDatatypes.lengthfn_paramsgf l
else
[ ]
pd_res ≔ r; pd_conv ≔ words
None
⇒
None
SomeOutsideg′
⇒
SomeICallOutsideg′
None
⇒
None
_
⇒
None
=
⊢
False

cbn [ raw_res ] in H

ge :
fr :
m :
Memory.mem
q :
args :
listarg
p :
why :
Hq :
lookupq fr_envfr = SomeWPtrp
Hc :
l :
listword
H :
match ptr_capp with
⇒
match find_fnge g with
SomeDefinedgf
⇒
match indirect_call_convgf r args l with
SomeConvTrapwhy
⇒
SomeIStopTrapwhy
SomeConvertedys words
⇒
Some
ys
++
→
skipnDatatypes.lengthfn_paramsgf l
else
[ ]
pd_res ≔ r; pd_conv ≔ words
None
⇒
None
SomeOutsideg′
⇒
SomeICallOutsideg′
None
⇒
None
_
⇒
None
=
⊢
False

cases H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge fr m r q args p why Hq Hc H
unfold inst_step , value_x in H
rewrite Hq in H
cbn [ word_at_class ] in H
destruct map_option_ args ; | discriminate H
cbv beta iota zeta in H
rewrite Hc in H
cbn [ raw_res ] in H