Exact Lean source
Nonadditivity.HaarPathNormalizedTreeColors
Download original .lean · View on GitHub · Jump to source
Direct imports
Imported by project modules
2 direct reverse imports
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
14 project constants, including generated, internal and private declarations.
14 declarations
Nonadditivity.HaarPathClasses.normalized_old_tree_colorsNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_2internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_3internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_4internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_5internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_6internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_7internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_colors._proof_1_8internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_reconstructionNonadditivity.HaarPathClasses.normalized_old_tree_reconstruction._proof_1internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_reconstruction._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.normalized_old_tree_reconstruction._proof_2internal/detail/privateNonadditivity.HaarPathClasses.normalized_repeated_edge
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathNormalizedTree78/-! # Old-tree routes reconstruct both normalized incidence labels -/9noncomputable section10set_option maxHeartbeats 150000011set_option linter.unusedSectionVars false12namespace Nonadditivity.HaarPathClasses13open HaarPathGraph HaarPathProfiles14variable {V : Type*} [DecidableEq V] {d m : ℕ}1516theorem normalized_repeated_edge (P Q : Path V d m)17(β γ : V → Equiv.Perm (Color d)) (i k : Fin m)18(hP : P.edgeAt i=P.edgeAt k) (hQ : Q.edgeAt i=Q.edgeAt k)19(hnP : P.vertex k.castSucc ≠ P.vertex k.succ)20(hnQ : Q.vertex k.castSucc ≠ Q.vertex k.succ)21(hv : P.vertex i.castSucc=P.vertex k.castSucc ↔ Q.vertex i.castSucc=Q.vertex k.castSucc)22(hc : ∀ b : Bool, normalizedIncidenceColor P β (k,b)=normalizedIncidenceColor Q γ (k,b)) :23∀ b : Bool, normalizedIncidenceColor P β (i,b)=normalizedIncidenceColor Q γ (i,b) := by24rcases edge_eq_iff.mp hP with ⟨hPx,hPc,hPy⟩ | ⟨hPx,hPc,hPy⟩25· rcases edge_eq_iff.mp hQ with ⟨hQx,hQc,hQy⟩ | ⟨hQx,hQc,hQy⟩26· intro b27cases b28· simpa [normalizedIncidenceColor,incidenceVertex,incidenceColor,29hPx,hPc,hPy,hQx,hQc,hQy] using hc false30· simpa [normalizedIncidenceColor,incidenceVertex,incidenceColor,31hPx,hPc,hPy,hQx,hQc,hQy] using hc true32· exact (hnQ ((hv.mp hPx).symm.trans hQx)).elim33· rcases edge_eq_iff.mp hQ with ⟨hQx,hQc,hQy⟩ | ⟨hQx,hQc,hQy⟩34· exact (hnP ((hv.mpr hQx).symm.trans hPx)).elim35· intro b36cases b37· simpa [normalizedIncidenceColor,incidenceVertex,incidenceColor,38hPx,hPc,hPy,hQx,hQc,hQy,flipColor] using hc true39· simpa [normalizedIncidenceColor,incidenceVertex,incidenceColor,40hPx,hPc,hPy,hQx,hQc,hQy,flipColor] using hc false4142theorem normalized_old_tree_colors (P Q : Path V d m) (hm : 0<m)43(β γ : V → Equiv.Perm (Color d)) (a b : ℕ) (hab : a ≤ b) (hbm : b ≤ m)44(htP : ∀ i : Fin m, a ≤ i.val → i.val<b → P.edgeAt i∈P.treeEdges)45(hoP : ∀ i : Fin m, a ≤ i.val → i.val<b → ¬P.FirstVisit i)46(htQ : ∀ i : Fin m, a ≤ i.val → i.val<b → Q.edgeAt i∈Q.treeEdges)47(hv : ∀ j : Fin (m+1), j.val ≤ b → P.vertexName hm j=Q.vertexName hm j)48(hc : ∀ z : Incidence m, z.1.val<a →49normalizedIncidenceColor P β z=normalizedIncidenceColor Q γ z) :50∀ i : Fin m, a ≤ i.val → i.val<b → ∀ c : Bool,51normalizedIncidenceColor P β (i,c)=normalizedIncidenceColor Q γ (i,c) := by52intro i hai hib53obtain ⟨k,hk,hki⟩ := Finset.mem_image.mp (htP i hai hib)54have hkf := (P.mem_firstTimes k).mp hk55have hki' : k.val ≤ i.val := by56by_contra h57exact P.firstVisit_edge_not_earlier hkf (by omega) hki.symm58have hka : k.val<a := by59by_contra h60exact hoP k (by omega) (by omega) hkf61have hkQ : Q.FirstVisit k := by62intro j hj he63apply hkf j hj64apply (P.vertexName_eq_iff hm j k.succ).mp65rw [hv j (by omega),hv k.succ (by simp; omega)]66exact (Q.vertexName_eq_iff hm j k.succ).mpr he67have hkQt : Q.edgeAt k∈Q.treeEdges := Finset.mem_image.mpr68⟨k,(Q.mem_firstTimes k).mpr hkQ,rfl⟩69have hkPt : P.edgeAt k∈P.treeEdges := Finset.mem_image.mpr ⟨k,hk,rfl⟩70have heN : (P.namedPath hm).edgeAt k=(P.namedPath hm).edgeAt i :=71(P.namedPath_edgeAt_eq_iff hm k i).mpr hki72have heS := (P.namedPath hm).edgeAt_eq_unoriented heN73have heQ : s((Q.namedPath hm).vertex k.castSucc,(Q.namedPath hm).vertex k.succ) =74s((Q.namedPath hm).vertex i.castSucc,(Q.namedPath hm).vertex i.succ) := by75simpa only [Path.namedPath,hv k.castSucc (by simp; omega),hv k.succ (by simp; omega),76hv i.castSucc (by simp; omega),hv i.succ (by simp; omega)] using heS77have hkiQ : Q.edgeAt k=Q.edgeAt i :=78(Q.namedPath_edgeAt_eq_iff hm k i).mp ((Q.namedPath hm).tree_edge_eq_of_unoriented79((Q.namedPath_tree_edge_mem_iff hm k).mpr hkQt)80((Q.namedPath_tree_edge_mem_iff hm i).mpr (htQ i hai hib)) heQ)81have hvertex : P.vertex i.castSucc=P.vertex k.castSucc ↔82Q.vertex i.castSucc=Q.vertex k.castSucc := by83rw [← P.vertexName_eq_iff hm i.castSucc k.castSucc,84← Q.vertexName_eq_iff hm i.castSucc k.castSucc,85hv i.castSucc (by simp; omega),hv k.castSucc (by simp; omega)]86exact normalized_repeated_edge P Q β γ i k hki.symm hkiQ.symm87(P.tree_edge_nonloop hkPt) (Q.tree_edge_nonloop hkQt) hvertex88(fun c => hc (k,c) hka)8990/-- Complete normalized reconstruction of an old-tree interval from the91decoded prefix and the endpoint's first-occurrence name. -/92theorem normalized_old_tree_reconstruction (P Q : Path V d m) (hm : 0<m)93(β γ : V → Equiv.Perm (Color d))94(a bP bQ : ℕ) (haP : a ≤ bP) (haQ : a ≤ bQ) (hPm : bP ≤ m) (hQm : bQ ≤ m)95(htP : ∀ i : Fin m, a ≤ i.val → i.val<bP → P.edgeAt i∈P.treeEdges)96(hoP : ∀ i : Fin m, a ≤ i.val → i.val<bP → ¬P.FirstVisit i)97(htQ : ∀ i : Fin m, a ≤ i.val → i.val<bQ → Q.edgeAt i∈Q.treeEdges)98(hoQ : ∀ i : Fin m, a ≤ i.val → i.val<bQ → ¬Q.FirstVisit i)99(hv : ∀ j : Fin (m+1), j.val ≤ a → P.vertexName hm j=Q.vertexName hm j)100(hc : ∀ z : Incidence m, z.1.val<a →101normalizedIncidenceColor P β z=normalizedIncidenceColor Q γ z)102(he : P.vertexName hm ⟨bP,by omega⟩=Q.vertexName hm ⟨bQ,by omega⟩) :103bP=bQ ∧104(∀ j : Fin (m+1), a ≤ j.val → j.val ≤ bP → P.vertexName hm j=Q.vertexName hm j) ∧105(∀ i : Fin m, a ≤ i.val → i.val<bP → ∀ c : Bool,106normalizedIncidenceColor P β (i,c)=normalizedIncidenceColor Q γ (i,c)) := by107obtain ⟨hb,hv'⟩ := P.named_old_tree_reconstruction Q hm a bP bQ haP haQ hPm hQm108htP hoP htQ hoQ hv he109subst bQ110refine ⟨rfl,hv',?_⟩111apply normalized_old_tree_colors P Q hm β γ a bP haP hPm htP hoP htQ _ hc112intro j hj113by_cases hja : j.val ≤ a114· exact hv j hja115· exact hv' j (by omega) hj116117end Nonadditivity.HaarPathClasses