Exact Lean source
Nonadditivity.HaarChainMultiplicity
Download original .lean · View on GitHub · Jump to source
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
18 project constants, including generated, internal and private declarations.
18 declarations
Nonadditivity.HaarPathGraph.Path.chainEdgesNonadditivity.HaarPathGraph.Path.chainEdges.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.chainEdges_countNonadditivity.HaarPathGraph.Path.chainEdges_mem_of_label_eqNonadditivity.HaarPathGraph.Path.chainEdges_reverseNonadditivity.HaarPathGraph.Path.chainLabel_eq_of_common_edgeNonadditivity.HaarPathGraph.Path.count_flatMap_chainEdgesNonadditivity.HaarPathGraph.Path.count_flatMap_chainEdges._proof_1_1internal/detail/privateNonadditivity.HaarPathGraph.Path.edgeList_eq_flatMap_chainEdgesNonadditivity.HaarPathGraph.Path.edge_count_eq_chain_countNonadditivity.HaarPathGraph.Path.edge_mem_labelEdgesNonadditivity.HaarPathGraph.Path.labelEdgesNonadditivity.HaarPathGraph.Path.labelEdges.eq_1internal/detail/privateNonadditivity.HaarPathGraph.Path.labelEdges_cardNonadditivity.HaarPathGraph.Path.labelEdges_disjointNonadditivity.HaarPathGraph.Path.labelEdges_subsetNonadditivity.HaarPathGraph.Path.singletonEdges_card_eq_chain_lengthsNonadditivity.HaarPathGraph.Path.singletonEdges_eq_biUnion
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarCoreChainLabels7import Nonadditivity.HaarPathChainProfiles89/-! # Edge multiplicities in the actual maximal-chain decomposition1011An original colored edge occurs exactly as often as its orientation-free12core-chain label. In particular the singleton edge budget is exactly the sum13of the lengths of singleton core chains.14-/15noncomputable section16open scoped BigOperators17namespace Nonadditivity.HaarPathGraph.Path18variable {V : Type*} [DecidableEq V] {d m : ℕ} (P : Path V d m)1920def chainEdges (c : P.CoreChain) : List (Edge V d) := c.val.map Prod.fst2122@[simp] theorem chainEdges_reverse (c : P.CoreChain) :23P.chainEdges (P.coreChainReverse c) = (P.chainEdges c).reverse := by24change ((c.val.reverse.map reverse).map Prod.fst) = (c.val.map Prod.fst).reverse25simp [List.map_map, reverse, List.map_reverse]2627theorem chainLabel_eq_of_common_edge (c c' : P.CoreChain) {e : Edge V d}28(he : e ∈ P.chainEdges c) (he' : e ∈ P.chainEdges c') :29P.chainLabel c = P.chainLabel c' := by30obtain ⟨q,hq,hqe⟩ := List.mem_map.mp he31obtain ⟨q',hq',hq'e⟩ := List.mem_map.mp he'32have hfst : q.1 = q'.1 := hqe.trans hq'e.symm33have hor : q = q' ∨ q = reverse q' := by34obtain ⟨a,b⟩ := q35obtain ⟨a',b'⟩ := q'36change a=a' at hfst37subst a'38cases b <;> cases b' <;> simp [reverse]39rcases hor with rfl | hrev40· rw [P.coreChain_eq_of_common_dart c c' hq hq']41· have hmem : q ∈ (P.coreChainReverse c').val := by42change q ∈ c'.val.reverse.map reverse43exact List.mem_map.mpr ⟨q',List.mem_reverse.mpr hq',hrev.symm⟩44rw [P.coreChain_eq_of_common_dart c (P.coreChainReverse c') hq hmem,45P.chainLabel_reverse]4647theorem chainEdges_mem_of_label_eq (c c' : P.CoreChain)48(h : P.chainLabel c = P.chainLabel c') {e : Edge V d}49(he : e ∈ P.chainEdges c) : e ∈ P.chainEdges c' := by50have hmem : c ∈ ({c',P.coreChainReverse c'} : Finset P.CoreChain) := by51have hv := congrArg Subtype.val h52change {c,P.coreChainReverse c} = {c',P.coreChainReverse c'} at hv53rw [←hv]54simp55rcases Finset.mem_insert.mp hmem with rfl | hc56· exact he57· have hc := Finset.mem_singleton.mp hc58simpa [hc] using he5960theorem chainEdges_count (c c' : P.CoreChain) {e : Edge V d}61(he : e ∈ P.chainEdges c') :62(P.chainEdges c).count e = if P.chainLabel c = P.chainLabel c' then 1 else 0 := by63split_ifs with h64· exact List.count_eq_one_of_mem (P.coreChain_edges_nodup c)65(P.chainEdges_mem_of_label_eq c' c h.symm he)66· apply List.count_eq_zero.mpr67intro hc68exact h (P.chainLabel_eq_of_common_edge c c' hc he)6970theorem edgeList_eq_flatMap_chainEdges (cs : List P.CoreChain)71(hcs : (cs.map Subtype.val).flatten = P.traversalList) :72P.edgeList = cs.flatMap P.chainEdges := by73have hh := congrArg (List.map Prod.fst) hcs74have he : P.traversalList.map Prod.fst = P.edgeList := by75simp only [traversalList,edgeList,List.map_ofFn]76rfl77rw [he,List.map_flatten,List.map_map] at hh78exact hh.symm7980theorem count_flatMap_chainEdges (cs : List P.CoreChain) (c : P.CoreChain)81{e : Edge V d} (he : e ∈ P.chainEdges c) :82(cs.flatMap P.chainEdges).count e = (cs.map P.chainLabel).count (P.chainLabel c) := by83induction cs with84| nil => simp85| cons a cs ih =>86simp only [List.flatMap_cons,List.count_append,List.map_cons,List.count_cons]87rw [P.chainEdges_count a c he,ih]88by_cases h : P.chainLabel a = P.chainLabel c89· simp [h]90omega91· simp [h]9293theorem edge_count_eq_chain_count (cs : List P.CoreChain)94(hcs : (cs.map Subtype.val).flatten = P.traversalList)95(c : P.CoreChain) {e : Edge V d} (he : e ∈ P.chainEdges c) :96P.edgeList.count e = (cs.map P.chainLabel).count (P.chainLabel c) := by97rw [P.edgeList_eq_flatMap_chainEdges cs hcs]98exact P.count_flatMap_chainEdges cs c he99100def labelEdges (e : P.unorientedChains) : Finset (Edge V d) :=101(P.chainEdges (P.representative e)).toFinset102103theorem labelEdges_card (e : P.unorientedChains) :104(P.labelEdges e).card = (P.representative e).val.length := by105rw [labelEdges,chainEdges,List.toFinset_card_of_nodup (P.coreChain_edges_nodup _)]106exact List.length_map _107108theorem labelEdges_disjoint {e e' : P.unorientedChains} (h : e ≠ e') :109Disjoint (P.labelEdges e) (P.labelEdges e') := by110apply Finset.disjoint_left.mpr111intro q hq hq'112apply h113have he := P.chainLabel_eq_of_common_edge (P.representative e) (P.representative e')114(List.mem_toFinset.mp hq) (List.mem_toFinset.mp hq')115simpa [P.label_representative] using he116117theorem edge_mem_labelEdges (cs : List P.CoreChain)118(hcs : (cs.map Subtype.val).flatten = P.traversalList)119(q : Edge V d) (hq : q ∈ P.edges) :120∃ e : P.unorientedChains, q ∈ P.labelEdges e := by121have hm : q ∈ cs.flatMap P.chainEdges := by122rw [←P.edgeList_eq_flatMap_chainEdges cs hcs]123exact List.mem_toFinset.mp hq124obtain ⟨c,hc,hqc⟩ := List.mem_flatMap.mp hm125refine ⟨P.chainLabel c,List.mem_toFinset.mpr ?_⟩126exact P.chainEdges_mem_of_label_eq c (P.representative (P.chainLabel c))127(P.label_representative _).symm hqc128129theorem labelEdges_subset (e : P.unorientedChains) : P.labelEdges e ⊆ P.edges := by130intro q hq131obtain ⟨a,ha,rfl⟩ := List.mem_map.mp (List.mem_toFinset.mp hq)132exact (Finset.mem_product.mp (P.toCore_mem (P.representative e).property.1 ha)).1133134theorem singletonEdges_eq_biUnion (cs : List P.CoreChain)135(hcs : (cs.map Subtype.val).flatten = P.traversalList) :136HaarPathMultiplicity.singletonEdges P.edgeList =137(Finset.univ.filter (fun e => (cs.map P.chainLabel).count e = 1)).biUnion138P.labelEdges := by139ext q140constructor141· intro hq142obtain ⟨hqe,hcount⟩ := Finset.mem_filter.mp hq143obtain ⟨e,he⟩ := P.edge_mem_labelEdges cs hcs q hqe144refine Finset.mem_biUnion.mpr ⟨e,Finset.mem_filter.mpr ⟨Finset.mem_univ _,?_⟩,he⟩145have hh := P.edge_count_eq_chain_count cs hcs (P.representative e)146(List.mem_toFinset.mp he)147have hcount' : P.edgeList.count q=1 := by148simpa only [List.count_eq_countP,Bool.beq_eq_decide_eq] using hcount149simpa [P.label_representative] using hh.symm.trans hcount'150· intro hq151obtain ⟨e,he,hqe⟩ := Finset.mem_biUnion.mp hq152refine Finset.mem_filter.mpr ⟨P.labelEdges_subset e hqe,?_⟩153have hh := P.edge_count_eq_chain_count cs hcs (P.representative e)154(List.mem_toFinset.mp hqe)155simpa only [List.count_eq_countP,Bool.beq_eq_decide_eq] using hh.trans156(by simpa [P.label_representative] using (Finset.mem_filter.mp he).2)157158/-- Exact transfer of the original singleton budget to compressed labels. -/159theorem singletonEdges_card_eq_chain_lengths (cs : List P.CoreChain)160(hcs : (cs.map Subtype.val).flatten = P.traversalList) :161(HaarPathMultiplicity.singletonEdges P.edgeList).card =162∑ e ∈ Finset.univ.filter (fun e => (cs.map P.chainLabel).count e = 1),163(P.representative e).val.length := by164rw [P.singletonEdges_eq_biUnion cs hcs]165rw [Finset.card_biUnion]166· exact Finset.sum_congr rfl (fun e he => P.labelEdges_card e)167· intro e he e' he' hne168exact P.labelEdges_disjoint hne169170end Nonadditivity.HaarPathGraph.Path