A fixed RAM program for the moment-coordinate catalog
Lax263307.NativeCatalog · concepts/Lax263307/NativeCatalog.lean · lax-263307
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
A single finite RAM program enumerates the subsets of size at most r+2 in the exact order used by the moment relaxation. Each subset occupies one n-bit word. The program stores only the N catalog entries and uses time and sufficient word width at most c(n+r+N+2)^3, uniformly for every larger word width.
Concept map
Lean source view on GitHub
| 1 | import Lax263307.CoordinateCatalog |
| 2 | import Lax808846.Ram |
| 3 | import Mathlib.Combinatorics.Colex |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: A fixed RAM program for the moment-coordinate catalog |
| 8 | type: theorem |
| 9 | --- |
| 10 | A single finite RAM program enumerates the subsets of size at most r+2 |
| 11 | in the exact order used by the moment relaxation. Each subset occupies |
| 12 | one n-bit word. The program stores only the N catalog entries and uses |
| 13 | time and sufficient word width at most c(n+r+N+2)^3, uniformly for every |
| 14 | larger word width. |
| 15 | |
| 16 | # Formalization notes |
| 17 | |
| 18 | Input is [n,r]. Output is the list of subset masks in CoordinateCatalog |
| 19 | order. The construction uses native Pascal tables, ranked-subset decoding, |
| 20 | bit packing, and ordered buffer appends. Distinct cardinality blocks are |
| 21 | disjoint, so the catalog's duplicate-removal operation leaves this order |
| 22 | unchanged. Mask words represent subsets; their values are not used as |
| 23 | addresses for an array of size 2^n. |
| 24 | -/ |
| 25 | |
| 26 | namespace Lax263307.NativeCatalog |
| 27 | |
| 28 | def subsetMask {n : ℕ} (I : Finset (Fin n)) : ℕ := |
| 29 | Finset.equivBitIndices.symm (I.image Fin.val) |
| 30 | |
| 31 | def words (n r : ℕ) : List ℕ := |
| 32 | (CoordinateCatalog.catalog n r).map (fun A => subsetMask A.val) |
| 33 | |
| 34 | axiom exists_program : ∃ p : Lax808846.Ram.Program, ∃ c : ℕ, 0<c ∧ |
| 35 | ∀ n r : ℕ, ∀ width : ℕ, c*(n+r+(words n r).length+2)^3≤width → |
| 36 | ∃ t≤c*(n+r+(words n r).length+2)^3, |
| 37 | Lax808846.Ram.RunsTo width p [n,r] (words n r) t |
| 38 | |
| 39 | end Lax263307.NativeCatalog |
| 40 |
Formalization notes
Input is [n,r]. Output is the list of subset masks in CoordinateCatalog order. The construction uses native Pascal tables, ranked-subset decoding, bit packing, and ordered buffer appends. Distinct cardinality blocks are disjoint, so the catalog's duplicate-removal operation leaves this order unchanged. Mask words represent subsets; their values are not used as addresses for an array of size 2^n.
Used by
none
From Mathlib
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments