l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem iSupLift_mk {i : ι} (x : K i) (hx : (x : A) ∈ T) :
    iSupLift K dir f hf T hT ⟨x, hx⟩ = f i x := by
  subst hT
  dsimp [iSupLift]
  

Proof state:
R : Type u
A : Type v
B : Type w
inst✝⁹ : CommSemiring R
inst✝⁸ : NonUnitalNonAssocSemiring A
inst✝⁷ : Module R A
inst✝⁶ : IsScalarTower R A A
inst✝⁵ : SMulCommClass R A A
inst✝⁴ : NonUnitalNonAssocSemiring B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
S : NonUnitalSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h)
i : ι
x : ↥(K i)
hx : ↑x ∈ iSup K
⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
      (_ :
        ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
          (fun i x => (f i) x) i { val := x, property := hxi } = (fun i x => (f i) x) j { val := x, property := hxj })
      ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) { val := ↑x, property := hx } =
    (f i) x

Next tactic:
apply Set.iUnionLift_mk
theorem iSupLift_of_mem {i : ι} (x : T) (hx : (x : A) ∈ K i) :
    iSupLift K dir f hf T hT x = f i ⟨x, hx⟩ := by
  

Proof state:
R : Type u
A : Type v
B : Type w
inst✝⁹ : CommSemiring R
inst✝⁸ : NonUnitalNonAssocSemiring A
inst✝⁷ : Module R A
inst✝⁶ : IsScalarTower R A A
inst✝⁵ : SMulCommClass R A A
inst✝⁴ : NonUnitalNonAssocSemiring B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
S : NonUnitalSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h)
T : NonUnitalSubalgebra R A
hT : T = iSup K
i : ι
x : ↥T
hx : ↑x ∈ K i
⊢ (iSupLift K dir f hf T hT) x = (f i) { val := ↑x, property := hx }

Next tactic:
subst hT
theorem iSupLift_of_mem {i : ι} (x : T) (hx : (x : A) ∈ K i) :
    iSupLift K dir f hf T hT x = f i ⟨x, hx⟩ := by
  subst hT
  

Proof state:
R : Type u
A : Type v
B : Type w
inst✝⁹ : CommSemiring R
inst✝⁸ : NonUnitalNonAssocSemiring A
inst✝⁷ : Module R A
inst✝⁶ : IsScalarTower R A A
inst✝⁵ : SMulCommClass R A A
inst✝⁴ : NonUnitalNonAssocSemiring B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
S : NonUnitalSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h)
i : ι
x : ↥(iSup K)
hx : ↑x ∈ K i
⊢ (iSupLift K dir f hf (iSup K) (_ : iSup K = iSup K)) x = (f i) { val := ↑x, property := hx }

Next tactic:
dsimp [iSupLift]
theorem iSupLift_of_mem {i : ι} (x : T) (hx : (x : A) ∈ K i) :
    iSupLift K dir f hf T hT x = f i ⟨x, hx⟩ := by
  subst hT
  dsimp [iSupLift]
  

Proof state:
R : Type u
A : Type v
B : Type w
inst✝⁹ : CommSemiring R
inst✝⁸ : NonUnitalNonAssocSemiring A
inst✝⁷ : Module R A
inst✝⁶ : IsScalarTower R A A
inst✝⁵ : SMulCommClass R A A
inst✝⁴ : NonUnitalNonAssocSemiring B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
S : NonUnitalSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h)
i : ι
x : ↥(iSup K)
hx : ↑x ∈ K i
⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
      (_ :
        ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
          (fun i x => (f i) x) i { val := x, property := hxi } = (fun i x => (f i) x) j { val := x, property := hxj })
      ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) x =
    (f i) { val := ↑x, property := hx }

Next tactic:
apply Set.iUnionLift_of_mem
theorem _root_.Set.smul_mem_center (r : R) {a : A} (ha : a ∈ Set.center A) :
    r • a ∈ Set.center A where
  comm b := by 

Proof state:
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module R A
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
r : R
a : A
ha : a ∈ Set.center A
b : A
⊢ r • a * b = b * r • a

Next tactic:
rw [mul_smul_comm, smul_mul_assoc, ha.comm]
theorem _root_.Set.smul_mem_center (r : R) {a : A} (ha : a ∈ Set.center A) :
    r • a ∈ Set.center A where
  comm b := by rw [mul_smul_comm, smul_mul_assoc, ha.comm]
  left_assoc b c := by 

Proof state:
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module R A
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
r : R
a : A
ha : a ∈ Set.center A
b c : A
⊢ r • a * (b * c) = r • a * b * c

Next tactic:
rw [smul_mul_assoc, smul_mul_assoc, smul_mul_assoc, ha.left_assoc]
theorem _root_.Set.smul_mem_center (r : R) {a : A} (ha : a ∈ Set.center A) :
    r • a ∈ Set.center A where
  comm b := by rw [mul_smul_comm, smul_mul_assoc, ha.comm]
  left_assoc b c := by rw [smul_mul_assoc, smul_mul_assoc, smul_mul_assoc, ha.left_assoc]
  mid_assoc b c := by
    

Proof state:
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module R A
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
r : R
a : A
ha : a ∈ Set.center A
b c : A
⊢ b * r • a * c = b * (r • a * c)

Next tactic:
rw [mul_smul_comm, smul_mul_assoc, smul_mul_assoc, mul_smul_comm, ha.mid_assoc]
theorem _root_.Set.smul_mem_center (r : R) {a : A} (ha : a ∈ Set.center A) :
    r • a ∈ Set.center A where
  comm b := by rw [mul_smul_comm, smul_mul_assoc, ha.comm]
  left_assoc b c := by rw [smul_mul_assoc, smul_mul_assoc, smul_mul_assoc, ha.left_assoc]
  mid_assoc b c := by
    rw [mul_smul_comm, smul_mul_assoc, smul_mul_assoc, mul_smul_comm, ha.mid_assoc]
  right_assoc b c := by
    

Proof state:
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module R A
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
r : R
a : A
ha : a ∈ Set.center A
b c : A
⊢ b * c * r • a = b * (c * r • a)

Next tactic:
rw [mul_smul_comm, mul_smul_comm, mul_smul_comm, ha.right_assoc]
@[simp]
theorem _root_.Set.smul_mem_centralizer {s : Set A} (r : R) {a : A} (ha : a ∈ s.centralizer) :
    r • a ∈ s.centralizer :=
  fun x hx => by 

Proof state:
R : Type u_1
A : Type u_2
inst✝⁴ : CommSemiring R
inst✝³ : NonUnitalSemiring A
inst✝² : Module R A
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
s : Set A
r : R
a : A
ha : a ∈ Set.centralizer s
x : A
hx : x ∈ s
⊢ x * r • a = r • a * x

Next tactic:
rw [mul_smul_comm, smul_mul_assoc, ha x hx]
theorem expand_one_apply (f : MvPolynomial σ R) : expand 1 f = f := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
f : MvPolynomial σ R
⊢ (expand 1) f = f

Next tactic:
simp only [expand, pow_one, eval₂Hom_eq_bind₂, bind₂_C_left, RingHom.toMonoidHom_eq_coe,
    RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply]
@[simp]
theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial σ R) := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
⊢ expand 1 = AlgHom.id R (MvPolynomial σ R)

Next tactic:
ext1 f
@[simp]
theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial σ R) := by
  ext1 f
  

Proof state:
case hf
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
f : σ
⊢ (expand 1) (X f) = (AlgHom.id R (MvPolynomial σ R)) (X f)

Next tactic:
rw [expand_one_apply, AlgHom.id_apply]
theorem expand_comp_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) :
    (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
p : ℕ
f : σ → MvPolynomial τ R
⊢ AlgHom.comp (expand p) (bind₁ f) = bind₁ fun i => (expand p) (f i)

Next tactic:
apply algHom_ext
theorem expand_comp_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) :
    (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by
  apply algHom_ext
  

Proof state:
case hf
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
p : ℕ
f : σ → MvPolynomial τ R
⊢ ∀ (i : σ), (AlgHom.comp (expand p) (bind₁ f)) (X i) = (bind₁ fun i => (expand p) (f i)) (X i)

Next tactic:
intro i
theorem expand_comp_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) :
    (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by
  apply algHom_ext
  intro i
  

Proof state:
case hf
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
p : ℕ
f : σ → MvPolynomial τ R
i : σ
⊢ (AlgHom.comp (expand p) (bind₁ f)) (X i) = (bind₁ fun i => (expand p) (f i)) (X i)

Next tactic:
simp only [AlgHom.comp_apply, bind₁_X_right]
theorem expand_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) (φ : MvPolynomial σ R) :
    expand p (bind₁ f φ) = bind₁ (fun i ↦ expand p (f i)) φ := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
p : ℕ
f : σ → MvPolynomial τ R
φ : MvPolynomial σ R
⊢ (expand p) ((bind₁ f) φ) = (bind₁ fun i => (expand p) (f i)) φ

Next tactic:
rw [← AlgHom.comp_apply, expand_comp_bind₁]
@[simp]
theorem map_expand (f : R →+* S) (p : ℕ) (φ : MvPolynomial σ R) :
    map f (expand p φ) = expand p (map f φ) := by 

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
f : R →+* S
p : ℕ
φ : MvPolynomial σ R
⊢ (map f) ((expand p) φ) = (expand p) ((map f) φ)

Next tactic:
simp [expand, map_bind₁]
@[simp]
theorem rename_expand (f : σ → τ) (p : ℕ) (φ : MvPolynomial σ R) :
    rename f (expand p φ) = expand p (rename f φ) := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
f : σ → τ
p : ℕ
φ : MvPolynomial σ R
⊢ (rename f) ((expand p) φ) = (expand p) ((rename f) φ)

Next tactic:
simp [expand, bind₁_rename, rename_bind₁, Function.comp]
@[simp]
theorem rename_comp_expand (f : σ → τ) (p : ℕ) :
    (rename f).comp (expand p) =
      (expand p).comp (rename f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
f : σ → τ
p : ℕ
⊢ AlgHom.comp (rename f) (expand p) = AlgHom.comp (expand p) (rename f)

Next tactic:
ext1 φ
@[simp]
theorem rename_comp_expand (f : σ → τ) (p : ℕ) :
    (rename f).comp (expand p) =
      (expand p).comp (rename f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) := by
  ext1 φ
  

Proof state:
case hf
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝¹ : CommSemiring R
inst✝ : CommSemiring S
f : σ → τ
p : ℕ
φ : σ
⊢ (AlgHom.comp (rename f) (expand p)) (X φ) = (AlgHom.comp (expand p) (rename f)) (X φ)

Next tactic:
simp only [rename_expand, AlgHom.comp_apply]
/-- Assume `k = l`. If two functions defined on `Fin k` and `Fin l` are equal on each element,
then they coincide (in the heq sense). -/
protected theorem heq_fun_iff {α : Sort*} {k l : ℕ} (h : k = l) {f : Fin k → α} {g : Fin l → α} :
    HEq f g ↔ ∀ i : Fin k, f i = g ⟨(i : ℕ), h ▸ i.2⟩ := by
  

Proof state:
n m : ℕ
α : Sort u_1
k l : ℕ
h : k = l
f : Fin k → α
g : Fin l → α
⊢ HEq f g ↔ ∀ (i : Fin k), f i = g { val := ↑i, isLt := (_ : ↑i < l) }

Next tactic:
subst h
/-- Assume `k = l`. If two functions defined on `Fin k` and `Fin l` are equal on each element,
then they coincide (in the heq sense). -/
protected theorem heq_fun_iff {α : Sort*} {k l : ℕ} (h : k = l) {f : Fin k → α} {g : Fin l → α} :
    HEq f g ↔ ∀ i : Fin k, f i = g ⟨(i : ℕ), h ▸ i.2⟩ := by
  subst h
  

Proof state:
n m : ℕ
α : Sort u_1
k : ℕ
f g : Fin k → α
⊢ HEq f g ↔ ∀ (i : Fin k), f i = g { val := ↑i, isLt := (_ : ↑i < k) }

Next tactic:
simp [Function.funext_iff]
/-- Assume `k = l` and `k' = l'`.
If two functions `Fin k → Fin k' → α` and `Fin l → Fin l' → α` are equal on each pair,
then they coincide (in the heq sense). -/
protected theorem heq_fun₂_iff {α : Sort*} {k l k' l' : ℕ} (h : k = l) (h' : k' = l')
    {f : Fin k → Fin k' → α} {g : Fin l → Fin l' → α} :
    HEq f g ↔ ∀ (i : Fin k) (j : Fin k'), f i j = g ⟨(i : ℕ), h ▸ i.2⟩ ⟨(j : ℕ), h' ▸ j.2⟩ := by
  

Proof state:
n m : ℕ
α : Sort u_1
k l k' l' : ℕ
h : k = l
h' : k' = l'
f : Fin k → Fin k' → α
g : Fin l → Fin l' → α
⊢ HEq f g ↔
    ∀ (i : Fin k) (j : Fin k'), f i j = g { val := ↑i, isLt := (_ : ↑i < l) } { val := ↑j, isLt := (_ : ↑j < l') }

Next tactic:
subst h
/-- Assume `k = l` and `k' = l'`.
If two functions `Fin k → Fin k' → α` and `Fin l → Fin l' → α` are equal on each pair,
then they coincide (in the heq sense). -/
protected theorem heq_fun₂_iff {α : Sort*} {k l k' l' : ℕ} (h : k = l) (h' : k' = l')
    {f : Fin k → Fin k' → α} {g : Fin l → Fin l' → α} :
    HEq f g ↔ ∀ (i : Fin k) (j : Fin k'), f i j = g ⟨(i : ℕ), h ▸ i.2⟩ ⟨(j : ℕ), h' ▸ j.2⟩ := by
  subst h
  

Proof state:
n m : ℕ
α : Sort u_1
k k' l' : ℕ
h' : k' = l'
f : Fin k → Fin k' → α
g : Fin k → Fin l' → α
⊢ HEq f g ↔
    ∀ (i : Fin k) (j : Fin k'), f i j = g { val := ↑i, isLt := (_ : ↑i < k) } { val := ↑j, isLt := (_ : ↑j < l') }

Next tactic:
subst h'
/-- Assume `k = l` and `k' = l'`.
If two functions `Fin k → Fin k' → α` and `Fin l → Fin l' → α` are equal on each pair,
then they coincide (in the heq sense). -/
protected theorem heq_fun₂_iff {α : Sort*} {k l k' l' : ℕ} (h : k = l) (h' : k' = l')
    {f : Fin k → Fin k' → α} {g : Fin l → Fin l' → α} :
    HEq f g ↔ ∀ (i : Fin k) (j : Fin k'), f i j = g ⟨(i : ℕ), h ▸ i.2⟩ ⟨(j : ℕ), h' ▸ j.2⟩ := by
  subst h
  subst h'
  

Proof state:
n m : ℕ
α : Sort u_1
k k' : ℕ
f g : Fin k → Fin k' → α
⊢ HEq f g ↔
    ∀ (i : Fin k) (j : Fin k'), f i j = g { val := ↑i, isLt := (_ : ↑i < k) } { val := ↑j, isLt := (_ : ↑j < k') }

Next tactic:
simp [Function.funext_iff]
protected theorem heq_ext_iff {k l : ℕ} (h : k = l) {i : Fin k} {j : Fin l} :
    HEq i j ↔ (i : ℕ) = (j : ℕ) := by
  

Proof state:
n m k l : ℕ
h : k = l
i : Fin k
j : Fin l
⊢ HEq i j ↔ ↑i = ↑j

Next tactic:
subst h
protected theorem heq_ext_iff {k l : ℕ} (h : k = l) {i : Fin k} {j : Fin l} :
    HEq i j ↔ (i : ℕ) = (j : ℕ) := by
  subst h
  

Proof state:
n m k : ℕ
i j : Fin k
⊢ HEq i j ↔ ↑i = ↑j

Next tactic:
simp [val_eq_val]
theorem min_val {a : Fin n} : min (a : ℕ) n = a := by 

Proof state:
n m : ℕ
a : Fin n
⊢ min (↑a) n = ↑a

Next tactic:
simp
theorem max_val {a : Fin n} : max (a : ℕ) n = n := by 

Proof state:
n m : ℕ
a : Fin n
⊢ max (↑a) n = n

Next tactic:
simp
instance {n : ℕ} : PartialOrder (Fin n) := by 

Proof state:
n✝ m n : ℕ
⊢ PartialOrder (Fin n)

Next tactic:
infer_instance
/-- The equivalence `Fin n ≃ { i // i < n }` is an order isomorphism. -/
@[simps! apply symm_apply]
def orderIsoSubtype : Fin n ≃o { i // i < n } :=
  equivSubtype.toOrderIso (by 

Proof state:
n m : ℕ
⊢ Monotone ⇑equivSubtype

Next tactic:
simp [Monotone]
/-- The equivalence `Fin n ≃ { i // i < n }` is an order isomorphism. -/
@[simps! apply symm_apply]
def orderIsoSubtype : Fin n ≃o { i // i < n } :=
  equivSubtype.toOrderIso (by simp [Monotone]) (by 

Proof state:
n m : ℕ
⊢ Monotone ⇑equivSubtype.symm

Next tactic:
simp [Monotone]
/--
The `Fin.pos_iff_ne_zero` in `Std` only applies in `Fin (n+1)`.
This one instead uses a `NeZero n` typeclass hypothesis.
-/
theorem pos_iff_ne_zero' [NeZero n] (a : Fin n) : 0 < a ↔ a ≠ 0 := by
  

Proof state:
n m : ℕ
inst✝ : NeZero n
a : Fin n
⊢ 0 < a ↔ a ≠ 0

Next tactic:
rw [← val_fin_lt, val_zero', _root_.pos_iff_ne_zero, Ne.def, Ne.def, ext_iff, val_zero']
theorem rev_involutive : Involutive (rev : Fin n → Fin n) := fun i =>
  ext <| by
    

Proof state:
n m : ℕ
i : Fin n
⊢ ↑(rev (rev i)) = ↑i

Next tactic:
dsimp only [rev]
theorem rev_involutive : Involutive (rev : Fin n → Fin n) := fun i =>
  ext <| by
    dsimp only [rev]
    

Proof state:
n m : ℕ
i : Fin n
⊢ n - (n - (↑i + 1) + 1) = ↑i

Next tactic:
rw [← tsub_tsub, tsub_tsub_cancel_of_le (Nat.add_one_le_iff.2 i.is_lt),
      add_tsub_cancel_right]
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  

Proof state:
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : Fin n
⊢ ↑(e i) = ↑i

Next tactic:
rcases i with ⟨i, hi⟩
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  

Proof state:
case mk
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
hi : i < n
⊢ ↑(e { val := i, isLt := hi }) = ↑{ val := i, isLt := hi }

Next tactic:
dsimp only
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  

Proof state:
case mk
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
hi : i < n
⊢ ↑(e { val := i, isLt := hi }) = i

Next tactic:
induction' i using Nat.strong_induction_on with i h
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  induction' i using Nat.strong_induction_on with i h
  

Proof state:
case mk.h
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
h : ∀ m_1 < i, ∀ (hi : m_1 < n), ↑(e { val := m_1, isLt := hi }) = m_1
hi : i < n
⊢ ↑(e { val := i, isLt := hi }) = i

Next tactic:
refine' le_antisymm (forall_lt_iff_le.1 fun j hj => _) (forall_lt_iff_le.1 fun j hj => _)
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  induction' i using Nat.strong_induction_on with i h
  refine' le_antisymm (forall_lt_iff_le.1 fun j hj => _) (forall_lt_iff_le.1 fun j hj => _)
  · 

Proof state:
case mk.h.refine'_1
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
h : ∀ m_1 < i, ∀ (hi : m_1 < n), ↑(e { val := m_1, isLt := hi }) = m_1
hi : i < n
j : ℕ
hj : j < ↑(e { val := i, isLt := hi })
⊢ j < i

Next tactic:
have := e.symm.lt_iff_lt.2 (mk_lt_of_lt_val hj)
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  induction' i using Nat.strong_induction_on with i h
  refine' le_antisymm (forall_lt_iff_le.1 fun j hj => _) (forall_lt_iff_le.1 fun j hj => _)
  · have := e.symm.lt_iff_lt.2 (mk_lt_of_lt_val hj)
    

Proof state:
case mk.h.refine'_1
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
h : ∀ m_1 < i, ∀ (hi : m_1 < n), ↑(e { val := m_1, isLt := hi }) = m_1
hi : i < n
j : ℕ
hj : j < ↑(e { val := i, isLt := hi })
this : (OrderIso.symm e) { val := j, isLt := (_ : j < m) } < (OrderIso.symm e) (e { val := i, isLt := hi })
⊢ j < i

Next tactic:
rw [e.symm_apply_apply] at this
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  induction' i using Nat.strong_induction_on with i h
  refine' le_antisymm (forall_lt_iff_le.1 fun j hj => _) (forall_lt_iff_le.1 fun j hj => _)
  · have := e.symm.lt_iff_lt.2 (mk_lt_of_lt_val hj)
    rw [e.symm_apply_apply] at this
    -- porting note: convert was abusing definitional equality
    

Proof state:
case mk.h.refine'_1
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
h : ∀ m_1 < i, ∀ (hi : m_1 < n), ↑(e { val := m_1, isLt := hi }) = m_1
hi : i < n
j : ℕ
hj : j < ↑(e { val := i, isLt := hi })
this : (OrderIso.symm e) { val := j, isLt := (_ : j < m) } < { val := i, isLt := hi }
⊢ j < i

Next tactic:
have : _ < i := this
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  induction' i using Nat.strong_induction_on with i h
  refine' le_antisymm (forall_lt_iff_le.1 fun j hj => _) (forall_lt_iff_le.1 fun j hj => _)
  · have := e.symm.lt_iff_lt.2 (mk_lt_of_lt_val hj)
    rw [e.symm_apply_apply] at this
    -- porting note: convert was abusing definitional equality
    have : _ < i := this
    

Proof state:
case mk.h.refine'_1
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
h : ∀ m_1 < i, ∀ (hi : m_1 < n), ↑(e { val := m_1, isLt := hi }) = m_1
hi : i < n
j : ℕ
hj : j < ↑(e { val := i, isLt := hi })
this✝ : (OrderIso.symm e) { val := j, isLt := (_ : j < m) } < { val := i, isLt := hi }
this : ↑((OrderIso.symm e) { val := j, isLt := (_ : j < m) }) < i
⊢ j < i

Next tactic:
convert this
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  induction' i using Nat.strong_induction_on with i h
  refine' le_antisymm (forall_lt_iff_le.1 fun j hj => _) (forall_lt_iff_le.1 fun j hj => _)
  · have := e.symm.lt_iff_lt.2 (mk_lt_of_lt_val hj)
    rw [e.symm_apply_apply] at this
    -- porting note: convert was abusing definitional equality
    have : _ < i := this
    convert this
    

Proof state:
case h.e'_3
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
h : ∀ m_1 < i, ∀ (hi : m_1 < n), ↑(e { val := m_1, isLt := hi }) = m_1
hi : i < n
j : ℕ
hj : j < ↑(e { val := i, isLt := hi })
this✝ : (OrderIso.symm e) { val := j, isLt := (_ : j < m) } < { val := i, isLt := hi }
this : ↑((OrderIso.symm e) { val := j, isLt := (_ : j < m) }) < i
⊢ j = ↑((OrderIso.symm e) { val := j, isLt := (_ : j < m) })

Next tactic:
simpa using h _ this (e.symm _).is_lt
/-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp]
theorem coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i := by
  rcases i with ⟨i, hi⟩
  dsimp only
  induction' i using Nat.strong_induction_on with i h
  refine' le_antisymm (forall_lt_iff_le.1 fun j hj => _) (forall_lt_iff_le.1 fun j hj => _)
  · have := e.symm.lt_iff_lt.2 (mk_lt_of_lt_val hj)
    rw [e.symm_apply_apply] at this
    -- porting note: convert was abusing definitional equality
    have : _ < i := this
    convert this
    simpa using h _ this (e.symm _).is_lt
  · 

Proof state:
case mk.h.refine'_2
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e : Fin n ≃o Fin m
i : ℕ
h : ∀ m_1 < i, ∀ (hi : m_1 < n), ↑(e { val := m_1, isLt := hi }) = m_1
hi : i < n
j : ℕ
hj : j < i
⊢ j < ↑(e { val := i, isLt := hi })

Next tactic:
rwa [← h j hj (hj.trans hi), ← lt_iff_val_lt_val, e.lt_iff_lt]
instance orderIso_subsingleton : Subsingleton (Fin n ≃o α) :=
  ⟨fun e e' => by
    

Proof state:
n m : ℕ
α : Type u_1
inst✝ : Preorder α
e e' : Fin n ≃o α
⊢ e = e'

Next tactic:
ext i