Buckets:
| import Mathlib | |
| import OAI.Computability.MinUncut.PCP.SelectedLikelihood | |
| import OAI.Computability.MinUncut.Machines.AlphabetBudget | |
| namespace OAI | |
| namespace MinUncutGames.Foundations.Repetition.SelectionSequence | |
| private theorem exists_unused {n : Nat} (S : Finset (Fin n)) (hcard : S.card < n) : | |
| ∃ j : Fin n, j ∉ S := by | |
| classical | |
| apply Classical.byContradiction | |
| intro h | |
| have hall : ∀ j : Fin n, j ∈ S := by | |
| intro j | |
| apply Classical.byContradiction | |
| intro hj | |
| exact h ⟨j, hj⟩ | |
| have hfull : S = Finset.univ := | |
| Finset.ext (fun j => iff_of_true (hall j) (Finset.mem_univ j)) | |
| have hbad : n < n := by | |
| simpa only [hfull, Finset.card_univ, Fintype.card_fin] using hcard | |
| exact Nat.lt_irrefl n hbad | |
| noncomputable def nextSet {n : Nat} | |
| (Step : Finset (Fin n) → Fin n → Prop) | |
| (witness : ∀ S, S.card < n → ∃ j, j ∉ S ∧ Step S j) | |
| (S : Finset (Fin n)) : Finset (Fin n) := | |
| if hs : S.card < n then insert (Classical.choose (witness S hs)) S else S | |
| noncomputable def selectedSet {n : Nat} | |
| (Step : Finset (Fin n) → Fin n → Prop) | |
| (witness : ∀ S, S.card < n → ∃ j, j ∉ S ∧ Step S j) : Nat → Finset (Fin n) | |
| | 0 => ∅ | |
| | m + 1 => nextSet Step witness (selectedSet Step witness m) | |
| theorem selectedSet_card {n : Nat} | |
| (Step : Finset (Fin n) → Fin n → Prop) | |
| (witness : ∀ S, S.card < n → ∃ j, j ∉ S ∧ Step S j) (m : Nat) : | |
| (selectedSet Step witness m).card = min m n := by | |
| induction m with | |
| | zero => simp [selectedSet] | |
| | succ m ih => | |
| by_cases hm : m < n | |
| · have hc : (selectedSet Step witness m).card = m := by | |
| simpa only [Nat.min_eq_left (Nat.le_of_lt hm)] using ih | |
| have hs : (selectedSet Step witness m).card < n := by | |
| simpa only [hc] using hm | |
| rw [selectedSet, nextSet, dite_eq_left hs, | |
| Finset.card_insert_of_notMem ((Classical.choose_spec (witness _ hs)).1), | |
| hc, Nat.min_eq_left (Nat.succ_le_of_lt hm)] | |
| · have hc : (selectedSet Step witness m).card = n := by | |
| simpa only [Nat.min_eq_right (Nat.le_of_not_gt hm)] using ih | |
| have hs : ¬(selectedSet Step witness m).card < n := by | |
| rw [hc] | |
| exact Nat.not_lt.mpr (Nat.le_refl n) | |
| rw [selectedSet, nextSet, dite_eq_right hs, hc, | |
| Nat.min_eq_right (Nat.le_trans (Nat.le_of_not_gt hm) (Nat.le_succ m))] | |
| theorem selectedSet_subset_succ {n : Nat} | |
| (Step : Finset (Fin n) → Fin n → Prop) | |
| (witness : ∀ S, S.card < n → ∃ j, j ∉ S ∧ Step S j) (m : Nat) : | |
| selectedSet Step witness m ⊆ selectedSet Step witness (m + 1) := by | |
| change selectedSet Step witness m ⊆ nextSet Step witness (selectedSet Step witness m) | |
| unfold nextSet | |
| split | |
| · exact Finset.subset_insert _ _ | |
| · exact le_rfl | |
| theorem selectedSet_monotone {n : Nat} | |
| (Step : Finset (Fin n) → Fin n → Prop) | |
| (witness : ∀ S, S.card < n → ∃ j, j ∉ S ∧ Step S j) : | |
| Monotone (selectedSet Step witness) := | |
| monotone_nat_of_le_succ (selectedSet_subset_succ Step witness) | |
| theorem selectedSet_univ {n : Nat} | |
| (Step : Finset (Fin n) → Fin n → Prop) | |
| (witness : ∀ S, S.card < n → ∃ j, j ∉ S ∧ Step S j) : | |
| selectedSet Step witness n = Finset.univ := by | |
| apply Finset.eq_of_subset_of_card_le (Finset.subset_univ _) | |
| simp [selectedSet_card] | |
| theorem selectedSet_step {n : Nat} | |
| (Step : Finset (Fin n) → Fin n → Prop) | |
| (witness : ∀ S, S.card < n → ∃ j, j ∉ S ∧ Step S j) | |
| (m : Nat) (hm : m < n) : | |
| ∃ j, j ∉ selectedSet Step witness m ∧ | |
| selectedSet Step witness (m + 1) = insert j (selectedSet Step witness m) ∧ | |
| Step (selectedSet Step witness m) j := by | |
| have hc : (selectedSet Step witness m).card = m := by | |
| rw [selectedSet_card, Nat.min_eq_left (Nat.le_of_lt hm)] | |
| have hs : (selectedSet Step witness m).card < n := by simpa only [hc] using hm | |
| let j := Classical.choose (witness (selectedSet Step witness m) hs) | |
| have hj := Classical.choose_spec (witness (selectedSet Step witness m) hs) | |
| refine ⟨j, hj.1, ?_, hj.2⟩ | |
| simp only [selectedSet, nextSet, dite_eq_left hs, j] | |
| def SetStep {n : Nat} (P : Finset (Fin n) → ℝ) (v ell : ℝ) | |
| (S : Finset (Fin n)) (j : Fin n) : Prop := | |
| P (insert j S) ≤ P S * | |
| (v + 15 * Real.sqrt (((S.card : ℝ) * ell + logTwo (1 / P S)) / | |
| ((n : ℝ) - S.card))) | |
| theorem totalSetStep {n : Nat} (P : Finset (Fin n) → ℝ) (v ell : ℝ) | |
| (hnonneg : ∀ S, 0 ≤ P S) (hanti : Antitone P) | |
| (hpositive : ∀ S, S.card < n → 0 < P S → | |
| ∃ j, j ∉ S ∧ SetStep P v ell S j) : | |
| ∀ S, S.card < n → ∃ j, j ∉ S ∧ SetStep P v ell S j := by | |
| intro S hcard | |
| by_cases hp : 0 < P S | |
| · exact hpositive S hcard hp | |
| · obtain ⟨j, hj⟩ := exists_unused S hcard | |
| have hz : P S = 0 := le_antisymm (le_of_not_gt hp) (hnonneg S) | |
| have hnext : P (insert j S) = 0 := le_antisymm | |
| ((hanti (Finset.subset_insert j S)).trans (le_of_eq hz)) (hnonneg (insert j S)) | |
| refine ⟨j, hj, ?_⟩ | |
| simpa only [SetStep, hnext, hz, zero_mul] using (le_refl (0 : ℝ)) | |
| theorem exists_scalar_sequence {n : Nat} (P : Finset (Fin n) → ℝ) (v ell : ℝ) | |
| (hempty : P ∅ = 1) (hnonneg : ∀ S, 0 ≤ P S) (hanti : Antitone P) | |
| (hpositive : ∀ S, S.card < n → 0 < P S → | |
| ∃ j, j ∉ S ∧ SetStep P v ell S j) : | |
| ∃ p : Nat → ℝ, p 0 = 1 ∧ (∀ m, 0 ≤ p m) ∧ Antitone p ∧ | |
| ScalarRecurrence p n v ell ∧ p n = P Finset.univ := by | |
| let witness := totalSetStep P v ell hnonneg hanti hpositive | |
| let sets := selectedSet (SetStep P v ell) witness | |
| let p := fun m => P (sets m) | |
| refine ⟨p, ?_, ?_, ?_, ?_, ?_⟩ | |
| · change P (selectedSet (SetStep P v ell) witness 0) = 1 | |
| simpa only [selectedSet] using hempty | |
| · intro m | |
| exact hnonneg (sets m) | |
| · intro i j hij | |
| exact hanti (selectedSet_monotone (SetStep P v ell) witness hij) | |
| · intro m hm | |
| obtain ⟨j, _, hnext, hbound⟩ := | |
| selectedSet_step (SetStep P v ell) witness m hm | |
| have hc : (selectedSet (SetStep P v ell) witness m).card = m := by | |
| rw [selectedSet_card, Nat.min_eq_left (Nat.le_of_lt hm)] | |
| change P (selectedSet (SetStep P v ell) witness (m + 1)) ≤ _ | |
| rw [hnext] | |
| simpa only [SetStep, hc] using hbound | |
| · change P (selectedSet (SetStep P v ell) witness n) = P Finset.univ | |
| rw [selectedSet_univ] | |
| open MinUncutGames.Foundations.Games | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| variable [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| variable [Nonempty A₁] [Nonempty A₂] | |
| def ConditionalCoordinateBound (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (ell : ℝ) : Prop := | |
| ∀ (S : Finset (Fin n)) (_hcard : S.card < n) | |
| (hp : 0 < G.selectedSuccess strategy S), | |
| ∃ j, j ∉ S ∧ | |
| (((G.repetition n).questions.condition (G.selectedWins strategy S) hp).probability | |
| (G.coordinateWin strategy j)) ≤ | |
| G.value + 15 * Real.sqrt | |
| (((S.card : ℝ) * ell + logTwo (1 / G.selectedSuccess strategy S)) / | |
| ((n : ℝ) - S.card)) | |
| theorem repetition_success_le_of_conditionalCoordinateBound | |
| (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| {v ell : ℝ} (hvalue : G.value ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell) | |
| (hcoordinate : ConditionalCoordinateBound G n strategy ell) : | |
| (G.repetition n).success strategy ≤ | |
| (1 - (1 - v)^3 / 6000)^((n : ℝ) / ell) := by | |
| have hpositive : ∀ S : Finset (Fin n), S.card < n → | |
| 0 < G.selectedSuccess strategy S → | |
| ∃ j, j ∉ S ∧ SetStep (G.selectedSuccess strategy) v ell S j := by | |
| intro S hcard hp | |
| obtain ⟨j, hj, hbound⟩ := hcoordinate S hcard hp | |
| refine ⟨j, hj, ?_⟩ | |
| change G.selectedSuccess strategy (insert j S) ≤ _ | |
| rw [G.selectedSuccess_insert strategy S j hp] | |
| exact mul_le_mul_of_nonneg_left | |
| (hbound.trans (add_le_add hvalue (le_refl _))) (le_of_lt hp) | |
| obtain ⟨p, hp0, hpnonneg, hpmono, hrec, hpn⟩ := | |
| exists_scalar_sequence (G.selectedSuccess strategy) v ell | |
| (G.selectedSuccess_empty strategy) (G.selectedSuccess_nonnegative strategy) | |
| (G.selectedSuccess_antitone strategy) hpositive | |
| have hbound := scalar_bound_6000 p n | |
| (G.value_nonnegative.trans hvalue) hv1 hell hp0 hpnonneg hpmono hrec | |
| rw [hpn, G.selectedSuccess_univ strategy] at hbound | |
| exact hbound | |
| end MinUncutGames.Foundations.Repetition.SelectionSequence | |
| namespace MinUncutGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games | |
| noncomputable section | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| [Nonempty A₁] [Nonempty A₂] | |
| [DecidableEq Q₁] [DecidableEq Q₂] {n : Nat} | |
| theorem selected_coordinate_probability_le_value_add_error | |
| (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected) | |
| (j : {i : Fin n // i ∉ selected}) : | |
| ((G.repetition n).questions.condition (G.selectedWins strategy selected) positive).probability | |
| (G.coordinateWin strategy j.1) ≤ | |
| G.value + selectedEmbeddingError G strategy selected positive j := by | |
| classical | |
| let : Nonempty (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j) := | |
| finiteDistribution_nonempty (selectedProfileFallback G strategy selected positive j) | |
| have h := coordinate_probability_le_value_of_local_completion G j.1 strategy | |
| (selectedSamplingTarget G strategy selected positive j) | |
| (selectedLeftProfile G strategy selected positive j) | |
| (selectedRightProfile G strategy selected positive j) | |
| (selectedFullLeftCompletion G strategy selected j) | |
| (selectedFullRightCompletion G strategy selected j) | |
| (selectedFullLeftCompletion_support G strategy selected j) | |
| (selectedFullRightCompletion_support G strategy selected j) | |
| (Classical.choice inferInstance) | |
| have htarget : (selectedSamplingTarget G strategy selected positive j).mixture | |
| (fun z => (selectedFullLeftCompletion G strategy selected j (z.1.1,z.2)).product | |
| (selectedFullRightCompletion G strategy selected j (z.1.2,z.2))) = | |
| (G.repetition n).questions.condition (G.selectedWins strategy selected) positive := | |
| selectedFullCompletionMixture_eq_conditionedQuestions G strategy selected positive j | |
| rw [htarget, selectedSamplingTarget_left_error, selectedSamplingTarget_right_error] at h | |
| exact h | |
| theorem holenstein_conditionalCoordinateBound | |
| (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (ell : ℝ) | |
| (halphabet : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card A₂ : ℝ)) ≤ ell) : | |
| SelectionSequence.ConditionalCoordinateBound G n strategy ell := by | |
| intro selected hcard positive | |
| obtain ⟨j,hj⟩ := exists_coordinate_le_information_budget G strategy selected positive ell | |
| halphabet hcard (selectedEmbeddingError G strategy selected positive) | |
| (selectedEmbeddingError_sum_le_fifteen G strategy selected positive) | |
| exact ⟨j.1,j.property, | |
| (selected_coordinate_probability_le_value_add_error G strategy selected positive j).trans | |
| (add_le_add le_rfl hj)⟩ | |
| theorem holenstein_repetition_success | |
| (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| {v ell : ℝ} (hvalue : G.value ≤ v) (hv : v < 1) (hell : 1 ≤ ell) | |
| (halphabet : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card A₂ : ℝ)) ≤ ell) : | |
| (G.repetition n).success strategy ≤ | |
| (1 - (1 - v)^3 / 6000)^((n : ℝ) / ell) := | |
| SelectionSequence.repetition_success_le_of_conditionalCoordinateBound G n strategy | |
| hvalue hv hell (holenstein_conditionalCoordinateBound G n strategy ell halphabet) | |
| theorem holenstein_repetition_value | |
| (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| {v ell : ℝ} (hvalue : G.value ≤ v) (hv : v < 1) (hell : 1 ≤ ell) | |
| (halphabet : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card A₂ : ℝ)) ≤ ell) : | |
| (G.repetition n).value ≤ | |
| (1 - (1 - v)^3 / 6000)^((n : ℝ) / ell) := by | |
| apply ((G.repetition n).value_le_iff _).2 | |
| intro strategy | |
| exact holenstein_repetition_success G n strategy hvalue hv hell halphabet | |
| end | |
| end MinUncutGames.Foundations.Repetition | |
| noncomputable section | |
| namespace MinUncut.Outer | |
| open MinUncut.Inner MinUncutGames.Foundations.Games MinUncutGames.Foundations.Repetition | |
| def repetitionRate : ℝ := 99999999/100000000 | |
| lemma repetitionRate_pos : 0<repetitionRate := by norm_num [repetitionRate] | |
| lemma repetitionRate_lt_one : repetitionRate<1 := by norm_num [repetitionRate] | |
| lemma repetitionRate_fourth : 1-(1-(11/12 : ℝ))^3/6000 ≤ repetitionRate^4 := by | |
| norm_num [repetitionRate] | |
| lemma ordinary_alphabet_log : | |
| logTwo ((Fintype.card Triple : ℝ)*(Fintype.card F₂ : ℝ)) ≤ 4 := by | |
| have hlog : Real.log (2 : ℝ) ≠ 0 := ne_of_gt (Real.log_pos (by norm_num)) | |
| have hcard : (Fintype.card Triple : ℝ)*(Fintype.card F₂ : ℝ) = 2^4 := by | |
| norm_num [Triple,F₂,Fintype.card_fun] | |
| rw [hcard,logTwo,Real.log_pow] | |
| norm_num | |
| variable {Name S : Type*} [Fintype Name] [Fintype S] [Nonempty S] | |
| theorem ordinary_repetition_success (equations : S → Equation Name) | |
| (hsound : ∀ s : Name → F₂, equationFraction equations s ≤ 3/4) (r : ℕ) | |
| (strategy : Strategy (Fin r → Equation Name) (Fin r → Name) | |
| (Fin r → Triple) (Fin r → F₂)) : | |
| ((ordinaryGame equations).repetition r).success strategy ≤ repetitionRate^r := by | |
| classical | |
| have h := holenstein_repetition_success (ordinaryGame equations) r strategy | |
| (ordinary_value_le equations hsound) (by norm_num : (11/12 : ℝ)<1) | |
| (by norm_num : (1 : ℝ)≤4) ordinary_alphabet_log | |
| refine h.trans ?_ | |
| have hb : 0 ≤ 1-(1-(11/12 : ℝ))^3/6000 := by norm_num | |
| have hp : 0 ≤ (r : ℝ)/4 := by positivity | |
| calc | |
| (1-(1-(11/12 : ℝ))^3/6000)^((r : ℝ)/4) ≤ | |
| (repetitionRate^4)^((r : ℝ)/4) := | |
| Real.rpow_le_rpow hb repetitionRate_fourth hp | |
| _ = repetitionRate^r := by | |
| rw [← Real.rpow_natCast,← Real.rpow_mul repetitionRate_pos.le] | |
| have he : (4 : ℝ)*((r : ℝ)/4)=(r : ℝ) := by ring | |
| norm_num only [Nat.cast_ofNat] | |
| rw [he,Real.rpow_natCast] | |
| end MinUncut.Outer | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 14.6 kB
- Xet hash:
- 06628e9d08738ac9bcc8ffc3f2bb43de9c52f50a90daf09ad576e0e64b520720
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.