rocq/theories/Renew.v
Campaign 3's reuse forms, part two: renew, renew over a hull and half check (formal.md, Campaign 3; rocq.md, Renew and the half check).
All three reuse a check that passed earlier. A renew of a pointer P trusts Q1, the proof of a single-definition check of a pointer P1 (a renew source, renew_source_op/6), whose span covers P's at the distance pointer_distance/4 finds. A half check of P trusts the same kind of source for the bound it does not test (half_known/6). A renew over a hull trusts two sources, QL and QH, whose spans bound P's from below and above (hull_renewable/8). The interpreter makes the run unchecked where that trust was false: Q1 of another capability (unchecked(alias)), a renew whose access test fails but not because the object was freed (unchecked(span)), or a half check whose one-sided native test disagrees with the whole check (unchecked(half)). This file proves none of them happens where the pass accepted the instruction.
The argument is the same for all three. Q1 is an operand of the instruction, so its single definition dominates it and replays (Single.v): Q1 holds the pointer P1 held when its check passed, and memory persists from then, so the object is as it was or freed. P is a known distance from P1, so it has P1's capability (Chain.v). What is left is arithmetic over cap_access_res/7.
Decisions
| Decision | Why |
|---|---|
| the source's rights are not used | a renew asks its own rights; on a read-only object a write traps readonly, which renew_res/4 keeps as the program's trap |
the persisting object is split by cases, not read through persists_access | a renew's trap must be on a freed object, which persists_access's conclusion forgets |
the source's memory fit the address space (Single.v's replays) | once the object is freed, the current memory no longer says where it ended, and a lower half check's address may wrap |
objects start at or above 0 and freed objects are empty (objects_fit, freed_bounds) | a lower half check reads its address signed and fails on any freed object; the whole check agrees only then |
| a renew over a hull compares its two sources only through the current memory | each source's check passed in its own memory, and both persist into the current one, so the object is as both saw it or freed since |
| an instruction of another class or arity is not the pass's concern | it does not step (reuse_shape) |
Renew sources
A renew source n1 that the pass records for a function f of a module md, of a pointer p1 over the span from lo1 up to hi1 at alignment al1, is the check-like instruction i that is n1's single definition, and p1 is a single-definition name too (stage_sources/4). check_fact reads the span i checks.
Proof 28 steps Qed
Each of the five source ops (check, check_ahead, renew_if, check_limit, half_check) has the fact its source records, so it is enough that the source instruction is n1's single definition.
Every instruction i of a block b of a function f of a checked_module md passes the validator's per-instruction test valid_inst/3 at some list of classes cls.
Explore proof 16 tactics
Initial goal
unfold checked_module , valid
intros md f b i Hv _ Hin Hb Hi
destruct existsb_ md ; discriminate Hv |
injection Hv as Hv
unfold valid_items in Hv
apply andb_true_iff in Hv as _ Hv
rewrite forallb_forall in Hv
specialize Hv_ Hin
simpl in Hv
unfold valid_func in Hv
destruct fn_blocksf as | b0 bs eqn: Eb ; destruct Hb |
destruct block_intervalsb0 :: bs ; | discriminate Hv
repeat match goal withH : _ && _ = true |- _⇒apply andb_true_iff in H as ? ?end
match goal withH : forallbvalid_blockmd f _ _ = true |- _⇒rewrite forallb_forall in H ; specialize Hb Hb ; unfold valid_block in Hend
repeat match goal withH : _ && _ = true |- _⇒apply andb_true_iff in H as ? ?end
match goal withH : forallbvalid_instmd _ b_instsb = true |- _⇒rewrite forallb_forall in H ; exact ex_intro_ _ Hi Hiend
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A check-like instruction i of a checked_module md, whose fact fa check_fact reads, checks a nonempty span at one of the alignments valid_op/1 allows (check_align).
Explore proof 5 tactics
Initial goal
intros md f b i fa Hmd Hin Hb Hi Hf
destruct inst_valid_ _ _ _ Hmd Hin Hb Hi as cls Hvi
destruct i as q k o args | | | | | | | | ; try discriminate Hf
destruct k ; try destruct o ; discriminate Hf
destruct o ; try discriminate Hf ; cbn - [ valid_op ] in Hf ; cases Hf ; injection Hf as ← ; unfold valid_inst in Hvi ; simpl in Hvi ; unfold check_ok in Hvi;repeat match goal withH : _ && _ = true |- _⇒apply andb_true_iff in H as ? ?end;repeat match goal withH : _ <? _ = true |- _⇒apply Z.ltb_lt in Hend;simpl;split ; lia | assumption
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Renew, over memory
The arithmetic of a renew. Where the span of capability c from A+lo1 up to A+hi1 passed its check in a memory m1, a renew through a pointer p of c of the part from A+off up to A+off+size, at an alignment al that divides the source's al1, in a memory m that persists from m1 and lies in the address space, passes, traps read-only, or traps out of bounds on a freed object (renew_res/4); never unchecked.
Proof 44 steps Qed
the object as it was
freed: the access traps out of bounds, on a freed object
read-only, as it was: a read passes, a write traps read-only
read-only, freed: as an object freed
Renew over a hull, over memory
The address of a renew over a hull. The renewed pointer's address A is Al+dl and Ah+dh modulo 2^64, where Al and Ah are the addresses of the low and high sources. The renew starts E past the low source's span and ends F before the high source's, both near (between 0 and 2^62). Then A+lo is both sums exactly, not merely modulo 2^64: both spans lie in the address space (at or below 2^48), so neither sum wraps.
Explore proof 15 tactics
Initial goal
intros Al Ah A lol loh hih dl dh lo hi HAl HAh Hl Hh Hs He Hf Hsz
assert Hmod : ∀B d o o′, A mod 2 ^ 64 = B + d mod 2 ^ 64 → raw_addressA o = raw_addressB o′ + o + d − o′ mod 2 ^ 64
2 openfocused goal
{intros B d o o′ HB
2 opendeferred goal
unfold raw_address
2 opendeferred goal
rewrite <- Z.add_mod_idemp_lA o 2 ^ 64 , HB , ! Z.add_mod_idemp_l by lia
2 opendeferred goal
f_equal
2 opendeferred goal
ring
deferred goal
pose proof HmodAl dl lo lol HAl as Xl
pose proof HmodAh dh lo loh HAh as Xh
pose proof Z.mod_pos_boundAl + lol 2 ^ 64 ltac:lia
pose proof Z.mod_pos_boundAh + loh 2 ^ 64 ltac:lia
unfold raw_address in *
rewrite Z.mod_smallAl + lol mod 2 ^ 64 + lo + dl − lol in Xl by lia
pose proof Z.div_modAh + loh mod 2 ^ 64 + lo + dh − loh 2 ^ 64 ltac:lia
split ; exact Xl | lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A renew through a pointer p whose object, at base, is freed in the memory m traps out of bounds on a freed object (renew_res/4); never unchecked.
Explore proof 6 tactics
Initial goal
intros m base reg A off size r al p E Hrb Hs Hc
exists RTrapOutOfBounds, RTrapOutOfBounds
unfold access_res , cap_access_res , renew_res
destruct Hc as Hc | Hc ; rewrite Hc , E ; simpl ; rewrite Hrb
2 openfocused goal
all: replace base ≤? raw_addressA off && raw_addressA off + size ≤? base with false by symmetry ; apply andb_false_iff ; destruct Z.le_gt_casesbase raw_addressA off ; right ; apply Z.leb_gt ; lia | left ; apply Z.leb_gt ; lia
2 openfocused goal
all: split ; reflexivity | split ; reflexivity | discriminate
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
The arithmetic of a renew over a hull, as renew_access is a renew's. Where a low span from Al+lol up to Al+hil and a high span from Ah+loh up to Ah+hih, of one capability c, passed their checks in memories ml and mh that the current memory m persists from, a renew from A+lo up to A+hi between them (hull_renewable/8's arithmetic), aligned as one of them is, passes, traps read-only, or finds the object freed; never unchecked. Both sources meet only in m: the object is as both saw it, or freed since.
Proof 26 steps Qed
The object is as both checks saw it, or freed since.
as the low check saw it but freed since the high one: empty, so the low check could not have passed
both as they were: one object, which holds the hull
aligned as the source it is aligned to
The half check, over memory
A half check's address A+lo is its source span's start A1+lo1 plus e = D + lo - lo1, modulo 2^64, where D is the distance d0 between A and A1 that half_known/6 reads as a signed 64-bit number.
Explore proof 8 tactics
Initial goal
intros A A1 d0 lo lo1 HA
unfold raw_address
rewrite Z.add_mod_idemp_l by lia
assert E : d0 + 2 ^ 63 mod 2 ^ 64 − 2 ^ 63 = d0 + −d0 + 2 ^ 63 / 2 ^ 64 × 2 ^ 64 by rewrite Z.mod_eq by lia ; lia
rewrite E
replace A1 + lo1 + d0 + −d0 + 2 ^ 63 / 2 ^ 64 × 2 ^ 64 + lo − lo1 with A1 + d0 + lo + −d0 + 2 ^ 63 / 2 ^ 64 × 2 ^ 64 by ring
rewrite Z_mod_plus_full , <- Z.add_mod_idemp_lA1 + d0 , <- HA , Z.add_mod_idemp_l by lia
reflexivity
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
The bound bd that a half check tests natively (half_bound/6) says what both bounds of the whole check say. The access is at address b, e past the start of a span from U up to U+span that passed earlier, and that span proves the other bound (f is how far the access ends before the span does). The object, from base, ends at end1 as it was, empty if freed, or is freed since. The span lies in the address space, so the address wraps only where a lower check, read signed, falls below 0, which fails both tests.
Explore proof 22 tactics
Initial goal
intros bd base U span end1 e f size b end′ life′ Hb Hend Hspan Hsize Hf He Hef Haddr Hbd Hobj
destruct bd ; unfold half_bound
2 openfocused goal
–replace b with U + e in * by rewrite Haddr ; apply Z.mod_unique_ _ 0 ; lia
2 opendeferred goal
replace base ≤? U + e with true by symmetry ; apply Z.leb_le ; lia
2 opendeferred goal
reflexivity
deferred goal
–destruct Hobj as → & Hlife | → & →
2 openfocused goal
+destruct life′ ; | specialize Hlifeeq_refl ; lia
2 opendeferred goal
destruct Z.le_gt_cases0 U + e as Hw | Hw
3 openfocused goal
deferred goal
∗replace b with U + e in * by rewrite Haddr ; apply Z.mod_unique_ _ 0 ; lia
3 opendeferred goal
deferred goal
replace 2 ^ 63 ≤? U + e with false by symmetry ; apply Z.leb_gt ; lia
3 opendeferred goal
deferred goal
replace U + e + size ≤? end1 with true by symmetry ; apply Z.leb_le ; lia
3 opendeferred goal
deferred goal
rewrite andb_true_r
3 opendeferred goal
deferred goal
reflexivity
2 opendeferred goal
deferred goal
∗replace b with U + e + 2 ^ 64 in * by rewrite Haddr ; apply Z.mod_unique_ _ −1 ; lia
2 opendeferred goal
replace 2 ^ 63 ≤? U + e + 2 ^ 64 with true by symmetry ; apply Z.leb_le ; lia
2 opendeferred goal
replace base ≤? U + e + 2 ^ 64 − 2 ^ 64 with false by symmetry ; apply Z.leb_gt ; lia
2 opendeferred goal
replace U + e + 2 ^ 64 + size ≤? end1 with false by symmetry ; apply Z.leb_gt ; lia
2 opendeferred goal
rewrite andb_false_r
2 opendeferred goal
reflexivity
deferred goal
+symmetry
apply andb_false_iff
destruct Z.le_gt_casesbase b ; right ; apply Z.leb_gt ; lia | left ; apply Z.leb_gt ; lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
upper: the address does not wrap, so it lies at or above the base
lower, the object as it was: live, since a freed object is empty
wrapped: read signed it is below 0, and no object reaches it
lower, freed since: both fail
Where the native test agrees with the whole check's bounds, the half check's result is the check's: half_res/4 is never unchecked.
Explore proof 3 tactics
Initial goal
intros inb ro r a al p why
unfold readonly_access_res , aligned_res
destruct inb , ro , r , a mod al =? 0 ; simpl ; discriminate
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Where the span of capability c from A1+lo1 up to A1+hi1 passed its check in a memory m1 that lay in the address space, a half check at address A, d0 past A1, whose known bound that span proves (half_known/6), in a memory m that persists from m1 and whose freed objects are empty, tests natively what the whole check tests: its result is never unchecked.
Proof 30 steps Qed
The object is as it was, or freed since; either way the native test's bound says what the check's bounds say.
an object, as it was: empty if freed
an object, freed since
a read-only object, as it was
a read-only object, freed since
What a reuse form reads at its point
An element el of a guard chain (guard_chain/3) is its start p itself, or p is a name whose single definition is a flight with a lower donor. distance_pointer uses it to show the chain starts at something that holds a pointer.
Explore proof 10 tactics
Initial goal
intros once fuel p lo hi el H
destruct fuel as | fuel ; simpl in H
2 openfocused goal
–destruct H as E |
2 opendeferred goal
left
2 opendeferred goal
auto
deferred goal
–destruct H as E | H ; left ; auto | right
destruct p as y | c | g ; | simpl in H ; contradiction | simpl in H ; contradiction
destruct lookupy once as | ph | i | eqn: Ey ; try simpl in H ; contradiction
destruct i as | d o args lw | | | | | | | ; try simpl in H ; contradiction
destruct lw ; simpl in H ; contradiction | eauto 8
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A flight d that steps and continues binds d to a pointer.
Explore proof 6 tactics
Initial goal
intros ge fr m d o args lw e1 l1 m1 H
simpl in H
cases H
injection H as ← _ _
rewrite lookup_put_same
eauto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A check-like instruction (one check_fact reads) is replayable: Single.v's invariant covers it.
Explore proof 4 tactics
Initial goal
intros i fa H
destruct i as q k o args | | | | | | | | ; try discriminate H
destruct o ; try reflexivity
destruct k ; discriminate H
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A check-like instruction also has an access fact, the range its own access checks (access_fact).
Explore proof 7 tactics
Initial goal
intros i fa H
destruct i as q k o args | | | | | | | | ; try discriminate H
destruct k ; try eexists ; exact H
destruct o ; try eexists ; exact H
destruct args as | a | a2 args ; try eexists ; exact H
eexists
2 openshelved goal
reflexivity
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Lemmas for a frame fr of a checked_module md, in memory m, at index k of a reachable block l, where every single definition in scope but a check_ahead replays (scope_plain). A doomed frame keeps that much, so Doomed.v uses these too.
A value p a known distance d from a value p1 that holds a pointer (pointer_distance/4) holds a pointer too, where the single definitions of both dominate the point. p's guard chain starts at a single definition: the exact base itself, which p1's chain reads, or a flight, which binds a pointer (chain_go_head).
Proof 27 steps Qed
the exact base is p itself, which p1's chain reads
p is a flight, which binds a pointer
Lemmas for a frame fr as in Plain, but where every replayable single definition in scope replays (scope_holds), check_ahead included, since a renew's source may be one.
A single-definition operand y of the instruction i at the frame's point, index kk of block b, has a site that dominates the point: the validator requires an operand's definition to dominate its use (definitions_dominate/3).
Explore proof 10 tactics
Initial goal
intros b kk i y Hb Hk → Hu Ho
destruct func_facts_ _ Hmd Hin as b0 & rest & _ & _ & _ & Hdd
destruct find_block_in_ _ _ Hb as Hbin Hl
unfold once_has in Ho
destruct lookupy single_definitionsfr_fnfr as D | eqn: Ey ; | discriminate Ho
rewrite <- Hl in Hr
destruct use_dominated_ _ _ _ _ _ _ Hdd Hbin Hr Hk Hu Ey as s & Hpos & Hsd
exists s, D
rewrite <- Hl
auto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A renew source n1 of the pointer p1 that dominates the point holds the pointer pp that p1 holds, and the check n1 made of pp passed (check_passes) in a memory m1 that lay in the address space and that the current memory persists from. p1 dominates the point too, and the checked span is nonempty.
Explore proof 21 tactics
Initial goal
intros n1 p1 lo1 hi1 al1 Hsrc Hdom
destruct renew_source_def_ _ _ _ _ _ _ Hsrc as i1 & r1 & Hn1 & Hcf & Hop1
destruct dominating_replays_ _ _ _ _ _ _ Hs Hpt Hn1 check_fact_replayable_ _ Hcf Hdom as fr0 & m0 & e1 & l1 & m1 & Hst & He1 & Hops & Hp & Hfit
destruct access_fact_some_ _ Hcf as fb Hfb
destruct check_like_continue_ _ _ _ _ _ _ _ _ Hcf Hfb Hst as → & _ & _ & pp & → & Hx & Hc & _
cbn [ f_q f_p f_lo f_hi f_r f_al ] in Hx , Hc , He1
assert Hu1 : Inp1 inst_usesi1 by exact check_fact_uses_ _ _ Hcf eq_refl
exists pp, m0, r1
split ; rewrite <- He1 ; apply lookup_put_same |
split ; rewrite <- Hx ; symmetry ; apply value_x_agree ; intros y E ; injection E as ← ; exact Hops_ Hu1 Hop1 |
split ; exact Hc |
split ; exact Hp |
split ; exact Hfit |
split
2 openfocused goal
–destruct Hdom as s & D & Hn & Hpos & _
2 opendeferred goal
rewrite Hn1 in Hn
2 opendeferred goal
injection Hn as ←
2 opendeferred goal
destruct dinst_site_ _ _ _ Hpos as d & j & →
2 opendeferred goal
destruct position_inst_ _ _ _ _ Hpos as b1 & kk1 & Hb1 & _ & Hk1 & _ & _
2 opendeferred goal
exact proj1check_fact_ok_ _ _ _ _ Hmd Hin Hb1 nth_error_In_ _ Hk1 Hcf
deferred goal
–exact operand_dominating_ _ _ _ _ _ _ Hmd Hin Hr Hn1 Hdom Hu1 Hop1
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
What a renew or half check i the pass accepted reads at the frame's point, index kk of block b. Q1, the name n1, holds the pointer PP1 of a renew source's check that passed in m1, a memory in the address space that the current one persists from; the renewed value p holds a pointer PP of PP1's capability, d past it modulo 2^64 (renew_source_holds, pointer_distance_sound).
Explore proof 15 tactics
Initial goal
intros b kk i n1 p p1 lo1 hi1 al1 d Hb Hk Hkk Hu1 Hu Esrc Ed
destruct fn_src_casesmd fr_fnfr as _ Esj | _ Esj
2 openfocused goal
{rewrite Esj in Esrc
2 opendeferred goal
discriminate Esrc
deferred goal
rewrite Esj in Ed
cbn [ s_once ] in Ed
destruct renew_source_def_ _ _ _ _ _ _ Esrc as i1 & _ & En1 & _
assert Hdn1 : dominatingfr_fnfr l k n1 by apply operand_atb kk i n1 Hb Hk Hkk Hu1 ; unfold once_has ; rewrite En1 ; reflexivity
destruct renew_source_holdsn1 p1 lo1 hi1 al1 Esrc Hdn1 as pp1 & m1 & r1 & Hn1 & Hp1 & Hc1 & Hp & Hfit1 & Hl1 & Hdp1
assert Hdp : ∀y, p = Tmpy → once_hassingle_definitionsfr_fnfr y = true → dominatingfr_fnfr l k y by intros y E Ho ; exact operand_atb kk i y Hb Hk Hkk Huy E Ho
assert Hdq : ∀y, Tmpp1 = Tmpy → once_hassingle_definitionsfr_fnfr y = true → dominatingfr_fnfr l k y by intros y E _ ; injection E as ← ; exact Hdp1
destruct distance_pointerge md fr m l k Hmd Hin Hr scope_plain_of_ _ _ Hs Hpt p Tmpp1 pp1 d Hp1 Hdp Hdq Ed as pp Hpp
destruct pointer_distance_soundge md fr m l k Hmd Hin Hr scope_plain_of_ _ _ Hs Hpt p Tmpp1 pp pp1 d Hpp Hp1 Hdp Hdq Ed as Hcap Haddr
exists pp1, pp, m1, r1
auto 10
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A function with a setjmp has no renew sources.
check_align/1 allows only positive alignments.
Explore proof 5 tactics
Initial goal
unfold check_align
intros al H
simpl in H
repeat apply orb_true_iff in H as H | H ; apply Z.eqb_eq in H ; lia |
discriminate H
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Every capability equals itself by cap_eqb.
Explore proof 1 tactics
Initial goal
intros ; simpl ; try apply Z.eqb_refl ; try apply name_eqb_refl ; reflexivity
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A renew of the value p from source n1, the instruction at index kk of block b, that the pass accepts (checked_inst_rest, checked_inst_rest/7) does not step to unchecked, in a memory in the address space. Its source holds the pointer whose check passed and the renewed pointer has its capability (reuse_operands), so there is no alias; and its span lies inside the source's (renew_access).
Proof 36 steps Qed
What the pass checked: a source, a distance, and the span inside.
What the operands hold at the point.
The step: one capability, so no alias; then the memory's answer.
A half check of the value p from source n1, the instruction at index kk of block b, that the pass accepts (checked_inst_rest) does not step to unchecked, in a memory in the address space whose freed objects are empty. The bound it does not test is proved by the source's span, which passed (half_access).
Explore proof 28 tactics
Initial goal
intros b kk q bd lo hi r al n1 p rest live out why Hfit Hfe Hb Hk Hkk H
unfold checked_inst_rest in H
cbn beta iota zeta in H
destruct lookupn1 s_renewsfn_srcmd fr_fnfr as p1 lo1 hi1 al1 | eqn: Esrc ; | discriminate H
destruct pointer_distances_oncefn_srcmd fr_fnfr p Tmpp1 as d | eqn: Ed ; | discriminate H
destruct half_knownbd lo hi d lo1 hi1 eqn: Ek ; clear H | discriminate H
destruct reuse_operandsb kk _ n1 p p1 lo1 hi1 al1 d Hb Hk Hkk ltac:simpl ; auto ltac:intros y → ; simpl ; auto Esrc Ed as pp1 & pp & m1 & r1 & Hn1 & Hpp & Hc1 & Hp & Hfit1 & Hl1 & Hcap & Haddr
rewrite inst_step_let by reflexivity
cbn beta iota zeta delta [ op_arg_classes map2_option ]
replace value_xge fr_envfr A Tmpn1 with SomeWPtrpp1 by simpl ; rewrite Hn1 ; reflexivity
rewrite Hpp
cbn beta iota
unfold op_res , op_res_int
cbn beta iota zeta delta [ fmt_of ]
rewrite Hcap , cap_eqb_refl
destruct find_block_in_ _ _ Hb as Hbin _
destruct check_fact_ok_ _ _ _ _ Hmd Hin Hbin nth_error_In_ _ Hk eq_refl as Hsz _
simpl in Hsz
destruct half_accessm1 m ptr_cappp1 ptr_addrpp1 ptr_addrpp lo1 hi1 r1 al1 tt bd lo hi r al d pp Hc1 Hfit1 Hp Hfe Haddr Hl1 Hsz Ek as chk & passes & Hchk & Hpass & Hnot
rewrite Hchk
cbn beta iota
rewrite Hpass
cbn beta iota
unfold bind_res
destruct half_reschk passes WPtrpp as x | w | w eqn: Eh ; try discriminate
intros E
injection E as ←
exact Hnotw eq_refl
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
What the pass checked: a source, a distance, and the known bound.
What the operands hold at the point.
The step: one capability, so no alias; then the memory's answer.
A renew over a hull of the value p with low source nl and high source nh, the instruction at index kk of block b, that the pass accepts (checked_inst_rest) does not step to unchecked, in a memory in the address space. Each source holds the pointer its check passed, a known distance from the renewed pointer (reuse_operands), so all three share a capability, and the renewed span lies between the two spans (hull_renewable/8, hull_renew_access).
Proof 42 steps Qed
What the pass checked: two sources, two distances, and the span between them.
What the operands hold at the point.
The step: one capability, so no alias; then the memory's answer.
Along every run
The instructions this file covers: a let of a renew, a renew over a hull or a half check, of any class and operands. None is a raw access.
A list of operands that map2_option pairs with two classes has two elements.
Explore proof 5 tactics
Initial goal
intros X Y Z f x y args zs H
destruct args as | a1 | a2 | a3 args ; simpl in H ; try discriminate H
3 openfocused goal
focused goal
–destruct fx a1 ; discriminate H
2 opendeferred goal
deferred goal
–eauto
deferred goal
–destruct fx a1 , fy a2 ; discriminate H
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A list of operands that map2_option pairs with three classes has three elements.
Explore proof 2 tactics
Initial goal
intros X Y Z f x y w args zs H
destruct args as | a1 | a2 | a3 | a4 args ; simpl in H;repeat match goal withH : context [match f with _ ⇒ _ end] |- _⇒destruct fu vend;try discriminate H;eauto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A reuse_form that steps to unchecked is of the proof class A, with two operands for a renew or half check and three for a renew over a hull (op_arg_classes/4, kind_res/8); of any other shape it does not step. So the run theorem covers every such instruction with the frame lemmas, which take only that shape.
Explore proof 7 tactics
Initial goal
intros ge fr m i why q & kc & lo & hi & r & al & args & → | q & kc & lo & hi & r & al & args & → | q & kc & bd & lo & hi & r & al & args & → H ; rewrite inst_step_let in H by reflexivity ; cbn beta iota zeta delta [ op_arg_classes ] in H ; destruct map2_option_ _ args as xs | eqn: Ex ; try discriminate H
3 openfocused goal
focused goal
–destruct map2_option_two_ _ _ _ _ _ _ _ Ex as a1 & a2 & →
3 opendeferred goal
deferred goal
destruct kc ; unfold op_res , op_res_int in H ; cbn beta iota zeta delta [ fmt_of ] in H ; try discriminate H ; do 3 eexists ; split ; reflexivity | left ; eauto 10
2 opendeferred goal
deferred goal
–destruct map2_option_three_ _ _ _ _ _ _ _ _ Ex as a1 & a2 & a3 & →
2 opendeferred goal
destruct kc ; unfold op_res , op_res_int in H ; cbn beta iota zeta delta [ fmt_of ] in H ; try discriminate H ; do 3 eexists ; split ; reflexivity | right ; left ; eauto 10
deferred goal
–destruct map2_option_two_ _ _ _ _ _ _ _ Ex as a1 & a2 & →
destruct kc ; unfold op_res , op_res_int in H ; cbn beta iota zeta delta [ fmt_of ] in H ; try discriminate H ; do 3 eexists ; split ; reflexivity | right ; right ; eauto 10
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
The frame theorems carried along every run of the machine of a runtime R, as Chain.v's Hull does: Persistence.v's invariant says the pass accepted the instruction at the point, Single.v's that single definitions replay there, and the runtime's readiness that memory lies in the address space with freed objects empty.
What holds at the point of a frame that is not doomed, in every state c a run reaches from a call of a function f of a checked_module md started ready, at an instruction i that is not a raw access or raw call: the pass accepted it there (checked_inst_rest, checked_inst_rest/7), single definitions replay (scope_holds), and memory lies in the address space with freed objects empty. Guard.v's run theorem uses it too.
Proof 33 steps Qed
The pass accepted the instruction at the point.
only a raw access, a touch or a raw call follows a check as its access
Single definitions replay there.
Memory lies in the address space, freed objects empty.
In every state a run reaches from a call of a function f of a checked_module md, started in a memory where the runtime is ready, a frame that is not doomed runs no renew, renew over a hull or half check to an unchecked outcome. Every runtime spares the pass's facts at safepoints (spares_any; see The evidence invariant over runs).
Explore proof 10 tactics
Initial goal
intros ge md f xs fr m fuel s0 c s l i rest j why Hmd Hge Hfree Hin Hcf H0 Hreach Hd Ha Hi Hst
destruct reuse_shape_ _ _ _ _ Hi Hst as q & o & args & → & Ho
destruct run_point_ _ _ _ _ _ _ _ _ _ _ _ _ _ Hmd Hge Hfree Hin Hcf H0 Hreach Hd Ha ltac:destruct Ho as ? & ? & ? & ? & ? & ? & → & → | ? & ? & ? & ? & ? & ? & ? & → & → | ? & ? & ? & ? & ? & ? & ? & → & → ; reflexivity ltac:intros ? ? ? E ; discriminate E ltac:intros ? E ; discriminate E as b & kk & live & out & Hinf & Hr & Hsc & Hpt & Hb & Hnth & Hc & Hfit & Hfe
destruct Ho as lo & hi & r & al & a1 & a2 & → & → | lo & hi & r & al & a1 & a2 & a3 & → & → | bd & lo & hi & r & al & a1 & a2 & → & →
3 openfocused goal
focused goal
–destruct a1 as n1 | c1 | g1 ; try unfold checked_inst_rest in Hc ; cbn beta iota zeta in Hc ; discriminate Hc
3 opendeferred goal
deferred goal
exact renew_not_uncheckedge md c_framec c_memc l Z.of_natkk Hmd Hinf Hr Hsc Hpt b kk q lo hi r al n1 a2 rest live out why Hfit Hb Hnth eq_refl Hc Hst
2 opendeferred goal
deferred goal
–destruct a1 as nl | c1 | g1 , a2 as nh | c2 | g2 ; try unfold checked_inst_rest , hull_renewable in Hc ; cbn beta iota zeta in Hc ; discriminate Hc
2 opendeferred goal
exact hull_renew_not_uncheckedge md c_framec c_memc l Z.of_natkk Hmd Hinf Hr Hsc Hpt b kk q lo hi r al nl nh a3 rest live out why Hfit Hb Hnth eq_refl Hc Hst
deferred goal
–destruct a1 as n1 | c1 | g1 ; try unfold checked_inst_rest in Hc ; cbn beta iota zeta in Hc ; discriminate Hc
exact half_not_uncheckedge md c_framec c_memc l Z.of_natkk Hmd Hinf Hr Hsc Hpt b kk q bd lo hi r al n1 a2 rest live out why Hfit Hfe Hb Hnth eq_refl Hc Hst
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
The pass accepts a reuse form only where its sources are proofs' names.
The interpreter's runtime
run_reuse_checked for the interpreter's runtime: in every state of a run of a checked module's function that starts ready, a frame that is not doomed runs no renew, renew over a hull or half check to unchecked. No hypothesis remains but the ready start.
Explore proof 2 tactics
Initial goal
intros md globals f xs fr m fuel s0 c s l i rest j why ge Hmd Hin Hcf H0 Hreach Hd Ha Hi
exact InterpReuse.run_reuse_checkedge md f xs fr m fuel s0 c s l i rest j why Hmd eq_refl eq_refl Hin Hcf H0 Hreach Hd Ha Hi
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.