l3lab/ntp-mathlib huggingface dataset:
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; 

Proof state:
x y : ℝ
h : Fact (x < y)
⊢ ∀ ⦃x_1 : EuclideanHalfSpace 1⦄, ↑x_1 0 < y - x → ↑x_1 0 + x < y ∨ y < y

Next tactic:
intro z hz
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; 

Proof state:
x y : ℝ
h : Fact (x < y)
z : EuclideanHalfSpace 1
hz : ↑z 0 < y - x
⊢ ↑z 0 + x < y ∨ y < y

Next tactic:
left
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    

Proof state:
case h
x y : ℝ
h : Fact (x < y)
z : EuclideanHalfSpace 1
hz : ↑z 0 < y - x
⊢ ↑z 0 + x < y

Next tactic:
linarith
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    

Proof state:
x y : ℝ
h : Fact (x < y)
⊢ ∀ ⦃x_1 : ↑(Icc x y)⦄,
    x_1 ∈ {z | ↑z < y} →
      (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
          ((fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) }) x_1) =
        x_1

Next tactic:
rintro ⟨z, hz⟩ h'z
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    

Proof state:
case mk
x y : ℝ
h : Fact (x < y)
z : ℝ
hz : z ∈ Icc x y
h'z : { val := z, property := hz } ∈ {z | ↑z < y}
⊢ (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
      ((fun z => { val := fun x_1 => ↑z - x, property := (_ : 0 ≤ ↑z - x) }) { val := z, property := hz }) =
    { val := z, property := hz }

Next tactic:
simp only [mem_setOf_eq, mem_Icc] at hz h'z
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    

Proof state:
case mk
x y : ℝ
h : Fact (x < y)
z : ℝ
hz✝ : z ∈ Icc x y
h'z : z < y
hz : x ≤ z ∧ z ≤ y
⊢ (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
      ((fun z => { val := fun x_1 => ↑z - x, property := (_ : 0 ≤ ↑z - x) }) { val := z, property := hz✝ }) =
    { val := z, property := hz✝ }

Next tactic:
simp only [hz, min_eq_left, sub_add_cancel]
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    

Proof state:
x y : ℝ
h : Fact (x < y)
⊢ ∀ ⦃x_1 : EuclideanHalfSpace 1⦄,
    x_1 ∈ {z | ↑z 0 < y - x} →
      (fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) })
          ((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) x_1) =
        x_1

Next tactic:
rintro ⟨z, hz⟩ h'z
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    

Proof state:
case mk
x y : ℝ
h : Fact (x < y)
z : EuclideanSpace ℝ (Fin 1)
hz : 0 ≤ z 0
h'z : { val := z, property := hz } ∈ {z | ↑z 0 < y - x}
⊢ (fun z => { val := fun x_1 => ↑z - x, property := (_ : 0 ≤ ↑z - x) })
      ((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
        { val := z, property := hz }) =
    { val := z, property := hz }

Next tactic:
rw [Subtype.mk_eq_mk]
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    

Proof state:
case mk
x y : ℝ
h : Fact (x < y)
z : EuclideanSpace ℝ (Fin 1)
hz : 0 ≤ z 0
h'z : { val := z, property := hz } ∈ {z | ↑z 0 < y - x}
⊢ (fun x_1 =>
      ↑((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
            { val := z, property := hz }) -
        x) =
    z

Next tactic:
funext i
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    

Proof state:
case mk.h
x y : ℝ
h : Fact (x < y)
z : EuclideanSpace ℝ (Fin 1)
hz : 0 ≤ z 0
h'z : { val := z, property := hz } ∈ {z | ↑z 0 < y - x}
i : Fin 1
⊢ ↑((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) { val := z, property := hz }) -
      x =
    z i

Next tactic:
dsimp at hz h'z
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    dsimp at hz h'z
    

Proof state:
case mk.h
x y : ℝ
h : Fact (x < y)
z : EuclideanSpace ℝ (Fin 1)
hz : 0 ≤ z 0
h'z : z 0 < y - x
i : Fin 1
⊢ ↑((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) { val := z, property := hz }) -
      x =
    z i

Next tactic:
have A : x + z 0 ≤ y := by linarith
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    dsimp at hz h'z
    have A : x + z 0 ≤ y := by 

Proof state:
x y : ℝ
h : Fact (x < y)
z : EuclideanSpace ℝ (Fin 1)
hz : 0 ≤ z 0
h'z : z 0 < y - x
i : Fin 1
⊢ x + z 0 ≤ y

Next tactic:
linarith
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    dsimp at hz h'z
    have A : x + z 0 ≤ y := by linarith
    

Proof state:
case mk.h
x y : ℝ
h : Fact (x < y)
z : EuclideanSpace ℝ (Fin 1)
hz : 0 ≤ z 0
h'z : z 0 < y - x
i : Fin 1
A : x + z 0 ≤ y
⊢ ↑((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) { val := z, property := hz }) -
      x =
    z i

Next tactic:
rw [Subsingleton.elim i 0]
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    dsimp at hz h'z
    have A : x + z 0 ≤ y := by linarith
    rw [Subsingleton.elim i 0]
    

Proof state:
case mk.h
x y : ℝ
h : Fact (x < y)
z : EuclideanSpace ℝ (Fin 1)
hz : 0 ≤ z 0
h'z : z 0 < y - x
i : Fin 1
A : x + z 0 ≤ y
⊢ ↑((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) { val := z, property := hz }) -
      x =
    z 0

Next tactic:
simp only [A, add_comm, add_sub_cancel', min_eq_left]
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    dsimp at hz h'z
    have A : x + z 0 ≤ y := by linarith
    rw [Subsingleton.elim i 0]
    simp only [A, add_comm, add_sub_cancel', min_eq_left]
  open_source :=
    haveI : IsOpen { z : ℝ | z < y } := isOpen_Iio
    this.preimage continuous_subtype_val
  open_target := by
    

Proof state:
x y : ℝ
h : Fact (x < y)
⊢ IsOpen
    { toFun := fun z => { val := fun x_1 => ↑z - x, property := (_ : 0 ≤ ↑z - x) },
        invFun := fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) },
        source := {z | ↑z < y}, target := {z | ↑z 0 < y - x},
        map_source' := (_ : ∀ (a : ↑(Icc x y)), ↑a < y → ↑a - x < y - x),
        map_target' :=
          (_ :
            ∀ ⦃x_1 : EuclideanHalfSpace 1⦄,
              x_1 ∈ {z | ↑z 0 < y - x} →
                (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) x_1 ∈
                  {z | ↑z < y}),
        left_inv' :=
          (_ :
            ∀ ⦃x_1 : ↑(Icc x y)⦄,
              x_1 ∈ {z | ↑z < y} →
                (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
                    ((fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) }) x_1) =
                  x_1),
        right_inv' :=
          (_ :
            ∀ ⦃x_1 : EuclideanHalfSpace 1⦄,
              x_1 ∈ {z | ↑z 0 < y - x} →
                (fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) })
                    ((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) x_1) =
                  x_1) }.target

Next tactic:
have : IsOpen { z : ℝ | z < y - x } := isOpen_Iio
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    dsimp at hz h'z
    have A : x + z 0 ≤ y := by linarith
    rw [Subsingleton.elim i 0]
    simp only [A, add_comm, add_sub_cancel', min_eq_left]
  open_source :=
    haveI : IsOpen { z : ℝ | z < y } := isOpen_Iio
    this.preimage continuous_subtype_val
  open_target := by
    have : IsOpen { z : ℝ | z < y - x } := isOpen_Iio
    

Proof state:
x y : ℝ
h : Fact (x < y)
this : IsOpen {z | z < y - x}
⊢ IsOpen
    { toFun := fun z => { val := fun x_1 => ↑z - x, property := (_ : 0 ≤ ↑z - x) },
        invFun := fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) },
        source := {z | ↑z < y}, target := {z | ↑z 0 < y - x},
        map_source' := (_ : ∀ (a : ↑(Icc x y)), ↑a < y → ↑a - x < y - x),
        map_target' :=
          (_ :
            ∀ ⦃x_1 : EuclideanHalfSpace 1⦄,
              x_1 ∈ {z | ↑z 0 < y - x} →
                (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) x_1 ∈
                  {z | ↑z < y}),
        left_inv' :=
          (_ :
            ∀ ⦃x_1 : ↑(Icc x y)⦄,
              x_1 ∈ {z | ↑z < y} →
                (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
                    ((fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) }) x_1) =
                  x_1),
        right_inv' :=
          (_ :
            ∀ ⦃x_1 : EuclideanHalfSpace 1⦄,
              x_1 ∈ {z | ↑z 0 < y - x} →
                (fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) })
                    ((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) x_1) =
                  x_1) }.target

Next tactic:
have : IsOpen { z : EuclideanSpace ℝ (Fin 1) | z 0 < y - x } :=
      this.preimage (@continuous_apply (Fin 1) (fun _ => ℝ) _ 0)
/-- The left chart for the topological space `[x, y]`, defined on `[x,y)` and sending `x` to `0` in
`EuclideanHalfSpace 1`.
-/
def IccLeftChart (x y : ℝ) [h : Fact (x < y)] :
    PartialHomeomorph (Icc x y) (EuclideanHalfSpace 1) where
  source := { z : Icc x y | z.val < y }
  target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x }
  toFun := fun z : Icc x y => ⟨fun _ => z.val - x, sub_nonneg.mpr z.property.1⟩
  invFun z := ⟨min (z.val 0 + x) y, by simp [le_refl, z.prop, le_of_lt h.out]⟩
  map_source' := by simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
  map_target' := by
    simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left
    linarith
  left_inv' := by
    rintro ⟨z, hz⟩ h'z
    simp only [mem_setOf_eq, mem_Icc] at hz h'z
    simp only [hz, min_eq_left, sub_add_cancel]
  right_inv' := by
    rintro ⟨z, hz⟩ h'z
    rw [Subtype.mk_eq_mk]
    funext i
    dsimp at hz h'z
    have A : x + z 0 ≤ y := by linarith
    rw [Subsingleton.elim i 0]
    simp only [A, add_comm, add_sub_cancel', min_eq_left]
  open_source :=
    haveI : IsOpen { z : ℝ | z < y } := isOpen_Iio
    this.preimage continuous_subtype_val
  open_target := by
    have : IsOpen { z : ℝ | z < y - x } := isOpen_Iio
    have : IsOpen { z : EuclideanSpace ℝ (Fin 1) | z 0 < y - x } :=
      this.preimage (@continuous_apply (Fin 1) (fun _ => ℝ) _ 0)
    

Proof state:
x y : ℝ
h : Fact (x < y)
this✝ : IsOpen {z | z < y - x}
this : IsOpen {z | z 0 < y - x}
⊢ IsOpen
    { toFun := fun z => { val := fun x_1 => ↑z - x, property := (_ : 0 ≤ ↑z - x) },
        invFun := fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) },
        source := {z | ↑z < y}, target := {z | ↑z 0 < y - x},
        map_source' := (_ : ∀ (a : ↑(Icc x y)), ↑a < y → ↑a - x < y - x),
        map_target' :=
          (_ :
            ∀ ⦃x_1 : EuclideanHalfSpace 1⦄,
              x_1 ∈ {z | ↑z 0 < y - x} →
                (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) x_1 ∈
                  {z | ↑z < y}),
        left_inv' :=
          (_ :
            ∀ ⦃x_1 : ↑(Icc x y)⦄,
              x_1 ∈ {z | ↑z < y} →
                (fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) })
                    ((fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) }) x_1) =
                  x_1),
        right_inv' :=
          (_ :
            ∀ ⦃x_1 : EuclideanHalfSpace 1⦄,
              x_1 ∈ {z | ↑z 0 < y - x} →
                (fun z => { val := fun x_2 => ↑z - x, property := (_ : 0 ≤ ↑z - x) })
                    ((fun z => { val := min (↑z 0 + x) y, property := (_ : min (↑z 0 + x) y ∈ Icc x y) }) x_1) =
                  x_1) }.target

Next tactic:
exact this.preimage continuous_subtype_val