A computable catalog and index for moment coordinates

Lax263307.CoordinateCatalog · concepts/Lax263307/CoordinateCatalog.lean · lax-263307

proven

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural 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
    8 concepts; 9 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    Lean source view on GitHub

    1import Lax263307.RationalConditioning
    2import Mathlib.Data.List.NodupEquivFin
    3import Mathlib.Data.List.Dedup
    4
    5/-!
    6---
    7title: A computable catalog and index for moment coordinates
    8type: lemma
    9---
    10Enumerate only subsets of size at most r+2, remove duplicates, and attach
    11the cardinality proof to each entry. This lists each moment coordinate
    12exactly once and gives a computable equivalence between coordinate indices
    13and the coordinate type. The catalog has at most (r+3)(n+1)^(r+2) entries.
    14
    15# Formalization notes
    16
    17The inverse index uses list search. This avoids a choice-based Fintype
    18equivalence in LP input construction. Duplicate removal is permitted as
    19its polynomial overhead in the catalogue length fits the quasipolynomial
    20bound. The proof package implements this enumeration on the RAM.
    21-/
    22
    23namespace Lax263307.CoordinateCatalog
    24
    25open LinearRelaxation RationalConditioning
    26
    27private 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
    52def sets (n r : ℕ) : List (Finset (Fin n)) := (candidates n (r + 2)).dedup
    53
    54def 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
    59axiom catalog_complete (n r : ℕ) (A : Coordinate n r) : A ∈ catalog n r
    60
    61private 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
    66private 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
    70def 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
    73axiom catalog_bound (n r : ℕ) : (catalog n r).length ≤ (r + 3) * (n + 1) ^ (r + 2)
    74
    75axiom catalog_positive (n r : ℕ) : 0 < (catalog n r).length
    76
    77axiom catalog_two (n r : ℕ) (positive : 0 < n) : 2 ≤ (catalog n r).length
    78
    79end Lax263307.CoordinateCatalog
    80
    Show ProofShow ProofShow ProofShow Proof
    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.

    Loading discussion…