roseking's picture
Add lean source and binary files (part 45)
c270adf 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