Exact Lean source
Nonadditivity.HaarPathPrefixTree
Download original .lean · View on GitHub · Jump to source
Imported by project modules
1 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
8 project constants, including generated, internal and private declarations.
8 declarations
Nonadditivity.HaarPathClasses.PrefixRelabeledNonadditivity.HaarPathClasses.prefixSamePattern_firstVisit_iffNonadditivity.HaarPathClasses.prefixSamePattern_firstVisit_iff._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_relabeledNonadditivity.HaarPathClasses.prefixTreeIsoNonadditivity.HaarPathClasses.prefixTreeIso._proof_1internal/detail/privateNonadditivity.HaarPathClasses.prefixTreeIso._proof_2internal/detail/privateNonadditivity.HaarPathClasses.prefix_tree_route_reconstruction
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathFreshRuns7import Nonadditivity.HaarPathClassData89/-! # Relabelling and tree-route reconstruction for known prefixes1011Prefix incidence patterns give actual vertex and local-color permutations.12Those permutations identify the complete discovery trees, so a reduced old13route is determined by its marked endpoint in the already decoded tree.14-/15noncomputable section16namespace Nonadditivity.HaarPathClasses17open HaarPathGraph HaarPathProfiles18variable {V : Type*} {d m : ℕ} [DecidableEq V]19variable {P Q : Path V d m} {k : ℕ}2021/-- Literal relabelling of the portion already decoded. -/22def PrefixRelabeled (P Q : Path V d m) (k : ℕ) : Prop :=23∃ τ : Equiv.Perm V, ∃ β : V → Equiv.Perm (Color d),24(∀ j : Fin (m+1), j.val ≤ k → τ (P.vertex j)=Q.vertex j) ∧25∀ a : Incidence m, a.1.val < k →26β (incidenceVertex P a) (incidenceColor P a)=incidenceColor Q a2728/-- A prefix pattern supplies actual permutations, including arbitrary29extensions on every vertex or color that has not yet been encountered. -/30theorem prefixSamePattern_relabeled [Fintype V]31(h : PrefixSamePattern P Q k) : PrefixRelabeled P Q k := by32classical33obtain ⟨τ,hτ⟩ := exists_perm_of_kernel_eq34(fun j : {j : Fin (m+1) // j.val ≤ k} => P.vertex j.val)35(fun j : {j : Fin (m+1) // j.val ≤ k} => Q.vertex j.val)36(fun a b => h.1 a.val b.val a.property b.property)37have hlocal (v : V) : ∃ β : Equiv.Perm (Color d),38∀ a : {a : Incidence m // a.1.val < k ∧ incidenceVertex P a=v},39β (incidenceColor P a.val)=incidenceColor Q a.val := by40apply exists_perm_of_kernel_eq41intro a b42exact h.2 a.val b.val a.property.1 b.property.143(a.property.2.trans b.property.2.symm)44choose β hβ using hlocal45refine ⟨τ,β,fun j hj => hτ ⟨j,hj⟩,fun a ha => ?_⟩46exact hβ (incidenceVertex P a) ⟨a,ha,rfl⟩4748theorem prefixSamePattern_firstVisit_iff49(h : PrefixSamePattern P Q k) (i : Fin m) (hi : i.val < k) :50P.FirstVisit i ↔ Q.FirstVisit i := by51constructor52· intro hp j hj he53exact hp j hj ((h.1 j i.succ (by omega) (by simp; omega)).mpr he)54· intro hq j hj he55exact hq j hj ((h.1 j i.succ (by omega) (by simp; omega)).mp he)5657/-- The vertex permutation of a known prefix identifies its actual discovery58tree with that of the other path. No final-graph data is used. -/59def prefixTreeIso (h : PrefixSamePattern P Q k) (τ : Equiv.Perm V)60(hτ : ∀ j : Fin (m+1), j.val ≤ k → τ (P.vertex j)=Q.vertex j) :61P.discoveryGraph k ≃g Q.discoveryGraph k where62toEquiv := τ63map_rel_iff' := by64intro x y65constructor66· rintro ⟨i,hi,hik,hxy⟩67have hP := (prefixSamePattern_firstVisit_iff h i hik).mpr hi68have hs := hτ i.castSucc (by simp; omega)69have ht := hτ i.succ (by simp; omega)70refine ⟨i,hP,hik,?_⟩71rcases hxy with ⟨hx,hy⟩ | ⟨hx,hy⟩72· exact Or.inl ⟨τ.injective (hx.trans hs.symm),τ.injective (hy.trans ht.symm)⟩73· exact Or.inr ⟨τ.injective (hx.trans ht.symm),τ.injective (hy.trans hs.symm)⟩74· rintro ⟨i,hi,hik,hxy⟩75have hQ := (prefixSamePattern_firstVisit_iff h i hik).mp hi76have hs := hτ i.castSucc (by simp; omega)77have ht := hτ i.succ (by simp; omega)78refine ⟨i,hQ,hik,?_⟩79rcases hxy with ⟨rfl,rfl⟩ | ⟨rfl,rfl⟩80· exact Or.inl ⟨hs,ht⟩81· exact Or.inr ⟨ht,hs⟩8283/-- Reduced tree routes between corresponding marked endpoints agree after84transport through the decoded prefix. This is the non-circular tree-run85reconstruction step. -/86theorem prefix_tree_route_reconstruction87(h : PrefixSamePattern P Q k) (τ : Equiv.Perm V)88(hτ : ∀ j : Fin (m+1), j.val ≤ k → τ (P.vertex j)=Q.vertex j)89{x y : V} (a : (P.discoveryGraph k).Walk x y)90(b : (Q.discoveryGraph k).Walk (τ x) (τ y))91(ha : a.edges.IsChain (· ≠ ·)) (hb : b.edges.IsChain (· ≠ ·)) :92a.map (prefixTreeIso h τ hτ).toHom=b := by93let e := prefixTreeIso h τ hτ94have hap := ((P.discoveryGraph_isAcyclic k).isPath_iff_isChain a).mpr ha95have hbp := ((Q.discoveryGraph_isAcyclic k).isPath_iff_isChain b).mpr hb96have ham : (a.map e.toHom).IsPath := SimpleGraph.Walk.map_isPath_of_injective e.injective hap97exact congrArg Subtype.val ((Q.discoveryGraph_isAcyclic k).path_unique98⟨a.map e.toHom,ham⟩ ⟨b,hbp⟩)99100end Nonadditivity.HaarPathClasses