rocq/theories/CallbackLogic.v
Exact-state adequacy for retained void callbacks. The return postcondition observes the actual local teardown memory and CURRENT world, before ReturnCallback changes only the shutdown phase.
Callback proofs over any runtime, independently of libc's representation.
Short local spelling of Linked's unchanged callback world type.
Linked and Language instantiate generative machine types separately; this changes only their constructor names, never their snapshots.
Local transport for promotion: the two runtime instances admit the same external effects, with the same intermediate memories.
Explore proof 5 tactics
Initial goal
intros H
induction H
3 openfocused goal
focused goal
–constructor
2 opendeferred goal
deferred goal
–eapply M.E.effects_local ; eauto
deferred goal
–eapply M.E.effects_alloc ; eauto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Local transport for promotion: invocations keep their exact arguments, observations, runtime, memory and world across the module boundary.
Explore proof 7 tactics
Initial goal
intros H
destruct H as trace ending s′ m′ w′ born Habi Hpre He Hp Hpost Hresource Hshape Hexit | why trace s′ m′ w′ born Habi Hpre He Hp Hfailure Hresource
2 openfocused goal
–eapply M.E.invoke_normal ; eauto
2 opendeferred goal
split ; eapply linked_effects ; exact He | exact Hp
deferred goal
–eapply M.E.invoke_resource ; eauto
3 openfocused goal
shelved goal
+split ; eapply linked_effects ; exact He | exact Hp
deferred goal
+destruct Hfailure ; eapply M.E.failure_oom | eapply M.E.failure_big ; eauto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Local transport for promotion: a labelled step is unchanged except for the generative state constructors.
Explore proof 13 tactics
Initial goal
intros H
destruct H ; cbn [ logic_state ]
9 openfocused goal
focused goal
focused goal
focused goal
focused goal
focused goal
focused goal
focused goal
–apply M.step_core
9 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
destruct H ; eapply M.P.I.RM.mstep_next | eapply M.P.I.RM.mstep_alloc | eapply M.P.I.RM.mstep_safepoint ; eauto
8 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–eapply M.step_core_end ; eauto
7 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–eapply M.step_core_stuck ; eauto
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–eapply M.step_core_refusal ; eauto
5 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–eapply M.step_return ; eauto using linked_invoke
4 opendeferred goal
deferred goal
deferred goal
deferred goal
–eapply M.step_exit ; eauto using linked_invoke
3 opendeferred goal
deferred goal
deferred goal
–eapply M.step_resource ; eauto using linked_invoke
2 opendeferred goal
deferred goal
–eapply M.step_rejected ; eauto
2 opendeferred goal
destruct H0 ; eapply M.reject_missing | eapply M.reject_arguments | eapply M.reject_abi | eapply M.reject_pre ; eauto
deferred goal
–eapply M.step_bad_return ; eauto using linked_invoke
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Local transport for promotion: every Linked run has the identical Language run, including its full trace and endpoint snapshots.
Explore proof 3 tactics
Initial goal
intros H
induction H ; constructor |
econstructor ; eapply linked_step ; eauto | exact IHrun
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Local rule for promotion: unlike outcome-only heap_labelled_safe, this keeps the final state interpretation together with the WP post. The existential heap in heap_interp is the one surviving execution.
Proof 32 steps Qed
Local rule for promotion: any nonempty run has a final step and its actual prefix; this introduces no execution or termination premise.
Explore proof 10 tactics
Initial goal
intros Hrun
induction Hrun as st | st tr mid tail last Hstep Hrun IH
2 open–left
2 openreflexivity
–right
destruct IH as [ ->| ( prefix & before & ending & Hp & Hs ) ]
2 openfocused goal
+exists [ ], st, tr
2 opendeferred goal
split ; constructor | exact Hstep
deferred goal
+exists tr ++ prefix, before, ending
split ; econstructor ; eauto | exact Hs
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Local rule for promotion: a stopped top-level void return reaches exactly the Iris state whose memory invalidate_locals produced.
Explore proof 16 tactics
Initial goal
intros Had Hrun Hreturn
destruct LK.callback_return_endpointpayload _ _ _ _ Hreturn as c & sr & wr & mr & → & Hcs & Hi & Hms & Hw & Hshutdown
exists c, sr, wr, mr
repeat split ; try assumption ; try reflexivity
apply linked_run in Hrun
cbn [ logic_state ] in Hrun
destruct run_last_ _ _ _ _ Hrun as Heq | prefix & mid & tail & Hp & Hs ; discriminate Heq |
inversion Hs ; subst
match goal withE : Semantics.stepge c = DoneRetVoid |- _⇒pose proof E as Hendend
destruct adequate_labelledregistry ge fr m s fuel w Q Had _ _ Hp as Hreach _
pose proof Hreachc sr wr eq_refl as Hiris
destruct c as cf cs cm cfuel
cbn in Hcs
subst cs
eapply rtc_r ; exact Hiris |
exact head_erasedregistry ge [ ] _ _ _ _ hs_returnregistry ge cf cm sr cfuel wr RetVoid mr Hend I Hi
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Failure freedom is independent of a normal return: outcome-only heap_labelled_safe also covers callbacks that exit or never return.
Explore proof 5 tactics
Initial goal
intros Hr Hd Ha Hw Hwp fuel trace why ms′ w′ Hrun
pose proof heap_labelled_safeΣ registry wi ge fr m s w h0 λ_ ⇒ True Hr Hd Ha Hw Hwp fuel as Hsafe
apply linked_run in Hrun
cbn [ logic_state ] in Hrun
exact proj1Hsafe_ _ _ _ Hrun
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A handler's WP yields its pure postcondition at Linked's actual return memory and current world. No old payload, registry or status is restored, and no return is required of nonreturning executions.
Explore proof 16 tactics
Initial goal
intros Hr Hd Ha Hw Hwp fuel trace stopped entry ms′ w′ Hrun Hreturn
assert Had : @adequatenanofil_langregistry ge NotStuck ERunfr mkLstatem s fuel w λo σ ⇒ o = RetVoid → Qls_memσ ls_worldσ
2 openfocused goal
{eapply heap_exact_adequacyΣ registry wi ge fr m s w h0 fuel ; exact Hr | exact Hd | exact Ha | exact Hw |
2 opendeferred goal
intros HinvG HheapG
2 opendeferred goal
destruct HwpHinvG HheapG as Ψ & Hbody & Hpost
2 opendeferred goal
exists Ψ
2 opendeferred goal
split ; exact Hbody |
2 opendeferred goal
intros o σ
2 opendeferred goal
iIntros H
2 opendeferred goal
iIntros →
2 opendeferred goal
iApply Hpost
2 opendeferred goal
iExact H
deferred goal
destruct callback_return_reachable_ _ _ _ _ _ _ _ _ _ _ _ _ Had Hrun Hreturn as c & sr & wr & mr & Hst & Hcs & Hi & Hms & Hworld & Hshutdown & Hreach
exists c, sr, wr, mr
repeat split ; try assumption
exact adequate_result_ _ _ _ Had [ ] _ _ Hreach eq_refl
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
CallbackLogicOn over a Logic instance of its own.