l3lab/ntp-mathlib huggingface dataset:
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · 

Proof state:
case hf
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
⊢ OpenEmbedding ⇑f.val.base

Next tactic:
apply openEmbedding_of_continuous_injective_open
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · 

Proof state:
case hf.h₁
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
⊢ Continuous ⇑f.val.base

Next tactic:
continuity
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · 

Proof state:
case hf.h₂
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
⊢ Function.Injective ⇑f.val.base

Next tactic:
rintro (i : X.carrier)
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); 

Proof state:
case hf.h₂
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
i : ↑↑X.toPresheafedSpace
⊢ ∀ ⦃a₂ : (forget TopCat).obj ↑X.toPresheafedSpace⦄, f.val.base i = f.val.base a₂ → i = a₂

Next tactic:
exact isEmptyElim i
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); exact isEmptyElim i
    · 

Proof state:
case hf.h₃
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
⊢ IsOpenMap ⇑f.val.base

Next tactic:
intro U _
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); exact isEmptyElim i
    · intro U _; 

Proof state:
case hf.h₃
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
U : Set ((forget TopCat).obj ↑X.toPresheafedSpace)
a✝ : IsOpen U
⊢ IsOpen (⇑f.val.base '' U)

Next tactic:
convert isOpen_empty (α := Y)
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); exact isEmptyElim i
    · intro U _; convert isOpen_empty (α := Y); 

Proof state:
case h.e'_3.h
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
U : Set ((forget TopCat).obj ↑X.toPresheafedSpace)
a✝ : IsOpen U
e_1✝ : (forget TopCat).obj ↑Y.toPresheafedSpace = ↑↑Y.toPresheafedSpace
⊢ ⇑f.val.base '' U = ∅

Next tactic:
ext
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); exact isEmptyElim i
    · intro U _; convert isOpen_empty (α := Y); ext; 

Proof state:
case h.e'_3.h.h
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
U : Set ((forget TopCat).obj ↑X.toPresheafedSpace)
a✝ : IsOpen U
e_1✝ : (forget TopCat).obj ↑Y.toPresheafedSpace = ↑↑Y.toPresheafedSpace
x✝ : (forget TopCat).obj ↑Y.toPresheafedSpace
⊢ x✝ ∈ ⇑f.val.base '' U ↔ x✝ ∈ ∅

Next tactic:
rw [Set.mem_empty_iff_false, iff_false_iff]
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); exact isEmptyElim i
    · intro U _; convert isOpen_empty (α := Y); ext; rw [Set.mem_empty_iff_false, iff_false_iff]
      

Proof state:
case h.e'_3.h.h
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
U : Set ((forget TopCat).obj ↑X.toPresheafedSpace)
a✝ : IsOpen U
e_1✝ : (forget TopCat).obj ↑Y.toPresheafedSpace = ↑↑Y.toPresheafedSpace
x✝ : (forget TopCat).obj ↑Y.toPresheafedSpace
⊢ x✝ ∉ ⇑f.val.base '' U

Next tactic:
exact fun x => isEmptyElim (show X.carrier from x.choose)
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); exact isEmptyElim i
    · intro U _; convert isOpen_empty (α := Y); ext; rw [Set.mem_empty_iff_false, iff_false_iff]
      exact fun x => isEmptyElim (show X.carrier from x.choose)
  · 

Proof state:
case inst
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
⊢ ∀ (x : ↑↑X.toPresheafedSpace), IsIso (PresheafedSpace.stalkMap f.val x)

Next tactic:
rintro (i : X.carrier)
instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y)
    [IsEmpty X.carrier] : IsOpenImmersion f := by
  apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso
  · apply openEmbedding_of_continuous_injective_open
    · continuity
    · rintro (i : X.carrier); exact isEmptyElim i
    · intro U _; convert isOpen_empty (α := Y); ext; rw [Set.mem_empty_iff_false, iff_false_iff]
      exact fun x => isEmptyElim (show X.carrier from x.choose)
  · rintro (i : X.carrier); 

Proof state:
case inst
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑X.toPresheafedSpace
i : ↑↑X.toPresheafedSpace
⊢ IsIso (PresheafedSpace.stalkMap f.val i)

Next tactic:
exact isEmptyElim i
instance (priority := 100) isIso_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty Y.carrier] :
    IsIso f := by
  

Proof state:
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑Y.toPresheafedSpace
⊢ IsIso f

Next tactic:
haveI : IsEmpty X.carrier := ⟨fun x => isEmptyElim (show Y.carrier from f.1.base x)⟩
instance (priority := 100) isIso_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty Y.carrier] :
    IsIso f := by
  haveI : IsEmpty X.carrier := ⟨fun x => isEmptyElim (show Y.carrier from f.1.base x)⟩
  

Proof state:
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑Y.toPresheafedSpace
this : IsEmpty ↑↑X.toPresheafedSpace
⊢ IsIso f

Next tactic:
have : Epi f.1.base
instance (priority := 100) isIso_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty Y.carrier] :
    IsIso f := by
  haveI : IsEmpty X.carrier := ⟨fun x => isEmptyElim (show Y.carrier from f.1.base x)⟩
  have : Epi f.1.base
  · 

Proof state:
case this
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑Y.toPresheafedSpace
this : IsEmpty ↑↑X.toPresheafedSpace
⊢ Epi f.val.base

Next tactic:
rw [TopCat.epi_iff_surjective]
instance (priority := 100) isIso_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty Y.carrier] :
    IsIso f := by
  haveI : IsEmpty X.carrier := ⟨fun x => isEmptyElim (show Y.carrier from f.1.base x)⟩
  have : Epi f.1.base
  · rw [TopCat.epi_iff_surjective]; 

Proof state:
case this
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑Y.toPresheafedSpace
this : IsEmpty ↑↑X.toPresheafedSpace
⊢ Function.Surjective ⇑f.val.base

Next tactic:
rintro (x : Y.carrier)
instance (priority := 100) isIso_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty Y.carrier] :
    IsIso f := by
  haveI : IsEmpty X.carrier := ⟨fun x => isEmptyElim (show Y.carrier from f.1.base x)⟩
  have : Epi f.1.base
  · rw [TopCat.epi_iff_surjective]; rintro (x : Y.carrier)
    

Proof state:
case this
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑Y.toPresheafedSpace
this : IsEmpty ↑↑X.toPresheafedSpace
x : ↑↑Y.toPresheafedSpace
⊢ ∃ a, f.val.base a = x

Next tactic:
exact isEmptyElim x
instance (priority := 100) isIso_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty Y.carrier] :
    IsIso f := by
  haveI : IsEmpty X.carrier := ⟨fun x => isEmptyElim (show Y.carrier from f.1.base x)⟩
  have : Epi f.1.base
  · rw [TopCat.epi_iff_surjective]; rintro (x : Y.carrier)
    exact isEmptyElim x
  

Proof state:
X Y : Scheme
f : X ⟶ Y
inst✝ : IsEmpty ↑↑Y.toPresheafedSpace
this✝ : IsEmpty ↑↑X.toPresheafedSpace
this : Epi f.val.base
⊢ IsIso f

Next tactic:
apply IsOpenImmersion.to_iso
theorem bot_isAffineOpen (X : Scheme) : IsAffineOpen (⊥ : Opens X.carrier) := by
  

Proof state:
X : Scheme
⊢ IsAffineOpen ⊥

Next tactic:
convert rangeIsAffineOpenOfOpenImmersion (initial.to X)
theorem bot_isAffineOpen (X : Scheme) : IsAffineOpen (⊥ : Opens X.carrier) := by
  convert rangeIsAffineOpenOfOpenImmersion (initial.to X)
  

Proof state:
case h.e'_2
X : Scheme
⊢ ⊥ = Scheme.Hom.opensRange (initial.to X)

Next tactic:
ext
theorem bot_isAffineOpen (X : Scheme) : IsAffineOpen (⊥ : Opens X.carrier) := by
  convert rangeIsAffineOpenOfOpenImmersion (initial.to X)
  ext
  -- Porting note : added this `erw` to turn LHS to `False`
  

Proof state:
case h.e'_2.h.h
X : Scheme
x✝ : ↑↑X.toPresheafedSpace
⊢ x✝ ∈ ↑⊥ ↔ x✝ ∈ ↑(Scheme.Hom.opensRange (initial.to X))

Next tactic:
erw [Set.mem_empty_iff_false]
theorem bot_isAffineOpen (X : Scheme) : IsAffineOpen (⊥ : Opens X.carrier) := by
  convert rangeIsAffineOpenOfOpenImmersion (initial.to X)
  ext
  -- Porting note : added this `erw` to turn LHS to `False`
  erw [Set.mem_empty_iff_false]
  

Proof state:
case h.e'_2.h.h
X : Scheme
x✝ : ↑↑X.toPresheafedSpace
⊢ False ↔ x✝ ∈ ↑(Scheme.Hom.opensRange (initial.to X))

Next tactic:
rw [false_iff_iff]
theorem bot_isAffineOpen (X : Scheme) : IsAffineOpen (⊥ : Opens X.carrier) := by
  convert rangeIsAffineOpenOfOpenImmersion (initial.to X)
  ext
  -- Porting note : added this `erw` to turn LHS to `False`
  erw [Set.mem_empty_iff_false]
  rw [false_iff_iff]
  

Proof state:
case h.e'_2.h.h
X : Scheme
x✝ : ↑↑X.toPresheafedSpace
⊢ x✝ ∉ ↑(Scheme.Hom.opensRange (initial.to X))

Next tactic:
exact fun x => isEmptyElim (show (⊥_ Scheme).carrier from x.choose)
instance : HasStrictInitialObjects Scheme :=
  hasStrictInitialObjects_of_initial_is_strict fun A f => by 

Proof state:
A : Scheme
f : A ⟶ ⊥_ Scheme
⊢ IsIso f

Next tactic:
infer_instance
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
⊢ ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n)

Next tactic:
rcases le_total n m with hnm | hmn
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hnm : n ≤ m
⊢ ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n)

Next tactic:
rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hmn : m ≤ n
⊢ ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n)

Next tactic:
refine' Succ.rec _ _ hmn
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
  · refine' Succ.rec _ _ hmn
    · 

Proof state:
case inr.refine'_1
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hmn : m ≤ n
⊢ ⋃ i ∈ Ico m m, Ioc (f i) (f (succ i)) = Ioc (f m) (f m)

Next tactic:
simp only [Ioc_self, Ico_self, biUnion_empty]
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
  · refine' Succ.rec _ _ hmn
    · simp only [Ioc_self, Ico_self, biUnion_empty]
    · 

Proof state:
case inr.refine'_2
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hmn : m ≤ n
⊢ ∀ (n : α),
    m ≤ n →
      ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) →
        ⋃ i ∈ Ico m (succ n), Ioc (f i) (f (succ i)) = Ioc (f m) (f (succ n))

Next tactic:
intro k hmk ihk
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
  · refine' Succ.rec _ _ hmn
    · simp only [Ioc_self, Ico_self, biUnion_empty]
    · intro k hmk ihk
      

Proof state:
case inr.refine'_2
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hmn : m ≤ n
k : α
hmk : m ≤ k
ihk : ⋃ i ∈ Ico m k, Ioc (f i) (f (succ i)) = Ioc (f m) (f k)
⊢ ⋃ i ∈ Ico m (succ k), Ioc (f i) (f (succ i)) = Ioc (f m) (f (succ k))

Next tactic:
rw [← Ioc_union_Ioc_eq_Ioc (hf hmk) (hf <| le_succ _), union_comm, ← ihk]
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
  · refine' Succ.rec _ _ hmn
    · simp only [Ioc_self, Ico_self, biUnion_empty]
    · intro k hmk ihk
      rw [← Ioc_union_Ioc_eq_Ioc (hf hmk) (hf <| le_succ _), union_comm, ← ihk]
      

Proof state:
case inr.refine'_2
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hmn : m ≤ n
k : α
hmk : m ≤ k
ihk : ⋃ i ∈ Ico m k, Ioc (f i) (f (succ i)) = Ioc (f m) (f k)
⊢ ⋃ i ∈ Ico m (succ k), Ioc (f i) (f (succ i)) = Ioc (f k) (f (succ k)) ∪ ⋃ i ∈ Ico m k, Ioc (f i) (f (succ i))

Next tactic:
by_cases hk : IsMax k
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
  · refine' Succ.rec _ _ hmn
    · simp only [Ioc_self, Ico_self, biUnion_empty]
    · intro k hmk ihk
      rw [← Ioc_union_Ioc_eq_Ioc (hf hmk) (hf <| le_succ _), union_comm, ← ihk]
      by_cases hk : IsMax k
      · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hmn : m ≤ n
k : α
hmk : m ≤ k
ihk : ⋃ i ∈ Ico m k, Ioc (f i) (f (succ i)) = Ioc (f m) (f k)
hk : IsMax k
⊢ ⋃ i ∈ Ico m (succ k), Ioc (f i) (f (succ i)) = Ioc (f k) (f (succ k)) ∪ ⋃ i ∈ Ico m k, Ioc (f i) (f (succ i))

Next tactic:
rw [hk.succ_eq, Ioc_self, empty_union]
/-- If `α` is a linear archimedean succ order and `β` is a linear order, then for any monotone
function `f` and `m n : α`, the union of intervals `Set.Ioc (f i) (f (Order.succ i))`, `m ≤ i < n`,
is equal to `Set.Ioc (f m) (f n)` -/
theorem biUnion_Ico_Ioc_map_succ [SuccOrder α] [IsSuccArchimedean α] [LinearOrder β] {f : α → β}
    (hf : Monotone f) (m n : α) : ⋃ i ∈ Ico m n, Ioc (f i) (f (succ i)) = Ioc (f m) (f n) := by
  rcases le_total n m with hnm | hmn
  · rw [Ico_eq_empty_of_le hnm, Ioc_eq_empty_of_le (hf hnm), biUnion_empty]
  · refine' Succ.rec _ _ hmn
    · simp only [Ioc_self, Ico_self, biUnion_empty]
    · intro k hmk ihk
      rw [← Ioc_union_Ioc_eq_Ioc (hf hmk) (hf <| le_succ _), union_comm, ← ihk]
      by_cases hk : IsMax k
      · rw [hk.succ_eq, Ioc_self, empty_union]
      · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝³ : LinearOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : LinearOrder β
f : α → β
hf : Monotone f
m n : α
hmn : m ≤ n
k : α
hmk : m ≤ k
ihk : ⋃ i ∈ Ico m k, Ioc (f i) (f (succ i)) = Ioc (f m) (f k)
hk : ¬IsMax k
⊢ ⋃ i ∈ Ico m (succ k), Ioc (f i) (f (succ i)) = Ioc (f k) (f (succ k)) ∪ ⋃ i ∈ Ico m k, Ioc (f i) (f (succ i))

Next tactic:
rw [Ico_succ_right_eq_insert_of_not_isMax hmk hk, biUnion_insert]
/-- If `α` is a linear pred order, `β` is a preorder, and `f : α → β` is a monotone function, then
the intervals `Set.Ioc (f Order.pred n) (f n)` are pairwise disjoint. -/
theorem pairwise_disjoint_on_Ioc_pred [PredOrder α] [Preorder β] {f : α → β} (hf : Monotone f) :
    Pairwise (Disjoint on fun n => Ioc (f (pred n)) (f n)) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrder α
inst✝¹ : PredOrder α
inst✝ : Preorder β
f : α → β
hf : Monotone f
⊢ Pairwise (Disjoint on fun n => Ioc (f (pred n)) (f n))

Next tactic:
simpa only [(· ∘ ·), dual_Ico] using hf.dual.pairwise_disjoint_on_Ico_succ
/-- If `α` is a linear pred order, `β` is a preorder, and `f : α → β` is a monotone function, then
the intervals `Set.Ico (f Order.pred n) (f n)` are pairwise disjoint. -/
theorem pairwise_disjoint_on_Ico_pred [PredOrder α] [Preorder β] {f : α → β} (hf : Monotone f) :
    Pairwise (Disjoint on fun n => Ico (f (pred n)) (f n)) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrder α
inst✝¹ : PredOrder α
inst✝ : Preorder β
f : α → β
hf : Monotone f
⊢ Pairwise (Disjoint on fun n => Ico (f (pred n)) (f n))

Next tactic:
simpa only [(· ∘ ·), dual_Ioc] using hf.dual.pairwise_disjoint_on_Ioc_succ
/-- If `α` is a linear pred order, `β` is a preorder, and `f : α → β` is a monotone function, then
the intervals `Set.Ioo (f Order.pred n) (f n)` are pairwise disjoint. -/
theorem pairwise_disjoint_on_Ioo_pred [PredOrder α] [Preorder β] {f : α → β} (hf : Monotone f) :
    Pairwise (Disjoint on fun n => Ioo (f (pred n)) (f n)) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrder α
inst✝¹ : PredOrder α
inst✝ : Preorder β
f : α → β
hf : Monotone f
⊢ Pairwise (Disjoint on fun n => Ioo (f (pred n)) (f n))

Next tactic:
simpa only [(· ∘ ·), dual_Ioo] using hf.dual.pairwise_disjoint_on_Ioo_succ
instance : FunLike (PartitionOfUnity ι X s) ι fun _ ↦ C(X, ℝ) where
  coe := toFun
  coe_injective' := fun f g h ↦ by 

Proof state:
ι : Type u
X : Type v
inst✝⁴ : TopologicalSpace X
E : Type u_1
inst✝³ : AddCommMonoid E
inst✝² : SMulWithZero ℝ E
inst✝¹ : TopologicalSpace E
inst✝ : ContinuousSMul ℝ E
s : Set X
f✝ f g : PartitionOfUnity ι X s
h : f.toFun = g.toFun
⊢ f = g

Next tactic:
cases f
instance : FunLike (PartitionOfUnity ι X s) ι fun _ ↦ C(X, ℝ) where
  coe := toFun
  coe_injective' := fun f g h ↦ by cases f; 

Proof state:
case mk
ι : Type u
X : Type v
inst✝⁴ : TopologicalSpace X
E : Type u_1
inst✝³ : AddCommMonoid E
inst✝² : SMulWithZero ℝ E
inst✝¹ : TopologicalSpace E
inst✝ : ContinuousSMul ℝ E
s : Set X
f g : PartitionOfUnity ι X s
toFun✝ : ι → C(X, ℝ)
locallyFinite'✝ : LocallyFinite fun i => support ⇑(toFun✝ i)
nonneg'✝ : 0 ≤ toFun✝
sum_eq_one'✝ : ∀ x ∈ s, ∑ᶠ (i : ι), (toFun✝ i) x = 1
sum_le_one'✝ : ∀ (x : X), ∑ᶠ (i : ι), (toFun✝ i) x ≤ 1
h : (mk s toFun✝ locallyFinite'✝ nonneg'✝ sum_eq_one'✝ sum_le_one'✝).toFun = g.toFun
⊢ mk s toFun✝ locallyFinite'✝ nonneg'✝ sum_eq_one'✝ sum_le_one'✝ = g

Next tactic:
cases g
instance : FunLike (PartitionOfUnity ι X s) ι fun _ ↦ C(X, ℝ) where
  coe := toFun
  coe_injective' := fun f g h ↦ by cases f; cases g; 

Proof state:
case mk.mk
ι : Type u
X : Type v
inst✝⁴ : TopologicalSpace X
E : Type u_1
inst✝³ : AddCommMonoid E
inst✝² : SMulWithZero ℝ E
inst✝¹ : TopologicalSpace E
inst✝ : ContinuousSMul ℝ E
s : Set X
f : PartitionOfUnity ι X s
toFun✝¹ : ι → C(X, ℝ)
locallyFinite'✝¹ : LocallyFinite fun i => support ⇑(toFun✝¹ i)
nonneg'✝¹ : 0 ≤ toFun✝¹
sum_eq_one'✝¹ : ∀ x ∈ s, ∑ᶠ (i : ι), (toFun✝¹ i) x = 1
sum_le_one'✝¹ : ∀ (x : X), ∑ᶠ (i : ι), (toFun✝¹ i) x ≤ 1
toFun✝ : ι → C(X, ℝ)
locallyFinite'✝ : LocallyFinite fun i => support ⇑(toFun✝ i)
nonneg'✝ : 0 ≤ toFun✝
sum_eq_one'✝ : ∀ x ∈ s, ∑ᶠ (i : ι), (toFun✝ i) x = 1
sum_le_one'✝ : ∀ (x : X), ∑ᶠ (i : ι), (toFun✝ i) x ≤ 1
h :
  (mk s toFun✝¹ locallyFinite'✝¹ nonneg'✝¹ sum_eq_one'✝¹ sum_le_one'✝¹).toFun =
    (mk s toFun✝ locallyFinite'✝ nonneg'✝ sum_eq_one'✝ sum_le_one'✝).toFun
⊢ mk s toFun✝¹ locallyFinite'✝¹ nonneg'✝¹ sum_eq_one'✝¹ sum_le_one'✝¹ =
    mk s toFun✝ locallyFinite'✝ nonneg'✝ sum_eq_one'✝ sum_le_one'✝

Next tactic:
congr
/-- If `f` is a partition of unity on `s`, then for every `x ∈ s` there exists an index `i` such
that `0 < f i x`. -/
theorem exists_pos {x : X} (hx : x ∈ s) : ∃ i, 0 < f i x := by
  

Proof state:
ι : Type u
X : Type v
inst✝⁴ : TopologicalSpace X
E : Type u_1
inst✝³ : AddCommMonoid E
inst✝² : SMulWithZero ℝ E
inst✝¹ : TopologicalSpace E
inst✝ : ContinuousSMul ℝ E
s : Set X
f : PartitionOfUnity ι X s
x : X
hx : x ∈ s
⊢ ∃ i, 0 < (f i) x

Next tactic:
have H := f.sum_eq_one hx