Skip to content

Conversation

@xrchz
Copy link
Member

@xrchz xrchz commented Jan 8, 2026

Define lcp as a list-based wrapper around longest_prefix:
lcp ls = longest_prefix (set ls)

Add supporting definitions and theorems in rich_listScript.sml:

  • lcp_def, lcp_nil, lcp_sing, lcp_cons2: definition and recursion equations
  • lcp_thm: lcp is a prefix of all elements and is maximal
  • longest_prefix_PAIR_prefix, longest_prefix_PAIR_maximal: helper lemmas
  • common_prefixes_INSERT2, longest_prefix_INSERT2: key lemmas for recursion
  • longest_prefix_assoc: associativity of longest_prefix on pairs
  • lcp2_def: binary version lcp2 x y = longest_prefix {x;y}
  • lcp2_thm, lcp_oneline: case-based equations for cv_trans

Add cv_trans support in cv_stdScript.sml:

  • cv_trans_pre for lcp2 and lcp with precondition proofs

This enables efficient computation of longest common prefixes using cv_compute. This is used in Verifereum for Merkle Patricia trees.

xrchz and others added 3 commits January 8, 2026 15:10
Define lcp as a list-based wrapper around longest_prefix:
  lcp ls = longest_prefix (set ls)

Add supporting definitions and theorems in rich_listScript.sml:
- lcp_def, lcp_nil, lcp_sing, lcp_cons2: definition and recursion equations
- lcp_thm: lcp is a prefix of all elements and is maximal
- longest_prefix_PAIR_prefix, longest_prefix_PAIR_maximal: helper lemmas
- common_prefixes_INSERT2, longest_prefix_INSERT2: key lemmas for recursion
- longest_prefix_assoc: associativity of longest_prefix on pairs
- lcp2_def: binary version lcp2 x y = longest_prefix {x;y}
- lcp2_thm, lcp_oneline: case-based equations for cv_trans

Add cv_trans support in cv_stdScript.sml:
- cv_trans_pre for lcp2 and lcp with precondition proofs

This enables efficient computation of longest common prefixes using
cv_compute. This is used in Verifereum for Merkle Patricia trees.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mn200
Copy link
Member

mn200 commented Jan 11, 2026

Nice!

@mn200 mn200 merged commit 220ddf8 into develop Jan 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants