Fil-C on Nix

Filnix wiki

the formal campaign

rocq/theories/HelloStdio.v

Admission of Hello's actual version/footer literals. The bytes and object bounds come from the linked fixture, but current memory is read from program-owned pieces, not assumed to equal startup memory.

From iris.proofmode Require Import proofmode
From Stdlib Require Import String ZArith List Lia
From Nanofil Require Import Term Syntax Values Memory Runtime Semantics Run ExternalCalls ExternalMachine Stdio Shutdown Streams Formatting Libc LibcStreams LibcExit Pieces Heap ContractFrame Logic StringLogic LibcStreamLogic HelloModule HelloLeaf HelloVersion HelloClose
Import ListNotations
Open Scope Z_scope
Open Scope list_scope
13Definition hello_literal_memory: mem ≔
Some_, m
⇒
m
None
⇒
mkMemλ_ ⇒ 0 [ ] λ_ ⇒ CNone
18Definition hello_literal_bytess : String.string : listZ ≔
22Definition hello_literal_regions : String.string : region ≔

Includes the author life tokens used by the variadic wrapper.

28Definition hello_output_literals: listString.string ≔
"version-etc#str.41"; "version_etc_copyright"; "version-etc#str.43"; "version-etc#str.44"; "version-etc#str.45"; "version-etc#str.46"; "version-etc#str.47"; "version-etc#str.51"; "version-etc#str.58"; "version-etc#str.59"; "version-etc#str.60"; "version-etc#str.61"; "version-etc#str.62"; "version-etc#str.63"; "version-etc#str.64"; "hello#str.70"; "hello#str.63"; "hello#str.71"; "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

Compute the closed fixture strings once, then rewrite by a checked equality instead of repeatedly reducing the linked initializer.

39Definition hello_literal_cache: listString.string × listZ ≔
Eval vm_compute in mapλs ⇒ s, hello_literal_bytess hello_output_literals
42Lemma hello_literal_cache_valid
List.Forallλsb ⇒ hello_literal_bytesfstsb = sndsb hello_literal_cache
Explore proof 2 tactics

Initial goal

⊢
Forallλsb : string × listZ ⇒ hello_literal_bytessb.1 = sb.2 hello_literal_cache

repeat apply List.Forall_cons ; vm_compute ; reflexivity |

⊢
Forallλsb : string × listZ ⇒ hello_literal_bytessb.1 = sb.2 [ ]

constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
repeat apply List.Forall_cons ; vm_compute ; reflexivity |
constructor
48Lemma hello_literal_cached
∀ s bytes
Explore proof 4 tactics

Initial goal

⊢
∀s : string bytes : listZ, Ins, bytes hello_literal_cache → hello_literal_bytess = bytes

intros s bytes Hin

bytes :
listZ
Hin :
⊢

pose proof hello_literal_cache_valid as Hcache

bytes :
listZ
Hin :
Hcache :
Forallλsb : string × listZ ⇒ hello_literal_bytessb.1 = sb.2 hello_literal_cache
⊢

rewrite List.Forall_forall in Hcache

bytes :
listZ
Hin :
Hcache :
∀x : string × listZ, Inx hello_literal_cache → hello_literal_bytesx.1 = x.2
⊢

exact Hcaches, bytes Hin

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s bytes Hin
pose proof hello_literal_cache_valid as Hcache
rewrite List.Forall_forall in Hcache
exact Hcaches, bytes Hin
55Ltac hello_cached_format  ≔
erewrite hello_literal_cached ; | vm_compute ; eauto 30
62Definition hello_output_pieces: listpiece × pval ≔
Explore proof 2 tactics

Initial goal

intros s Hin

repeat destruct Hin as [ <-| Hin ] ; try contradiction ; vm_compute ; repeat split ; try right ; reflexivity ; repeat constructor ; congruence

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s Hin
repeat destruct Hin as [ <-| Hin ] ; try contradiction ; vm_compute ; repeat split ; try right ; reflexivity ; repeat constructor ; congruence

This is the exact lookup/agreement interface used by HelloVersion; no condition on the current world or output result supplies bytes.

75Lemma hello_owned_literal
∀ s m h
∀l v, l, v ∈ hello_output_pieces → h !! l = Somev
Explore proof 14 tactics

Initial goal

⊢
∀s : string m : mem h : gmappiece pval, Ins hello_output_literals → ∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev → agreesm h → c_stringm version_literals hello_literal_bytess

intros s m h Hin Howned Ha

m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :

apply string_c_string with b := ptr_addrversion_literals reg := hello_literal_regions

2 open

focused goal

–apply hello_literal_shape

2 open

m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
deferred goal

exact Hin

deferred goal

–apply all_agree_intro

m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :

intros l v Hlv

m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
v :
⊢

apply Ha , Howned

m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
v :
⊢

apply list_elem_of_In

unfold hello_output_pieces

apply in_flat_map

m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
v :

exists s

split ; exact Hin |

apply list_elem_of_In

m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
v :
⊢

exact Hlv

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s m h Hin Howned Ha
exact Hin
intros l v Hlv
apply Ha , Howned
apply list_elem_of_In
apply in_flat_map
exists s
split ; exact Hin |
apply list_elem_of_In
exact Hlv

The default branch is used only for printf sites; registry facts below are restricted to actual footer/version call lists.

90Definition hello_output_apig : name : narrow_api ≔
94Definition hello_output_specrep requests wide g : contractlibc_world ≔

Hard aliases and the six stream entries compose without replacing the remaining libc contracts supplied by the caller.

99Definition hello_stdio_registryrep requests wide host fallback ≔
libc_hard_exit_registryrep host libc_stream_registryrep requests wide fallback

Tactics mirror the selected format constructors, not a second executable parser. Every %s must prove its owned C string.

104Ltac hello_format Hstring ≔
first apply format_end | eapply format_string ; apply Hstring ; simpl ; tauto | hello_format Hstring | eapply format_signed with text := 50; 48; 50; 54 ; vm_compute ; repeat split ; repeat constructor ; congruence | hello_format Hstring | apply format_percent ; hello_format Hstring | apply format_literal ; lia | discriminate | hello_format Hstring
112Lemma hello_version_text
∀ stream g xs m h
Ing, xs version_output_argsstream
∀l v, l, v ∈ hello_output_pieces → h !! l = Somev
∃bytes, output_texthello_output_apig m xs bytes
Explore proof 4 tactics

Initial goal

⊢
∀stream : ptr g : name xs : listword m : mem h : gmappiece pval, Ing, xs version_output_argsstream → ∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev → agreesm h → ∃bytes : listZ, output_texthello_output_apig m xs bytes

intros stream g xs m h Hin Howned Ha

stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs version_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apig m xs bytes

assert Hstring := λs Hin ⇒ hello_owned_literals m h Hin Howned Ha

stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs version_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apig m xs bytes

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ←

6 open

stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"fprintf" m WPtrstream; WPtrversion_literal"version-etc#str.41"; WPtrversion_literal"hello#str.70"; WPtrversion_literal"hello#str.63"; WPtrversion_literal"hello#str.71" bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"fprintf" m WPtrstream; WPtrversion_literal"version_etc_copyright"; WPtrversion_literal"version-etc#str.44"; WInt2026 bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"fputs" m WPtrversion_literal"version-etc#str.45"; WPtrstream bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"fprintf" m WPtrstream; WPtrversion_literal"version-etc#str.46"; WPtrversion_literal"version-etc#str.47" bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"fputs" m WPtrversion_literal"version-etc#str.45"; WPtrstream bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"fprintf" m WPtrstream; WPtrversion_literal"version-etc#str.51"; WPtrversion_literal"hello#str.72"; WPtrversion_literal"hello#str.73"; WPtrversion_literal"hello#str.74"; WPtrversion_literal"hello#str.75" bytes

all: (match goal with|- ∃bytes, output_text?api ?m ?xs bytes⇒let actual ≔ eval vm_compute in api in change ∃bytes, output_textactual m xs bytesend;eexists;unfold output_text;eexists;eexists;eexists;split;|reflexivity|;split;|apply Hstring ; simpl ; tauto|;cbv beta iota zeta;try reflexivity;hello_cached_format;hello_format Hstring)

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros stream g xs m h Hin Howned Ha
assert Hstring := λs Hin ⇒ hello_owned_literals m h Hin Howned Ha
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ←
all: (match goal with|- ∃bytes, output_text?api ?m ?xs bytes⇒let actual ≔ eval vm_compute in api in change ∃bytes, output_textactual m xs bytesend;eexists;unfold output_text;eexists;eexists;eexists;split;|reflexivity|;split;|apply Hstring ; simpl ; tauto|;cbv beta iota zeta;try reflexivity;hello_cached_format;hello_format Hstring)
Explore proof 4 tactics

Initial goal

⊢
∀stream : ptr g : name xs : listword m : mem h : gmappiece pval, Ing, xs emit_output_argsstream → ∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev → agreesm h → ∃bytes : listZ, output_texthello_output_apig m xs bytes

intros stream g xs m h Hin Howned Ha

stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs emit_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apig m xs bytes

assert Hstring := λs Hin ⇒ hello_owned_literals m h Hin Howned Ha

stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs emit_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apig m xs bytes

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ←

4 open

stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"fputs" m WPtrversion_literal"version-etc#str.45"; WPtrstream bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"printf" m WPtrversion_literal"version-etc#str.58"; WPtrversion_literal"version-etc#str.59" bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"printf" m WPtrversion_literal"version-etc#str.60"; WPtrversion_literal"version-etc#str.61"; WPtrversion_literal"version-etc#str.62" bytes
focused goal
stream :
m :
h :
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
⊢
∃bytes : listZ, output_texthello_output_apiTAtom"printf" m WPtrversion_literal"version-etc#str.63"; WPtrversion_literal"version-etc#str.64" bytes

all: (match goal with|- ∃bytes, output_text?api ?m ?xs bytes⇒let actual ≔ eval vm_compute in api in change ∃bytes, output_textactual m xs bytesend;eexists;unfold output_text;eexists;eexists;eexists;split;|reflexivity|;split;|apply Hstring ; simpl ; tauto|;cbv beta iota zeta;try reflexivity;hello_cached_format;hello_format Hstring)

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros stream g xs m h Hin Howned Ha
assert Hstring := λs Hin ⇒ hello_owned_literals m h Hin Howned Ha
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ←
all: (match goal with|- ∃bytes, output_text?api ?m ?xs bytes⇒let actual ≔ eval vm_compute in api in change ∃bytes, output_textactual m xs bytesend;eexists;unfold output_text;eexists;eexists;eexists;split;|reflexivity|;split;|apply Hstring ; simpl ; tauto|;cbv beta iota zeta;try reflexivity;hello_cached_format;hello_format Hstring)

Class-only admission of the selected promoted ABI, independent of argument expressions and their evaluated values.

Explore proof 4 tactics

Initial goal

⊢
∀ args : listarg  ,
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
→

intros args H

args :
listarg
H :
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
⊢

induction args as | k v args IH ; constructor |

args :
listarg
H :
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
Argk v :: args
IH :
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
→
⊢
Forallpromoted_argument Argk v :: args

inversion H as [ |? ? Hk Hrest ] ; subst

args :
listarg
H :
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
Argk v :: args
IH :
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
→
Hk :
k = P ∨ k = W
Hrest :
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
⊢
Forallpromoted_argument Argk v :: args

constructor ; exists v ; destruct Hk ; subst ; auto | auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros args H
induction args as | k v args IH ; constructor |
inversion H as [ |? ? Hk Hrest ] ; subst
constructor ; exists v ; destruct Hk ; subst ; auto | auto
160Lemma output_abi_classes
∀ api d args
match api with
⇒
∃ rest  ,
map
λ a  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk ⇒ k = P ∨ k = W rest
⇒
∃ rest  ,
map
λ a  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk ⇒ k = P ∨ k = W rest
⇒
map
λ a  ⇒
match a with
Argk _
⇒
k
args
=
P; P
Explore proof 23 tactics

Initial goal

⊢
∀ api : narrow_api d : name args : listarg  ,
match api with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
→

intros api d args H

d :
args :
listarg
H :
match api with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢

split ; right ; exists d ; reflexivity |

d :
args :
listarg
H :
match api with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
match api with
⇒
∃fmt : value rest : listarg, args = ArgP fmt :: rest ∧ Forallpromoted_argument rest
⇒
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
⇒
∃text file : value, args = ArgP text; ArgP file

destruct api

3 open

d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃fmt : value rest : listarg, args = ArgP fmt :: rest ∧ Forallpromoted_argument rest
focused goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
focused goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

–destruct H as rest & Hargs & Hrest

3 open

d :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃fmt : value rest0 : listarg, args = ArgP fmt :: rest0 ∧ Forallpromoted_argument rest0
deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

destruct args as | k fmt args ; discriminate |

3 open

d :
fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
Argk fmt :: args
=
P :: rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃fmt0 : value rest0 : listarg, Argk fmt :: args = ArgP fmt0 :: rest0 ∧ Forallpromoted_argument rest0
deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

injection Hargs as → Hargs

3 open

d :
fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃fmt0 : value rest0 : listarg, ArgP fmt :: args = ArgP fmt0 :: rest0 ∧ Forallpromoted_argument rest0
deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

exists fmt, args

3 open

d :
fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
ArgP fmt :: args = ArgP fmt :: args ∧ Forallpromoted_argument args
deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

split ; reflexivity |

3 open

d :
fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

apply promoted_classes

3 open

d :
fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

rewrite Hargs

3 open

d :
fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
Forallλk : class ⇒ k = P ∨ k = W rest
deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

exact Hrest

2 open

deferred goal
d :
args :
listarg
H :
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest : listarg, args = ArgP file :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

–destruct H as rest & Hargs & Hrest

2 open

d :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file fmt : value rest0 : listarg, args = ArgP file :: ArgP fmt :: rest0 ∧ Forallpromoted_argument rest0
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

destruct args as | k file | k′ fmt args ; try discriminate

2 open

d :
file :
k′ :
fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
Argk file :: Argk′ fmt :: args
=
P :: P :: rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file0 fmt0 : value rest0 : listarg, Argk file :: Argk′ fmt :: args = ArgP file0 :: ArgP fmt0 :: rest0 ∧ Forallpromoted_argument rest0
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

injection Hargs as → → Hargs

2 open

d :
file, fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
∃file0 fmt0 : value rest0 : listarg, ArgP file :: ArgP fmt :: args = ArgP file0 :: ArgP fmt0 :: rest0 ∧ Forallpromoted_argument rest0
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

exists file, fmt, args

2 open

d :
file, fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
ArgP file :: ArgP fmt :: args = ArgP file :: ArgP fmt :: args ∧ Forallpromoted_argument args
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

split ; reflexivity |

2 open

d :
file, fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

apply promoted_classes

2 open

d :
file, fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
Forallλk : class ⇒ k = P ∨ k = W
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

rewrite Hargs

2 open

d :
file, fmt :
args :
listarg
rest :
listclass
Hargs :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
rest
Hrest :
Forallλk : class ⇒ k = P ∨ k = W rest
⊢
Forallλk : class ⇒ k = P ∨ k = W rest
deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

exact Hrest

deferred goal
d :
args :
listarg
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
⊢
∃text file : value, args = ArgP text; ArgP file

–destruct args as | k text | k′ file | extra args ; try discriminate

d :
text :
k′ :
file :
H :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
Argk text; Argk′ file
=
P; P
⊢
∃text0 file0 : value, Argk text; Argk′ file = ArgP text0; ArgP file0

injection H as → →

d :
text, file :
⊢
∃text0 file0 : value, ArgP text; ArgP file = ArgP text0; ArgP file0

exists text, file

d :
text, file :
⊢
ArgP text; ArgP file = ArgP text; ArgP file

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros api d args H
split ; right ; exists d ; reflexivity |
destruct api
–destruct H as rest & Hargs & Hrest
destruct args as | k fmt args ; discriminate |
injection Hargs as → Hargs
exists fmt, args
split ; reflexivity |
rewrite Hargs
exact Hrest
–destruct H as rest & Hargs & Hrest
destruct args as | k file | k′ fmt args ; try discriminate
injection Hargs as → → Hargs
exists file, fmt, args
split ; reflexivity |
rewrite Hargs
exact Hrest
–destruct args as | k text | k′ file | extra args ; try discriminate
injection H as → →
exists text, file
reflexivity
183Lemma hello_version_registry
∀ rep requests wide fallback stream g xs
Ing, xs version_output_argsstream
libc_stream_registryrep requests wide fallback g = Somehello_output_specrep requests wide g
Explore proof 2 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop fallback : name → optioncontractlibc_world stream : ptr g : name xs : listword, Ing, xs version_output_argsstream → libc_stream_registryrep requests wide fallback g = Somehello_output_specrep requests wide g

intros rep requests wide fallback stream g xs Hin

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
fallback :
stream :
g :
xs :
listword
Hin :
Ing, xs version_output_argsstream
⊢
libc_stream_registryrep requests wide fallback g = Somehello_output_specrep requests wide g

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests wide fallback stream g xs Hin
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; reflexivity
Explore proof 2 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop fallback : name → optioncontractlibc_world stream : ptr g : name xs : listword, Ing, xs emit_output_argsstream → libc_stream_registryrep requests wide fallback g = Somehello_output_specrep requests wide g

intros rep requests wide fallback stream g xs Hin

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
fallback :
stream :
g :
xs :
listword
Hin :
Ing, xs emit_output_argsstream
⊢
libc_stream_registryrep requests wide fallback g = Somehello_output_specrep requests wide g

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests wide fallback stream g xs Hin
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; reflexivity
199Lemma hello_output_return_class
∀ rep requests wide g
Explore proof 1 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop g : name, contract_returnshello_output_specrep requests wide g = RClassW

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity
203Lemma hello_version_abi
∀ stream g xs d args
Ing, xs version_output_argsstream
map
λ a  ⇒
match a with
Argk _
⇒
k
args
=
Explore proof 4 tactics

Initial goal

⊢
∀ stream : ptr g : name xs : listword d : name args : listarg  ,
Ing, xs version_output_argsstream
→
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
→

intros stream g xs d args Hin Hclasses

stream :
g :
xs :
listword
d :
args :
listarg
Hin :
Ing, xs version_output_argsstream
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=

apply output_abi_classes

stream :
g :
xs :
listword
d :
args :
listarg
Hin :
Ing, xs version_output_argsstream
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
⊢
match hello_output_apig with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; cbn [ hello_output_api name_eqb ] ; try exact Hclasses

4 open

stream :
d :
args :
listarg
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
version_output_classesWPtrstream; WPtrversion_literal"version-etc#str.41"; WPtrversion_literal"hello#str.70"; WPtrversion_literal"hello#str.63"; WPtrversion_literal"hello#str.71"
⊢
match hello_output_apiTAtom"fprintf" with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
focused goal
stream :
d :
args :
listarg
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
version_output_classesWPtrstream; WPtrversion_literal"version_etc_copyright"; WPtrversion_literal"version-etc#str.44"; WInt2026
⊢
match hello_output_apiTAtom"fprintf" with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
focused goal
stream :
d :
args :
listarg
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
version_output_classesWPtrstream; WPtrversion_literal"version-etc#str.46"; WPtrversion_literal"version-etc#str.47"
⊢
match hello_output_apiTAtom"fprintf" with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
focused goal
stream :
d :
args :
listarg
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
version_output_classesWPtrstream; WPtrversion_literal"version-etc#str.51"; WPtrversion_literal"hello#str.72"; WPtrversion_literal"hello#str.73"; WPtrversion_literal"hello#str.74"; WPtrversion_literal"hello#str.75"
⊢
match hello_output_apiTAtom"fprintf" with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P

all: eexists ; split ; exact Hclasses | repeat apply Forall_cons ; auto | ; constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros stream g xs d args Hin Hclasses
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; cbn [ hello_output_api name_eqb ] ; try exact Hclasses
all: eexists ; split ; exact Hclasses | repeat apply Forall_cons ; auto | ; constructor
Explore proof 4 tactics

Initial goal

⊢
∀ stream : ptr g : name xs : listword d : name args : listarg  ,
Ing, xs emit_output_argsstream
→
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
replicateDatatypes.lengthxs P
→

intros stream g xs d args Hin Hclasses

stream :
g :
xs :
listword
d :
args :
listarg
Hin :
Ing, xs emit_output_argsstream
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
replicateDatatypes.lengthxs P

apply output_abi_classes

stream :
g :
xs :
listword
d :
args :
listarg
Hin :
Ing, xs emit_output_argsstream
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
replicateDatatypes.lengthxs P
⊢
match hello_output_apig with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; cbn [ hello_output_api name_eqb ] ; try exact Hclasses

3 open

stream :
d :
args :
listarg
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
replicateDatatypes.lengthWPtrversion_literal"version-etc#str.58"; WPtrversion_literal"version-etc#str.59" P
⊢
match hello_output_apiTAtom"printf" with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
focused goal
stream :
d :
args :
listarg
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
replicateDatatypes.lengthWPtrversion_literal"version-etc#str.60"; WPtrversion_literal"version-etc#str.61"; WPtrversion_literal"version-etc#str.62" P
⊢
match hello_output_apiTAtom"printf" with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P
focused goal
stream :
d :
args :
listarg
Hclasses :
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
replicateDatatypes.lengthWPtrversion_literal"version-etc#str.63"; WPtrversion_literal"version-etc#str.64" P
⊢
match hello_output_apiTAtom"printf" with
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
∃ rest : listclass  ,
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P :: P :: rest
∧
Forallλk : class ⇒ k = P ∨ k = W rest
⇒
map
λ a : arg  ⇒
match a with
Argk _
⇒
k
args
=
P; P

all: eexists ; split ; exact Hclasses | repeat apply Forall_cons ; auto | ; constructor

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros stream g xs d args Hin Hclasses
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; cbn [ hello_output_api name_eqb ] ; try exact Hclasses
all: eexists ; split ; exact Hclasses | repeat apply Forall_cons ; auto | ; constructor

Actual stdout-facing version/footer calls keep their stream open and non-wide. The fixed handle is a world fact, not a second token.

227Definition hello_stdio_wirep stream m w h : Prop ≔
libc_stream_wirep stream m w h ∧ libc_stdoutw = stream ∧ ∃file, libc_file_atw stream = Somefile ∧ orientationlibc_stream_statew stream ≠ WideOriented
232Lemma hello_version_target
∀ stream g xs w
Ing, xs version_output_argsstream
Explore proof 2 tactics

Initial goal

⊢
∀stream : ptr g : name xs : listword w : libc_world, Ing, xs version_output_argsstream → output_targethello_output_apig libc_stdout w xs = stream

intros stream g xs w Hin

stream :
g :
xs :
listword
Hin :
Ing, xs version_output_argsstream

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros stream g xs w Hin
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; reflexivity
Explore proof 2 tactics

Initial goal

⊢
∀stream : ptr g : name xs : listword w : libc_world, Ing, xs emit_output_argsstream → libc_stdoutw = stream → output_targethello_output_apig libc_stdout w xs = stream

intros stream g xs w Hin Hstdout

stream :
g :
xs :
listword
Hin :
Ing, xs emit_output_argsstream
Hstdout :
libc_stdoutw = stream

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros stream g xs w Hin Hstdout
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; auto
248Lemma hello_version_admitted
∀ rep requests wide stream g xs m w h
Ing, xs version_output_argsstream
∀l v, l, v ∈ hello_output_pieces → h !! l = Somev
hello_stdio_wirep stream m w h
contract_prehello_output_specrep requests wide g xs m w
Explore proof 5 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop stream : ptr g : name xs : listword m : mem w : libc_world h : gmappiece pval, Ing, xs version_output_argsstream → ∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev → agreesm h → hello_stdio_wirep stream m w h → contract_prehello_output_specrep requests wide g xs m w

intros rep requests wide stream g xs m w h Hin Howned Ha Hr & _ & Hstdout & Hfile & Hn

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs version_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
⊢
contract_prehello_output_specrep requests wide g xs m w

destruct hello_version_textstream g xs m h Hin Howned Ha as bytes Htext

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs version_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
bytes :
listZ
Htext :
⊢
contract_prehello_output_specrep requests wide g xs m w

unfold hello_output_spec

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs version_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
bytes :
listZ
Htext :

destruct Hfile as file Hfile

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs version_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
file :
Hfile :
libc_file_atw stream = Somefile
bytes :
listZ
Htext :

apply libc_output_admitted with file := file bytes := bytes ; exact Hr | | | exact Htext ; rewrite hello_version_target_ _ _ _ Hin ; assumption

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests wide stream g xs m w h Hin Howned Ha Hr & _ & Hstdout & Hfile & Hn
destruct hello_version_textstream g xs m h Hin Howned Ha as bytes Htext
destruct Hfile as file Hfile
apply libc_output_admitted with file := file bytes := bytes ; exact Hr | | | exact Htext ; rewrite hello_version_target_ _ _ _ Hin ; assumption
Explore proof 5 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop stream : ptr g : name xs : listword m : mem w : libc_world h : gmappiece pval, Ing, xs emit_output_argsstream → ∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev → agreesm h → hello_stdio_wirep stream m w h → contract_prehello_output_specrep requests wide g xs m w

intros rep requests wide stream g xs m w h Hin Howned Ha Hr & _ & Hstdout & Hfile & Hn

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs emit_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
⊢
contract_prehello_output_specrep requests wide g xs m w

destruct hello_footer_textstream g xs m h Hin Howned Ha as bytes Htext

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs emit_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
bytes :
listZ
Htext :
⊢
contract_prehello_output_specrep requests wide g xs m w

unfold hello_output_spec

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs emit_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
bytes :
listZ
Htext :

destruct Hfile as file Hfile

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
m :
h :
Hin :
Ing, xs emit_output_argsstream
Howned :
∀l : piece v : pval, l, v ∈ hello_output_pieces → h !! l = Somev
Ha :
Hstdout :
libc_stdoutw = stream
file :
Hfile :
libc_file_atw stream = Somefile
bytes :
listZ
Htext :

apply libc_output_admitted with file := file bytes := bytes ; exact Hr | | | exact Htext ; rewrite hello_footer_target_ _ _ _ Hin Hstdout ; assumption

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests wide stream g xs m w h Hin Howned Ha Hr & _ & Hstdout & Hfile & Hn
destruct hello_footer_textstream g xs m h Hin Howned Ha as bytes Htext
destruct Hfile as file Hfile
apply libc_output_admitted with file := file bytes := bytes ; exact Hr | | | exact Htext ; rewrite hello_footer_target_ _ _ _ Hin Hstdout ; assumption

The actual author life-token premise, with fixture-derived regions.

275Lemma hello_author_live
∀ s
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"
Explore proof 8 tactics

Initial goal

⊢
∀s : string, Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75" → PLiveptr_addrversion_literals, VLivehello_literal_regions ∈ hello_output_pieces

intros s Hin

Hin :
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

apply list_elem_of_In

Hin :
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

unfold hello_output_pieces

Hin :
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

apply in_flat_map

Hin :
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

exists s

Hin :
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

split ; simpl in * ; tauto |

Hin :
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

left

Hin :
Ins "hello#str.72"; "hello#str.73"; "hello#str.74"; "hello#str.75"

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros s Hin
apply list_elem_of_In
apply in_flat_map
exists s
split ; simpl in * ; tauto |
left
reflexivity

Bind the very machine used by HelloVersion's triples. The proofs below type-check invocation transport across the helper aliases.

285Module HelloStdioOn R : Runtime LG0 : LogicSigR
286Module LG ≔ LG0
287Module V ≔ HelloVersionOn R LG0
288Module M ≔ V.L.M
289Module SL ≔ LibcStreamLogicOn R LG0
290Module C ≔ HelloCloseOn R LG0
291Module X ≔ LibcExitOn R C.L.M
293Theorem hello_output_frame
∀ rep requests wide stream g r args xs s m w trace values s′ m′ w′ h
R.readys m
hello_stdio_wirep stream m w h
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Explore proof 10 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop stream : ptr g : name r : call_result args : listarg xs : listword s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world h : gmappiece pval, output_targethello_output_apig libc_stdout w xs = stream → agreesm h → live_disjointm → R.readys m → hello_stdio_wirep stream m w h → M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′ → agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

intros rep requests wide stream g r args xs s m w trace values s′ m′ w′ h Htarget Ha Hd Hr Hw & Hstdout & Hfile & Hn Hcall

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
⊢
agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

destruct SL.output_return_framerep requests wide hello_output_apig r args xs stream s m w trace values s′ m′ w′ h eq_symHtarget Hcall Ha Hd Hr Hw as Ha′ & Hd′ & Hr′ & Hw′ & Hresult

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
⊢
agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

destruct SL.output_open_narrowrep requests wide hello_output_apig r args xs stream s m w trace CallReturnvalues s′ m′ w′ eq_symHtarget Hn Hcall as Hfile′ & Hn′ & Hstdout′

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Hfile′ :
∃file : libc_file, libc_file_atw′ stream = Somefile
Hstdout′ :
⊢
agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

split ; exact Ha′ |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Hfile′ :
∃file : libc_file, libc_file_atw′ stream = Somefile
Hstdout′ :
⊢
live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

split ; exact Hd′ |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Hfile′ :
∃file : libc_file, libc_file_atw′ stream = Somefile
Hstdout′ :
⊢
R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

split ; exact Hr′ |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Hfile′ :
∃file : libc_file, libc_file_atw′ stream = Somefile
Hstdout′ :
⊢
hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

split ; | exact Hresult

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Hfile′ :
∃file : libc_file, libc_file_atw′ stream = Somefile
Hstdout′ :
⊢
hello_stdio_wirep stream m′ w′ h

split ; exact Hw′ |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Hfile′ :
∃file : libc_file, libc_file_atw′ stream = Somefile
Hstdout′ :
⊢
libc_stdoutw′ = stream ∧ ∃file : libc_file, libc_file_atw′ stream = Somefile ∧ orientationlibc_stream_statew′ stream ≠ WideOriented

split ; congruence |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
args :
listarg
xs :
listword
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
h :
Ha :
Hr :
R.readys m
Hw :
libc_stream_wirep stream m w h
Hstdout :
libc_stdoutw = stream
Hfile :
∃file : libc_file, libc_file_atw stream = Somefile
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
Ha′ :
agreesm′ h
Hd′ :
Hr′ :
R.readys′ m′
Hw′ :
libc_stream_wirep stream m′ w′ h
Hresult :
∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Hfile′ :
∃file : libc_file, libc_file_atw′ stream = Somefile
Hstdout′ :
⊢
∃file : libc_file, libc_file_atw′ stream = Somefile ∧ orientationlibc_stream_statew′ stream ≠ WideOriented

auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests wide stream g r args xs s m w trace values s′ m′ w′ h Htarget Ha Hd Hr Hw & Hstdout & Hfile & Hn Hcall
destruct SL.output_return_framerep requests wide hello_output_apig r args xs stream s m w trace values s′ m′ w′ h eq_symHtarget Hcall Ha Hd Hr Hw as Ha′ & Hd′ & Hr′ & Hw′ & Hresult
destruct SL.output_open_narrowrep requests wide hello_output_apig r args xs stream s m w trace CallReturnvalues s′ m′ w′ eq_symHtarget Hn Hcall as Hfile′ & Hn′ & Hstdout′
split ; exact Ha′ |
split ; exact Hd′ |
split ; exact Hr′ |
split ; | exact Hresult
split ; exact Hw′ |
split ; congruence |
auto

These statements are HelloVersion's two output-frame premises, specialized to the concrete registry/spec and represented world.

315Theorem hello_version_frame
∀ rep requests wide stream g xs r args s m w h trace values s′ m′ w′
Ing, xs version_output_argsstream
R.readys m
hello_stdio_wirep stream m w h
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n, values = WIntn ∧ 0 ≤ n < 2 ^ 32
Explore proof 3 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop stream : ptr g : name xs : listword r : call_result args : listarg s : R.state m : mem w : libc_world h : gmappiece pval trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, Ing, xs version_output_argsstream → agreesm h → live_disjointm → R.readys m → hello_stdio_wirep stream m w h → M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′ → agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

intros

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
args :
listarg
s :
R.state
m :
h :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
H :
Ing, xs version_output_argsstream
H0 :
H2 :
R.readys m
H3 :
hello_stdio_wirep stream m w h
H4 :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
⊢
agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

eapply hello_output_frame ; eauto

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
args :
listarg
s :
R.state
m :
h :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
H :
Ing, xs version_output_argsstream
H0 :
H2 :
R.readys m
H3 :
hello_stdio_wirep stream m w h
H4 :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′

eapply hello_version_target ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros
eapply hello_output_frame ; eauto
eapply hello_version_target ; eauto
Explore proof 3 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop stream : ptr g : name xs : listword r : call_result args : listarg s : R.state m : mem w : libc_world h : gmappiece pval trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, Ing, xs emit_output_argsstream → agreesm h → live_disjointm → R.readys m → hello_stdio_wirep stream m w h → M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′ → agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

intros rep requests wide stream g xs r args s m w h trace values s′ m′ w′ Hin Ha Hd Hr Hw Hcall

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
args :
listarg
s :
R.state
m :
h :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
Hin :
Ing, xs emit_output_argsstream
Ha :
Hr :
R.readys m
Hw :
hello_stdio_wirep stream m w h
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′
⊢
agreesm′ h ∧ live_disjointm′ ∧ R.readys′ m′ ∧ hello_stdio_wirep stream m′ w′ h ∧ ∃n : Z, values = WIntn ∧ 0 ≤ n < 2 ^ 32

eapply hello_output_frame ; eauto

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
stream :
g :
xs :
listword
args :
listarg
s :
R.state
m :
h :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
Hin :
Ing, xs emit_output_argsstream
Ha :
Hr :
R.readys m
Hw :
hello_stdio_wirep stream m w h
Hcall :
M.E.invokehello_output_specrep requests wide g r args xs s m w trace CallReturnvalues s′ m′ w′

eapply hello_footer_target ; exact Hin | exact proj1proj2Hw

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests wide stream g xs r args s m w h trace values s′ m′ w′ Hin Ha Hd Hr Hw Hcall
eapply hello_output_frame ; eauto
eapply hello_footer_target ; exact Hin | exact proj1proj2Hw

HelloClose's complete ordinary _exit interface over its actual invocation relation. It requires no successful host completion to establish admission or absence of ordinary returns.

342Theorem hello_close_exit_contract
∀ rep requests wide host fallback p
hello_stdio_registryrep requests wide host fallback TAtom"_exit" = Somelibc_hard_exit_contractrep host ∧ contract_returnslibc_hard_exit_contractrep host = RVoid ∧ ∀v, contract_abilibc_hard_exit_contractrep host CVoid ArgW v ∧ ∀n m w h, 0 ≤ n < 2 ^ 32 → libc_closing_wirep p m w h → contract_prelibc_hard_exit_contractrep host WIntn m w ∧ ∀args n s m w trace values s′ m′ w′, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False
Explore proof 13 tactics

Initial goal

⊢
∀rep : mem → libc_world → Prop requests : libc_world → ptr → Z → Z → Prop wide : libc_world → ptr → stream_state → stream_state → bool → Prop host : mem → libc_world → Prop fallback : name → optioncontractlibc_world p : ptr, hello_stdio_registryrep requests wide host fallback TAtom"_exit" = Somelibc_hard_exit_contractrep host ∧ contract_returnslibc_hard_exit_contractrep host = RVoid ∧ ∀v : value, contract_abilibc_hard_exit_contractrep host CVoid ArgW v ∧ ∀n : Z m : mem w : libc_world h : gmappiece pval, 0 ≤ n < 2 ^ 32 → libc_closing_wirep p m w h → contract_prelibc_hard_exit_contractrep host WIntn m w ∧ ∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

intros rep requests wide host fallback p

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
hello_stdio_registryrep requests wide host fallback TAtom"_exit" = Somelibc_hard_exit_contractrep host ∧ contract_returnslibc_hard_exit_contractrep host = RVoid ∧ ∀v : value, contract_abilibc_hard_exit_contractrep host CVoid ArgW v ∧ ∀n : Z m : mem w : libc_world h : gmappiece pval, 0 ≤ n < 2 ^ 32 → libc_closing_wirep p m w h → contract_prelibc_hard_exit_contractrep host WIntn m w ∧ ∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

split ; reflexivity |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
contract_returnslibc_hard_exit_contractrep host = RVoid ∧ ∀v : value, contract_abilibc_hard_exit_contractrep host CVoid ArgW v ∧ ∀n : Z m : mem w : libc_world h : gmappiece pval, 0 ≤ n < 2 ^ 32 → libc_closing_wirep p m w h → contract_prelibc_hard_exit_contractrep host WIntn m w ∧ ∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

split ; reflexivity |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀v : value, contract_abilibc_hard_exit_contractrep host CVoid ArgW v ∧ ∀n : Z m : mem w : libc_world h : gmappiece pval, 0 ≤ n < 2 ^ 32 → libc_closing_wirep p m w h → contract_prelibc_hard_exit_contractrep host WIntn m w ∧ ∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

split ; intros ; split ; reflexivity | eexists ; reflexivity |

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀n : Z m : mem w : libc_world h : gmappiece pval, 0 ≤ n < 2 ^ 32 → libc_closing_wirep p m w h → contract_prelibc_hard_exit_contractrep host WIntn m w ∧ ∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

split

2 open

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀n : Z m : mem w : libc_world h : gmappiece pval, 0 ≤ n < 2 ^ 32 → libc_closing_wirep p m w h → contract_prelibc_hard_exit_contractrep host WIntn m w
focused goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

–intros n m w h Hn Hready & _ & Hphase

2 open

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

apply hard_exit_admitted with bits := n

4 open

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
⊢
libc_readyrep m w
focused goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
focused goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
⊢
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

+apply libc_stream_ready_libc

4 open

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
⊢
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

exact Hready

3 open

deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
⊢
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

+split ; reflexivity | exact Hn

2 open

deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
n :
Z
m :
h :
Hn :
0 ≤ n < 2 ^ 32
Hready :
Hphase :
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
⊢
∀kind : handoff_kind, shutdown_atw.2 ≠ HandedOffkind
deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

+exact Hphase

deferred goal
rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
⊢
∀args : listarg n : Z s : R.state m : mem w : libc_world trace : listevent values : listword s′ : R.state m′ : mem w′ : libc_world, C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′ → False

–intros

rep :
mem → libc_world → Prop
requests :
libc_world → ptr → Z → Z → Prop
wide :
libc_world → ptr → stream_state → stream_state → bool → Prop
host :
mem → libc_world → Prop
fallback :
p :
args :
listarg
n :
Z
s :
R.state
m :
trace :
listevent
values :
listword
s′ :
R.state
m′ :
H :
C.L.M.E.invokelibc_hard_exit_contractrep host CVoid args WIntn s m w trace CallReturnvalues s′ m′ w′
⊢
False

eapply X.hard_exit_no_return ; eauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros rep requests wide host fallback p
split ; reflexivity |
split ; reflexivity |
split ; intros ; split ; reflexivity | eexists ; reflexivity |
split
–intros n m w h Hn Hready & _ & Hphase
apply hard_exit_admitted with bits := n
exact Hready
+split ; reflexivity | exact Hn
+exact Hphase
–intros
eapply X.hard_exit_no_return ; eauto

Standalone users retain the original functor and theorem paths.

367Module HelloStdio R : Runtime
368Module LG0 ≔ Logic R
Include HelloStdioOn R LG0

Main supplies one instance beneath output and callback triples.

373Module HelloStdioSharedChecks
374Module LG ≔ Logic InterpRuntime
377Example version_expr_identity: H.V.L.expr = LG.L.expr
Explore proof 1 tactics

Initial goal

⊢
H.V.L.expr = LG.L.expr

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity
380Example close_expr_identity: H.C.L.expr = LG.L.expr
Explore proof 1 tactics

Initial goal

⊢
H.C.L.expr = LG.L.expr

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity
383Example shared_invoke_identity: @H.M.E.invoke = @H.C.L.M.E.invoke
Explore proof 1 tactics

Initial goal

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity