Skip to content

Convex algebra - #192

Open
adamv-symbolica wants to merge 8 commits into
Adam-Vandervorst:masterfrom
adamv-symbolica:codex/convex-algebra
Open

adamv-symbolica wants to merge 8 commits into
Adam-Vandervorst:masterfrom
adamv-symbolica:codex/convex-algebra

Conversation

@adamv-symbolica

Copy link
Copy Markdown
Contributor

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:

  • "retain" is added, which together with "restrict" are the two coordinate projections of {(a,f) ∈ A×F | a ≼ f}
  • "hull" and "basis" are the "prefix-pruned" and "postfix-trimmed" versions of a space, and fix the meaning of convex meet and subtract as A ∩ B retain Hull(A) ∩ Hull(B) and A retain Hull(A) \ B
  • "divergences" and its closure "longest common path" (lcp) are added, where lcp can be lifted {lcp(a, b) a∈A b∈B} and L(A, B) = D(A, B) ∪ (A retain B) ∪ (B retain A) and D(A, B) = L(Hull(A), Hull(B)) \ (Hull(A) ∪ Hull(A)) hold
  • "hull and "basis" classify restrict and retain as ∀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)
  • "lcp" fixes the meaning of retain as A ∩ (A lcp B)

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 imlvts left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite hard to review all code here, so I would ask for two things:

  1. 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.
  2. 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.

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.

2 participants