math / data /lean /OAI /Combinatorics /InfiniteMatroid /Interpolation.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
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