Theorem: ContinuousOn.if'
File: Mathlib/Topology/ContinuousOn.lean

tactic: intro x hx
state_before: α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
⊢ ContinuousOn (fun a => if p a then f a else g a) s

tactic: by_cases hx' : x ∈ frontier { a | p a }
state_before: α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx : x ∈ s
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) s x

tactic: exact (hpf x ⟨hx, hx'⟩).piecewise_nhdsWithin (hpg x ⟨hx, hx'⟩)
state_before: case pos
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx : x ∈ s
hx' : x ∈ frontier {a | p a}
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) s x

tactic: rw [← inter_univ s, ← union_compl_self { a | p a }, inter_union_distrib_left] at hx ⊢
state_before: case neg
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx : x ∈ s
hx' : ¬x ∈ frontier {a | p a}
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) s x

tactic: cases' hx with hx hx
state_before: case neg
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx : x ∈ s ∩ {a | p a} ∪ s ∩ {a | p a}ᶜ
hx' : ¬x ∈ frontier {a | p a}
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a} ∪ s ∩ {a | p a}ᶜ) x

tactic: apply ContinuousWithinAt.union
state_before: case neg.inl
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a} ∪ s ∩ {a | p a}ᶜ) x

tactic: exact (hf x hx).congr (fun y hy => if_pos hy.2) (if_pos hx.2)
state_before: case neg.inl.hs
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a}) x

tactic: have : x ∉ closure ({ a | p a }ᶜ) := fun h => hx' ⟨subset_closure hx.2, by
  rwa [closure_compl] at h⟩
state_before: case neg.inl.ht
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a}ᶜ) x

tactic: exact continuousWithinAt_of_not_mem_closure fun h =>
  this (closure_inter_subset_inter_closure _ _ h).2
state_before: case neg.inl.ht
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}
this : ¬x ∈ closure ({a | p a}ᶜ)
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a}ᶜ) x

tactic: rwa [closure_compl] at h
state_before: α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}
h : x ∈ closure ({a | p a}ᶜ)
⊢ ¬x ∈ interior {a | p a}

tactic: apply ContinuousWithinAt.union
state_before: case neg.inr
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}ᶜ
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a} ∪ s ∩ {a | p a}ᶜ) x

tactic: have : x ∉ closure { a | p a } := fun h =>
  hx' ⟨h, fun h' : x ∈ interior { a | p a } => hx.2 (interior_subset h')⟩
state_before: case neg.inr.hs
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}ᶜ
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a}) x

tactic: exact continuousWithinAt_of_not_mem_closure fun h =>
  this (closure_inter_subset_inter_closure _ _ h).2
state_before: case neg.inr.hs
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}ᶜ
this : ¬x ∈ closure {a | p a}
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a}) x

tactic: exact (hg x hx).congr (fun y hy => if_neg hy.2) (if_neg hx.2)
state_before: case neg.inr.ht
α : Type u_1
β : Type u_2
γ : Type ?u.370900
δ : Type ?u.370903
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : TopologicalSpace δ
s : Set α
p : α → Prop
f g : α → β
inst✝ : (a : α) → Decidable (p a)
hpf : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto f (𝓝[s ∩ {a | p a}] a) (𝓝 (if p a then f a else g a))
hpg : ∀ (a : α), a ∈ s ∩ frontier {a | p a} → Tendsto g (𝓝[s ∩ {a | ¬p a}] a) (𝓝 (if p a then f a else g a))
hf : ContinuousOn f (s ∩ {a | p a})
hg : ContinuousOn g (s ∩ {a | ¬p a})
x : α
hx' : ¬x ∈ frontier {a | p a}
hx : x ∈ s ∩ {a | p a}ᶜ
⊢ ContinuousWithinAt (fun a => if p a then f a else g a) (s ∩ {a | p a}ᶜ) x