Fil-C on Nix

Filnix wiki

the formal campaign

rocq/theories/HelloDiagnosticChecks.v

Logical controls for Hello's four-argument diagnostic binding. These use actual fixture literals and the supplied machine, but empty private native inventories. The Iris rule is partial correctness, not native execution or a proof of the complete close_stdout body.

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 String ZArith List Lia
From Nanofil Require Import Term Syntax Values Memory Runtime Semantics Run ExternalCalls ExternalMachine Stdio Shutdown Streams Formatting Libc LibcStreams Pieces Heap ContractFrame Logic StringLogic MemLogic LentLogic Locale LibcStreamLogic LibcErrnoLogic LibcStreamTokens LibcStreamAdapter LibcDiagnosticLogic HelloModule HelloLeaf HelloReach HelloStdio
Import ListNotations
Open Scope Z_scope
Open Scope list_scope
17Module HelloDiagnosticChecks
18Module F ≔ LibcStreamChecks
19Module T ≔ StreamTokenChecks
20Module H ≔ HelloCallbackChecks.H
21Module LG ≔ StreamHandleChecks.LG
22Module Reach ≔ HelloReach InterpRuntime
Import LG LG.L
25Definition text ≔
119; 114; 105; 116; 101; 32; 101; 114; 114; 111; 114
26Definition memory: mem ≔
λ a  ⇒
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
Explore proof 2 tactics

Initial goal

vm_compute

⊢
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live ∧ Live = Live
∧
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65744%positive H
=
∧
37 = 37
∧
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65745%positive H
=
∧
115 = 115
∧
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65746%positive H
=
∧
0 = 0
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live ∧ Live = Live
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65680%positive H
=
∧
119 = 119
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65681%positive H
=
∧
114 = 114
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65682%positive H
=
∧
105 = 105
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65683%positive H
=
∧
116 = 116
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65684%positive H
=
∧
101 = 101
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65685%positive H
=
∧
32 = 32
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65686%positive H
=
∧
101 = 101
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65687%positive H
=
∧
114 = 114
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65688%positive H
=
∧
114 = 114
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65689%positive H
=
∧
111 = 111
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65690%positive H
=
∧
114 = 114
∧
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = None → False
∧
∀ x : region  ,
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = Somex
→
match x with
=
→
∧
match match x with r_end ≔ r_end ⇒ r_end end with
Z.posH
⇒
fix Ffix x0 : comparison x1 x2 : positive {struct x2} : comparison ≔
match x1 with
H0~1%positive
⇒
match x2 with
H1~1%positive
⇒
Ffixx0 H0 H1
H1~0%positive
⇒
FfixDatatypes.Gt H0 H1
1%positive
⇒
H0~0%positive
⇒
match x2 with
H1~1%positive
⇒
FfixDatatypes.Lt H0 H1
H1~0%positive
⇒
Ffixx0 H0 H1
1%positive
⇒
1%positive
⇒
match x2 with
1%positive
⇒
x0
Datatypes.Eq 65691%positive H
=
∧
0 = 0
∧
True

repeat split ; intros;repeat match goal withH : Some_ = Some_ |- _⇒injection H as ←end;vm_compute;intuition congruence

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
repeat split ; intros;repeat match goal withH : Some_ = Some_ |- _⇒injection H as ←end;vm_compute;intuition congruence
42Lemma overwrite_owned
∀ ps h : gmappiece pval l v
base.NoDupps.*1
l, v ∈ ps
overwriteps h !! l = Somev
Explore proof 15 tactics

Initial goal

ps :
listpiece × pval
h :
⊢
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev

induction ps as | k u ps IH ; intros Hdup l v Hin ; set_solver |

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ k, u :: ps
⊢
overwritek, u :: ps h !! l = Somev

inversion Hdup as [ |? ? Hnot Htail ] ; subst

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ k, u :: ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
overwritek, u :: ps h !! l = Somev

apply elem_of_cons in Hin as E | Hin

2 open

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
E :
l, v = k, u
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
overwritek, u :: ps h !! l = Somev
focused goal
u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
overwritek, u :: ps h !! l = Somev

–injection E as ← ←

2 open

ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
v :
Hdup :
base.NoDupl, v :: ps.*1
Hnot :
l ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
overwritel, v :: ps h !! l = Somev
deferred goal
u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
overwritek, u :: ps h !! l = Somev

cbn [ overwrite ]

2 open

ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
v :
Hdup :
base.NoDupl, v :: ps.*1
Hnot :
l ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
<[l, v.1 ≔ l, v.2]>overwriteps h !! l = Somev
deferred goal
u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
overwritek, u :: ps h !! l = Somev

apply lookup_insert_eq

deferred goal
u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
overwritek, u :: ps h !! l = Somev

–cbn [ overwrite ]

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
<[k, u.1 ≔ k, u.2]>overwriteps h !! l = Somev

rewrite lookup_insert_ne ; apply IH ; assumption |

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
k, u.1 ≠ l

simpl

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
k ≠ l

intros E

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupk, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
k ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
E :
k = l
⊢
False

subst k

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupl, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
l ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
False

apply Hnot

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupl, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
l ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
l ∈ list_fmappiece × pval%type piece fst ps

apply list_elem_of_fmap

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupl, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
l ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
∃x : piece × pval, l = x.1 ∧ x ∈ ps

exists l, v

u :
ps :
listpiece × pval
h :
IH :
base.NoDupps.*1 → ∀l : piece v : pval, l, v ∈ ps → overwriteps h !! l = Somev
Hdup :
base.NoDupl, u :: ps.*1
v :
Hin :
l, v ∈ ps
Hnot :
l ∉ list_fmappiece × pval%type piece fst ps
Htail :
base.NoDuplist_fmappiece × pval%type piece fst ps
⊢
l = l, v.1 ∧ l, v ∈ ps

auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
induction ps as | k u ps IH ; intros Hdup l v Hin ; set_solver |
inversion Hdup as [ |? ? Hnot Htail ] ; subst
apply elem_of_cons in Hin as E | Hin
–injection E as ← ←
cbn [ overwrite ]
apply lookup_insert_eq
–cbn [ overwrite ]
rewrite lookup_insert_ne ; apply IH ; assumption |
simpl
intros E
subst k
apply Hnot
apply list_elem_of_fmap
exists l, v
auto
53Lemma heap_owned
∀ opened l v
heapopened !! l = Somev
Explore proof 3 tactics

Initial goal

⊢
∀opened : bool l : piece v : pval, l, v ∈ hello_diagnostic_pieces → heapopened !! l = Somev

intros opened

opened :
bool
⊢
∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces → heapopened !! l = Somev

apply overwrite_owned

opened :
bool
⊢

apply NoDup_ListNoDup , hello_diagnostic_keys

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros opened
apply NoDup_ListNoDup , hello_diagnostic_keys
58Lemma heap_agrees
∀ opened
Explore proof 13 tactics

Initial goal

⊢
∀opened : bool, agreesmemory heapopened

intros opened l v Hl

opened :
bool
v :
Hl :
heapopened !! l = Somev

destruct lookup_overwritehello_diagnostic_pieces HelloErrnoChecks.heap l v Hl as Hin | _ Hold

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
focused goal
opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
HelloErrnoChecks.heap !! l = Somev

–eapply all_agree_elem ; exact literals_agree | exact Hin

deferred goal
opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
HelloErrnoChecks.heap !! l = Somev

–unfold HelloErrnoChecks.heap in Hold

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
list_to_mapbyte_ps5120 0 0; 0; 0; 0 !! l = Somev

apply elem_of_list_to_map_2 in Hold

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

eapply all_agree_elem ; | exact Hold

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
all_agreememory byte_ps5120 0 0; 0; 0; 0

change all_agreememory byte_ps5120 0 errno_bytesmemory 5120 0

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

apply errno_bytes_agree

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
errno_cellmemory ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120

split ; discriminate |

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
writable_spanmemory span_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 ∧ ptr_addrptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120 mod 4 = 0

split ; | reflexivity

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
writable_spanmemory span_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4

split ; simpl ; lia |

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
∃base : Z reg : region, ptr_capspan_ptrspan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 = Objbase ∧ object_regionbase m_regionsmemory = Somereg ∧ r_lifereg = Live ∧ access_resmemory ptr_addrspan_ptrspan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 Objbase span_sizespan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 Write 1 = Someok

exists 5120, mkRegion5120 5128 Heap Live

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
ptr_capspan_ptrspan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 = Obj5120 ∧ object_region5120 m_regionsmemory = Somer_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live ∧ r_lifer_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live = Live ∧ access_resmemory ptr_addrspan_ptrspan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 Obj5120 span_sizespan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 Write 1 = Someok

repeat split ; reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros opened l v Hl
–eapply all_agree_elem ; exact literals_agree | exact Hin
–unfold HelloErrnoChecks.heap in Hold
apply elem_of_list_to_map_2 in Hold
eapply all_agree_elem ; | exact Hold
split ; discriminate |
split ; | reflexivity
split ; simpl ; lia |
exists 5120, mkRegion5120 5128 Heap Live
repeat split ; reflexivity
74Lemma regions
∀ b reg
Inb, reg 1024, mkRegion1024 1056 GlobalData Live; 2048, mkRegion2048 2056 Stack Live; 3072, mkRegion3072 3080 Stack Live; 4096, mkRegion4096 4104 GlobalData Live; 5120, mkRegion5120 5128 Heap Live; 65680, mkRegion65680 65696 GlobalData Live; 65744, mkRegion65744 65752 GlobalData Live
Explore proof 3 tactics

Initial goal

⊢
∀b : Z reg : region, object_regionb m_regionsmemory = Somereg → Inb, reg 1024, r_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live; 2048, r_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live; 3072, r_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live; 4096, r_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live; 5120, r_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live; 65680, r_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live; 65744, r_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live

intros b reg Hreg

b :
Z
reg :
Hreg :
⊢
Inb, reg 1024, r_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live; 2048, r_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live; 3072, r_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live; 4096, r_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live; 5120, r_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live; 65680, r_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live; 65744, r_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live

cbn [ memory conversion_mem m_regions app object_region r_base ] in Hreg

b :
Z
reg :
Hreg :
1024 =? b
→
Somer_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live
2048 =? b
→
Somer_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live
3072 =? b
→
Somer_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live
4096 =? b
→
Somer_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live
5120 =? b
→
Somer_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live
65680 =? b
→
Somer_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live
65744 =? b
→
Somer_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live
else
None
=
Somereg
⊢
Inb, reg 1024, r_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live; 2048, r_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live; 3072, r_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live; 4096, r_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live; 5120, r_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live; 65680, r_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live; 65744, r_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live

repeat destruct _ =? _ eqn :? in Hreg ; try discriminate ; injection Hreg as ←;repeat match goal withH : _ =? _ = true |- _⇒apply Z.eqb_eq in Hend;subst;simpl;tauto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros b reg Hreg
repeat destruct _ =? _ eqn :? in Hreg ; try discriminate ; injection Hreg as ←;repeat match goal withH : _ =? _ = true |- _⇒apply Z.eqb_eq in Hend;subst;simpl;tauto
87Lemma disjoint
Explore proof 3 tactics

Initial goal

intros b1 r1 b2 r2 E1 _ E2 _ Hne

b1 :
Z
r1 :
b2 :
Z
r2 :
Hne :
b1 ≠ b2
⊢
r_endr1 ≤ b2 ∨ r_endr2 ≤ b1

apply regions in E1 , E2

b1 :
Z
r1 :
b2 :
Z
r2 :
E1 :
Inb1, r1 1024, r_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live; 2048, r_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live; 3072, r_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live; 4096, r_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live; 5120, r_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live; 65680, r_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live; 65744, r_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live
E2 :
Inb2, r2 1024, r_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live; 2048, r_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live; 3072, r_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live; 4096, r_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live; 5120, r_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live; 65680, r_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live; 65744, r_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live
Hne :
b1 ≠ b2
⊢
r_endr1 ≤ b2 ∨ r_endr2 ≤ b1

repeat destruct E1 as E1 | E1 ; try contradiction ; injection E1 as ← ← ; repeat destruct E2 as E2 | E2 ; try contradiction ; injection E2 as ← ← ; simpl in * ; lia

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros b1 r1 b2 r2 E1 _ E2 _ Hne
apply regions in E1 , E2
repeat destruct E1 as E1 | E1 ; try contradiction ; injection E1 as ← ← ; repeat destruct E2 as E2 | E2 ; try contradiction ; injection E2 as ← ← ; simpl in * ; lia
Explore proof 21 tactics

Initial goal

split ; change 0 < 4294967296 ≤ 281474976710656 ; lia |

⊢
∀b : Z reg : region, object_regionb m_regionsmemory = Somereg → 0 ≤ b < InterpRuntime.start ∧ r_endreg ≤ InterpRuntime.start ∧ r_lifereg = Freed → r_endreg = b ∧ ∀a : Z, InterpRuntime.start ≤ a → m_bytesmemory a = 0 ∧ m_auxmemory a = CNone

split

2 open

⊢
∀b : Z reg : region, object_regionb m_regionsmemory = Somereg → 0 ≤ b < InterpRuntime.start ∧ r_endreg ≤ InterpRuntime.start ∧ r_lifereg = Freed → r_endreg = b
focused goal
⊢
∀a : Z, InterpRuntime.start ≤ a → m_bytesmemory a = 0 ∧ m_auxmemory a = CNone

–intros b reg E

2 open

b :
Z
reg :
⊢
0 ≤ b < InterpRuntime.start ∧ r_endreg ≤ InterpRuntime.start ∧ r_lifereg = Freed → r_endreg = b
deferred goal
⊢
∀a : Z, InterpRuntime.start ≤ a → m_bytesmemory a = 0 ∧ m_auxmemory a = CNone

apply regions in E

2 open

b :
Z
reg :
E :
Inb, reg 1024, r_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live; 2048, r_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live; 3072, r_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live; 4096, r_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live; 5120, r_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live; 65680, r_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live; 65744, r_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live
⊢
0 ≤ b < InterpRuntime.start ∧ r_endreg ≤ InterpRuntime.start ∧ r_lifereg = Freed → r_endreg = b
deferred goal
⊢
∀a : Z, InterpRuntime.start ≤ a → m_bytesmemory a = 0 ∧ m_auxmemory a = CNone

change 0 ≤ b < 4294967296 ∧ r_endreg ≤ 4294967296 ∧ r_lifereg = Freed → r_endreg = b

2 open

b :
Z
reg :
E :
Inb, reg 1024, r_base ≔ 1024; r_end ≔ 1056; r_kind ≔ GlobalData; r_life ≔ Live; 2048, r_base ≔ 2048; r_end ≔ 2056; r_kind ≔ Stack; r_life ≔ Live; 3072, r_base ≔ 3072; r_end ≔ 3080; r_kind ≔ Stack; r_life ≔ Live; 4096, r_base ≔ 4096; r_end ≔ 4104; r_kind ≔ GlobalData; r_life ≔ Live; 5120, r_base ≔ 5120; r_end ≔ 5128; r_kind ≔ Heap; r_life ≔ Live; 65680, r_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live; 65744, r_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live
⊢
0 ≤ b < 4294967296 ∧ r_endreg ≤ 4294967296 ∧ r_lifereg = Freed → r_endreg = b
deferred goal
⊢
∀a : Z, InterpRuntime.start ≤ a → m_bytesmemory a = 0 ∧ m_auxmemory a = CNone

repeat destruct E as E | E ; try contradiction ; injection E as ← ← ; simpl ; intuition try discriminate ; lia

deferred goal
⊢
∀a : Z, InterpRuntime.start ≤ a → m_bytesmemory a = 0 ∧ m_auxmemory a = CNone

–intros a Ha

a :
Z
⊢

change 4294967296 ≤ a in Ha

a :
Z
Ha :
4294967296 ≤ a
⊢

cbn [ memory conversion_mem m_bytes m_aux ]

a :
Z
Ha :
4294967296 ≤ a
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

assert Htext : 65680 ≤? a && a <? 65692 = false

2 open

a :
Z
Ha :
4294967296 ≤ a
⊢
65680 ≤? a && a <? 65692 = false
focused goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

{apply Bool.andb_false_iff

2 open

a :
Z
Ha :
4294967296 ≤ a
⊢
65680 ≤? a = false ∨ a <? 65692 = false
deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

right

2 open

a :
Z
Ha :
4294967296 ≤ a
⊢
a <? 65692 = false
deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

apply Z.ltb_ge

2 open

a :
Z
Ha :
4294967296 ≤ a
⊢
65692 ≤ a
deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

lia

deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

assert Hfmt : 65744 ≤? a && a <? 65747 = false

2 open

a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65744 ≤? a && a <? 65747 = false
focused goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
Hfmt :
65744 ≤? a && a <? 65747 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

{apply Bool.andb_false_iff

2 open

a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65744 ≤? a = false ∨ a <? 65747 = false
deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
Hfmt :
65744 ≤? a && a <? 65747 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

right

2 open

a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
a <? 65747 = false
deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
Hfmt :
65744 ≤? a && a <? 65747 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

apply Z.ltb_ge

2 open

a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
⊢
65747 ≤ a
deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
Hfmt :
65744 ≤? a && a <? 65747 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

lia

deferred goal
a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
Hfmt :
65744 ≤? a && a <? 65747 = false
⊢
65680 ≤? a && a <? 65692
→
nthZ.to_nata − 65680 text 0
65744 ≤? a && a <? 65747
→
nthZ.to_nata − 65744 37; 115 0
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

rewrite Htext Hfmt

a :
Z
Ha :
4294967296 ≤ a
Htext :
65680 ≤? a && a <? 65692 = false
Hfmt :
65744 ≤? a && a <? 65747 = false
⊢
a =? 1024
→
65
a =? 4096
→
67
a =? 3076
→
83
else
0
=
0
∧

repeat match goal with|- context [a =? ?b]⇒destruct Z.eqb_speca b ; subst ; lia | end;auto

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
split ; change 0 < 4294967296 ≤ 281474976710656 ; lia |
split
–intros b reg E
apply regions in E
change 0 ≤ b < 4294967296 ∧ r_endreg ≤ 4294967296 ∧ r_lifereg = Freed → r_endreg = b
repeat destruct E as E | E ; try contradiction ; injection E as ← ← ; simpl ; intuition try discriminate ; lia
–intros a Ha
change 4294967296 ≤ a in Ha
assert Htext : 65680 ≤? a && a <? 65692 = false
{apply Bool.andb_false_iff
right
apply Z.ltb_ge
lia
assert Hfmt : 65744 ≤? a && a <? 65747 = false
{apply Bool.andb_false_iff
right
apply Z.ltb_ge
lia
rewrite Htext Hfmt
repeat match goal with|- context [a =? ?b]⇒destruct Z.eqb_speca b ; subst ; lia | end;auto
115Lemma ready
∀ opened
libc_stream_readyλ_ _ ⇒ True memory F.worldopened
Proof 57 steps Qed
intros opened
assert Hl : locale_readyλ_ _ ⇒ True memory libc_localefstconversion_world
{split ; exact I |
split ; constructor |
split
–intros k _
split ; discriminate |
vm_compute
repeat split ; congruence
–split ; constructor |
split ; constructor |
intros k _
exists 4096
split ; right ; reflexivity | reflexivity
assert He : errno_cellmemory mkPtr5120 Obj5120
{split ; discriminate |
split ; | reflexivity
split ; simpl ; lia |
exists 5120, mkRegion5120 5128 Heap Live
repeat split ; reflexivity
{assert Hread : ∀a, a = 1024 ∨ a = 2048 → readable_bytesmemory mkPtra Obja 1
{intros a → | → ; split ; simpl ; lia | | simpl ; lia |
all: split
1: {exists 1024, mkRegion1024 1056 GlobalData Live
auto
2: {exists 2048, mkRegion2048 2056 Stack Live
auto
all: split ; reflexivity |
all: intros i Hi ; assert i = 0 as → by lia ; vm_compute ; split ; congruence
assert Hapart : ∀a n, a ≠ 5120 → file_errno_apartmemory mkPtr5120 Obj5120 mkLibcFilemkPtra Obja n [ ] [ ] [ ]
{intros a n Hne
split ; intros root |
intros base Hbase | Hbase ; injection Hbase as <-| discriminate
split ; intros |
split ; intros Hnone | source & Hin & Hcap | source & addr & Hin & Ha & Hsize & _ | b & & _ ; try discriminate ; simpl in Hin ; destruct Hin as [ <-| [ ] ] ; simpl in * ; congruence | unfold span_contains in Ha ; simpl in Ha ; lia | discriminate | unfold span_contains in Ha ; simpl in Ha ; lia
split ; unfold F.out_file , F.err_file , libc_file_ready ; split ; discriminate | | discriminate |
all: split ; apply Hread ; auto |
all: split ; simpl ; lia |
all: split ; constructor |
all: split ; constructor |
all: split ; constructor | apply Hapart ; lia
split ; exact I |
split ; exact Hl |
split ; exact He |
split ; split ; destruct opened ; repeat constructor ; lia | reflexivity |
split ; apply stdout_initial_wf |
split ; constructor |
split ; simpl ; lia |
split ; exact I |
split ; simpl ; lia |
split ; destruct opened ; reflexivity |
split ; intros _ ; exact proj1Hfiles |
split ; intros _ ; exact proj2Hfiles |
intros p file Hfile base Hin
unfold libc_file_at in Hfile
destruct same_filep libc_stdoutF.worldopened ; destruct opened | destruct same_filep libc_stderrF.worldopened ; try discriminate ; injection Hfile as ← ; contradiction
159Definition native ≔
mkDiagnosticContextlibc_world λ_ w ⇒ ∃file, libc_file_atw libc_stderrw = Somefile ∧ orientationlibc_stream_statew libc_stderrw ≠ WideOriented λ_ _ ⇒ [ ] λ_ ⇒ [ ] λ_ _ _ ⇒ False λ_ _ _ body segments ⇒ segments = body; 10 λ_ _ ⇒ True
164Definition wim w h ≔
libc_diagnostic_wiλ_ _ ⇒ True native T.out T.err 5120 0 m w h ∧ diagnostic_readynative m w
168Lemma names_absent
∀ opened key
heapopened !! PNamekey = None
Explore proof 14 tactics

Initial goal

⊢
∀opened : bool key : Z, heapopened !! PNamekey = None

intros

opened :
bool
key :
Z
⊢
heapopened !! PNamekey = None

unfold heap

rewrite overwrite_out

2 open

opened :
bool
key :
Z
⊢
focused goal
opened :
bool
key :
Z

–unfold HelloErrnoChecks.heap

2 open

opened :
bool
key :
Z
⊢
list_to_mapbyte_ps5120 0 0; 0; 0; 0 !! PNamekey = None
deferred goal
opened :
bool
key :
Z

apply not_elem_of_list_to_map_1

2 open

opened :
bool
key :
Z
⊢
PNamekey ∉ byte_ps5120 0 0; 0; 0; 0.*1
deferred goal
opened :
bool
key :
Z

rewrite byte_ps_keys

2 open

opened :
bool
key :
Z
⊢
PNamekey ∉ PByte5120 <$> seqZ0 Datatypes.length0; 0; 0; 0
deferred goal
opened :
bool
key :
Z

intros Hin

2 open

opened :
bool
key :
Z
Hin :
PNamekey ∈ PByte5120 <$> seqZ0 Datatypes.length0; 0; 0; 0
⊢
False
deferred goal
opened :
bool
key :
Z

apply list_elem_of_fmap in Hin as i & E & _

2 open

opened :
bool
key, i :
Z
E :
PNamekey = PByte5120 i
⊢
False
deferred goal
opened :
bool
key :
Z

discriminate E

deferred goal
opened :
bool
key :
Z

–intros Hin

opened :
bool
key :
Z
⊢
False

apply list_elem_of_fmap in Hin as l v & E & Hin

opened :
bool
key :
Z
v :
E :
PNamekey = l, v.1
⊢
False

apply list_elem_of_In in Hin

opened :
bool
key :
Z
v :
E :
PNamekey = l, v.1
⊢
False

vm_compute in Hin

opened :
bool
key :
Z
v :
E :
PNamekey = l, v.1
Hin :
PLive65744, VLiver_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = l, v ∨ PByte65744 0, VByte37 = l, v ∨ PByte65744 1, VByte115 = l, v ∨ PByte65744 2, VByte0 = l, v ∨ PLive65680, VLiver_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = l, v ∨ PByte65680 0, VByte119 = l, v ∨ PByte65680 1, VByte114 = l, v ∨ PByte65680 2, VByte105 = l, v ∨ PByte65680 3, VByte116 = l, v ∨ PByte65680 4, VByte101 = l, v ∨ PByte65680 5, VByte32 = l, v ∨ PByte65680 6, VByte101 = l, v ∨ PByte65680 7, VByte114 = l, v ∨ PByte65680 8, VByte114 = l, v ∨ PByte65680 9, VByte111 = l, v ∨ PByte65680 10, VByte114 = l, v ∨ PByte65680 11, VByte0 = l, v ∨ False
⊢
False

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

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros
unfold heap
apply not_elem_of_list_to_map_1
rewrite byte_ps_keys
intros Hin
apply list_elem_of_fmap in Hin as i & E & _
discriminate E
–intros Hin
apply list_elem_of_fmap in Hin as l v & E & Hin
apply list_elem_of_In in Hin
vm_compute in Hin
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; discriminate E
180Lemma heap_errno
∀ opened l v
l, v ∈ byte_ps5120 0 0; 0; 0; 0
heapopened !! l = Somev
Explore proof 15 tactics

Initial goal

⊢
∀opened : bool l : piece v : pval, l, v ∈ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev

intros opened l v Hin

opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
heapopened !! l = Somev

unfold heap

opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

rewrite overwrite_out

2 open

opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
HelloErrnoChecks.heap !! l = Somev
focused goal
opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

–unfold HelloErrnoChecks.heap

2 open

opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
list_to_mapbyte_ps5120 0 0; 0; 0; 0 !! l = Somev
deferred goal
opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

apply elem_of_list_to_map_1 ; | exact Hin

2 open

opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
base.NoDupbyte_ps5120 0 0; 0; 0; 0.*1
deferred goal
opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

change base.NoDupPByte5120 0; PByte5120 1; PByte5120 2; PByte5120 3

2 open

opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
base.NoDupPByte5120 0; PByte5120 1; PByte5120 2; PByte5120 3
deferred goal
opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

repeat apply base.NoDup_cons_2 ; set_solver |

2 open

opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
base.NoDup[ ]
deferred goal
opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

apply base.NoDup_nil_2

deferred goal
opened :
bool
v :
Hin :
l, v ∈ byte_ps5120 0 0; 0; 0; 0

–destruct MemLogic.byte_ps_elem_ _ _ _ _ Hin as i & x & Hi & → & →

opened :
bool
i :
nat
x :
Z
Hin :
PByte5120 0 + i, VBytex ∈ byte_ps5120 0 0; 0; 0; 0
Hi :
0; 0; 0; 0 !! i = Somex
⊢
PByte5120 0 + i ∉ hello_diagnostic_pieces.*1

clear Hin

opened :
bool
i :
nat
x :
Z
Hi :
0; 0; 0; 0 !! i = Somex
⊢
PByte5120 0 + i ∉ hello_diagnostic_pieces.*1

intros Hkey

opened :
bool
i :
nat
x :
Z
Hi :
0; 0; 0; 0 !! i = Somex
Hkey :
PByte5120 0 + i ∈ hello_diagnostic_pieces.*1
⊢
False

apply list_elem_of_fmap in Hkey as l v & E & Hin

opened :
bool
i :
nat
x :
Z
Hi :
0; 0; 0; 0 !! i = Somex
v :
E :
PByte5120 0 + i = l, v.1
⊢
False

apply list_elem_of_In in Hin

opened :
bool
i :
nat
x :
Z
Hi :
0; 0; 0; 0 !! i = Somex
v :
E :
PByte5120 0 + i = l, v.1
⊢
False

vm_compute in Hin

opened :
bool
i :
nat
x :
Z
Hi :
0; 0; 0; 0 !! i = Somex
v :
E :
PByte5120 0 + i = l, v.1
Hin :
PLive65744, VLiver_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = l, v ∨ PByte65744 0, VByte37 = l, v ∨ PByte65744 1, VByte115 = l, v ∨ PByte65744 2, VByte0 = l, v ∨ PLive65680, VLiver_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = l, v ∨ PByte65680 0, VByte119 = l, v ∨ PByte65680 1, VByte114 = l, v ∨ PByte65680 2, VByte105 = l, v ∨ PByte65680 3, VByte116 = l, v ∨ PByte65680 4, VByte101 = l, v ∨ PByte65680 5, VByte32 = l, v ∨ PByte65680 6, VByte101 = l, v ∨ PByte65680 7, VByte114 = l, v ∨ PByte65680 8, VByte114 = l, v ∨ PByte65680 9, VByte111 = l, v ∨ PByte65680 10, VByte114 = l, v ∨ PByte65680 11, VByte0 = l, v ∨ False
⊢
False

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

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros opened l v Hin
unfold heap
apply elem_of_list_to_map_1 ; | exact Hin
change base.NoDupPByte5120 0; PByte5120 1; PByte5120 2; PByte5120 3
repeat apply base.NoDup_cons_2 ; set_solver |
apply base.NoDup_nil_2
–destruct MemLogic.byte_ps_elem_ _ _ _ _ Hin as i & x & Hi & → & →
clear Hin
intros Hkey
apply list_elem_of_fmap in Hkey as l v & E & Hin
apply list_elem_of_In in Hin
vm_compute in Hin
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; discriminate E
195Lemma entry_wi
∀ opened
wimemory F.worldopened heapopened
Explore proof 38 tactics

Initial goal

⊢
∀opened : bool, wimemory F.worldopened heapopened

intros opened

opened :
bool
⊢
wimemory F.worldopened heapopened

assert Hoff : pieces_offerrno_keys5120 0 stream_data_heap1024 2048 heapopened memory span_containserrno_span5120 0

2 open

opened :
bool
focused goal
opened :
bool
⊢
wimemory F.worldopened heapopened

{intros l v Hl Hnot

2 open

opened :
bool
v :
Hl :
stream_data_heap1024 2048 heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

apply stream_data_lookup in Hl as Hl _

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

destruct lookup_overwritehello_diagnostic_pieces HelloErrnoChecks.heap l v Hl as Hin | _ Hold

3 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
focused goal
opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
HelloErrnoChecks.heap !! l = Somev
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

–apply list_elem_of_In in Hin

3 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
HelloErrnoChecks.heap !! l = Somev
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

vm_compute in Hin

3 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hin :
PLive65744, VLiver_base ≔ 65744; r_end ≔ 65752; r_kind ≔ GlobalData; r_life ≔ Live = l, v ∨ PByte65744 0, VByte37 = l, v ∨ PByte65744 1, VByte115 = l, v ∨ PByte65744 2, VByte0 = l, v ∨ PLive65680, VLiver_base ≔ 65680; r_end ≔ 65696; r_kind ≔ GlobalData; r_life ≔ Live = l, v ∨ PByte65680 0, VByte119 = l, v ∨ PByte65680 1, VByte114 = l, v ∨ PByte65680 2, VByte105 = l, v ∨ PByte65680 3, VByte116 = l, v ∨ PByte65680 4, VByte101 = l, v ∨ PByte65680 5, VByte32 = l, v ∨ PByte65680 6, VByte101 = l, v ∨ PByte65680 7, VByte114 = l, v ∨ PByte65680 8, VByte114 = l, v ∨ PByte65680 9, VByte111 = l, v ∨ PByte65680 10, VByte114 = l, v ∨ PByte65680 11, VByte0 = l, v ∨ False
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
HelloErrnoChecks.heap !! l = Somev
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; cbn ; try exact I ; intros reg Hlive Hlo Hhi Hspan ; unfold span_contains , errno_span in Hspan ; simpl in Hspan ; lia

2 open

deferred goal
opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
HelloErrnoChecks.heap !! l = Somev
⊢
match l with
PByteb o | PAuxb o
⇒
∀reg : region, live_atmemory b reg → 0 ≤ o → b + o < r_endreg → ¬span_containserrno_span5120 0 b + o
_
⇒
True
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

–exfalso

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
HelloErrnoChecks.heap !! l = Somev
⊢
False
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

apply Hnot

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
HelloErrnoChecks.heap !! l = Somev
⊢
l ∈ errno_keys5120 0
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

unfold HelloErrnoChecks.heap in Hold

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
list_to_mapbyte_ps5120 0 0; 0; 0; 0 !! l = Somev
⊢
l ∈ errno_keys5120 0
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

apply elem_of_list_to_map_2 in Hold

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
l ∈ errno_keys5120 0
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

change l ∈ byte_ps5120 0 0; 0; 0; 0.*1

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
l ∈ byte_ps5120 0 0; 0; 0; 0.*1
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

apply list_elem_of_fmap

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
∃x : piece × pval, l = x.1 ∧ x ∈ byte_ps5120 0 0; 0; 0; 0
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

exists l, v

2 open

opened :
bool
v :
Hl :
heapopened !! l = Somev
Hnot :
l ∉ errno_keys5120 0
Hold :
l, v ∈ byte_ps5120 0 0; 0; 0; 0
⊢
l = l, v.1 ∧ l, v ∈ byte_ps5120 0 0; 0; 0; 0
deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

auto

deferred goal
opened :
bool
⊢
wimemory F.worldopened heapopened

assert Hpair : stream_tokens_wiλ_ _ ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened

2 open

opened :
bool
⊢
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
focused goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

{split ; split ; reflexivity | simpl ; lia |

2 open

opened :
bool
⊢
token_wfT.err ∧ token_baseT.out ≠ token_baseT.err ∧ token_keyT.out ≠ token_keyT.err ∧ libc_stdoutF.worldopened = token_handleT.out ∧ libc_stderrF.worldopened = token_handleT.err ∧ stream_currentT.out F.worldopened heapopened ∧ stream_currentT.err F.worldopened heapopened ∧ ∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split ; split ; reflexivity | simpl ; lia |

2 open

opened :
bool
⊢
token_baseT.out ≠ token_baseT.err ∧ token_keyT.out ≠ token_keyT.err ∧ libc_stdoutF.worldopened = token_handleT.out ∧ libc_stderrF.worldopened = token_handleT.err ∧ stream_currentT.out F.worldopened heapopened ∧ stream_currentT.err F.worldopened heapopened ∧ ∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split ; discriminate |

2 open

opened :
bool
⊢
token_keyT.out ≠ token_keyT.err ∧ libc_stdoutF.worldopened = token_handleT.out ∧ libc_stderrF.worldopened = token_handleT.err ∧ stream_currentT.out F.worldopened heapopened ∧ stream_currentT.err F.worldopened heapopened ∧ ∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split ; discriminate |

2 open

opened :
bool
⊢
libc_stdoutF.worldopened = token_handleT.out ∧ libc_stderrF.worldopened = token_handleT.err ∧ stream_currentT.out F.worldopened heapopened ∧ stream_currentT.err F.worldopened heapopened ∧ ∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split ; reflexivity |

2 open

opened :
bool
⊢
libc_stderrF.worldopened = token_handleT.err ∧ stream_currentT.out F.worldopened heapopened ∧ stream_currentT.err F.worldopened heapopened ∧ ∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split ; reflexivity |

2 open

opened :
bool
⊢
stream_currentT.out F.worldopened heapopened ∧ stream_currentT.err F.worldopened heapopened ∧ ∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split ; unfold stream_current ; rewrite names_absent ; exact I |

2 open

opened :
bool
⊢
stream_currentT.err F.worldopened heapopened ∧ ∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split ; unfold stream_current ; rewrite names_absent ; exact I |

2 open

opened :
bool
⊢
∀d : stream_token, d = T.out ∨ d = T.err → libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handled 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handled heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

intros d → | →

3 open

opened :
bool
⊢
libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handleT.out 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handleT.out heapopened
focused goal
opened :
bool
⊢
libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handleT.err 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened ∧ ids_apartlibc_stream_releasesF.worldopened token_handleT.err heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

all: split ; | intros base l v Hin ; destruct opened ; contradiction

3 open

opened :
bool
⊢
libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handleT.out 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened
focused goal
opened :
bool
⊢
libc_errno_wiλ_ : mem _ : libc_world ⇒ True token_handleT.err 5120 0 memory F.worldopened stream_data_heaptoken_baseT.out token_baseT.err heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

all: split ; apply ready |

3 open

focused goal
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

all: split ; reflexivity |

3 open

focused goal
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

all: split ; intros root a Hin ; destruct opened ; contradiction |

3 open

focused goal
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

all: split ; intros base l v Hin ; destruct opened ; contradiction | exact Hoff

deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
wimemory F.worldopened heapopened

split

2 open

opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
libc_diagnostic_wiλ_ : mem _ : libc_world ⇒ True native T.out T.err 5120 0 memory F.worldopened heapopened
focused goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened

–split ; exact Hpair |

2 open

opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened

split ; intros root a |

2 open

opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
diagnostic_nameT.out heapopened ∧ diagnostic_nameT.err heapopened
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened

unfold diagnostic_name

2 open

opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
match heapopened !! PNametoken_keyT.out with
SomeVStream_ None | SomeVStreamOpen_ | None
⇒
True
_
⇒
False
∧
match heapopened !! PNametoken_keyT.err with
SomeVStream_ None | SomeVStreamOpen_ | None
⇒
True
_
⇒
False
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened

rewrite ! names_absent

2 open

opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
⊢
True ∧ True
deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened

auto

deferred goal
opened :
bool
Hpair :
stream_tokens_wiλ_ : mem _ : libc_world ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened

–split ; exists F.err_file ; destruct opened ; reflexivity | destruct opened ; discriminate

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros opened
assert Hoff : pieces_offerrno_keys5120 0 stream_data_heap1024 2048 heapopened memory span_containserrno_span5120 0
{intros l v Hl Hnot
apply stream_data_lookup in Hl as Hl _
–apply list_elem_of_In in Hin
vm_compute in Hin
repeat destruct Hin as Hin | Hin ; try contradiction ; injection Hin as ← ← ; cbn ; try exact I ; intros reg Hlive Hlo Hhi Hspan ; unfold span_contains , errno_span in Hspan ; simpl in Hspan ; lia
–exfalso
apply Hnot
unfold HelloErrnoChecks.heap in Hold
apply elem_of_list_to_map_2 in Hold
change l ∈ byte_ps5120 0 0; 0; 0; 0.*1
apply list_elem_of_fmap
exists l, v
auto
assert Hpair : stream_tokens_wiλ_ _ ⇒ True T.out T.err 5120 0 memory F.worldopened heapopened
{split ; split ; reflexivity | simpl ; lia |
split ; split ; reflexivity | simpl ; lia |
split ; discriminate |
split ; discriminate |
split ; reflexivity |
split ; reflexivity |
split ; unfold stream_current ; rewrite names_absent ; exact I |
split ; unfold stream_current ; rewrite names_absent ; exact I |
intros d → | →
all: split ; | intros base l v Hin ; destruct opened ; contradiction
all: split ; apply ready |
all: split ; reflexivity |
all: split ; intros root a Hin ; destruct opened ; contradiction |
all: split ; intros base l v Hin ; destruct opened ; contradiction | exact Hoff
split
–split ; exact Hpair |
split ; intros root a |
rewrite ! names_absent
auto
–split ; exists F.err_file ; destruct opened ; reflexivity | destruct opened ; discriminate
229Definition spec ≔
libc_error_contractλ_ _ ⇒ True λ_ _ _ _ ⇒ False λ_ _ _ _ _ ⇒ False native
231Definition words ≔
WInt0; WInt0; WPtrmkPtr65744 Ro65744; WPtrmkPtr65680 Ro65680
233Example admitted: ∀opened, contract_prespec words memory F.worldopened
Explore proof 10 tactics

Initial goal

⊢
∀opened : bool, contract_prespec words memory F.worldopened

intros

opened :
bool
⊢

eapply hello_diagnostic_admitted with h := heapopened file := F.err_file

8 open

opened :
bool
⊢
0 ≤ 0 < 2 ^ 32
focused goal
opened :
bool
focused goal
opened :
bool
⊢
∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces → heapopened !! l = Somev
focused goal
opened :
bool
focused goal
opened :
bool
⊢
libc_stream_readyλ_ : mem _ : libc_world ⇒ True memory F.worldopened
focused goal
opened :
bool
focused goal
opened :
bool
⊢
libc_file_atF.worldopened libc_stderrF.worldopened = SomeF.err_file
focused goal
opened :
bool
⊢

–lia

7 open

deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces → heapopened !! l = Somev
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_stream_readyλ_ : mem _ : libc_world ⇒ True memory F.worldopened
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_file_atF.worldopened libc_stderrF.worldopened = SomeF.err_file
deferred goal
opened :
bool
⊢

–apply heap_agrees

6 open

deferred goal
opened :
bool
⊢
∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces → heapopened !! l = Somev
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_stream_readyλ_ : mem _ : libc_world ⇒ True memory F.worldopened
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_file_atF.worldopened libc_stderrF.worldopened = SomeF.err_file
deferred goal
opened :
bool
⊢

–apply heap_owned

5 open

deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_stream_readyλ_ : mem _ : libc_world ⇒ True memory F.worldopened
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_file_atF.worldopened libc_stderrF.worldopened = SomeF.err_file
deferred goal
opened :
bool
⊢

–exact proj2entry_wiopened

4 open

deferred goal
opened :
bool
⊢
libc_stream_readyλ_ : mem _ : libc_world ⇒ True memory F.worldopened
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_file_atF.worldopened libc_stderrF.worldopened = SomeF.err_file
deferred goal
opened :
bool
⊢

–apply ready

3 open

deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
libc_file_atF.worldopened libc_stderrF.worldopened = SomeF.err_file
deferred goal
opened :
bool
⊢

–constructor

2 open

deferred goal
opened :
bool
⊢
libc_file_atF.worldopened libc_stderrF.worldopened = SomeF.err_file
deferred goal
opened :
bool
⊢

–destruct opened ; reflexivity

deferred goal
opened :
bool
⊢

–destruct opened ; discriminate

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros
eapply hello_diagnostic_admitted with h := heapopened file := F.err_file
–lia
–apply heap_agrees
–apply heap_owned
–exact proj2entry_wiopened
–apply ready
–constructor
–destruct opened ; reflexivity
–destruct opened ; discriminate
246Lemma admission_stderr
Explore proof 3 tactics

Initial goal

intros m w Hfmt _ _

m :
Hfmt :
contract_preerror_format_contractlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False libc_stdout libc_stderr libc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native words m w

destruct Hfmt as status & errnum & fmt & rest & format & body & info & Hwords & Hstatus & Herrnum & Hstring & Hformat & Hready & Hrest

m :
status, errnum :
Z
fmt :
rest :
listword
format, body :
listZ
Hwords :
words = WIntstatus :: WInterrnum :: WPtrfmt :: rest
Hstatus :
0 ≤ status < 2 ^ 32
Herrnum :
0 ≤ errnum < 2 ^ 32
Hstring :
c_stringm fmt format
Hformat :
narrow_formatm format rest body
Hrest :
Forallwritable_spanm diagnostic_writeslibc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native w ∧ stream_openlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False m w libc_stderrw info ∧ orientationstream_protocolinfo ≠ WideOriented ∧ libc_stdoutw ≠ libc_stderrw

exact proj1Hready

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m w Hfmt _ _
destruct Hfmt as status & errnum & fmt & rest & format & body & info & Hwords & Hstatus & Herrnum & Hstring & Hformat & Hready & Hrest
exact proj1Hready
256Example closed_stderr_rejected: ∀m w, libc_file_atw libc_stderrw = None → ¬contract_prespec words m w
Explore proof 3 tactics

Initial goal

⊢
∀m : mem w : libc_world, libc_file_atw libc_stderrw = None → ¬contract_prespec words m w

intros m w Hclosed Hpre

⊢
False

destruct admission_stderrm w Hpre as file Hfile _

m :
Hclosed :
file :
Hfile :
⊢
False

congruence

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m w Hclosed Hpre
destruct admission_stderrm w Hpre as file Hfile _
congruence
262Example wide_stderr_rejected: ∀m w, orientationlibc_stream_statew libc_stderrw = WideOriented → ¬contract_prespec words m w
Explore proof 2 tactics

Initial goal

intros m w Hwide Hpre

exact proj2admission_stderrm w Hpre Hwide

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros m w Hwide Hpre
exact proj2admission_stderrm w Hpre Hwide
266Definition changed ≔
store_bytesmemory 5120 4 16909060
275Lemma changed_ready
∀ opened
Proof 40 steps Qed
intros opened
destruct readytrue as Hrep & Hlocale & He & _ & _ & Hu & Hstatus & Hphase & Hdistinct & Hroots & Ho & Herr & Hsep
{split ; specialize Hoeq_refl ; clear Herr | specialize Herreq_refl ; clear Ho
all: destruct Ho as Hnon & Hn & Hreg & Haccess & Hbytes & Hrest || destruct Herr as Hnon & Hn & Hreg & Haccess & Hbytes & Hrest
all: split ; exact Hnon |
all: split ; | destruct Hrest as Hp & _ & _ & _ & Ha ; split ; exact Hp | ; split ; constructor | ; split ; constructor | ; split ; constructor | exact Ha
all: split ; exact Hn |
all: split ; exact Hreg |
all: split ; exact Haccess |
all: intros i Hi ; assert i = 0 as → by lia ; vm_compute ; split ; congruence
split ; exact I |
split
–destruct Hlocale as _ & _ & _ & _ & _ & Haligned
split ; exact I |
split ; constructor |
split
+intros category _
vm_compute
repeat split ; congruence
+split ; constructor |
split ; constructor | exact Haligned
–split ; exact He |
split
split ; constructor | intros _ ; reflexivity
+split
∗change stream_wfmkStreamByteOriented text ++ 10 false
split ; repeat constructor ; lia | intros _ ; reflexivity
∗split ; exact Hu |
split ; exact Hstatus |
split ; exact Hphase |
split ; exact Hdistinct |
split ; destruct opened ; reflexivity |
split ; intros _ ; exact proj1Hfiles |
split ; intros _ ; exact proj2Hfiles |
intros p file Hfile base Hin
unfold libc_file_at in Hfile
destruct same_filep libc_stdoutfinal_worldopened ; destruct opened | destruct same_filep libc_stderrfinal_worldopened ; try discriminate ; injection Hfile as ← ; contradiction
313Definition call_args ≔
ArgW Const0; ArgW TmpTAtom"errnum"; ArgP GlobalTAtom"closeout#str.55"; ArgP GlobalTAtom"closeout#str.53"
316Lemma format_prefix
Proof 95 steps Qed
intros opened
exists 0, 0, mkPtr65744 Ro65744, WPtrmkPtr65680 Ro65680, 37; 115, text, mkStreamInfo2 stdout_initial 3, mkStreamInfo2 mkStreamByteOriented text ++ 10 false 3, text; 10, text; 10, Accepttext ++ 10
split ; reflexivity |
split
–pose proof hello_diagnostic_owned"closeout#str.55" memory heapopened or_introleq_refl heap_ownedopened heap_agreesopened as Hfmt
change c_stringmemory mkPtr65744 Ro65744 37; 115 in Hfmt
exact Hfmt
–split
+rewrite <- app_nil_rtext
apply format_string ; | constructor
pose proof hello_diagnostic_owned"closeout#str.53" memory heapopened or_introror_introleq_refl heap_ownedopened heap_agreesopened as Htext
change c_stringmemory mkPtr65680 Ro65680 text in Htext
exact Htext
+split ; reflexivity |
split
∗repeat constructor ; exists [ ] ; reflexivity |
constructor
∗split ; destruct opened ; reflexivity |
split
--split ; apply changed_ready |
split ; destruct opened ; reflexivity |
split ; reflexivity |
split
++split ; split ; repeat constructor ; lia | reflexivity | simpl ; lia
++change Forallwritable_spanchanged errno_span5120 0
constructor ; exact proj1proj2proj1proj2proj2changed_readyopened | constructor
--split ; reflexivity |
split ; reflexivity |
split
++eapply stream_next ; apply stream_accept ; discriminate | repeat constructor ; lia | constructor
++split ; reflexivity |
split
**destruct opened
---exists mkStreamInfo1 mkStreamByteOriented [ ] true 7
split ; reflexivity |
split ; reflexivity |
split ; reflexivity |
split ; reflexivity | apply F.close_settles
---split ; reflexivity
**split
---split
+++split ; exists F.err_file ; destruct opened ; reflexivity | discriminate
+++apply changed_ready
---split ; split ; exact I | repeat split ; reflexivity |
split
+++destruct opened
***split
----intros root E |
subst root
split
++++right
left
exists mkSpanmkPtr5120 Obj5120 0
split ; right ; left ; reflexivity | reflexivity
++++intros a Ha
left
exists errno_span5120 0
split ; left ; reflexivity |
split
*****exact proj1proj2proj1proj2proj2changed_readytrue
*****exact Ha
----split
++++intros source Hin
left
exists source
split ; exact Hin | reflexivity
++++intros x ; contradiction
***split ; intros root |
split ; intros x ; contradiction
+++split
***split
----intros root E |
subst root
split
++++right
left
exists mkSpanmkPtr5120 Obj5120 0
split ; right ; left ; reflexivity | reflexivity
++++intros a Ha
left
exists errno_span5120 0
split ; left ; reflexivity |
split
*****exact proj1proj2proj1proj2proj2changed_readyopened
*****exact Ha
----split
++++intros source Hin
left
exists source
split ; destruct opened ; exact Hin | reflexivity
++++intros x ; destruct opened ; contradiction
***split ; intros root |
split ; right ; reflexivity |
intros a _ _
reflexivity
Explore proof 31 tactics

Initial goal

intros opened

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

7 open

focused goal
opened :
bool
⊢
focused goal
focused goal
opened :
bool
focused goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
focused goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
focused goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

–split ; reflexivity |

7 open

opened :
bool
⊢
contract_abierror_format_contractlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False libc_stdout libc_stderr libc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native CVoid call_args ∧ ∃status errnum format : value rest : listarg, call_args = ArgW status :: ArgW errnum :: ArgP format :: rest
deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

split

8 open

opened :
bool
⊢
contract_abierror_format_contractlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False libc_stdout libc_stderr libc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native CVoid call_args
focused goal
opened :
bool
⊢
∃status errnum format : value rest : listarg, call_args = ArgW status :: ArgW errnum :: ArgP format :: rest
deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

+split ; reflexivity |

8 open

opened :
bool
⊢
∃status errnum fmt : value rest : listarg, call_args = ArgW status :: ArgW errnum :: ArgP fmt :: rest ∧ Forallpromoted_argument rest
deferred goal
opened :
bool
⊢
∃status errnum format : value rest : listarg, call_args = ArgW status :: ArgW errnum :: ArgP format :: rest
deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

do 4 eexists

12 open

opened :
bool
⊢
call_args = ArgW ?status :: ArgW ?errnum :: ArgP ?fmt :: ?rest ∧ Forallpromoted_argument ?rest
deferred goal
opened :
bool
⊢
∃status errnum format : value rest : listarg, call_args = ArgW status :: ArgW errnum :: ArgP format :: rest
deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus
shelved goal
opened :
bool
shelved goal
opened :
bool
shelved goal
opened :
bool
shelved goal
opened :
bool
⊢
listarg

split ; reflexivity |

8 open

opened :
bool
⊢
Forallpromoted_argument ArgP GlobalTAtom"closeout#str.53"
deferred goal
opened :
bool
⊢
∃status errnum format : value rest : listarg, call_args = ArgW status :: ArgW errnum :: ArgP format :: rest
deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

constructor ; eexists ; left ; reflexivity | constructor

7 open

deferred goal
opened :
bool
⊢
∃status errnum format : value rest : listarg, call_args = ArgW status :: ArgW errnum :: ArgP format :: rest
deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

+do 4 eexists

11 open

opened :
bool
⊢
call_args = ArgW ?status :: ArgW ?errnum :: ArgP ?format :: ?rest
deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus
shelved goal
opened :
bool
shelved goal
opened :
bool
shelved goal
opened :
bool
shelved goal
opened :
bool
⊢
listarg

reflexivity

6 open

deferred goal
opened :
bool
⊢
deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

–apply admitted

5 open

deferred goal
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

–split

6 open

focused goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

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

6 open

opened :
bool
⊢
∀b : Z, 5120 ≤ b < 5120 + 4 → write_authoritycontract_writesspec words memory F.worldopened [ ] memory b
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

intros a Ha

6 open

opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

left

6 open

opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
⊢
∃s : span, Ins contract_writesspec words memory F.worldopened ∧ writable_spanmemory s ∧ span_containss a
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

exists errno_span5120 0

6 open

opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

split ; apply in_or_app ; right ; apply in_or_app ; left ; destruct opened ; left ; reflexivity |

6 open

opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

split

7 open

opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
focused goal
opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

∗exact proj1proj2proj1proj2proj2readyopened

6 open

deferred goal
opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

∗unfold span_contains , errno_span

6 open

opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
⊢
ptr_addrspan_ptrspan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 ≤ a < ptr_addrspan_ptrspan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4 + span_sizespan_ptr ≔ ptr_addr ≔ 5120 + 0; ptr_cap ≔ Obj5120; span_size ≔ 4
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

simpl

6 open

opened :
bool
a :
Z
Ha :
5120 ≤ a < 5120 + 4
⊢
5120 + 0 ≤ a < 5120 + 0 + 4
deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

lia

5 open

deferred goal
opened :
bool
deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

+split ; apply format_prefix | constructor ; reflexivity | constructor

4 open

deferred goal
opened :
bool
deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

–split ; split ; apply format_prefix | reflexivity | reflexivity

3 open

deferred goal
opened :
bool
⊢
∀why : reason, CallReturn[ ] ≠ CallResourcewhy
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

–intros why Hbad

3 open

opened :
bool
why :
Hbad :
⊢
False
deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

discriminate Hbad

2 open

deferred goal
opened :
bool
⊢
∀values : listword, CallReturn[ ] = CallReturnvalues → return_shapecontract_returnsspec values ∧ Forallword_authoritycontract_sourcesspec words memory F.worldopened [ ] changed values
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

–intros vs Hvs

2 open

opened :
bool
vs :
listword
Hvs :
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

injection Hvs as ←

2 open

opened :
bool
deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

split ; reflexivity | constructor

deferred goal
opened :
bool
⊢
∀status : Z, CallReturn[ ] = CallExitstatus → ∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

–intros status Hbad

opened :
bool
status :
Z
Hbad :
CallReturn[ ] = CallExitstatus
⊢
∃before : listevent, StreamBytes2 text ++ 10 = before ++ ProcessExitstatus

discriminate Hbad

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros opened
eapply H.M.E.invoke_normal with born := [ ]
–split ; reflexivity |
split
+split ; reflexivity |
do 4 eexists
split ; reflexivity |
constructor ; eexists ; left ; reflexivity | constructor
+do 4 eexists
reflexivity
–apply admitted
–split
+eapply H.M.E.effects_local ; apply local_store_bytes | constructor
intros a Ha
left
exists errno_span5120 0
split ; apply in_or_app ; right ; apply in_or_app ; left ; destruct opened ; left ; reflexivity |
split
∗exact proj1proj2proj1proj2proj2readyopened
simpl
lia
+split ; apply format_prefix | constructor ; reflexivity | constructor
–split ; split ; apply format_prefix | reflexivity | reflexivity
–intros why Hbad
discriminate Hbad
–intros vs Hvs
injection Hvs as ←
split ; reflexivity | constructor
–intros status Hbad
discriminate Hbad
407Example combined_keys: NoDuphello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0.*1
Explore proof 3 tactics

Initial goal

⊢
NoDuphello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0.*1

vm_compute

⊢
NoDupPLive65744; PByte65744 0; PByte65744 1; PByte65744 2; PLive65680; PByte65680 0; PByte65680 1; PByte65680 2; PByte65680 3; PByte65680 4; PByte65680 5; PByte65680 6; PByte65680 7; PByte65680 8; PByte65680 9; PByte65680 10; PByte65680 11; PByte5120 0; PByte5120 1; PByte5120 2; PByte5120 3

repeat apply NoDup_cons ; simpl ; intros Hbad ; repeat destruct Hbad as Hbad | Hbad ; try contradiction ; discriminate |

⊢
NoDup[ ]

apply NoDup_nil

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
vm_compute
repeat apply NoDup_cons ; simpl ; intros Hbad ; repeat destruct Hbad as Hbad | Hbad ; try contradiction ; discriminate |
apply NoDup_nil
414Example entry_usable: ∀opened, agreesmemory heapopened ∧ live_disjointmemory ∧ InterpRuntime.readyInterpRuntime.start memory ∧ wimemory F.worldopened heapopened ∧ ∀l v, l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev
Explore proof 7 tactics

Initial goal

⊢
∀opened : bool, agreesmemory heapopened ∧ live_disjointmemory ∧ InterpRuntime.readyInterpRuntime.start memory ∧ wimemory F.worldopened heapopened ∧ ∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev

intros

opened :
bool
⊢
agreesmemory heapopened ∧ live_disjointmemory ∧ InterpRuntime.readyInterpRuntime.start memory ∧ wimemory F.worldopened heapopened ∧ ∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev

split ; apply heap_agrees |

opened :
bool
⊢
live_disjointmemory ∧ InterpRuntime.readyInterpRuntime.start memory ∧ wimemory F.worldopened heapopened ∧ ∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev

split ; apply disjoint |

opened :
bool
⊢
InterpRuntime.readyInterpRuntime.start memory ∧ wimemory F.worldopened heapopened ∧ ∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev

split ; apply runtime_ready |

opened :
bool
⊢
wimemory F.worldopened heapopened ∧ ∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev

split ; apply entry_wi |

opened :
bool
⊢
∀l : piece v : pval, l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0 → heapopened !! l = Somev

intros l v Hin

opened :
bool
v :
Hin :
l, v ∈ hello_diagnostic_pieces ++ byte_ps5120 0 0; 0; 0; 0
⊢
heapopened !! l = Somev

apply elem_of_app in Hin as Hin | Hin ; apply heap_owned | apply heap_errno ; exact Hin

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros
split ; apply heap_agrees |
split ; apply disjoint |
split ; apply runtime_ready |
split ; apply entry_wi |
intros l v Hin
apply elem_of_app in Hin as Hin | Hin ; apply heap_owned | apply heap_errno ; exact Hin
425Example framed_return: ∀opened, ∃ys, lengthys = 4%nat ∧ agreeschanged overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys heapopened ∧ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys heapopened !! PByte5120 3 = SomeVByte1 ∧ ∀l v, l, v ∈ hello_diagnostic_pieces → overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys heapopened !! l = Somev
Proof 31 steps Qed
intros opened
destruct entry_usableopened as Ha & Hd & Hr & Hw & Howned
destruct H.D.error_pieces_frameλ_ _ ⇒ True λ_ _ _ _ ⇒ False λ_ _ _ _ _ ⇒ False native T.out T.err 5120 0 hello_diagnostic_pieces CVoid call_args words InterpRuntime.start memory F.worldopened StreamBytes2 text ++ 10 [ ] InterpRuntime.start changed final_worldopened heapopened 0; 0; 0; 0 returning_callopened Ha Hd Hr proj1Hw eq_refl Howned hello_diagnostic_errno_keys5120 0 ltac:lia ltac:lia as ys & _ & Hlen & Hkeys & Hag & _ & _ & Hwi
assert Hdup : base.NoDuphello_diagnostic_pieces ++ byte_ps5120 0 ys.*1
{rewrite Hkeys
apply NoDup_ListNoDup , combined_keys
exists ys
split ; exact Hlen |
split ; exact Hag |
split
–destruct ys as | a | b | c | d rest ; try discriminate Hlen
assert rest = [ ] as → by destruct rest ; reflexivity | discriminate Hlen
assert Hl : overwritehello_diagnostic_pieces ++ byte_ps5120 0 a; b; c; d heapopened !! PByte5120 3 = SomeVByted
{apply overwrite_owned ; exact Hdup |
apply elem_of_app
right
change PByte5120 3, VByted ∈ PByte5120 0, VBytea; PByte5120 1, VByteb; PByte5120 2, VBytec; PByte5120 3, VByted
do 3 apply elem_of_cons ; right
apply elem_of_cons
left
reflexivity
destruct Hag_ _ Hl as _ Hbyte
destruct HbytemkRegion5120 5128 Heap Live eq_refl eq_refl as _ & _ & Hvalue
change 1 = d in Hvalue
rewrite Hvalue
exact Hl
–intros l v Hin
apply overwrite_owned ; exact Hdup |
apply elem_of_app
left
exact Hin
458Example overlapping_key_rejected: ¬∀l v, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
Explore proof 10 tactics

Initial goal

⊢
¬∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0

intros H

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
False

apply HPByte5120 3 VByte0

2 open

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3, VByte0 ∈ PByte5120 3, VByte0
focused goal
H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 ∈ errno_keys5120 0

–apply elem_of_cons

2 open

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3, VByte0 = PByte5120 3, VByte0 ∨ PByte5120 3, VByte0 ∈ [ ]
deferred goal
H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 ∈ errno_keys5120 0

left

2 open

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3, VByte0 = PByte5120 3, VByte0
deferred goal
H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 ∈ errno_keys5120 0

reflexivity

deferred goal
H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 ∈ errno_keys5120 0

–change PByte5120 3 ∈ PByte5120 0; PByte5120 1; PByte5120 2; PByte5120 3

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 ∈ PByte5120 0; PByte5120 1; PByte5120 2; PByte5120 3

do 3 apply elem_of_cons ; right

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 ∈ PByte5120 3

apply elem_of_cons

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 = PByte5120 3 ∨ PByte5120 3 ∈ [ ]

left

H :
∀l : piece v : pval, l, v ∈ PByte5120 3, VByte0 → l ∉ errno_keys5120 0
⊢
PByte5120 3 = PByte5120 3

reflexivity

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros H
apply HPByte5120 3 VByte0
–apply elem_of_cons
left
reflexivity
–change PByte5120 3 ∈ PByte5120 0; PByte5120 1; PByte5120 2; PByte5120 3
do 3 apply elem_of_cons ; right
apply elem_of_cons
left
reflexivity
467Instance stable: SafepointStablewi
Explore proof 3 tactics

Initial goal

constructor

⊢
∀s : InterpRuntime.state m : mem s′ : InterpRuntime.state m′ : mem w : libc_world h : gmappiece pval, InterpRuntime.safepoints m s′ m′ → wim w h → wim′ w h

intros s m s′ m′ w h → → Hw

⊢
wim w h

exact Hw

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
constructor
intros s m s′ m′ w h → → Hw
exact Hw
470Definition registry: name → optioncontractlibc_world ≔
λ_ ⇒ Somespec
471Definition ge ≔
472Definition stub ≔
473Definition entry_env ≔
TAtom"errnum", WInt0
475Lemma compatible
∀ args words s m w tr vs s′ m′ w′ h ys
H.M.E.invokespec CVoid args words s m w tr CallReturnvs s′ m′ w′
wim w h
lengthys = 4%nat
libc_diagnostic_wiλ_ _ ⇒ True native T.out T.err 5120 0 m′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h
Explore proof 6 tactics

Initial goal

⊢
∀args : listarg words0 : listword s : InterpRuntime.state m : mem w : libc_world tr : listevent vs : listword s′ : InterpRuntime.state m′ : mem w′ : libc_world h : gmappiece pval ys : listZ, H.M.E.invokespec CVoid args words0 s m w tr CallReturnvs s′ m′ w′ → wim w h → Datatypes.lengthys = 4%nat → libc_diagnostic_wiλ_ : mem _ : libc_world ⇒ True native T.out T.err 5120 0 m′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h → wim′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h

intros args ws s m w tr vs s′ m′ w′ h ys Hi _ _ Hw

args :
listarg
ws :
listword
m :
tr :
listevent
vs :
listword
m′ :
h :
ys :
listZ
Hi :
H.M.E.invokespec CVoid args ws s m w tr CallReturnvs s′ m′ w′
Hw :
libc_diagnostic_wiλ_ : mem _ : libc_world ⇒ True native T.out T.err 5120 0 m′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h
⊢

split ; exact Hw |

args :
listarg
ws :
listword
m :
tr :
listevent
vs :
listword
m′ :
h :
ys :
listZ
Hi :
H.M.E.invokespec CVoid args ws s m w tr CallReturnvs s′ m′ w′
Hw :
libc_diagnostic_wiλ_ : mem _ : libc_world ⇒ True native T.out T.err 5120 0 m′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h

destruct H.D.error_returned_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Hi as _ born Hp

args :
listarg
ws :
listword
m :
tr :
listevent
vs :
listword
m′ :
h :
ys :
listZ
Hi :
H.M.E.invokespec CVoid args ws s m w tr CallReturnvs s′ m′ w′
Hw :
libc_diagnostic_wiλ_ : mem _ : libc_world ⇒ True native T.out T.err 5120 0 m′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h
born :
listZ
Hp :
H.D.M.E.prefixlibc_error_contractλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False native ws s m w born tr s′ m′ w′

destruct proj2Hp as Hfmt _

args :
listarg
ws :
listword
m :
tr :
listevent
vs :
listword
m′ :
h :
ys :
listZ
Hi :
H.M.E.invokespec CVoid args ws s m w tr CallReturnvs s′ m′ w′
Hw :
libc_diagnostic_wiλ_ : mem _ : libc_world ⇒ True native T.out T.err 5120 0 m′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h
born :
listZ
Hp :
H.D.M.E.prefixlibc_error_contractλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False native ws s m w born tr s′ m′ w′
Hfmt :
contract_prefixerror_format_contractlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False libc_stdout libc_stderr libc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native ws m w born tr m′ w′

destruct Hfmt as status & errnum & fmt & rest & text & body & info & info′ & segments & pieces & actions & Hxs & Hstring & Hformat & Hsegments & Hpieces & Hinfo & Hopen & Hid & Hid′ & Hrun & Haccepted & Hflush & Hready & Hrest

args :
listarg
ws :
listword
m :
tr :
listevent
vs :
listword
m′ :
h :
ys :
listZ
Hi :
H.M.E.invokespec CVoid args ws s m w tr CallReturnvs s′ m′ w′
Hw :
libc_diagnostic_wiλ_ : mem _ : libc_world ⇒ True native T.out T.err 5120 0 m′ w′ overwritehello_diagnostic_pieces ++ byte_ps5120 0 ys h
born :
listZ
Hp :
H.D.M.E.prefixlibc_error_contractλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False native ws s m w born tr s′ m′ w′
status, errnum :
Z
fmt :
rest :
listword
text, body :
listZ
info, info′ :
segments, pieces :
listlistZ
actions :
Hxs :
ws = WIntstatus :: WInterrnum :: WPtrfmt :: rest
Hstring :
c_stringm fmt text
Hformat :
narrow_formatm text rest body
Hsegments :
diagnostic_segmentslibc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native m w errnum body segments
Hpieces :
Forall2λwhole part : listZ ⇒ ∃tail : listZ, whole = part ++ tail segments pieces
Hinfo :
stream_atlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False w libc_stderrw = Someinfo
Hopen :
stream_openlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False m′ w′ libc_stderrw info′
Hid :
Hid′ :
stream_identifierinfo′ = 2
Haccepted :
acceptedactions = concatpieces
Hflush :
diagnostic_flushlibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False libc_stdout w w′
Hready :
Hrest :
diagnostic_framelibc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native w w′ ∧ stream_delegateslibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False w libc_stdoutw born m′ w′ ∧ stream_delegateslibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False w libc_stderrw born m′ w′ ∧ ∀root : span, Inroot diagnostic_writeslibc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native w′ → available_capdiagnostic_sourceslibc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native m w born m′ ptr_capspan_ptrroot ∧ ∀a : Z, span_containsroot a → write_authoritydiagnostic_writeslibc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native w born m′ a ∧ tr = [ ] ∧ acceptedactions = [ ] ∨ tr = StreamBytes2 acceptedactions ∧ ∀a : Z, in_objectm a → ¬write_authoritystream_aux_rootslibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False w libc_stdoutw ++ stream_aux_rootslibc_stream_modelλ_ : mem _ : libc_world ⇒ True λ_ : libc_world _ : ptr _ _ : Z ⇒ False λ_ : libc_world _ : ptr _ _ : stream_state _ : bool ⇒ False w libc_stderrw ++ diagnostic_writeslibc_diagnostic_contextλ_ : mem _ : libc_world ⇒ True native w [ ] m a → m_auxm′ a = m_auxm a

exact proj1Hready

No remaining goals.

Qed

✓ Proof checked and closed by Rocq.

Source script
intros args ws s m w tr vs s′ m′ w′ h ys Hi _ _ Hw
split ; exact Hw |
destruct H.D.error_returned_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Hi as _ born Hp
destruct proj2Hp as Hfmt _
destruct Hfmt as status & errnum & fmt & rest & text & body & info & info′ & segments & pieces & actions & Hxs & Hstring & Hformat & Hsegments & Hpieces & Hinfo & Hopen & Hid & Hid′ & Hrun & Haccepted & Hflush & Hready & Hrest
exact proj1Hready
491Section iris
492Context `{!invGS_genhlc Σ, !gen_heapGSpiece pval Σ}
493Instance test_irisGS: irisGS_genhlc nanofil_langregistry ge Σ ≔
nanofil_irisGSregistry wi ge
496Example diagnostic_then_return: ptshello_diagnostic_pieces −∗ ptsbyte_ps5120 0 0; 0; 0; 0 −∗ WPERunmkFramestub entry_env [ ] None ExecTAtom"body" CallCVoid GlobalTAtom"error" ArgW Const0; ArgW TmpTAtom"errnum"; ArgP GlobalTAtom"closeout#str.55"; ArgP GlobalTAtom"closeout#str.53" JRetConst0 : language.exprnanofil_langregistry ge {result. ∃ys, ⌜result = RetWInt0 ∧ lengthys = 4%nat⌝ ∗ ptshello_diagnostic_pieces ∗ ptsbyte_ps5120 0 ys}
Proof 29 steps Qed
iIntros Hps He
iApply H.wp_hello_errorregistry wi ge λ_ _ ⇒ True λ_ _ _ _ ⇒ False λ_ _ _ _ _ ⇒ False native T.out T.err 5120 0 stub entry_env [ ] TAtom"body" TmpTAtom"errnum" GlobalTAtom"closeout#str.55" GlobalTAtom"closeout#str.53" [ ] JRetConst0 0 0; 0; 0; 0 _ with Hps He []
–intros m w h Hwi Hnative
split ; exact Hwi |
split ; exact Hnative |
split ; constructor | exact Hnative
–exact compatible
intros s _
reflexivity
–lia
–lia
–reflexivity
–reflexivity
–vm_compute
reflexivity
–vm_compute
reflexivity
–lia
–reflexivity
–iNext
iIntros ys %Hlen Hps He
iApply wp_retregistry wi ge stub entry_env TAtom"body" Const0 W WInt0 ; reflexivity | reflexivity |
iNext
iExists ys
iSplit
+iPureIntro
split ; reflexivity | exact Hlen
+iFrame Hps He