l3lab/ntp-mathlib huggingface dataset:
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · 

Proof state:
case pos
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
⊢ (if ∑ i in x.support, x i = m then coeff x p else 0) = coeff x (if m = n then p else 0)

Next tactic:
split_ifs
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    

Proof state:
case pos
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ∑ i in x.support, x i = m
h✝ : m = n
⊢ coeff x p = coeff x p
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ∑ i in x.support, x i = m
h✝ : ¬m = n
⊢ coeff x p = coeff x 0
case pos
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ¬∑ i in x.support, x i = m
h✝ : m = n
⊢ 0 = coeff x p
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ¬∑ i in x.support, x i = m
h✝ : ¬m = n
⊢ 0 = coeff x 0

Next tactic:
all_goals simp only [zero_coeff, coeff_zero]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals 

Proof state:
case pos
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ∑ i in x.support, x i = m
h✝ : m = n
⊢ coeff x p = coeff x p

Next tactic:
simp only [zero_coeff, coeff_zero]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals 

Proof state:
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ∑ i in x.support, x i = m
h✝ : ¬m = n
⊢ coeff x p = coeff x 0

Next tactic:
simp only [zero_coeff, coeff_zero]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals 

Proof state:
case pos
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ¬∑ i in x.support, x i = m
h✝ : m = n
⊢ 0 = coeff x p

Next tactic:
simp only [zero_coeff, coeff_zero]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals 

Proof state:
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : coeff x p = 0
h✝¹ : ¬∑ i in x.support, x i = m
h✝ : ¬m = n
⊢ 0 = coeff x 0

Next tactic:
simp only [zero_coeff, coeff_zero]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals simp only [zero_coeff, coeff_zero]
  · 

Proof state:
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : ¬coeff x p = 0
⊢ (if ∑ i in x.support, x i = m then coeff x p else 0) = coeff x (if m = n then p else 0)

Next tactic:
rw [h zero_coeff]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals simp only [zero_coeff, coeff_zero]
  · rw [h zero_coeff]
    

Proof state:
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : ¬coeff x p = 0
⊢ (if n = m then coeff x p else 0) = coeff x (if m = n then p else 0)

Next tactic:
simp only [show n = m ↔ m = n from eq_comm]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals simp only [zero_coeff, coeff_zero]
  · rw [h zero_coeff]
    simp only [show n = m ↔ m = n from eq_comm]
    

Proof state:
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : ¬coeff x p = 0
⊢ (if m = n then coeff x p else 0) = coeff x (if m = n then p else 0)

Next tactic:
split_ifs with h1
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals simp only [zero_coeff, coeff_zero]
  · rw [h zero_coeff]
    simp only [show n = m ↔ m = n from eq_comm]
    split_ifs with h1
    · 

Proof state:
case pos
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : ¬coeff x p = 0
h1 : m = n
⊢ coeff x p = coeff x p

Next tactic:
rfl
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  by_cases zero_coeff : coeff x p = 0
  · split_ifs
    all_goals simp only [zero_coeff, coeff_zero]
  · rw [h zero_coeff]
    simp only [show n = m ↔ m = n from eq_comm]
    split_ifs with h1
    · rfl
    · 

Proof state:
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
zero_coeff : ¬coeff x p = 0
h1 : ¬m = n
⊢ 0 = coeff x 0

Next tactic:
simp only [coeff_zero]
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanHalfSpace n)`, used as
a model for manifolds with boundary. In the locale `manifold`, use the shortcut `𝓡∂ n`.
-/
def modelWithCornersEuclideanHalfSpace (n : ℕ) [Zero (Fin n)] :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanHalfSpace n) where
  toFun := Subtype.val
  invFun x := ⟨update x 0 (max (x 0) 0), by 

Proof state:
n : ℕ
inst✝ : Zero (Fin n)
x : EuclideanSpace ℝ (Fin n)
⊢ 0 ≤ update x 0 (max (x 0) 0) 0

Next tactic:
simp [le_refl]
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanHalfSpace n)`, used as
a model for manifolds with boundary. In the locale `manifold`, use the shortcut `𝓡∂ n`.
-/
def modelWithCornersEuclideanHalfSpace (n : ℕ) [Zero (Fin n)] :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanHalfSpace n) where
  toFun := Subtype.val
  invFun x := ⟨update x 0 (max (x 0) 0), by simp [le_refl]⟩
  source := univ
  target := { x | 0 ≤ x 0 }
  map_source' x _ := x.property
  map_target' _ _ := mem_univ _
  left_inv' := fun ⟨xval, xprop⟩ _ => by
    

Proof state:
n : ℕ
inst✝ : Zero (Fin n)
x✝¹ : EuclideanHalfSpace n
xval : EuclideanSpace ℝ (Fin n)
xprop : 0 ≤ xval 0
x✝ : { val := xval, property := xprop } ∈ univ
⊢ (fun x => { val := update x 0 (max (x 0) 0), property := (_ : 0 ≤ update x 0 (max (x 0) 0) 0) })
      ↑{ val := xval, property := xprop } =
    { val := xval, property := xprop }

Next tactic:
rw [Subtype.mk_eq_mk, update_eq_iff]
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanHalfSpace n)`, used as
a model for manifolds with boundary. In the locale `manifold`, use the shortcut `𝓡∂ n`.
-/
def modelWithCornersEuclideanHalfSpace (n : ℕ) [Zero (Fin n)] :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanHalfSpace n) where
  toFun := Subtype.val
  invFun x := ⟨update x 0 (max (x 0) 0), by simp [le_refl]⟩
  source := univ
  target := { x | 0 ≤ x 0 }
  map_source' x _ := x.property
  map_target' _ _ := mem_univ _
  left_inv' := fun ⟨xval, xprop⟩ _ => by
    rw [Subtype.mk_eq_mk, update_eq_iff]
    

Proof state:
n : ℕ
inst✝ : Zero (Fin n)
x✝¹ : EuclideanHalfSpace n
xval : EuclideanSpace ℝ (Fin n)
xprop : 0 ≤ xval 0
x✝ : { val := xval, property := xprop } ∈ univ
⊢ max (↑{ val := xval, property := xprop } 0) 0 = xval 0 ∧
    ∀ (x : Fin n), x ≠ 0 → ↑{ val := xval, property := xprop } x = xval x

Next tactic:
exact ⟨max_eq_left xprop, fun i _ => rfl⟩
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanHalfSpace n)`, used as
a model for manifolds with boundary. In the locale `manifold`, use the shortcut `𝓡∂ n`.
-/
def modelWithCornersEuclideanHalfSpace (n : ℕ) [Zero (Fin n)] :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanHalfSpace n) where
  toFun := Subtype.val
  invFun x := ⟨update x 0 (max (x 0) 0), by simp [le_refl]⟩
  source := univ
  target := { x | 0 ≤ x 0 }
  map_source' x _ := x.property
  map_target' _ _ := mem_univ _
  left_inv' := fun ⟨xval, xprop⟩ _ => by
    rw [Subtype.mk_eq_mk, update_eq_iff]
    exact ⟨max_eq_left xprop, fun i _ => rfl⟩
  right_inv' x hx := update_eq_iff.2 ⟨max_eq_left hx, fun i _ => rfl⟩
  source_eq := rfl
  unique_diff' := by
    

Proof state:
n : ℕ
inst✝ : Zero (Fin n)
⊢ UniqueDiffOn ℝ
    { toFun := Subtype.val,
        invFun := fun x => { val := update x 0 (max (x 0) 0), property := (_ : 0 ≤ update x 0 (max (x 0) 0) 0) },
        source := univ, target := {x | 0 ≤ x 0}, map_source' := (_ : ∀ x ∈ univ, 0 ≤ ↑x 0),
        map_target' :=
          (_ :
            ∀ x ∈ {x | 0 ≤ x 0},
              (fun x => { val := update x 0 (max (x 0) 0), property := (_ : 0 ≤ update x 0 (max (x 0) 0) 0) }) x ∈
                univ),
        left_inv' :=
          (_ :
            ∀ x ∈ univ,
              (fun x => { val := update x 0 (max (x 0) 0), property := (_ : 0 ≤ update x 0 (max (x 0) 0) 0) }) ↑x = x),
        right_inv' := (_ : ∀ x ∈ {x | 0 ≤ x 0}, update (fun a => x a) 0 (max (x 0) 0) = x) }.target

Next tactic:
have : UniqueDiffOn ℝ _ :=
      UniqueDiffOn.pi (Fin n) (fun _ => ℝ) _ _ fun i (_ : i ∈ ({0} : Set (Fin n))) =>
        uniqueDiffOn_Ici 0
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanHalfSpace n)`, used as
a model for manifolds with boundary. In the locale `manifold`, use the shortcut `𝓡∂ n`.
-/
def modelWithCornersEuclideanHalfSpace (n : ℕ) [Zero (Fin n)] :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanHalfSpace n) where
  toFun := Subtype.val
  invFun x := ⟨update x 0 (max (x 0) 0), by simp [le_refl]⟩
  source := univ
  target := { x | 0 ≤ x 0 }
  map_source' x _ := x.property
  map_target' _ _ := mem_univ _
  left_inv' := fun ⟨xval, xprop⟩ _ => by
    rw [Subtype.mk_eq_mk, update_eq_iff]
    exact ⟨max_eq_left xprop, fun i _ => rfl⟩
  right_inv' x hx := update_eq_iff.2 ⟨max_eq_left hx, fun i _ => rfl⟩
  source_eq := rfl
  unique_diff' := by
    have : UniqueDiffOn ℝ _ :=
      UniqueDiffOn.pi (Fin n) (fun _ => ℝ) _ _ fun i (_ : i ∈ ({0} : Set (Fin n))) =>
        uniqueDiffOn_Ici 0
    

Proof state:
n : ℕ
inst✝ : Zero (Fin n)
this : UniqueDiffOn ℝ (pi {0} fun i => Ici 0)
⊢ UniqueDiffOn ℝ
    { toFun := Subtype.val,
        invFun := fun x => { val := update x 0 (max (x 0) 0), property := (_ : 0 ≤ update x 0 (max (x 0) 0) 0) },
        source := univ, target := {x | 0 ≤ x 0}, map_source' := (_ : ∀ x ∈ univ, 0 ≤ ↑x 0),
        map_target' :=
          (_ :
            ∀ x ∈ {x | 0 ≤ x 0},
              (fun x => { val := update x 0 (max (x 0) 0), property := (_ : 0 ≤ update x 0 (max (x 0) 0) 0) }) x ∈
                univ),
        left_inv' :=
          (_ :
            ∀ x ∈ univ,
              (fun x => { val := update x 0 (max (x 0) 0), property := (_ : 0 ≤ update x 0 (max (x 0) 0) 0) }) ↑x = x),
        right_inv' := (_ : ∀ x ∈ {x | 0 ≤ x 0}, update (fun a => x a) 0 (max (x 0) 0) = x) }.target

Next tactic:
simpa only [singleton_pi] using this
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanQuadrant n)`, used as a
model for manifolds with corners -/
def modelWithCornersEuclideanQuadrant (n : ℕ) :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanQuadrant n) where
  toFun := Subtype.val
  invFun x := ⟨fun i => max (x i) 0, fun i => by 

Proof state:
n : ℕ
x : EuclideanSpace ℝ (Fin n)
i : Fin n
⊢ 0 ≤ (fun i => max (x i) 0) i

Next tactic:
simp only [le_refl, or_true_iff, le_max_iff]
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanQuadrant n)`, used as a
model for manifolds with corners -/
def modelWithCornersEuclideanQuadrant (n : ℕ) :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanQuadrant n) where
  toFun := Subtype.val
  invFun x := ⟨fun i => max (x i) 0, fun i => by simp only [le_refl, or_true_iff, le_max_iff]⟩
  source := univ
  target := { x | ∀ i, 0 ≤ x i }
  map_source' x _ := x.property
  map_target' x _ := mem_univ _
  left_inv' x _ := by 

Proof state:
n : ℕ
x : EuclideanQuadrant n
x✝ : x ∈ univ
⊢ (fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) ↑x = x

Next tactic:
ext i
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanQuadrant n)`, used as a
model for manifolds with corners -/
def modelWithCornersEuclideanQuadrant (n : ℕ) :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanQuadrant n) where
  toFun := Subtype.val
  invFun x := ⟨fun i => max (x i) 0, fun i => by simp only [le_refl, or_true_iff, le_max_iff]⟩
  source := univ
  target := { x | ∀ i, 0 ≤ x i }
  map_source' x _ := x.property
  map_target' x _ := mem_univ _
  left_inv' x _ := by ext i; 

Proof state:
case h.h
n : ℕ
x : EuclideanQuadrant n
x✝ : x ∈ univ
i : Fin n
⊢ ↑((fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) ↑x) i = ↑x i

Next tactic:
simp only [Subtype.coe_mk, x.2 i, max_eq_left]
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanQuadrant n)`, used as a
model for manifolds with corners -/
def modelWithCornersEuclideanQuadrant (n : ℕ) :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanQuadrant n) where
  toFun := Subtype.val
  invFun x := ⟨fun i => max (x i) 0, fun i => by simp only [le_refl, or_true_iff, le_max_iff]⟩
  source := univ
  target := { x | ∀ i, 0 ≤ x i }
  map_source' x _ := x.property
  map_target' x _ := mem_univ _
  left_inv' x _ := by ext i; simp only [Subtype.coe_mk, x.2 i, max_eq_left]
  right_inv' x hx := by 

Proof state:
n : ℕ
x : EuclideanSpace ℝ (Fin n)
hx : x ∈ {x | ∀ (i : Fin n), 0 ≤ x i}
⊢ ↑((fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) x) = x

Next tactic:
ext1 i
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanQuadrant n)`, used as a
model for manifolds with corners -/
def modelWithCornersEuclideanQuadrant (n : ℕ) :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanQuadrant n) where
  toFun := Subtype.val
  invFun x := ⟨fun i => max (x i) 0, fun i => by simp only [le_refl, or_true_iff, le_max_iff]⟩
  source := univ
  target := { x | ∀ i, 0 ≤ x i }
  map_source' x _ := x.property
  map_target' x _ := mem_univ _
  left_inv' x _ := by ext i; simp only [Subtype.coe_mk, x.2 i, max_eq_left]
  right_inv' x hx := by ext1 i; 

Proof state:
case h
n : ℕ
x : EuclideanSpace ℝ (Fin n)
hx : x ∈ {x | ∀ (i : Fin n), 0 ≤ x i}
i : Fin n
⊢ ↑((fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) x) i = x i

Next tactic:
simp only [hx i, max_eq_left]
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanQuadrant n)`, used as a
model for manifolds with corners -/
def modelWithCornersEuclideanQuadrant (n : ℕ) :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanQuadrant n) where
  toFun := Subtype.val
  invFun x := ⟨fun i => max (x i) 0, fun i => by simp only [le_refl, or_true_iff, le_max_iff]⟩
  source := univ
  target := { x | ∀ i, 0 ≤ x i }
  map_source' x _ := x.property
  map_target' x _ := mem_univ _
  left_inv' x _ := by ext i; simp only [Subtype.coe_mk, x.2 i, max_eq_left]
  right_inv' x hx := by ext1 i; simp only [hx i, max_eq_left]
  source_eq := rfl
  unique_diff' := by
    

Proof state:
n : ℕ
⊢ UniqueDiffOn ℝ
    { toFun := Subtype.val,
        invFun := fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) },
        source := univ, target := {x | ∀ (i : Fin n), 0 ≤ x i},
        map_source' := (_ : ∀ x ∈ univ, ∀ (i : Fin n), 0 ≤ ↑x i),
        map_target' :=
          (_ :
            ∀ x ∈ {x | ∀ (i : Fin n), 0 ≤ x i},
              (fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) x ∈ univ),
        left_inv' :=
          (_ :
            ∀ x ∈ univ,
              (fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) ↑x = x),
        right_inv' :=
          (_ :
            ∀ x ∈ {x | ∀ (i : Fin n), 0 ≤ x i},
              ↑((fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) x) =
                x) }.target

Next tactic:
have this : UniqueDiffOn ℝ _ :=
      UniqueDiffOn.univ_pi (Fin n) (fun _ => ℝ) _ fun _ => uniqueDiffOn_Ici 0
/--
Definition of the model with corners `(EuclideanSpace ℝ (Fin n), EuclideanQuadrant n)`, used as a
model for manifolds with corners -/
def modelWithCornersEuclideanQuadrant (n : ℕ) :
    ModelWithCorners ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanQuadrant n) where
  toFun := Subtype.val
  invFun x := ⟨fun i => max (x i) 0, fun i => by simp only [le_refl, or_true_iff, le_max_iff]⟩
  source := univ
  target := { x | ∀ i, 0 ≤ x i }
  map_source' x _ := x.property
  map_target' x _ := mem_univ _
  left_inv' x _ := by ext i; simp only [Subtype.coe_mk, x.2 i, max_eq_left]
  right_inv' x hx := by ext1 i; simp only [hx i, max_eq_left]
  source_eq := rfl
  unique_diff' := by
    have this : UniqueDiffOn ℝ _ :=
      UniqueDiffOn.univ_pi (Fin n) (fun _ => ℝ) _ fun _ => uniqueDiffOn_Ici 0
    

Proof state:
n : ℕ
this : UniqueDiffOn ℝ (pi univ fun x => Ici 0)
⊢ UniqueDiffOn ℝ
    { toFun := Subtype.val,
        invFun := fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) },
        source := univ, target := {x | ∀ (i : Fin n), 0 ≤ x i},
        map_source' := (_ : ∀ x ∈ univ, ∀ (i : Fin n), 0 ≤ ↑x i),
        map_target' :=
          (_ :
            ∀ x ∈ {x | ∀ (i : Fin n), 0 ≤ x i},
              (fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) x ∈ univ),
        left_inv' :=
          (_ :
            ∀ x ∈ univ,
              (fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) ↑x = x),
        right_inv' :=
          (_ :
            ∀ x ∈ {x | ∀ (i : Fin n), 0 ≤ x i},
              ↑((fun x => { val := fun i => max (x i) 0, property := (_ : ∀ (i : Fin n), 0 ≤ max (x i) 0) }) x) =
                x) }.target

Next tactic:
simpa only [pi_univ_Ici] using this
/-- 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 

Proof state:
x y : ℝ
h : Fact (x < y)
z : EuclideanHalfSpace 1
⊢ min (↑z 0 + x) y ∈ Icc x y

Next tactic:
simp [le_refl, z.prop, le_of_lt h.out]
/-- 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 

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

Next tactic:
simp only [imp_self, sub_lt_sub_iff_right, mem_setOf_eq, forall_true_iff]
/-- 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
    

Proof state:
x y : ℝ
h : Fact (x < y)
⊢ ∀ ⦃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}

Next tactic:
simp only [min_lt_iff, mem_setOf_eq]