Download data/lean/OAI/Combinatorics/InfiniteMatroid/Interpolation.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 22.5 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/InfiniteMatroid/Interpolation.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/InfiniteMatroid/Interpolation.lean
-
curl -L -o Interpolation.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/InfiniteMatroid/Interpolation.lean
22.5 kB
| import OAI.Combinatorics.InfiniteMatroid.Basic | |
| namespace OAI | |
| section | |
| open Set Filter | |
| open scoped Topology | |
| namespace InfiniteMatroidCounterexample | |
| /-- Two subsets of β agree on the first `m` labels. -/ | |
| def AgreeBelow (X Y : Set β) (m : β) : Prop := | |
| β x < m, (x β X β x β Y) | |
| def CylinderContinuous (f : β β Set β β β) (I Y : Set β) : Prop := | |
| β j Ξ΅, 0 < Ξ΅ β β m, β X Z, | |
| I β X β X β Y β I β Z β Z β Y β AgreeBelow X Z m β | |
| β n < j, |f n X - f n Z| < Ξ΅ | |
| /-- Delete, in the usual order of β, the labels not reserved by the | |
| lower endpoint or by the finite prefix. -/ | |
| def deletePrefix (I X : Set β) (m k : β) : Set β := | |
| {x | x β X β§ (x β I β¨ x < m β¨ k β€ x)} | |
| lemma deletePrefix_zero (I X : Set β) (m : β) : deletePrefix I X m 0 = X := by | |
| ext x | |
| simp [deletePrefix] | |
| lemma subset_deletePrefix {I X : Set β} (hIX : I β X) (m k : β) : | |
| I β deletePrefix I X m k := by | |
| intro x hx | |
| exact β¨hIX hx, Or.inl hxβ© | |
| lemma deletePrefix_subset (I X : Set β) (m k : β) : | |
| deletePrefix I X m k β X := fun _ h β¦ h.1 | |
| lemma deletePrefix_antitone (I X : Set β) (m : β) : | |
| Antitone (deletePrefix I X m) := by | |
| intro a b hab x hx | |
| rcases hx with β¨hx, hi | hm | hbβ© | |
| Β· exact β¨hx, Or.inl hiβ© | |
| Β· exact β¨hx, Or.inr (Or.inl hm)β© | |
| Β· exact β¨hx, Or.inr (Or.inr (hab.trans hb))β© | |
| lemma deletePrefix_agree (I X : Set β) (m k : β) : | |
| AgreeBelow X (deletePrefix I X m k) m := by | |
| intro x hx | |
| exact β¨fun h β¦ β¨h, Or.inr (Or.inl hx)β©, fun h β¦ h.1β© | |
| lemma deletePrefix_step (I X : Set β) (m k : β) : | |
| deletePrefix I X m k β insert k (deletePrefix I X m (k+1)) := by | |
| intro x hx | |
| by_cases h : x = k | |
| Β· exact Or.inl h | |
| Β· right | |
| refine β¨hx.1, ?_β© | |
| rcases hx.2 with hi | hm | hk | |
| Β· exact Or.inl hi | |
| Β· exact Or.inr (Or.inl hm) | |
| Β· exact Or.inr (Or.inr (by omega)) | |
| lemma deletePrefix_finite (I X : Set β) (m k : β) : | |
| (X \ deletePrefix I X m k).Finite := by | |
| apply (finite_Iio k).subset | |
| intro x hx | |
| simp only [mem_Iio] | |
| by_contra hn | |
| exact hx.2 β¨hx.1, Or.inr (Or.inr (by omega))β© | |
| /-- The limit after every eligible label has been deleted. -/ | |
| def deleteTail (I X : Set β) (m : β) : Set β := | |
| {x | x β X β§ (x β I β¨ x < m)} | |
| lemma subset_deleteTail {I X : Set β} (hIX : I β X) (m : β) : | |
| I β deleteTail I X m := fun _ hx β¦ β¨hIX hx, Or.inl hxβ© | |
| lemma deleteTail_subset (I X : Set β) (m : β) : | |
| deleteTail I X m β X := fun _ h β¦ h.1 | |
| lemma deleteTail_finite (I X : Set β) (m : β) : | |
| (deleteTail I X m \ I).Finite := by | |
| apply (finite_Iio m).subset | |
| intro x hx | |
| exact hx.1.2.resolve_left hx.2 | |
| lemma deletePrefix_agree_tail (I X : Set β) (m k : β) : | |
| AgreeBelow (deletePrefix I X m k) (deleteTail I X m) k := by | |
| intro x hx | |
| constructor | |
| Β· rintro β¨hX, hi | hm | hkβ© | |
| Β· exact β¨hX, Or.inl hiβ© | |
| Β· exact β¨hX, Or.inr hmβ© | |
| Β· omega | |
| Β· rintro β¨hX, hi | hmβ© | |
| Β· exact β¨hX, Or.inl hiβ© | |
| Β· exact β¨hX, Or.inr (Or.inl hm)β© | |
| /-- One stage of the infinite-endpoint interpolation: the stopping time | |
| is finite, all late probes are reset above -1, and earlier probes lose | |
| less than the prescribed tolerance. -/ | |
| lemma deletion_stage | |
| {f : β β Set β β β} {I Y X : Set β} | |
| (hcc : CylinderContinuous f I Y) | |
| (hone : β n A B, I β A β A β B β B β Y β | |
| (β e, B β insert e A) β f n B β€ f n A + 1) | |
| (hlow : β Z, I β Z β Z β Y β (Z \ I).Finite β | |
| β j, β n β₯ j, f n Z < 0) | |
| (hIX : I β X) (hXY : X β Y) (j : β) (Ξ΅ : β) (hΞ΅ : 0 < Ξ΅) : | |
| β Z, I β Z β§ Z β X β§ (X \ Z).Finite β§ | |
| (β n β₯ j, f n Z β€ 0) β§ | |
| (β n < j, |f n X - f n Z| < Ξ΅) β§ | |
| (Z = X β¨ β n β₯ j, -1 β€ f n Z) := by | |
| classical | |
| by_cases hex : β n β₯ j, f n X β€ 0 | |
| Β· refine β¨X, hIX, Subset.rfl, ?_, hex, ?_, Or.inl rflβ© | |
| Β· simp | |
| Β· intro n hn | |
| simpa using hΞ΅ | |
| have hpos : β n β₯ j, 0 < f n X := by | |
| intro n hn | |
| exact lt_of_not_ge (fun h β¦ hex β¨n, hn, hβ©) | |
| obtain β¨m, hmβ© := hcc j Ξ΅ hΞ΅ | |
| let T := deleteTail I X m | |
| have hIT : I β T := subset_deleteTail hIX m | |
| have hTY : T β Y := (deleteTail_subset I X m).trans hXY | |
| obtain β¨n, hnj, hnβ© := hlow T hIT hTY (deleteTail_finite I X m) j | |
| obtain β¨k, hkβ© := hcc (n+1) (-f n T) (neg_pos.mpr hn) | |
| have happrox := hk (deletePrefix I X m k) T (subset_deletePrefix hIX m k) | |
| ((deletePrefix_subset I X m k).trans hXY) hIT hTY | |
| (deletePrefix_agree_tail I X m k) n (Nat.lt_succ_self n) | |
| have hstop : β k, β n β₯ j, f n (deletePrefix I X m k) β€ 0 := by | |
| refine β¨k, n, hnj, ?_β© | |
| have := (abs_lt.mp happrox).2 | |
| linarith | |
| let k := Nat.find hstop | |
| have hkstop : β n β₯ j, f n (deletePrefix I X m k) β€ 0 := Nat.find_spec hstop | |
| have hk0 : k β 0 := by | |
| intro hk0 | |
| obtain β¨n, hnj, hnβ© := hkstop | |
| rw [hk0, deletePrefix_zero] at hn | |
| exact (hpos n hnj).not_ge hn | |
| obtain β¨r, hrβ© := Nat.exists_eq_succ_of_ne_zero hk0 | |
| have hprev : β n β₯ j, 0 < f n (deletePrefix I X m r) := by | |
| intro n hnj | |
| apply lt_of_not_ge | |
| intro hn | |
| have hrk : r < k := by omega | |
| exact Nat.find_min hstop hrk β¨n, hnj, hnβ© | |
| refine β¨deletePrefix I X m k, subset_deletePrefix hIX m k, | |
| deletePrefix_subset I X m k, deletePrefix_finite I X m k, hkstop, ?_, Or.inr ?_β© | |
| Β· exact hm X (deletePrefix I X m k) hIX hXY (subset_deletePrefix hIX m k) | |
| ((deletePrefix_subset I X m k).trans hXY) (deletePrefix_agree I X m k) | |
| Β· intro n hnj | |
| have h1 := hone n (deletePrefix I X m (r+1)) (deletePrefix I X m r) | |
| (subset_deletePrefix hIX m (r+1)) | |
| (deletePrefix_antitone I X m (Nat.le_succ r)) | |
| ((deletePrefix_subset I X m r).trans hXY) | |
| β¨r, deletePrefix_step I X m rβ© | |
| rw [hr] | |
| have := hprev n hnj | |
| linarith | |
| lemma antitone_agree_iInter {X : β β Set β} (hX : Antitone X) (m : β) : | |
| β k, β l β₯ k, AgreeBelow (X l) (β j, X j) m := by | |
| classical | |
| induction m with | |
| | zero => exact β¨0, fun _ _ _ hx β¦ by omegaβ© | |
| | succ m ih => | |
| obtain β¨k, hkβ© := ih | |
| by_cases hm : m β β j, X j | |
| Β· refine β¨k, fun l hl x hx β¦ ?_β© | |
| by_cases hxm : x < m | |
| Β· exact hk l hl x hxm | |
| Β· have hxm : x = m := by omega | |
| subst x | |
| exact β¨fun _ β¦ hm, fun _ β¦ mem_iInter.mp hm lβ© | |
| Β· simp only [mem_iInter, not_forall] at hm | |
| obtain β¨k', hk'β© := hm | |
| refine β¨max k k', fun l hl x hx β¦ ?_β© | |
| by_cases hxm : x < m | |
| Β· exact hk l ((le_max_left _ _).trans hl) x hxm | |
| Β· have hxm : x = m := by omega | |
| subst x | |
| have hml : m β X l := fun h β¦ hk' (hX ((le_max_right _ _).trans hl) h) | |
| exact β¨fun h β¦ (hml h).elim, fun h β¦ mem_iInter.mp h lβ© | |
| lemma CylinderContinuous.tendsto_iInter {f : β β Set β β β} {I Y : Set β} | |
| (hcc : CylinderContinuous f I Y) {X : β β Set β} | |
| (hX : Antitone X) (hIX : β j, I β X j) (hXY : β j, X j β Y) (n : β) : | |
| Tendsto (fun j β¦ f n (X j)) atTop (π (f n (β j, X j))) := by | |
| rw [Metric.tendsto_atTop] | |
| intro Ξ΅ hΞ΅ | |
| obtain β¨m, hmβ© := hcc (n+1) Ξ΅ hΞ΅ | |
| obtain β¨k, hkβ© := antitone_agree_iInter hX m | |
| refine β¨k, fun j hj β¦ ?_β© | |
| rw [Real.dist_eq] | |
| exact hm (X j) (β l, X l) (hIX j) (hXY j) | |
| (subset_iInter hIX) ((iInter_subset X 0).trans (hXY 0)) (hk j hj) | |
| n (Nat.lt_succ_self n) | |
| lemma infinite_endpoint_interpolation | |
| {f : β β Set β β β} {I Y : Set β} (hIY : I β Y) | |
| (hcc : CylinderContinuous f I Y) | |
| (hmono : β n A B, I β A β A β B β B β Y β f n A β€ f n B) | |
| (hone : β n A B, I β A β A β B β B β Y β | |
| (β e, B β insert e A) β f n B β€ f n A + 1) | |
| (hlow : β Z, I β Z β Z β Y β (Z \ I).Finite β | |
| β j, β n β₯ j, f n Z < 0) | |
| (hhigh : β j, β n β₯ j, 0 < f n Y) : | |
| β Z, I β Z β§ Z β Y β§ | |
| (β j, β n β₯ j, f n Z β€ 0) β§ | |
| (β Ξ΅ : β, 0 < Ξ΅ β β j, β n β₯ j, -1 - Ξ΅ β€ f n Z) := by | |
| classical | |
| let S := {X : Set β // I β X β§ X β Y} | |
| have hchoose : β j (X : S), β Z : S, | |
| Z.1 β X.1 β§ (X.1 \ Z.1).Finite β§ | |
| (β n β₯ j, f n Z.1 β€ 0) β§ | |
| (β n < j, |f n X.1 - f n Z.1| < (1/2:β)^j) β§ | |
| (Z.1 = X.1 β¨ β n β₯ j, -1 β€ f n Z.1) := by | |
| intro j X | |
| obtain β¨Z, hIZ, hZX, hfin, hneg, hclose, hresetβ© := | |
| deletion_stage hcc hone hlow X.2.1 X.2.2 j ((1/2:β)^j) (by positivity) | |
| exact β¨β¨Z, hIZ, hZX.trans X.2.2β©, hZX, hfin, hneg, hclose, hresetβ© | |
| choose step hstep using hchoose | |
| let seq : β β S := Nat.rec β¨Y, hIY, Subset.rflβ© (fun j X β¦ step (j+1) X) | |
| let X : β β Set β := fun j β¦ (seq j).1 | |
| have hX0 : X 0 = Y := rfl | |
| have hIX : β j, I β X j := fun j β¦ (seq j).2.1 | |
| have hXY : β j, X j β Y := fun j β¦ (seq j).2.2 | |
| have hstage : β j, | |
| X (j+1) β X j β§ (X j \ X (j+1)).Finite β§ | |
| (β n β₯ j+1, f n (X (j+1)) β€ 0) β§ | |
| (β n < j+1, |f n (X j) - f n (X (j+1))| < (1/2:β)^(j+1)) β§ | |
| (X (j+1) = X j β¨ β n β₯ j+1, -1 β€ f n (X (j+1))) := by | |
| intro j | |
| exact hstep (j+1) (seq j) | |
| have hanti : Antitone X := antitone_nat_of_succ_le fun j β¦ (hstage j).1 | |
| let Z := β j, X j | |
| have hIZ : I β Z := subset_iInter hIX | |
| have hZY : Z β Y := (iInter_subset X 0).trans (hXY 0) | |
| have hneg : β j, β n β₯ j, f n Z β€ 0 := by | |
| intro j | |
| obtain β¨n, hn, hfnβ© := (hstage j).2.2.1 | |
| exact β¨n, by omega, | |
| (hmono n Z (X (j+1)) hIZ (iInter_subset X (j+1)) (hXY (j+1))).trans hfnβ© | |
| have hreset : β j, β n β₯ j+1, -1 β€ f n (X (j+1)) := by | |
| by_contra hn | |
| push Not at hn | |
| have heq : β j, X (j+1) = X j := by | |
| intro j | |
| rcases (hstage j).2.2.2.2 with h | h | |
| Β· exact h | |
| Β· obtain β¨n, hnj, hltβ© := hn j | |
| exact (hlt.not_ge (h n hnj)).elim | |
| have hconst : β j, X j = Y := by | |
| intro j | |
| induction j with | |
| | zero => exact hX0 | |
| | succ j ih => exact (heq j).trans ih | |
| obtain β¨j, hjβ© := hhigh | |
| obtain β¨n, hn, hfnβ© := (hstage j).2.2.1 | |
| rw [hconst (j+1)] at hfn | |
| exact (hj n (by omega)).not_ge hfn | |
| obtain β¨jβ, hjββ© := hreset | |
| have hreset_range : β k, jβ+1 β€ k β β n β₯ k, -1 β€ f n (X k) := by | |
| intro k hk | |
| induction k, hk using Nat.le_induction with | |
| | base => exact hjβ | |
| | succ k hk ih => | |
| intro n hn | |
| rcases (hstage k).2.2.2.2 with h | h | |
| Β· rw [h] | |
| exact ih n (by omega) | |
| Β· exact h n hn | |
| have hlower : β n, jβ+1 β€ n β β k β₯ n, | |
| -1 - (1/2:β)^n + (1/2:β)^k β€ f n (X k) := by | |
| intro n hn k hk | |
| induction k, hk using Nat.le_induction with | |
| | base => simpa using hreset_range n hn n le_rfl | |
| | succ k hk ih => | |
| have hloss := (abs_lt.mp ((hstage k).2.2.2.1 n (by omega))).2 | |
| have hpower : (1/2:β)^(k+1) = (1/2:β)^k / 2 := by rw [pow_succ]; ring | |
| rw [hpower] at hloss β’ | |
| linarith | |
| have hlower_Z : β n, jβ+1 β€ n β -1 - (1/2:β)^n β€ f n Z := by | |
| intro n hn | |
| apply ge_of_tendsto (hcc.tendsto_iInter hanti hIX hXY n) | |
| filter_upwards [eventually_ge_atTop n] with k hk | |
| have hpow : 0 β€ (1/2:β)^k := by positivity | |
| exact (le_add_of_nonneg_right hpow).trans (hlower n hn k hk) | |
| refine β¨Z, hIZ, hZY, hneg, ?_β© | |
| intro Ξ΅ hΞ΅ | |
| have hpowlim : Tendsto (fun n : β β¦ (1/2:β)^n) atTop (π 0) := | |
| tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num) (by norm_num) | |
| obtain β¨N, hNβ© := eventually_atTop.mp ((tendsto_order.mp hpowlim).2 Ξ΅ hΞ΅) | |
| refine β¨max (jβ+1) N, fun n hn β¦ ?_β© | |
| have h1 := hlower_Z n ((le_max_left _ _).trans hn) | |
| have h2 := hN n ((le_max_right _ _).trans hn) | |
| linarith | |
| /-- Extended lower limiting value of the real probes. -/ | |
| noncomputable def probeLiminf {Ξ± : Type*} (f : β β Set Ξ± β β) (X : Set Ξ±) : EReal := | |
| liminf (fun n β¦ (f n X : EReal)) atTop | |
| lemma ereal_liminf_add_real (u : β β EReal) (b : β) : | |
| liminf (fun n β¦ u n + (b : EReal)) atTop = liminf u atTop + (b : EReal) := by | |
| apply le_antisymm | |
| Β· have h := EReal.liminf_add_le (u := fun _ : β β¦ (b : EReal)) (v := u) | |
| (f := atTop) (Or.inl (by simp)) (Or.inl (by simp)) | |
| simpa [Pi.add_def, add_comm] using h | |
| Β· simpa [Pi.add_def] using | |
| EReal.le_liminf_add (u := u) (v := fun _ : β β¦ (b : EReal)) (f := atTop) | |
| lemma probeLiminf_finite_change {Ξ± : Type*} {f : β β Set Ξ± β β} | |
| {X Y : Set Ξ±} {b : β} (h : βαΆ n in atTop, f n Y = f n X + b) : | |
| probeLiminf f Y = probeLiminf f X + (b : EReal) := by | |
| unfold probeLiminf | |
| rw [β ereal_liminf_add_real] | |
| exact liminf_congr (h.mono fun n hn β¦ by simp [hn, EReal.coe_add]) | |
| lemma probeLiminf_mono {Ξ± : Type*} {f : β β Set Ξ± β β} | |
| {X Y : Set Ξ±} (h : β n, f n X β€ f n Y) : | |
| probeLiminf f X β€ probeLiminf f Y := by | |
| exact liminf_le_liminf (Eventually.of_forall fun n β¦ EReal.coe_le_coe_iff.mpr (h n)) | |
| lemma probeLiminf_le_zero {Ξ± : Type*} {f : β β Set Ξ± β β} {X : Set Ξ±} | |
| (h : β j, β n β₯ j, f n X β€ 0) : probeLiminf f X β€ 0 := by | |
| apply liminf_le_of_frequently_le' | |
| rw [frequently_atTop] | |
| simpa using h | |
| lemma probeLiminf_ge_neg_one {Ξ± : Type*} {f : β β Set Ξ± β β} {X : Set Ξ±} | |
| (h : β Ξ΅ : β, 0 < Ξ΅ β β j, β n β₯ j, -1 - Ξ΅ β€ f n X) : | |
| -1 β€ probeLiminf f X := by | |
| by_contra hbad | |
| obtain β¨r, hr1, hr2β© := EReal.exists_between_coe_real (lt_of_not_ge hbad) | |
| have hr : r < -1 := EReal.coe_lt_coe_iff.mp (by simpa using hr2) | |
| let Ξ΅ : β := (-1-r)/2 | |
| have hΞ΅ : 0 < Ξ΅ := by dsimp [Ξ΅]; linarith | |
| obtain β¨j, hjβ© := h Ξ΅ hΞ΅ | |
| have hbound : ((-1-Ξ΅ : β) : EReal) β€ probeLiminf f X := by | |
| apply le_liminf_of_le (h := ?_) | |
| filter_upwards [eventually_ge_atTop j] with n hn | |
| exact EReal.coe_le_coe_iff.mpr (hj n hn) | |
| have hstrict : (r : EReal) < ((-1-Ξ΅ : β) : EReal) := by | |
| apply EReal.coe_lt_coe_iff.mpr | |
| dsimp [Ξ΅] | |
| linarith | |
| exact (hstrict.trans_le hbound).not_ge hr1.le | |
| /-- The half-closed interval used by the lower-limit rule. -/ | |
| def LowerBasis {Ξ± : Type*} (f : β β Set Ξ± β β) (X : Set Ξ±) : Prop := | |
| -1 < probeLiminf f X β§ probeLiminf f X β€ 0 | |
| lemma infinite_endpoint_liminf_interpolation | |
| {f : β β Set β β β} {I Y : Set β} (hIY : I β Y) | |
| (hcc : CylinderContinuous f I Y) | |
| (hmono : β n A B, I β A β A β B β B β Y β f n A β€ f n B) | |
| (hone : β n A B, I β A β A β B β B β Y β | |
| (β e, B β insert e A) β f n B β€ f n A + 1) | |
| (hlow : β Z, I β Z β Z β Y β (Z \ I).Finite β probeLiminf f Z = β₯) | |
| (hhigh : 0 < probeLiminf f Y) : | |
| β Z, I β Z β§ Z β Y β§ -1 β€ probeLiminf f Z β§ probeLiminf f Z β€ 0 := by | |
| have hlow' : β Z, I β Z β Z β Y β (Z \ I).Finite β | |
| β j, β n β₯ j, f n Z < 0 := by | |
| intro Z hIZ hZY hfin | |
| have hlim : probeLiminf f Z < 0 := by rw [hlow Z hIZ hZY hfin]; exact EReal.bot_lt_coe 0 | |
| have hh := frequently_lt_of_liminf_lt (u := fun n β¦ (f n Z : EReal)) (h := hlim) | |
| simpa [frequently_atTop] using hh | |
| have hhigh' : β j, β n β₯ j, 0 < f n Y := by | |
| have hh := eventually_lt_of_lt_liminf hhigh | |
| simpa [eventually_atTop] using hh | |
| obtain β¨Z, hIZ, hZY, hneg, hbdβ© := | |
| infinite_endpoint_interpolation hIY hcc hmono hone hlow' hhigh' | |
| exact β¨Z, hIZ, hZY, probeLiminf_ge_neg_one hbd, probeLiminf_le_zero hnegβ© | |
| /-- Exact finite-cardinality translation on a fixed interval. -/ | |
| def IntervalFiniteShift {Ξ± : Type*} (f : β β Set Ξ± β β) (I Y : Set Ξ±) : Prop := | |
| β A B, I β A β A β B β B β Y β (B \ A).Finite β | |
| probeLiminf f B = probeLiminf f A + ((B \ A).ncard : EReal) | |
| lemma finite_lower_interpolation {Ξ± : Type*} {f : β β Set Ξ± β β} {I Y : Set Ξ±} | |
| (hIY : I β Y) (hshift : IntervalFiniteShift f I Y) | |
| (hlow : probeLiminf f I β€ -1) (hhigh : 0 < probeLiminf f Y) | |
| (hbot : probeLiminf f I β β₯) : | |
| β B, I β B β§ B β Y β§ LowerBasis f B := by | |
| classical | |
| have htop : probeLiminf f I β β€ := ne_top_of_le_ne_top (by simpa only [EReal.coe_neg, EReal.coe_one] using EReal.coe_ne_top (-1)) hlow | |
| let a := (probeLiminf f I).toReal | |
| have ha : (a : EReal) = probeLiminf f I := EReal.coe_toReal htop hbot | |
| have halow : a β€ -1 := EReal.coe_le_coe_iff.mp (by simpa [ha] using hlow) | |
| let k : β := β-aββ | |
| have hk_le : (k : β) β€ -a := Nat.floor_le (by linarith) | |
| have hk_gt : -a < (k : β) + 1 := Nat.lt_floor_add_one (-a) | |
| have hk : -1 < a + k β§ a + k β€ 0 := by constructor <;> linarith | |
| have hchoose : β H : Finset Ξ±, (H : Set Ξ±) β Y \ I β§ H.card = k := by | |
| by_cases hfin : (Y \ I).Finite | |
| Β· have hgap : k β€ (Y \ I).ncard := by | |
| by_contra hn | |
| have hn' : ((Y \ I).ncard : β) < k := by exact_mod_cast lt_of_not_ge hn | |
| have hy := hshift I Y Subset.rfl hIY Subset.rfl hfin | |
| have hval : probeLiminf f Y = ((a + (Y \ I).ncard : β) : EReal) := by | |
| rw [hy, β ha, EReal.coe_add, EReal.coe_natCast] | |
| have hpos : 0 < a + (Y \ I).ncard := EReal.coe_lt_coe_iff.mp (by simpa [hval] using hhigh) | |
| linarith | |
| have hc : k β€ hfin.toFinset.card := by simpa only [Set.ncard_eq_toFinset_card _ hfin] using hgap | |
| obtain β¨H, hH, hcHβ© := Finset.exists_subset_card_eq hc | |
| exact β¨H, fun x hx β¦ by simpa using hH hx, hcHβ© | |
| Β· exact Set.Infinite.exists_subset_card_eq hfin k | |
| obtain β¨H, hH, hcardβ© := hchoose | |
| let B := I βͺ (H : Set Ξ±) | |
| have hIB : I β B := subset_union_left | |
| have hBY : B β Y := union_subset hIY (hH.trans sdiff_subset) | |
| have hdiff : B \ I = (H : Set Ξ±) := by | |
| ext x | |
| have hx := @hH x | |
| simp only [B, Set.mem_sdiff, mem_union] at hx β’ | |
| tauto | |
| have hval := hshift I B Subset.rfl hIB hBY (by rw [hdiff]; exact H.finite_toSet) | |
| have hval' : probeLiminf f B = ((a+k : β) : EReal) := by | |
| simpa [hdiff, hcard, β ha, EReal.coe_add] using hval | |
| refine β¨B, hIB, hBY, ?_β© | |
| rw [LowerBasis, hval'] | |
| constructor | |
| Β· exact EReal.coe_lt_coe_iff.mpr hk.1 | |
| Β· exact EReal.coe_le_coe_iff.mpr hk.2 | |
| lemma finite_upper_interpolation {Ξ± : Type*} {f : β β Set Ξ± β β} {I Y : Set Ξ±} | |
| (hIY : I β Y) (hshift : IntervalFiniteShift f I Y) | |
| (hlow : probeLiminf f I = β₯) (hhigh : 0 < probeLiminf f Y) | |
| (htop : probeLiminf f Y β β€) : | |
| β B, I β B β§ B β Y β§ LowerBasis f B := by | |
| classical | |
| have hbot : probeLiminf f Y β β₯ := ne_bot_of_gt hhigh | |
| let b := (probeLiminf f Y).toReal | |
| have hb : (b : EReal) = probeLiminf f Y := EReal.coe_toReal htop hbot | |
| have hbpos : 0 < b := EReal.coe_lt_coe_iff.mp (by simpa [hb] using hhigh) | |
| let k : β := βbββ | |
| have hk_le : b β€ (k : β) := Nat.le_ceil b | |
| have hk_gt : (k : β) < b + 1 := Nat.ceil_lt_add_one hbpos.le | |
| have hk : -1 < b - k β§ b - k β€ 0 := by constructor <;> linarith | |
| have hgap : (Y \ I).Infinite := by | |
| intro hfin | |
| have hh := hshift I Y Subset.rfl hIY Subset.rfl hfin | |
| rw [hlow, EReal.bot_add] at hh | |
| exact hbot hh | |
| obtain β¨H, hH, hcardβ© := hgap.exists_subset_card_eq k | |
| let B := Y \ (H : Set Ξ±) | |
| have hIB : I β B := by | |
| intro x hx | |
| exact β¨hIY hx, fun h β¦ (hH h).2 hxβ© | |
| have hBY : B β Y := sdiff_subset | |
| have hdiff : Y \ B = (H : Set Ξ±) := by | |
| ext x | |
| have hx := @hH x | |
| simp only [B, Set.mem_sdiff] at hx β’ | |
| tauto | |
| have hval := hshift B Y hIB hBY Subset.rfl (by rw [hdiff]; exact H.finite_toSet) | |
| have hval' : probeLiminf f B = ((b-k : β) : EReal) := by | |
| have hh := congrArg (fun x : EReal β¦ x - ((k : β) : EReal)) hval | |
| simpa [hdiff, hcard, β hb, β EReal.coe_natCast, EReal.add_sub_cancel_right, | |
| β EReal.coe_sub] using hh.symm | |
| refine β¨B, hIB, hBY, ?_β© | |
| rw [LowerBasis, hval'] | |
| exact β¨EReal.coe_lt_coe_iff.mpr hk.1, EReal.coe_le_coe_iff.mpr hk.2β© | |
| /-- The complete local interpolation argument, including both finite | |
| rounding cases and the opposite-infinite-endpoint case. -/ | |
| lemma local_interpolation | |
| {f : β β Set β β β} {I Y : Set β} (hIY : I β Y) | |
| (hcc : CylinderContinuous f I Y) | |
| (hmono : β n A B, I β A β A β B β B β Y β f n A β€ f n B) | |
| (hone : β n A B, I β A β A β B β B β Y β | |
| (β e, B β insert e A) β f n B β€ f n A + 1) | |
| (hshift : IntervalFiniteShift f I Y) | |
| (hlow : probeLiminf f I β€ -1) (hhigh : 0 < probeLiminf f Y) : | |
| β B, I β B β§ B β Y β§ LowerBasis f B := by | |
| classical | |
| by_cases hbot : probeLiminf f I = β₯ | |
| Β· by_cases htop : probeLiminf f Y = β€ | |
| Β· have hlow' : β Z, I β Z β Z β Y β (Z \ I).Finite β probeLiminf f Z = β₯ := by | |
| intro Z hIZ hZY hfin | |
| rw [hshift I Z Subset.rfl hIZ hZY hfin, hbot, EReal.bot_add] | |
| obtain β¨Z, hIZ, hZY, hZlo, hZhiβ© := | |
| infinite_endpoint_liminf_interpolation hIY hcc hmono hone hlow' hhigh | |
| rcases lt_or_eq_of_le hZlo with hZlo | hZeq | |
| Β· exact β¨Z, hIZ, hZY, hZlo, hZhiβ© | |
| Β· have hgap : (Y \ Z).Nonempty := by | |
| by_contra hn | |
| have hyz : Y β Z := sdiff_eq_empty.mp (not_nonempty_iff_eq_empty.mp hn) | |
| have hZYeq : Z = Y := Subset.antisymm hZY hyz | |
| rw [hZYeq, htop] at hZhi | |
| exact (EReal.coe_lt_top 0).not_ge hZhi | |
| obtain β¨e, heY, heZβ© := hgap | |
| have hIBe : I β insert e Z := hIZ.trans (subset_insert _ _) | |
| have hBeY : insert e Z β Y := insert_subset heY hZY | |
| have hdiff : insert e Z \ Z = {e} := by ext x; simp [heZ] | |
| have hval := hshift Z (insert e Z) hIZ (subset_insert _ _) hBeY | |
| (by rw [hdiff]; exact finite_singleton e) | |
| have hzero : probeLiminf f (insert e Z) = 0 := by | |
| rw [hdiff, ncard_singleton, β hZeq] at hval | |
| have hc : (-1 : EReal) + 1 = 0 := by | |
| have hh := congrArg (fun r : β β¦ (r : EReal)) (show (-1 : β) + 1 = 0 by ring) | |
| simpa only [EReal.coe_add, EReal.coe_neg, EReal.coe_one, EReal.coe_zero] using hh | |
| simpa only [Nat.cast_one, hc] using hval | |
| refine β¨insert e Z, hIBe, hBeY, ?_β© | |
| simp [LowerBasis, hzero] | |
| Β· exact finite_upper_interpolation hIY hshift hbot hhigh htop | |
| Β· exact finite_lower_interpolation hIY hshift hlow hhigh hbot | |
| end InfiniteMatroidCounterexample | |
| end | |
| end OAI | |