Fil-C on Nix

Filnix wiki

the formal campaign

rocq/theories/Hi.v

The source-shaped body of tests/c/prog/hi.c at the trusted libc boundary. Entry and libc realization are premises, not proofs of the native launcher or libc. The body ignores all launcher words.

From Stdlib Require Import String ZArith List Bool Lia
From Nanofil Require Import Term Syntax Values Memory Runtime Ops Semantics Run Machine ExternalCalls Startup Stdio Shutdown ExternalMachine
Import ListNotations
Open Scope Z_scope
Open Scope list_scope

Main's one call has the exact checked IR result and argument syntax.

13Definition hi_site: call_site ≔

The two instructions emitted for hi.c: copy its literal, then call puts.

The source-shaped main returns an int and declares no parameters or locals.

23Definition hi_function: func ≔

The module's read-only hello literal includes its NUL.

28Definition hi_module: Syntax.module ≔

The pointer assigned to the literal by the model's actual module layout.

33Definition hi_literal: ptr ≔
mkPtr65552 Ro65552

The model's actual initialized module memory, before launcher/libc allocations.

36Definition hi_memory: mem ≔
Some_, m
⇒
m
None
⇒

Initializing the module succeeds and exposes the expected symbol pointers.

40Example hi_initial_memory: initial_memoryhi_module = SomeTAtom"str.10", hi_literal; TAtom"main", mkPtr65536 FnTAtom"main", hi_memory
Explore proof 1 tactics

Initial goal

⊢
initial_memoryhi_module = SomeTAtom"str.10", hi_literal; TAtom"main", ptr_addr ≔ 65536; ptr_cap ≔ FnTAtom"main", hi_memory

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity

The initialized literal is a checked in-object C string, not an assumed address.

46Example hi_initialized_literal: c_stringhi_memory hi_literal hello_bytes
Explore proof 2 tactics

Initial goal

vm_compute

⊢
Someok = Someok ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 104 = 104 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 101 = 101 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 108 = 108 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 108 = 108 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 111 = 111 ∧ 0 = 0

repeat split ; try reflexivity ; lia

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
repeat split ; try reflexivity ; lia

A configuration in this main, with no caller/local objects or doom.

50Definition hi_configm : mem fuel : Z e : env at_ : point : config ≔
mkConfigmkFramehi_function e [ ] None at_ [ ] m fuel

Main begins at its actual entry block.

54Definition hi_entrym : mem fuel : Z : config ≔
hi_configm fuel [ ] EnterTAtom"start" None

Just before puts, its argument has been copied into v0.

58Definition hi_callm : mem fuel : Z : config ≔

Any launcher's argc/argv/environment produce the same main(void) frame.

63Theorem hi_ignores_launcher_words
∀ argc argv envp m fuel
Explore proof 1 tactics

Initial goal

⊢
∀argc : Z argv envp : ptr m : mem fuel : Z, call_framehi_function main_argumentsargc argv envp = Somec_framehi_entrym fuel

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity

Bind this body's own symbols; libc remains unresolved and contract-dispatched.

68Module Hi R : Runtime
69Module M ≔ ExternalMachine R

The linked model environment: this module and its initialized global symbols.

72Definition hi_genv: genv ≔
mkGenvhi_module TAtom"str.10", hi_literal; TAtom"main", mkPtr65536 FnTAtom"main" R.free

Main reaches the call by two ordinary core steps, preserving entry memory.

77Lemma hi_reaches_call
∀ world : Type m fuel s w : world registry
fuel ≠ 0
M.runregistry hi_genv M.Runninghi_entrym fuel, s w [ ] M.Runninghi_callm fuel − 1, s w
Explore proof 14 tactics

Initial goal

⊢
∀world : Type m : mem fuel : Z s : R.state w : world registry : name → optioncontractworld, fuel ≠ 0 → M.runregistry hi_genv M.Runninghi_entrym fuel, s w [ ] M.Runninghi_callm fuel − 1, s w

intros world m fuel s w registry Hfuel

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_entrym fuel, s w [ ] M.Runninghi_callm fuel − 1, s w

eapply M.run_cons with trace := [ ] tail := [ ] mid := M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w

2 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.stepregistry hi_genv M.Runninghi_entrym fuel, s w [ ] M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w
focused goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

–apply M.step_core

2 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

apply M.P.I.RM.mstep_next

2 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

unfold Semantics.step , hi_entry , hi_config

2 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
match fr_atc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel with
⇒
Nextc_frame ≔ fr_fn ≔ fr_fnc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_env ≔ putva_snapshot WPtrptr_addr ≔ 0; ptr_cap ≔ CNone fr_envc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_locals ≔ fr_localsc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_doomed ≔ fr_doomedc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_at ≔ Enterl None; c_callers ≔ c_callersc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; c_mem ≔ c_memc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; c_fuel ≔ c_fuelc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel
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_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_env ≔ putva_snapshot WPtrptr_addr ≔ base; ptr_cap ≔ Robase fr_envc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_locals ≔ fr_localsc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_doomed ≔ fr_doomedc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_at ≔ Enterl None; c_callers ≔ c_callersc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; c_mem ≔ snapshot_valuesxs base allocatedc_memc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel heap_req16 8 × Z.of_natDatatypes.lengthxs base; c_fuel ≔ c_fuelc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel

No native implementation is inferred from the registry: only puts is covered.

This real call is unresolved, not free, not data, and not doomed.

The caller's obligation is checked independently of any invocation's existence.

Every completed puts invocation either returns its W result or exhausts resources; it cannot terminate the process or yield a capability panic.

Returned integers bind the source's v1 without consuming main's return.

Whatever puts returns, main's next real core instruction returns zero, and the retained snapshot is exactly the invocation's final memory.

An actual returning contract call followed by main's return reaches the existing machine terminal. No exit observation is appended here.

Enterl from
⇒
c_fuelc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel =? 0
→
else
or_stuck"block"
let* b ≔ find_blockl fn_blocksfr_fnc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel in
let* e ≔ phis_envhi_genv b_phisb from fr_envc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel in
SomeNextc_frame ≔ fr_fn ≔ fr_fnc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_env ≔ e; fr_locals ≔ fr_localsc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_doomed ≔ fr_doomedc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; fr_at ≔ Execl b_instsb b_jumpb; c_callers ≔ c_callersc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; c_mem ≔ c_memc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel; c_fuel ≔ c_fuelc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1

Before the call, the literal retains its actual global region and bytes.

This invariant establishes the entire NUL-inclusive argument check.

The initialized source module establishes the literal invariant.

A safepoint cannot free GlobalData as though it were a heap object; non-moving bytes preserve the first NUL and the literal's contents.

The source's copy point, after its entry block has consumed fuel.

After the call, return zero reads no old literal or argument state.

Entry consumes fuel or reports OutOfFuel; neither is a library transition.

The literal copy has no memory effect or dynamic allocation.

The no-locals return ignores puts' result, even EOF.

There is exactly one external-call syntax at the reached call point.

The four application phases and permitted terminals; none deletes a failed precondition or silently turns it into a native safety result.

This environment/library premise requires the opaque representation and writable roots to survive collector safepoints, including permitted rewriting of capabilities to already-freed objects. It is not an extra Runtime axiom. The literal preservation is proved above.

Only the facts main still needs are retained before its call; argv is unused.

Safepoints retain those facts under the explicit stdio-stability premise.

Safe finite application outcomes include resource refusal and fuel exhaustion, not unreachable/stuck/unchecked/capability-panic or contract-violation endings.

The actual configuration shape and the caller obligations at every phase.

Every external call in a body state is this puts, with its obligations proved.

Execl [ ] j
⇒
jump_stephi_genv c_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel l j

Ordinary core steps retain the exact source phase and its needed facts.

Execl i :: rest j
⇒
match let* why ≔ fr_doomedc_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel in if ahead_transparenti then None else Somewhy with
Somewhy
⇒
None
⇒
or_stuck"instruction"
let* out0 ≔ inst_stephi_genv c_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel c_memc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel i in
let* od ≔ doomed_resulthi_genv c_framec_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel c_memc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel i out0 in
Someinst_nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ EnterTAtom"start" None; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel l rest j fstod sndod
=
Nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ ExecTAtom"start" hi_instructions JRetConst0; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

simpl

2 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
fuel =? 0
→
else
Nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ ExecTAtom"start" hi_instructions JRetConst0; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1
=
Nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ ExecTAtom"start" hi_instructions JRetConst0; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

assert fuel =? 0 = false as E by apply Z.eqb_neq ; assumption

2 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
E :
fuel =? 0 = false
⊢
fuel =? 0
→
else
Nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ ExecTAtom"start" hi_instructions JRetConst0; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1
=
Nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ ExecTAtom"start" hi_instructions JRetConst0; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

rewrite E

2 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
E :
fuel =? 0 = false
⊢
Nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ ExecTAtom"start" hi_instructions JRetConst0; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1 = Nextc_frame ≔ fr_fn ≔ hi_function; fr_env ≔ [ ]; fr_locals ≔ [ ]; fr_doomed ≔ None; fr_at ≔ ExecTAtom"start" hi_instructions JRetConst0; c_callers ≔ [ ]; c_mem ≔ m; c_fuel ≔ fuel − 1
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

reflexivity

deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] M.Runninghi_callm fuel − 1, s w

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

3 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.stepregistry hi_genv M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w [ ] ?mid
focused goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv ?mid [ ] M.Runninghi_callm fuel − 1, s w
shelved goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.stateworld

+apply M.step_core

3 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Running?ms′ w [ ] M.Runninghi_callm fuel − 1, s w
shelved goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0

apply M.P.I.RM.mstep_next

3 open

world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
stephi_genv hi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0 = Next?c′
deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0
⊢
M.runregistry hi_genv M.Running?c′, s w [ ] M.Runninghi_callm fuel − 1, s w
shelved goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0

reflexivity

deferred goal
world :
Type
m :
fuel :
Z
s :
R.state
w :
world
registry :
name → optioncontractworld
Hfuel :
fuel ≠ 0

+constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros world m fuel s w registry Hfuel
eapply M.run_cons with trace := [ ] tail := [ ] mid := M.Runninghi_configm fuel − 1 [ ] ExecTAtom"start" hi_instructions JRetConst0, s w
–apply M.step_core
unfold Semantics.step , hi_entry , hi_config
simpl
assert fuel =? 0 = false as E by apply Z.eqb_neq ; assumption
rewrite E
reflexivity
–eapply M.run_cons with trace := [ ] tail := [ ]
reflexivity
+constructor
96Definition hi_registryrep : mem → stdio_world → Prop requests : listword → mem → stdio_world → Z → Z → Prop symbol : name : optioncontractstdio_world ≔
name_eqbsymbol TAtom"puts"
→
Someputs_contractrep requests
else
None
102Lemma hi_external_site
Explore proof 2 tactics

Initial goal

⊢
∀m : mem fuel : Z, external_sitehi_genv hi_callm fuel hi_site

intros m fuel

repeat split ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m fuel
repeat split ; reflexivity
107Theorem hi_call_admissible
∀ rep requests m w fuel
Explore proof 12 tactics

Initial goal

⊢
∀rep : mem → stdio_world → Prop requests : listword → mem → stdio_world → Z → Z → Prop m : mem w : stdio_world fuel : Z, repm w → stdio_readym w → c_stringm hi_literal hello_bytes → M.admissiblehi_registryrep requests hi_genv hi_callm fuel w hi_site

intros rep requests m w fuel Hr Hw Hstr

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

exists puts_contractrep requests, WPtrhi_literal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

split ; reflexivity |

split ; reflexivity |

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

split

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

–split ; right ; exists TAtom"v1" ; reflexivity |

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w
⊢
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

exists TmpTAtom"v0"

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

reflexivity

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

–split ; exact Hr |

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w
⊢
stdio_readyc_memhi_callm fuel w ∧ ∃p : ptr bytes : listZ, WPtrhi_literal = WPtrp ∧ c_stringc_memhi_callm fuel p bytes

split ; exact Hw |

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w
⊢
∃p : ptr bytes : listZ, WPtrhi_literal = WPtrp ∧ c_stringc_memhi_callm fuel p bytes

exists hi_literal, hello_bytes

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
m :
fuel :
Z
Hr :
repm w

auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests m w fuel Hr Hw Hstr
exists puts_contractrep requests, WPtrhi_literal
split ; reflexivity |
split ; reflexivity |
split
–split ; right ; exists TAtom"v1" ; reflexivity |
exists TmpTAtom"v0"
reflexivity
–split ; exact Hr |
split ; exact Hw |
auto
120Theorem hi_puts_end
∀ rep requests s m w trace ending s′ m′ w′
M.E.invokeputs_contractrep requests site_resulthi_site site_argshi_site WPtrhi_literal s m w trace ending s′ m′ w′
∃n, ending = CallReturnWIntn ∨ ∃why, ending = CallResourcewhy ∧ resource_reasonwhy ∧ ¬puts_panicwhy
Explore proof 11 tactics

Initial goal

⊢
∀rep : mem → stdio_world → Prop requests : listword → mem → stdio_world → Z → Z → Prop s : R.state m : mem w : stdio_world trace : listevent ending : call_end s′ : R.state m′ : mem w′ : stdio_world, M.E.invokeputs_contractrep requests site_resulthi_site site_argshi_site WPtrhi_literal s m w trace ending s′ m′ w′ → ∃n : Z, ending = CallReturnWIntn ∨ ∃why : reason, ending = CallResourcewhy ∧ resource_reasonwhy ∧ ¬puts_panicwhy

intros rep requests s m w trace ending s′ m′ w′ H

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
ending :
s′ :
R.state
m′ :
H :
M.E.invokeputs_contractrep requests site_resulthi_site site_argshi_site WPtrhi_literal s m w trace ending s′ m′ w′
⊢
∃n : Z, ending = CallReturnWIntn ∨ ∃why : reason, ending = CallResourcewhy ∧ resource_reasonwhy ∧ ¬puts_panicwhy

destruct H

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
ending :
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H2 :
contract_postputs_contractrep requests WPtrhi_literal m w born trace ending m′ w′
H3 :
∀why : reason, ending ≠ CallResourcewhy
H4 :
∀values : listword, ending = CallReturnvalues → return_shapecontract_returnsputs_contractrep requests values ∧ Forallword_authoritycontract_sourcesputs_contractrep requests WPtrhi_literal m w born m′ values
H5 :
∀status : Z, ending = CallExitstatus → ∃before : listevent, trace = before ++ ProcessExitstatus
⊢
∃n : Z, ending = CallReturnWIntn ∨ ∃why : reason, ending = CallResourcewhy ∧ resource_reasonwhy ∧ ¬puts_panicwhy
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢
∃n : Z, CallResourcewhy = CallReturnWIntn ∨ ∃why0 : reason, CallResourcewhy = CallResourcewhy0 ∧ resource_reasonwhy0 ∧ ¬puts_panicwhy0

–left

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
ending :
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H2 :
contract_postputs_contractrep requests WPtrhi_literal m w born trace ending m′ w′
H3 :
∀why : reason, ending ≠ CallResourcewhy
H4 :
∀values : listword, ending = CallReturnvalues → return_shapecontract_returnsputs_contractrep requests values ∧ Forallword_authoritycontract_sourcesputs_contractrep requests WPtrhi_literal m w born m′ values
H5 :
∀status : Z, ending = CallExitstatus → ∃before : listevent, trace = before ++ ProcessExitstatus
⊢
∃n : Z, ending = CallReturnWIntn
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢
∃n : Z, CallResourcewhy = CallReturnWIntn ∨ ∃why0 : reason, CallResourcewhy = CallResourcewhy0 ∧ resource_reasonwhy0 ∧ ¬puts_panicwhy0

destruct H2 as p & bytes & acc & tail & n & _ & _ & _ & _ & _ & Hend & _

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
ending :
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
p :
bytes, acc, tail :
listZ
n :
Z
Hend :
ending = CallReturnWIntn
H3 :
∀why : reason, ending ≠ CallResourcewhy
H4 :
∀values : listword, ending = CallReturnvalues → return_shapecontract_returnsputs_contractrep requests values ∧ Forallword_authoritycontract_sourcesputs_contractrep requests WPtrhi_literal m w born m′ values
H5 :
∀status : Z, ending = CallExitstatus → ∃before : listevent, trace = before ++ ProcessExitstatus
⊢
∃n0 : Z, ending = CallReturnWIntn0
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢
∃n : Z, CallResourcewhy = CallReturnWIntn ∨ ∃why0 : reason, CallResourcewhy = CallResourcewhy0 ∧ resource_reasonwhy0 ∧ ¬puts_panicwhy0

exists n

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
ending :
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
p :
bytes, acc, tail :
listZ
n :
Z
Hend :
ending = CallReturnWIntn
H3 :
∀why : reason, ending ≠ CallResourcewhy
H4 :
∀values : listword, ending = CallReturnvalues → return_shapecontract_returnsputs_contractrep requests values ∧ Forallword_authoritycontract_sourcesputs_contractrep requests WPtrhi_literal m w born m′ values
H5 :
∀status : Z, ending = CallExitstatus → ∃before : listevent, trace = before ++ ProcessExitstatus
⊢
ending = CallReturnWIntn
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢
∃n : Z, CallResourcewhy = CallReturnWIntn ∨ ∃why0 : reason, CallResourcewhy = CallResourcewhy0 ∧ resource_reasonwhy0 ∧ ¬puts_panicwhy0

exact Hend

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢
∃n : Z, CallResourcewhy = CallReturnWIntn ∨ ∃why0 : reason, CallResourcewhy = CallResourcewhy0 ∧ resource_reasonwhy0 ∧ ¬puts_panicwhy0

–right

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢
∃why0 : reason, CallResourcewhy = CallResourcewhy0 ∧ resource_reasonwhy0 ∧ ¬puts_panicwhy0

exists why

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢

repeat split ; auto

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :
⊢

apply puts_no_capability_panic with rep := rep requests := requests

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
why :
trace :
listevent
s′ :
R.state
m′ :
born :
listZ
H1 :
M.E.prefixputs_contractrep requests WPtrhi_literal s m w born trace s′ m′ w′
H3 :

assumption

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests s m w trace ending s′ m′ w′ H
destruct H
–left
destruct H2 as p & bytes & acc & tail & n & _ & _ & _ & _ & _ & Hend & _
exists n
exact Hend
–right
exists why
repeat split ; auto
apply puts_no_capability_panic with rep := rep requests := requests
assumption
133Lemma hi_return_environment
∀ rep requests n m fuel
external_envputs_contractrep requests hi_site WIntn fr_envc_framehi_callm fuel = SomeTAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal
Explore proof 1 tactics

Initial goal

⊢
∀rep : mem → stdio_world → Prop requests : listword → mem → stdio_world → Z → Z → Prop n : Z m : mem fuel : Z, external_envputs_contractrep requests hi_site WIntn fr_envc_framehi_callm fuel = SomeTAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity
140Theorem hi_after_puts_return
Explore proof 3 tactics

Initial goal

⊢
∀n : Z m m′ : mem fuel : Z, main_return_sitehi_genv resume_externalhi_callm fuel hi_site TAtom"v1", WIntn; TAtom"v0", WPtrhi_literal m′ 0

intros n m m′ fuel

exists TAtom"start", Const0

repeat split ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros n m m′ fuel
exists TAtom"start", Const0
repeat split ; reflexivity
151Theorem hi_returning_run
∀ rep requests s m w trace n s′ m′ w′ fuel
let c′ ≔ resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′ in
M.runhi_registryrep requests hi_genv M.Runninghi_callm fuel, s w trace M.StoppedCoreEndRetWInt0 c′, s′ w′
Explore proof 12 tactics

Initial goal

⊢
∀ rep : mem → stdio_world → Prop requests : listword → mem → stdio_world → Z → Z → Prop s : R.state m : mem w : stdio_world trace : listevent n : Z s′ : R.state m′ : mem w′ : stdio_world fuel : Z  ,
→
let c′ ≔ resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′ in
M.runhi_registryrep requests hi_genv M.Runninghi_callm fuel, s w trace M.StoppedCoreEndRetWInt0 c′, s′ w′

intros rep requests s m w trace n s′ m′ w′ fuel H

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
let c′ ≔ resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′ in
M.runhi_registryrep requests hi_genv M.Runninghi_callm fuel, s w trace M.StoppedCoreEndRetWInt0 c′, s′ w′

cbv zeta

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.Runninghi_callm fuel, s w trace M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′

rewrite <- app_nil_rtrace

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.Runninghi_callm fuel, s w trace ++ [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′

eapply M.run_cons with trace := trace tail := [ ]

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.stephi_registryrep requests hi_genv M.Runninghi_callm fuel, s w trace ?mid
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv ?mid [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′
shelved goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢

–eapply M.step_return with site := hi_site values := WIntn ; apply hi_external_site | reflexivity | reflexivity | exact H | reflexivity

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.Runningresume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′, s′ w′ [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′

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

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.stephi_registryrep requests hi_genv M.Runningresume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′, s′ w′ [ ] ?mid
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv ?mid [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′
shelved goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢

+apply M.step_core_end

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
∀site : call_site, ¬external_sitehi_genv resume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′ site
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.StoppedCoreEnd?o resume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′, s′ w′ [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′
shelved goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z

∗intros site Hsite

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
site :
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.StoppedCoreEnd?o resume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′, s′ w′ [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′
shelved goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z

pose proof external_site_stuck_ _ _ Hsite as Hstuck

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
site :
Hstuck :
stephi_genv resume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′ = Stuck"instruction"
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.StoppedCoreEnd?o resume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′, s′ w′ [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′
shelved goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z

discriminate Hstuck

3 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.StoppedCoreEnd?o resume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′, s′ w′ [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′
shelved goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z

∗exact proj1main_return_step_ _ _ hi_after_puts_returnn mod 2 ^ 32 m m′ fuel

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
s :
R.state
m :
trace :
listevent
n :
Z
s′ :
R.state
m′ :
fuel :
Z
⊢
M.runhi_registryrep requests hi_genv M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site putTAtom"v1" WIntn mod 2 ^ 32 fr_envc_framehi_callm fuel m′, s′ w′ [ ] M.StoppedCoreEndRetWInt0 resume_externalhi_callm fuel hi_site TAtom"v1", WIntn mod 2 ^ 32; TAtom"v0", WPtrhi_literal m′, s′ w′

+constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests s m w trace n s′ m′ w′ fuel H
cbv zeta
rewrite <- app_nil_rtrace
eapply M.run_cons with trace := trace tail := [ ]
–eapply M.step_return with site := hi_site values := WIntn ; apply hi_external_site | reflexivity | reflexivity | exact H | reflexivity
–eapply M.run_cons with trace := [ ] tail := [ ]
∗intros site Hsite
pose proof external_site_stuck_ _ _ Hsite as Hstuck
discriminate Hstuck
∗exact proj1main_return_step_ _ _ hi_after_puts_returnn mod 2 ^ 32 m m′ fuel
+constructor
173Definition hi_literal_validm : mem : Prop ≔
178Lemma hi_literal_checked
Explore proof 6 tactics

Initial goal

intros m Hreg Hbytes

m :
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :

split ; | exact Hbytes

m :
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
⊢
access_resm ptr_addrhi_literal ptr_caphi_literal Z.of_natDatatypes.lengthhello_bytes + 1 Read 1 = Someok

unfold access_res , cap_access_res

m :
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
⊢
Objbase
⇒
let* reg ≔ object_regionbase m_regionsm in
Some
base ≤? ptr_addrhi_literal && ptr_addrhi_literal + Z.of_natDatatypes.lengthhello_bytes + 1 ≤? r_endreg
→
Robase
⇒
let* reg ≔ object_regionbase m_regionsm in
Some
⇒
None
=
Someok

simpl

m :
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
⊢
let* reg ≔ object_region65552 m_regionsm in
Some
65558 ≤? r_endreg
→
=
Someok

rewrite Hreg

m :
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
⊢
Some
65558 ≤? r_endr_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
→
=
Someok

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m Hreg Hbytes
split ; | exact Hbytes
simpl
rewrite Hreg
reflexivity
186Example hi_literal_initial: hi_literal_validhi_memory
Explore proof 2 tactics

Initial goal

vm_compute

⊢
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 104 = 104 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 101 = 101 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 108 = 108 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 108 = 108 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 111 = 111 ∧ 0 = 0

repeat split ; try reflexivity ; lia

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
repeat split ; try reflexivity ; lia
191Lemma hi_literal_safepoint
∀ s m s′ m′
R.safepoints m s′ m′
Explore proof 18 tactics

Initial goal

⊢
∀s : R.state m : mem s′ : R.state m′ : mem, R.safepoints m s′ m′ → hi_literal_validm → hi_literal_validm′

intros s m s′ m′ Hsp Hreg Hbytes

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :

assert Hexists : object_region65552 m_regionsm′ ≠ None

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
⊢
object_region65552 m_regionsm′ ≠ None
focused goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
object_region65552 m_regionsm′ ≠ None

{apply R.rooting_ _ _ _ Hsp

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
⊢
object_region65552 m_regionsm ≠ None
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
object_region65552 m_regionsm′ ≠ None

rewrite Hreg

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
⊢
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ≠ None
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
object_region65552 m_regionsm′ ≠ None

discriminate

deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
object_region65552 m_regionsm′ ≠ None

destruct object_region65552 m_regionsm′ as reg′ | eqn: E ; | contradiction

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None

destruct R.safepoint_lifetime_ _ _ _ Hsp _ _ E as reg & Hr & Heq | Hheap _

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Heq :
reg′ = reg
focused goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

–rewrite Hreg in Hr

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live = Somereg
Heq :
reg′ = reg
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

injection Hr as ←

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
Heq :
reg′ = r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

subst reg′

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ≠ None
E :
object_region65552 m_regionsm′ = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

split ; exact E |

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ≠ None
E :
object_region65552 m_regionsm′ = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
⊢
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

eapply string_at_agree ; | exact Hbytes

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ≠ None
E :
object_region65552 m_regionsm′ = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
⊢
∀b : Z, 65552 ≤ b < 65552 + Z.of_natDatatypes.lengthhello_bytes + 1 → m_bytesm′ b = m_bytesm b
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

intros a

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ≠ None
E :
object_region65552 m_regionsm′ = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
a :
Z
⊢
65552 ≤ a < 65552 + Z.of_natDatatypes.lengthhello_bytes + 1 → m_bytesm′ a = m_bytesm a
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

rewrite R.non_moving_ _ _ _ Hsp

2 open

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
Hexists :
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ≠ None
E :
object_region65552 m_regionsm′ = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
a :
Z
⊢
65552 ≤ a < 65552 + Z.of_natDatatypes.lengthhello_bytes + 1 → m_bytesm a = m_bytesm a
deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

reflexivity

deferred goal
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
object_region65552 m_regionsm = Somereg
Hheap :
r_kindreg = Heap

–rewrite Hreg in Hr

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
reg :
Hr :
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live = Somereg
Hheap :
r_kindreg = Heap

injection Hr as ←

s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hreg :
object_region65552 m_regionsm = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live
Hbytes :
reg′ :
E :
object_region65552 m_regionsm′ = Somereg′
Hexists :
Somereg′ ≠ None
Hheap :
r_kindr_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live = Heap

discriminate Hheap

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s m s′ m′ Hsp Hreg Hbytes
assert Hexists : object_region65552 m_regionsm′ ≠ None
{apply R.rooting_ _ _ _ Hsp
rewrite Hreg
discriminate
destruct object_region65552 m_regionsm′ as reg′ | eqn: E ; | contradiction
destruct R.safepoint_lifetime_ _ _ _ Hsp _ _ E as reg & Hr & Heq | Hheap _
–rewrite Hreg in Hr
injection Hr as ←
subst reg′
split ; exact E |
eapply string_at_agree ; | exact Hbytes
intros a
rewrite R.non_moving_ _ _ _ Hsp
reflexivity
–rewrite Hreg in Hr
injection Hr as ←
discriminate Hheap
206Definition hi_copym : mem fuel : Z : config ≔
210Definition hi_returnm : mem fuel : Z e : env : config ≔
hi_configm fuel e ExecTAtom"start" [ ] JRetConst0
214Lemma hi_entry_step
∀ m fuel
Semantics.stephi_genv hi_entrym fuel
=
fuel =? 0
→
else
Nexthi_copym fuel − 1
Explore proof 2 tactics

Initial goal

⊢
∀ m : mem fuel : Z  ,
=
fuel =? 0
→
else
Nexthi_copym fuel − 1

intros m fuel

m :
fuel :
Z
⊢
=
fuel =? 0
→
else
Nexthi_copym fuel − 1

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m fuel
reflexivity
220Lemma hi_copy_step
∀ m fuel
Semantics.stephi_genv hi_copym fuel = Nexthi_callm fuel
Explore proof 1 tactics

Initial goal

⊢
∀m : mem fuel : Z, stephi_genv hi_copym fuel = Nexthi_callm fuel

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity
225Lemma hi_return_step
∀ m fuel e
Semantics.stephi_genv hi_returnm fuel e = DoneRetWInt0
Explore proof 1 tactics

Initial goal

⊢
∀m : mem fuel : Z e : env, stephi_genv hi_returnm fuel e = DoneRetWInt0

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity
230Lemma hi_site_unique
∀ m fuel site
site = hi_site
Explore proof 4 tactics

Initial goal

⊢
∀m : mem fuel : Z site : call_site, external_sitehi_genv hi_callm fuel site → site = hi_site

intros m fuel l r n args rest j _ & Hat & _

m :
fuel :
Z
l :
n :
args :
listarg
rest :
listinst
j :
Hat :
fr_atc_framehi_callm fuel = Execsite_labelsite_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j Callsite_resultsite_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j Globalsite_namesite_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j site_argssite_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j :: site_restsite_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j site_jumpsite_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j
⊢
site_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j = hi_site

simpl in Hat

m :
fuel :
Z
l :
n :
args :
listarg
rest :
listinst
j :
Hat :
ExecTAtom"start" CallCResultTAtom"v1" W GlobalTAtom"puts" ArgP TmpTAtom"v0" JRetConst0 = Execl Callr Globaln args :: rest j
⊢
site_label ≔ l; site_result ≔ r; site_name ≔ n; site_args ≔ args; site_rest ≔ rest; site_jump ≔ j = hi_site

inversion Hat

m :
fuel :
Z
l :
n :
args :
listarg
rest :
listinst
j :
Hat :
ExecTAtom"start" CallCResultTAtom"v1" W GlobalTAtom"puts" ArgP TmpTAtom"v0" JRetConst0 = Execl Callr Globaln args :: rest j
H0 :
TAtom"start" = l
H1 :
CResultTAtom"v1" W = r
H2 :
TAtom"puts" = n
H3 :
ArgP TmpTAtom"v0" = args
H4 :
[ ] = rest
H5 :
JRetConst0 = j
⊢
site_label ≔ TAtom"start"; site_result ≔ CResultTAtom"v1" W; site_name ≔ TAtom"puts"; site_args ≔ ArgP TmpTAtom"v0"; site_rest ≔ [ ]; site_jump ≔ JRetConst0 = hi_site

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m fuel l r n args rest j _ & Hat & _
simpl in Hat
inversion Hat
reflexivity
239Section BodySafety
240Variable rep : mem → stdio_world → Prop
241Variable requests : listword → mem → stdio_world → Z → Z → Prop
247Hypothesis stdio_stable
∀ s m s′ m′ w
R.safepoints m s′ m′
repm w
repm′ w ∧ stdio_readym′ w
252Definition hi_before_callm : mem w : stdio_world : Prop ≔
256Lemma hi_before_safepoint
∀ s m s′ m′ w
R.safepoints m s′ m′
Explore proof 5 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → hi_before_callm w → hi_before_callm′ w

intros s m s′ m′ w Hsp Hr Hw Hl

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hr :
repm w

destruct stdio_stable_ _ _ _ _ Hsp Hr Hw as Hr′ Hw′

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hr :
repm w
Hr′ :
repm′ w
Hw′ :

split ; exact Hr′ |

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hr :
repm w
Hr′ :
repm′ w
Hw′ :
⊢

split ; exact Hw′ |

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
s′ :
R.state
m′ :
Hsp :
R.safepoints m s′ m′
Hr :
repm w
Hr′ :
repm′ w
Hw′ :

eapply hi_literal_safepoint ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s m s′ m′ w Hsp Hr Hw Hl
destruct stdio_stable_ _ _ _ _ Hsp Hr Hw as Hr′ Hw′
split ; exact Hr′ |
split ; exact Hw′ |
eapply hi_literal_safepoint ; eauto
266Definition hi_endingwhy : ending : Prop ≔
why = CoreEndRetWInt0 ∨ why = CoreEndOutOfFuel ∨ ∃resource, why = CoreEndTrapresource ∧ resource_reasonresource
271Inductive hi_body_state: M.statestdio_world → Prop ≔
∀ m fuel s w
hi_body_entry
∀ m fuel s w
hi_body_copy
∀ m fuel s w
hi_body_call
∀ m fuel e s w
hi_body_return
∀ why ms w
hi_body_end
284Theorem hi_reached_call_admissible
Explore proof 15 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀c : config s : R.state w : stdio_world site : call_site, hi_body_stateM.Runningc, s w → external_sitehi_genv c site → site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv c w site

intros c s w site Hinv Hsite

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv c w site

inversion Hinv ; subst

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_entrym fuel w site
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_copym fuel w site
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_callm fuel w site
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

–pose proof external_site_stuck_ _ _ Hsite as Hstuck

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
Hstuck :
stephi_genv hi_entrym fuel = Stuck"instruction"
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_entrym fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_copym fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_callm fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

rewrite hi_entry_step in Hstuck

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
Hstuck :
fuel =? 0
→
else
Nexthi_copym fuel − 1
=
Stuck"instruction"
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_entrym fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_copym fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_callm fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

destruct fuel =? 0 ; discriminate

3 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_copym fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_callm fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

–pose proof external_site_stuck_ _ _ Hsite as Hstuck

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
Hstuck :
stephi_genv hi_copym fuel = Stuck"instruction"
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_copym fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_callm fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

rewrite hi_copy_step in Hstuck

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
Hstuck :
Nexthi_callm fuel = Stuck"instruction"
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_copym fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_callm fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

discriminate

2 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_callm fuel w site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

–pose proof hi_site_unique_ _ _ Hsite as →

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

split ; reflexivity |

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

match goal withHpre : hi_before_call_ _ |- _⇒destruct Hpre as Hr Hw Hlend

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hr :
repm w
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

apply hi_call_admissible ; auto using hi_literal_checked

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

–pose proof external_site_stuck_ _ _ Hsite as Hstuck

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
Hstuck :
stephi_genv hi_returnm fuel e = Stuck"instruction"
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

rewrite hi_return_step in Hstuck

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
m :
fuel :
Z
e :
Hsite :
Hstuck :
DoneRetWInt0 = Stuck"instruction"
⊢
site = hi_site ∧ M.admissiblehi_registryrep requests hi_genv hi_returnm fuel e w site

discriminate

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros c s w site Hinv Hsite
inversion Hinv ; subst
–pose proof external_site_stuck_ _ _ Hsite as Hstuck
rewrite hi_entry_step in Hstuck
destruct fuel =? 0 ; discriminate
–pose proof external_site_stuck_ _ _ Hsite as Hstuck
rewrite hi_copy_step in Hstuck
discriminate
–pose proof hi_site_unique_ _ _ Hsite as →
split ; reflexivity |
match goal withHpre : hi_before_call_ _ |- _⇒destruct Hpre as Hr Hw Hlend
–pose proof external_site_stuck_ _ _ Hsite as Hstuck
rewrite hi_return_step in Hstuck
discriminate
301Lemma hi_body_core
∀ c s c′ s′ w
Proof 33 steps Qed
intros c s c′ s′ w Hinv Hcore
inversion Hinv ; subst
–inversion Hcore as c0 c1 rt Hnext | c0 q k rt base rt′ Hfresh Hsize Ha | c0 rt rt′ m′ Hdue Hsp ; subst
+rewrite hi_entry_step in Hnext
destruct fuel =? 0 ; inversion Hnext ; subst
assumption
+rewrite hi_entry_step in Hfresh
destruct fuel =? 0 ; discriminate
+discriminate Hdue
–inversion Hcore as c0 c1 rt Hnext | c0 q k rt base rt′ Hfresh Hsize Ha | c0 rt rt′ m′ Hdue Hsp ; subst
+rewrite hi_copy_step in Hnext
inversion Hnext ; subst
assumption
+rewrite hi_copy_step in Hfresh
discriminate
eapply hi_before_safepoint ; eauto
–pose proof external_site_stuck_ _ _ hi_external_sitem fuel as Hstuck
inversion Hcore as c0 c1 rt Hnext | c0 q k rt base rt′ Hfresh Hsize Ha | c0 rt rt′ m′ Hdue Hsp ; subst
+rewrite Hstuck in Hnext
discriminate
+rewrite Hstuck in Hfresh
discriminate
eapply hi_before_safepoint ; eauto
–inversion Hcore as c0 c1 rt Hnext | c0 q k rt base rt′ Hfresh Hsize Ha | c0 rt rt′ m′ Hdue Hsp ; subst
+rewrite hi_return_step in Hnext
discriminate
+rewrite hi_return_step in Hfresh
discriminate
+discriminate Hdue

An actual core terminal at a body phase is return zero or OutOfFuel.

327Lemma hi_body_core_end
∀ c s w o
Semantics.stephi_genv c = Doneo
Explore proof 12 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀c : config s : R.state w : stdio_world o : outcome, hi_body_stateM.Runningc, s w → stephi_genv c = Doneo → hi_endingCoreEndo

intros c s w o Hinv Hdone

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
Hdone :

inversion Hinv ; subst

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

–rewrite hi_entry_step in Hdone

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
fuel =? 0
→
else
Nexthi_copym fuel − 1
=
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

destruct fuel =? 0 ; inversion Hdone

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
H1 :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

right ; left ; reflexivity

3 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

–rewrite hi_copy_step in Hdone

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
Nexthi_callm fuel = Doneo
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

discriminate

2 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

–rewrite external_site_stuck_ _ _ hi_external_sitem fuel in Hdone

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
Hdone :
Stuck"instruction" = Doneo
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

discriminate

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

–rewrite hi_return_step in Hdone

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :

inversion Hdone

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
e :
Hdone :
H0 :
RetWInt0 = o

left ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros c s w o Hinv Hdone
inversion Hinv ; subst
–rewrite hi_entry_step in Hdone
destruct fuel =? 0 ; inversion Hdone
right ; left ; reflexivity
–rewrite hi_copy_step in Hdone
discriminate
–rewrite external_site_stuck_ _ _ hi_external_sitem fuel in Hdone
discriminate
–rewrite hi_return_step in Hdone
inversion Hdone
left ; reflexivity

Core stuck at a body phase is exactly the external call, never an unhandled core error. Missing coverage is still detected by the external rules.

340Lemma hi_body_stuck_external
∀ c s w diagnostic
Semantics.stephi_genv c = Stuckdiagnostic
∃site, external_sitehi_genv c site
Explore proof 10 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀c : config s : R.state w : stdio_world diagnostic : string, hi_body_stateM.Runningc, s w → stephi_genv c = Stuckdiagnostic → ∃site : call_site, external_sitehi_genv c site

intros c s w diagnostic Hinv Hstuck

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
Hstuck :
stephi_genv c = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv c site

inversion Hinv ; subst

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_entrym fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_entrym fuel site
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_copym fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_copym fuel site
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_callm fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_callm fuel site
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

–rewrite hi_entry_step in Hstuck

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
fuel =? 0
→
else
Nexthi_copym fuel − 1
=
Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_entrym fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_copym fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_copym fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_callm fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_callm fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

destruct fuel =? 0 ; discriminate

3 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_copym fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_copym fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_callm fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_callm fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

–rewrite hi_copy_step in Hstuck

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
Nexthi_callm fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_copym fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_callm fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_callm fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

discriminate

2 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_callm fuel = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_callm fuel site
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

–exists hi_site

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
Hstuck :
stephi_genv hi_callm fuel = Stuckdiagnostic
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

apply hi_external_site

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

–rewrite hi_return_step in Hstuck

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
diagnostic :
m :
fuel :
Z
e :
Hstuck :
DoneRetWInt0 = Stuckdiagnostic
⊢
∃site : call_site, external_sitehi_genv hi_returnm fuel e site

discriminate

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros c s w diagnostic Hinv Hstuck
inversion Hinv ; subst
–rewrite hi_entry_step in Hstuck
destruct fuel =? 0 ; discriminate
–rewrite hi_copy_step in Hstuck
discriminate
–exists hi_site
–rewrite hi_return_step in Hstuck
discriminate

No core allocation is hidden in this body. Puts' allocations remain in its contract.

352Lemma hi_body_no_fresh
∀ c s w q k
Semantics.stephi_genv c ≠ Freshq k
Explore proof 10 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀c : config s : R.state w : stdio_world q : alloc_req k : Z → config, hi_body_stateM.Runningc, s w → stephi_genv c ≠ Freshq k

intros c s w q k Hinv Hfresh

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
Hfresh :
⊢
False

inversion Hinv ; subst

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

–rewrite hi_entry_step in Hfresh

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
fuel =? 0
→
else
Nexthi_copym fuel − 1
=
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

destruct fuel =? 0 ; discriminate

3 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

–rewrite hi_copy_step in Hfresh

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
Nexthi_callm fuel = Freshq k
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

discriminate

2 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

–rewrite external_site_stuck_ _ _ hi_external_sitem fuel in Hfresh

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
Hfresh :
Stuck"instruction" = Freshq k
⊢
False
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

discriminate

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

–rewrite hi_return_step in Hfresh

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
k :
Z → config
m :
fuel :
Z
e :
Hfresh :
⊢
False

discriminate

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros c s w q k Hinv Hfresh
inversion Hinv ; subst
–rewrite hi_entry_step in Hfresh
destruct fuel =? 0 ; discriminate
–rewrite hi_copy_step in Hfresh
discriminate
–rewrite external_site_stuck_ _ _ hi_external_sitem fuel in Hfresh
discriminate
–rewrite hi_return_step in Hfresh
discriminate

Dispatch and argument evaluation select exactly this contract and literal.

363Lemma hi_selected_call
∀ c s w site spec xs
∃m fuel, c = hi_callm fuel ∧ site = hi_site ∧ spec = puts_contractrep requests ∧ xs = WPtrhi_literal
Explore proof 18 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀c : config s : R.state w : stdio_world site : call_site spec : contractstdio_world xs : listword, hi_body_stateM.Runningc, s w → external_sitehi_genv c site → hi_registryrep requests site_namesite = Somespec → map_optionarg_xhi_genv fr_envc_framec site_argssite = Somexs → ∃m : mem fuel : Z, c = hi_callm fuel ∧ site = hi_site ∧ spec = puts_contractrep requests ∧ xs = WPtrhi_literal

intros c s w site spec xs Hinv Hsite Hreg Hargs

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
site :
xs :
listword
Hsite :
Hreg :
hi_registryrep requests site_namesite = Somespec
⊢
∃m : mem fuel : Z, c = hi_callm fuel ∧ site = hi_site ∧ spec = puts_contractrep requests ∧ xs = WPtrhi_literal

destruct hi_reached_call_admissible_ _ _ _ Hinv Hsite as → _

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
Hreg :
hi_registryrep requests site_namehi_site = Somespec
⊢
∃m : mem fuel : Z, c = hi_callm fuel ∧ hi_site = hi_site ∧ spec = puts_contractrep requests ∧ xs = WPtrhi_literal

change Someputs_contractrep requests = Somespec in Hreg

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
Hreg :
Someputs_contractrep requests = Somespec
⊢
∃m : mem fuel : Z, c = hi_callm fuel ∧ hi_site = hi_site ∧ spec = puts_contractrep requests ∧ xs = WPtrhi_literal

injection Hreg as ←

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
⊢
∃m : mem fuel : Z, c = hi_callm fuel ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

inversion Hinv ; subst

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_entrym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_copym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

–pose proof external_site_stuck_ _ _ Hsite as Hstuck

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
Hstuck :
stephi_genv hi_entrym fuel = Stuck"instruction"
⊢
∃m0 : mem fuel0 : Z, hi_entrym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_copym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

rewrite hi_entry_step in Hstuck

4 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
Hstuck :
fuel =? 0
→
else
Nexthi_copym fuel − 1
=
Stuck"instruction"
⊢
∃m0 : mem fuel0 : Z, hi_entrym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_copym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

destruct fuel =? 0 ; discriminate

3 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_copym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

–pose proof external_site_stuck_ _ _ Hsite as Hstuck

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
Hstuck :
stephi_genv hi_copym fuel = Stuck"instruction"
⊢
∃m0 : mem fuel0 : Z, hi_copym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

rewrite hi_copy_step in Hstuck

3 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
Hstuck :
Nexthi_callm fuel = Stuck"instruction"
⊢
∃m0 : mem fuel0 : Z, hi_copym fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

discriminate

2 open

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

–change SomeWPtrhi_literal = Somexs in Hargs

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
Hargs :
SomeWPtrhi_literal = Somexs
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

injection Hargs as ←

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
⊢
∃m0 : mem fuel0 : Z, hi_callm fuel = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ WPtrhi_literal = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

exists m, fuel

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
m :
fuel :
Z
⊢
hi_callm fuel = hi_callm fuel ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ WPtrhi_literal = WPtrhi_literal
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

repeat split ; reflexivity

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

–pose proof external_site_stuck_ _ _ Hsite as Hstuck

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
Hstuck :
stephi_genv hi_returnm fuel e = Stuck"instruction"
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

rewrite hi_return_step in Hstuck

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
s :
R.state
xs :
listword
m :
fuel :
Z
e :
Hstuck :
DoneRetWInt0 = Stuck"instruction"
⊢
∃m0 : mem fuel0 : Z, hi_returnm fuel e = hi_callm0 fuel0 ∧ hi_site = hi_site ∧ puts_contractrep requests = puts_contractrep requests ∧ xs = WPtrhi_literal

discriminate

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros c s w site spec xs Hinv Hsite Hreg Hargs
destruct hi_reached_call_admissible_ _ _ _ Hinv Hsite as → _
change Someputs_contractrep requests = Somespec in Hreg
injection Hreg as ←
inversion Hinv ; subst
–pose proof external_site_stuck_ _ _ Hsite as Hstuck
rewrite hi_entry_step in Hstuck
destruct fuel =? 0 ; discriminate
–pose proof external_site_stuck_ _ _ Hsite as Hstuck
rewrite hi_copy_step in Hstuck
discriminate
–change SomeWPtrhi_literal = Somexs in Hargs
injection Hargs as ←
exists m, fuel
repeat split ; reflexivity
–pose proof external_site_stuck_ _ _ Hsite as Hstuck
rewrite hi_return_step in Hstuck
discriminate

Every enabled labelled step retains the body invariant. Bad contracts are not filtered out: the concrete call's proved obligations contradict rejection.

386Theorem hi_body_step
∀ st trace st′
Proof 31 steps Qed
intros st trace st′ Hstep Hinv
destruct Hstep as ms ms′ w Hcore | c s w o Hnone Hdone | c s w why Hnone Hstuck | c s w q k Hnone Hfresh Hsize Hrefuse | c s w site spec xs trace values s′ m′ w′ e Hsite Hreg Hargs Hcall Henv | c s w site spec xs trace status s′ m′ w′ Hsite Hreg Hargs Hcall | c s w site spec xs trace why s′ m′ w′ Hsite Hreg Hargs Hcall | c s w site why Hsite Hreject | c s w site spec xs trace values s′ m′ w′ Hsite Hreg Hargs Hcall Henv
–destruct ms as c s , ms' as c′ s′
eapply hi_body_core ; eauto
–apply hi_body_end
eapply hi_body_core_end ; eauto
–destruct hi_body_stuck_external_ _ _ _ Hinv Hstuck as site Hsite
exfalso
exact Hnonesite Hsite
–exfalso
exact hi_body_no_fresh_ _ _ _ _ Hinv Hfresh
–destruct hi_selected_call_ _ _ _ _ _ Hinv Hsite Hreg Hargs as m & fuel & → & → & → & →
destruct hi_puts_end_ _ _ _ _ _ _ _ _ _ Hcall as n & Hend | why & Hend & _ ; inversion Hend ; subst
rewrite hi_return_environment in Henv
injection Henv as ←
–destruct hi_selected_call_ _ _ _ _ _ Hinv Hsite Hreg Hargs as m & fuel & → & → & → & →
destruct hi_puts_end_ _ _ _ _ _ _ _ _ _ Hcall as n & Hend | why & Hend & _ ; discriminate Hend
–destruct hi_selected_call_ _ _ _ _ _ Hinv Hsite Hreg Hargs as m & fuel & → & → & → & →
destruct hi_puts_end_ _ _ _ _ _ _ _ _ _ Hcall as n & Hend | resource & Hend & Hresource & _ ; inversion Hend ; subst
right ; right
exists resource
auto
–destruct hi_reached_call_admissible_ _ _ _ Hinv Hsite as _ Hadmit
exfalso
exact M.admissible_not_rejected_ _ _ _ _ _ _ Hadmit Hreject
–destruct hi_selected_call_ _ _ _ _ _ Hinv Hsite Hreg Hargs as m & fuel & → & → & → & →
destruct hi_puts_end_ _ _ _ _ _ _ _ _ _ Hcall as n & Hend | why & Hend & _ ; inversion Hend ; subst
rewrite hi_return_environment in Henv
discriminate

Safety covers every represented finite run, including arbitrarily many permitted safepoints, not just the exhibited two-step path to puts.

430Theorem hi_body_run
∀ st trace st′
Explore proof 5 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀st : M.statestdio_world trace : listevent st′ : M.statestdio_world, M.runhi_registryrep requests hi_genv st trace st′ → hi_body_statest → hi_body_statest′

intros st trace st′ H

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
st :
trace :
listevent
st′ :
H :
M.runhi_registryrep requests hi_genv st trace st′

induction H ; auto |

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
M.stephi_registryrep requests hi_genv st trace mid
H0 :
M.runhi_registryrep requests hi_genv mid tail last
IHrun :

intros Hinv

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
M.stephi_registryrep requests hi_genv st trace mid
H0 :
M.runhi_registryrep requests hi_genv mid tail last
IHrun :

apply IHrun

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
st :
trace :
listevent
mid :
tail :
listevent
last :
H :
M.stephi_registryrep requests hi_genv st trace mid
H0 :
M.runhi_registryrep requests hi_genv mid tail last
IHrun :

eapply hi_body_step ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros st trace st′ H
induction H ; auto |
intros Hinv
apply IHrun
eapply hi_body_step ; eauto

Every reached external call meets its obligations, regardless of whether libc has a completed invocation there. No coverage-by-empty-relation claim.

440Theorem hi_all_calls_admissible
∀ m fuel s w trace c s′ w′ site
Explore proof 6 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀m : mem fuel : Z s : R.state w : stdio_world trace : listevent c : config s′ : R.state w′ : stdio_world site : call_site, hi_before_callm w → M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′ → external_sitehi_genv c site → M.admissiblehi_registryrep requests hi_genv c w′ site

intros m fuel s w trace c s′ w′ site Hpre Hrun Hsite

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
⊢
M.admissiblehi_registryrep requests hi_genv c w′ site

assert Hinv : hi_body_stateM.Runningc, s′ w′

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
⊢
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
Hinv :
⊢
M.admissiblehi_registryrep requests hi_genv c w′ site

{eapply hi_body_run ; exact Hrun |

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
Hinv :
⊢
M.admissiblehi_registryrep requests hi_genv c w′ site

apply hi_body_entry

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
Hinv :
⊢
M.admissiblehi_registryrep requests hi_genv c w′ site

exact Hpre

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
s′ :
R.state
site :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Runningc, s′ w′
Hsite :
Hinv :
⊢
M.admissiblehi_registryrep requests hi_genv c w′ site

exact proj2hi_reached_call_admissible_ _ _ _ Hinv Hsite

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m fuel s w trace c s′ w′ site Hpre Hrun Hsite
assert Hinv : hi_body_stateM.Runningc, s′ w′
{eapply hi_body_run ; exact Hrun |
exact Hpre
exact proj2hi_reached_call_admissible_ _ _ _ Hinv Hsite

A stopped application can only have a declared resource/fuel ending or return zero, under the explicit entry and environment premises.

454Theorem hi_finite_safety
∀ m fuel s w trace why ms w′
Explore proof 7 tactics

Initial goal

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
⊢
∀m : mem fuel : Z s : R.state w : stdio_world trace : listevent why : ending ms : M.P.I.RM.mstate w′ : stdio_world, hi_before_callm w → M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′ → hi_endingwhy

intros m fuel s w trace why ms w′ Hpre Hrun

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
⊢

assert Hinv : hi_body_stateM.Stoppedwhy ms w′

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
focused goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
Hinv :
⊢

{eapply hi_body_run ; exact Hrun |

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
Hinv :
⊢

apply hi_body_entry

2 open

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
Hinv :
⊢

exact Hpre

deferred goal
rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
Hinv :
⊢

inversion Hinv

rep :
mem → stdio_world → Prop
requests :
listword → mem → stdio_world → Z → Z → Prop
stdio_stable :
∀s : R.state m : mem s′ : R.state m′ : mem w : stdio_world, R.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w
m :
fuel :
Z
s :
R.state
trace :
listevent
why :
Hrun :
M.runhi_registryrep requests hi_genv M.Runninghi_entrym fuel, s w trace M.Stoppedwhy ms w′
Hinv :
why0 :
H0 :
H :
why0 = why
H1 :
ms0 = ms
H2 :
w0 = w′
⊢

assumption

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m fuel s w trace why ms w′ Hpre Hrun
assert Hinv : hi_body_stateM.Stoppedwhy ms w′
{eapply hi_body_run ; exact Hrun |
exact Hpre
inversion Hinv
assumption

Inhabited interpreter boundary checks

These represent the selected contracts, not native libc implementations.

470Module HiChecks
471Module H ≔ Hi InterpRuntime

Retain the actual initialized literal and give the fixture its existing libc root.

The fixture supplies the body invariant without assuming call admissibility.

Explore proof 9 tactics

Initial goal

split ; split ; reflexivity |

split

2 open

focused goal

–split ; reflexivity |

2 open

deferred goal

constructor ; | constructor

2 open

deferred goal

split ; simpl ; lia |

2 open

deferred goal

exists 2048, mkRegion2048 2064 Heap Live

2 open

⊢
ptr_capspan_ptrstdout_span = Obj2048 ∧ object_region2048 m_regionsmemory = Somer_base ≔ 2048; r_end ≔ 2064; r_kind ≔ Heap; r_life ≔ Live ∧ r_lifer_base ≔ 2048; r_end ≔ 2064; r_kind ≔ Heap; r_life ≔ Live = Live ∧ access_resmemory ptr_addrspan_ptrstdout_span Obj2048 span_sizestdout_span Write 1 = Someok
deferred goal

repeat split ; reflexivity

deferred goal

–vm_compute

⊢
Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live = Somer_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 104 = 104 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 101 = 101 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 108 = 108 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 108 = 108 ∧ Datatypes.Lt = Datatypes.Lt ∧ Datatypes.Lt = Datatypes.Lt ∧ 111 = 111 ∧ 0 = 0

repeat split ; try reflexivity ; lia

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
split ; split ; reflexivity |
split
–split ; reflexivity |
constructor ; | constructor
split ; simpl ; lia |
exists 2048, mkRegion2048 2064 Heap Live
repeat split ; reflexivity
–vm_compute
repeat split ; try reflexivity ; lia

Identity safepoints supply the stability premise for any representation.

489Lemma interpreter_stdio_stable
∀ rep : mem → stdio_world → Prop s m s′ m′ w
repm′ w ∧ stdio_readym′ w
Explore proof 2 tactics

Initial goal

⊢
∀rep : mem → stdio_world → Prop s : InterpRuntime.state m : mem s′ : InterpRuntime.state m′ : mem w : stdio_world, InterpRuntime.safepoints m s′ m′ → repm w → stdio_readym w → repm′ w ∧ stdio_readym′ w

intros rep s m s′ m′ w _ →

⊢
repm w → stdio_readym w → repm w ∧ stdio_readym w

auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep s m s′ m′ w _ →
auto

EOF may accept any prefix and still lets this exact main return zero.

Proof 36 steps Qed
intros acc tail Hb
destruct entry_pre as Hr Hw Hl
pose proof H.hi_literal_checkedmemory Hl as Hstr
eapply H.M.E.invoke_normal with born := [ ]
–split ; right ; exists TAtom"v1" ; reflexivity |
exists TmpTAtom"v0"
reflexivity
–split ; exact Hr |
split ; exact Hw |
auto
–split ; constructor |
split ; exact Hr |
split ; exact Hw |
split
+apply stdio_delegates_refl ; reflexivity | exact proj2Hw
+right
repeat split ; auto
–exists hi_literal, hello_bytes, acc, tail, 2 ^ 32 − 1
split ; reflexivity |
split ; exact Hstr |
split ; exact Hb |
split ; right ; reflexivity |
split ; reflexivity |
split ; reflexivity | exact Hw
–intros why Hbad
discriminate
–intros values Heq
injection Heq as ←
split
+exists WInt2 ^ 32 − 1
split ; reflexivity
+constructor ; exact I | constructor
–intros status Hbad
discriminate

The actual return-zero run after EOF, parameterized by the accepted bytes.

Every allowed EOF prefix can resume the actual source-shaped main.

530Lemma eof_run
∀ acc tail
hello_bytes ++ 10 = acc ++ tail
Explore proof 4 tactics
Source script

Empty acceptance is not mistaken for a successful full write.

540Example eof_empty_returns_zero: eof_main_returns_zero[ ]
Explore proof 2 tactics

Initial goal

apply eof_run_ hello_bytes ++ 10

⊢
hello_bytes ++ 10 = [ ] ++ hello_bytes ++ 10

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
apply eof_run_ hello_bytes ++ 10
reflexivity

Partial acceptance does not change the C source's return value.

544Example eof_partial_returns_zero: eof_main_returns_zero104; 101
Explore proof 2 tactics

Initial goal

apply eof_run_ 108; 108; 111; 10

⊢
hello_bytes ++ 10 = 104; 101 ++ 108; 108; 111; 10

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
apply eof_run_ 108; 108; 111; 10
reflexivity

EOF after accepting the full string and newline is also permitted.

548Example eof_full_returns_zero: eof_main_returns_zerohello_bytes ++ 10
Explore proof 2 tactics

Initial goal

apply eof_run_ [ ]

⊢
hello_bytes ++ 10 = hello_bytes ++ 10 ++ [ ]

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
apply eof_run_ [ ]
reflexivity

The safety premise is inhabited and the resulting theorem covers all finite runs.

552Example interpreter_finite_safety: ∀trace why ms w′, H.M.runH.hi_registryfixture_rep fixture_requests H.hi_genv H.M.Runninghi_entrymemory 10, InterpRuntime.start hello_world trace H.M.Stoppedwhy ms w′ → H.hi_endingwhy
Explore proof 2 tactics

Initial goal

intros trace why ms w′ Hrun

eapply H.hi_finite_safety ; apply interpreter_stdio_stable | exact entry_pre | exact Hrun

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros trace why ms w′ Hrun
eapply H.hi_finite_safety ; apply interpreter_stdio_stable | exact entry_pre | exact Hrun

Without registry coverage the machine rejects even though no invoke exists.

Explore proof 3 tactics

Initial goal

eapply H.M.step_rejected with site := hi_site ; apply H.hi_external_site |

constructor

⊢
None = None

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
eapply H.M.step_rejected with site := hi_site ; apply H.hi_external_site |
constructor
reflexivity

Freeing the protected fixture root destroys its representation. Such a program free is not a collector-safepoint action; the fixture still requires the root to be live at entry and throughout the puts contract.

573Example protected_root_cannot_be_freed: let m′ ≔ mkMemm_bytesmemory mkRegion2048 2048 Heap Freed; mkRegion65552 65560 GlobalData Live m_auxmemory in ¬fixture_repm′ hello_world ∧ ¬stdio_readym′ hello_world
Explore proof 11 tactics

Initial goal

⊢
let m′ ≔ m_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory in

split

2 open

⊢
¬fixture_repm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory hello_world
focused goal
⊢
¬stdio_readym_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory hello_world

–intros _ Hreg

2 open

Hreg :
object_region2048 m_regionsm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory = Somer_base ≔ 2048; r_end ≔ 2064; r_kind ≔ Heap; r_life ≔ Live
⊢
False
deferred goal
⊢
¬stdio_readym_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory hello_world

discriminate

deferred goal
⊢
¬stdio_readym_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory hello_world

–intros _ Hroots

Hroots :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdio_rootshello_world
⊢
False

inversion Hroots as | root rest Hwrite Hrest ; subst

Hroots :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdio_rootshello_world
Hwrite :
writable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdout_span
Hrest :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory [ ]
⊢
False

destruct Hwrite as _ base reg Hcap Hreg Hlive Haccess

Hroots :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdio_rootshello_world
base :
Z
reg :
Hreg :
object_regionbase m_regionsm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory = Somereg
Hlive :
r_lifereg = Live
Haccess :
Hrest :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory [ ]
⊢
False

simpl in Hcap

Hroots :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdio_rootshello_world
base :
Z
reg :
Hcap :
Obj2048 = Objbase
Hreg :
object_regionbase m_regionsm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory = Somereg
Hlive :
r_lifereg = Live
Haccess :
Hrest :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory [ ]
⊢
False

injection Hcap as ←

Hroots :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdio_rootshello_world
reg :
Hreg :
object_region2048 m_regionsm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory = Somereg
Hlive :
r_lifereg = Live
Haccess :
Hrest :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory [ ]
⊢
False

simpl in Hreg

Hroots :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdio_rootshello_world
reg :
Hreg :
Somer_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed = Somereg
Hlive :
r_lifereg = Live
Haccess :
Hrest :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory [ ]
⊢
False

injection Hreg as ←

Hroots :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory stdio_rootshello_world
Hlive :
r_lifer_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed = Live
Haccess :
Hrest :
Forallwritable_spanm_bytes ≔ m_bytesmemory; m_regions ≔ r_base ≔ 2048; r_end ≔ 2048; r_kind ≔ Heap; r_life ≔ Freed; r_base ≔ 65552; r_end ≔ 65560; r_kind ≔ GlobalData; r_life ≔ Live; m_aux ≔ m_auxmemory [ ]
⊢
False

discriminate

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
split
–intros _ Hreg
discriminate
–intros _ Hroots
inversion Hroots as | root rest Hwrite Hrest ; subst
destruct Hwrite as _ base reg Hcap Hreg Hlive Haccess
simpl in Hcap
injection Hcap as ←
simpl in Hreg
injection Hreg as ←
discriminate