Fil-C on Nix

Filnix wiki

the formal campaign

rocq/theories/ScanLogic.v

rocq/programs/scan.c through the program logic of Logic.v, with strlen, strchr and puts called through Campaign 4's contracts.

scan reads memory after a libc call: it takes the length of its string s, finds the first l in it, prints the rest of s from there, and then reads the byte after that l through the pointer strchr returned. Each call is a triple of StringLogic.v, used as a rule: wp_strlen and wp_strchr hand the string back unchanged, wp_puts hands back the suffix it was lent (string_suffix), which the frame for external calls keeps through puts's writes. The read after puts takes the object's life and the one byte from the suffix (string_byte) for a read check through the string's capability, read-write or read-only (wp_check_read), and a byte load (wp_raw_load_byte). That the l is not the NUL is what puts the byte after it inside the string.

scan_logic_safe is the labelled machine's safety from any memory holding the string, with its object apart from the stdio world's roots; interp_scan_logic_safe instantiates it on Hi.v's fixture, whose literal is "hello".

From iris.proofmode Require Import proofmode
From iris.base_logic.lib Require Import gen_heap
From iris.program_logic Require Import language weakestpre
From Stdlib Require Import ZArith Lia
From Stdlib Require String
From Nanofil Require Import Term Syntax Values Memory Runtime Ops Semantics Run Machine Panics StepRules Symbolic ExternalCalls ExternalMachine Transport Pieces Heap ContractFrame Language Logic StringLogic ScanCode Hi HiLogic
Open Scope Z_scope
Open Scope list_scope

The module

The checked module nanofil makes of scan.c (scan_term).

37Definition scan_module: module ≔
Somemd
⇒
md
None
⇒
[ ]

The fixture decodes to scan_module.

41Lemma scan_decodes
Explore proof 2 tactics

Initial goal

vm_compute

⊢
SomeIFuncfn_name ≔ TAtom"scan"; fn_linkage ≔ TAtom"export"; fn_ret ≔ RClassW; fn_params ≔ P, TAtom"v0"; fn_blocks ≔ b_label ≔ TAtom"start"; b_phis ≔ [ ]; b_insts ≔ CallCResultTAtom"v4" L GlobalTAtom"strlen" ArgP TmpTAtom"v0"; CallCResultTAtom"v7" P GlobalTAtom"strchr" ArgP TmpTAtom"v0"; ArgW Const108; LetTAtom"v12" L Ptoi TmpTAtom"v7"; LetTAtom"v14" W CmpEq L TmpTAtom"v12"; Const0; b_jump ≔ JBranchTmpTAtom"v14" ToTAtom"L8" ToTAtom"L10"; b_label ≔ TAtom"L8"; b_phis ≔ [ ]; b_insts ≔ [ ]; b_jump ≔ JRetConst0; b_label ≔ TAtom"L10"; b_phis ≔ [ ]; b_insts ≔ CallCResultTAtom"v17" W GlobalTAtom"puts" ArgP TmpTAtom"v7"; FlightTAtom"v20" Add FAddressTmpTAtom"v7"; FValueConst1 LowerOfTmpTAtom"v7"; LetTAtom"chk0" A Check0 1 Read 1 TmpTAtom"v20"; LetTAtom"v21" W RawLoadLdNarrowSb 0 TmpTAtom"chk0"; LetTAtom"v22" W Add TmpTAtom"v4"; TmpTAtom"v21"; b_jump ≔ JRetTmpTAtom"v22" = SomeIFuncfn_name ≔ TAtom"scan"; fn_linkage ≔ TAtom"export"; fn_ret ≔ RClassW; fn_params ≔ P, TAtom"v0"; fn_blocks ≔ b_label ≔ TAtom"start"; b_phis ≔ [ ]; b_insts ≔ CallCResultTAtom"v4" L GlobalTAtom"strlen" ArgP TmpTAtom"v0"; CallCResultTAtom"v7" P GlobalTAtom"strchr" ArgP TmpTAtom"v0"; ArgW Const108; LetTAtom"v12" L Ptoi TmpTAtom"v7"; LetTAtom"v14" W CmpEq L TmpTAtom"v12"; Const0; b_jump ≔ JBranchTmpTAtom"v14" ToTAtom"L8" ToTAtom"L10"; b_label ≔ TAtom"L8"; b_phis ≔ [ ]; b_insts ≔ [ ]; b_jump ≔ JRetConst0; b_label ≔ TAtom"L10"; b_phis ≔ [ ]; b_insts ≔ CallCResultTAtom"v17" W GlobalTAtom"puts" ArgP TmpTAtom"v7"; FlightTAtom"v20" Add FAddressTmpTAtom"v7"; FValueConst1 LowerOfTmpTAtom"v7"; LetTAtom"chk0" A Check0 1 Read 1 TmpTAtom"v20"; LetTAtom"v21" W RawLoadLdNarrowSb 0 TmpTAtom"chk0"; LetTAtom"v22" W Add TmpTAtom"v4"; TmpTAtom"v21"; b_jump ≔ JRetTmpTAtom"v22"

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
reflexivity

The module's one function, scan.

45Definition scan_fn: func ≔
match scan_module with
IFuncf :: _
⇒
f
_
⇒
mkFuncTAtom"scan" TAtom"export" RClassW [ ] [ ]

The module's symbols: scan alone; strlen, strchr and puts are external.

53Definition scan_globals: listname × ptr ≔
TAtom"scan", mkPtr65536 FnTAtom"scan"

Laying out the module gives scan_globals.

56Lemma scan_layout
Explore proof 2 tactics

Initial goal

⊢

vm_compute

⊢
SomeTAtom"scan", ptr_addr ≔ 65536; ptr_cap ≔ FnTAtom"scan" = SomeTAtom"scan", ptr_addr ≔ 65536; ptr_cap ≔ FnTAtom"scan"

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
reflexivity

Block l of scan, or an empty one.

60Definition sblkl : String.string : block ≔
Someb
⇒
b
None
⇒

The entry block: strlen, strchr, and the test for a miss.

67Definition s_start: block ≔
Eval vm_compute in sblk"start"

The miss: return 0.

69Definition s_L8: block ≔
Eval vm_compute in sblk"L8"

The hit: puts, then the read after it.

71Definition s_L10: block ≔
Eval vm_compute in sblk"L10"

scan has its entry block.

74Lemma find_start
Explore proof 2 tactics

Initial goal

vm_compute

⊢
Someb_label ≔ TAtom"start"; b_phis ≔ [ ]; b_insts ≔ CallCResultTAtom"v4" L GlobalTAtom"strlen" ArgP TmpTAtom"v0"; CallCResultTAtom"v7" P GlobalTAtom"strchr" ArgP TmpTAtom"v0"; ArgW Const108; LetTAtom"v12" L Ptoi TmpTAtom"v7"; LetTAtom"v14" W CmpEq L TmpTAtom"v12"; Const0; b_jump ≔ JBranchTmpTAtom"v14" ToTAtom"L8" ToTAtom"L10" = Someb_label ≔ TAtom"start"; b_phis ≔ [ ]; b_insts ≔ CallCResultTAtom"v4" L GlobalTAtom"strlen" ArgP TmpTAtom"v0"; CallCResultTAtom"v7" P GlobalTAtom"strchr" ArgP TmpTAtom"v0"; ArgW Const108; LetTAtom"v12" L Ptoi TmpTAtom"v7"; LetTAtom"v14" W CmpEq L TmpTAtom"v12"; Const0; b_jump ≔ JBranchTmpTAtom"v14" ToTAtom"L8" ToTAtom"L10"

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
reflexivity

scan has its miss block.

77Lemma find_L8
Explore proof 2 tactics

Initial goal

vm_compute

⊢
Someb_label ≔ TAtom"L8"; b_phis ≔ [ ]; b_insts ≔ [ ]; b_jump ≔ JRetConst0 = Someb_label ≔ TAtom"L8"; b_phis ≔ [ ]; b_insts ≔ [ ]; b_jump ≔ JRetConst0

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
reflexivity

scan has its hit block.

80Lemma find_L10
Explore proof 2 tactics

Initial goal

vm_compute

⊢

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
reflexivity

scan returns an int.

83Lemma scan_ret
Explore proof 1 tactics

Initial goal

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity

scan called with the pointer p.

87Definition scan_entryp : ptr : frame ≔
mkFramescan_fn TAtom"v0", WPtrp [ ] None EnterTAtom"start" None

A call of scan with p starts it at scan_entry.

91Lemma scan_call_frame
Explore proof 1 tactics

Initial goal

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
reflexivity

The contracts scan is linked with: strlen, strchr and puts, the last with the trusted stream representation rep.

96Definition scan_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

The raw address of a at offset 0 is a, inside the address space.

105Lemma raw_address_0
∀ a
0 ≤ a < 2 ^ 64
raw_addressa 0 = a
Explore proof 5 tactics

Initial goal

a :
Z
⊢
0 ≤ a < 2 ^ 64 → raw_addressa 0 = a

intros H

a :
Z
H :
0 ≤ a < 2 ^ 64
⊢
raw_addressa 0 = a

unfold raw_address

a :
Z
H :
0 ≤ a < 2 ^ 64
⊢
a + 0 mod 2 ^ 64 = a

rewrite Z.add_0_r

a :
Z
H :
0 ≤ a < 2 ^ 64
⊢
a mod 2 ^ 64 = a

apply Z.mod_small

a :
Z
H :
0 ≤ a < 2 ^ 64
⊢
0 ≤ a < 2 ^ 64

exact H

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros H
rewrite Z.add_0_r
apply Z.mod_small
exact H

Prove an address premise: drop the wraps of raw_address and of the flight's sum where arithmetic shows them the identity, then arithmetic.

111Ltac addr_premise  ≔

scan over any runtime R.

114Module ScanLogic R : Runtime
115Module SL ≔ StringLogic R
116Module LG ≔ SL.LG
117Module L ≔ LG.L
Import L LG SL

The linked genv: the module, its symbol, R's free.

121Definition scan_ge: genv ≔
123Section proof

puts's trusted stream representation and allocation requests.

125Variable rep : mem → stdio_world → Prop
126Variable requests : listword → mem → stdio_world → Z → Z → Prop

Hi.v's premise: a safepoint keeps rep and readiness.

129Hypothesis stdio_stable
∀ s m s′ m′ w
R.safepoints m s′ m′
repm w
repm′ w ∧ stdio_readym′ w

stdio_wi survives safepoints, by stdio_stable.

135Section wp
136Context `{!invGS_genhlc Σ, !gen_heapGSpiece pval Σ}

The Iris instance of scan: its contracts and stdio_wi.

139Instance scan_irisGS: irisGS_genhlc nanofil_langscan_registryrep requests scan_ge Σ ≔

The expressions of scan's language.

143Notation sexpr ≔ language.exprnanofil_langscan_registryrep requests scan_ge

scan, owning the string at p, is safe and returns an int.

146Lemma scan_spec
∀ p b reg bytes
stringp b reg bytes −∗ WPERunscan_entryp : sexpr {o. ⌜∃n, o = RetWIntn⌝}
Proof 70 steps Qed
iIntros Hs
iDestruct Hs as [%Hok Hps]
iAssert stringp b reg bytes with [$Hps] as Hs ; done |
pose proof Hok as Hc & Hb0 & Hb1 & Hb2 & Hb3 & _
iApply wp_enter ; exact find_start | reflexivity |
iNext
iApply wp_strlen with Hs ; reflexivity | reflexivity | reflexivity | reflexivity |
iNext
iIntros Hs
iApply wp_strchr with Hs ; reflexivity | reflexivity | reflexivity | reflexivity | reflexivity | vm_compute ; intuition congruence | vm_compute ; intuition congruence |
iNext
iIntros q Hq Hs
destruct Hq as i & x & Hx & Hxc & _ & → | _ & →

A hit at i, before the NUL.

–assert Hi : i < lengthbytes%nat by apply lookup_lt_Some in Hx ; exact Hx
assert Hz : ptr_addrp + Z.of_nati =? 0 = false by apply Z.eqb_neq ; lia
iApply wp_let ; reflexivity | reflexivity | reflexivity | intros m ; reflexivity |
iNext
iApply wp_let ; reflexivity | reflexivity | reflexivity | intros m ; reflexivity |
iNext
iApply wp_branch ; reflexivity |
iNext
rewrite Z.mod_smallptr_addrp + Z.of_nati ; | lia
rewrite Hz
iApply wp_enter ; exact find_L10 | reflexivity |
iNext
iDestruct string_suffix_ _ _ _ i with Hs as [Hq _] ; lia |
iApply wp_puts with Hq ; reflexivity | reflexivity | reflexivity | reflexivity |
iNext
iIntros n Hq
iApply wp_flight ; reflexivity | reflexivity | reflexivity |
iNext
destruct dropi bytes as | x0 rest eqn: Ed
{exfalso
apply f_equallength in Ed
rewrite length_drop in Ed
cbn in Ed
lia
iDestruct string_byte_ _ _ _ 1 nth0 rest ++ 0 0 with Hq as (%Hok′ & Hl & Hb & _)
{destruct rest ; reflexivity
iApply wp_check_read with Hl ; reflexivity | reflexivity | exact Hc | addr_premise | addr_premise | apply Z.mod_1_r |
iNext
iIntros Hl
iApply wp_raw_load_byte with Hl Hb ; reflexivity | reflexivity | reflexivity | reflexivity | exact Hc | addr_premise |
iNext
iIntros _ _
iApply wp_let ; reflexivity | reflexivity | reflexivity | intros m ; reflexivity |
iNext
iApply wp_ret ; exact scan_ret | reflexivity |
iNext
iPureIntro
eexists
reflexivity

A miss: return 0.

–iApply wp_let ; reflexivity | reflexivity | reflexivity | intros m ; reflexivity |
iNext
iApply wp_let ; reflexivity | reflexivity | reflexivity | intros m ; reflexivity |
iNext
iApply wp_branch ; reflexivity |
iNext
iApply wp_enter ; exact find_L8 | reflexivity |
iNext
iApply wp_ret ; exact scan_ret | reflexivity |
iNext
iPureIntro
eexists
reflexivity

scan is safe: from a ready runtime, live objects apart, puts's rep and readiness of the world, and a string at p, in an object no root of the world reaches into, with any fuel, no labelled run stops with a failure_ending, and a run that returns returns an int. By heap_labelled_safe from scan_spec, the ghost heap starting with the string's pieces.

198Theorem scan_logic_safe
∀ Σ HinvP : invGpreSΣ HheapP : gen_heapGpreSpiece pval Σ m s w fuel p b reg bytes
R.readys m
repm w
string_okp b reg bytes
all_agreem string_psp b reg bytes
∀sp a, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
Explore proof 21 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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
⊢
R.readys m → live_disjointm → repm w → stdio_readym w → string_okp b reg bytes → all_agreem string_psp b reg bytes → ∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg → labelled_safescan_registryrep requests scan_ge scan_entryp m s w fuel λo : outcome ⇒ ∃n : Z, o = RetWIntn

intros Hr Hd Hrep Hw Hok Ha Hapart

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
labelled_safescan_registryrep requests scan_ge scan_entryp m s w fuel λo : outcome ⇒ ∃n : Z, o = RetWIntn

apply heap_labelled_safeΣ scan_registryrep requests stdio_wirep scan_ge scan_entryp m s w list_to_mapstring_psp b reg bytes

5 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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
R.readys m
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
agreesm list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
stdio_wirep m w list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

–exact Hr

4 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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
agreesm list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
stdio_wirep m w list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

–exact Hd

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
agreesm list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
stdio_wirep m w list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

–intros l v Hl

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
v :
Hl :
list_to_mapstring_psp b reg bytes !! l = Somev
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
stdio_wirep m w list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

exact all_agree_elem_ _ _ _ Ha elem_of_list_to_map_2_ _ _ Hl

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
stdio_wirep m w list_to_mapstring_psp b reg bytes
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

–split ; exact Hrep |

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
stdio_readym w ∧ roots_apartstdio_rootsw list_to_mapstring_psp b reg bytes m
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

split ; exact Hw |

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
roots_apartstdio_rootsw list_to_mapstring_psp b reg bytes m
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

intros sp a Hin Hs l & v & reg′ & Hl & _ & E _ & Hb

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
sp :
a :
Z
Hin :
v :
reg′ :
Hl :
list_to_mapstring_psp b reg bytes !! l = Somev
E :
Hb :
piece_idl ≤ a < r_endreg′
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

apply elem_of_list_to_map_2 in Hl

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
sp :
a :
Z
Hin :
v :
reg′ :
Hl :
l, v ∈ string_psp b reg bytes
E :
Hb :
piece_idl ≤ a < r_endreg′
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

rewrite string_ps_id_ _ _ _ _ _ Hl in E , Hb

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
sp :
a :
Z
Hin :
v :
reg′ :
Hl :
l, v ∈ string_psp b reg bytes
E :
object_regionb m_regionsm = Somereg′
Hb :
b ≤ a < r_endreg′
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

destruct Ha as E′ _ _

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
E′ :
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
sp :
a :
Z
Hin :
v :
reg′ :
Hl :
l, v ∈ string_psp b reg bytes
E :
object_regionb m_regionsm = Somereg′
Hb :
b ≤ a < r_endreg′
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

cbn [ fst snd ] in E′

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
E′ :
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
sp :
a :
Z
Hin :
v :
reg′ :
Hl :
l, v ∈ string_psp b reg bytes
E :
object_regionb m_regionsm = Somereg′
Hb :
b ≤ a < r_endreg′
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

rewrite E′ in E

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
E′ :
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
sp :
a :
Z
Hin :
v :
reg′ :
Hl :
l, v ∈ string_psp b reg bytes
Hb :
b ≤ a < r_endreg′
E :
Somereg = Somereg′
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

injection E 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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
E′ :
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
sp :
a :
Z
Hin :
v :
Hl :
l, v ∈ string_psp b reg bytes
Hb :
b ≤ a < r_endreg
⊢
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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

exact Hapartsp a Hin Hs Hb

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
⊢
∀ HinvG : invGS_genHasNoLc Σ HheapG : gen_heapGSpiece pval Σ  ,
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

–intros HinvG HheapG

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
HinvG :
invGS_genHasNoLc Σ
HheapG :
gen_heapGSpiece pval Σ
⊢
∗l↦v∈list_to_mapstring_psp b reg bytespointstol DfracOwn1 v
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

rewrite big_sepM_list_to_map ; | exact string_ps_nodupp b reg bytes

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
HinvG :
invGS_genHasNoLc Σ
HheapG :
gen_heapGSpiece pval Σ
⊢
∗xk∈string_psp b reg bytespointstoxk.1 DfracOwn1 xk.2
⊢
let H ≔ nanofil_irisGSscan_registryrep requests stdio_wirep scan_ge in
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

iIntros Hs

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
HinvG :
invGS_genHasNoLc Σ
HheapG :
gen_heapGSpiece pval Σ
Hs :
∗xk∈string_psp b reg bytespointstoxk.1 DfracOwn1 xk.2
∗
WPScanLogic.LG.L.ERunscan_entryp {o. ⌜∃n : Z, o = RetWIntn⌝}

iApply scan_specp b reg bytes with [$Hs]

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
Σ :
gFunctors
HinvP :
invGpreSΣ
HheapP :
gen_heapGpreSpiece pval Σ
m :
s :
R.state
fuel :
Z
p :
b :
Z
reg :
bytes :
listZ
Hr :
R.readys m
Hrep :
repm w
Hok :
string_okp b reg bytes
Ha :
all_agreem string_psp b reg bytes
Hapart :
∀sp : span a : Z, Insp stdio_rootsw → span_containssp a → ¬b ≤ a < r_endreg
HinvG :
invGS_genHasNoLc Σ
HheapG :
gen_heapGSpiece pval Σ
∗
⌜string_okp b reg bytes⌝

done

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros Hr Hd Hrep Hw Hok Ha Hapart
apply heap_labelled_safeΣ scan_registryrep requests stdio_wirep scan_ge scan_entryp m s w list_to_mapstring_psp b reg bytes
–exact Hr
–exact Hd
–intros l v Hl
exact all_agree_elem_ _ _ _ Ha elem_of_list_to_map_2_ _ _ Hl
–split ; exact Hrep |
split ; exact Hw |
intros sp a Hin Hs l & v & reg′ & Hl & _ & E _ & Hb
apply elem_of_list_to_map_2 in Hl
rewrite string_ps_id_ _ _ _ _ _ Hl in E , Hb
destruct Ha as E′ _ _
cbn [ fst snd ] in E′
rewrite E′ in E
injection E as ←
exact Hapartsp a Hin Hs Hb
–intros HinvG HheapG
rewrite big_sepM_list_to_map ; | exact string_ps_nodupp b reg bytes
iIntros Hs
iApply scan_specp b reg bytes with [$Hs]
done

The interpreter's runtime

scan over the interpreter's runtime.

226Module InterpScanLogic ≔ ScanLogic InterpRuntime

scan is safe under the interpreter's runtime, called with Hi.v's literal "hello" in Hi.v's fixture memory, with the fixture's stream representation.

Explore proof 19 tactics

Initial goal

intros fuel

destruct HiChecks.entry_pre as Hrep & Hw & Hv

apply InterpScanLogic.scan_logic_safefixture_rep fixture_requests HiChecks.interpreter_stdio_stablefixture_rep hiΣ _ _ _ _ _ 65552 lit_reg hello_bytes

7 open

focused goal
focused goal
focused goal
focused goal
focused goal
focused goal

–exact hi_memory_ready

6 open

deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal

–exact hi_memory_disjoint

5 open

deferred goal
deferred goal
deferred goal
deferred goal
deferred goal

–exact Hrep

4 open

deferred goal
deferred goal
deferred goal
deferred goal

–exact Hw

3 open

deferred goal
deferred goal
deferred goal

–unfold string_ok

3 open

⊢
ptr_caphi_literal = Obj65552 ∨ ptr_caphi_literal = Ro65552 ∧ 0 < 65552 ∧ 65552 ≤ ptr_addrhi_literal ∧ ptr_addrhi_literal + lengthhello_bytes + 1 ≤ r_endlit_reg ∧ r_endlit_reg ≤ 2 ^ 48 ∧ Forallλx : Z ⇒ 0 < x < 256 hello_bytes
deferred goal
deferred goal

cbn

3 open

⊢
Ro65552 = Obj65552 ∨ Ro65552 = Ro65552 ∧ 0 < 65552 ∧ 65552 ≤ 65552 ∧ 65552 + 5%nat + 1 ≤ 65560 ∧ 65560 ≤ 2 ^ 48 ∧ Forallλx : Z ⇒ 0 < x < 256 hello_bytes
deferred goal
deferred goal

split ; right ; reflexivity |

3 open

⊢
0 < 65552 ∧ 65552 ≤ 65552 ∧ 65552 + 5%nat + 1 ≤ 65560 ∧ 65560 ≤ 2 ^ 48 ∧ Forallλx : Z ⇒ 0 < x < 256 hello_bytes
deferred goal
deferred goal

repeat split ; try lia

3 open

deferred goal
deferred goal

repeat constructor ; lia

2 open

deferred goal
deferred goal

–apply all_agree_intro

2 open

deferred goal

intros l v Hl

2 open

deferred goal

exact InterpHiLogic.lit_valid_agrees_ Hv l v Hl

deferred goal

–intros sp a [ <-| [ ] ] Hs

unfold span_contains in Hs

cbn in Hs

lia

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros fuel
destruct HiChecks.entry_pre as Hrep & Hw & Hv
–exact Hrep
–exact Hw
–unfold string_ok
cbn
split ; right ; reflexivity |
repeat split ; try lia
repeat constructor ; lia
intros l v Hl
–intros sp a [ <-| [ ] ] Hs
unfold span_contains in Hs
cbn in Hs
lia