A computable catalog and index for moment coordinates
Lax263307.CoordinateCatalog · concepts/Lax263307/CoordinateCatalog.lean · lax-263307
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Lemma
Enumerate only subsets of size at most r+2, remove duplicates, and attach the cardinality proof to each entry. This lists each moment coordinate exactly once and gives a computable equivalence between coordinate indices and the coordinate type. The catalog has at most (r+3)(n+1)^(r+2) entries.
Concept map
Evidence
Lean source view on GitHub
| 1 | import Lax263307.RationalConditioning |
| 2 | import Mathlib.Data.List.NodupEquivFin |
| 3 | import Mathlib.Data.List.Dedup |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: A computable catalog and index for moment coordinates |
| 8 | type: lemma |
| 9 | --- |
| 10 | Enumerate only subsets of size at most r+2, remove duplicates, and attach |
| 11 | the cardinality proof to each entry. This lists each moment coordinate |
| 12 | exactly once and gives a computable equivalence between coordinate indices |
| 13 | and the coordinate type. The catalog has at most (r+3)(n+1)^(r+2) entries. |
| 14 | |
| 15 | # Formalization notes |
| 16 | |
| 17 | The inverse index uses list search. This avoids a choice-based Fintype |
| 18 | equivalence in LP input construction. Duplicate removal is permitted as |
| 19 | its polynomial overhead in the catalogue length fits the quasipolynomial |
| 20 | bound. The proof package implements this enumeration on the RAM. |
| 21 | -/ |
| 22 | |
| 23 | namespace Lax263307.CoordinateCatalog |
| 24 | |
| 25 | open LinearRelaxation RationalConditioning |
| 26 | |
| 27 | private theorem mem_candidates (n r : ℕ) (A : Finset (Fin n)) : |
| 28 | A ∈ candidates n r ↔ A.card ≤ r := |
| 29 | ⟨fun member => |
| 30 | let ⟨j, inRange, inSublists⟩ := List.mem_flatMap.mp member |
| 31 | let ⟨vertices, listed, sameSet⟩ := List.mem_map.mp inSublists |
| 32 | let sublist := (List.mem_sublistsLen.mp listed).1 |
| 33 | let length := (List.mem_sublistsLen.mp listed).2 |
| 34 | calc |
| 35 | A.card = vertices.toFinset.card := congrArg Finset.card sameSet.symm |
| 36 | _ = vertices.length := List.toFinset_card_of_nodup (sublist.nodup (List.nodup_finRange n)) |
| 37 | _ = j := length |
| 38 | _ ≤ r := Nat.le_of_lt_succ (List.mem_range.mp inRange), |
| 39 | fun bounded => |
| 40 | let vertices := (List.finRange n).filter fun v => decide (v ∈ A) |
| 41 | let sublist : vertices.Sublist (List.finRange n) := List.filter_sublist |
| 42 | let sameSet : vertices.toFinset = A := Finset.ext fun v => |
| 43 | List.mem_toFinset.trans (List.mem_filter.trans |
| 44 | ⟨fun h => of_decide_eq_true h.2, |
| 45 | fun h => ⟨List.mem_finRange v, decide_eq_true h⟩⟩) |
| 46 | let length : vertices.length = A.card := |
| 47 | (List.toFinset_card_of_nodup (sublist.nodup (List.nodup_finRange n))).symm.trans |
| 48 | (congrArg Finset.card sameSet) |
| 49 | List.mem_flatMap.mpr ⟨A.card, List.mem_range.mpr (Nat.lt_succ_of_le bounded), |
| 50 | List.mem_map.mpr ⟨vertices, List.mem_sublistsLen.mpr ⟨sublist, length⟩, sameSet⟩⟩⟩ |
| 51 | |
| 52 | def sets (n r : ℕ) : List (Finset (Fin n)) := (candidates n (r + 2)).dedup |
| 53 | |
| 54 | def catalog (n r : ℕ) : List (Coordinate n r) := |
| 55 | (sets n r).attach.map (fun A => ⟨A.val, |
| 56 | (mem_candidates n (r + 2) A.val).mp |
| 57 | (List.mem_dedup.mp A.property)⟩) |
| 58 | |
| 59 | axiom catalog_complete (n r : ℕ) (A : Coordinate n r) : A ∈ catalog n r |
| 60 | |
| 61 | private theorem mem_catalog (n r : ℕ) (A : Coordinate n r) : A ∈ catalog n r := |
| 62 | let listed : A.val ∈ sets n r := |
| 63 | List.mem_dedup.mpr ((mem_candidates n (r + 2) A.val).mpr A.property) |
| 64 | List.mem_map.mpr ⟨⟨A.val, listed⟩, List.mem_attach _ _, Subtype.ext rfl⟩ |
| 65 | |
| 66 | private theorem catalog_nodup (n r : ℕ) : (catalog n r).Nodup := |
| 67 | (List.nodup_dedup _).attach.map fun _ _ equal => |
| 68 | Subtype.ext (congrArg (fun coordinate : Coordinate n r => coordinate.val) equal) |
| 69 | |
| 70 | def indexing (n r : ℕ) : Fin (catalog n r).length ≃ Coordinate n r := |
| 71 | List.Nodup.getEquivOfForallMemList (catalog n r) (catalog_nodup n r) (mem_catalog n r) |
| 72 | |
| 73 | axiom catalog_bound (n r : ℕ) : (catalog n r).length ≤ (r + 3) * (n + 1) ^ (r + 2) |
| 74 | |
| 75 | axiom catalog_positive (n r : ℕ) : 0 < (catalog n r).length |
| 76 | |
| 77 | axiom catalog_two (n r : ℕ) (positive : 0 < n) : 2 ≤ (catalog n r).length |
| 78 | |
| 79 | end Lax263307.CoordinateCatalog |
| 80 |
Formalization notes
The inverse index uses list search. This avoids a choice-based Fintype equivalence in LP input construction. Duplicate removal is permitted as its polynomial overhead in the catalogue length fits the quasipolynomial bound. The proof package implements this enumeration on the RAM.
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments