rocq/theories/Libc.v
Hello's composite trusted libc boundary. One locale/stdio/errno/getopt payload accompanies the existing authoritative shutdown state; there is no second output queue or callback inventory. The conversion contract describes logical represented endpoints, not every native instruction or collector prefix. Libc satisfaction remains trusted.
A represented FILE's handle, physical pending count and private storage. No logical output queue is stored in this record. Owned heaps exclude static FILE objects and caller setvbuf storage.
Stdout's open flag remains stdout_usable, and its protocol remains shutdown_stdout. Stderr has its own protocol and open flag. These fields supply the physical information absent from stdio_world.
| libc_stdout_file | ||
| libc_stderr_file | ||
| libc_stderr_open | : bool | |
| libc_stderr_state |
| libc_locale | ||
| libc_stdio | ||
| libc_errno | : ptr | |
| libc_streams | ||
| libc_getopt |
Definitionally the payload * shutdown_state used by Linked.
Parser state is an independent component of the same libc world; optarg and optind may evolve without changing locale or stdout.
The full representation owns coherent libc/TLS state and exclusive private release rights. Structural facts alone do not establish it. In a callback, uniqueness is not evidence that its token was popped. Readiness does not require stdout open: errno lookup, locale and conversion remain valid after fclose. Output admits an open handle separately. Retired stdio roots must be removed, not kept writable.
Native initialization/continuation is an independent premise, not a consequence of the exposed option cells. Errno uses the existing TLS cell, not a second cell. Native representation and call admission must also justify separation from locale/stdout storage: a pure world frame is not a native-memory or cross-pool ownership frame.
A separate native predicate permits unfinished parser state at a logical prefix. Completed public-cell coherence is required only by getopt_pre/post. Ordinary endpoints must satisfy BOTH running and initialized predicates; no implication between them is assumed.
Preserve the one locale/stdout/shutdown inventory and TLS identity. Diagnostic stderr retains its handle/open flag but may change private storage and protocol. This relation deliberately does not relate its FIFO to the trace, even when the trace is empty.
Conservative safety binding over this same world, with no machine application. Native/consumer obligations still include diagnostic trace/protocol correspondence, stream readiness and cross-call parser continuity (including refreshed errno). Other libc contracts do not freeze this entire parser record. Input and registry are fixed for one launch after startup witnesses are chosen, not per permutation.
Borrowed-name facts survive projection through the composite world. No separate ghost copy of the locale names is introduced here.
Explore proof 5 tactics
Initial goal
intros rep m w category _ & Hlocale & _ Hcategory
destruct Hlocale as _ & _ & Hnames & _ & _ & Haligned
destruct Hnamescategory Hcategory as Hnonnull Hstring
split ; exact Hnonnull |
split ; exact Hstring | exact Halignedcategory Hcategory
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
These two labels identify the independently audited profiles, not strings from which converter behavior can be inferred. The supplied audit maps opaque codec identities to actual selected converters.
| | | CodecC | ||
| | | CodecCUtf8 |
The valid-state predicate is an explicit contract parameter keyed by codec and all eight current bytes. Initialization is a separate law, not a deduction from count bits or mere writable storage.
A required law for the chosen state representation, not an axiom. Validity must also admit completed states with residual value bytes.
Valid represented states contain bytes, not arbitrary mathematical integers. This independent representation law closes state reuse; a zero load alone cannot establish it.
Explore proof 16 tactics
Initial goal
intros valid codec m p Hlaw Hvalid i Hi
pose proof Hlaw_ _ Hvalid as Hbytes
rewrite Forall_forall in Hbytes
apply Hbytes
unfold mbstate_bytes
apply in_map_iff
exists Z.to_nati
split
2 openfocused goal
–rewrite Z2Nat.id by lia
2 opendeferred goal
reflexivity
deferred goal
–apply in_seq
split ; lia |
apply Nat2Z.inj_lt
rewrite Z2Nat.id by lia
simpl
lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 6 tactics
Initial goal
intros valid codec m p Hvalid Hzero
assert mbstate_bytesm p = repeat0 8 as →
2 open{unfold mbstate_bytes
2 opensimpl
2 openrepeat f_equal ; apply Hzero ; lia
apply Hvalid
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Byte-disjoint spans, even if their capabilities share an object.
The composite setter borrows the same readable input as Locale's contract. Its independently writable errno cell is not private locale storage, release authority or a source of retained capabilities. Queries need none of these setter-only separation premises.
Refusal/loading may write errno; a query may not. No errno pointer is added to the capability sources or delegated private roots.
Reuse Locale's selected/delegated endpoint rather than another locale inventory. Other authoritative world components remain exact. As for conversion, scalar errno stores leave caller aux unchanged, and the frame tests private authority in entry memory, not after a free.
This is the composite call candidate, not a native satisfaction or world-interpretation theorem. Locale changes may select a new codec. Runtime resource endings retain only their actual coherent prefix.
Null output/source/state forms and caller aliasing are outside this first slice. Private releases cannot end any argument/errno object.
Only old private libc sources supply capabilities to caches. Caller argument capabilities must not be retained in private aux slots.
n=0 returns before converter lookup. All other prefixes retain the effective locale, stream/shutdown state and errno pointer. Private cache delegation deliberately excludes the caller's write roots. Ordinary wide/state/errno scalar writes do not change caller aux.
Entry-memory byte claims never inspect an already modified input. Generic EILSEQ state stays unspecified. The audited stateless C converter rejects only non-ASCII and leaves all eight state bytes unchanged, including residual bytes. Both Hello codecs preserve valid initial count on EILSEQ and cannot reject a first-byte NUL. UTF-8 pending-state errors still have no reusable-state guarantee. Nonerror errno changes are permitted while lazy loading is unaudited.
Plain P/P/L/P to L. Resource endpoints retain their actual effects prefix, not the normal completion's validity or EILSEQ guarantees.
Consumer lemmas share the supplied machine's exact call relations.
The existing TLS lookup contract with the exact composite projection. It exports the cell's capability, never ownership of its four bytes.
Explore proof 3 tactics
Initial goal
intros rep r args s m w Habi Hready
apply E.errno_location_return ; auto
exact proj1proj2proj2proj2Hready
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 3 tactics
Initial goal
intros rep r args xs s m w trace ending s′ m′ w′ Hcall
destruct E.errno_location_invocation_ _ _ _ _ _ _ _ _ _ _ _ _ _ Hcall as _ & _ & _ & _ & Htrace & Hs & Hm & Hw & Hend
auto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Admission and exact query inversion match HelloLocale's call-site premises over this machine, including identity of the entire world.
Explore proof 9 tactics
Initial goal
intros rep requests category p m w Hready Hcat Hnull
split ; exact Hready |
split
2 openfocused goal
–split ; exact proj1proj2Hready |
2 opendeferred goal
exists category, p
2 opendeferred goal
auto
deferred goal
–cbn [ locale_query ]
rewrite Hnull
exact I
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Proof 29 steps Qed
Proof 20 steps Qed
These constructions require admission and, for selection, an actual permitted effects prefix and independently represented endpoint. They do not assume invocation or guarantee native selection/termination.
Proof 34 steps Qed
Proof 31 steps Qed
Setter endpoints expose the selected new codec through the actual final locale, not a fixed codec hidden in the entry interpretation. New sources retain precisely Locale's old-private-or-born provenance.
Explore proof 18 tactics
Initial goal
intros rep requests r args category p s m w trace ending s′ m′ w′ Hnonnull Hcall
assert Hquery : locale_queryWIntcategory; WPtrp = false by apply Z.eqb_neq ; exact Hnonnull
destruct E.invoke_prefix_ _ _ _ _ _ _ _ _ _ _ _ _ Hcall as born & _ & Hp & Hw
destruct Hp as Htrace Hp
rewrite Hquery in Hp , Hw
destruct Hp as _ & Hd & cat & q & Hxs & Hselected
injection Hxs as ← ←
destruct Hw as Hready & Hstdio & Herrno & Hshutdown & _
split ; exact Htrace |
split ; exact Hready |
split ; exact Hstdio |
split ; exact Herrno |
split ; exact Hshutdown |
exists born
split ; exact Hd |
split ; | exact Hselected
intros source Hin
eapply locale_delegates_private ; eauto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 17 tactics
Initial goal
intros rep requests r args category p s m w trace values s′ m′ w′ Hnonnull Hcall
destruct setlocale_setter_prefix_ _ _ _ _ _ _ _ _ _ _ _ _ _ Hnonnull Hcall as _ & Hready & _
assert Hcat : Incategory locale_categories
2 openfocused goal
{inversion Hcall ; subst
2 opendeferred goal
match goal withHpre : contract_pre_ _ _ _ |- _⇒destruct Hpre as _ & _ & cat & q & Hxs & Hcat & _ & _end
2 opendeferred goal
injection Hxs as ← ←
2 opendeferred goal
exact Hcat
deferred goal
assert Hpost : setlocale_postWIntcategory; WPtrp m libc_localefstw [ ] trace CallReturnvalues m′ libc_localefstw′
2 openfocused goal
{inversion Hcall ; subst
2 opendeferred goal
assumption
deferred goal
destruct Hpost as cat & q & Hxs & Hpost
injection Hxs as ← ←
assert Hquery : locale_queryWIntcategory; WPtrp = false by apply Z.eqb_neq ; exact Hnonnull
rewrite Hquery in Hpost
destruct Hpost as Hret Hunchanged | Hret Hselected ; injection Hret as → ; left ; auto | right ; split ; reflexivity |
split ; exact Hselected |
exact proj1proj2libc_namerep m′ w′ category Hready Hcat
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Input-only n=0 admission constructs a call with the exact snapshot. The full valid-state/readability premises are intentionally retained.
Explore proof 18 tactics
Initial goal
intros valid audit rep requests r args out src state s m w Habi Hpre
eapply E.invoke_normal with born := [ ]
7 openfocused goal
focused goal
focused goal
focused goal
focused goal
focused goal
–exact Habi
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–exact Hpre
5 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–split ; constructor |
5 opendeferred goal
deferred goal
deferred goal
deferred goal
repeat split ; reflexivity
4 opendeferred goal
deferred goal
deferred goal
deferred goal
–exists out, src, 0, state, 2 ^ 64 − 2
4 opendeferred goal
deferred goal
deferred goal
repeat split ; reflexivity
3 opendeferred goal
deferred goal
deferred goal
–intros why Hbad
3 opendeferred goal
deferred goal
discriminate
2 opendeferred goal
deferred goal
–intros values Heq
2 opendeferred goal
injection Heq as ←
2 opendeferred goal
split
3 openfocused goal
deferred goal
+exists WInt2 ^ 64 − 2
3 opendeferred goal
deferred goal
split ; reflexivity
2 opendeferred goal
deferred goal
+constructor ; exact I | constructor
deferred goal
–intros status Hbad
discriminate
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Non-setlocale conversion never changes effective locale/borrow facts or either authoritative stdio/shutdown state, including on resources.
Explore proof 12 tactics
Initial goal
intros valid audit rep requests r args xs s m w trace ending s′ m′ w′ Hcall
assert Hpre : mbrtowc_prevalid rep xs m w by inversion Hcall ; assumption
destruct Hpre as _ & _ & _ & out & src & n & state & → & _
destruct E.invoke_prefix_ _ _ _ _ _ _ _ _ _ _ _ _ Hcall as born & _ & Htrace & Hp
cbn [ mbrtowc_prefix ] in Hp
split ; exact Htrace |
destruct n =? 0
2 openfocused goal
–destruct Hp as _ & _ & →
2 opendeferred goal
split ; apply locale_unchanged_refl |
2 opendeferred goal
repeat split ; reflexivity
deferred goal
–destruct Hp as _ & Hlocale & _ & Hstdio & Herrno & Hshutdown & _
auto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Nonzero normal completions need independent memory effects, endpoint representation/delegation and a result witness. This is not decoding existence or native termination, nor an assumption of invocation.
Explore proof 22 tactics
Initial goal
intros valid audit rep requests r args out src n state s m w born s′ m′ w′ result Habi Hpre Hn Hp Hresult
eapply E.invoke_normal with born := born
7 openfocused goal
focused goal
focused goal
focused goal
focused goal
focused goal
–exact Habi
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–exact Hpre
5 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
–exact Hp
4 opendeferred goal
deferred goal
deferred goal
deferred goal
–exists out, src, n, state, result
4 opendeferred goal
deferred goal
deferred goal
split ; reflexivity |
4 opendeferred goal
deferred goal
deferred goal
split ; reflexivity |
4 opendeferred goal
deferred goal
deferred goal
rewrite proj2Z.eqb_neq_ _ Hn
4 opendeferred goal
deferred goal
deferred goal
exact Hresult
3 opendeferred goal
deferred goal
deferred goal
–intros why Hbad
3 opendeferred goal
deferred goal
discriminate
2 opendeferred goal
deferred goal
–intros values Heq
2 opendeferred goal
injection Heq as ←
2 opendeferred goal
split
3 openfocused goal
deferred goal
+exists WIntresult
3 opendeferred goal
deferred goal
split ; reflexivity |
3 opendeferred goal
deferred goal
simpl
3 opendeferred goal
deferred goal
rewrite Z.mod_small ; reflexivity | exact proj1Hresult
2 opendeferred goal
deferred goal
+constructor ; exact I | constructor
deferred goal
–intros status Hbad
discriminate
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
All normal return cases, extracted without assuming a particular decoder outcome. Resource endpoints do not obtain this theorem.
Explore proof 7 tactics
Initial goal
intros valid audit rep requests r args out src n state s m w trace values s′ m′ w′ Hcall
inversion Hcall ; subst
match goal withHpost : contract_post_ _ _ _ _ _ _ _ _ |- _⇒destruct Hpost as out′ & src′ & n′ & state′ & result & Hxs & Hend & Hresultend
injection Hxs as ← ← ← ←
injection Hend as →
exists result
auto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
n=0 has no allocation request and cannot end for resources. Every completion, not just the constructed one, has the identity snapshot.
Explore proof 17 tactics
Initial goal
intros valid audit rep requests r args out src state s m w trace ending s′ m′ w′ Hcall
destruct Hcall as trace ending s′ m′ w′ born Habi Hpre He Ht Hp Hpost Hresource Hvalues Hexit | why trace s′ m′ w′ born Habi Hpre He Ht Hp Hfailure Hresource
2 openfocused goal
–cbn [ mbrtowc_prefix ] in Hp
2 opendeferred goal
destruct Hp as _ & → & →
2 opendeferred goal
destruct Hpost as out′ & src′ & n′ & state′ & result & Hxs & Hend & Hresult
2 opendeferred goal
injection Hxs as ← ← ← ←
2 opendeferred goal
cbn in Hresult
2 opendeferred goal
subst result ending
2 opendeferred goal
split ; exact Ht |
2 opendeferred goal
split ; reflexivity |
2 opendeferred goal
split ; | auto
2 opendeferred goal
clear - He
2 opendeferred goal
induction He ; reflexivity | exact IHHe |
2 opendeferred goal
destruct H as out′ & src′ & n′ & state′ & Hxs & Hn & _
2 opendeferred goal
injection Hxs as ← ← ← ←
2 opendeferred goal
contradiction
deferred goal
–inversion Hfailure as align size Hrequest Hsize Hrefuse | align size Hrequest Hsize ; destruct Hrequest as out′ & src′ & n′ & state′ & Hxs & Hn & _ ; injection Hxs as ← ← ← ← ; contradiction
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Consumer facts expose the audited profile only where it is needed. A complete character is initial, not necessarily eight zero bytes.
Explore proof 4 tactics
Initial goal
intros valid audit m w out src n state result m′ _ & Hcases Hprofile Hpositive
destruct Hcases as → & _ | Hbound & _ & Hvalid & Hprofiled | → & _ | → & _ ; try lia
destruct HprofiledHprofile as Hwide & Hinitial & Hbytes
intuition
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 4 tactics
Initial goal
intros valid audit m w out src n state m′ _ & Hcases Hprofile
destruct Hcases as Hbad & _ | _ & Hbad & _ | Hbad & _ | _ & _ & _ & Hprofiled ; try lia
apply Hprofiled
exact Hprofile
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 2 tactics
Initial goal
intros valid audit m w out src n state result m′ _ & Hcases Hnoterror
destruct Hcases as _ & Hvalid & _ | _ & _ & Hvalid & _ | Herror & _ | _ & Hvalid & _ ; congruence
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Only the independently identified stateless C converter gets this error rule. It preserves admitted state, not necessarily zero state.
Explore proof 3 tactics
Initial goal
intros valid audit m w out src n state m′ _ & Hcases Hc
destruct Hcases as Hbad & _ | _ & Hbad & _ | _ & _ & _ & Herror & _ | Hbad & _ ; try lia
exact HerrorHc
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
The selected C/UTF-8 initial-state error boundary used by gnulib's one-byte fallback. No promise is made about a pending UTF-8 state.
Explore proof 3 tactics
Initial goal
intros valid audit m w out src n state m′ _ & Hcases Hprofile Hinitial Hvalid
destruct Hcases as Hbad & _ | _ & Hbad & _ | _ & _ & _ & _ & Herror | Hbad & _ ; try lia
exact HerrorHprofile Hinitial Hvalid
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 6 tactics
Initial goal
intros valid audit m w out src n state result m′ Hresult Hc Hvalid
destruct Z.eq_decresult 2 ^ 64 − 1 as [ ->| Hnoterror ]
2 openfocused goal
–destruct mbrtowc_c_error_ _ _ _ _ _ _ _ _ Hresult Hc as Hstate _
2 opendeferred goal
rewrite Hstate
2 opendeferred goal
exact Hvalid
deferred goal
–eapply mbrtowc_valid_after ; eauto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Logical fixtures, not a native representation or decoder. Separate objects prevent a symmetric/overlapping footprint from hiding errors.
The abstract fixture admits initial states with residual bytes and one explicitly represented pending state. No count-bit validity rule is being asserted for native arbitrary-codec states.
Proof 72 steps Qed
Explore proof 2 tactics
Zero count and real request/refusal are both public invocations.
Explore proof 5 tactics
Initial goal
apply InterpLibc.mbrtowc_zero
2 openfocused goal
–split ; left ; reflexivity |
2 opendeferred goal
eexists ; eexists ; eexists ; eexists ; reflexivity
deferred goal
–apply conversion_pre
lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Explore proof 27 tactics
Initial goal
eapply InterpLibc.E.invoke_resource with born := [ ]
5 openfocused goal
focused goal
focused goal
–split ; left ; reflexivity |
5 opendeferred goal
deferred goal
deferred goal
eexists ; eexists ; eexists ; eexists ; reflexivity
4 opendeferred goal
deferred goal
deferred goal
–apply conversion_pre
4 opendeferred goal
deferred goal
deferred goal
lia
3 opendeferred goal
deferred goal
deferred goal
–split ; constructor |
3 opendeferred goal
deferred goal
split ; reflexivity |
3 opendeferred goal
deferred goal
split ; exact proj1conversion_pre1 ltac:lia |
3 opendeferred goal
deferred goal
split ; apply locale_unchanged_refl |
3 opendeferred goal
deferred goal
split
4 openfocused goal
deferred goal
deferred goal
+eapply locale_delegates_refl
5 opendeferred goal
deferred goal
deferred goal
shelved goal
exact proj1proj2proj1conversion_pre1 ltac:lia
3 opendeferred goal
deferred goal
deferred goal
+split ; reflexivity |
3 opendeferred goal
deferred goal
split ; reflexivity |
3 opendeferred goal
deferred goal
split ; reflexivity |
3 opendeferred goal
deferred goal
split ; reflexivity |
3 opendeferred goal
deferred goal
intros ; reflexivity
2 opendeferred goal
deferred goal
–eapply InterpLibc.E.failure_oom with align := 16 size := 32
4 openfocused goal
focused goal
deferred goal
+eexists ; eexists ; eexists ; eexists
8 opendeferred goal
deferred goal
deferred goal
shelved goal
shelved goal
shelved goal
shelved goal
split ; reflexivity |
4 opendeferred goal
deferred goal
deferred goal
split ; discriminate |
4 opendeferred goal
deferred goal
deferred goal
auto
3 opendeferred goal
deferred goal
deferred goal
+unfold max_allocation_size
3 opendeferred goal
deferred goal
lia
2 opendeferred goal
deferred goal
+reflexivity
deferred goal
–left
reflexivity
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Scalar endpoints may change errno even on success. The residual value bytes are independent of the initial-state count.
Proof 76 steps Qed
Explore proof 22 tactics
Initial goal
split
2 openfocused goal
–eapply InterpLibc.mbrtowc_completed with born := [ ]
6 openfocused goal
focused goal
focused goal
focused goal
deferred goal
+split ; left ; reflexivity |
6 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
eexists ; eexists ; eexists ; eexists ; reflexivity
5 opendeferred goal
deferred goal
deferred goal
deferred goal
deferred goal
+apply conversion_pre
5 opendeferred goal
deferred goal
deferred goal
deferred goal
lia
4 opendeferred goal
deferred goal
deferred goal
deferred goal
+discriminate
3 opendeferred goal
deferred goal
deferred goal
+apply conversion_scalar_prefix
2 opendeferred goal
deferred goal
+split ; lia |
2 opendeferred goal
right
2 opendeferred goal
left
2 opendeferred goal
split ; lia |
2 opendeferred goal
split ; lia |
2 opendeferred goal
split ; vm_compute ; split ; repeat constructor ; congruence | auto |
2 opendeferred goal
intros _
2 opendeferred goal
split ; vm_compute ; auto |
2 opendeferred goal
split ; reflexivity |
2 opendeferred goal
intros i Hi
2 opendeferred goal
assert i = 0 by lia
2 opendeferred goal
subst
2 opendeferred goal
discriminate
deferred goal
–split ; reflexivity
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Scalar output/state/errno roots never confer permission to retain caller capabilities in aux. The public invocation rejects this even though the state bytes themselves are writable.
Explore proof 11 tactics
Initial goal
intros c Hcap s s′ trace ending Hcall
destruct InterpLibc.E.invoke_prefix_ _ _ _ _ _ _ _ _ _ _ _ _ Hcall as born & _ & _ & _ & _ & _ & _ & _ & _ & _ & Hframe
specialize Hframe3072
assert in_objectconversion_mem 3072 as Hin
2 openfocused goal
{exists 3072, mkRegion3072 3080 Stack Live
2 opendeferred goal
split ; reflexivity |
2 opendeferred goal
simpl ; lia
deferred goal
assert ¬write_authority[ ] [ ] conversion_mem 3072 as Hout
2 openfocused goal
{intros root & & _ | base & reg & & _
deferred goal
apply Hcap
exact HframeHin Hout
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
Profiled incomplete calls preserve valid continuation, not initial state. An unprofiled EILSEQ may still leave invalid state.
Explore proof 33 tactics
Initial goal
split
2 openfocused goal
–split ; lia |
2 opendeferred goal
right
2 opendeferred goal
right
2 opendeferred goal
right
2 opendeferred goal
split ; reflexivity |
2 opendeferred goal
split ; vm_compute ; split ; repeat constructor ; congruence | auto |
2 opendeferred goal
split
3 openfocused goal
deferred goal
+intros a Ha
3 opendeferred goal
deferred goal
change 2048 ≤ a < 2052 in Ha
3 opendeferred goal
deferred goal
assert a = 2048 ∨ a = 2049 ∨ a = 2050 ∨ a = 2051 by lia
3 opendeferred goal
deferred goal
destruct H as → | → | → | → ; reflexivity
2 opendeferred goal
deferred goal
+intros _
2 opendeferred goal
split ; lia |
2 opendeferred goal
intros i Hi
2 opendeferred goal
assert i = 0 by lia
2 opendeferred goal
subst
2 opendeferred goal
discriminate
deferred goal
–intros audit Hnotc Hnotprofile
split ; lia |
right
right
left
split ; reflexivity |
split ; reflexivity |
split
2 openfocused goal
+intros a Ha
2 opendeferred goal
change 2048 ≤ a < 2052 in Ha
2 opendeferred goal
assert a = 2048 ∨ a = 2049 ∨ a = 2050 ∨ a = 2051 by lia
2 opendeferred goal
destruct H as → | → | → | → ; reflexivity
deferred goal
+split ; intros Hc ; contradiction |
intros Hprofile
contradiction
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
A mathematical memory write is not automatically a byte. Neither normal nor incomplete validity may admit this damaged state.
Explore proof 8 tactics
Initial goal
intros byte result Hbad Hnoterror Hresult
pose proof mbrtowc_valid_after_ _ _ _ _ _ _ _ _ _ Hresult Hnoterror as Hvalid
assert mbstate_valid_bytesconversion_valid as Hlaw
2 openfocused goal
{intros codec bytes Hbytes _
2 opendeferred goal
exact Hbytes
deferred goal
pose proof mbstate_byte_range_ _ _ _ Hlaw Hvalid 4 ltac:lia as Hrange
change 0 ≤ byte < 256 in Hrange
lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
C error and subsequent reuse retain a nonzero residual state byte; they do not silently reinitialize the state.
Explore proof 21 tactics
Initial goal
split ; lia |
right
right
left
split ; reflexivity |
split ; reflexivity |
split
2 openfocused goal
–intros a Ha
2 opendeferred goal
change 2048 ≤ a < 2052 in Ha
2 opendeferred goal
unfold conversion_c_error_end , store_bytes
2 opendeferred goal
cbn [ m_bytes ]
2 opendeferred goal
rewrite proj2Z.leb_gt5120 a ltac:lia
2 opendeferred goal
reflexivity
deferred goal
–split
2 openfocused goal
+intros _
2 opendeferred goal
split ; reflexivity |
2 opendeferred goal
vm_compute
2 opendeferred goal
repeat split ; congruence
deferred goal
+intros _ _ Hvalid
split ; exact Hvalid |
split ; reflexivity | discriminate
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.