Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
387 commits
Select commit Hold shift + click to select a range
ca5b7bf
G2_CreditV_UB
markusdemedeiros Nov 24, 2025
bdfaf2e
More g2 expectation side conditions
markusdemedeiros Nov 25, 2025
1113d5c
checkpoint
markusdemedeiros Nov 25, 2025
3653439
some more stuff
markusdemedeiros Nov 25, 2025
3f3a58e
sketch Fubini applications
markusdemedeiros Nov 25, 2025
a7095a2
Prove Fubini for G1 expectation
markusdemedeiros Nov 25, 2025
6ce3647
H5
markusdemedeiros Nov 27, 2025
aad0c46
checkpoint robot
markusdemedeiros Nov 27, 2025
76b603e
checkpoint
markusdemedeiros Nov 27, 2025
446fc1b
move lemmas
markusdemedeiros Nov 27, 2025
f751a4c
finish one of the proofs
markusdemedeiros Nov 27, 2025
7cc66be
refactor
markusdemedeiros Nov 27, 2025
5e55f89
checkpoint robot
markusdemedeiros Nov 28, 2025
53077ab
checkpoint
markusdemedeiros Nov 28, 2025
c63ea72
checkpoint
markusdemedeiros Nov 28, 2025
f382720
minor
markusdemedeiros Nov 28, 2025
60060b6
minor
markusdemedeiros Nov 28, 2025
500aed7
comparison test
markusdemedeiros Dec 8, 2025
a229026
left extensions
markusdemedeiros Dec 8, 2025
fc59b59
reduction for M test
markusdemedeiros Dec 8, 2025
d4299a8
M test
markusdemedeiros Dec 9, 2025
ecdb71a
FubiniIntegralSeries_Strong
markusdemedeiros Dec 9, 2025
fd2a9da
checkpoint
markusdemedeiros Dec 9, 2025
361ad9a
checkpoint
markusdemedeiros Dec 9, 2025
40edb3b
comment out neg exp and dependencies
markusdemedeiros Dec 9, 2025
7e2a8b3
Le_nat_sum
markusdemedeiros Dec 9, 2025
5873be0
ex_RInt_SeriesC
markusdemedeiros Dec 9, 2025
e6120db
checkpoint HL3
markusdemedeiros Dec 9, 2025
0526f9b
gauss -> pcts
markusdemedeiros Dec 9, 2025
e2eeb82
checkpoint
markusdemedeiros Dec 9, 2025
54a21bf
checkpoint fubini step reduction
markusdemedeiros Dec 10, 2025
279c1f4
checkpoint
markusdemedeiros Dec 10, 2025
007dd94
Gauss existence lemma 2
markusdemedeiros Dec 10, 2025
2b8bf10
H3
markusdemedeiros Dec 10, 2025
5d1a12e
dammit
markusdemedeiros Dec 10, 2025
bdd4ed3
the only good code is dead code
markusdemedeiros Dec 10, 2025
073bcef
more HR2
markusdemedeiros Dec 10, 2025
f196751
Dissolve HR2 in battery acid
markusdemedeiros Dec 10, 2025
f88349f
victory over gauss
markusdemedeiros Dec 10, 2025
4c74714
add continuity assumption to the uniform limit theorem (oops)
markusdemedeiros Dec 11, 2025
40b7b28
start organizing indicators.v
markusdemedeiros Dec 11, 2025
82918a1
organize math
markusdemedeiros Dec 11, 2025
4cdfe09
derive one of the Fubini axioms
markusdemedeiros Dec 11, 2025
855d18b
First attempt in program for proving adequacy of lazy real
hei411 Dec 12, 2025
f858ea8
RInt_sep
markusdemedeiros Dec 12, 2025
523c667
nit
markusdemedeiros Dec 12, 2025
ef2dda3
open neg_exp again
markusdemedeiros Dec 13, 2025
e2cece1
checkpoint
markusdemedeiros Dec 13, 2025
412d466
wow
markusdemedeiros Dec 13, 2025
45fde0d
double wow
markusdemedeiros Dec 13, 2025
3c9ce68
kill upper bound proof
markusdemedeiros Dec 13, 2025
c53a4ca
checkpoint
markusdemedeiros Dec 13, 2025
2b8f467
more
markusdemedeiros Dec 13, 2025
1afe6c6
checkpoint (no compile)
markusdemedeiros Dec 13, 2025
6f199a7
checkpoint (no compile)
markusdemedeiros Dec 13, 2025
8a8ae87
checkpoint
markusdemedeiros Dec 13, 2025
c5c0d75
grind up more existence theorems in neg_exp
markusdemedeiros Dec 13, 2025
45e35ac
checkpoint exists
markusdemedeiros Dec 13, 2025
b3bee97
blood for the blood god
markusdemedeiros Dec 13, 2025
49945d8
ex_RInt_filterlim_uniform
markusdemedeiros Dec 13, 2025
421a95f
more
markusdemedeiros Dec 13, 2025
1fc4ff5
checkpoint
markusdemedeiros Dec 13, 2025
4ec9964
robot checkpoint
markusdemedeiros Dec 13, 2025
cecbeb7
fix pcs
markusdemedeiros Dec 13, 2025
600e61f
integrability of interval functions
markusdemedeiros Dec 13, 2025
338c288
pcts lemmas
markusdemedeiros Dec 13, 2025
0ae832a
fix definition of IPCTS
markusdemedeiros Dec 13, 2025
41a388c
more pcs
markusdemedeiros Dec 13, 2025
31845e4
checkpoint
markusdemedeiros Dec 14, 2025
71cc440
checkpoint
markusdemedeiros Dec 14, 2025
3e9a2df
checkpoint
markusdemedeiros Dec 14, 2025
ac96bb0
checkpoint
markusdemedeiros Dec 14, 2025
5a2b15d
move the test
markusdemedeiros Dec 14, 2025
5578101
checkpoint
markusdemedeiros Dec 14, 2025
9bdc708
checkpoint
markusdemedeiros Dec 14, 2025
6fbfacf
reduce neg exp to mostly math
markusdemedeiros Dec 14, 2025
bb868c9
axioms doc
markusdemedeiros Dec 15, 2025
3bfc961
continuity2 docs
markusdemedeiros Dec 15, 2025
34be8a6
exp doc
markusdemedeiros Dec 15, 2025
fb22222
integrals doc
markusdemedeiros Dec 15, 2025
978bc3d
indicators doc
markusdemedeiros Dec 15, 2025
d06565c
series doc
markusdemedeiros Dec 15, 2025
3c6ff63
set doc
markusdemedeiros Dec 15, 2025
d151132
pcs doc
markusdemedeiros Dec 15, 2025
c9abc64
doc period
markusdemedeiros Dec 15, 2025
fc8138b
doc limit exchanges, close M test for improper integrals
markusdemedeiros Dec 15, 2025
76d8a9d
neg exp goals
markusdemedeiros Dec 15, 2025
32540d0
rebase
hei411 Dec 15, 2025
d830792
first case in lazy real adequacy
hei411 Dec 15, 2025
251556e
Complete lazy_real_adequacy
hei411 Dec 15, 2025
099ed3a
plan
markusdemedeiros Dec 15, 2025
1c75bc7
checkpoint
markusdemedeiros Dec 15, 2025
59f79aa
First sketch of improved adequacy
hei411 Dec 15, 2025
f0a073d
Add PCts condition
hei411 Dec 15, 2025
1fbb27d
checkpoint
markusdemedeiros Dec 15, 2025
1296505
Progress
hei411 Dec 15, 2025
291d622
Change PCts to IPCts
hei411 Dec 15, 2025
04ed484
NIT
hei411 Dec 15, 2025
7c91a8d
neg exp but without RInt_gen skeleton
markusdemedeiros Dec 15, 2025
37ba069
DELETE IT ALL
markusdemedeiros Dec 15, 2025
6ad1a19
negexp progress
markusdemedeiros Dec 16, 2025
9b121e5
checkpoint
markusdemedeiros Dec 16, 2025
7aca1a9
Solving more admits for lazy_real_adequacy
hei411 Dec 16, 2025
acccab5
More admits solved lazy_real_adequacy
hei411 Dec 16, 2025
099a86b
progress with lazy real
hei411 Dec 16, 2025
7fc4872
Improved adequacy
hei411 Dec 16, 2025
2049550
NIT
hei411 Dec 16, 2025
4c7ed32
Sketch of the other adequacy thm for lazy real
hei411 Dec 16, 2025
f266915
wp_is_smaller_prog2
hei411 Dec 16, 2025
3c12c47
wp_is_zero2
hei411 Dec 16, 2025
c949d1a
wp_is_smaller_prog_aux2
hei411 Dec 16, 2025
bfb5e85
Progress in wp_e2
hei411 Dec 16, 2025
5043539
top level proof of accuracy bound
markusdemedeiros Dec 16, 2025
cb6b2d5
lazy_real_adequacy2
hei411 Dec 16, 2025
c6319f4
poke poke
markusdemedeiros Dec 16, 2025
7b61c9c
exp lemmas
markusdemedeiros Dec 16, 2025
71be79e
IPCts of Acc
markusdemedeiros Dec 16, 2025
efff562
make neg exp sampler a little less spicy
markusdemedeiros Dec 16, 2025
9560ea1
NIT
hei411 Dec 16, 2025
1eff066
NIT
hei411 Dec 16, 2025
f6fc244
NIT
hei411 Dec 16, 2025
09d076f
checkpoint
markusdemedeiros Dec 16, 2025
5c7dcf2
stub application of adequacy1 to gauss
markusdemedeiros Dec 16, 2025
3f44178
checkpoint
markusdemedeiros Dec 16, 2025
00568e8
g_expectation admits to lemmas or solved
markusdemedeiros Dec 16, 2025
7772fac
checkpoint
markusdemedeiros Dec 16, 2025
49ecae9
more
markusdemedeiros Dec 16, 2025
65ad203
more
markusdemedeiros Dec 17, 2025
23edad3
darn
markusdemedeiros Dec 17, 2025
764a7ff
I will not be forgiven for this proof
markusdemedeiros Dec 17, 2025
0c91b96
bleh
markusdemedeiros Dec 17, 2025
67a5a3e
complete lazy_real_adequacy' by adding IPCts condition
hei411 Dec 17, 2025
54c545c
some work on gauss_adequate_1
hei411 Dec 17, 2025
e27c4c0
small admits over Gauss_adequate_1
hei411 Dec 17, 2025
012a2ca
NIT
hei411 Dec 17, 2025
9e2eea6
PCts_split
hei411 Dec 17, 2025
63209b0
Some PCts lemmas
hei411 Dec 17, 2025
91e8dc3
QuadExchange1
markusdemedeiros Dec 17, 2025
fd515bc
state PCts_unit_implies_all lemma
hei411 Dec 17, 2025
4646c9e
QuadExchange2
markusdemedeiros Dec 17, 2025
23f71f0
QuadExchange4
markusdemedeiros Dec 17, 2025
051f77a
QuadExists1
markusdemedeiros Dec 17, 2025
a0dbe92
QuadExists
markusdemedeiros Dec 17, 2025
ff65457
move
markusdemedeiros Dec 17, 2025
49659ef
some mult reductions
markusdemedeiros Dec 17, 2025
83f9d5e
hbne reductions
markusdemedeiros Dec 17, 2025
b2ff09f
Progress in PCts_unit_implies_all
hei411 Dec 18, 2025
8eab601
Finish PCTs condition in gauss adequacy
hei411 Dec 18, 2025
87d71e7
NIT
hei411 Dec 18, 2025
b29741f
some Fubini
markusdemedeiros Dec 18, 2025
a94a610
math
markusdemedeiros Dec 18, 2025
b714168
math
markusdemedeiros Dec 18, 2025
2b8f80c
ex_RInt_gen_Ici_compare_PCts'
hei411 Dec 18, 2025
b892e8d
math
markusdemedeiros Dec 18, 2025
d1e7b5a
Some lemmas for ex_RInt_gen
hei411 Dec 18, 2025
7a1ae78
math
markusdemedeiros Dec 18, 2025
a974d41
Small admits solved
hei411 Dec 18, 2025
8b124af
math
markusdemedeiros Dec 18, 2025
8cdc570
Gausssssss 1
hei411 Dec 18, 2025
f9c448a
Modify IntervalFun_continuity_mult
hei411 Dec 18, 2025
42d00d5
remove half-baked PCTS
markusdemedeiros Dec 18, 2025
70ea39c
simple clamp lemmas
markusdemedeiros Dec 18, 2025
79fd812
Yo dawg I heard you liked case analysis so I put case analysis in you…
markusdemedeiros Dec 18, 2025
1c70638
first half of Fubini reduction
markusdemedeiros Dec 18, 2025
4fd8408
second half of Fubini reduction
markusdemedeiros Dec 18, 2025
7fac9c3
Third and final half of the Fubini reduction
markusdemedeiros Dec 18, 2025
97e6d23
clamp_continuous
hei411 Dec 19, 2025
ed3f6ac
IPCts_scal_mult
hei411 Dec 19, 2025
08ed0a8
IPCts_shift
hei411 Dec 19, 2025
3b97be9
PCts_mult
hei411 Dec 19, 2025
5da9fc0
RInt_gen_pos_strong
hei411 Dec 19, 2025
2c0c6b8
ex_RInt_gen_plus
hei411 Dec 19, 2025
9e09e95
ex_RInt_gen_fsum
hei411 Dec 19, 2025
ebf7b86
fsum_product
hei411 Dec 19, 2025
c5daafc
NIT
hei411 Dec 19, 2025
c1e2567
lazy real addition
markusdemedeiros Dec 22, 2025
55156b6
defs
markusdemedeiros Dec 22, 2025
65925c8
Rocq-level implementation
markusdemedeiros Dec 22, 2025
1f50af7
Iris lazy reals
markusdemedeiros Dec 22, 2025
3a078c5
IPCts_mult
hei411 Dec 22, 2025
0d33ba0
NIT
hei411 Dec 22, 2025
24888c7
Change definition of PCts2
hei411 Dec 22, 2025
be96df4
Progress in PCts2_mult
hei411 Dec 22, 2025
ecc0287
More progress in PCts2_mult
hei411 Dec 22, 2025
f54468d
RectFun_continuity_mult
hei411 Dec 22, 2025
13d3ee7
Continuity2_mult
hei411 Dec 22, 2025
fc9ddc8
neg_exp_accuracy_chasles progress
hei411 Dec 22, 2025
7ddced0
get_bit
markusdemedeiros Dec 22, 2025
9af1278
update
markusdemedeiros Dec 22, 2025
f2722d6
attempt
markusdemedeiros Dec 22, 2025
e07c1b4
attempt 2
markusdemedeiros Dec 23, 2025
760ff69
Fix neg_exp_accuracy_chasles
hei411 Dec 23, 2025
65b3200
NIT
hei411 Dec 23, 2025
a36ddc7
Lemmas for IPCts Ioi
hei411 Dec 23, 2025
153461f
get bits
markusdemedeiros Dec 23, 2025
0f779df
checkpoint
markusdemedeiros Dec 23, 2025
ef31fd9
lower-level approximation definition
markusdemedeiros Dec 23, 2025
6406b15
lift lazy real to real
markusdemedeiros Dec 23, 2025
8ee04a9
cmp helpers
markusdemedeiros Dec 23, 2025
c0a9463
compare lt
markusdemedeiros Dec 23, 2025
8dad946
cmp gt
markusdemedeiros Dec 23, 2025
d3f8d83
checkpoint
markusdemedeiros Dec 23, 2025
0c60a84
symmetric neg exp
markusdemedeiros Dec 23, 2025
c3cbc3c
move neg exp symm
markusdemedeiros Dec 23, 2025
84e3030
oops
markusdemedeiros Dec 23, 2025
77dd0e8
lift bzu to lazy real
markusdemedeiros Dec 23, 2025
694b859
strengthen approxScal (for free)
markusdemedeiros Dec 24, 2025
acb847c
sketch Laplace
markusdemedeiros Dec 24, 2025
6c0b334
checkpoint
markusdemedeiros Dec 24, 2025
c95d399
checkpoint
markusdemedeiros Dec 24, 2025
5ac5929
checkpoint
markusdemedeiros Dec 24, 2025
5bd6487
checkpoint
markusdemedeiros Dec 24, 2025
97bb4aa
oops
markusdemedeiros Dec 24, 2025
fc373e8
checkpoint
markusdemedeiros Dec 24, 2025
c2315be
more
markusdemedeiros Dec 24, 2025
dfc7423
more
markusdemedeiros Dec 24, 2025
7c7ca35
positive half of the laplace closed form argument
markusdemedeiros Dec 24, 2025
b3aca2e
checkpoint
markusdemedeiros Dec 24, 2025
52d6196
closed form for laplace
markusdemedeiros Dec 24, 2025
1204026
more
markusdemedeiros Dec 24, 2025
afe1a3d
laplace closed
markusdemedeiros Dec 24, 2025
dddf4b0
another piecewise lemma
markusdemedeiros Dec 24, 2025
c747acf
checkpoint
markusdemedeiros Dec 24, 2025
37c9280
checkpoint
markusdemedeiros Dec 24, 2025
a3c8498
more
markusdemedeiros Dec 24, 2025
ef55ed3
laplace sampler
markusdemedeiros Dec 24, 2025
b417b04
general laplace (missing shift lemma)
markusdemedeiros Dec 24, 2025
e58f12d
checkpoint
markusdemedeiros Dec 24, 2025
49ce6c2
checkpoint shifting lemmas
markusdemedeiros Dec 26, 2025
432bdc5
wp_Laplace
markusdemedeiros Dec 26, 2025
07efe44
wp_laplace
markusdemedeiros Dec 26, 2025
f14f2bc
laplace accuracy
markusdemedeiros Dec 26, 2025
a6899cf
cleanup
markusdemedeiros Dec 26, 2025
56cc090
max lazy real start
markusdemedeiros Dec 29, 2025
905a44f
finish max lazy real
markusdemedeiros Jan 6, 2026
a55f44f
move bzu to R
markusdemedeiros Jan 7, 2026
6ee4dbd
strengthen gauss
markusdemedeiros Jan 7, 2026
666daf6
gauss creal (missing closed form)
markusdemedeiros Jan 7, 2026
7ac6147
checkpoint: closed form skeleton
markusdemedeiros Jan 7, 2026
5699649
change of variables
markusdemedeiros Jan 7, 2026
1d5b13f
gauss CReal
markusdemedeiros Jan 7, 2026
ef25cff
sketch CReal adequacy
markusdemedeiros Jan 7, 2026
fc8e416
close over I in IsApprox
markusdemedeiros Jan 7, 2026
e32237f
checkpoint adequacy
markusdemedeiros Jan 8, 2026
adf6488
first direction of CReal adequacy
markusdemedeiros Jan 8, 2026
70ec302
the other half of adequacy
markusdemedeiros Jan 8, 2026
3dec20d
apply adequacy to gauss
markusdemedeiros Jan 12, 2026
59771ae
lazy_real_expr_adequacy_mass_prob
markusdemedeiros Jan 15, 2026
66db96d
cdf adequacy
markusdemedeiros Jan 15, 2026
b441ed1
Merge branch 'elementary-infinite-2' into main-tmp-infinite
markusdemedeiros Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 32 additions & 16 deletions theories/eris/adequacy.v
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ Section adequacy.
by iApply "IH".
Qed.

Theorem wp_refRcoupl_step_fupdN (ε : nonnegreal) (e : expr) (σ : state) n φ :
state_interp σ ∗ err_interp (ε) ∗ WP e {{ v, ⌜φ v⌝ }} ⊢
Theorem wp_refRcoupl_step_fupdN k (ε : nonnegreal) (e : expr) (σ : state) n φ :
(k + n < max_step)%nat →
state_interp k σ ∗ err_interp (ε) ∗ WP e {{ v, ⌜φ v⌝ }} ⊢
|={⊤,∅}=> |={∅}▷=>^n ⌜pgl (exec n (e, σ)) φ ε⌝.
Proof.
iInduction n as [|n] "IH" forall (e σ ε); iIntros "((Hσh & Hσt) & Hε & Hwp)".
iInduction n as [|n] "IH" forall (k e σ ε); iIntros (Hlt) "(Hσ & Hε & Hwp)".
- rewrite /exec /=.
destruct (to_val e) eqn:Heq.
+ apply of_to_val in Heq as <-.
Expand All @@ -226,7 +227,9 @@ Section adequacy.
apply (pgl_mon_grading _ _ 0); [apply cond_nonneg | ].
apply pgl_dret; auto.
+ rewrite pgl_wp_unfold /pgl_wp_pre /= Heq.
iMod ("Hwp" with "[$]") as "Hlift".
iMod ("Hwp" $! k with "[$]") as "Hlift".
iDestruct "Hlift" as "[%|Hlift]".
{ exfalso. simpl in Hlt. lia. }
iModIntro.
iPoseProof
(glm_mono _ (λ '(e2, σ2) ε', |={∅}▷=>^(S n)
Expand All @@ -235,7 +238,8 @@ Section adequacy.
{ apply Rle_refl. }
{ iIntros ([] ?) "H !> !>".
iMod "H" as "(Hstate & Herr_auth & Hwp)".
iMod ("IH" with "[$]") as "H".
iMod ("IH" $! (S k) with "[] [$]") as "H".
{ iPureIntro. simpl in Hlt. lia. }
iModIntro. done. }
assert ((prim_step e σ) = (step (e, σ))) as h => //.
rewrite h. clear h.
Expand Down Expand Up @@ -448,11 +452,12 @@ Section adequacy.
by iApply "IH".
Qed.

Theorem wp_safety_fupdN (ε : nonnegreal) (e : expr) (σ : state) n φ :
state_interp σ ∗ err_interp (ε) ∗ WP e {{ v, ⌜φ v⌝ }} ⊢
Theorem wp_safety_fupdN k (ε : nonnegreal) (e : expr) (σ : state) n φ :
(k + n < max_step)%nat →
state_interp k σ ∗ err_interp (ε) ∗ WP e {{ v, ⌜φ v⌝ }} ⊢
|={⊤,∅}=> |={∅}▷=>^n ⌜SeriesC (pexec n (e, σ)) >= 1 - ε⌝.
Proof.
iInduction n as [|n] "IH" forall (e σ ε); iIntros "((Hσh & Hσt) & Hε & Hwp)".
iInduction n as [|n] "IH" forall (k e σ ε); iIntros (Hlt) "(Hσ & Hε & Hwp)".
- rewrite /=.
iApply fupd_mask_intro; [set_solver|]; iIntros.
iPureIntro.
Expand Down Expand Up @@ -487,7 +492,8 @@ Section adequacy.
etrans; last eapply (SeriesC_singleton' (of_val v, σ)).
apply SeriesC_ext.
intros. case_bool_decide; subst; simpl.
--- rewrite IHn. rewrite step_or_final_is_final; first rewrite dret_1_1; [lra|done|].
--- rewrite IHn; last by lia.
rewrite step_or_final_is_final; first rewrite dret_1_1; [lra|done|].
rewrite /is_final. simpl. done.
--- simpl. rewrite step_or_final_is_final; last by rewrite /is_final.
rewrite dret_0; last done. lra.
Expand All @@ -503,13 +509,15 @@ Section adequacy.
++ intros. simpl. rewrite /dbind/dbind_pmf{1}/pmf/=.
apply SeriesC_0.
intros. destruct (decide (x = (of_val v, σ))).
** subst. rewrite IHn; try done. lra.
** subst. rewrite IHn; try done; try lia. lra.
** rewrite step_or_final_is_final; last by rewrite /is_final.
rewrite dret_0; last done.
lra.
* rewrite SeriesC_singleton. lra.
+ rewrite pgl_wp_unfold /pgl_wp_pre /= Heq.
iMod ("Hwp" with "[$]") as "Hlift".
iMod ("Hwp" $! k with "[$]") as "Hlift".
iDestruct "Hlift" as "[%Hlt'|Hlift]".
{ exfalso. simpl in Hlt. lia. }
iModIntro.
iPoseProof
(glm_mono _ (λ '(e2, σ2) ε', |={∅}▷=>^(S n)
Expand All @@ -518,7 +526,8 @@ Section adequacy.
{ apply Rle_refl. }
{ iIntros ([] ?) "H !> !>".
iMod "H" as "(Hstate & Herr_auth & Hwp)".
iMod ("IH" with "[$]") as "H".
iMod ("IH" $! (S k)%nat with "[] [$]") as "H".
{ iPureIntro. simpl in Hlt; lia. }
iModIntro. done. }
by iApply (glm_erasure_safety with "H").
Qed.
Expand All @@ -530,12 +539,14 @@ Class erisGpreS Σ := ErisGpreS {
erisGpreS_iris :: invGpreS Σ;
erisGpreS_heap :: ghost_mapG Σ loc val;
erisGpreS_tapes :: ghost_mapG Σ loc tape;
erisGpreS_steps :: mono_natG Σ;
erisGpreS_err :: ecGpreS Σ;
}.

Definition erisΣ : gFunctors :=
#[invΣ; ghost_mapΣ loc val;
ghost_mapΣ loc tape;
mono_natΣ;
GFunctor (authR nonnegrealUR)].
Global Instance subG_erisGPreS {Σ} : subG erisΣ Σ → erisGpreS Σ.
Proof. solve_inG. Qed.
Expand All @@ -562,8 +573,10 @@ Proof.
eapply Rle_trans; [eapply prob_le_1|done]. }
set ε' := mknonnegreal _ Hε.
iMod (ec_alloc ε') as (?) "[? ?]"; [done|].
set (HclutchGS := HeapG Σ _ _ _ γH γT _).
iApply (wp_refRcoupl_step_fupdN ε').
iMod (mono_nat_own_alloc O) as (γS) "[? ?]".
set (HclutchGS := HeapG Σ _ _ _ _ γH γT γS _ (S n)).
iApply (wp_refRcoupl_step_fupdN 0 ε' _ _ n).
{ simpl. lia. }
iFrame.
iApply Hwp.
done.
Expand Down Expand Up @@ -627,8 +640,11 @@ Proof.
- simpl. lra. }
set ε' := mknonnegreal _ Hε.
iMod (ec_alloc ε') as (?) "[? ?]"; [done|].
set (HclutchGS := HeapG Σ _ _ _ γH γT _).
iApply (wp_safety_fupdN ε'). iFrame.
iMod (mono_nat_own_alloc O) as (γS) "[? ?]".
set (HclutchGS := HeapG Σ _ _ _ _ γH γT γS _ (S n)).
iApply (wp_safety_fupdN 0 ε').
{ simpl. lia. }
iFrame.
iApply Hwp. done.
Qed.

Expand Down
67 changes: 54 additions & 13 deletions theories/eris/ectx_lifting.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,47 @@ Local Hint Resolve head_stuck_stuck : core.

Lemma wp_lift_head_step_fupd_couple {E Φ} e1 s :
to_val e1 = None →
(∀ σ1 ε1,
state_interp σ1 ∗ err_interp ε1
(∀ n σ1 ε1,
state_interp n σ1 ∗ err_interp ε1
={E,∅}=∗
⌜head_reducible e1 σ1⌝ ∗
glm e1 σ1 ε1 (λ '(e2, σ2) ε2,
▷ |={∅,E}=> state_interp σ2 ∗ err_interp ε2 ∗ WP e2 @ s; E {{ Φ }}))
▷ |={∅,E}=> state_interp (S n) σ2 ∗ err_interp ε2 ∗ WP e2 @ s; E {{ Φ }}))
⊢ WP e1 @ s; E {{ Φ }}.
Proof.
iIntros (?) "H". iApply wp_lift_step_fupd_glm; [done|].
iIntros (σ1 ε) "Hσε".
iIntros (n σ1 ε) "Hσε".
iMod ("H" with "Hσε") as "[% H]"; iModIntro; auto.
Qed.

Lemma wp_lift_head_step {E Φ} e1 s :
to_val e1 = None →
(∀ σ1, state_interp σ1 ={E,∅}=∗
(∀ n σ1, state_interp n σ1 ={E,∅}=∗
⌜head_reducible e1 σ1⌝ ∗
▷ ∀ e2 σ2, ⌜head_step e1 σ1 (e2, σ2) > 0⌝ ={∅,E}=∗
state_interp σ2 ∗ WP e2 @ s; E {{ Φ }})
state_interp (S n) σ2 ∗ WP e2 @ s; E {{ Φ }})
⊢ WP e1 @ s; E {{ Φ }}.
Proof.
iIntros (?) "H". iApply wp_lift_step_fupd; [done|]. iIntros (?) "Hσ".
iIntros (?) "H". iApply wp_lift_step_fupd; [done|]. iIntros (??) "Hσ".
iMod ("H" with "Hσ") as "[% H]"; iModIntro.
iSplit.
{ iPureIntro. by eapply head_prim_reducible. }
iIntros (???) "!> !>". iApply "H"; auto.
Qed.

Lemma wp_lift_head_step' {E Φ} e1 s :
to_val e1 = None →
(∀ n σ1, state_interp (S n) σ1 ={E,∅}=∗
⌜head_reducible e1 σ1⌝ ∗
▷ ∀ e2 σ2, ⌜head_step e1 σ1 (e2, σ2) > 0⌝ ={∅,E}=∗
state_interp (S n) σ2 ∗ WP e2 @ s; E {{ Φ }})
⊢ WP e1 @ s; E {{ Φ }}.
Proof.
iIntros (?) "H". iApply wp_lift_step_fupd; [done|]. iIntros (??) "Hσ".
iMod (fupd_mask_subseteq ∅) as "Hclose".
{ set_solver+. }
iMod (state_interp_mono with "Hσ") as "Hσ".
iMod "Hclose".
iMod ("H" with "Hσ") as "[% H]"; iModIntro.
iSplit.
{ iPureIntro. by eapply head_prim_reducible. }
Expand All @@ -47,15 +66,15 @@ Qed.

Lemma wp_lift_atomic_head_step_fupd {E1 E2 Φ} e1 s :
to_val e1 = None →
(∀ σ1, state_interp σ1 ={E1}=∗
(∀ n σ1, state_interp n σ1 ={E1}=∗
⌜head_reducible e1 σ1⌝ ∗
∀ e2 σ2, ⌜head_step e1 σ1 (e2, σ2) > 0⌝ ={E1}[E2]▷=∗
state_interp σ2 ∗
state_interp (S n) σ2 ∗
from_option Φ False (to_val e2))
⊢ WP e1 @ s; E1 {{ Φ }}.
Proof.
iIntros (?) "H". iApply wp_lift_atomic_step_fupd; [done|].
iIntros (σ1) "Hσ1". iMod ("H" with "Hσ1") as "[% H]"; iModIntro.
iIntros (n σ1) "Hσ1". iMod ("H" with "Hσ1") as "[% H]"; iModIntro.
iSplit.
{ iPureIntro. by apply head_prim_reducible. }
iIntros (e2 σ2 Hstep).
Expand All @@ -64,15 +83,37 @@ Qed.

Lemma wp_lift_atomic_head_step {E Φ} e1 s :
to_val e1 = None →
(∀ σ1, state_interp σ1 ={E}=∗
(∀ n σ1, state_interp n σ1 ={E}=∗
⌜head_reducible e1 σ1⌝ ∗
▷ ∀ e2 σ2, ⌜head_step e1 σ1 (e2, σ2) > 0⌝ ={E}=∗
state_interp (S n) σ2 ∗
from_option Φ False (to_val e2))
⊢ WP e1 @ s; E {{ Φ }}.
Proof.
iIntros (?) "H". iApply wp_lift_atomic_step; eauto.
iIntros (n σ1) "Hσ1". iMod ("H" with "Hσ1") as "[% H]"; iModIntro.
iSplit.
{ iPureIntro. by apply head_prim_reducible. }
iNext. iIntros (e2 σ2 Hstep).
iApply "H"; eauto.
Qed.

Lemma wp_lift_atomic_head_step' {E Φ} e1 s :
to_val e1 = None →
(∀ n σ1, state_interp (S n) σ1 ={E}=∗
⌜head_reducible e1 σ1⌝ ∗
▷ ∀ e2 σ2, ⌜head_step e1 σ1 (e2, σ2) > 0⌝ ={E}=∗
state_interp σ2 ∗
state_interp (S n) σ2 ∗
from_option Φ False (to_val e2))
⊢ WP e1 @ s; E {{ Φ }}.
Proof.
iIntros (?) "H". iApply wp_lift_atomic_step; eauto.
iIntros (σ1) "Hσ1". iMod ("H" with "Hσ1") as "[% H]"; iModIntro.
iIntros (n σ1) "Hσ1".
iMod (fupd_mask_subseteq ∅) as "Hclose".
{ set_solver+. }
iMod (state_interp_mono with "Hσ1") as "Hσ1".
iMod "Hclose".
iMod ("H" with "Hσ1") as "[% H]"; iModIntro.
iSplit.
{ iPureIntro. by apply head_prim_reducible. }
iNext. iIntros (e2 σ2 Hstep).
Expand Down
Loading