Exact Lean source
Nonadditivity.HaarPathFreshRuns
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
33 project constants, including generated, internal and private declarations.
33 declarations
Nonadditivity.HaarPathClasses.OutgoingMarkNonadditivity.HaarPathClasses.PrefixSamePatternNonadditivity.HaarPathClasses.incidenceIndex.eq_1internal/detail/privateNonadditivity.HaarPathClasses.incidenceIndex_le_of_beforeNonadditivity.HaarPathClasses.incidenceIndex_le_of_before._proof_1_2internal/detail/privateNonadditivity.HaarPathClasses.incidenceIndex_le_of_before._proof_1_3internal/detail/privateNonadditivity.HaarPathClasses.incidence_at_fresh_vertex_uniqueNonadditivity.HaarPathClasses.incidence_at_fresh_vertex_unique._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.incidence_at_fresh_vertex_unique._proof_1_2internal/detail/privateNonadditivity.HaarPathClasses.incidence_at_fresh_vertex_unique._proof_1_3internal/detail/privateNonadditivity.HaarPathClasses.outgoingMark_after_firstVisitNonadditivity.HaarPathClasses.prefixSamePattern_extend_after_firstVisitNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisitNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisit._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisit._proof_1_2internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisit._proof_1_3internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisit._proof_1_5internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisit._proof_1_6internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisit._proof_1_8internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_extend_firstVisit._simp_1_7internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_runNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_2internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_3internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_4internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_5internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_6internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_7internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_8internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fresh_run._proof_1_9internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_fullNonadditivity.HaarPathClasses.prefixSamePattern_full._proof_1_1internal/detail/privateNonadditivity.HaarPathClasses.prefixSamePattern_mono
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathClasses78/-! # Fresh exploration runs carry no internal color marks910When a path discovers a fresh vertex, only the outgoing color at the old11vertex needs a mark. At every later step of a consecutive discovery run,12the only previous incidence is the incoming edge; reduction forces the new13outgoing color to be distinct. Thus all subsequent equality patterns are14determined without additional marks.15-/1617noncomputable section18namespace Nonadditivity.HaarPathClasses19open HaarPathGraph HaarPathProfiles2021variable {V : Type*} [DecidableEq V] {d m : ℕ}2223/-- The exact vertex and local-color equality patterns of a path prefix. -/24def PrefixSamePattern (P Q : Path V d m) (k : ℕ) : Prop :=25(∀ i j : Fin (m+1), i.val ≤ k → j.val ≤ k →26(P.vertex i=P.vertex j ↔ Q.vertex i=Q.vertex j)) ∧27∀ a b : Incidence m, a.1.val < k → b.1.val < k →28incidenceVertex P a=incidenceVertex P b →29(incidenceColor P a=incidenceColor P b ↔ incidenceColor Q a=incidenceColor Q b)3031omit [DecidableEq V] in32theorem prefixSamePattern_mono {P Q : Path V d m} {j k : ℕ}33(h : PrefixSamePattern P Q k) (hjk : j ≤ k) : PrefixSamePattern P Q j := by34exact ⟨fun a b ha hb => h.1 a b (ha.trans hjk) (hb.trans hjk),35fun a b ha hb => h.2 a b (ha.trans_le hjk) (hb.trans_le hjk)⟩3637omit [DecidableEq V] in38theorem prefixSamePattern_full {P Q : Path V d m}39(h : PrefixSamePattern P Q m) : SamePattern P Q := by40exact ⟨fun i j => h.1 i j (by omega) (by omega),41fun a b => h.2 a b a.1.isLt b.1.isLt⟩4243theorem incidenceIndex_le_of_before (a : Incidence m) {k : ℕ}44(ha : a.1.val < k) : (incidenceIndex a).val ≤ k := by45obtain ⟨a,b⟩ := a46change a.val < k at ha47cases b <;> simp only [incidenceIndex, Bool.false_eq_true, if_false, if_true,48Fin.val_succ, Fin.val_castSucc] <;> omega4950/-- The sole new color information at a first visit is its outgoing color's51equality pattern with old incidences at the starting vertex. -/52def OutgoingMark (P Q : Path V d m) (i : Fin m) : Prop :=53∀ a : Incidence m, a.1.val < i.val →54incidenceVertex P a=P.vertex i.castSucc →55(incidenceColor P a=P.colors i ↔ incidenceColor Q a=Q.colors i)5657/-- Extend the full observable pattern by one fresh-vertex step. The proof58uses the literal two incidences of the new edge. -/59theorem prefixSamePattern_extend_firstVisit (P Q : Path V d m) (i : Fin m)60(hp : PrefixSamePattern P Q i.val) (hP : P.FirstVisit i) (hQ : Q.FirstVisit i)61(hmark : OutgoingMark P Q i) : PrefixSamePattern P Q (i.val+1) := by62constructor63· intro a b ha hb64by_cases hai : a.val ≤ i.val65· by_cases hbi : b.val ≤ i.val66· exact hp.1 a b hai hbi67· have he : b=i.succ := Fin.ext (by simp; omega)68subst b69exact iff_of_false (hP a hai) (hQ a hai)70· have he : a=i.succ := Fin.ext (by simp; omega)71subst a72by_cases hbi : b.val ≤ i.val73· exact iff_of_false (Ne.symm (hP b hbi)) (Ne.symm (hQ b hbi))74· have he : b=i.succ := Fin.ext (by simp; omega)75subst b76simp77· have holdnew (a : Incidence m) (ha : a.1.val < i.val) (b : Bool)78(hab : incidenceVertex P a=incidenceVertex P (i,b)) :79(incidenceColor P a=incidenceColor P (i,b) ↔80incidenceColor Q a=incidenceColor Q (i,b)) := by81cases b with82| false =>83exact (hP (incidenceIndex a) (incidenceIndex_le_of_before a ha)84(by simpa only [incidenceVertex_eq, incidenceIndex, if_false] using hab)).elim85| true => exact hmark a ha hab86have hnewnew (a b : Bool)87(hab : incidenceVertex P (i,a)=incidenceVertex P (i,b)) :88(incidenceColor P (i,a)=incidenceColor P (i,b) ↔89incidenceColor Q (i,a)=incidenceColor Q (i,b)) := by90have hn := hP i.castSucc (show i.castSucc.val ≤ i.val from le_rfl)91cases a <;> cases b92· simp93· exact (hn hab.symm).elim94· exact (hn hab).elim95· simp96rintro ⟨a,ab⟩ ⟨b,bb⟩ ha hb hab97by_cases hai : a.val < i.val98· by_cases hbi : b.val < i.val99· exact hp.2 (a,ab) (b,bb) hai hbi hab100· have he : b=i := Fin.ext (by change b.val < i.val+1 at hb; omega)101subst b102exact holdnew (a,ab) hai bb hab103· have he : a=i := Fin.ext (by change a.val < i.val+1 at ha; omega)104subst a105by_cases hbi : b.val < i.val106· simpa only [eq_comm] using holdnew (b,bb) hbi ab hab.symm107· have he : b=i := Fin.ext (by change b.val < i.val+1 at hb; omega)108subst b109exact hnewnew ab bb hab110111/-- Immediately after a first visit, the previous incoming incidence is the112only old incidence at the current vertex. -/113theorem incidence_at_fresh_vertex_unique (P : Path V d m) (i j : Fin m)114(hij : i.val+1=j.val) (hi : P.FirstVisit i)115(a : Incidence m) (ha : a.1.val < j.val)116(hv : incidenceVertex P a=P.vertex j.castSucc) : a=(i,false) := by117have hji : j.castSucc=i.succ := Fin.ext (by simp; omega)118rw [hji] at hv119obtain ⟨a,b⟩ := a120change a.val < j.val at ha121cases b with122| true =>123exact (hi a.castSucc (by change a.val ≤ i.val; omega) hv).elim124| false =>125have hai : a.val=i.val := by126by_contra hn127have hlt : a.val < i.val := by omega128exact hi a.succ (by simp; omega) hv129exact congrArg (fun k : Fin m => (k,false)) (Fin.ext hai)130131/-- No color mark is needed after a fresh visit: reducedness fixes the only132possible comparison with the previous incoming incidence. -/133theorem outgoingMark_after_firstVisit (P Q : Path V d m) (i j : Fin m)134(hij : i.val+1=j.val) (hi : P.FirstVisit i) : OutgoingMark P Q j := by135intro a ha hv136have he := incidence_at_fresh_vertex_unique P i j hij hi a ha hv137subst a138exact iff_of_false (Ne.symm (P.reduced i j hij)) (Ne.symm (Q.reduced i j hij))139140theorem prefixSamePattern_extend_after_firstVisit (P Q : Path V d m) (i j : Fin m)141(hij : i.val+1=j.val) (hp : PrefixSamePattern P Q j.val)142(hi : P.FirstVisit i) (hP : P.FirstVisit j) (hQ : Q.FirstVisit j) :143PrefixSamePattern P Q (j.val+1) :=144prefixSamePattern_extend_firstVisit P Q j hp hP hQ145(outgoingMark_after_firstVisit P Q i j hij hi)146147/-- An entire consecutive fresh run is determined by its first-step pattern.148The induction adds no further outgoing-color marks. -/149theorem prefixSamePattern_fresh_run (P Q : Path V d m) (s t : ℕ)150(hst : s < t) (htm : t ≤ m) (hp : PrefixSamePattern P Q (s+1))151(hfresh : ∀ i : Fin m, s ≤ i.val → i.val < t → P.FirstVisit i ∧ Q.FirstVisit i) :152PrefixSamePattern P Q t := by153have hmain : ∀ k, s+1 ≤ k → k ≤ t → PrefixSamePattern P Q k := by154intro k hsk155induction k, hsk using Nat.le_induction with156| base => exact fun _ => hp157| succ k hsk ih =>158intro hkt159let i : Fin m := ⟨k-1,by omega⟩160let j : Fin m := ⟨k,by omega⟩161have hij : i.val+1=j.val := by dsimp [i,j]; omega162have hi := (hfresh i (by dsimp [i]; omega) (by dsimp [i]; omega)).1163have hj := hfresh j (by dsimp [j]; omega) (by dsimp [j]; omega)164exact prefixSamePattern_extend_after_firstVisit P Q i j hij165(ih (by omega)) hi hj.1 hj.2166exact hmain t (by omega) le_rfl167168end Nonadditivity.HaarPathClasses