Download data/lean/OAI/Computability/DepthThree/FiniteProbability.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.02 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DepthThree/FiniteProbability.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/DepthThree/FiniteProbability.lean
-
curl -L -o FiniteProbability.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DepthThree/FiniteProbability.lean
8.02 kB
| import OAI.Computability.DepthThree.Core | |
| import Mathlib.Algebra.BigOperators.Ring.Finset | |
| import Mathlib.Algebra.Order.BigOperators.Group.Finset | |
| import Mathlib.Algebra.Order.BigOperators.Ring.Finset | |
| import Mathlib.Data.Fintype.BigOperators | |
| import Mathlib.Data.Fintype.Option | |
| import Mathlib.Tactic.Ring | |
| namespace OAI | |
| universe uDepth1 uDepth2 uDepth3 uDepth4 uDepth5 uDepth6 uDepth7 uDepth8 uDepth9 uDepth10 uDepth11 uDepth12 uDepth13 uDepth14 uDepth15 uDepth16 uDepth17 uDepth18 uDepth19 uDepth20 uDepth21 | |
| noncomputable section | |
| open scoped BigOperators Classical | |
| namespace DepthThreeLowerBound | |
| abbrev Restriction (V : Type uDepth1) := V β Option Bool | |
| abbrev Live {V : Type uDepth2} (Ο : Restriction V) := {v : V // Ο v = none} | |
| def fill {V : Type uDepth3} (Ο : Restriction V) (z : Cube (Live Ο)) : Cube V := | |
| fun v => if h : Ο v = none then z β¨v, hβ© else (Ο v).getD false | |
| @[simp] theorem fill_live {V : Type uDepth4} (Ο : Restriction V) (z : Cube (Live Ο)) | |
| (v : Live Ο) : fill Ο z v.val = z v := by | |
| simp [fill, v.property] | |
| @[simp] theorem fill_fixed {V : Type uDepth5} (Ο : Restriction V) (z : Cube (Live Ο)) | |
| (v : V) (b : Bool) (h : Ο v = some b) : fill Ο z v = b := by | |
| simp [fill, h] | |
| def finiteAvg {Ξ© : Type uDepth6} [Fintype Ξ©] (f : Ξ© β β) : β := | |
| (Fintype.card Ξ© : β)β»ΒΉ * β Ο, f Ο | |
| section Averages | |
| variable {Ξ© : Type uDepth7} {Ξ : Type uDepth8} [Fintype Ξ©] [Fintype Ξ] | |
| theorem finiteAvg_congr {f g : Ξ© β β} (h : β Ο, f Ο = g Ο) : | |
| finiteAvg f = finiteAvg g := by | |
| unfold finiteAvg | |
| congr 1 | |
| exact Finset.sum_congr rfl (fun Ο _ => h Ο) | |
| @[simp] theorem finiteAvg_zero : finiteAvg (fun _ : Ξ© => (0 : β)) = 0 := by | |
| simp [finiteAvg] | |
| theorem finiteAvg_add (f g : Ξ© β β) : | |
| finiteAvg (fun Ο => f Ο + g Ο) = finiteAvg f + finiteAvg g := by | |
| simp [finiteAvg, Finset.sum_add_distrib, mul_add] | |
| theorem finiteAvg_sub (f g : Ξ© β β) : | |
| finiteAvg (fun Ο => f Ο - g Ο) = finiteAvg f - finiteAvg g := by | |
| simp [finiteAvg, Finset.sum_sub_distrib, mul_sub] | |
| theorem finiteAvg_const_mul (c : β) (f : Ξ© β β) : | |
| finiteAvg (fun Ο => c * f Ο) = c * finiteAvg f := by | |
| unfold finiteAvg | |
| rw [β Finset.mul_sum] | |
| ring | |
| theorem finiteAvg_mul_const (f : Ξ© β β) (c : β) : | |
| finiteAvg (fun Ο => f Ο * c) = finiteAvg f * c := by | |
| unfold finiteAvg | |
| rw [β Finset.sum_mul] | |
| ring | |
| theorem finiteAvg_sum {ΞΉ : Type uDepth9} (s : Finset ΞΉ) (f : ΞΉ β Ξ© β β) : | |
| finiteAvg (fun Ο => β i β s, f i Ο) = β i β s, finiteAvg (f i) := by | |
| classical | |
| simp only [finiteAvg, Finset.mul_sum] | |
| exact Finset.sum_comm | |
| theorem finiteAvg_nonneg {f : Ξ© β β} (h : β Ο, 0 β€ f Ο) : | |
| 0 β€ finiteAvg f := by | |
| exact mul_nonneg (inv_nonneg.mpr (Nat.cast_nonneg _)) | |
| (Finset.sum_nonneg (fun Ο _ => h Ο)) | |
| theorem finiteAvg_mono {f g : Ξ© β β} (h : β Ο, f Ο β€ g Ο) : | |
| finiteAvg f β€ finiteAvg g := by | |
| exact mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun Ο _ => h Ο)) | |
| (inv_nonneg.mpr (Nat.cast_nonneg _)) | |
| theorem finiteAvg_abs_le (f : Ξ© β β) : | |
| |finiteAvg f| β€ finiteAvg (fun Ο => |f Ο|) := by | |
| unfold finiteAvg | |
| rw [abs_mul, abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg _))] | |
| exact mul_le_mul_of_nonneg_left (Finset.abs_sum_le_sum_abs f Finset.univ) | |
| (inv_nonneg.mpr (Nat.cast_nonneg _)) | |
| @[simp] theorem finiteAvg_const [Nonempty Ξ©] (c : β) : | |
| finiteAvg (fun _ : Ξ© => c) = c := by | |
| have hc : (Fintype.card Ξ© : β) β 0 := by | |
| exact_mod_cast Fintype.card_ne_zero | |
| simp [finiteAvg, nsmul_eq_mul, hc] | |
| theorem finiteAvg_equiv (e : Ξ© β Ξ) (f : Ξ β β) : | |
| finiteAvg (fun Ο => f (e Ο)) = finiteAvg f := by | |
| unfold finiteAvg | |
| rw [Fintype.card_congr e, e.sum_comp f] | |
| theorem finiteAvg_comm (f : Ξ© β Ξ β β) : | |
| finiteAvg (fun Ο => finiteAvg (f Ο)) = | |
| finiteAvg (fun l => finiteAvg (fun Ο => f Ο l)) := by | |
| simp only [finiteAvg, Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro l hl | |
| apply Finset.sum_congr rfl | |
| intro Ο hΟ | |
| ring | |
| theorem finiteAvg_product (f : Ξ© Γ Ξ β β) : | |
| finiteAvg f = finiteAvg (fun Ο => finiteAvg (fun l => f (Ο, l))) := by | |
| simp only [finiteAvg, Fintype.card_prod, Nat.cast_mul, mul_inv, | |
| Fintype.sum_prod_type, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro Ο hΟ | |
| apply Finset.sum_congr rfl | |
| intro l hl | |
| ring | |
| theorem finiteAvg_pi_prod {ΞΉ : Type uDepth10} [Fintype ΞΉ] | |
| {ΞΊ : ΞΉ β Type uDepth21} [β i, Fintype (ΞΊ i)] (f : β i, ΞΊ i β β) : | |
| finiteAvg (fun x : β i, ΞΊ i => β i, f i (x i)) = | |
| β i, finiteAvg (f i) := by | |
| classical | |
| unfold finiteAvg | |
| rw [Fintype.card_pi, Nat.cast_prod, β Fintype.prod_sum] | |
| rw [Finset.prod_mul_distrib, Finset.prod_inv_distrib] | |
| end Averages | |
| def restrictionCoordinateWeight (p : β) : Option Bool β β | |
| | none => p | |
| | some _ => (1 - p) / 2 | |
| def restrictionWeight {V : Type uDepth11} [Fintype V] (p : β) (Ο : Restriction V) : β := | |
| β v, restrictionCoordinateWeight p (Ο v) | |
| def restrictionAvg {V : Type uDepth12} [Fintype V] (p : β) | |
| (F : Restriction V β β) : β := | |
| β Ο, restrictionWeight p Ο * F Ο | |
| @[simp] theorem restrictionCoordinateWeight_sum (p : β) : | |
| (β a : Option Bool, restrictionCoordinateWeight p a) = 1 := by | |
| simp [Fintype.sum_option, restrictionCoordinateWeight] | |
| ring | |
| theorem restrictionCoordinateWeight_nonneg {p : β} (hp : 0 β€ p) (hp1 : p β€ 1) | |
| (a : Option Bool) : 0 β€ restrictionCoordinateWeight p a := by | |
| cases a with | |
| | none => exact hp | |
| | some b => exact div_nonneg (sub_nonneg.mpr hp1) (by norm_num) | |
| theorem restrictionWeight_nonneg {V : Type uDepth13} [Fintype V] {p : β} | |
| (hp : 0 β€ p) (hp1 : p β€ 1) (Ο : Restriction V) : | |
| 0 β€ restrictionWeight p Ο := by | |
| exact Finset.prod_nonneg (fun v _ => restrictionCoordinateWeight_nonneg hp hp1 (Ο v)) | |
| @[simp] theorem restrictionWeight_sum {V : Type uDepth14} [Fintype V] (p : β) : | |
| (β Ο : Restriction V, restrictionWeight p Ο) = 1 := by | |
| classical | |
| unfold restrictionWeight | |
| rw [β Fintype.prod_sum] | |
| simp only [restrictionCoordinateWeight_sum, Finset.prod_const_one] | |
| @[simp] theorem restrictionAvg_const {V : Type uDepth15} [Fintype V] (p c : β) : | |
| restrictionAvg p (fun _ : Restriction V => c) = c := by | |
| simp [restrictionAvg, β Finset.sum_mul] | |
| theorem restrictionAvg_nonneg {V : Type uDepth16} [Fintype V] {p : β} | |
| (hp : 0 β€ p) (hp1 : p β€ 1) {F : Restriction V β β} | |
| (hF : β Ο, 0 β€ F Ο) : 0 β€ restrictionAvg p F := by | |
| exact Finset.sum_nonneg (fun Ο _ => | |
| mul_nonneg (restrictionWeight_nonneg hp hp1 Ο) (hF Ο)) | |
| theorem restrictionAvg_mono {V : Type uDepth17} [Fintype V] {p : β} | |
| (hp : 0 β€ p) (hp1 : p β€ 1) {F G : Restriction V β β} | |
| (h : β Ο, F Ο β€ G Ο) : restrictionAvg p F β€ restrictionAvg p G := by | |
| exact Finset.sum_le_sum (fun Ο _ => | |
| mul_le_mul_of_nonneg_left (h Ο) (restrictionWeight_nonneg hp hp1 Ο)) | |
| theorem restrictionAvg_add {V : Type uDepth18} [Fintype V] (p : β) | |
| (F G : Restriction V β β) : | |
| restrictionAvg p (fun Ο => F Ο + G Ο) = restrictionAvg p F + restrictionAvg p G := by | |
| simp [restrictionAvg, mul_add, Finset.sum_add_distrib] | |
| theorem restrictionAvg_const_mul {V : Type uDepth19} [Fintype V] (p c : β) | |
| (F : Restriction V β β) : | |
| restrictionAvg p (fun Ο => c * F Ο) = c * restrictionAvg p F := by | |
| simp [restrictionAvg, Finset.mul_sum, mul_left_comm] | |
| theorem restrictionAvg_abs_le {V : Type uDepth20} [Fintype V] {p : β} | |
| (hp : 0 β€ p) (hp1 : p β€ 1) (F : Restriction V β β) : | |
| |restrictionAvg p F| β€ restrictionAvg p (fun Ο => |F Ο|) := by | |
| unfold restrictionAvg | |
| calc | |
| _ β€ β Ο, |restrictionWeight p Ο * F Ο| := | |
| Finset.abs_sum_le_sum_abs _ _ | |
| _ = _ := by | |
| apply Finset.sum_congr rfl | |
| intro Ο hΟ | |
| rw [abs_mul, abs_of_nonneg (restrictionWeight_nonneg hp hp1 Ο)] | |
| end DepthThreeLowerBound | |
| end | |
| end OAI | |