rocq/theories/HelloProgName.v
set_program_name preserves strings, not just capabilities. This strengthens HelloName's control-flow proofs while reusing its IR definitions, literals, cells and store proof.
Keep symbolic address arithmetic folded during computation.
Promotion candidate: a zero bounded comparison implies equal bounded lengths, since an earlier NUL would differ from a nonzero byte.
Explore proof 23 tactics
Initial goal
intros Hl Hr l & r & Hpl & Hqr & _ & ordering & Horder & Hsign
Hsign : (sign_extension (2 ^ 32) (2 ^ 31) 0 ?= 0) = orderingpose proof bounded_length_unique_ _ _ _ _ Hl Hpl as ←
Hsign : (sign_extension (2 ^ 32) (2 ^ 31) 0 ?= 0) = orderingpose proof bounded_length_unique_ _ _ _ _ Hr Hqr as ←
Hsign : (sign_extension (2 ^ 32) (2 ^ 31) 0 ?= 0) = orderingchange Datatypes.Eq = ordering in Hsign
subst ordering
assert Hsame : ∀i, 0 ≤ i < strncmp_windown left right → m_bytesm ptr_addrp + i = m_bytesm ptr_addrq + i
2 openfocused goal
{destruct Horder as _ & Hsame | k & Hk & Hb & Hne & Heq ; exact Hsame |
2 openHeq :
Datatypes.Eq = (m_bytes m (ptr_addr p + k) ?= m_bytes m (ptr_addr q + k))deferred goal
exfalso
2 openHeq :
Datatypes.Eq = (m_bytes m (ptr_addr p + k) ?= m_bytes m (ptr_addr q + k))deferred goal
apply Hne
2 openHeq :
Datatypes.Eq = (m_bytes m (ptr_addr p + k) ?= m_bytes m (ptr_addr q + k))deferred goal
apply Z.compare_eq
2 openHeq :
Datatypes.Eq = (m_bytes m (ptr_addr p + k) ?= m_bytes m (ptr_addr q + k))(m_bytes m (ptr_addr p + k) ?= m_bytes m (ptr_addr q + k)) = Datatypes.Eqdeferred goal
symmetry
2 openHeq :
Datatypes.Eq = (m_bytes m (ptr_addr p + k) ?= m_bytes m (ptr_addr q + k))Datatypes.Eq = (m_bytes m (ptr_addr p + k) ?= m_bytes m (ptr_addr q + k))deferred goal
exact Heq
deferred goal
destruct Hl as Hn & Hl & Hlp & Hap & Hbp & Hnp
destruct Hr as _ & Hr & Hlq & Haq & Hbq & Hnq
destruct Z.lt_trichotomyleft right as Hlt | Heq | Hgt ; | exact Heq |
2 openfocused goal
–specialize Hsameleft ltac:unfold strncmp_window ; lia
2 opendeferred goal
rewrite Hnpltac:lia in Hsame
2 opendeferred goal
specialize Hbqleft ltac:lia
2 opendeferred goal
lia
deferred goal
–specialize Hsameright ltac:unfold strncmp_window ; lia
rewrite Hnqltac:lia in Hsame
specialize Hbpright ltac:lia
lia
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
String-valued program-name reasoning over any runtime.
Import the existing module paths rather than copying their nested signatures into another chain of aliases.
The linked module and the three external contracts already used by HelloName.
Exactly HelloName's global-cell layout and world-preserving store premises.
The same Iris interpretation as HelloName.
Expressions in the linked language.
Promotion candidate: expose the length consequence of strncmp's result instead of discarding all information about the returned integer.
Proof 34 steps Qed
The cells and the existing store proof specialized to this layout.
The lt-prefix test only advances by three when those bytes exist. Both the full invocation name and the short name remain suffixes.
Proof 50 steps Qed
The directory-prefix comparison keeps the base-name offset; only L16 can advance it, using the comparison's length consequence.
Proof 99 steps Qed
The strengthened triple: the first two name cells hold the same suffix pointer, the short-name cell another suffix pointer. The original string is returned intact, so string_suffix lends either selected string for printing and restores argv0 afterwards.
Proof 39 steps Qed
A printing-ready form of set_program_name_suffix_spec: own the selected program-name string, with a wand restoring the full argv0. The suffix may be empty, including when argv0 ends in a slash.
Explore proof 7 tactics
Initial goal
iIntros Hs Hlit Hc HΦ
iApply set_program_name_suffix_spec with Hs Hlit Hc
iNext
iIntros i k Hi Hk Hs Hlit Hc
iDestruct string_suffix_ _ _ _ i with Hs as [Hs Hback] ; exact Hi |
iApply HΦ $! i k with [%] Hs Hback Hlit Hc
auto
No remaining goals.
Qed
✓ Proof checked and closed by Rocq.
Source script
HelloProgNameOn over a Logic instance of its own.