Buckets:
| import Mathlib | |
| import OAI.Combinatorics.IndependentSets.Repetition.Scalar | |
| namespace OAI | |
| namespace IndependentSetsGames.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] | |
| end IndependentSetsGames.Foundations.Repetition.SelectionSequence | |
| end OAI | |
Xet Storage Details
- Size:
- 6.38 kB
- Xet hash:
- f7ecd8a5b95b7fdea5d74bca9732178c27a917bf35458449b3ec1564a42977b7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.