Repository navigation
Convex algebra - #192
Open
adamv-symbolica wants to merge 8 commits into
Open
Convex algebra#192adamv-symbolica wants to merge 8 commits into
adamv-symbolica wants to merge 8 commits into
Conversation
Define prefix extrema and divergences on valued paths, with recursive formulations and adapters to maps and zipper focuses. Prove their algebraic, geometric, cardinality, and update laws; check finite counterexamples to stronger claims.
Traverse valued paths with explicit stacks and restore all zipper focuses. Termination does not count as a branch, and dangling structure supplies no valued witness. Preserve source payloads for basis and hull. Exercise the Lean law catalogue as Rust expressions and compare with an independent path-set oracle, including movement-count and focus tests.
Select common original tips for meet and unmasked original tips for subtraction. Retain the supporting interior values and prove equivalence to pruning until stable, including termination and confluence. Prove the semilattice, deletion-action, order, Boolean-pruning, geometric, and morphism laws, with valued-support adapters to maps and zipper focuses. Include counterexamples for laws requiring additional hypotheses.
Add native and zipper traversals that preserve left payloads, retain supporting interiors, and share unchanged subtrees. Use direct byte/list kernels with lazy reconstruction and explicit stacks for unary spines. Check both traversals against independent repeated pruning, exercise every native representation pairing, and cover dangling paths, focus restoration, allocator differences, subtree sharing, and deep spines.
Rename the valued-prefix selection operation from live to retain throughout the Lean model. Add map and zipper adapters and a Rust zipper traversal that preserves candidate payloads and stops fringe scans at the first witness. Prove Boolean filtering, exact mask composition, canonical hull/basis masks, restriction dualities, extremum and divergence interactions, and the convex connections. Record counterexamples to invalid stronger identities. Use retain directly in the convex property tests, with exhaustive prefix spaces, independent pruning, payload/focus checks, and traversal-work bounds.
imlvts
requested changes
Nov 17, 2026
Collaborator
There was a problem hiding this comment.
It's quite hard to review all code here, so I would ask for two things:
- separate Lean code related to convex stuff into a separate directory. this PR adds more files to the existing namespace than there are currently. as an example PrunedModel is in a separate directory.
- document where the definitions lay (
def hull,def interior), something that we might inspect. the thing which a human might specify/inspect, from which the theorems/proofs can build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When internal values are used, we may not want them to become external after a meet or subtract.
On master, such an invariant can not be upheld, or requires an expensive additional pass.
This PR introduces convex variants of meet and subtract, that trim internal paths that'd become hull paths.
Along with that, this PR adds all the supporting ops and laws:
{(a,f) ∈ A×F | a ≼ f}A ∩ B retain Hull(A) ∩ Hull(B)andA retain Hull(A) \ B{lcp(a, b) a∈A b∈B}andL(A, B) = D(A, B) ∪ (A retain B) ∪ (B retain A)andD(A, B) = L(Hull(A), Hull(B)) \ (Hull(A) ∪ Hull(A))hold∀X. X restrict A = X restrict B iff Basis(A) = Basis(B)and∀X. X retain A = X retain B iff Hull(A) = Hull(B)A ∩ (A lcp B)