rocq/theories/LibcDiagnosticLogic.v
Returning diagnostics on the consumer's same libc world and machine. Native diagnostic representation stays trusted. The frame below owns no diagnostic pool: it separates future write roots, not all retained sources or future release rights.
Preserve callback inventory, not the whole shutdown record: flushing stdout changes its authoritative protocol. Neither FILE inventory is frozen, and parser compatibility (including sampled errno) is separate.
Keep the native sources, writes, requests and segment interpretation. Readiness at both endpoints includes the independent FILE envelope.
Only this status-zero wrapper is an ordinary returning error symbol. Nonzero diagnostics still belong to the separate ending protocol.
Exact open observations cannot be framed unchanged through acceptance or settlement. Open-only and completed-closed names can.
Transport only what the permitted name constructors actually observe.
Explore proof 11 tactics
Initial goal
intros d w w′ h h′ Hkey Hname Hcurrent Hopen Hclosed
unfold stream_current , diagnostic_name in *
rewrite Hkey
destruct h !! PNametoken_keyd as v | ; | auto
destruct v ; try contradiction
2 openfocused goal
–destruct pending as physical fifo | ; contradiction |
2 opendeferred goal
destruct Hcurrent as → Hlookup Hfifo
2 opendeferred goal
destruct HclosedHlookup as Hlookup′ Hstate
2 opendeferred goal
split ; split ; reflexivity | split ; exact Hlookup′ | rewrite Hstate ; exact Hfifo | exact I
deferred goal
–destruct Hcurrent as → Hlookup
split ; split ; reflexivity | auto | exact I
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
The empty return list comes from the supplied machine's normal branch, never from a resource prefix. The same invocation also supplies the formatting observations and both FILE delegations.
Explore proof 5 tactics
Initial goal
intros rep requests wide native r args xs s m w trace values s′ m′ w′ Hi
split
2 openfocused goal
–inversion Hi ; subst
2 opendeferred goal
match goal withHpost : contract_post_ _ _ _ _ _ _ _ _ |- _⇒apply error_post_void in Hpost ; injection Hpost ; autoend
deferred goal
–eapply M.E.invoke_prefix ; exact Hi
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Sample only the already-owned errno byte keys. Life projection omits neither private bytes nor auxiliary pieces. Future FILE release separation is restored against the FULL heap, including both lives.
Proof 190 steps Qed
Caller-owned diagnostic strings are returned with their old values. Separation is checked against the sampled errno keys, not merely at entry: a diagnostic prefix must not overwrite the new errno bytes.
Proof 29 steps Qed
Logical contract controls, not native FILEs or native diagnostic-pool realization. Both initial stdout states have actual admitted calls.
Explore proof 20 tactics
Initial goal
intros opened
destruct T.changed_readyopened as Hrep & Hlocale & He & _ & _ & Hu & Hstatus & Hphase & Hdistinct & Hroots & Hout & Herr & Hsep
split ; exact Hrep |
split ; exact Hlocale |
split ; exact He |
split
2 openfocused goal
{change stream_wfmkStreamByteOriented [ ] true
2 opendeferred goal
cbn [ stream_wf outstanding orientation ]
2 opendeferred goal
split ; apply Forall_nil | intros _ ; reflexivity
deferred goal
split
2 openfocused goal
{change stream_wfmkStreamByteOriented 67; 10 false
2 opendeferred goal
cbn [ stream_wf outstanding orientation ]
2 opendeferred goal
split ; repeat constructor ; lia | intros _ ; reflexivity
deferred goal
split ; exact Hu |
split ; exact Hstatus |
split ; exact Hphase |
split ; exact Hdistinct |
split ; exact Hroots |
split ; exact Hout |
split ; exact Herr | exact Hsep
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 7 tactics
Initial goal
intros opened l v Hl
unfold heap in Hl
apply lookup_insert_Some in Hl as El Ev | _ Hl
2 openfocused goal
–subst l v
2 opendeferred goal
destruct opened ; exact I
deferred goal
–apply lookup_insert_Some in Hl as El Ev | _ Hl ; subst l v ; exact I |
exact StreamHandleChecks.heap_agreesl v Hl
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Proof 56 steps Qed
Explore proof 24 tactics
Initial goal
intros opened
split
2 openfocused goal
–split
3 openfocused goal
deferred goal
+exists 0, 0, fmt, [ ], 67, 67, mkStreamInfo2 stdout_initial 3
3 opendeferred goal
deferred goal
split ; reflexivity |
3 opendeferred goal
deferred goal
split ; lia |
3 opendeferred goal
deferred goal
split ; lia |
3 opendeferred goal
deferred goal
split
4 openfocused goal
deferred goal
deferred goal
∗vm_compute
4 opendeferred goal
deferred goal
deferred goal
repeat split ; congruence
3 opendeferred goal
deferred goal
deferred goal
∗split ; apply format_literal ; lia | discriminate | constructor |
3 opendeferred goal
deferred goal
split ; split ; exact I | apply F.ready |
3 opendeferred goal
deferred goal
split ; constructor |
3 opendeferred goal
deferred goal
split
4 openfocused goal
deferred goal
deferred goal
--destruct libc_stream_openλ_ _ ⇒ True λ_ _ _ _ ⇒ False λ_ _ _ _ _ ⇒ False conversion_mem F.worldopened file_handleF.err_file F.err_file F.readyopened ltac:destruct opened ; reflexivity as info Hopen
4 opendeferred goal
deferred goal
deferred goal
destruct Hopen as Hr Hlookup Hrest
4 opendeferred goal
deferred goal
deferred goal
assert info = mkStreamInfo2 stdout_initial 3 as →
5 openfocused goal
deferred goal
deferred goal
deferred goal
{destruct opened ; injection Hlookup ; auto
4 opendeferred goal
deferred goal
deferred goal
deferred goal
exact conjHr conjHlookup Hrest
3 opendeferred goal
deferred goal
deferred goal
--split ; discriminate | destruct opened ; discriminate
2 opendeferred goal
deferred goal
+exists 0, 0, fmt, [ ]
2 opendeferred goal
split ; reflexivity | lia
deferred goal
–exists 0, fmt, [ ]
split ; reflexivity | lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Proof 84 steps Qed
Explore proof 30 tactics
Initial goal
intros opened
eapply D.M.E.invoke_normal with born := [ ]
7 openfocused goal
focused goal
focused goal
focused goal
focused goal
focused goal
–split ; reflexivity |
7 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
split
8 openfocused goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
+split ; reflexivity |
8 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
exists Const0, Const0, Const0, [ ]
8 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
split ; reflexivity | constructor
7 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
+exists Const0, Const0, Const0, [ ]
7 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
reflexivity
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–apply admitted
5 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–split
6 openfocused goal
deferred goal
deferred goal
deferred goal
deferred goal
+eapply D.M.E.effects_local ; apply local_store_bytes | constructor
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
intros a Ha
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
left
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
exists errno_span5120 0
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
split ; apply in_or_app ; right ; apply in_or_app ; left ; destruct opened ; left ; reflexivity |
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
split
7 openfocused goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
∗exact proj1proj2proj1proj2proj2F.readyopened
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
∗unfold span_contains , errno_span
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
simpl
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
lia
5 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
+split ; apply format_prefix | constructor ; reflexivity | constructor
4 opendeferred goal
deferred goal
deferred goal
deferred goal
–split ; split ; apply format_prefix | reflexivity | reflexivity
3 opendeferred goal
deferred goal
deferred goal
–intros why Hbad
3 opendeferred goal
deferred goal
discriminate Hbad
2 opendeferred goal
deferred goal
–intros vs Hvs
2 opendeferred goal
injection Hvs as ←
2 opendeferred goal
split ; reflexivity | constructor
deferred goal
–intros status Hbad
discriminate Hbad
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Apply the actual frame with both lives/names and all errno bytes. The last sampled byte is one, not its old zero. Closed stdout stays a completed-closed observation; open stderr survives FIFO acceptance.
Proof 41 steps Qed
Explore proof 6 tactics
Initial goal
split ; repeat split ; reflexivity |
split ; reflexivity |
split ; | reflexivity
intros H
apply f_equalshutdown_stdout in H
discriminate H
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 5 tactics
Initial goal
intros
unfold diagnostic_name
cbn [ T.out token_key ]
rewrite lookup_insert_eq
exact λH ⇒ H
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 8 tactics
Initial goal
split ; exact proj1T.open_snapshots_current |
unfold stream_current , T.open_heap
cbn [ T.out token_key ]
rewrite lookup_insert_eq
intros _ info Hlookup _ Hfifo
change SomemkStreamInfo1 mkStreamByteOriented [ ] true 7 = Someinfo in Hlookup
injection Hlookup as ←
discriminate Hfifo
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 2 tactics
Initial goal
intros m w h v Hl Hlive _ Hroots _
exact StreamHandleChecks.private_byte_rejectedm h v Hl Hlive Hroots
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 2 tactics
Initial goal
intros m w h v Hl Hlive _ Hroots _
exact StreamHandleChecks.private_aux_rejectedm h v Hl Hlive Hroots
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 5 tactics
Initial goal
intros m w
apply nonzero_error_not_returning with status := 1
2 openfocused goal
–exists 0, fmt, [ ]
2 opendeferred goal
split ; reflexivity | lia
deferred goal
–lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.