Fil-C on Nix

Filnix wiki

the formal campaign

rocq/theories/ExternalMachine.v

Campaign 4's guarded, labelled extension of Machine.v (milestone 2): a machine whose steps carry the external call events of ExternalCalls.v.

Existing machine steps are silent and unchanged. A direct call of an unresolved, non-data name other than free can invoke a registered contract, only in a frame that is not doomed. A completed call carries its observations and exact runtime/memory/world snapshot.

Contract violations are specification failures, NOT native traps. Coverage and caller admissibility are checked independently of an invocation's existence. Admissible contracts may still have no completed invocation: native coverage, blocking/divergence and independent external prefixes remain obligations, not safety claims. This extension is relational; the extracted driver is unchanged.

From Stdlib Require Import String ZArith List Bool Lia
From Nanofil Require Import Term Maps Syntax Cfg Values Memory Runtime Ops Semantics Machine Validate Identity ExternalCalls Walk Steps Invariant Persistence Single
Import ListNotations
Open Scope Z_scope
Open Scope list_scope

Dispatch and the return channel

A direct call about to run: its block label, the call's result (where the returned words go), the called global's name, the argument syntax, and the instructions and jump that follow it in the block.

31Record call_site: Type ≔ mkCallSite
site_label
 : name
site_result
site_name
 : name
site_args
 : listarg
site_rest
 : listinst
site_jump
 : jump

In the global environment ge, the configuration c is at the external call site: its frame is not doomed, its next instruction is a direct call of site's global name, and that name is neither a function of the module (defined or outside the core subset, find_fn), nor global data, nor free. This preserves core dispatch precedence: free remains the runtime's operation. In particular a doomed call cannot use this rule to escape Ahead.

48Definition external_sitege : genv c : config site : call_site : Prop ≔
let fr ≔ c_framec in
fr_doomedfr = None ∧ fr_atfr = Execsite_labelsite Callsite_resultsite Globalsite_namesite site_argssite :: site_restsite site_jumpsite ∧ find_fnge site_namesite = None ∧ lookupsite_namesite ge_globalsge = None ∧ name_eqbsite_namesite free_name = false

The outcome a call's returned words xs make under the declared return type ty: RetVoid for void, Ret for a scalar, Rets for any tuple; none when void or scalar gets the wrong number of words. The declared shape, not list length, selects the return channel.

60Definition external_outcomety : ret_type xs : listword : optionoutcome ≔
match ty, xs with
RVoid, [ ]
⇒
RClass_, x
⇒
SomeRetx
RTuple_, _
⇒
SomeRetsxs
_, _
⇒
None

Words of the declared return_shape always make an outcome.

69Lemma external_outcome_total
∀ ty xs
∃o, external_outcomety xs = Someo
Explore proof 10 tactics

Initial goal

⊢
∀ty : ret_type xs : listword, return_shapety xs → ∃o : outcome, external_outcomety xs = Someo

intros ty xs H

xs :
listword
H :
⊢
∃o : outcome, external_outcomety xs = Someo

destruct ty ; simpl in H

3 open

xs :
listword
H :
∃x : word, xs = x ∧ word_at_classk x = Somex
⊢
∃o : outcome, external_outcomeRClassk xs = Someo
focused goal
xs :
listword
H :
xs = [ ]
⊢
∃o : outcome, external_outcomeRVoid xs = Someo
focused goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
∃o : outcome, external_outcomeRTupleks xs = Someo

–destruct H as x & → & _

3 open

x :
⊢
∃o : outcome, external_outcomeRClassk x = Someo
deferred goal
xs :
listword
H :
xs = [ ]
⊢
∃o : outcome, external_outcomeRVoid xs = Someo
deferred goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
∃o : outcome, external_outcomeRTupleks xs = Someo

eexists

4 open

x :
⊢
deferred goal
xs :
listword
H :
xs = [ ]
⊢
∃o : outcome, external_outcomeRVoid xs = Someo
deferred goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
∃o : outcome, external_outcomeRTupleks xs = Someo
shelved goal

reflexivity

2 open

deferred goal
xs :
listword
H :
xs = [ ]
⊢
∃o : outcome, external_outcomeRVoid xs = Someo
deferred goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
∃o : outcome, external_outcomeRTupleks xs = Someo

–subst xs

2 open

⊢
∃o : outcome, external_outcomeRVoid [ ] = Someo
deferred goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
∃o : outcome, external_outcomeRTupleks xs = Someo

eexists

3 open

⊢
external_outcomeRVoid [ ] = Some?o
deferred goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
∃o : outcome, external_outcomeRTupleks xs = Someo
shelved goal

reflexivity

deferred goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
∃o : outcome, external_outcomeRTupleks xs = Someo

–eexists

2 open

ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs
⊢
external_outcomeRTupleks xs = Some?o
shelved goal
ks :
listclass
xs :
listword
H :
Forall2λk : class x : word ⇒ word_at_classk x = Somex ks xs

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ty xs H
destruct ty ; simpl in H
–destruct H as x & → & _
eexists
reflexivity
–subst xs
eexists
reflexivity
–eexists
reflexivity

The caller's environment e with the words xs a call of the contract spec returned bound as the site's result reads them (returned_env, as call_outcome_result/5); none if the declared return channel and the site's result do not fit.

82Definition external_envworld : Type spec : contractworld site : call_site xs : listword e : env : optionenv ≔

The configuration after an external call returns: the same function, locals, callers and fuel, with environment e and memory m, at the instruction after the call.

90Definition resume_externalc : config site : call_site e : env m : Memory.mem : config ≔

How a call site fails its contract: no contract is registered for the name, an argument does not evaluate, the ABI or the precondition does not hold, or the returned words do not fit the call's result. These are specification failures, not Fil-C traps.

99Inductive violation: Type ≔
|MissingContract
|BadArguments
|BadABI
|BadPrecondition
|BadReturn

Why the labelled machine stopped: a core outcome, a stuck core step with its diagnostic, a process exit with its status from an external call, or a contract violation at the call of symbol.

104Inductive ending: Type ≔
|CoreEnd
o : outcome
|CoreStuck
diagnostic : string
|ExternalExit
status : Z
|ContractViolation
symbol : name why : violation

At an external_site, the core Semantics.step is stuck on the instruction, so no core continuation or allocation can compete with contract dispatch. Runtime safepoints (poll) remain.

113Lemma external_site_stuck
∀ ge c site
external_sitege c site
Semantics.stepge c = Stuck"instruction"
Explore proof 9 tactics

Initial goal

⊢
∀ge : genv c : config site : call_site, external_sitege c site → stepge c = Stuck"instruction"

intros ge c site Hd & Ha & Hfn & Hdata & Hfree

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
⊢
stepge c = Stuck"instruction"

unfold Semantics.step

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
⊢
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
=
Stuck"instruction"

rewrite Ha , Hd

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
⊢
or_stuck"instruction"
Someinst_nextc site_labelsite site_restsite site_jumpsite fstod sndod
=
Stuck"instruction"

unfold inst_step

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
⊢
or_stuck"instruction"
let* out0 ≔
let* xs ≔ map_optionarg_xge fr_envc_framec site_argssite in
match find_fnge site_namesite with
in
Someinst_nextc site_labelsite site_restsite site_jumpsite fstod sndod
=
Stuck"instruction"

destruct map_optionarg_xge fr_envc_framec site_argssite ; | reflexivity

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
l :
listword
⊢
or_stuck"instruction"
let* out0 ≔
match find_fnge site_namesite with
in
Someinst_nextc site_labelsite site_restsite site_jumpsite fstod sndod
=
Stuck"instruction"

rewrite Hfn

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
l :
listword
⊢
or_stuck"instruction"
=
Stuck"instruction"

unfold external_call

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
l :
listword
⊢
or_stuck"instruction"
let* out0 ≔
match lookupsite_namesite ge_globalsge with
None
⇒
else
match site_resultsite with
⇒
match site_argssite with
⇒
match l with
[ ]
⇒
None
x
⇒
match ge_freege x c_memc with
Somer′, m′
⇒
None
⇒
None
x :: _ :: _
⇒
None
_
⇒
None
_
⇒
None
in
Someinst_nextc site_labelsite site_restsite site_jumpsite fstod sndod
=
Stuck"instruction"

rewrite Hdata , Hfree

ge :
site :
Hd :
Hfn :
find_fnge site_namesite = None
Hdata :
Hfree :
l :
listword
⊢
or_stuck"instruction"
let* out0 ≔
negbfalse
→
None
else
match site_resultsite with
⇒
match site_argssite with
⇒
match l with
[ ]
⇒
None
x
⇒
match ge_freege x c_memc with
Somer′, m′
⇒
None
⇒
None
x :: _ :: _
⇒
None
_
⇒
None
_
⇒
None
in
Someinst_nextc site_labelsite site_restsite site_jumpsite fstod sndod
=
Stuck"instruction"

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge c site Hd & Ha & Hfn & Hdata & Hfree
rewrite Ha , Hd
unfold inst_step
destruct map_optionarg_xge fr_envc_framec site_argssite ; | reflexivity
rewrite Hfn
rewrite Hdata , Hfree
reflexivity

The labelled machine

The labelled machine over any runtime R, with the call relations (E), the evidence invariant (P) and the single definition invariant (S) instantiated at R.

127Module ExternalMachine R : Runtime
129Module E ≔ ExternalCalls R
130Module P ≔ Persistence R
131Module S ≔ Single R
Import P.I P.I.RM

A core machine step (mstep) is also a step of the copy of the machine inside the single-definition functor. The two invariant functors instantiate the same core machine, but its inductive relation is generative; copy only its constructors.

138Lemma single_core_step
∀ ge ms ms′
mstepge ms ms′
S.ID.RM.mstepge ms ms′
Explore proof 2 tactics

Initial goal

⊢
∀ge : genv ms ms′ : mstate, mstepge ms ms′ → S.ID.RM.mstepge ms ms′

intros ge ms ms′ H

ge :
ms, ms′ :
H :
mstepge ms ms′
⊢
S.ID.RM.mstepge ms ms′

destruct H ; eapply S.ID.RM.mstep_next | eapply S.ID.RM.mstep_alloc | eapply S.ID.RM.mstep_safepoint ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge ms ms′ H
destruct H ; eapply S.ID.RM.mstep_next | eapply S.ID.RM.mstep_alloc | eapply S.ID.RM.mstep_safepoint ; eauto

At an external_site, the only core machine step is a safepoint (poll): it is due there, the runtime acts on memory, and the call point stays in place. A contract's precondition is then checked in the post-safepoint state.

145Lemma external_core_safepoint
∀ ge c s c′ s′ site
external_sitege c site
mstepge c, s c′, s′
safepoint_duege c = true ∧ ∃m′, c′ = with_memc m′ ∧ R.safepoints c_memc s′ m′
Explore proof 4 tactics

Initial goal

⊢
∀ge : genv c : config s : R.state c′ : config s′ : R.state site : call_site, external_sitege c site → mstepge c, s c′, s′ → safepoint_duege c = true ∧ ∃m′ : Memory.mem, c′ = with_memc m′ ∧ R.safepoints c_memc s′ m′

intros ge c s c′ s′ site Hsite H

ge :
c′ :
s′ :
site :
Hsite :
external_sitege c site
H :
mstepge c, s c′, s′
⊢
safepoint_duege c = true ∧ ∃m′ : Memory.mem, c′ = with_memc m′ ∧ R.safepoints c_memc s′ m′

pose proof external_site_stuck_ _ _ Hsite as Hstuck

ge :
c′ :
s′ :
site :
Hsite :
external_sitege c site
H :
mstepge c, s c′, s′
Hstuck :
stepge c = Stuck"instruction"
⊢
safepoint_duege c = true ∧ ∃m′ : Memory.mem, c′ = with_memc m′ ∧ R.safepoints c_memc s′ m′

inversion H ; subst ; try congruence

ge :
s, s′ :
site :
Hsite :
external_sitege c site
m′ :
Memory.mem
H :
mstepge c, s with_memc m′, s′
Hstuck :
stepge c = Stuck"instruction"
H3 :
safepoint_duege c = true
H5 :
R.safepoints c_memc s′ m′
⊢
safepoint_duege c = true ∧ ∃m'0 : Memory.mem, with_memc m′ = with_memc m'0 ∧ R.safepoints c_memc s′ m'0

eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge c s c′ s′ site Hsite H
pose proof external_site_stuck_ _ _ Hsite as Hstuck
inversion H ; subst ; try congruence
eauto

Everything below is over one type world of logical libc state, shared by all registered contracts.

156Section World
157Variable world : Type

A labelled machine state: a core machine state (configuration and runtime state) and the world, either running or stopped with an ending.

162Inductive state: Type ≔
|Running
machine : mstate w : world
|Stopped
why : ending machine : mstate w : world

The core machine state inside st.

167Definition machine_ofst : state : mstate ≔
match st with
Runningms _ | Stopped_ ms _
⇒
ms

The runtime is ready in st's machine state.

171Definition state_readyst : state : Prop ≔

The call at site is admissible under the registry (each name's contract, if any) in configuration c and world w: a contract is registered, the arguments evaluate to words xs, and the ABI and the precondition hold. These obligations are at the call site, not conditional on there being an invoke derivation. Negating pre does not grant a libc trap.

179Definition admissibleregistry : name → optioncontractworld ge : genv c : config w : world site : call_site : Prop ≔
∃spec xs, registrysite_namesite = Somespec ∧ map_optionarg_xge fr_envc_framec site_argssite = Somexs ∧ contract_abispec site_resultsite site_argssite ∧ contract_prespec xs c_memc w

Why the call at site is rejected, checked in order: no registered contract, an argument that does not evaluate, a false ABI premise, or a false precondition. Each is the violation of the same name; a bad return is caught after the call, by step_bad_return.

190Inductive rejectedregistry : name → optioncontractworld ge : genv c : config w : world site : call_site : violation → Prop ≔
registrysite_namesite = None
reject_missing
rejectedregistry ge c w site MissingContract
∀ spec
registrysite_namesite = Somespec
reject_arguments
rejectedregistry ge c w site BadArguments
∀ spec xs
registrysite_namesite = Somespec
reject_abi
rejectedregistry ge c w site BadABI
∀ spec xs
registrysite_namesite = Somespec
¬contract_prespec xs c_memc w
reject_pre
rejectedregistry ge c w site BadPrecondition

One labelled step under the registry, with its events:

  • a core machine step (mstep), silent;
  • a core terminal, stuck step or allocation refusal, where no external call is due, stopping with the configuration as it was;
  • a completed call at an external_site: a return resumes at the next instruction with the call's memory, runtime state and world (resume_external), an exit or resource ending stops with them;
  • a rejected call, or a return the site's result cannot take, stopping with a ContractViolation.
216Inductive stepregistry : name → optioncontractworld ge : genv : state → listevent → state → Prop ≔
∀ ms ms′ w
mstepge ms ms′
step_core
stepregistry ge Runningms w [ ] Runningms′ w

Core terminals retain an observation snapshot. Done contains no final memory: e.g. a top-level return discards its invalidated locals.

∀ c s w o
∀site, ¬external_sitege c site
step_core_end
stepregistry ge Runningc, s w [ ] StoppedCoreEndo c, s w
∀ c s w why
∀site, ¬external_sitege c site
step_core_stuck
stepregistry ge Runningc, s w [ ] StoppedCoreStuckwhy c, s w
∀ c s w q k
∀site, ¬external_sitege c site
0 ≤ req_extentq
R.allocs q = None
step_core_refusal
stepregistry ge Runningc, s w [ ] StoppedCoreEndTrapOutOfMemory c, s w
∀ c s w site spec xs trace values s′ m′ w′ e
external_sitege c site
registrysite_namesite = Somespec
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
external_envspec site values fr_envc_framec = Somee
step_return
stepregistry ge Runningc, s w trace Runningresume_externalc site e m′, s′ w′
∀ c s w site spec xs trace status s′ m′ w′
external_sitege c site
registrysite_namesite = Somespec
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallExitstatus s′ m′ w′
step_exit
stepregistry ge Runningc, s w trace StoppedExternalExitstatus with_memc m′, s′ w′
∀ c s w site spec xs trace why s′ m′ w′
external_sitege c site
registrysite_namesite = Somespec
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallResourcewhy s′ m′ w′
step_resource
stepregistry ge Runningc, s w trace StoppedCoreEndTrapwhy with_memc m′, s′ w′
∀ c s w site why
external_sitege c site
rejectedregistry ge c w site why
step_rejected
stepregistry ge Runningc, s w [ ] StoppedContractViolationsite_namesite why c, s w
∀ c s w site spec xs trace values s′ m′ w′
external_sitege c site
registrysite_namesite = Somespec
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
external_envspec site values fr_envc_framec = None
step_bad_return
stepregistry ge Runningc, s w trace StoppedContractViolationsite_namesite BadReturn with_memc m′, s′ w′

A finite labelled run: a sequence of steps whose events are concatenated in order. Completed calls are atomic here. prefix remains independent: this is not yet a native prefix or totality semantics.

270Inductive runregistry : name → optioncontractworld ge : genv : state → listevent → state → Prop ≔
∀ st
runregistry ge st [ ] st
run_refl
∀ st trace mid tail last
stepregistry ge st trace mid
runregistry ge mid tail last
run_cons
runregistry ge st trace ++ tail last

No running state reached from start can step to a ContractViolation. Safety against specification failures is about EVERY reached state, not merely the ending a chosen path happens to take. A safepoint that later repairs pre cannot erase an earlier rejection.

282Definition no_violationregistry : name → optioncontractworld ge : genv start : state : Prop ≔
∀prefix ms w trace symbol why ms′ w′, runregistry ge start prefix Runningms w → ¬stepregistry ge Runningms w trace StoppedContractViolationsymbol why ms′ w′

Where there is no_violation from start, no external call reached from it is rejected.

289Lemma no_violation_rejected
∀ registry ge start prefix c s w site why
no_violationregistry ge start
runregistry ge start prefix Runningc, s w
external_sitege c site
¬rejectedregistry ge c w site why
Explore proof 2 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv start : state prefix : listevent c : config s : R.state w : world site : call_site why : violation, no_violationregistry ge start → runregistry ge start prefix Runningc, s w → external_sitege c site → ¬rejectedregistry ge c w site why

intros registry ge start prefix c s w site why Hsafe Hrun Hsite Hbad

world :
Type
registry :
name → optioncontractworld
ge :
start :
prefix :
listevent
w :
world
site :
Hsafe :
no_violationregistry ge start
Hrun :
runregistry ge start prefix Runningc, s w
Hsite :
external_sitege c site
Hbad :
rejectedregistry ge c w site why
⊢
False

exact Hsafe_ _ _ _ _ _ _ _ Hrun step_rejected_ _ _ _ _ _ _ Hsite Hbad

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge start prefix c s w site why Hsafe Hrun Hsite Hbad
exact Hsafe_ _ _ _ _ _ _ _ Hrun step_rejected_ _ _ _ _ _ _ Hsite Hbad

A stopped state does not step.

298Lemma stopped_no_step
∀ registry ge why ms w trace st
¬stepregistry ge Stoppedwhy ms w trace st
Explore proof 2 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv why : ending ms : mstate w : world trace : listevent st : state, ¬stepregistry ge Stoppedwhy ms w trace st

intros registry ge why ms w trace st H

world :
Type
registry :
name → optioncontractworld
ge :
why :
ms :
w :
world
trace :
listevent
st :
H :
stepregistry ge Stoppedwhy ms w trace st
⊢
False

inversion H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge why ms w trace st H
inversion H

Where no external call is due, a step observes nothing.

303Lemma non_external_silent
∀ registry ge c s w trace st
∀site, ¬external_sitege c site
stepregistry ge Runningc, s w trace st
trace = [ ]
Explore proof 2 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv c : config s : R.state w : world trace : listevent st : state, ∀site : call_site, ¬external_sitege c site → stepregistry ge Runningc, s w trace st → trace = [ ]

intros registry ge c s w trace st Hnone H

world :
Type
registry :
name → optioncontractworld
ge :
w :
world
trace :
listevent
st :
Hnone :
∀site : call_site, ¬external_sitege c site
H :
stepregistry ge Runningc, s w trace st
⊢
trace = [ ]

inversion H ; subst ; try reflexivity ; exfalso ; eapply Hnone ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge c s w trace st Hnone H
inversion H ; subst ; try reflexivity ; exfalso ; eapply Hnone ; eauto

A step that stops with Unchecked why is the old core's own ending: external calls never produce it. This does not prove arbitrary frees or doomed runs safe.

310Lemma unchecked_is_core
∀ registry ge c s w trace ms′ w′ why
stepregistry ge Runningc, s w trace StoppedCoreEndUncheckedwhy ms′ w′
Explore proof 2 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv c : config s : R.state w : world trace : listevent ms′ : mstate w′ : world why : reason, stepregistry ge Runningc, s w trace StoppedCoreEndUncheckedwhy ms′ w′ → Semantics.stepge c = DoneUncheckedwhy

intros registry ge c s w trace ms′ w′ why H

world :
Type
registry :
name → optioncontractworld
ge :
w :
world
trace :
listevent
ms′ :
w′ :
world
why :
H :
stepregistry ge Runningc, s w trace StoppedCoreEndUncheckedwhy ms′ w′

inversion H ; subst ; assumption

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge c s w trace ms′ w′ why H
inversion H ; subst ; assumption

An admissible call is not rejected.

316Lemma admissible_not_rejected
∀ registry ge c w site why
admissibleregistry ge c w site
¬rejectedregistry ge c w site why
Explore proof 2 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv c : config w : world site : call_site why : violation, admissibleregistry ge c w site → ¬rejectedregistry ge c w site why

intros registry ge c w site why spec & xs & Hr & Hx & Ha & Hp H

world :
Type
registry :
name → optioncontractworld
ge :
w :
world
site :
spec :
xs :
listword
Hr :
registrysite_namesite = Somespec
Hp :
H :
rejectedregistry ge c w site why
⊢
False

destruct H ; try congruence

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge c w site why spec & xs & Hr & Hx & Ha & Hp H
destruct H ; try congruence

A labelled step keeps the runtime ready, where the global environment's free is the runtime's.

325Theorem step_ready
∀ registry ge st trace st′
ge_freege = R.free
stepregistry ge st trace st′
Explore proof 3 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv st : state trace : listevent st′ : state, ge_freege = R.free → stepregistry ge st trace st′ → state_readyst → state_readyst′

intros registry ge st trace st′ Hfree H

world :
Type
registry :
name → optioncontractworld
ge :
st :
trace :
listevent
st′ :
Hfree :
ge_freege = R.free
H :
stepregistry ge st trace st′
⊢

destruct H ; simpl ; intros Hr ; try exact Hr ; try solve eapply mstep_ready ; eauto

4 open

world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
⊢
state_readyRunningresume_externalc site e m′, s′ w′
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
status :
Z
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallExitstatus s′ m′ w′
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
why :
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallResourcewhy s′ m′ w′
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = None

all: exact proj1E.invoke_preserve_ _ _ _ _ _ _ _ _ _ _ _ _ H2 Hr

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge st trace st′ Hfree H
destruct H ; simpl ; intros Hr ; try exact Hr ; try solve eapply mstep_ready ; eauto
all: exact proj1E.invoke_preserve_ _ _ _ _ _ _ _ _ _ _ _ _ H2 Hr

From a ready state, every object of the memory before a labelled step persists into the memory after it.

335Theorem step_persists
∀ registry ge st trace st′
ge_freege = R.free
stepregistry ge st trace st′
Explore proof 4 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv st : state trace : listevent st′ : state, ge_freege = R.free → stepregistry ge st trace st′ → state_readyst → persistsc_memfstmachine_ofst c_memfstmachine_ofst′

intros registry ge st trace st′ Hfree H

world :
Type
registry :
name → optioncontractworld
ge :
st :
trace :
listevent
st′ :
Hfree :
ge_freege = R.free
H :
stepregistry ge st trace st′

destruct H ; simpl ; intros Hr ; try apply persists_refl

5 open

world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
ms, ms′ :
w :
world
H :
mstepge ms ms′
⊢
persistsc_memfstms c_memfstms′
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
status :
Z
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallExitstatus s′ m′ w′
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
why :
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallResourcewhy s′ m′ w′
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = None
⊢

1: exact S.ID.mstep_persists_ _ _ Hfree Hr single_core_step_ _ _ H

4 open

world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
status :
Z
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallExitstatus s′ m′ w′
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
why :
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallResourcewhy s′ m′ w′
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = None
⊢

all: exact proj2E.invoke_preserve_ _ _ _ _ _ _ _ _ _ _ _ _ H2 Hr

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge st trace st′ Hfree H
destruct H ; simpl ; intros Hr ; try apply persists_refl
1: exact S.ID.mstep_persists_ _ _ Hfree Hr single_core_step_ _ _ H
all: exact proj2E.invoke_preserve_ _ _ _ _ _ _ _ _ _ _ _ _ H2 Hr

Continuations and Campaign 3

Resuming after an external call keeps the evidence invariant inv of a module md: the call kills the frame's live facts, so the frame is parked there (call_parked) and resumes with any result and memory (parked_resume).

351Lemma resume_inv
∀ ge md c s site e m′ s′
external_sitege c site
invge md c, s
invge md resume_externalc site e m′, s′
Explore proof 3 tactics

Initial goal

world :
Type
⊢
∀ge : genv md : module c : config s : R.state site : call_site e : env m′ : Memory.mem s′ : R.state, external_sitege c site → invge md c, s → invge md resume_externalc site e m′, s′

intros ge md c s site e m′ s′ Hd & Ha & _ Hfr Hcs

world :
Type
ge :
md :
site :
e :
m′ :
Memory.mem
s′ :
Hd :
Hfr :
frame_okge md c_memfstc, s c_framefstc, s
Hcs :
Forallλfp : frame × pending ⇒ parkedmd fstfp c_callersfstc, s
⊢
invge md resume_externalc site e m′, s′

split ; | exact Hcs

world :
Type
ge :
md :
site :
e :
m′ :
Memory.mem
s′ :
Hd :
Hfr :
frame_okge md c_memfstc, s c_framefstc, s
Hcs :
Forallλfp : frame × pending ⇒ parkedmd fstfp c_callersfstc, s
⊢
frame_okge md c_memfstresume_externalc site e m′, s′ c_framefstresume_externalc site e m′, s′

exact parked_resumege md m′ mkFramefr_fnc_framec fr_envc_framec fr_localsc_framec None Execsite_labelsite site_restsite site_jumpsite e call_parked_ _ _ _ _ _ _ _ _ _ Hfr Hd Ha

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge md c s site e m′ s′ Hd & Ha & _ Hfr Hcs
split ; | exact Hcs
exact parked_resumege md m′ mkFramefr_fnc_framec fr_envc_framec fr_localsc_framec None Execsite_labelsite site_restsite site_jumpsite e call_parked_ _ _ _ _ _ _ _ _ _ Hfr Hd Ha

Binding a call's returned values changes no temporary a but the names the site's result defines (result_names).

363Lemma external_env_other
∀ spec : contractworld site values old e a
external_envspec site values old = Somee
lookupa e = lookupa old
Explore proof 4 tactics

Initial goal

world :
Type
⊢
∀spec : contractworld site : call_site values : listword old e : env a : name, external_envspec site values old = Somee → ¬Ina result_namessite_resultsite → lookupa e = lookupa old

intros spec site values old e a H Ha

world :
Type
spec :
site :
values :
listword
old, e :
a :
H :
external_envspec site values old = Somee
⊢
lookupa e = lookupa old

unfold external_env in H

world :
Type
spec :
site :
values :
listword
old, e :
a :
H :
=
Somee
⊢
lookupa e = lookupa old

destruct external_outcome_ _ as o | ; | discriminate H

world :
Type
spec :
site :
values :
listword
old, e :
a :
H :
returned_envsite_resultsite o old = Somee
⊢
lookupa e = lookupa old

exact returned_env_other_ _ _ _ _ H Ha

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros spec site values old e a H Ha
unfold external_env in H
destruct external_outcome_ _ as o | ; | discriminate H
exact returned_env_other_ _ _ _ _ H Ha

Resuming after an external call keeps the single definition invariant sinv of a checked_module md, where the call's memory m' persists from the old: the result names are its only new definitions, and waiting callers keep their scopes.

376Lemma resume_sinv
∀ ge md c site spec : contractworld values e m′
external_sitege c site
external_envspec site values fr_envc_framec = Somee
sinvge md c
sinvge md resume_externalc site e m′
Explore proof 26 tactics

Initial goal

world :
Type
⊢
∀ge : genv md : module c : config site : call_site spec : contractworld values : listword e : env m′ : Memory.mem, checked_modulemd → external_sitege c site → external_envspec site values fr_envc_framec = Somee → persistsc_memc m′ → sinvge md c → sinvge md resume_externalc site e m′

intros ge md c site spec values e m′ Hmd Hd & Ha & _ He Hp Hsh Hsc Hcs

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
Hsh :
Hsc :
Hcs :
Forallwaitingge md c_memc c_callersc
⊢
sinvge md resume_externalc site e m′

destruct Hsc as Hdoom | Hsc ; contradiction |

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
Hsh :
Hcs :
Forallwaitingge md c_memc c_callersc
⊢
sinvge md resume_externalc site e m′

unfold shaped in Hsh

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
Hsh :
∧
match fr_atc_framec with
Enterl from
⇒
is_reachableSites.fn_domsfr_fnc_framec l = true ∧ from = None → entry_labelfr_fnc_framec = Somel
Execl is j
⇒
is_reachableSites.fn_domsfr_fnc_framec l = true ∧ ∃b : block k : nat, find_blockl fn_blocksfr_fnc_framec = Someb ∧ k ≤ Datatypes.lengthb_instsb%nat ∧ is = skipnk b_instsb ∧ j = b_jumpb
Hcs :
Forallwaitingge md c_memc c_callersc
⊢
sinvge md resume_externalc site e m′

cbv zeta in Hsh

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
Hsh :
∧
match fr_atc_framec with
Enterl from
⇒
is_reachableSites.fn_domsfr_fnc_framec l = true ∧ from = None → entry_labelfr_fnc_framec = Somel
Execl is j
⇒
is_reachableSites.fn_domsfr_fnc_framec l = true ∧ ∃b : block k : nat, find_blockl fn_blocksfr_fnc_framec = Someb ∧ k ≤ Datatypes.lengthb_instsb%nat ∧ is = skipnk b_instsb ∧ j = b_jumpb
Hcs :
Forallwaitingge md c_memc c_callersc
⊢
sinvge md resume_externalc site e m′

rewrite Ha in Hsh

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
Hsh :
InIFuncfr_fnc_framec md ∧ is_reachableSites.fn_domsfr_fnc_framec site_labelsite = true ∧ ∃b : block k : nat, find_blocksite_labelsite fn_blocksfr_fnc_framec = Someb ∧ k ≤ Datatypes.lengthb_instsb%nat ∧ Callsite_resultsite Globalsite_namesite site_argssite :: site_restsite = skipnk b_instsb ∧ site_jumpsite = b_jumpb
Hcs :
Forallwaitingge md c_memc c_callersc
⊢
sinvge md resume_externalc site e m′

destruct Hsh as Hin & Hr & b & k & Hb & Hk & Hsk & Hj

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
⊢
sinvge md resume_externalc site e m′

destruct skipn_cons_ _ _ _ _ eq_symHsk as Hki & Hrest & Hlen

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
⊢
sinvge md resume_externalc site e m′

assert Hpt0 : point_sitefr_fnc_framec fr_atc_framec = Somesite_labelsite, Z.of_natk by rewrite Ha , Hsk ; exact point_site_exec_ _ _ _ _ Hb Hk

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
⊢
sinvge md resume_externalc site e m′

assert Hpt1 : point_sitefr_fnc_framec Execsite_labelsite site_restsite site_jumpsite = Somesite_labelsite, Z.of_natSk by rewrite <- Hrest ; exact point_site_exec_ _ _ _ _ Hb Hlen

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
sinvge md resume_externalc site e m′

split ; | exact callers_mem_ _ _ _ _ Hcs Hp

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
runningge md c_memresume_externalc site e m′ c_frameresume_externalc site e m′

split

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
focused goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

–unfold shaped

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
∧
match fr_atc_frameresume_externalc site e m′ with
Enterl from
⇒
is_reachableSites.fn_domsfr_fnc_frameresume_externalc site e m′ l = true ∧ from = None → entry_labelfr_fnc_frameresume_externalc site e m′ = Somel
Execl is j
⇒
is_reachableSites.fn_domsfr_fnc_frameresume_externalc site e m′ l = true ∧ ∃b0 : block k0 : nat, find_blockl fn_blocksfr_fnc_frameresume_externalc site e m′ = Someb0 ∧ k0 ≤ Datatypes.lengthb_instsb0%nat ∧ is = skipnk0 b_instsb0 ∧ j = b_jumpb0
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

cbv zeta

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
∧
match fr_atc_frameresume_externalc site e m′ with
Enterl from
⇒
is_reachableSites.fn_domsfr_fnc_frameresume_externalc site e m′ l = true ∧ from = None → entry_labelfr_fnc_frameresume_externalc site e m′ = Somel
Execl is j
⇒
is_reachableSites.fn_domsfr_fnc_frameresume_externalc site e m′ l = true ∧ ∃b0 : block k0 : nat, find_blockl fn_blocksfr_fnc_frameresume_externalc site e m′ = Someb0 ∧ k0 ≤ Datatypes.lengthb_instsb0%nat ∧ is = skipnk0 b_instsb0 ∧ j = b_jumpb0
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

simpl

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
InIFuncfr_fnc_framec md ∧ is_reachableSites.fn_domsfr_fnc_framec site_labelsite = true ∧ ∃b0 : block k0 : nat, find_blocksite_labelsite fn_blocksfr_fnc_framec = Someb0 ∧ k0 ≤ Datatypes.lengthb_instsb0%nat ∧ site_restsite = skipnk0 b_instsb0 ∧ site_jumpsite = b_jumpb0
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

split ; exact Hin |

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
is_reachableSites.fn_domsfr_fnc_framec site_labelsite = true ∧ ∃b0 : block k0 : nat, find_blocksite_labelsite fn_blocksfr_fnc_framec = Someb0 ∧ k0 ≤ Datatypes.lengthb_instsb0%nat ∧ site_restsite = skipnk0 b_instsb0 ∧ site_jumpsite = b_jumpb0
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

split ; exact Hr |

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
∃b0 : block k0 : nat, find_blocksite_labelsite fn_blocksfr_fnc_framec = Someb0 ∧ k0 ≤ Datatypes.lengthb_instsb0%nat ∧ site_restsite = skipnk0 b_instsb0 ∧ site_jumpsite = b_jumpb0
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

exists b, Sk

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
find_blocksite_labelsite fn_blocksfr_fnc_framec = Someb ∧ Sk ≤ Datatypes.lengthb_instsb%nat ∧ site_restsite = skipnSk b_instsb ∧ site_jumpsite = b_jumpb
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

split ; exact Hb |

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
Sk ≤ Datatypes.lengthb_instsb%nat ∧ site_restsite = skipnSk b_instsb ∧ site_jumpsite = b_jumpb
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

split ; exact Hlen |

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
site_restsite = skipnSk b_instsb ∧ site_jumpsite = b_jumpb
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

split ; symmetry ; exact Hrest | exact Hj

deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
⊢
fr_doomedc_frameresume_externalc site e m′ ≠ None ∨ scope_holdsge c_frameresume_externalc site e m′ c_memresume_externalc site e m′

–right

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :

refine scope_step_ _ c_framec c_frameresume_externalc site e m′ _ _ _ _ _ Callsite_resultsite Globalsite_namesite site_argssite Hmd Hin eq_refl Hr Hb Hki Hpt0 Hpt1 _ Hp _ Hsc

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
focused goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :

+rewrite call_defs

2 open

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :

exact λa Hn ⇒ external_env_other_ _ _ _ _ _ He Hn

deferred goal
world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :

+intros n Hrp

world :
Type
ge :
md :
site :
spec :
values :
listword
e :
m′ :
Memory.mem
Hd :
He :
external_envspec site values fr_envc_framec = Somee
Hp :
k :
nat
Hk :
k ≤ Datatypes.lengthb_instsb%nat
Hsk :
Hj :
Hcs :
Forallwaitingge md c_memc c_callersc
Hki :
nth_errorb_instsb k = SomeCallsite_resultsite Globalsite_namesite site_argssite
Hrest :
skipnSk b_instsb = site_restsite
Hlen :
Sk ≤ Datatypes.lengthb_instsb%nat
Hpt0 :
Hpt1 :
n :

discriminate Hrp

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ge md c site spec values e m′ Hmd Hd & Ha & _ He Hp Hsh Hsc Hcs
destruct Hsc as Hdoom | Hsc ; contradiction |
unfold shaped in Hsh
cbv zeta in Hsh
rewrite Ha in Hsh
destruct Hsh as Hin & Hr & b & k & Hb & Hk & Hsk & Hj
destruct skipn_cons_ _ _ _ _ eq_symHsk as Hki & Hrest & Hlen
assert Hpt0 : point_sitefr_fnc_framec fr_atc_framec = Somesite_labelsite, Z.of_natk by rewrite Ha , Hsk ; exact point_site_exec_ _ _ _ _ Hb Hk
assert Hpt1 : point_sitefr_fnc_framec Execsite_labelsite site_restsite site_jumpsite = Somesite_labelsite, Z.of_natSk by rewrite <- Hrest ; exact point_site_exec_ _ _ _ _ Hb Hlen
split ; | exact callers_mem_ _ _ _ _ Hcs Hp
split
–unfold shaped
cbv zeta
simpl
split ; exact Hin |
split ; exact Hr |
exists b, Sk
split ; exact Hb |
split ; exact Hlen |
split ; symmetry ; exact Hrest | exact Hj
–right
refine scope_step_ _ c_framec c_frameresume_externalc site e m′ _ _ _ _ _ Callsite_resultsite Globalsite_namesite site_argssite Hmd Hin eq_refl Hr Hb Hki Hpt0 Hpt1 _ Hp _ Hsc
+rewrite call_defs
exact λa Hn ⇒ external_env_other_ _ _ _ _ _ He Hn
+intros n Hrp
discriminate Hrp

The evidence invariant inv of a running state; nothing of a stopped one. Terminal snapshots retain memory and readiness, not active-frame facts. Only a returned call has a caller continuation to re-establish.

405Definition evidence_invge : genv md : module st : state : Prop ≔
match st with
⇒
invge md ms
Stopped_ _ _
⇒
True

The single definition invariant sinv of a running state's configuration; nothing of a stopped one.

410Definition single_invge : genv md : module st : state : Prop ≔
match st with
⇒
sinvge md fstms
Stopped_ _ _
⇒
True

A labelled step from a ready state keeps evidence_inv of the environment's checked_module md.

415Theorem step_inv
∀ registry ge md st trace st′
ge_modulege = md
stepregistry ge st trace st′
evidence_invge md st
evidence_invge md st′
Explore proof 4 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv md : module st : state trace : listevent st′ : state, ge_modulege = md → checked_modulemd → stepregistry ge st trace st′ → state_readyst → evidence_invge md st → evidence_invge md st′

intros registry ge md st trace st′ Hge Hmd H

world :
Type
registry :
name → optioncontractworld
ge :
md :
st :
trace :
listevent
st′ :
Hge :
ge_modulege = md
H :
stepregistry ge st trace st′
⊢
state_readyst → evidence_invge md st → evidence_invge md st′

destruct H ; simpl ; intros Hr Hi ; try exact I

2 open

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
ms, ms′ :
w :
world
H :
mstepge ms ms′
Hi :
invge md ms
⊢
invge md ms′
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
Hi :
invge md c, s
⊢
invge md resume_externalc site e m′, s′

–eapply P.mstep_inv ; eauto

deferred goal
world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
Hi :
invge md c, s
⊢
invge md resume_externalc site e m′, s′

–eapply resume_inv ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge md st trace st′ Hge Hmd H
destruct H ; simpl ; intros Hr Hi ; try exact I
–eapply P.mstep_inv ; eauto
–eapply resume_inv ; eauto

A labelled step from a ready state keeps single_inv of the environment's checked_module md, where its free is the runtime's.

426Theorem step_sinv
∀ registry ge md st trace st′
ge_modulege = md
ge_freege = R.free
stepregistry ge st trace st′
single_invge md st
single_invge md st′
Explore proof 5 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv md : module st : state trace : listevent st′ : state, ge_modulege = md → checked_modulemd → ge_freege = R.free → stepregistry ge st trace st′ → state_readyst → single_invge md st → single_invge md st′

intros registry ge md st trace st′ Hge Hmd Hfree H

world :
Type
registry :
name → optioncontractworld
ge :
md :
st :
trace :
listevent
st′ :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
H :
stepregistry ge st trace st′
⊢
state_readyst → single_invge md st → single_invge md st′

destruct H ; simpl ; intros Hr Hi ; try exact I

2 open

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
ms, ms′ :
w :
world
H :
mstepge ms ms′
Hi :
sinvge md fstms
⊢
sinvge md fstms′
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
Hi :
sinvge md c
⊢
sinvge md resume_externalc site e m′

–exact S.mstep_sinv_ _ _ _ Hge Hmd Hfree Hr single_core_step_ _ _ H Hi

deferred goal
world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
Hi :
sinvge md c
⊢
sinvge md resume_externalc site e m′

–eapply resume_sinv ; eauto

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
w :
world
site :
spec :
xs :
listword
trace :
listevent
values :
listword
s′ :
m′ :
Memory.mem
w′ :
world
e :
H :
external_sitege c site
H0 :
registrysite_namesite = Somespec
H2 :
E.invokespec site_resultsite site_argssite xs s c_memc w trace CallReturnvalues s′ m′ w′
H3 :
external_envspec site values fr_envc_framec = Somee
Hi :
sinvge md c
⊢

exact proj2E.invoke_preserve_ _ _ _ _ _ _ _ _ _ _ _ _ H2 Hr

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge md st trace st′ Hge Hmd Hfree H
destruct H ; simpl ; intros Hr Hi ; try exact I
–exact S.mstep_sinv_ _ _ _ Hge Hmd Hfree Hr single_core_step_ _ _ H Hi
–eapply resume_sinv ; eauto
exact proj2E.invoke_preserve_ _ _ _ _ _ _ _ _ _ _ _ _ H2 Hr

The four structural guarantees for every finite labelled run of a checked_module md, from a state that has them: the runtime stays ready, objects persist, and evidence_inv and single_inv hold at the end. No completeness or absence of contract violations follows from them.

440Theorem run_preserve
∀ registry ge md st trace st′
ge_modulege = md
ge_freege = R.free
runregistry ge st trace st′
evidence_invge md st
single_invge md st
state_readyst′ ∧ persistsc_memfstmachine_ofst c_memfstmachine_ofst′ ∧ evidence_invge md st′ ∧ single_invge md st′
Explore proof 10 tactics

Initial goal

world :
Type
⊢
∀registry : name → optioncontractworld ge : genv md : module st : state trace : listevent st′ : state, ge_modulege = md → checked_modulemd → ge_freege = R.free → runregistry ge st trace st′ → state_readyst → evidence_invge md st → single_invge md st → state_readyst′ ∧ persistsc_memfstmachine_ofst c_memfstmachine_ofst′ ∧ evidence_invge md st′ ∧ single_invge md st′

intros registry ge md st trace st′ Hge Hmd Hfree H

world :
Type
registry :
name → optioncontractworld
ge :
md :
st :
trace :
listevent
st′ :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
H :
runregistry ge st trace st′
⊢
state_readyst → evidence_invge md st → single_invge md st → state_readyst′ ∧ persistsc_memfstmachine_ofst c_memfstmachine_ofst′ ∧ evidence_invge md st′ ∧ single_invge md st′

induction H ; intros Hr Hi Hs

2 open

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
Hi :
evidence_invge md st
Hs :
single_invge md st
⊢
focused goal
world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
⊢
state_readylast ∧ persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

–split ; exact Hr |

2 open

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
Hi :
evidence_invge md st
Hs :
single_invge md st
⊢
deferred goal
world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
⊢
state_readylast ∧ persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

split ; apply persists_refl | auto

deferred goal
world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
⊢
state_readylast ∧ persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

–pose proof step_ready_ _ _ _ _ Hfree H Hr as Hr1

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
Hr1 :
⊢
state_readylast ∧ persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

pose proof step_inv_ _ _ _ _ _ Hge Hmd H Hr Hi as Hi1

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
Hr1 :
Hi1 :
evidence_invge md mid
⊢
state_readylast ∧ persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

pose proof step_sinv_ _ _ _ _ _ Hge Hmd Hfree H Hr Hs as Hs1

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
Hr1 :
Hi1 :
evidence_invge md mid
Hs1 :
single_invge md mid
⊢
state_readylast ∧ persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

destruct IHrunHr1 Hi1 Hs1 as Hr′ & Hp & Hi′ & Hs′

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
Hr1 :
Hi1 :
evidence_invge md mid
Hs1 :
single_invge md mid
Hr′ :
Hi′ :
evidence_invge md last
Hs′ :
single_invge md last
⊢
state_readylast ∧ persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

split ; exact Hr′ |

world :
Type
registry :
name → optioncontractworld
ge :
md :
Hge :
ge_modulege = md
Hfree :
ge_freege = R.free
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
stepregistry ge st trace mid
H0 :
runregistry ge mid tail last
IHrun :
state_readymid → evidence_invge md mid → single_invge md mid → state_readylast ∧ persistsc_memfstmachine_ofmid c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last
Hi :
evidence_invge md st
Hs :
single_invge md st
Hr1 :
Hi1 :
evidence_invge md mid
Hs1 :
single_invge md mid
Hr′ :
Hi′ :
evidence_invge md last
Hs′ :
single_invge md last
⊢
persistsc_memfstmachine_ofst c_memfstmachine_oflast ∧ evidence_invge md last ∧ single_invge md last

split ; eapply persists_trans ; eapply step_persists ; eauto | exact Hp | auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros registry ge md st trace st′ Hge Hmd Hfree H
induction H ; intros Hr Hi Hs
–split ; exact Hr |
split ; apply persists_refl | auto
–pose proof step_ready_ _ _ _ _ Hfree H Hr as Hr1
pose proof step_inv_ _ _ _ _ _ Hge Hmd H Hr Hi as Hi1
pose proof step_sinv_ _ _ _ _ _ Hge Hmd Hfree H Hr Hs as Hs1
destruct IHrunHr1 Hi1 Hs1 as Hr′ & Hp & Hi′ & Hs′
split ; exact Hr′ |
split ; eapply persists_trans ; eapply step_persists ; eauto | exact Hp | auto
Arguments Running { world }
Arguments Stopped { world }
Arguments admissible { world }
Arguments step { world }
Arguments run { world }

Accept an existing machine instance rather than instantiate a sibling functor. In particular its inductive E.invoke, E.effects, step and run types remain the caller's exact types. This signature adds no runtime assumptions and changes no transition or theorem.

469Module Type ExternalMachineSig R : Runtime
Include ExternalMachine R

Public transition regressions

These are abstract contract fixtures, not native libc instances. The argument is genuinely evaluated from a temporary; the separate caller, local object, remaining instruction and fuel expose accidental whole-frame replacement or return-from-the-caller behavior.

The regressions, over the interpreter's runtime.

481Module ExternalMachineChecks

The temporary holding the call's argument.

485Definition arg_name: name ≔
TAtom"input"

The temporary a scalar or tuple result binds.

487Definition result_name: name ≔
TAtom"answer"

The one block's label.

489Definition label: name ≔
TAtom"entry"

The called name, unresolved in the test module.

491Definition symbol: name ≔
TAtom"puts"

The call's one argument: the temporary input as a pointer.

493Definition args: listarg ≔

The instruction after the call, a source location.

495Definition rest: listinst ≔
LocTAtom"hi.c" 3

A main of one block: the call with result r, then rest, then return.

498Definition test_fnr : call_result : func ≔

The environment at the call: input is hello_ptr, and an unrelated temporary keep must survive the call.

503Definition test_env: env ≔

One local object, at 3072.

505Definition test_locals: listname × optionZ ≔
TAtom"local", Some3072

A separate waiting caller frame.

507Definition test_caller: frame ≔

The call stack: test_caller, waiting for a void result.

509Definition test_callers: listframe × pending ≔

The configuration at the call with result r, over hello_mem, with 41 units of fuel.

A global environment with no functions or data, so symbol is unresolved.

519Definition test_ge: genv ≔

A registry giving every name the contract spec.

521Definition registryworld : Type spec : contractworld : name → optioncontractworld ≔
λ_ ⇒ Somespec

The test configuration is at an external_site, whatever the call's result.

Explore proof 2 tactics

Initial goal

intros r

repeat split ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros r
repeat split ; reflexivity

The call of puts on hello from the test site completes like hello_return, for a void or word result.

530Lemma puts_invocation
∀ r n accepted tail
r = CVoid ∨ ∃d, r = CResultd W
hello_bytes ++ 10 = accepted ++ tail
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
Explore proof 33 tactics

Initial goal

⊢
∀r : call_result n : Z accepted tail : listZ, r = CVoid ∨ ∃d : name, r = CResultd W → hello_bytes ++ 10 = accepted ++ tail → tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1 → M.E.invokeputs_contractfixture_rep fixture_requests r args WPtrhello_ptr InterpRuntime.start hello_mem hello_world StreamBytes1 accepted CallReturnWIntn InterpRuntime.start hello_mem hello_world

intros r n accepted tail Hr Hb Hn

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1

eapply M.E.invoke_normal with born := [ ]

7 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

–split ; exact Hr |

7 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∃v : value, args = ArgP v
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

exists Tmparg_name

7 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

reflexivity

6 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

–exact hello_pre

5 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

–split ; constructor |

5 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split ; split ; reflexivity |

5 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
stdio_readyhello_mem hello_world ∧ stdio_delegatesstdio_rootshello_world [ ] hello_mem hello_world ∧ StreamBytes1 accepted = [ ] ∨ ∃p : ptr bytes accepted0 tail0 : listZ, WPtrhello_ptr = WPtrp ∧ c_stringhello_mem p bytes ∧ bytes ++ 10 = accepted0 ++ tail0 ∧ StreamBytes1 accepted = StreamBytes1 accepted0
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split ; exact hello_stdio |

5 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
stdio_delegatesstdio_rootshello_world [ ] hello_mem hello_world ∧ StreamBytes1 accepted = [ ] ∨ ∃p : ptr bytes accepted0 tail0 : listZ, WPtrhello_ptr = WPtrp ∧ c_stringhello_mem p bytes ∧ bytes ++ 10 = accepted0 ++ tail0 ∧ StreamBytes1 accepted = StreamBytes1 accepted0
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split

6 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
StreamBytes1 accepted = [ ] ∨ ∃p : ptr bytes accepted0 tail0 : listZ, WPtrhello_ptr = WPtrp ∧ c_stringhello_mem p bytes ∧ bytes ++ 10 = accepted0 ++ tail0 ∧ StreamBytes1 accepted = StreamBytes1 accepted0
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

+apply stdio_delegates_refl ; reflexivity | exact proj2hello_stdio

5 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
StreamBytes1 accepted = [ ] ∨ ∃p : ptr bytes accepted0 tail0 : listZ, WPtrhello_ptr = WPtrp ∧ c_stringhello_mem p bytes ∧ bytes ++ 10 = accepted0 ++ tail0 ∧ StreamBytes1 accepted = StreamBytes1 accepted0
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

+right

5 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∃p : ptr bytes accepted0 tail0 : listZ, WPtrhello_ptr = WPtrp ∧ c_stringhello_mem p bytes ∧ bytes ++ 10 = accepted0 ++ tail0 ∧ StreamBytes1 accepted = StreamBytes1 accepted0
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

exists hello_ptr, hello_bytes, accepted, tail

5 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
WPtrhello_ptr = WPtrhello_ptr ∧ c_stringhello_mem hello_ptr hello_bytes ∧ hello_bytes ++ 10 = accepted ++ tail ∧ StreamBytes1 accepted = StreamBytes1 accepted
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

repeat split ; auto using hello_string

4 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

–exists hello_ptr, hello_bytes, accepted, tail, n

4 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
WPtrhello_ptr = WPtrhello_ptr ∧ c_stringhello_mem hello_ptr hello_bytes ∧ hello_bytes ++ 10 = accepted ++ tail ∧ tail = [ ] ∧ 0 ≤ n < 2 ^ 31 ∨ n = 2 ^ 32 − 1 ∧ StreamBytes1 accepted = StreamBytes1 accepted ∧ CallReturnWIntn = CallReturnWIntn ∧ stdio_readyhello_mem hello_world
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split ; reflexivity |

4 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
c_stringhello_mem hello_ptr hello_bytes ∧ hello_bytes ++ 10 = accepted ++ tail ∧ tail = [ ] ∧ 0 ≤ n < 2 ^ 31 ∨ n = 2 ^ 32 − 1 ∧ StreamBytes1 accepted = StreamBytes1 accepted ∧ CallReturnWIntn = CallReturnWIntn ∧ stdio_readyhello_mem hello_world
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split ; exact hello_string |

4 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
hello_bytes ++ 10 = accepted ++ tail ∧ tail = [ ] ∧ 0 ≤ n < 2 ^ 31 ∨ n = 2 ^ 32 − 1 ∧ StreamBytes1 accepted = StreamBytes1 accepted ∧ CallReturnWIntn = CallReturnWIntn ∧ stdio_readyhello_mem hello_world
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split ; exact Hb |

4 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
tail = [ ] ∧ 0 ≤ n < 2 ^ 31 ∨ n = 2 ^ 32 − 1 ∧ StreamBytes1 accepted = StreamBytes1 accepted ∧ CallReturnWIntn = CallReturnWIntn ∧ stdio_readyhello_mem hello_world
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split

5 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
tail = [ ] ∧ 0 ≤ n < 2 ^ 31 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

+destruct Hn as Ht → | → ; left ; split ; exact Ht | change 0 ≤ 0 < 2147483648 ; lia | right ; reflexivity

4 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

+split ; reflexivity |

4 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split ; reflexivity | exact hello_stdio

3 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀why : reason, CallReturnWIntn ≠ CallResourcewhy
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

–intros why H

3 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
why :
⊢
False
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

discriminate H

2 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

–intros values H

2 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
values :
listword
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

injection H as ←

2 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split

3 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
focused goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

+exists WIntn

3 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
WIntn = WIntn ∧ word_at_classW WIntn = SomeWIntn
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

split ; reflexivity |

3 open

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

destruct Hn as _ → | → ; reflexivity

2 open

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

+constructor ; exact I | constructor

deferred goal
n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
⊢
∀status : Z, CallReturnWIntn = CallExitstatus → ∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

–intros status H

n :
Z
accepted, tail :
listZ
Hr :
r = CVoid ∨ ∃d : name, r = CResultd W
Hb :
hello_bytes ++ 10 = accepted ++ tail
Hn :
tail = [ ] ∧ n = 0 ∨ n = 2 ^ 32 − 1
status :
Z
⊢
∃before : listevent, StreamBytes1 accepted = before ++ ProcessExitstatus

discriminate H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros r n accepted tail Hr Hb Hn
eapply M.E.invoke_normal with born := [ ]
–split ; exact Hr |
reflexivity
–exact hello_pre
–split ; constructor |
split ; split ; reflexivity |
split ; exact hello_stdio |
split
+apply stdio_delegates_refl ; reflexivity | exact proj2hello_stdio
+right
exists hello_ptr, hello_bytes, accepted, tail
repeat split ; auto using hello_string
–exists hello_ptr, hello_bytes, accepted, tail, n
split ; reflexivity |
split ; exact hello_string |
split ; exact Hb |
split
+destruct Hn as Ht → | → ; left ; split ; exact Ht | change 0 ≤ 0 < 2147483648 ; lia | right ; reflexivity
+split ; reflexivity |
split ; reflexivity | exact hello_stdio
–intros why H
discriminate H
–intros values H
injection H as ←
split
+exists WIntn
split ; reflexivity |
destruct Hn as _ → | → ; reflexivity
+constructor ; exact I | constructor
–intros status H
discriminate H

A successful puts step emits its one event and resumes the same frame at rest with answer bound to 0, the same locals, callers, memory and fuel.

Explore proof 2 tactics
Source script
eapply M.step_return with site := test_siteCResultresult_name W values := WInt0 ; apply test_external | reflexivity | reflexivity | | reflexivity
apply puts_invocation_ _ _ [ ] ; right ; eexists ; reflexivity | reflexivity | left ; auto

A partial EOF puts with a discarded result also resumes, with the environment unchanged.

Explore proof 2 tactics
Source script
eapply M.step_return with site := test_siteCVoid values := WInt2 ^ 32 − 1 ; apply test_external | reflexivity | reflexivity | | reflexivity
apply puts_invocation_ _ _ 108; 108; 111; 10 ; left ; reflexivity | reflexivity | right ; reflexivity

A contract with return type ty whose ABI premise, precondition and postcondition are the given propositions abi, pre and behavior, which may write only stdout_span, requests no allocation and accepts any prefix. Such deliberately independent propositions expose rejection even when no behavior exists.

591Definition test_contractty : ret_type abi pre behavior : Prop : contractunit ≔
mkContractunit ty λ_ _ ⇒ abi λ_ _ _ ⇒ pre λ_ _ _ ⇒ [ ] λ_ _ _ ⇒ stdout_span λ_ _ _ ⇒ [ ] λ_ _ _ _ _ ⇒ False λ_ _ _ _ _ _ _ ⇒ True λ_ _ _ _ _ _ _ _ ⇒ behavior λ_ ⇒ False λ_ ⇒ False

An always-true test contract may return, changing nothing, any values of its return_shape whose capabilities need no source or born object (word_authority).

600Lemma test_return
Explore proof 6 tactics

Initial goal

⊢
∀ty : ret_type r : call_result values : listword, return_shapety values → Forallword_authority[ ] [ ] hello_mem values → M.E.invoketest_contractty True True True r args WPtrhello_ptr InterpRuntime.start hello_mem tt [ ] CallReturnvalues InterpRuntime.start hello_mem tt

intros ty r values Hshape Hauth

eapply M.E.invoke_normal with born := [ ] ; try exact I ; try intros x H ; discriminate H

2 open

values :
listword
Hshape :
return_shapety values
Hauth :
Forallword_authority[ ] [ ] hello_mem values
focused goal
values :
listword
Hshape :
return_shapety values
Hauth :
Forallword_authority[ ] [ ] hello_mem values
⊢
∀values0 : listword, CallReturnvalues = CallReturnvalues0 → return_shapecontract_returnstest_contractty True True True values0 ∧ Forallword_authoritycontract_sourcestest_contractty True True True WPtrhello_ptr hello_mem tt [ ] hello_mem values0

–split ; constructor | exact I

deferred goal
values :
listword
Hshape :
return_shapety values
Hauth :
Forallword_authority[ ] [ ] hello_mem values
⊢
∀values0 : listword, CallReturnvalues = CallReturnvalues0 → return_shapecontract_returnstest_contractty True True True values0 ∧ Forallword_authoritycontract_sourcestest_contractty True True True WPtrhello_ptr hello_mem tt [ ] hello_mem values0

–intros xs H

values :
listword
Hshape :
return_shapety values
Hauth :
Forallword_authority[ ] [ ] hello_mem values
xs :
listword
H :

injection H as ←

values :
listword
Hshape :
return_shapety values
Hauth :
Forallword_authority[ ] [ ] hello_mem values

auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ty r values Hshape Hauth
eapply M.E.invoke_normal with born := [ ] ; try exact I ; try intros x H ; discriminate H
–split ; constructor | exact I
–intros xs H
injection H as ←
auto

Such a return is a silent machine step to resume_external with the environment external_env gives.

Explore proof 2 tactics

Initial goal

⊢

intros ty r values e Hs Ha He

eapply M.step_return with site := test_siter values := values ; apply test_external | reflexivity | reflexivity | exact test_returnty r values Hs Ha | exact He

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros ty r values e Hs Ha He
eapply M.step_return with site := test_siter values := values ; apply test_external | reflexivity | reflexivity | exact test_returnty r values Hs Ha | exact He

Void, empty-tuple and one-element-tuple returns each use their own channel.

Explore proof 3 tactics

Initial goal

split ; eapply return_channel with values := [ ] ; repeat constructor |

split ; eapply return_channel with values := [ ] ; repeat constructor |

eapply return_channel with values := WInt7 ; repeat constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
split ; eapply return_channel with values := [ ] ; repeat constructor |
split ; eapply return_channel with values := [ ] ; repeat constructor |
eapply return_channel with values := WInt7 ; repeat constructor

A call with no registered contract stops with MissingContract.

Explore proof 1 tactics

Initial goal

eapply M.step_rejected with site := test_siteCVoid ; apply test_external | constructor ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
eapply M.step_rejected with site := test_siteCVoid ; apply test_external | constructor ; reflexivity

A false precondition is rejected even when the contract has no behavior at all.

Explore proof 2 tactics

Initial goal

eapply M.step_rejected with site := test_siteCVoid ; apply test_external |

eapply M.reject_pre ; reflexivity | reflexivity | exact I | exact λH ⇒ H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
eapply M.step_rejected with site := test_siteCVoid ; apply test_external |
eapply M.reject_pre ; reflexivity | reflexivity | exact I | exact λH ⇒ H

A call can be admissible yet have no completed invocation: admissibility does not promise behavior.

662Example admitted_empty_behavior: M.admissibleregistrytest_contractRVoid True True False test_ge test_configCVoid tt test_siteCVoid ∧ ¬∃trace result s′ m′ w′, M.E.invoketest_contractRVoid True True False CVoid args WPtrhello_ptr InterpRuntime.start hello_mem tt trace result s′ m′ w′
Explore proof 3 tactics

Initial goal

⊢
M.admissibleregistrytest_contractRVoid True True False test_ge test_configCVoid tt test_siteCVoid ∧ ¬∃trace : listevent result : call_end s′ : InterpRuntime.state m′ : Memory.mem w′ : unit, M.E.invoketest_contractRVoid True True False CVoid args WPtrhello_ptr InterpRuntime.start hello_mem tt trace result s′ m′ w′

split ; eexists ; eexists ; repeat split ; reflexivity || exact I |

⊢
¬∃trace : listevent result : call_end s′ : InterpRuntime.state m′ : Memory.mem w′ : unit, M.E.invoketest_contractRVoid True True False CVoid args WPtrhello_ptr InterpRuntime.start hello_mem tt trace result s′ m′ w′

intros trace & result & s′ & m′ & w′ & H

trace :
listevent
result :
m′ :
Memory.mem
w′ :
unit
H :
M.E.invoketest_contractRVoid True True False CVoid args WPtrhello_ptr InterpRuntime.start hello_mem tt trace result s′ m′ w′
⊢
False

inversion H ; assumption

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
split ; eexists ; eexists ; repeat split ; reflexivity || exact I |
intros trace & result & s′ & m′ & w′ & H
inversion H ; assumption

A one-word tuple returned to a scalar result stops with BadReturn, keeping the call's memory.

Explore proof 15 tactics

Initial goal

eapply M.step_bad_return with site := test_siteCResultresult_name W values := WInt7 ; apply test_external | reflexivity | reflexivity | | reflexivity

eapply M.E.invoke_normal with born := [ ] ; try exact I ; try intros x H ; discriminate H

2 open

focused goal

–split ; | exact I

2 open

deferred goal

eapply M.E.effects_local ; apply local_store_bytes | constructor

2 open

deferred goal

intros b Hb

2 open

deferred goal

left

2 open

deferred goal

exists stdout_span

2 open

deferred goal

split ; left ; reflexivity |

2 open

deferred goal

split ; exact Forall_invproj2hello_stdio |

2 open

b :
Z
Hb :
2048 ≤ b < 2048 + 1
deferred goal

unfold span_contains

2 open

b :
Z
Hb :
2048 ≤ b < 2048 + 1
deferred goal

simpl

2 open

b :
Z
Hb :
2048 ≤ b < 2048 + 1
⊢
2048 ≤ b < 2064
deferred goal

lia

deferred goal

–intros values H

injection H as ←

split ; repeat constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
eapply M.step_bad_return with site := test_siteCResultresult_name W values := WInt7 ; apply test_external | reflexivity | reflexivity | | reflexivity
eapply M.E.invoke_normal with born := [ ] ; try exact I ; try intros x H ; discriminate H
–split ; | exact I
eapply M.E.effects_local ; apply local_store_bytes | constructor
intros b Hb
left
split ; left ; reflexivity |
split ; exact Forall_invproj2hello_stdio |
simpl
lia
–intros values H
injection H as ←
split ; repeat constructor

A two-word tuple binds both names, and a void result discards it.

Explore proof 1 tactics
Source script
split ; eapply return_channel with values := WInt3; WInt11 ; repeat constructor

A false ABI premise is rejected as BadABI, without behavior.

Explore proof 2 tactics

Initial goal

eapply M.step_rejected with site := test_siteCVoid ; apply test_external |

eapply M.reject_abi ; reflexivity | reflexivity | exact λH ⇒ H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
eapply M.step_rejected with site := test_siteCVoid ; apply test_external |
eapply M.reject_abi ; reflexivity | reflexivity | exact λH ⇒ H

The test configuration with an empty environment, so the argument input has no value.

An argument that does not evaluate is rejected as BadArguments.

Explore proof 2 tactics
Source script
eapply M.step_rejected with site := test_siteCVoid ; repeat split ; reflexivity |
eapply M.reject_arguments ; reflexivity

Even at a call that would be rejected, the core machine may take a safepoint (poll) step first.

Explore proof 3 tactics
Source script

The test configuration with its frame doomed to trap out of bounds.

A doomed frame's call is not external: the core ends it as Unchecked (Ahead out of bounds).

Explore proof 1 tactics

Initial goal

apply M.step_core_end ; intros site Hd & _ ; discriminate Hd | reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
apply M.step_core_end ; intros site Hd & _ ; discriminate Hd | reflexivity

A defined function named puts.

755Definition callee: func ≔

An environment where puts is that defined function.

757Definition defined_ge: genv ≔

An environment where puts is a function outside the core subset.

760Definition outside_ge: genv ≔

An environment where puts is global data.

762Definition data_ge: genv ≔

The test frame about to call free.

Calls of a defined, outside or data name, and of free, stay core calls: every step there is silent.

Explore proof 1 tactics

Initial goal

intros trace st H | H | H | H ; eapply M.non_external_silent ; try exact H ; intros site Hsite ; pose proof external_site_stuck_ _ _ Hsite as Hstuck ; discriminate Hstuck

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros trace st H | H | H | H ; eapply M.non_external_silent ; try exact H ; intros site Hsite ; pose proof external_site_stuck_ _ _ Hsite as Hstuck ; discriminate Hstuck

A puts whose allocation is refused stops as OutOfMemory with its event and its write to the libc state retained.

Explore proof 28 tactics

Initial goal

eapply M.step_resource with site := test_siteCVoid ; apply test_external | reflexivity | reflexivity |

eapply M.E.invoke_resource with born := [ ]

5 open

focused goal
focused goal
focused goal
focused goal

–split ; left ; reflexivity |

5 open

deferred goal
deferred goal
deferred goal
deferred goal

exists Tmparg_name

5 open

deferred goal
deferred goal
deferred goal
deferred goal

reflexivity

4 open

deferred goal
deferred goal
deferred goal
deferred goal

–exact hello_pre

3 open

deferred goal
deferred goal
deferred goal

–split

4 open

focused goal
deferred goal
deferred goal

+eapply M.E.effects_local ; apply local_store_bytes | constructor

4 open

deferred goal
deferred goal
deferred goal

intros b Hb

4 open

deferred goal
deferred goal
deferred goal

left

4 open

deferred goal
deferred goal
deferred goal

exists stdout_span

4 open

deferred goal
deferred goal
deferred goal

split ; left ; reflexivity |

4 open

deferred goal
deferred goal
deferred goal

split ; exact Forall_invproj2hello_stdio |

4 open

b :
Z
Hb :
2048 ≤ b < 2048 + 1
deferred goal
deferred goal
deferred goal

unfold span_contains

4 open

b :
Z
Hb :
2048 ≤ b < 2048 + 1
deferred goal
deferred goal
deferred goal

simpl

4 open

b :
Z
Hb :
2048 ≤ b < 2048 + 1
⊢
2048 ≤ b < 2064
deferred goal
deferred goal
deferred goal

lia

3 open

deferred goal
deferred goal
deferred goal

+split ; split ; reflexivity |

3 open

⊢
stdio_readystore_byteshello_mem 2048 1 1 hello_world ∧ stdio_delegatesstdio_rootshello_world [ ] store_byteshello_mem 2048 1 1 hello_world ∧ StreamBytes1 104 = [ ] ∨ ∃p : ptr bytes accepted tail : listZ, WPtrhello_ptr = WPtrp ∧ c_stringc_memtest_configCVoid p bytes ∧ bytes ++ 10 = accepted ++ tail ∧ StreamBytes1 104 = StreamBytes1 accepted
deferred goal
deferred goal

split ; exact hello_stdio |

3 open

⊢
stdio_delegatesstdio_rootshello_world [ ] store_byteshello_mem 2048 1 1 hello_world ∧ StreamBytes1 104 = [ ] ∨ ∃p : ptr bytes accepted tail : listZ, WPtrhello_ptr = WPtrp ∧ c_stringc_memtest_configCVoid p bytes ∧ bytes ++ 10 = accepted ++ tail ∧ StreamBytes1 104 = StreamBytes1 accepted
deferred goal
deferred goal

split

4 open

focused goal
⊢
StreamBytes1 104 = [ ] ∨ ∃p : ptr bytes accepted tail : listZ, WPtrhello_ptr = WPtrp ∧ c_stringc_memtest_configCVoid p bytes ∧ bytes ++ 10 = accepted ++ tail ∧ StreamBytes1 104 = StreamBytes1 accepted
deferred goal
deferred goal

∗apply stdio_delegates_refl ; reflexivity | exact proj2hello_stdio

3 open

deferred goal
⊢
StreamBytes1 104 = [ ] ∨ ∃p : ptr bytes accepted tail : listZ, WPtrhello_ptr = WPtrp ∧ c_stringc_memtest_configCVoid p bytes ∧ bytes ++ 10 = accepted ++ tail ∧ StreamBytes1 104 = StreamBytes1 accepted
deferred goal
deferred goal

∗right

3 open

⊢
∃p : ptr bytes accepted tail : listZ, WPtrhello_ptr = WPtrp ∧ c_stringc_memtest_configCVoid p bytes ∧ bytes ++ 10 = accepted ++ tail ∧ StreamBytes1 104 = StreamBytes1 accepted
deferred goal
deferred goal

exists hello_ptr, hello_bytes, 104, 101; 108; 108; 111; 10

3 open

⊢
WPtrhello_ptr = WPtrhello_ptr ∧ c_stringc_memtest_configCVoid hello_ptr hello_bytes ∧ hello_bytes ++ 10 = 104 ++ 101; 108; 108; 111; 10 ∧ StreamBytes1 104 = StreamBytes1 104
deferred goal
deferred goal

split ; reflexivity |

3 open

⊢
c_stringc_memtest_configCVoid hello_ptr hello_bytes ∧ hello_bytes ++ 10 = 104 ++ 101; 108; 108; 111; 10 ∧ StreamBytes1 104 = StreamBytes1 104
deferred goal
deferred goal

split ; exact hello_string |

3 open

⊢
hello_bytes ++ 10 = 104 ++ 101; 108; 108; 111; 10 ∧ StreamBytes1 104 = StreamBytes1 104
deferred goal
deferred goal

split ; reflexivity

2 open

deferred goal
deferred goal

–eapply M.E.failure_oom with align := 16 size := 32 ; split ; reflexivity | unfold max_allocation_size ; simpl ; lia | reflexivity

deferred goal

–left

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
eapply M.step_resource with site := test_siteCVoid ; apply test_external | reflexivity | reflexivity |
eapply M.E.invoke_resource with born := [ ]
–split ; left ; reflexivity |
reflexivity
–exact hello_pre
–split
+eapply M.E.effects_local ; apply local_store_bytes | constructor
intros b Hb
left
split ; left ; reflexivity |
split ; exact Forall_invproj2hello_stdio |
simpl
lia
+split ; split ; reflexivity |
split ; exact hello_stdio |
split
∗apply stdio_delegates_refl ; reflexivity | exact proj2hello_stdio
∗right
exists hello_ptr, hello_bytes, 104, 101; 108; 108; 111; 10
split ; reflexivity |
split ; exact hello_string |
split ; reflexivity
–eapply M.E.failure_oom with align := 16 size := 32 ; split ; reflexivity | unfold max_allocation_size ; simpl ; lia | reflexivity
–left
reflexivity

An exiting call's trace already ends in its ProcessExit; the step adds no second one.

Explore proof 7 tactics

Initial goal

eapply M.step_exit with site := test_siteCVoid ; apply test_external | reflexivity | reflexivity |

eapply M.E.invoke_normal with born := [ ] ; try exact I ; try intros x H ; discriminate H

2 open

focused goal
⊢
∀status : Z, CallExit7 = CallExitstatus → ∃before : listevent, StreamBytes1 65; ProcessExit7 = before ++ ProcessExitstatus

–split ; constructor | exact I

deferred goal
⊢
∀status : Z, CallExit7 = CallExitstatus → ∃before : listevent, StreamBytes1 65; ProcessExit7 = before ++ ProcessExitstatus

–intros status H

status :
Z
H :
CallExit7 = CallExitstatus
⊢
∃before : listevent, StreamBytes1 65; ProcessExit7 = before ++ ProcessExitstatus

injection H as ←

⊢
∃before : listevent, StreamBytes1 65; ProcessExit7 = before ++ ProcessExit7

exists StreamBytes1 65

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
eapply M.step_exit with site := test_siteCVoid ; apply test_external | reflexivity | reflexivity |
eapply M.E.invoke_normal with born := [ ] ; try exact I ; try intros x H ; discriminate H
–split ; constructor | exact I
–intros status H
injection H as ←
exists StreamBytes1 65
reflexivity

A top-level test frame at point pt with the given fuel and no callers.

826Definition core_configpt : point fuel : Z : config ≔
mkConfigmkFrametest_fnCVoid test_env TAtom"local", None None pt [ ] hello_mem fuel

A top-level return and running out of fuel stop with the core's outcome.

Explore proof 1 tactics

Initial goal

split ; apply M.step_core_end ; try reflexivity ; intros site H ; pose proof external_site_stuck_ _ _ H as Hs ; discriminate Hs

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
split ; apply M.step_core_end ; try reflexivity ; intros site H ; pose proof external_site_stuck_ _ _ H as Hs ; discriminate Hs

A local allocation the runtime refuses stops as OutOfMemory.

Explore proof 2 tactics

Initial goal

cbv zeta

eapply M.step_core_refusal ; intros site H ; pose proof external_site_stuck_ _ _ H as Hs ; discriminate Hs | reflexivity | simpl ; lia | reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
cbv zeta
eapply M.step_core_refusal ; intros site H ; pose proof external_site_stuck_ _ _ H as Hs ; discriminate Hs | reflexivity | simpl ; lia | reflexivity

A call of a function outside the core subset stops stuck.

Explore proof 1 tactics

Initial goal

apply M.step_core_stuck ; intros site H ; pose proof external_site_stuck_ _ _ H as Hs ; discriminate Hs | reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
apply M.step_core_stuck ; intros site H ; pose proof external_site_stuck_ _ _ H as Hs ; discriminate Hs | reflexivity

A main that calls puts twice in a row.

double_fn's frame at its first call.

The first call, followed by the second.

The second call, the block's last instruction.

876Definition last_site: call_site ≔

The configuration after the first call returns.

A run of the two calls observes the first call's event, then the second's.

Explore proof 7 tactics

Initial goal

eapply M.run_cons with trace := StreamBytes1 hello_bytes ++ 10 tail := StreamBytes1 104 mid := M.Runningafter_first, InterpRuntime.start hello_world

2 open

focused goal

–eapply M.step_return with site := first_site values := WInt0 ; repeat split ; reflexivity | reflexivity | reflexivity | | reflexivity

2 open

deferred goal

apply puts_invocation_ _ _ [ ] ; left ; reflexivity | reflexivity | left ; auto

deferred goal

–eapply M.run_cons with trace := StreamBytes1 104 tail := [ ]

3 open

focused goal
shelved goal

+eapply M.step_return with site := last_site values := WInt2 ^ 32 − 1 ; repeat split ; reflexivity | reflexivity | reflexivity | | reflexivity

5 open

deferred goal
shelved goal
shelved goal
shelved goal
⊢
Memory.mem

apply puts_invocation_ _ _ 101; 108; 108; 111; 10 ; left ; reflexivity | reflexivity | right ; reflexivity

deferred goal

+constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
–eapply M.step_return with site := first_site values := WInt0 ; repeat split ; reflexivity | reflexivity | reflexivity | | reflexivity
apply puts_invocation_ _ _ [ ] ; left ; reflexivity | reflexivity | left ; auto
–eapply M.run_cons with trace := StreamBytes1 104 tail := [ ]
+eapply M.step_return with site := last_site values := WInt2 ^ 32 − 1 ; repeat split ; reflexivity | reflexivity | reflexivity | | reflexivity
apply puts_invocation_ _ _ 101; 108; 108; 111; 10 ; left ; reflexivity | reflexivity | right ; reflexivity
+constructor