Exact Lean source
Nonadditivity.HaarPathGraph
Download original .lean · View on GitHub · Jump to source
Direct imports
Imported by project modules
Relationships above come from literal import commands. The declarations below link to types and references extracted from Lean’s environment. Source text is complete and unchanged.
Declarations in this module
82 project constants, including generated, internal and private declarations.
82 declarations
Nonadditivity.HaarPathGraph.DartNonadditivity.HaarPathGraph.EdgeNonadditivity.HaarPathGraph.PathNonadditivity.HaarPathGraph.Path._sizeOf_1internal/detail/privateNonadditivity.HaarPathGraph.Path._sizeOf_instinternal/detail/privateNonadditivity.HaarPathGraph.Path.card_budgetProfileAssignments_leNonadditivity.HaarPathGraph.Path.casesOnNonadditivity.HaarPathGraph.Path.closedNonadditivity.HaarPathGraph.Path.colorsNonadditivity.HaarPathGraph.Path.coreEdgeBudgetNonadditivity.HaarPathGraph.Path.coreVerticesNonadditivity.HaarPathGraph.Path.coreVertices._proof_1internal/detail/privateNonadditivity.HaarPathGraph.Path.coreVertices_add_twice_vertices_leNonadditivity.HaarPathGraph.Path.coreVertices_add_twice_vertices_le._proof_1_2internal/detail/privateNonadditivity.HaarPathGraph.Path.coreVertices_add_twice_vertices_le._proof_1_3internal/detail/privateNonadditivity.HaarPathGraph.Path.coreVertices_add_twice_vertices_le._proof_1_4internal/detail/privateNonadditivity.HaarPathGraph.Path.coreVertices_add_twice_vertices_le._proof_1_5internal/detail/privateNonadditivity.HaarPathGraph.Path.ctorIdxNonadditivity.HaarPathGraph.Path.dartsNonadditivity.HaarPathGraph.Path.darts.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.defectTwiceNonadditivity.HaarPathGraph.Path.degreeNonadditivity.HaarPathGraph.Path.degree.congr_simpNonadditivity.HaarPathGraph.Path.degree.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.degree_posNonadditivity.HaarPathGraph.Path.edgeListNonadditivity.HaarPathGraph.Path.edgeList.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.edgeList_lengthNonadditivity.HaarPathGraph.Path.edgesNonadditivity.HaarPathGraph.Path.end_memNonadditivity.HaarPathGraph.Path.end_mem._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.end_mem._proof_1_2internal/detail/privateNonadditivity.HaarPathGraph.Path.highMultiplicityOccurrences_le_twice_defectNonadditivity.HaarPathGraph.Path.highMultiplicityOccurrences_le_twice_defect._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.mkNonadditivity.HaarPathGraph.Path.mk._flat_ctorinternal/detail/privateNonadditivity.HaarPathGraph.Path.mk.injNonadditivity.HaarPathGraph.Path.mk.injEqNonadditivity.HaarPathGraph.Path.mk.noConfusionNonadditivity.HaarPathGraph.Path.mk.sizeOf_specNonadditivity.HaarPathGraph.Path.noConfusionNonadditivity.HaarPathGraph.Path.noConfusionTypeNonadditivity.HaarPathGraph.Path.recNonadditivity.HaarPathGraph.Path.recOnNonadditivity.HaarPathGraph.Path.reducedNonadditivity.HaarPathGraph.Path.reverse_traversal_memNonadditivity.HaarPathGraph.Path.reverse_traversal_mem._simp_1_2internal/detail/privateNonadditivity.HaarPathGraph.Path.reverse_traversal_mem._simp_1_3internal/detail/privateNonadditivity.HaarPathGraph.Path.source_memNonadditivity.HaarPathGraph.Path.start_memNonadditivity.HaarPathGraph.Path.sum_degreesNonadditivity.HaarPathGraph.Path.traversalNonadditivity.HaarPathGraph.Path.traversal.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.traversal_memNonadditivity.HaarPathGraph.Path.traversal_mem._simp_1_2internal/detail/privateNonadditivity.HaarPathGraph.Path.traversal_mem._simp_1_3internal/detail/privateNonadditivity.HaarPathGraph.Path.twice_coreEdgeBudget_leNonadditivity.HaarPathGraph.Path.twice_coreEdgeBudget_le._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.twice_vertices_le_length_add_singletonsNonadditivity.HaarPathGraph.Path.twice_vertices_le_length_add_singletons._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.two_le_degreeNonadditivity.HaarPathGraph.Path.two_le_degree._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.two_le_degree._proof_1_2internal/detail/privateNonadditivity.HaarPathGraph.Path.two_le_degree._proof_1_3internal/detail/privateNonadditivity.HaarPathGraph.Path.vertexNonadditivity.HaarPathGraph.Path.verticesNonadditivity.HaarPathGraph.Path.vertices_le_edgesNonadditivity.HaarPathGraph.Path.vertices_le_edges._proof_1_2internal/detail/privateNonadditivity.HaarPathGraph.Path.vertices_le_edges._proof_1_3internal/detail/privateNonadditivity.HaarPathGraph.colorNonadditivity.HaarPathGraph.color_dartNonadditivity.HaarPathGraph.color_reverse_dartNonadditivity.HaarPathGraph.dartNonadditivity.HaarPathGraph.edgeNonadditivity.HaarPathGraph.edge.eq_1internal/detail/privateNonadditivity.HaarPathGraph.flipColorNonadditivity.HaarPathGraph.reverseNonadditivity.HaarPathGraph.reverse.eq_1internal/detail/privateNonadditivity.HaarPathGraph.sourceNonadditivity.HaarPathGraph.source.eq_1internal/detail/privateNonadditivity.HaarPathGraph.source_dartNonadditivity.HaarPathGraph.source_reverse_dart
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathMultiplicity78/-! # The colored multigraph of a closed reduced path910Edges are stored with the orientation of a positive generator. This is a11concrete representative of `[x,i,y] = [y,i*,x]`, and retains colored loops12and parallel edges. Degrees count both incidences of a loop. The results13prove BC equations (24)--(26) and the core-vertex estimate underlying (29)14for the actual graph extracted from the path.15-/16noncomputable section17namespace Nonadditivity.HaarPathGraph18open scoped BigOperators19open HaarPathProfiles20variable {V : Type*}2122abbrev Edge (V : Type*) (d : ℕ) := V × Fin d × V23abbrev Dart (V : Type*) (d : ℕ) := Edge V d × Bool2425def flipColor {d : ℕ} (c : Color d) : Color d := (c.1, !c.2)2627def edge {d : ℕ} (x : V) (c : Color d) (y : V) : Edge V d :=28if c.2 then (x,c.1,y) else (y,c.1,x)2930def dart {d : ℕ} (x : V) (c : Color d) (y : V) : Dart V d := (edge x c y,c.2)31def reverse {d : ℕ} (q : Dart V d) : Dart V d := (q.1,!q.2)32def source {d : ℕ} (q : Dart V d) : V := if q.2 then q.1.1 else q.1.2.233def color {d : ℕ} (q : Dart V d) : Color d := (q.1.2.1,q.2)3435@[simp] theorem source_dart {d : ℕ} (x y : V) (c : Color d) :36source (dart x c y) = x := by cases c with | mk i b => cases b <;> rfl37@[simp] theorem source_reverse_dart {d : ℕ} (x y : V) (c : Color d) :38source (reverse (dart x c y)) = y := by cases c with | mk i b => cases b <;> rfl39@[simp] theorem color_dart {d : ℕ} (x y : V) (c : Color d) :40color (dart x c y) = c := by cases c with | mk i b => cases b <;> rfl41@[simp] theorem color_reverse_dart {d : ℕ} (x y : V) (c : Color d) :42color (reverse (dart x c y)) = flipColor c := by43cases c with | mk i b => cases b <;> rfl4445/-- A literal closed path whose generator word is reduced. No reduction is46required between the last and first colors, matching BC's path set. -/47structure Path (V : Type*) (d m : ℕ) where48vertex : Fin (m+1) → V49colors : Fin m → Color d50closed : vertex (Fin.last m) = vertex 051reduced : ∀ i j : Fin m, i.val+1=j.val → colors j ≠ flipColor (colors i)5253namespace Path54variable {d m : ℕ} [DecidableEq V] (P : Path V d m)5556def edgeList : List (Edge V d) := List.ofFn fun i : Fin m =>57edge (P.vertex i.castSucc) (P.colors i) (P.vertex i.succ)58def edges : Finset (Edge V d) := P.edgeList.toFinset59def vertices : Finset V := Finset.univ.image fun i : Fin m => P.vertex i.castSucc60def darts : Finset (Dart V d) := P.edges ×ˢ Finset.univ61def degree (v : V) : ℕ := (P.darts.filter fun q => source q = v).card6263def traversal (i : Fin m) : Dart V d :=64dart (P.vertex i.castSucc) (P.colors i) (P.vertex i.succ)6566omit [DecidableEq V] in67@[simp] theorem edgeList_length : P.edgeList.length = m := by simp [edgeList]6869lemma traversal_mem (i : Fin m) : P.traversal i ∈ P.darts := by70simp only [darts, Finset.mem_product, Finset.mem_univ, and_true]71apply List.mem_toFinset.mpr72exact List.mem_ofFn.mpr ⟨i,rfl⟩7374lemma reverse_traversal_mem (i : Fin m) : reverse (P.traversal i) ∈ P.darts := by75have h := P.traversal_mem i76simpa only [darts, Finset.mem_product, Finset.mem_univ, and_true, reverse] using h7778lemma start_mem (i : Fin m) : P.vertex i.castSucc ∈ P.vertices :=79Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩8081lemma end_mem (i : Fin m) : P.vertex i.succ ∈ P.vertices := by82by_cases hi : i.val+1 < m83· have he : i.succ = (⟨i.val+1,hi⟩ : Fin m).castSucc := Fin.ext rfl84rw [he]85exact P.start_mem _86· have he : i.succ = Fin.last m := Fin.ext (by simp only [Fin.val_succ, Fin.val_last]; omega)87have hm : 0 < m := by omega88rw [he, P.closed]89exact P.start_mem ⟨0,hm⟩9091lemma source_mem {q : Dart V d} (hq : q ∈ P.darts) : source q ∈ P.vertices := by92obtain ⟨hq, _⟩ := Finset.mem_product.mp hq93obtain ⟨i,hi⟩ := List.mem_ofFn.mp (List.mem_toFinset.mp hq)94obtain ⟨e,b⟩ := q95change edge (P.vertex i.castSucc) (P.colors i) (P.vertex i.succ) = e at hi96subst e97obtain ⟨g,c⟩ := P.colors i98cases b <;> cases c <;> simp only [source, edge, Bool.false_eq_true,99ite_false, ite_true] <;> first | exact P.start_mem i | exact P.end_mem i100101/-- The handshake identity includes loops with degree two. -/102theorem sum_degrees : ∑ v ∈ P.vertices, P.degree v = 2*P.edges.card := by103have h := Finset.card_eq_sum_card_fiberwise (s := P.darts) (t := P.vertices)104(f := source) (fun q hq => P.source_mem hq)105simpa [degree, darts, Finset.card_product, mul_comm] using h.symm106107/-- Every visited vertex has an outgoing dart. -/108theorem degree_pos {v : V} (hv : v ∈ P.vertices) : 0 < P.degree v := by109obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hv110apply Finset.card_pos.mpr111exact ⟨P.traversal i, Finset.mem_filter.mpr112⟨P.traversal_mem i, source_dart _ _ _⟩⟩113114/-- At every vertex other than the base, the reduced-word condition supplies115two distinct incidences. This does not assume cyclic reduction. -/116theorem two_le_degree {v : V} (hv : v ∈ P.vertices) (hne : v ≠ P.vertex 0) :1172 ≤ P.degree v := by118obtain ⟨i,_,hi⟩ := Finset.mem_image.mp hv119have hi0 : 0 < i.val := by120by_contra h121have he : i.castSucc = 0 := Fin.ext (by simp only [Fin.val_castSucc, Fin.val_zero]; omega)122exact hne (by rw [←hi,he])123let j : Fin m := ⟨i.val-1,by omega⟩124have hji : j.val+1=i.val := by dsimp [j]; omega125have hjs : j.succ=i.castSucc := Fin.ext hji126have hd : P.traversal i ≠ reverse (P.traversal j) := by127intro he128have hc := congrArg color he129simp only [traversal, color_dart, color_reverse_dart] at hc130exact P.reduced j i hji hc131have hmem₁ : P.traversal i ∈ P.darts.filter (fun q => source q=v) := by132apply Finset.mem_filter.mpr133exact ⟨P.traversal_mem i, (source_dart _ _ _).trans hi⟩134have hmem₂ : reverse (P.traversal j) ∈ P.darts.filter (fun q => source q=v) := by135apply Finset.mem_filter.mpr136refine ⟨P.reverse_traversal_mem j, ?_⟩137simp only [traversal, source_reverse_dart, hjs, hi]138have hsub : {P.traversal i, reverse (P.traversal j)} ⊆139P.darts.filter (fun q => source q=v) := by140intro q hq141rcases Finset.mem_insert.mp hq with rfl | hq142· exact hmem₁143· rw [Finset.mem_singleton] at hq144simpa [hq] using hmem₂145have hc := Finset.card_le_card hsub146simpa [degree, hd] using hc147148/-- BC equation (25): a nonempty closed reduced path has at least as many149colored edges as vertices, including when its base has degree one. -/150theorem vertices_le_edges : P.vertices.card ≤ P.edges.card := by151have hpoint (v : V) (hv : v ∈ P.vertices) :1522 ≤ P.degree v + (if v = P.vertex 0 then 1 else 0) := by153by_cases h : v=P.vertex 0154· have hp := P.degree_pos hv155simp only [if_pos h]156omega157· simpa [h] using P.two_le_degree hv h158have hs := Finset.sum_le_sum hpoint159have hfilter : (P.vertices.filter fun v => v=P.vertex 0).card ≤ 1 := by160have hsub : (P.vertices.filter fun v => v=P.vertex 0) ⊆ {P.vertex 0} := by161intro v hv162simpa using (Finset.mem_filter.mp hv).2163simpa using Finset.card_le_card hsub164simp only [Finset.sum_add_distrib, Finset.sum_const, smul_eq_mul,165Finset.sum_ite, Nat.mul_one] at hs166rw [P.sum_degrees] at hs167omega168169/-- Twice the BC defect is nonnegative without fractions or parity assumptions. -/170theorem twice_vertices_le_length_add_singletons :1712*P.vertices.card ≤ m + (HaarPathMultiplicity.singletonEdges P.edgeList).card := by172have he := HaarPathMultiplicity.twice_edges_le_length_add_singletons P.edgeList173rw [P.edgeList_length] at he174have hv := P.vertices_le_edges175change P.vertices.card ≤ P.edgeList.toFinset.card at hv176omega177178/-- Vertices retained by degree-two suppression: the base and every vertex179whose degree differs from two. -/180def coreVertices : Finset V := P.vertices.filter fun v => v=P.vertex 0 ∨ P.degree v ≠ 2181182/-- The exact degree-count bound used in BC Lemma 5.8, before constructing183the chains between core vertices. -/184theorem coreVertices_add_twice_vertices_le :185P.coreVertices.card + 2*P.vertices.card ≤ 2*P.edges.card+2 := by186have hpoint (v : V) (hv : v ∈ P.vertices) :1872 + (if v ∈ P.coreVertices then 1 else 0) ≤188P.degree v + (if v=P.vertex 0 then 2 else 0) := by189have hp := P.degree_pos hv190by_cases hroot : v=P.vertex 0191· simp only [if_pos hroot]192split_ifs <;> omega193· have htwo := P.two_le_degree hv hroot194by_cases hc : v ∈ P.coreVertices195· have hne : P.degree v ≠ 2 := by196exact (Finset.mem_filter.mp hc).2.resolve_left hroot197simp only [if_pos hc, if_neg hroot]198omega199· simp only [if_neg hc, if_neg hroot]200omega201have hs := Finset.sum_le_sum hpoint202have hcore : (P.vertices.filter fun v => v ∈ P.coreVertices) = P.coreVertices := by203exact Finset.filter_mem_eq_inter.trans (Finset.inter_eq_right.mpr (Finset.filter_subset _ _))204have hfilter : (P.vertices.filter fun v => v=P.vertex 0).card ≤ 1 := by205have hsub : (P.vertices.filter fun v => v=P.vertex 0) ⊆ {P.vertex 0} := by206intro v hv207simpa using (Finset.mem_filter.mp hv).2208simpa using Finset.card_le_card hsub209simp only [Finset.sum_add_distrib, Finset.sum_const, smul_eq_mul,210Finset.sum_ite, Nat.mul_one] at hs211rw [hcore,P.sum_degrees] at hs212omega213214/-- Twice the defect, an integer even when the path length or the singleton215count is odd. -/216def defectTwice : ℕ := m + (HaarPathMultiplicity.singletonEdges P.edgeList).card -2172*P.vertices.card218219/-- The Euler-characteristic budget for the number of edges after suppressing220degree-two vertices. This is a numerical budget, not a definition of a221suppressed graph. -/222def coreEdgeBudget : ℕ := P.edges.card + P.coreVertices.card - P.vertices.card223224/-- Twice the core-edge budget is at most `6*χ+4`, precisely the exponent225needed for the profile-count estimate. -/226theorem twice_coreEdgeBudget_le : 2*P.coreEdgeBudget ≤ 3*P.defectTwice+4 := by227have hv := P.vertices_le_edges228have hc := P.coreVertices_add_twice_vertices_le229have he := HaarPathMultiplicity.twice_edges_le_length_add_singletons P.edgeList230rw [P.edgeList_length] at he231have hχ := P.twice_vertices_le_length_add_singletons232change 2*P.edges.card ≤ _ at he233dsimp [coreEdgeBudget,defectTwice]234omega235236/-- The actual finite set of word-profile assignments to the core-edge budget237has the claimed BC exponent. Constructing the suppressed chains is a separate238step; this theorem makes no assumption of an unproved profile cardinal bound. -/239theorem card_budgetProfileAssignments_le (hm : 0 < m) (hd : 0 < d) :240Fintype.card (Fin P.coreEdgeBudget → BoundedProfile (Color d) m) ≤241(2*d*m^d)^(3*P.defectTwice+4) := by242rw [Fintype.card_fun, Fintype.card_fin]243have hc := HaarPathProfiles.card_signedProfile_le d m244calc245_ ≤ ((2*d*m^d)^2)^P.coreEdgeBudget := Nat.pow_le_pow_left hc _246_ = (2*d*m^d)^(2*P.coreEdgeBudget) := (pow_mul _ _ _).symm247_ ≤ _ := Nat.pow_le_pow_right (by positivity) P.twice_coreEdgeBudget_le248249/-- High-multiplicity occurrences are bounded by four times the BC defect.250This is derived from the actual path graph, including loops and colors. -/251theorem highMultiplicityOccurrences_le_twice_defect :252HaarPathMultiplicity.highMultiplicityOccurrences P.edgeList ≤ 2*P.defectTwice := by253have h := HaarPathMultiplicity.highMultiplicityOccurrences_le_twice_excess P.edgeList254have he := HaarPathMultiplicity.excess_add_twice_edges P.edgeList255rw [P.edgeList_length] at he256have hv := P.vertices_le_edges257have hχ := P.twice_vertices_le_length_add_singletons258change P.vertices.card ≤ P.edgeList.toFinset.card at hv259dsimp [defectTwice]260omega261262end Path263end Nonadditivity.HaarPathGraph