Exact Lean source
Nonadditivity.HaarPathClassData
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
27 project constants, including generated, internal and private declarations.
27 declarations
Nonadditivity.HaarPathClasses.SamePattern.defectTwice_eqNonadditivity.HaarPathClasses.SamePattern.edgeAt_eq_iffNonadditivity.HaarPathClasses.SamePattern.edgeAt_eq_iff._simp_1_1internal/detail/privateNonadditivity.HaarPathClasses.SamePattern.edgeAt_mem_treeEdges_iffNonadditivity.HaarPathClasses.SamePattern.edgeAt_mem_treeEdges_iff._simp_1_1internal/detail/privateNonadditivity.HaarPathClasses.SamePattern.firstTimes_eqNonadditivity.HaarPathClasses.SamePattern.firstTimes_eq._simp_1_1internal/detail/privateNonadditivity.HaarPathClasses.SamePattern.firstVisit_iffNonadditivity.HaarPathClasses.SamePattern.importantTimes_eqNonadditivity.HaarPathClasses.SamePattern.importantTimes_eq._simp_1_1internal/detail/privateNonadditivity.HaarPathClasses.SamePattern.importantTimes_eq._simp_1_2internal/detail/privateNonadditivity.HaarPathClasses.SamePattern.incidenceVertex_iffNonadditivity.HaarPathClasses.SamePattern.singleton_card_eqNonadditivity.HaarPathClasses.SamePattern.vertices_card_eqNonadditivity.HaarPathClasses.SamePattern.vertices_card_eq._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.classDefectTwiceNonadditivity.HaarPathClasses.classImportantTimesNonadditivity.HaarPathClasses.classImportantTimes_card_leNonadditivity.HaarPathClasses.singletonEdges_map_cardNonadditivity.HaarPathClasses.singletonEdges_map_card._simp_1_1internal/detail/privateNonadditivity.HaarPathClasses.singletonEdges_map_card._simp_1_2internal/detail/privateNonadditivity.HaarPathClasses.singletonEdges_map_card._simp_1_3internal/detail/privateNonadditivity.HaarPathClasses.singletonEdges_map_card._simp_1_4internal/detail/privateNonadditivity.HaarPathGraph.Path.FirstVisit.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.defectTwice.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.firstTimes.congr_simpNonadditivity.HaarPathGraph.edge_eq_iff
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathClasses78/-! # Exploration statistics descend to the actual path quotient910Repeated colored edges, discovery times, important times and the defect are11invariant under the literal vertex-and-local-color equivalence.12-/13noncomputable section14namespace Nonadditivity.HaarPathGraph15variable {V : Type*} {d : ℕ}1617theorem edge_eq_iff {x y x' y' : V} {c c' : HaarPathProfiles.Color d} :18edge x c y=edge x' c' y' ↔19(x=x' ∧ c=c' ∧ y=y') ∨ (x=y' ∧ c=flipColor c' ∧ y=x') := by20obtain ⟨g,b⟩ := c21obtain ⟨g',b'⟩ := c'22cases b <;> cases b' <;> simp [edge,flipColor,Prod.mk.injEq]23all_goals tauto24end Nonadditivity.HaarPathGraph2526namespace Nonadditivity.HaarPathClasses27open HaarPathGraph HaarPathProfiles28variable {V : Type*} {d m : ℕ} [DecidableEq V]29variable {P Q : Path V d m}3031namespace SamePattern3233theorem incidenceVertex_iff (h : SamePattern P Q) (a b : Incidence m) :34incidenceVertex P a=incidenceVertex P b ↔35incidenceVertex Q a=incidenceVertex Q b := by36simpa only [incidenceVertex_eq] using h.1 (incidenceIndex a) (incidenceIndex b)3738theorem firstVisit_iff (h : SamePattern P Q) (i : Fin m) :39P.FirstVisit i ↔ Q.FirstVisit i := by40simp only [Path.FirstVisit]41constructor42· intro hi j hj he43exact hi j hj ((h.1 j i.succ).mpr he)44· intro hi j hj he45exact hi j hj ((h.1 j i.succ).mp he)4647theorem firstTimes_eq (h : SamePattern P Q) : P.firstTimes=Q.firstTimes := by48ext i49simpa only [Path.mem_firstTimes] using h.firstVisit_iff i5051theorem edgeAt_eq_iff (h : SamePattern P Q) (i j : Fin m) :52P.edgeAt i=P.edgeAt j ↔ Q.edgeAt i=Q.edgeAt j := by53simp only [Path.edgeAt,edge_eq_iff]54have hf : P.vertex i.castSucc=P.vertex j.castSucc →55(P.colors i=P.colors j ↔ Q.colors i=Q.colors j) := by56intro hv57exact h.2 (i,true) (j,true) hv58have hr : P.vertex i.castSucc=P.vertex j.succ →59(P.colors i=flipColor (P.colors j) ↔ Q.colors i=flipColor (Q.colors j)) := by60intro hv61exact h.2 (i,true) (j,false) hv62constructor63· rintro (⟨hs,hc,ht⟩ | ⟨hs,hc,ht⟩)64· exact Or.inl ⟨(h.1 _ _).mp hs,(hf hs).mp hc,(h.1 _ _).mp ht⟩65· exact Or.inr ⟨(h.1 _ _).mp hs,(hr hs).mp hc,(h.1 _ _).mp ht⟩66· rintro (⟨hs,hc,ht⟩ | ⟨hs,hc,ht⟩)67· have hs' := (h.1 _ _).mpr hs68exact Or.inl ⟨hs',(hf hs').mpr hc,(h.1 _ _).mpr ht⟩69· have hs' := (h.1 _ _).mpr hs70exact Or.inr ⟨hs',(hr hs').mpr hc,(h.1 _ _).mpr ht⟩7172theorem edgeAt_mem_treeEdges_iff (h : SamePattern P Q) (i : Fin m) :73P.edgeAt i∈P.treeEdges ↔ Q.edgeAt i∈Q.treeEdges := by74simp only [Path.treeEdges,Finset.mem_image]75constructor76· rintro ⟨j,hj,he⟩77exact ⟨j,h.firstTimes_eq ▸ hj,(h.edgeAt_eq_iff j i).mp he⟩78· rintro ⟨j,hj,he⟩79exact ⟨j,h.firstTimes_eq.symm ▸ hj,(h.edgeAt_eq_iff j i).mpr he⟩8081theorem importantTimes_eq (h : SamePattern P Q) : P.importantTimes=Q.importantTimes := by82ext i83simp only [Path.importantTimes,Finset.mem_filter,Finset.mem_univ,true_and]84exact not_congr (h.edgeAt_mem_treeEdges_iff i)8586theorem vertices_card_eq (h : SamePattern P Q) (hm : 0 < m) :87P.vertices.card=Q.vertices.card := by88have hp := P.card_firstTimes hm89have hq := Q.card_firstTimes hm90rw [h.firstTimes_eq] at hp91omega9293end SamePattern9495/-- Relabeling an arbitrary edge list by a bijection preserves its exact96singleton count; the statement is about literal multiplicities. -/97theorem singletonEdges_map_card {E : Type*} [DecidableEq E]98(l : List E) (σ : Equiv.Perm E) :99(HaarPathMultiplicity.singletonEdges (l.map σ)).card =100(HaarPathMultiplicity.singletonEdges l).card := by101classical102have he : HaarPathMultiplicity.singletonEdges (l.map σ) =103(HaarPathMultiplicity.singletonEdges l).image σ := by104ext e105simp only [HaarPathMultiplicity.singletonEdges,Finset.mem_filter,List.mem_toFinset,106List.mem_map,Finset.mem_image]107constructor108· rintro ⟨⟨x,hx,rfl⟩,hc⟩109refine ⟨x,⟨hx,?_⟩,rfl⟩110simpa only [List.count_map_of_injective l σ σ.injective] using hc111· rintro ⟨x,⟨hx,hc⟩,rfl⟩112refine ⟨⟨x,hx,rfl⟩,?_⟩113simpa only [List.count_map_of_injective l σ σ.injective] using hc114rw [he,Finset.card_image_of_injective _ σ.injective]115116namespace SamePattern117118theorem singleton_card_eq [Fintype V] (h : SamePattern P Q) :119(HaarPathMultiplicity.singletonEdges P.edgeList).card =120(HaarPathMultiplicity.singletonEdges Q.edgeList).card := by121obtain ⟨σ,hσ⟩ := exists_perm_of_kernel_eq P.edgeAt Q.edgeAt h.edgeAt_eq_iff122have he : P.edgeList.map σ=Q.edgeList := by123simp only [Path.edgeList,List.map_ofFn]124apply congrArg List.ofFn125funext i126exact hσ i127rw [←he,singletonEdges_map_card]128129theorem defectTwice_eq [Fintype V] (h : SamePattern P Q) (hm : 0 < m) :130P.defectTwice=Q.defectTwice := by131simp only [Path.defectTwice,h.vertices_card_eq hm,h.singleton_card_eq]132133end SamePattern134135/-- The important-position finset is an honest function on BC path classes. -/136def classImportantTimes (C : PathClass V d m) : Finset (Fin m) :=137Quotient.lift Path.importantTimes138(fun _ _ (h : SamePattern _ _) => h.importantTimes_eq) C139140/-- The defect is an honest function on nonempty path classes. -/141def classDefectTwice [Fintype V] (hm : 0 < m) (C : PathClass V d m) : ℕ :=142Quotient.lift Path.defectTwice143(fun _ _ (h : SamePattern _ _) => h.defectTwice_eq hm) C144145/-- The corrected exploration budget holds directly on genuine equivalence146classes, with no representative or graph invariant supplied by the caller. -/147theorem classImportantTimes_card_le [Fintype V] (hm : 0 < m) (C : PathClass V d m) :148(classImportantTimes C).card ≤ classDefectTwice hm C+2 := by149induction C using Quotient.inductionOn with150| h P => exact P.card_importantTimes_le hm151152end Nonadditivity.HaarPathClasses