Download data/lean/OAI/Combinatorics/MatchingPSD/CutGeometry.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingPSD/CutGeometry.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingPSD/CutGeometry.lean
-
curl -L -o CutGeometry.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingPSD/CutGeometry.lean
4.6 kB
| import OAI.Combinatorics.MatchingPSD.AdmissiblePoints | |
| namespace OAI | |
| universe u_1 u_2 u_3 u_4 u_5 u_6 u_7 u_8 u_9 u_10 u_11 u_12 u_13 u_14 u_15 | |
| namespace MatchingSmoothing | |
| open scoped BigOperators | |
| attribute [local instance] Classical.propDecidable | |
| abbrev GlobalVertices (s q : β) := | |
| (Fin (2*s+1) β Fin (2*s+1)) β (Fin q Γ (Fin s Γ Bool)) | |
| def localCutColor (b : Bool) : Fin 3 β Bool := ![true,false,b] | |
| def globalCutColor {A : Type u_1} {B : Type u_2} {C : Type u_3} {I : Type u_4} (y : I β Bool) : (A β B) β (I Γ C) β Bool := | |
| Sum.elim (Sum.elim (fun _ => true) (fun _ => false)) (fun v => y v.1) | |
| lemma tableCoordinate_localcut {V : Type u_5} [Fintype V] (z : V β Fin 3) | |
| (M : Pairing V) (b : Bool) : | |
| tableCoordinate (localCutColor b β z) (true,false) M = | |
| crossVector z M 0 + crossVector z M (if b then 2 else 1) := by | |
| cases b | |
| Β· change _ = tableCoordinate z (0,1) M + tableCoordinate z (0,2) M | |
| simp only [tableCoordinate, β Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro v _ | |
| rcases (show z v=0 β¨ z v=1 β¨ z v=2 by omega) with hv | hv | hv <;> | |
| rcases (show z (M.1 v)=0 β¨ z (M.1 v)=1 β¨ z (M.1 v)=2 by omega) with hw | hw | hw <;> | |
| simp [Function.comp_apply, hv, hw, localCutColor] | |
| Β· change _ = tableCoordinate z (0,1) M + tableCoordinate z (1,2) M | |
| rw [tableCoordinate_symm z 1 2] | |
| simp only [tableCoordinate, β Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro v _ | |
| rcases (show z v=0 β¨ z v=1 β¨ z v=2 by omega) with hv | hv | hv <;> | |
| rcases (show z (M.1 v)=0 β¨ z (M.1 v)=1 β¨ z (M.1 v)=2 by omega) with hw | hw | hw <;> | |
| simp [Function.comp_apply, hv, hw, localCutColor] | |
| lemma tableCoordinate_cellwise_cut {I : Type u_6} {C : Type u_7} [Fintype I] [Fintype C] | |
| (y : I β Bool) (N : I β Pairing C) : | |
| tableCoordinate (fun v : I Γ C => y v.1) (true,false) (Pairing.cellwise N) = 0 := by | |
| apply (tableCoordinate_eq_zero_iff _ _ _).mpr | |
| rintro β¨j,cβ© β¨h1,h2β© | |
| have he : (true : Bool) = false := h1.symm.trans h2 | |
| cases he | |
| lemma localSplit_cut {A : Type u_8} {B : Type u_9} {C : Type u_10} {I : Type u_11} [DecidableEq I] | |
| (y : I β Bool) (i : I) : | |
| globalCutColor (A := A) (B := B) (C := C) y β localSplitEquiv i = | |
| Sum.elim (localCutColor (y i) β threeColor) | |
| (fun v : {j : I // j β i} Γ C => y v.1.1) := by | |
| funext v | |
| rcases v with (a | c) | β¨j,cβ© | |
| Β· cases a <;> rfl | |
| Β· rfl | |
| Β· rfl | |
| lemma extendLocal_cut {A : Type u_12} {B : Type u_13} {C : Type u_14} {I : Type u_15} [Fintype A] [Fintype B] [Fintype C] | |
| [Fintype I] [DecidableEq I] (y : I β Bool) (i : I) | |
| (M : Pairing ((A β B) β C)) (N : {j : I // j β i} β Pairing C) : | |
| tableCoordinate (globalCutColor y) (true,false) (extendLocal i M N) = | |
| crossVector threeColor M 0 + crossVector threeColor M (if y i then 2 else 1) := by | |
| rw [extendLocal, tableCoordinate_transport, localSplit_cut, tableCoordinate_sum, | |
| tableCoordinate_cellwise_cut (fun j : {j : I // j β i} => y j.1), | |
| add_zero, tableCoordinate_localcut] | |
| lemma globalCutColor_card (s q : β) (y : Fin q β Bool) : | |
| Fintype.card {v : GlobalVertices s q // globalCutColor y v = true} = | |
| 2*s+1 + Fintype.card {i : Fin q // y i = true} * (2*s) := by | |
| classical | |
| have hc (V : Type) [Fintype V] (f : V β Bool) : | |
| Fintype.card {v // f v = true} = histogram f true := by | |
| simp only [Fintype.card_subtype, histogram] | |
| rw [hc, hc] | |
| apply Nat.cast_injective (R := β) | |
| simp only [Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one, | |
| histogram_cast_sum] | |
| simp only [Fintype.sum_sum_type, Fintype.sum_prod_type, globalCutColor, | |
| Sum.elim_inl, Sum.elim_inr, Fintype.sum_bool, ite_true, Bool.false_eq_true, | |
| ite_false, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, | |
| mul_one, mul_zero, add_zero, Finset.sum_add_distrib, Finset.sum_mul, | |
| Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one] | |
| congr 1 | |
| rw [β Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| by_cases h : y i = true <;> simp [h] | |
| ring | |
| lemma globalCutColor_odd (s q : β) (y : Fin q β Bool) : | |
| Odd (Fintype.card {v : GlobalVertices s q // globalCutColor y v = true}) := by | |
| rw [globalCutColor_card] | |
| exact β¨s+Fintype.card {i : Fin q // y i = true}*s, by ringβ© | |
| lemma globalVertices_card (s q : β) : | |
| Fintype.card (GlobalVertices s q) = 2*s*(q+2)+2 := by | |
| simp only [GlobalVertices, Fintype.card_sum, Fintype.card_prod, Fintype.card_fin, | |
| Fintype.card_bool] | |
| ring | |
| end MatchingSmoothing | |
| end OAI | |