Exact Lean source
Nonadditivity.HaarChainColoring
Download original .lean · View on GitHub · Jump to source
Direct imports
Imported by project modules
3 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
37 project constants, including generated, internal and private declarations.
37 declarations
Nonadditivity.HaarPathGraph.Path.ChainColoringNonadditivity.HaarPathGraph.Path.ChainColoring._sizeOf_1internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring._sizeOf_instinternal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.casesOnNonadditivity.HaarPathGraph.Path.ChainColoring.colorNonadditivity.HaarPathGraph.Path.ChainColoring.color_eq_of_source_coreNonadditivity.HaarPathGraph.Path.ChainColoring.color_eq_of_source_core._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.color_injective_internalNonadditivity.HaarPathGraph.Path.ChainColoring.color_injective_internal._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.color_injective_internal._proof_1_2internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.color_injective_internal._proof_1_3internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.color_injective_internal._proof_1_4internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.color_injective_internal._proof_1_5internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.color_kernelNonadditivity.HaarPathGraph.Path.ChainColoring.color_positionNonadditivity.HaarPathGraph.Path.ChainColoring.color_reverseNonadditivity.HaarPathGraph.Path.ChainColoring.ctorIdxNonadditivity.HaarPathGraph.Path.ChainColoring.mkNonadditivity.HaarPathGraph.Path.ChainColoring.mk._flat_ctorinternal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.mk.injNonadditivity.HaarPathGraph.Path.ChainColoring.mk.injEqNonadditivity.HaarPathGraph.Path.ChainColoring.mk.noConfusionNonadditivity.HaarPathGraph.Path.ChainColoring.mk.sizeOf_specNonadditivity.HaarPathGraph.Path.ChainColoring.noConfusionNonadditivity.HaarPathGraph.Path.ChainColoring.noConfusionTypeNonadditivity.HaarPathGraph.Path.ChainColoring.recNonadditivity.HaarPathGraph.Path.ChainColoring.recOnNonadditivity.HaarPathGraph.Path.ChainColoring.reversalNonadditivity.HaarPathGraph.Path.ChainColoring.source_core_of_zeroNonadditivity.HaarPathGraph.Path.ChainColoring.source_core_of_zero._proof_1internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.source_not_core_of_posNonadditivity.HaarPathGraph.Path.ChainColoring.source_not_core_of_pos._proof_1internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.source_not_core_of_pos._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.ChainColoring.valueNonadditivity.HaarPathGraph.Path.ChainColoring.value_stepNonadditivity.HaarPathGraph.Path.ChainColoring.value_step._proof_1internal/detail/privateNonadditivity.HaarPathGraph.Path.positionDart.eq_1internal/detail/private
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarCoreChainReverseAddress7import Nonadditivity.HaarPathProfileReverse8import Nonadditivity.HaarCoreChainWords9import Nonadditivity.HaarPathInternalColors1011/-! # Reconstructing graph colors from compatible reduced chain words -/1213noncomputable section14set_option backward.isDefEq.respectTransparency false15set_option maxHeartbeats 12000001617namespace Nonadditivity.HaarPathGraph.Path1819open HaarPathProfiles HaarProfileCoefficient20variable {V : Type*} [DecidableEq V] {d m : ℕ} (P : Path V d m)2122/-- A compatible assignment of actual reduced profile words to all orientations.23Only opposite orientations are related; the unoriented edges remain independent. -/24structure ChainColoring where25value (c : P.CoreChain) : Words d c.val.length (P.coreChainProfile c).val26reversal (p : P.ChainPosition) :27(value (P.reversePosition p).1).val (P.reversePosition p).2 =28flipColor ((value p.1).val p.2)2930namespace ChainColoring31variable {P} (F : P.ChainColoring)3233def color (q : P.darts) : Color d := P.recolor (fun c => (F.value c).val) q3435@[simp] theorem color_position (c : P.CoreChain) (i : Fin c.val.length) :36F.color (P.positionDart ⟨c,i⟩) = (F.value c).val i := P.recolor_position _ c i3738/-- Opposite graph incidences receive opposite signed colors. -/39theorem color_reverse (q : P.darts) :40F.color ⟨reverse q.val,P.reverse_mem q.property⟩ = flipColor (F.color q) := by41obtain ⟨p,rfl⟩ := P.positionDart_surjective q42have he : (⟨reverse (P.positionDart p).val,P.reverse_mem (P.positionDart p).property⟩ : P.darts) =43P.positionDart (P.reversePosition p) := (P.positionDart_reversePosition p).symm44rw [he,color_position,color_position]45exact F.reversal p464748/-- Every noninitial position of a stopped chain has non-core source. -/49theorem source_not_core_of_pos (c : P.CoreChain) (i : Fin c.val.length)50(hi : 0 < i.val) : source c.val[i] ∉ P.coreVertices := by51apply P.toCore_tail_source_not_core c.property.152have ht : i.val-1 < c.val.tail.length := by simp only [List.length_tail]; omega53have hm := List.get_mem c.val.tail (⟨i.val-1,ht⟩ : Fin c.val.tail.length)54simpa only [List.get_eq_getElem,List.getElem_tail,Nat.sub_add_cancel hi] using hm5556/-- The initial source of a complete chain belongs to the core. -/57theorem source_core_of_zero (c : P.CoreChain) (i : Fin c.val.length)58(hi : i.val=0) : source c.val[i] ∈ P.coreVertices := by59obtain ⟨a,l,he,ha⟩ := c.property.260change source c.val[i.val] ∈ P.coreVertices61simpa only [he,hi,List.getElem_cons_zero] using ha6263/-- Endpoint profiles fix all outgoing signed colors at core vertices. -/64theorem color_eq_of_source_core (q : P.darts) (hq : source q.val∈P.coreVertices) :65F.color q=HaarPathGraph.color q.val := by66obtain ⟨⟨c,i⟩,rfl⟩ := P.positionDart_surjective q67have hi : i.val=0 := by68by_contra h69exact source_not_core_of_pos (P := P) c i (Nat.pos_of_ne_zero h) hq70rw [F.color_position]71have hh := (F.value c).property.2.172have hn : 0 < c.val.length := by omega73have hf : (List.ofFn (F.value c).val).head?=some ((F.value c).val ⟨0,hn⟩) := by74rw [List.head?_eq_some_head (by simpa using Nat.ne_of_gt hn),List.head_ofFn]75rw [hf] at hh76have hi' : i=⟨0,hn⟩ := Fin.ext hi77rw [Option.some.injEq] at hh78rw [hi',hh,P.coreChainProfile_first]79simp only [positionDart,List.get_eq_getElem,List.head_eq_getElem]8081/-- Adjacent letters in an assigned reduced profile cannot cancel. -/82theorem value_step (c : P.CoreChain) (i : ℕ) (hi : i + 1 < c.val.length) :83(F.value c).val ⟨i+1,hi⟩ ≠ flipColor ((F.value c).val ⟨i,by omega⟩) := by84intro he85have hr := List.isChain_iff_getElem.mp (F.value c).property.1 i86(by simpa only [List.length_ofFn] using hi)87simp only [List.getElem_ofFn] at hr88rw [he] at hr89have hb := hr rfl90cases h : ((F.value c).val ⟨i,by omega⟩).2 <;> simp [flipColor,h] at hb9192/-- Recoloring preserves injectivity among the two outgoing darts of every93internal vertex, because their colors are adjacent reduced letters. -/94theorem color_injective_internal {q r : P.darts}95(hq : source q.val∉P.coreVertices) (hs : source q.val=source r.val)96(hc : F.color q=F.color r) : q=r := by97by_contra hne98obtain ⟨⟨c,i⟩,hqi⟩ := P.positionDart_surjective q99have hi : 0 < i.val := by100by_contra h101have hi0 : i.val=0 := by omega102exact hq (hqi ▸ source_core_of_zero (P := P) c i hi0)103let j : Fin c.val.length := ⟨i.val-1,by omega⟩104have hji : j.val+1=i.val := by dsimp [j]; omega105have ht := P.toCore_step c.property.1 j.val (by omega)106have he : c.val[j.val+1]=q.val := by107simpa only [hji] using congrArg Subtype.val hqi108rw [he] at ht109let a := P.positionDart ⟨c,j⟩110have hra : r.val=reverse a.val := by111apply P.next_dart_unique q.property r.property (P.reverse_mem a.property) hq hs ht.1.symm112· exact fun h => hne (Subtype.ext h.symm)113· exact ht.2.symm114have hr : r=⟨reverse a.val,P.reverse_mem a.property⟩ := Subtype.ext hra115rw [hr,F.color_reverse,←hqi,F.color_position,F.color_position] at hc116have hstep := F.value_step c j.val (by omega)117have hi' : (⟨j.val+1,by omega⟩ : Fin c.val.length)=i := Fin.ext hji118rw [hi'] at hstep119exact hstep hc120121/-- The assigned profile words preserve the actual local color equality122kernel, which is the defining color constraint of the coarse path class. -/123theorem color_kernel (q r : P.darts) (hs : source q.val=source r.val) :124F.color q=F.color r ↔ HaarPathGraph.color q.val=HaarPathGraph.color r.val := by125by_cases hq : source q.val∈P.coreVertices126· rw [F.color_eq_of_source_core q hq,F.color_eq_of_source_core r (hs ▸ hq)]127· constructor128· intro hc129exact congrArg (fun q : P.darts => HaarPathGraph.color q.val) (F.color_injective_internal hq hs hc)130· intro hc131have he := P.internal_color_injective q.property r.property hq hs hc132exact congrArg F.color (Subtype.ext he)133134end ChainColoring135end Nonadditivity.HaarPathGraph.Path