Exact Lean source
Nonadditivity.HaarProfilePermutations
Download original .lean · View on GitHub · Jump to source
Direct imports
Nonadditivity.HaarPathRefinedNonadditivity.HaarMatchingCountMathlib.GroupTheory.Perm.Supportdependency
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
13 project constants, including generated, internal and private declarations.
13 declarations
Nonadditivity.HaarProfilePermutations.coreChainProfile_countNonadditivity.HaarProfilePermutations.coreChainProfile_firstNonadditivity.HaarProfilePermutations.coreChainProfile_lastNonadditivity.HaarProfilePermutations.exists_coreChain_positionPermNonadditivity.HaarProfilePermutations.exists_coreChain_positionPerm._proof_1_1internal/detail/privateNonadditivity.HaarProfilePermutations.exists_perm_labels_fixNonadditivity.HaarProfilePermutations.exists_perm_labels_fix._proof_1_3internal/detail/privateNonadditivity.HaarProfilePermutations.exists_perm_labels_fix._simp_1_1internal/detail/privateNonadditivity.HaarProfilePermutations.exists_perm_labels_fix._simp_1_2internal/detail/privateNonadditivity.HaarProfilePermutations.labelEquivNonadditivity.HaarProfilePermutations.labelEquiv_mapNonadditivity.HaarProfilePermutations.restricted_fiber_cardNonadditivity.HaarProfilePermutations.restricted_fiber_card._simp_1_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.HaarPathRefined7import Nonadditivity.HaarMatchingCount8import Mathlib.GroupTheory.Perm.Support910/-! # Profile-preserving permutations of chain positions -/11noncomputable section12attribute [local instance 2000] instBEqOfDecidableEq13attribute [local instance 2000] instBEqOfDecidableEq14set_option backward.isDefEq.respectTransparency false15set_option maxHeartbeats 100000016namespace Nonadditivity.HaarProfilePermutations17open scoped BigOperators18variable {I E : Type*} [Fintype I] [DecidableEq I] [DecidableEq E]1920/-- Equal label-fiber sizes supply an actual label-preserving bijection. -/21def labelEquiv (f g : I → E)22(h : ∀ e, Fintype.card {i // f i=e}=Fintype.card {i // g i=e}) : I ≃ I :=23Equiv.ofFiberEquiv (fun e => Fintype.equivOfCardEq (h e))2425theorem labelEquiv_map (f g : I → E)26(h : ∀ e, Fintype.card {i // f i=e}=Fintype.card {i // g i=e}) (i : I) :27g (labelEquiv f g h i)=f i := Equiv.ofFiberEquiv_map _ i2829lemma restricted_fiber_card (f : I → E) (S : Finset I) (e : E) :30Fintype.card {i : {i : I // i ∉ S} // f i.val=e} =31((Finset.univ.filter (fun i => f i=e)).filter (fun i => i ∉ S)).card := by32let e' : {i : {i : I // i ∉ S} // f i.val=e} ≃ {i : I // i ∉ S ∧ f i=e} :=33⟨fun i => ⟨i.val.val,i.val.property,i.property⟩,34fun i => ⟨⟨i.val,i.property.1⟩,i.property.2⟩,35fun _ => rfl,fun _ => rfl⟩36rw [Fintype.card_congr e',Fintype.card_subtype,Finset.filter_filter]37congr 138ext i39simp [and_comm]4041/-- A matching can be chosen to fix any designated positions at which the42labels already agree. This is used for the first and last edges of a chain. -/43theorem exists_perm_labels_fix (f g : I → E) (S : Finset I)44(hcount : ∀ e, Fintype.card {i // f i=e}=Fintype.card {i // g i=e})45(hfix : ∀ i ∈ S, f i=g i) :46∃ σ : Equiv.Perm I, (∀ i, g (σ i)=f i) ∧ ∀ i ∈ S, σ i=i := by47have hr : ∀ e, Fintype.card {i : {i : I // i ∉ S} // f i.val=e} =48Fintype.card {i : {i : I // i ∉ S} // g i.val=e} := by49intro e50rw [restricted_fiber_card,restricted_fiber_card]51have hc := hcount e52rw [Fintype.card_subtype,Fintype.card_subtype] at hc53have hs : ((Finset.univ.filter (fun i => f i=e)).filter (fun i => i ∈ S)) =54((Finset.univ.filter (fun i => g i=e)).filter (fun i => i ∈ S)) := by55ext i56simp only [Finset.mem_filter,Finset.mem_univ,true_and]57constructor58· rintro ⟨he,hi⟩59exact ⟨(hfix i hi).symm.trans he,hi⟩60· rintro ⟨he,hi⟩61exact ⟨(hfix i hi).trans he,hi⟩62have h₁ := Finset.card_filter_add_card_filter_not63(s := Finset.univ.filter (fun i => f i=e)) (fun i => i ∈ S)64have h₂ := Finset.card_filter_add_card_filter_not65(s := Finset.univ.filter (fun i => g i=e)) (fun i => i ∈ S)66rw [hs] at h₁67omega68let e := labelEquiv (fun i : {i : I // i ∉ S} => f i.val)69(fun i : {i : I // i ∉ S} => g i.val) hr70refine ⟨Equiv.Perm.ofSubtype e,?_,?_⟩71· intro i72by_cases hi : i ∈ S73· rw [Equiv.Perm.ofSubtype_apply_of_not_mem e (by simpa using hi)]74exact (hfix i hi).symm75· rw [Equiv.Perm.ofSubtype_apply_of_mem e hi]76exact labelEquiv_map _ _ hr ⟨i,hi⟩77· intro i hi78exact Equiv.Perm.ofSubtype_apply_of_not_mem e (by simpa using hi)7980section Chains81open HaarPathGraph HaarPathClasses82variable {V : Type*} [Fintype V] [DecidableEq V] {d m : ℕ}83variable {P Q : Path V d m}8485lemma coreChainProfile_count (c : P.CoreChain) (a : HaarPathProfiles.Color d) :86(P.coreChainProfile c).val.count a=(c.val.map color).count a := by87obtain ⟨q,l,he,hq⟩ := c.property.288simp [Path.coreChainProfile,he,HaarPathProfiles.wordProfile]8990lemma coreChainProfile_first (c : P.CoreChain) :91(P.coreChainProfile c).val.first=color (c.val.head (P.toCore_nonempty c.property.1)) := rfl9293lemma coreChainProfile_last (c : P.CoreChain) :94(P.coreChainProfile c).val.last=color (c.val.getLast (P.toCore_nonempty c.property.1)) := by95obtain ⟨q,l,he,hq⟩ := c.property.296simp only [Path.coreChainProfile,he,HaarPathProfiles.wordProfile,List.head_cons,List.tail_cons]97exact List.getLast_map (l := q::l) (f := color) (by simp)9899/-- Equal profiles give a permutation of edge positions preserving colors100and fixing the first and last positions, including chains of length one. -/101theorem exists_coreChain_positionPerm (h : RefinedPattern P Q) (c : P.CoreChain) :102∃ σ : Equiv.Perm (Fin c.val.length),103(∀ i, color (h.samePattern.dartPerm (c.val.get (σ i)))=color (c.val.get i)) ∧104∀ i, (i.val=0 ∨ i.val+1=c.val.length) → σ i=i := by105classical106let f : Fin c.val.length → HaarPathProfiles.Color d := fun i => color (c.val.get i)107let g : Fin c.val.length → HaarPathProfiles.Color d :=108fun i => color (h.samePattern.dartPerm (c.val.get i))109let S := Finset.univ.filter (fun i : Fin c.val.length => i.val=0 ∨ i.val+1=c.val.length)110have hprofile := h.profile_eq c111have hcount : ∀ a, Fintype.card {i // f i=a}=Fintype.card {i // g i=a} := by112intro a113have he := congrArg (fun p : HaarPathProfiles.BoundedProfile (HaarPathProfiles.Color d) m => p.val.count a) hprofile114dsimp only at he115rw [coreChainProfile_count,coreChainProfile_count] at he116simp only [SamePattern.coreChainEquiv_apply,SamePattern.coreChainMap_val,List.map_map] at he117rw [Fintype.card_subtype,Fintype.card_subtype,118←HaarMatchingCount.count_ofFn_eq_card,←HaarMatchingCount.count_ofFn_eq_card]119simpa only [f,g,List.ofFn_comp',List.ofFn_get,List.map_map] using he120have hfirst : color (c.val.head (P.toCore_nonempty c.property.1)) =121color (h.samePattern.dartPerm (c.val.head (P.toCore_nonempty c.property.1))) := by122have he := congrArg (fun p : HaarPathProfiles.BoundedProfile (HaarPathProfiles.Color d) m => p.val.first) hprofile123simpa only [coreChainProfile_first,SamePattern.coreChainEquiv_apply,124SamePattern.coreChainMap_val,List.head_map] using he125have hlast : color (c.val.getLast (P.toCore_nonempty c.property.1)) =126color (h.samePattern.dartPerm (c.val.getLast (P.toCore_nonempty c.property.1))) := by127have he := congrArg (fun p : HaarPathProfiles.BoundedProfile (HaarPathProfiles.Color d) m => p.val.last) hprofile128simpa only [coreChainProfile_last,SamePattern.coreChainEquiv_apply,129SamePattern.coreChainMap_val,List.getLast_map] using he130have hfix : ∀ i ∈ S, f i=g i := by131intro i hi132have hi' := (Finset.mem_filter.mp hi).2133change color (c.val.get i)=color (h.samePattern.dartPerm (c.val.get i))134rcases hi' with hi | hi135· have he : c.val.get i=c.val.head (P.toCore_nonempty c.property.1) := by136simp only [List.get_eq_getElem,List.head_eq_getElem,hi]137simpa only [he] using hfirst138· have he : c.val.get i=c.val.getLast (P.toCore_nonempty c.property.1) := by139simp only [List.get_eq_getElem,List.getLast_eq_getElem]140congr 1141omega142simpa only [he] using hlast143obtain ⟨σ,hσ,hS⟩ := exists_perm_labels_fix f g S hcount hfix144exact ⟨σ,hσ,fun i hi => hS i (by simp [S,hi])⟩145146end Chains147end Nonadditivity.HaarProfilePermutations