Download data/lean/OAI/Combinatorics/Crossing/AffineSideEvents.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.83 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/Crossing/AffineSideEvents.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/Crossing/AffineSideEvents.lean
-
curl -L -o AffineSideEvents.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/Crossing/AffineSideEvents.lean
2.83 kB
| import OAI.Combinatorics.Crossing.StepEvents | |
| import Mathlib.Tactic.FieldSimp | |
| namespace OAI | |
| noncomputable section | |
| namespace Zarankiewicz | |
| open scoped BigOperators | |
| def positiveIndicator (x : β) : β := if 0 < x then 1 else 0 | |
| def slopeSign (b : β) : β := if 0 < b then 1 else -1 | |
| def sideBefore (b : β) : β := if 0 < b then 0 else 1 | |
| def sideAfter (b : β) : β := if 0 < b then 1 else 0 | |
| theorem sideAfter_sub_before (b : β) : sideAfter b-sideBefore b = slopeSign b := by | |
| unfold sideAfter sideBefore slopeSign | |
| split_ifs <;> norm_num | |
| theorem positiveIndicator_factor (b r t : β) (hb : b β 0) (ht : t β r) : | |
| positiveIndicator (b*(t-r)) = stepAt r (sideBefore b) (sideAfter b) t := by | |
| rcases lt_or_gt_of_ne hb with hb | hb | |
| Β· by_cases htr : t<r | |
| Β· have hprod := mul_pos_of_neg_of_neg hb (sub_neg.mpr htr) | |
| simp [positiveIndicator,stepAt,sideBefore,htr,hprod,not_lt.mpr hb.le] | |
| Β· have hrt : r<t := lt_of_le_of_ne (le_of_not_gt htr) ht.symm | |
| have hprod := mul_neg_of_neg_of_pos hb (sub_pos.mpr hrt) | |
| simp [positiveIndicator,stepAt,sideAfter,htr,not_lt.mpr hprod.le,not_lt.mpr hb.le] | |
| Β· by_cases htr : t<r | |
| Β· have hprod := mul_neg_of_pos_of_neg hb (sub_neg.mpr htr) | |
| simp [positiveIndicator,stepAt,sideBefore,htr,not_lt.mpr hprod.le,hb] | |
| Β· have hrt : r<t := lt_of_le_of_ne (le_of_not_gt htr) ht.symm | |
| have hprod := mul_pos hb (sub_pos.mpr hrt) | |
| simp [positiveIndicator,stepAt,sideAfter,htr,hprod,hb] | |
| theorem sum_affine_side_events (n : β) (r b : Fin n β β) | |
| (hr : StrictMono r) (hb : β i, b i β 0) (h0 : β i, r i β 0) (h1 : β i, r i β 1) : | |
| (β i, if 0<r i β§ r i<1 then slopeSign (b i) * | |
| (β j, if j=i then 1 else positiveIndicator (b j*(r i-r j))) else 0) = | |
| (β i, positiveIndicator (b i*(1-r i))) - β i, positiveIndicator (b i*(0-r i)) := by | |
| have hh := sum_stepEvent n r (fun i => sideBefore (b i)) (fun i => sideAfter (b i)) hr h0 h1 | |
| have he : β i : Fin n, stepEvent r (fun i => sideBefore (b i)) (fun i => sideAfter (b i)) i = | |
| if 0<r i β§ r i<1 then slopeSign (b i) * | |
| (β j, if j=i then 1 else positiveIndicator (b j*(r i-r j))) else 0 := by | |
| intro i | |
| unfold stepEvent | |
| rw [sideAfter_sub_before] | |
| congr 1 | |
| congr 1 | |
| apply Finset.prod_congr rfl | |
| intro j hj | |
| by_cases hji : j=i | |
| Β· simp [hji] | |
| Β· rw [ite_eq_right hji,ite_eq_right hji] | |
| exact (positiveIndicator_factor (b j) (r j) (r i) (hb j) (hr.injective.ne (Ne.symm hji))).symm | |
| simp_rw [he] at hh | |
| rw [hh] | |
| congr 1 | |
| Β· apply Finset.prod_congr rfl | |
| intro i hi | |
| exact (positiveIndicator_factor (b i) (r i) 1 (hb i) (h1 i).symm).symm | |
| Β· apply Finset.prod_congr rfl | |
| intro i hi | |
| exact (positiveIndicator_factor (b i) (r i) 0 (hb i) (h0 i).symm).symm | |
| end Zarankiewicz | |
| end | |
| end OAI | |