l3lab/ntp-mathlib huggingface dataset:
/-- The *identity principle* for analytic functions, global version: if two functions are
analytic on a connected set `U` and coincide at points which accumulate to a point `z₀ ∈ U`, then
they coincide globally in `U`.
For higher-dimensional versions requiring that the functions coincide in a neighborhood of `z₀`,
see `AnalyticOn.eqOn_of_preconnected_of_eventuallyEq`. -/
theorem eqOn_of_preconnected_of_frequently_eq (hf : AnalyticOn 𝕜 f U) (hg : AnalyticOn 𝕜 g U)
    (hU : IsPreconnected U) (h₀ : z₀ ∈ U) (hfg : ∃ᶠ z in 𝓝[≠] z₀, f z = g z) : EqOn f g U := by
  have hfg' : ∃ᶠ z in 𝓝[≠] z₀, (f - g) z = 0 :=
    hfg.mono fun z h => by 

Proof state:
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
s : E
p q : FormalMultilinearSeries 𝕜 𝕜 E
f g : 𝕜 → E
n : ℕ
z✝ z₀ : 𝕜
U : Set 𝕜
hf : AnalyticOn 𝕜 f U
hg : AnalyticOn 𝕜 g U
hU : IsPreconnected U
h₀ : z₀ ∈ U
hfg : ∃ᶠ (z : 𝕜) in 𝓝[≠] z₀, f z = g z
z : 𝕜
h : f z = g z
⊢ (f - g) z = 0

Next tactic:
rw [Pi.sub_apply, h, sub_self]
/-- The *identity principle* for analytic functions, global version: if two functions are
analytic on a connected set `U` and coincide at points which accumulate to a point `z₀ ∈ U`, then
they coincide globally in `U`.
For higher-dimensional versions requiring that the functions coincide in a neighborhood of `z₀`,
see `AnalyticOn.eqOn_of_preconnected_of_eventuallyEq`. -/
theorem eqOn_of_preconnected_of_frequently_eq (hf : AnalyticOn 𝕜 f U) (hg : AnalyticOn 𝕜 g U)
    (hU : IsPreconnected U) (h₀ : z₀ ∈ U) (hfg : ∃ᶠ z in 𝓝[≠] z₀, f z = g z) : EqOn f g U := by
  have hfg' : ∃ᶠ z in 𝓝[≠] z₀, (f - g) z = 0 :=
    hfg.mono fun z h => by rw [Pi.sub_apply, h, sub_self]
  

Proof state:
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
s : E
p q : FormalMultilinearSeries 𝕜 𝕜 E
f g : 𝕜 → E
n : ℕ
z z₀ : 𝕜
U : Set 𝕜
hf : AnalyticOn 𝕜 f U
hg : AnalyticOn 𝕜 g U
hU : IsPreconnected U
h₀ : z₀ ∈ U
hfg : ∃ᶠ (z : 𝕜) in 𝓝[≠] z₀, f z = g z
hfg' : ∃ᶠ (z : 𝕜) in 𝓝[≠] z₀, (f - g) z = 0
⊢ EqOn f g U

Next tactic:
simpa [sub_eq_zero] using fun z hz =>
    (hf.sub hg).eqOn_zero_of_preconnected_of_frequently_eq_zero hU h₀ hfg' hz
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    

Proof state:
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Epi g
⊢ ∃ f', f' ≫ g = f

Next tactic:
rw [epi_iff_surjective] at hg
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    

Proof state:
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
⊢ ∃ f', f' ≫ g = f

Next tactic:
obtain ⟨g', hg'⟩ := hg.hasRightInverse
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    

Proof state:
case intro
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
⊢ ∃ f', f' ≫ g = f

Next tactic:
let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    

Proof state:
case intro
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
⊢ ∃ f', f' ≫ g = f

Next tactic:
let h : Ultrafilter X → Y := Ultrafilter.extend t
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    

Proof state:
case intro
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
⊢ ∃ f', f' ≫ g = f

Next tactic:
have hh : Continuous h := continuous_ultrafilter_extend _
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    have hh : Continuous h := continuous_ultrafilter_extend _
    

Proof state:
case intro
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
hh : Continuous h
⊢ ∃ f', f' ≫ g = f

Next tactic:
use ⟨h, hh⟩
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    have hh : Continuous h := continuous_ultrafilter_extend _
    use ⟨h, hh⟩
    

Proof state:
case h
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
hh : Continuous h
⊢ ContinuousMap.mk h ≫ g = f

Next tactic:
apply Faithful.map_injective (F := forget Profinite)
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    have hh : Continuous h := continuous_ultrafilter_extend _
    use ⟨h, hh⟩
    apply Faithful.map_injective (F := forget Profinite)
    

Proof state:
case h.a
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
hh : Continuous h
⊢ (forget Profinite).map (ContinuousMap.mk h ≫ g) = (forget Profinite).map f

Next tactic:
simp only [ContinuousMap.coe_mk, coe_comp]
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    have hh : Continuous h := continuous_ultrafilter_extend _
    use ⟨h, hh⟩
    apply Faithful.map_injective (F := forget Profinite)
    simp only [ContinuousMap.coe_mk, coe_comp]
    

Proof state:
case h.a
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
hh : Continuous h
⊢ (forget Profinite).map (ContinuousMap.mk (Ultrafilter.extend (g' ∘ ⇑f ∘ pure)) ≫ g) = (forget Profinite).map f

Next tactic:
convert denseRange_pure.equalizer (g.continuous.comp hh) f.continuous _
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    have hh : Continuous h := continuous_ultrafilter_extend _
    use ⟨h, hh⟩
    apply Faithful.map_injective (F := forget Profinite)
    simp only [ContinuousMap.coe_mk, coe_comp]
    convert denseRange_pure.equalizer (g.continuous.comp hh) f.continuous _
     -- Porting note: same fix as in `Topology.Category.CompHaus.Projective`
    

Proof state:
case h.a
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
hh : Continuous h
⊢ (⇑g ∘ h) ∘ pure = ⇑f ∘ pure

Next tactic:
let g'' : ContinuousMap Y Z := g
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    have hh : Continuous h := continuous_ultrafilter_extend _
    use ⟨h, hh⟩
    apply Faithful.map_injective (F := forget Profinite)
    simp only [ContinuousMap.coe_mk, coe_comp]
    convert denseRange_pure.equalizer (g.continuous.comp hh) f.continuous _
     -- Porting note: same fix as in `Topology.Category.CompHaus.Projective`
    let g'' : ContinuousMap Y Z := g
    

Proof state:
case h.a
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
hh : Continuous h
g'' : C(↑Y.toCompHaus.toTop, ↑Z.toCompHaus.toTop) := g
⊢ (⇑g ∘ h) ∘ pure = ⇑f ∘ pure

Next tactic:
have : g'' ∘ g' = id := hg'.comp_eq_id
instance projective_ultrafilter (X : Type u) : Projective (of <| Ultrafilter X) where
  factors {Y Z} f g hg := by
    rw [epi_iff_surjective] at hg
    obtain ⟨g', hg'⟩ := hg.hasRightInverse
    let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X)
    let h : Ultrafilter X → Y := Ultrafilter.extend t
    have hh : Continuous h := continuous_ultrafilter_extend _
    use ⟨h, hh⟩
    apply Faithful.map_injective (F := forget Profinite)
    simp only [ContinuousMap.coe_mk, coe_comp]
    convert denseRange_pure.equalizer (g.continuous.comp hh) f.continuous _
     -- Porting note: same fix as in `Topology.Category.CompHaus.Projective`
    let g'' : ContinuousMap Y Z := g
    have : g'' ∘ g' = id := hg'.comp_eq_id
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    

Proof state:
case h.a
X : Type u
Y Z : Profinite
f : of (Ultrafilter X) ⟶ Z
g : Y ⟶ Z
hg : Surjective ⇑g
g' : (forget Profinite).obj Z → (forget Profinite).obj Y
hg' : Function.RightInverse g' ⇑g
t : X → ↑Y.toCompHaus.toTop := g' ∘ ⇑f ∘ pure
h : Ultrafilter X → ↑Y.toCompHaus.toTop := Ultrafilter.extend t
hh : Continuous h
g'' : C(↑Y.toCompHaus.toTop, ↑Z.toCompHaus.toTop) := g
this : ⇑g'' ∘ g' = id
⊢ (⇑g ∘ h) ∘ pure = ⇑f ∘ pure

Next tactic:
erw [comp.assoc, ultrafilter_extend_extends, ← comp.assoc, this, comp.left_id]
@[simp]
theorem not_supIrred : ¬SupIrred a ↔ IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b < a ∧ c < a := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b c : α
⊢ ¬SupIrred a ↔ IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b < a ∧ c < a

Next tactic:
rw [SupIrred, not_and_or]
@[simp]
theorem not_supIrred : ¬SupIrred a ↔ IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b < a ∧ c < a := by
  rw [SupIrred, not_and_or]
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b c : α
⊢ (¬¬IsMin a ∨ ¬∀ ⦃b c : α⦄, b ⊔ c = a → b = a ∨ c = a) ↔ IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b < a ∧ c < a

Next tactic:
push_neg
@[simp]
theorem not_supIrred : ¬SupIrred a ↔ IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b < a ∧ c < a := by
  rw [SupIrred, not_and_or]
  push_neg
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b c : α
⊢ (IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b ≠ a ∧ c ≠ a) ↔ IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b < a ∧ c < a

Next tactic:
rw [exists₂_congr]
@[simp]
theorem not_supIrred : ¬SupIrred a ↔ IsMin a ∨ ∃ b c, b ⊔ c = a ∧ b < a ∧ c < a := by
  rw [SupIrred, not_and_or]
  push_neg
  rw [exists₂_congr]
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b c : α
⊢ ∀ (a_1 b : α), a_1 ⊔ b = a ∧ a_1 ≠ a ∧ b ≠ a ↔ a_1 ⊔ b = a ∧ a_1 < a ∧ b < a

Next tactic:
simp (config := { contextual := true }) [@eq_comm _ _ a]
@[simp]
theorem not_supPrime : ¬SupPrime a ↔ IsMin a ∨ ∃ b c, a ≤ b ⊔ c ∧ ¬a ≤ b ∧ ¬a ≤ c := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b c : α
⊢ ¬SupPrime a ↔ IsMin a ∨ ∃ b c, a ≤ b ⊔ c ∧ ¬a ≤ b ∧ ¬a ≤ c

Next tactic:
rw [SupPrime, not_and_or]
@[simp]
theorem not_supPrime : ¬SupPrime a ↔ IsMin a ∨ ∃ b c, a ≤ b ⊔ c ∧ ¬a ≤ b ∧ ¬a ≤ c := by
  rw [SupPrime, not_and_or]; 

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b c : α
⊢ (¬¬IsMin a ∨ ¬∀ ⦃b c : α⦄, a ≤ b ⊔ c → a ≤ b ∨ a ≤ c) ↔ IsMin a ∨ ∃ b c, a ≤ b ⊔ c ∧ ¬a ≤ b ∧ ¬a ≤ c

Next tactic:
push_neg
@[simp]
theorem not_supPrime : ¬SupPrime a ↔ IsMin a ∨ ∃ b c, a ≤ b ⊔ c ∧ ¬a ≤ b ∧ ¬a ≤ c := by
  rw [SupPrime, not_and_or]; push_neg; 

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b c : α
⊢ (IsMin a ∨ ∃ b c, a ≤ b ⊔ c ∧ ¬a ≤ b ∧ ¬a ≤ c) ↔ IsMin a ∨ ∃ b c, a ≤ b ⊔ c ∧ ¬a ≤ b ∧ ¬a ≤ c

Next tactic:
rfl
protected theorem SupPrime.supIrred : SupPrime a → SupIrred a :=
  And.imp_right fun h b c ha => by 

Proof state:
ι : Type u_1
α : Type u_2
inst✝ : SemilatticeSup α
a b✝ c✝ : α
h : ∀ ⦃b c : α⦄, a ≤ b ⊔ c → a ≤ b ∨ a ≤ c
b c : α
ha : b ⊔ c = a
⊢ b = a ∨ c = a

Next tactic:
simpa [← ha] using h ha.ge
theorem SupIrred.ne_bot (ha : SupIrred a) : a ≠ ⊥ := by 

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupIrred a
⊢ a ≠ ⊥

Next tactic:
rintro rfl
theorem SupIrred.ne_bot (ha : SupIrred a) : a ≠ ⊥ := by rintro rfl; 

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupIrred ⊥
⊢ False

Next tactic:
exact not_supIrred_bot ha
theorem SupPrime.ne_bot (ha : SupPrime a) : a ≠ ⊥ := by 

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupPrime a
⊢ a ≠ ⊥

Next tactic:
rintro rfl
theorem SupPrime.ne_bot (ha : SupPrime a) : a ≠ ⊥ := by rintro rfl; 

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupPrime ⊥
⊢ False

Next tactic:
exact not_supPrime_bot ha
theorem SupIrred.finset_sup_eq (ha : SupIrred a) (h : s.sup f = a) : ∃ i ∈ s, f i = a := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupIrred a
h : sup s f = a
⊢ ∃ i ∈ s, f i = a

Next tactic:
classical
  induction' s using Finset.induction with i s _ ih
  · simpa [ha.ne_bot] using h.symm
  simp only [exists_prop, exists_mem_insert] at ih ⊢
  rw [sup_insert] at h
  exact (ha.2 h).imp_right ih
theorem SupIrred.finset_sup_eq (ha : SupIrred a) (h : s.sup f = a) : ∃ i ∈ s, f i = a := by
  classical
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupIrred a
h : sup s f = a
⊢ ∃ i ∈ s, f i = a

Next tactic:
induction' s using Finset.induction with i s _ ih
theorem SupIrred.finset_sup_eq (ha : SupIrred a) (h : s.sup f = a) : ∃ i ∈ s, f i = a := by
  classical
  induction' s using Finset.induction with i s _ ih
  · 

Proof state:
case empty
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupIrred a
h : sup ∅ f = a
⊢ ∃ i ∈ ∅, f i = a

Next tactic:
simpa [ha.ne_bot] using h.symm
theorem SupIrred.finset_sup_eq (ha : SupIrred a) (h : s.sup f = a) : ∃ i ∈ s, f i = a := by
  classical
  induction' s using Finset.induction with i s _ ih
  · simpa [ha.ne_bot] using h.symm
  

Proof state:
case insert
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s✝ : Finset ι
f : ι → α
ha : SupIrred a
i : ι
s : Finset ι
a✝ : i ∉ s
ih : sup s f = a → ∃ i ∈ s, f i = a
h : sup (insert i s) f = a
⊢ ∃ i_1 ∈ insert i s, f i_1 = a

Next tactic:
simp only [exists_prop, exists_mem_insert] at ih ⊢
theorem SupIrred.finset_sup_eq (ha : SupIrred a) (h : s.sup f = a) : ∃ i ∈ s, f i = a := by
  classical
  induction' s using Finset.induction with i s _ ih
  · simpa [ha.ne_bot] using h.symm
  simp only [exists_prop, exists_mem_insert] at ih ⊢
  

Proof state:
case insert
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s✝ : Finset ι
f : ι → α
ha : SupIrred a
i : ι
s : Finset ι
a✝ : i ∉ s
ih : sup s f = a → ∃ i ∈ s, f i = a
h : sup (insert i s) f = a
⊢ f i = a ∨ ∃ x ∈ s, f x = a

Next tactic:
rw [sup_insert] at h
theorem SupIrred.finset_sup_eq (ha : SupIrred a) (h : s.sup f = a) : ∃ i ∈ s, f i = a := by
  classical
  induction' s using Finset.induction with i s _ ih
  · simpa [ha.ne_bot] using h.symm
  simp only [exists_prop, exists_mem_insert] at ih ⊢
  rw [sup_insert] at h
  

Proof state:
case insert
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s✝ : Finset ι
f : ι → α
ha : SupIrred a
i : ι
s : Finset ι
a✝ : i ∉ s
ih : sup s f = a → ∃ i ∈ s, f i = a
h : f i ⊔ sup s f = a
⊢ f i = a ∨ ∃ x ∈ s, f x = a

Next tactic:
exact (ha.2 h).imp_right ih
theorem SupPrime.le_finset_sup (ha : SupPrime a) : a ≤ s.sup f ↔ ∃ i ∈ s, a ≤ f i := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupPrime a
⊢ a ≤ sup s f ↔ ∃ i ∈ s, a ≤ f i

Next tactic:
classical
  induction' s using Finset.induction with i s _ ih
  · simp [ha.ne_bot]
  · simp only [exists_prop, exists_mem_insert, sup_insert, ha.le_sup, ih]
theorem SupPrime.le_finset_sup (ha : SupPrime a) : a ≤ s.sup f ↔ ∃ i ∈ s, a ≤ f i := by
  classical
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupPrime a
⊢ a ≤ sup s f ↔ ∃ i ∈ s, a ≤ f i

Next tactic:
induction' s using Finset.induction with i s _ ih
theorem SupPrime.le_finset_sup (ha : SupPrime a) : a ≤ s.sup f ↔ ∃ i ∈ s, a ≤ f i := by
  classical
  induction' s using Finset.induction with i s _ ih
  · 

Proof state:
case empty
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
ha : SupPrime a
⊢ a ≤ sup ∅ f ↔ ∃ i ∈ ∅, a ≤ f i

Next tactic:
simp [ha.ne_bot]
theorem SupPrime.le_finset_sup (ha : SupPrime a) : a ≤ s.sup f ↔ ∃ i ∈ s, a ≤ f i := by
  classical
  induction' s using Finset.induction with i s _ ih
  · simp [ha.ne_bot]
  · 

Proof state:
case insert
ι : Type u_1
α : Type u_2
inst✝¹ : SemilatticeSup α
a b c : α
inst✝ : OrderBot α
s✝ : Finset ι
f : ι → α
ha : SupPrime a
i : ι
s : Finset ι
a✝ : i ∉ s
ih : a ≤ sup s f ↔ ∃ i ∈ s, a ≤ f i
⊢ a ≤ sup (insert i s) f ↔ ∃ i_1 ∈ insert i s, a ≤ f i_1

Next tactic:
simp only [exists_prop, exists_mem_insert, sup_insert, ha.le_sup, ih]
/-- In a well-founded lattice, any element is the supremum of finitely many sup-irreducible
elements. This is the order-theoretic analogue of prime factorisation. -/
theorem exists_supIrred_decomposition (a : α) :
    ∃ s : Finset α, s.sup id = a ∧ ∀ ⦃b⦄, b ∈ s → SupIrred b := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝² : SemilatticeSup α
a✝ b c : α
inst✝¹ : OrderBot α
s : Finset ι
f : ι → α
inst✝ : WellFoundedLT α
a : α
⊢ ∃ s, sup s id = a ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b

Next tactic:
classical
  apply WellFoundedLT.induction a _
  clear a
  rintro a ih
  by_cases ha : SupIrred a
  · exact ⟨{a}, by simp [ha]⟩
  rw [not_supIrred] at ha
  obtain ha | ⟨b, c, rfl, hb, hc⟩ := ha
  · exact ⟨∅, by simp [ha.eq_bot]⟩
  obtain ⟨s, rfl, hs⟩ := ih _ hb
  obtain ⟨t, rfl, ht⟩ := ih _ hc
  exact ⟨s ∪ t, sup_union, forall_mem_union.2 ⟨hs, ht⟩⟩
/-- In a well-founded lattice, any element is the supremum of finitely many sup-irreducible
elements. This is the order-theoretic analogue of prime factorisation. -/
theorem exists_supIrred_decomposition (a : α) :
    ∃ s : Finset α, s.sup id = a ∧ ∀ ⦃b⦄, b ∈ s → SupIrred b := by
  classical
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝² : SemilatticeSup α
a✝ b c : α
inst✝¹ : OrderBot α
s : Finset ι
f : ι → α
inst✝ : WellFoundedLT α
a : α
⊢ ∃ s, sup s id = a ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b

Next tactic:
apply WellFoundedLT.induction a _
/-- In a well-founded lattice, any element is the supremum of finitely many sup-irreducible
elements. This is the order-theoretic analogue of prime factorisation. -/
theorem exists_supIrred_decomposition (a : α) :
    ∃ s : Finset α, s.sup id = a ∧ ∀ ⦃b⦄, b ∈ s → SupIrred b := by
  classical
  apply WellFoundedLT.induction a _
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝² : SemilatticeSup α
a✝ b c : α
inst✝¹ : OrderBot α
s : Finset ι
f : ι → α
inst✝ : WellFoundedLT α
a : α
⊢ ∀ (x : α),
    (∀ y < x, ∃ s, sup s id = y ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b) → ∃ s, sup s id = x ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b

Next tactic:
clear a
/-- In a well-founded lattice, any element is the supremum of finitely many sup-irreducible
elements. This is the order-theoretic analogue of prime factorisation. -/
theorem exists_supIrred_decomposition (a : α) :
    ∃ s : Finset α, s.sup id = a ∧ ∀ ⦃b⦄, b ∈ s → SupIrred b := by
  classical
  apply WellFoundedLT.induction a _
  clear a
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝² : SemilatticeSup α
a b c : α
inst✝¹ : OrderBot α
s : Finset ι
f : ι → α
inst✝ : WellFoundedLT α
⊢ ∀ (x : α),
    (∀ y < x, ∃ s, sup s id = y ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b) → ∃ s, sup s id = x ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b

Next tactic:
rintro a ih
/-- In a well-founded lattice, any element is the supremum of finitely many sup-irreducible
elements. This is the order-theoretic analogue of prime factorisation. -/
theorem exists_supIrred_decomposition (a : α) :
    ∃ s : Finset α, s.sup id = a ∧ ∀ ⦃b⦄, b ∈ s → SupIrred b := by
  classical
  apply WellFoundedLT.induction a _
  clear a
  rintro a ih
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝² : SemilatticeSup α
a✝ b c : α
inst✝¹ : OrderBot α
s : Finset ι
f : ι → α
inst✝ : WellFoundedLT α
a : α
ih : ∀ y < a, ∃ s, sup s id = y ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b
⊢ ∃ s, sup s id = a ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b

Next tactic:
by_cases ha : SupIrred a
/-- In a well-founded lattice, any element is the supremum of finitely many sup-irreducible
elements. This is the order-theoretic analogue of prime factorisation. -/
theorem exists_supIrred_decomposition (a : α) :
    ∃ s : Finset α, s.sup id = a ∧ ∀ ⦃b⦄, b ∈ s → SupIrred b := by
  classical
  apply WellFoundedLT.induction a _
  clear a
  rintro a ih
  by_cases ha : SupIrred a
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
inst✝² : SemilatticeSup α
a✝ b c : α
inst✝¹ : OrderBot α
s : Finset ι
f : ι → α
inst✝ : WellFoundedLT α
a : α
ih : ∀ y < a, ∃ s, sup s id = y ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b
ha : SupIrred a
⊢ ∃ s, sup s id = a ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b

Next tactic:
exact ⟨{a}, by simp [ha]⟩
/-- In a well-founded lattice, any element is the supremum of finitely many sup-irreducible
elements. This is the order-theoretic analogue of prime factorisation. -/
theorem exists_supIrred_decomposition (a : α) :
    ∃ s : Finset α, s.sup id = a ∧ ∀ ⦃b⦄, b ∈ s → SupIrred b := by
  classical
  apply WellFoundedLT.induction a _
  clear a
  rintro a ih
  by_cases ha : SupIrred a
  · exact ⟨{a}, by 

Proof state:
ι : Type u_1
α : Type u_2
inst✝² : SemilatticeSup α
a✝ b c : α
inst✝¹ : OrderBot α
s : Finset ι
f : ι → α
inst✝ : WellFoundedLT α
a : α
ih : ∀ y < a, ∃ s, sup s id = y ∧ ∀ ⦃b : α⦄, b ∈ s → SupIrred b
ha : SupIrred a
⊢ sup {a} id = a ∧ ∀ ⦃b : α⦄, b ∈ {a} → SupIrred b

Next tactic:
simp [ha]