l3lab/ntp-mathlib huggingface dataset:
theorem lowerSemicontinuousWithinAt_ciSup {f : ι → α → δ'}
    (bdd : ∀ᶠ y in 𝓝[s] x, BddAbove (range fun i => f i y))
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') s x := by
  cases isEmpty_or_nonempty ι
  · 

Proof state:
case inl
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ'
bdd : ∀ᶠ (y : α) in 𝓝[s] x, BddAbove (range fun i => f i y)
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
h✝ : IsEmpty ι
⊢ LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') s x

Next tactic:
simpa only [iSup_of_empty'] using lowerSemicontinuousWithinAt_const
theorem lowerSemicontinuousWithinAt_ciSup {f : ι → α → δ'}
    (bdd : ∀ᶠ y in 𝓝[s] x, BddAbove (range fun i => f i y))
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') s x := by
  cases isEmpty_or_nonempty ι
  · simpa only [iSup_of_empty'] using lowerSemicontinuousWithinAt_const
  · 

Proof state:
case inr
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ'
bdd : ∀ᶠ (y : α) in 𝓝[s] x, BddAbove (range fun i => f i y)
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
h✝ : Nonempty ι
⊢ LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') s x

Next tactic:
intro y hy
theorem lowerSemicontinuousWithinAt_ciSup {f : ι → α → δ'}
    (bdd : ∀ᶠ y in 𝓝[s] x, BddAbove (range fun i => f i y))
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') s x := by
  cases isEmpty_or_nonempty ι
  · simpa only [iSup_of_empty'] using lowerSemicontinuousWithinAt_const
  · intro y hy
    

Proof state:
case inr
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y✝ z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ'
bdd : ∀ᶠ (y : α) in 𝓝[s] x, BddAbove (range fun i => f i y)
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
h✝ : Nonempty ι
y : δ'
hy : y < (fun x' => ⨆ i, f i x') x
⊢ ∀ᶠ (x' : α) in 𝓝[s] x, y < (fun x' => ⨆ i, f i x') x'

Next tactic:
rcases exists_lt_of_lt_ciSup hy with ⟨i, hi⟩
theorem lowerSemicontinuousWithinAt_ciSup {f : ι → α → δ'}
    (bdd : ∀ᶠ y in 𝓝[s] x, BddAbove (range fun i => f i y))
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') s x := by
  cases isEmpty_or_nonempty ι
  · simpa only [iSup_of_empty'] using lowerSemicontinuousWithinAt_const
  · intro y hy
    rcases exists_lt_of_lt_ciSup hy with ⟨i, hi⟩
    

Proof state:
case inr.intro
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y✝ z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ'
bdd : ∀ᶠ (y : α) in 𝓝[s] x, BddAbove (range fun i => f i y)
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
h✝ : Nonempty ι
y : δ'
hy : y < (fun x' => ⨆ i, f i x') x
i : ι
hi : y < f i x
⊢ ∀ᶠ (x' : α) in 𝓝[s] x, y < (fun x' => ⨆ i, f i x') x'

Next tactic:
filter_upwards [h i y hi, bdd] with y hy hy' using hy.trans_le (le_ciSup hy' i)
theorem lowerSemicontinuousWithinAt_iSup {f : ι → α → δ}
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') s x :=
  lowerSemicontinuousWithinAt_ciSup (by 

Proof state:
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
⊢ ∀ᶠ (y : α) in 𝓝[s] x, BddAbove (range fun i => f i y)

Next tactic:
simp
theorem lowerSemicontinuousAt_ciSup {f : ι → α → δ'}
    (bdd : ∀ᶠ y in 𝓝 x, BddAbove (range fun i => f i y)) (h : ∀ i, LowerSemicontinuousAt (f i) x) :
    LowerSemicontinuousAt (fun x' => ⨆ i, f i x') x := by
  

Proof state:
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ'
bdd : ∀ᶠ (y : α) in 𝓝 x, BddAbove (range fun i => f i y)
h : ∀ (i : ι), LowerSemicontinuousAt (f i) x
⊢ LowerSemicontinuousAt (fun x' => ⨆ i, f i x') x

Next tactic:
simp_rw [← lowerSemicontinuousWithinAt_univ_iff] at *
theorem lowerSemicontinuousAt_ciSup {f : ι → α → δ'}
    (bdd : ∀ᶠ y in 𝓝 x, BddAbove (range fun i => f i y)) (h : ∀ i, LowerSemicontinuousAt (f i) x) :
    LowerSemicontinuousAt (fun x' => ⨆ i, f i x') x := by
  simp_rw [← lowerSemicontinuousWithinAt_univ_iff] at *
  

Proof state:
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ'
bdd : ∀ᶠ (y : α) in 𝓝 x, BddAbove (range fun i => f i y)
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) univ x
⊢ LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') univ x

Next tactic:
rw [← nhdsWithin_univ] at bdd
theorem lowerSemicontinuousAt_ciSup {f : ι → α → δ'}
    (bdd : ∀ᶠ y in 𝓝 x, BddAbove (range fun i => f i y)) (h : ∀ i, LowerSemicontinuousAt (f i) x) :
    LowerSemicontinuousAt (fun x' => ⨆ i, f i x') x := by
  simp_rw [← lowerSemicontinuousWithinAt_univ_iff] at *
  rw [← nhdsWithin_univ] at bdd
  

Proof state:
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ'
bdd : ∀ᶠ (y : α) in 𝓝[univ] x, BddAbove (range fun i => f i y)
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) univ x
⊢ LowerSemicontinuousWithinAt (fun x' => ⨆ i, f i x') univ x

Next tactic:
exact lowerSemicontinuousWithinAt_ciSup bdd h
theorem lowerSemicontinuousAt_iSup {f : ι → α → δ} (h : ∀ i, LowerSemicontinuousAt (f i) x) :
    LowerSemicontinuousAt (fun x' => ⨆ i, f i x') x :=
  lowerSemicontinuousAt_ciSup (by 

Proof state:
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ
h : ∀ (i : ι), LowerSemicontinuousAt (f i) x
⊢ ∀ᶠ (y : α) in 𝓝 x, BddAbove (range fun i => f i y)

Next tactic:
simp
theorem lowerSemicontinuousOn_iSup {f : ι → α → δ} (h : ∀ i, LowerSemicontinuousOn (f i) s) :
    LowerSemicontinuousOn (fun x' => ⨆ i, f i x') s :=
  lowerSemicontinuousOn_ciSup (by 

Proof state:
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ
h : ∀ (i : ι), LowerSemicontinuousOn (f i) s
⊢ ∀ x ∈ s, BddAbove (range fun i => f i x)

Next tactic:
simp
theorem lowerSemicontinuous_iSup {f : ι → α → δ} (h : ∀ i, LowerSemicontinuous (f i)) :
    LowerSemicontinuous fun x' => ⨆ i, f i x' :=
  lowerSemicontinuous_ciSup (by 

Proof state:
α : Type u_1
inst✝³ : TopologicalSpace α
β : Type u_2
inst✝² : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Sort u_3
δ : Type u_4
δ' : Type u_5
inst✝¹ : CompleteLinearOrder δ
inst✝ : ConditionallyCompleteLinearOrder δ'
f : ι → α → δ
h : ∀ (i : ι), LowerSemicontinuous (f i)
⊢ ∀ (x : α), BddAbove (range fun i => f i x)

Next tactic:
simp
theorem lowerSemicontinuousWithinAt_tsum {f : ι → α → ℝ≥0∞}
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ∑' i, f i x') s x := by
  

Proof state:
α : Type u_1
inst✝¹ : TopologicalSpace α
β : Type u_2
inst✝ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
f : ι → α → ℝ≥0∞
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
⊢ LowerSemicontinuousWithinAt (fun x' => ∑' (i : ι), f i x') s x

Next tactic:
simp_rw [ENNReal.tsum_eq_iSup_sum]
theorem lowerSemicontinuousWithinAt_tsum {f : ι → α → ℝ≥0∞}
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ∑' i, f i x') s x := by
  simp_rw [ENNReal.tsum_eq_iSup_sum]
  

Proof state:
α : Type u_1
inst✝¹ : TopologicalSpace α
β : Type u_2
inst✝ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
f : ι → α → ℝ≥0∞
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
⊢ LowerSemicontinuousWithinAt (fun x' => ⨆ s, ∑ i in s, f i x') s x

Next tactic:
refine lowerSemicontinuousWithinAt_iSup fun b => ?_
theorem lowerSemicontinuousWithinAt_tsum {f : ι → α → ℝ≥0∞}
    (h : ∀ i, LowerSemicontinuousWithinAt (f i) s x) :
    LowerSemicontinuousWithinAt (fun x' => ∑' i, f i x') s x := by
  simp_rw [ENNReal.tsum_eq_iSup_sum]
  refine lowerSemicontinuousWithinAt_iSup fun b => ?_
  

Proof state:
α : Type u_1
inst✝¹ : TopologicalSpace α
β : Type u_2
inst✝ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
f : ι → α → ℝ≥0∞
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) s x
b : Finset ι
⊢ LowerSemicontinuousWithinAt (fun x' => ∑ i in b, f i x') s x

Next tactic:
exact lowerSemicontinuousWithinAt_sum fun i _hi => h i
theorem lowerSemicontinuousAt_tsum {f : ι → α → ℝ≥0∞} (h : ∀ i, LowerSemicontinuousAt (f i) x) :
    LowerSemicontinuousAt (fun x' => ∑' i, f i x') x := by
  

Proof state:
α : Type u_1
inst✝¹ : TopologicalSpace α
β : Type u_2
inst✝ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
f : ι → α → ℝ≥0∞
h : ∀ (i : ι), LowerSemicontinuousAt (f i) x
⊢ LowerSemicontinuousAt (fun x' => ∑' (i : ι), f i x') x

Next tactic:
simp_rw [← lowerSemicontinuousWithinAt_univ_iff] at *
theorem lowerSemicontinuousAt_tsum {f : ι → α → ℝ≥0∞} (h : ∀ i, LowerSemicontinuousAt (f i) x) :
    LowerSemicontinuousAt (fun x' => ∑' i, f i x') x := by
  simp_rw [← lowerSemicontinuousWithinAt_univ_iff] at *
  

Proof state:
α : Type u_1
inst✝¹ : TopologicalSpace α
β : Type u_2
inst✝ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
f : ι → α → ℝ≥0∞
h : ∀ (i : ι), LowerSemicontinuousWithinAt (f i) univ x
⊢ LowerSemicontinuousWithinAt (fun x' => ∑' (i : ι), f i x') univ x

Next tactic:
exact lowerSemicontinuousWithinAt_tsum h
theorem upperSemicontinuousWithinAt_univ_iff :
    UpperSemicontinuousWithinAt f univ x ↔ UpperSemicontinuousAt f x := by
  

Proof state:
α : Type u_1
inst✝¹ : TopologicalSpace α
β : Type u_2
inst✝ : Preorder β
f g : α → β
x : α
s t : Set α
y z : β
⊢ UpperSemicontinuousWithinAt f univ x ↔ UpperSemicontinuousAt f x

Next tactic:
simp [UpperSemicontinuousWithinAt, UpperSemicontinuousAt, nhdsWithin_univ]
theorem upperSemicontinuousOn_univ_iff : UpperSemicontinuousOn f univ ↔ UpperSemicontinuous f := by
  

Proof state:
α : Type u_1
inst✝¹ : TopologicalSpace α
β : Type u_2
inst✝ : Preorder β
f g : α → β
x : α
s t : Set α
y z : β
⊢ UpperSemicontinuousOn f univ ↔ UpperSemicontinuous f

Next tactic:
simp [UpperSemicontinuousOn, UpperSemicontinuous, upperSemicontinuousWithinAt_univ_iff]
theorem upperSemicontinuous_iff_isClosed_preimage {f : α → γ} :
    UpperSemicontinuous f ↔ ∀ y, IsClosed (f ⁻¹' Ici y) := by
  

Proof state:
α : Type u_1
inst✝² : TopologicalSpace α
β : Type u_2
inst✝¹ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝ : LinearOrder γ
f : α → γ
⊢ UpperSemicontinuous f ↔ ∀ (y : γ), IsClosed (f ⁻¹' Ici y)

Next tactic:
rw [upperSemicontinuous_iff_isOpen_preimage]
theorem upperSemicontinuous_iff_isClosed_preimage {f : α → γ} :
    UpperSemicontinuous f ↔ ∀ y, IsClosed (f ⁻¹' Ici y) := by
  rw [upperSemicontinuous_iff_isOpen_preimage]
  

Proof state:
α : Type u_1
inst✝² : TopologicalSpace α
β : Type u_2
inst✝¹ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝ : LinearOrder γ
f : α → γ
⊢ (∀ (y : γ), IsOpen (f ⁻¹' Iio y)) ↔ ∀ (y : γ), IsClosed (f ⁻¹' Ici y)

Next tactic:
simp only [← isOpen_compl_iff, ← preimage_compl, compl_Ici]
/-- The sum of two upper semicontinuous functions is upper semicontinuous. Formulated with an
explicit continuity assumption on addition, for application to `EReal`. The unprimed version of
the lemma uses `[ContinuousAdd]`. -/
theorem UpperSemicontinuousAt.add' {f g : α → γ} (hf : UpperSemicontinuousAt f x)
    (hg : UpperSemicontinuousAt g x)
    (hcont : ContinuousAt (fun p : γ × γ => p.1 + p.2) (f x, g x)) :
    UpperSemicontinuousAt (fun z => f z + g z) x := by
  

Proof state:
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g✝ : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
γ : Type u_4
inst✝² : LinearOrderedAddCommMonoid γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f g : α → γ
hf : UpperSemicontinuousAt f x
hg : UpperSemicontinuousAt g x
hcont : ContinuousAt (fun p => p.1 + p.2) (f x, g x)
⊢ UpperSemicontinuousAt (fun z => f z + g z) x

Next tactic:
simp_rw [← upperSemicontinuousWithinAt_univ_iff] at *
/-- The sum of two upper semicontinuous functions is upper semicontinuous. Formulated with an
explicit continuity assumption on addition, for application to `EReal`. The unprimed version of
the lemma uses `[ContinuousAdd]`. -/
theorem UpperSemicontinuousAt.add' {f g : α → γ} (hf : UpperSemicontinuousAt f x)
    (hg : UpperSemicontinuousAt g x)
    (hcont : ContinuousAt (fun p : γ × γ => p.1 + p.2) (f x, g x)) :
    UpperSemicontinuousAt (fun z => f z + g z) x := by
  simp_rw [← upperSemicontinuousWithinAt_univ_iff] at *
  

Proof state:
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g✝ : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
γ : Type u_4
inst✝² : LinearOrderedAddCommMonoid γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f g : α → γ
hcont : ContinuousAt (fun p => p.1 + p.2) (f x, g x)
hf : UpperSemicontinuousWithinAt f univ x
hg : UpperSemicontinuousWithinAt g univ x
⊢ UpperSemicontinuousWithinAt (fun z => f z + g z) univ x

Next tactic:
exact hf.add' hg hcont
theorem upperSemicontinuousAt_sum {f : ι → α → γ} {a : Finset ι}
    (ha : ∀ i ∈ a, UpperSemicontinuousAt (f i) x) :
    UpperSemicontinuousAt (fun z => ∑ i in a, f i z) x := by
  

Proof state:
α : Type u_1
inst✝⁵ : TopologicalSpace α
β : Type u_2
inst✝⁴ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
γ : Type u_4
inst✝³ : LinearOrderedAddCommMonoid γ
inst✝² : TopologicalSpace γ
inst✝¹ : OrderTopology γ
inst✝ : ContinuousAdd γ
f : ι → α → γ
a : Finset ι
ha : ∀ i ∈ a, UpperSemicontinuousAt (f i) x
⊢ UpperSemicontinuousAt (fun z => ∑ i in a, f i z) x

Next tactic:
simp_rw [← upperSemicontinuousWithinAt_univ_iff] at *
theorem upperSemicontinuousAt_sum {f : ι → α → γ} {a : Finset ι}
    (ha : ∀ i ∈ a, UpperSemicontinuousAt (f i) x) :
    UpperSemicontinuousAt (fun z => ∑ i in a, f i z) x := by
  simp_rw [← upperSemicontinuousWithinAt_univ_iff] at *
  

Proof state:
α : Type u_1
inst✝⁵ : TopologicalSpace α
β : Type u_2
inst✝⁴ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
ι : Type u_3
γ : Type u_4
inst✝³ : LinearOrderedAddCommMonoid γ
inst✝² : TopologicalSpace γ
inst✝¹ : OrderTopology γ
inst✝ : ContinuousAdd γ
f : ι → α → γ
a : Finset ι
ha : ∀ i ∈ a, UpperSemicontinuousWithinAt (f i) univ x
⊢ UpperSemicontinuousWithinAt (fun z => ∑ i in a, f i z) univ x

Next tactic:
exact upperSemicontinuousWithinAt_sum ha
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  

Proof state:
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
⊢ ContinuousWithinAt f s x ↔ LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x

Next tactic:
refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  

Proof state:
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
⊢ LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x → ContinuousWithinAt f s x

Next tactic:
rintro ⟨h₁, h₂⟩
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  

Proof state:
case intro
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
⊢ ContinuousWithinAt f s x

Next tactic:
intro v hv
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  intro v hv
  

Proof state:
case intro
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
v : Set γ
hv : v ∈ 𝓝 (f x)
⊢ v ∈ map f (𝓝[s] x)

Next tactic:
simp only [Filter.mem_map]
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  intro v hv
  simp only [Filter.mem_map]
  

Proof state:
case intro
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
v : Set γ
hv : v ∈ 𝓝 (f x)
⊢ f ⁻¹' v ∈ 𝓝[s] x

Next tactic:
by_cases Hl : ∃ l, l < f x
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  intro v hv
  simp only [Filter.mem_map]
  by_cases Hl : ∃ l, l < f x
  · 

Proof state:
case pos
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
v : Set γ
hv : v ∈ 𝓝 (f x)
Hl : ∃ l, l < f x
⊢ f ⁻¹' v ∈ 𝓝[s] x

Next tactic:
rcases exists_Ioc_subset_of_mem_nhds hv Hl with ⟨l, lfx, hl⟩
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  intro v hv
  simp only [Filter.mem_map]
  by_cases Hl : ∃ l, l < f x
  · rcases exists_Ioc_subset_of_mem_nhds hv Hl with ⟨l, lfx, hl⟩
    

Proof state:
case pos.intro.intro
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
v : Set γ
hv : v ∈ 𝓝 (f x)
Hl : ∃ l, l < f x
l : γ
lfx : l < f x
hl : Ioc l (f x) ⊆ v
⊢ f ⁻¹' v ∈ 𝓝[s] x

Next tactic:
by_cases Hu : ∃ u, f x < u
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  intro v hv
  simp only [Filter.mem_map]
  by_cases Hl : ∃ l, l < f x
  · rcases exists_Ioc_subset_of_mem_nhds hv Hl with ⟨l, lfx, hl⟩
    by_cases Hu : ∃ u, f x < u
    · 

Proof state:
case pos
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
v : Set γ
hv : v ∈ 𝓝 (f x)
Hl : ∃ l, l < f x
l : γ
lfx : l < f x
hl : Ioc l (f x) ⊆ v
Hu : ∃ u, f x < u
⊢ f ⁻¹' v ∈ 𝓝[s] x

Next tactic:
rcases exists_Ico_subset_of_mem_nhds hv Hu with ⟨u, fxu, hu⟩
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  intro v hv
  simp only [Filter.mem_map]
  by_cases Hl : ∃ l, l < f x
  · rcases exists_Ioc_subset_of_mem_nhds hv Hl with ⟨l, lfx, hl⟩
    by_cases Hu : ∃ u, f x < u
    · rcases exists_Ico_subset_of_mem_nhds hv Hu with ⟨u, fxu, hu⟩
      

Proof state:
case pos.intro.intro
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
v : Set γ
hv : v ∈ 𝓝 (f x)
Hl : ∃ l, l < f x
l : γ
lfx : l < f x
hl : Ioc l (f x) ⊆ v
Hu : ∃ u, f x < u
u : γ
fxu : f x < u
hu : Ico (f x) u ⊆ v
⊢ f ⁻¹' v ∈ 𝓝[s] x

Next tactic:
filter_upwards [h₁ l lfx, h₂ u fxu] with a lfa fau
theorem continuousWithinAt_iff_lower_upperSemicontinuousWithinAt {f : α → γ} :
    ContinuousWithinAt f s x ↔
      LowerSemicontinuousWithinAt f s x ∧ UpperSemicontinuousWithinAt f s x := by
  refine' ⟨fun h => ⟨h.lowerSemicontinuousWithinAt, h.upperSemicontinuousWithinAt⟩, _⟩
  rintro ⟨h₁, h₂⟩
  intro v hv
  simp only [Filter.mem_map]
  by_cases Hl : ∃ l, l < f x
  · rcases exists_Ioc_subset_of_mem_nhds hv Hl with ⟨l, lfx, hl⟩
    by_cases Hu : ∃ u, f x < u
    · rcases exists_Ico_subset_of_mem_nhds hv Hu with ⟨u, fxu, hu⟩
      filter_upwards [h₁ l lfx, h₂ u fxu] with a lfa fau
      

Proof state:
case h
α : Type u_1
inst✝⁴ : TopologicalSpace α
β : Type u_2
inst✝³ : Preorder β
f✝ g : α → β
x : α
s t : Set α
y z : β
γ : Type u_3
inst✝² : LinearOrder γ
inst✝¹ : TopologicalSpace γ
inst✝ : OrderTopology γ
f : α → γ
h₁ : LowerSemicontinuousWithinAt f s x
h₂ : UpperSemicontinuousWithinAt f s x
v : Set γ
hv : v ∈ 𝓝 (f x)
Hl : ∃ l, l < f x
l : γ
lfx : l < f x
hl : Ioc l (f x) ⊆ v
Hu : ∃ u, f x < u
u : γ
fxu : f x < u
hu : Ico (f x) u ⊆ v
a : α
lfa : l < f a
fau : f a < u
⊢ a ∈ f ⁻¹' v

Next tactic:
cases' le_or_gt (f a) (f x) with h h