data.nat.cast.basic
⟷
Mathlib.Data.Nat.Cast.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
A few missing instances about nat.cast
/int.cast
/rat.cast
and mul_opposite
/add_opposite
.
Also add the (weirdly) missing add_comm_group_with_one → add_comm_monoid_with_one
.
Finally, this changes the defeq of rat.cast
on mul_opposite
to be simpler.
@@ -223,15 +223,6 @@ rfl
instance nat.unique_ring_hom {R : Type*} [non_assoc_semiring R] : unique (ℕ →+* R) :=
{ default := nat.cast_ring_hom R, uniq := ring_hom.eq_nat_cast' }
-namespace mul_opposite
-variables [add_monoid_with_one α]
-
-@[simp, norm_cast] lemma op_nat_cast (n : ℕ) : op (n : α) = n := rfl
-
-@[simp, norm_cast] lemma unop_nat_cast (n : ℕ) : unop (n : αᵐᵒᵖ) = n := rfl
-
-end mul_opposite
-
namespace pi
variables {π : α → Type*} [Π a, has_nat_cast (π a)]
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -8,7 +8,7 @@ import Algebra.GroupWithZero.Commute
import Algebra.Ring.Hom.Defs
import Algebra.Order.Group.Abs
import Algebra.Ring.Commute
-import Data.Nat.Order.Basic
+import Algebra.Order.Group.Nat
import Algebra.Group.Opposite
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -379,17 +379,17 @@ variable {π : α → Type _} [∀ a, NatCast (π a)]
instance : NatCast (∀ a, π a) := by refine_struct { .. } <;> pi_instance_derive_field
-#print Pi.nat_apply /-
-theorem nat_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
+#print Pi.natCast_apply /-
+theorem natCast_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
rfl
-#align pi.nat_apply Pi.nat_apply
+#align pi.nat_apply Pi.natCast_apply
-/
-#print Pi.coe_nat /-
+#print Pi.natCast_def /-
@[simp]
-theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ => n :=
+theorem natCast_def (n : ℕ) : (n : ∀ a, π a) = fun _ => n :=
rfl
-#align pi.coe_nat Pi.coe_nat
+#align pi.coe_nat Pi.natCast_def
-/
end Pi
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -5,7 +5,7 @@ Authors: Mario Carneiro
-/
import Algebra.CharZero.Defs
import Algebra.GroupWithZero.Commute
-import Algebra.Hom.Ring
+import Algebra.Ring.Hom.Defs
import Algebra.Order.Group.Abs
import Algebra.Ring.Commute
import Data.Nat.Order.Basic
@@ -223,10 +223,10 @@ theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
#align nat.abs_cast Nat.abs_cast
-/
-#print Nat.coe_nat_dvd /-
-theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
+#print Nat.cast_dvd_cast /-
+theorem cast_dvd_cast [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
map_dvd (Nat.castRingHom α) h
-#align nat.coe_nat_dvd Nat.coe_nat_dvd
+#align nat.coe_nat_dvd Nat.cast_dvd_cast
-/
alias _root_.has_dvd.dvd.nat_cast := coe_nat_dvd
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -240,7 +240,7 @@ variable {A B F : Type _} [AddMonoidWithOne B]
#print ext_nat' /-
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
- FunLike.ext f g <| by
+ DFunLike.ext f g <| by
apply Nat.rec
· simp only [Nat.zero_eq, map_zero]
simp (config := { contextual := true }) [Nat.succ_eq_add_one, h]
@@ -283,7 +283,7 @@ variable {A F : Type _} [MulZeroOneClass A]
/-- If two `monoid_with_zero_hom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
f = g := by
- apply FunLike.ext
+ apply DFunLike.ext
rintro (_ | n)
· simp
exact h_pos n.succ_pos
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,13 +3,13 @@ Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathbin.Algebra.CharZero.Defs
-import Mathbin.Algebra.GroupWithZero.Commute
-import Mathbin.Algebra.Hom.Ring
-import Mathbin.Algebra.Order.Group.Abs
-import Mathbin.Algebra.Ring.Commute
-import Mathbin.Data.Nat.Order.Basic
-import Mathbin.Algebra.Group.Opposite
+import Algebra.CharZero.Defs
+import Algebra.GroupWithZero.Commute
+import Algebra.Hom.Ring
+import Algebra.Order.Group.Abs
+import Algebra.Ring.Commute
+import Data.Nat.Order.Basic
+import Algebra.Group.Opposite
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -229,7 +229,7 @@ theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n :
#align nat.coe_nat_dvd Nat.coe_nat_dvd
-/
-alias coe_nat_dvd ← _root_.has_dvd.dvd.nat_cast
+alias _root_.has_dvd.dvd.nat_cast := coe_nat_dvd
#align has_dvd.dvd.nat_cast Dvd.Dvd.nat_cast
end Nat
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.nat.cast.basic
-! leanprover-community/mathlib commit acebd8d49928f6ed8920e502a6c90674e75bd441
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.CharZero.Defs
import Mathbin.Algebra.GroupWithZero.Commute
@@ -16,6 +11,8 @@ import Mathbin.Algebra.Ring.Commute
import Mathbin.Data.Nat.Order.Basic
import Mathbin.Algebra.Group.Opposite
+#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
+
/-!
# Cast of natural numbers (additional theorems)
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -46,15 +46,19 @@ def castAddMonoidHom (α : Type _) [AddMonoidWithOne α] : ℕ →+ α
#align nat.cast_add_monoid_hom Nat.castAddMonoidHom
-/
+#print Nat.coe_castAddMonoidHom /-
@[simp]
theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ → α) = coe :=
rfl
#align nat.coe_cast_add_monoid_hom Nat.coe_castAddMonoidHom
+-/
+#print Nat.cast_mul /-
@[simp, norm_cast]
theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
induction n <;> simp [mul_succ, mul_add, *]
#align nat.cast_mul Nat.cast_mul
+-/
#print Nat.castRingHom /-
/-- `coe : ℕ → α` as a `ring_hom` -/
@@ -66,23 +70,31 @@ def castRingHom (α : Type _) [NonAssocSemiring α] : ℕ →+* α :=
#align nat.cast_ring_hom Nat.castRingHom
-/
+#print Nat.coe_castRingHom /-
@[simp]
theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) = coe :=
rfl
#align nat.coe_cast_ring_hom Nat.coe_castRingHom
+-/
+#print Nat.cast_commute /-
theorem cast_commute [NonAssocSemiring α] (n : ℕ) (x : α) : Commute (↑n) x :=
Nat.recOn n (by rw [cast_zero] <;> exact Commute.zero_left x) fun n ihn => by
rw [cast_succ] <;> exact ihn.add_left (Commute.one_left x)
#align nat.cast_commute Nat.cast_commute
+-/
+#print Nat.cast_comm /-
theorem cast_comm [NonAssocSemiring α] (n : ℕ) (x : α) : (n : α) * x = x * n :=
(cast_commute n x).Eq
#align nat.cast_comm Nat.cast_comm
+-/
+#print Nat.commute_cast /-
theorem commute_cast [NonAssocSemiring α] (x : α) (n : ℕ) : Commute x n :=
(n.cast_commute x).symm
#align nat.commute_cast Nat.commute_cast
+-/
section OrderedSemiring
@@ -96,22 +108,28 @@ theorem mono_cast : Monotone (coe : ℕ → α) :=
#align nat.mono_cast Nat.mono_cast
-/
+#print Nat.cast_nonneg /-
@[simp]
theorem cast_nonneg (n : ℕ) : 0 ≤ (n : α) :=
@Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
#align nat.cast_nonneg Nat.cast_nonneg
+-/
section Nontrivial
variable [Nontrivial α]
+#print Nat.cast_add_one_pos /-
theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg
#align nat.cast_add_one_pos Nat.cast_add_one_pos
+-/
+#print Nat.cast_pos /-
@[simp]
theorem cast_pos {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
#align nat.cast_pos Nat.cast_pos
+-/
end Nontrivial
@@ -172,6 +190,7 @@ theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le
end OrderedSemiring
+#print Nat.cast_tsub /-
/-- A version of `nat.cast_sub` that works for `ℝ≥0` and `ℚ≥0`. Note that this proof doesn't work
for `ℕ∞` and `ℝ≥0∞`, so we use type-specific lemmas for these types. -/
@[simp, norm_cast]
@@ -184,21 +203,28 @@ theorem cast_tsub [CanonicallyOrderedCommSemiring α] [Sub α] [OrderedSub α]
· rcases le_iff_exists_add'.mp h with ⟨m, rfl⟩
rw [add_tsub_cancel_right, cast_add, add_tsub_cancel_right]
#align nat.cast_tsub Nat.cast_tsub
+-/
+#print Nat.cast_min /-
@[simp, norm_cast]
theorem cast_min [LinearOrderedSemiring α] {a b : ℕ} : (↑(min a b) : α) = min a b :=
(@mono_cast α _).map_min
#align nat.cast_min Nat.cast_min
+-/
+#print Nat.cast_max /-
@[simp, norm_cast]
theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : (↑(max a b) : α) = max a b :=
(@mono_cast α _).map_max
#align nat.cast_max Nat.cast_max
+-/
+#print Nat.abs_cast /-
@[simp, norm_cast]
theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
abs_of_nonneg (cast_nonneg a)
#align nat.abs_cast Nat.abs_cast
+-/
#print Nat.coe_nat_dvd /-
theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
@@ -215,17 +241,21 @@ section AddMonoidHomClass
variable {A B F : Type _} [AddMonoidWithOne B]
+#print ext_nat' /-
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
FunLike.ext f g <| by
apply Nat.rec
· simp only [Nat.zero_eq, map_zero]
simp (config := { contextual := true }) [Nat.succ_eq_add_one, h]
#align ext_nat' ext_nat'
+-/
+#print AddMonoidHom.ext_nat /-
@[ext]
theorem AddMonoidHom.ext_nat [AddMonoid A] : ∀ {f g : ℕ →+ A}, ∀ h : f 1 = g 1, f = g :=
ext_nat'
#align add_monoid_hom.ext_nat AddMonoidHom.ext_nat
+-/
variable [AddMonoidWithOne A]
@@ -263,10 +293,12 @@ theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n :
#align ext_nat'' ext_nat''
-/
+#print MonoidWithZeroHom.ext_nat /-
@[ext]
theorem MonoidWithZeroHom.ext_nat : ∀ {f g : ℕ →*₀ A}, (∀ {n : ℕ}, 0 < n → f n = g n) → f = g :=
ext_nat''
#align monoid_with_zero_hom.ext_nat MonoidWithZeroHom.ext_nat
+-/
end MonoidWithZeroHomClass
@@ -281,10 +313,12 @@ theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
#align eq_nat_cast eq_natCast
-/
+#print map_natCast /-
@[simp]
theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
map_natCast' f <| map_one f
#align map_nat_cast map_natCast
+-/
#print ext_nat /-
theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
@@ -292,15 +326,19 @@ theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
#align ext_nat ext_nat
-/
+#print NeZero.nat_of_injective /-
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
⟨fun h => NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero]⟩
#align ne_zero.nat_of_injective NeZero.nat_of_injective
+-/
+#print NeZero.nat_of_neZero /-
theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
{n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) := by apply NeZero.of_map f;
simp only [map_natCast, hn]
#align ne_zero.nat_of_ne_zero NeZero.nat_of_neZero
+-/
end RingHomClass
@@ -350,17 +388,21 @@ theorem nat_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
#align pi.nat_apply Pi.nat_apply
-/
+#print Pi.coe_nat /-
@[simp]
theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ => n :=
rfl
#align pi.coe_nat Pi.coe_nat
+-/
end Pi
+#print Sum.elim_natCast_natCast /-
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
@Sum.elim_lam_const_lam_const α β γ n
#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCast
+-/
namespace Pi
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -294,7 +294,7 @@ theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
- ⟨fun h => NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero] ⟩
+ ⟨fun h => NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero]⟩
#align ne_zero.nat_of_injective NeZero.nat_of_injective
theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -123,38 +123,52 @@ theorem strictMono_cast : StrictMono (coe : ℕ → α) :=
#align nat.strict_mono_cast Nat.strictMono_cast
-/
+#print Nat.castOrderEmbedding /-
/-- `coe : ℕ → α` as an `order_embedding` -/
@[simps (config := { fullyApplied := false })]
def castOrderEmbedding : ℕ ↪o α :=
OrderEmbedding.ofStrictMono coe Nat.strictMono_cast
#align nat.cast_order_embedding Nat.castOrderEmbedding
+-/
+#print Nat.cast_le /-
@[simp, norm_cast]
theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
strictMono_cast.le_iff_le
#align nat.cast_le Nat.cast_le
+-/
+#print Nat.cast_lt /-
@[simp, norm_cast, mono]
theorem cast_lt : (m : α) < n ↔ m < n :=
strictMono_cast.lt_iff_lt
#align nat.cast_lt Nat.cast_lt
+-/
+#print Nat.one_lt_cast /-
@[simp, norm_cast]
theorem one_lt_cast : 1 < (n : α) ↔ 1 < n := by rw [← cast_one, cast_lt]
#align nat.one_lt_cast Nat.one_lt_cast
+-/
+#print Nat.one_le_cast /-
@[simp, norm_cast]
theorem one_le_cast : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le]
#align nat.one_le_cast Nat.one_le_cast
+-/
+#print Nat.cast_lt_one /-
@[simp, norm_cast]
theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
rw [← cast_one, cast_lt, lt_succ_iff, ← bot_eq_zero, le_bot_iff]
#align nat.cast_lt_one Nat.cast_lt_one
+-/
+#print Nat.cast_le_one /-
@[simp, norm_cast]
theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le]
#align nat.cast_le_one Nat.cast_le_one
+-/
end OrderedSemiring
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -46,23 +46,11 @@ def castAddMonoidHom (α : Type _) [AddMonoidWithOne α] : ℕ →+ α
#align nat.cast_add_monoid_hom Nat.castAddMonoidHom
-/
-/- warning: nat.coe_cast_add_monoid_hom -> Nat.coe_castAddMonoidHom is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α], Eq.{succ u1} ((fun (_x : AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) => Nat -> α) (Nat.castAddMonoidHom.{u1} α _inst_1)) (coeFn.{succ u1, succ u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (fun (_x : AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) => Nat -> α) (AddMonoidHom.hasCoeToFun.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (Nat.castAddMonoidHom.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => α) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat α (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))))) (Nat.castAddMonoidHom.{u1} α _inst_1)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align nat.coe_cast_add_monoid_hom Nat.coe_castAddMonoidHomₓ'. -/
@[simp]
theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ → α) = coe :=
rfl
#align nat.coe_cast_add_monoid_hom Nat.coe_castAddMonoidHom
-/- warning: nat.cast_mul -> Nat.cast_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (m : Nat) (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (m : Nat) (n : Nat), Eq.{succ u1} α (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1))) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1) m) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align nat.cast_mul Nat.cast_mulₓ'. -/
@[simp, norm_cast]
theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
induction n <;> simp [mul_succ, mul_add, *]
@@ -78,44 +66,20 @@ def castRingHom (α : Type _) [NonAssocSemiring α] : ℕ →+* α :=
#align nat.cast_ring_hom Nat.castRingHom
-/
-/- warning: nat.coe_cast_ring_hom -> Nat.coe_castRingHom is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} ((fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (Nat.castRingHom.{u1} α _inst_1)) (coeFn.{succ u1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (RingHom.hasCoeToFun.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (Nat.castRingHom.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => α) _x) (MulHomClass.toFunLike.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonUnitalNonAssocSemiring.toMul.{0} Nat (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (NonUnitalRingHomClass.toMulHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1) (RingHomClass.toNonUnitalRingHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1 (RingHom.instRingHomClassRingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1)))) (Nat.castRingHom.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align nat.coe_cast_ring_hom Nat.coe_castRingHomₓ'. -/
@[simp]
theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) = coe :=
rfl
#align nat.coe_cast_ring_hom Nat.coe_castRingHom
-/- warning: nat.cast_commute -> Nat.cast_commute is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (n : Nat) (x : α), Commute.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))) n) x
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (n : Nat) (x : α), Commute.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1) n) x
-Case conversion may be inaccurate. Consider using '#align nat.cast_commute Nat.cast_commuteₓ'. -/
theorem cast_commute [NonAssocSemiring α] (n : ℕ) (x : α) : Commute (↑n) x :=
Nat.recOn n (by rw [cast_zero] <;> exact Commute.zero_left x) fun n ihn => by
rw [cast_succ] <;> exact ihn.add_left (Commute.one_left x)
#align nat.cast_commute Nat.cast_commute
-/- warning: nat.cast_comm -> Nat.cast_comm is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (n : Nat) (x : α), Eq.{succ u1} α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))) n) x) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)))) x ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (n : Nat) (x : α), Eq.{succ u1} α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1))) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1) n) x) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1))) x (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align nat.cast_comm Nat.cast_commₓ'. -/
theorem cast_comm [NonAssocSemiring α] (n : ℕ) (x : α) : (n : α) * x = x * n :=
(cast_commute n x).Eq
#align nat.cast_comm Nat.cast_comm
-/- warning: nat.commute_cast -> Nat.commute_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (x : α) (n : Nat), Commute.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1))) x ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α] (x : α) (n : Nat), Commute.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) x (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1) n)
-Case conversion may be inaccurate. Consider using '#align nat.commute_cast Nat.commute_castₓ'. -/
theorem commute_cast [NonAssocSemiring α] (x : α) (n : ℕ) : Commute x n :=
(n.cast_commute x).symm
#align nat.commute_cast Nat.commute_cast
@@ -132,12 +96,6 @@ theorem mono_cast : Monotone (coe : ℕ → α) :=
#align nat.mono_cast Nat.mono_cast
-/
-/- warning: nat.cast_nonneg -> Nat.cast_nonneg is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] (n : Nat), LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] (n : Nat), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)
-Case conversion may be inaccurate. Consider using '#align nat.cast_nonneg Nat.cast_nonnegₓ'. -/
@[simp]
theorem cast_nonneg (n : ℕ) : 0 ≤ (n : α) :=
@Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
@@ -147,22 +105,10 @@ section Nontrivial
variable [Nontrivial α]
-/- warning: nat.cast_add_one_pos -> Nat.cast_add_one_pos is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] (n : Nat), LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] (n : Nat), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align nat.cast_add_one_pos Nat.cast_add_one_posₓ'. -/
theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg
#align nat.cast_add_one_pos Nat.cast_add_one_pos
-/- warning: nat.cast_pos -> Nat.cast_pos is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n)
-Case conversion may be inaccurate. Consider using '#align nat.cast_pos Nat.cast_posₓ'. -/
@[simp]
theorem cast_pos {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
#align nat.cast_pos Nat.cast_pos
@@ -177,89 +123,41 @@ theorem strictMono_cast : StrictMono (coe : ℕ → α) :=
#align nat.strict_mono_cast Nat.strictMono_cast
-/
-/- warning: nat.cast_order_embedding -> Nat.castOrderEmbedding is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))], OrderEmbedding.{0, u1} Nat α Nat.hasLe (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))], OrderEmbedding.{0, u1} Nat α instLENat (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1)))
-Case conversion may be inaccurate. Consider using '#align nat.cast_order_embedding Nat.castOrderEmbeddingₓ'. -/
/-- `coe : ℕ → α` as an `order_embedding` -/
@[simps (config := { fullyApplied := false })]
def castOrderEmbedding : ℕ ↪o α :=
OrderEmbedding.ofStrictMono coe Nat.strictMono_cast
#align nat.cast_order_embedding Nat.castOrderEmbedding
-/- warning: nat.cast_le -> Nat.cast_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LE.le.{0} Nat Nat.hasLe m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) m) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LE.le.{0} Nat instLENat m n)
-Case conversion may be inaccurate. Consider using '#align nat.cast_le Nat.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
strictMono_cast.le_iff_le
#align nat.cast_le Nat.cast_le
-/- warning: nat.cast_lt -> Nat.cast_lt is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LT.lt.{0} Nat Nat.hasLt m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) m) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LT.lt.{0} Nat instLTNat m n)
-Case conversion may be inaccurate. Consider using '#align nat.cast_lt Nat.cast_ltₓ'. -/
@[simp, norm_cast, mono]
theorem cast_lt : (m : α) < n ↔ m < n :=
strictMono_cast.lt_iff_lt
#align nat.cast_lt Nat.cast_lt
-/- warning: nat.one_lt_cast -> Nat.one_lt_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) n)
-Case conversion may be inaccurate. Consider using '#align nat.one_lt_cast Nat.one_lt_castₓ'. -/
@[simp, norm_cast]
theorem one_lt_cast : 1 < (n : α) ↔ 1 < n := by rw [← cast_one, cast_lt]
#align nat.one_lt_cast Nat.one_lt_cast
-/- warning: nat.one_le_cast -> Nat.one_le_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LE.le.{0} Nat Nat.hasLe (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LE.le.{0} Nat instLENat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) n)
-Case conversion may be inaccurate. Consider using '#align nat.one_le_cast Nat.one_le_castₓ'. -/
@[simp, norm_cast]
theorem one_le_cast : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le]
#align nat.one_le_cast Nat.one_le_cast
-/- warning: nat.cast_lt_one -> Nat.cast_lt_one is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))))))) (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))
-Case conversion may be inaccurate. Consider using '#align nat.cast_lt_one Nat.cast_lt_oneₓ'. -/
@[simp, norm_cast]
theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
rw [← cast_one, cast_lt, lt_succ_iff, ← bot_eq_zero, le_bot_iff]
#align nat.cast_lt_one Nat.cast_lt_one
-/- warning: nat.cast_le_one -> Nat.cast_le_one is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))))))) (LE.le.{0} Nat Nat.hasLe n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (LE.le.{0} Nat instLENat n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
-Case conversion may be inaccurate. Consider using '#align nat.cast_le_one Nat.cast_le_oneₓ'. -/
@[simp, norm_cast]
theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le]
#align nat.cast_le_one Nat.cast_le_one
end OrderedSemiring
-/- warning: nat.cast_tsub -> Nat.cast_tsub is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))))) (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))] (m : Nat) (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.925 : α) => HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.925) (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.940 : α) => LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.940)] (m : Nat) (n : Nat), Eq.{succ u1} α (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) m) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align nat.cast_tsub Nat.cast_tsubₓ'. -/
/-- A version of `nat.cast_sub` that works for `ℝ≥0` and `ℚ≥0`. Note that this proof doesn't work
for `ℕ∞` and `ℝ≥0∞`, so we use type-specific lemmas for these types. -/
@[simp, norm_cast]
@@ -273,34 +171,16 @@ theorem cast_tsub [CanonicallyOrderedCommSemiring α] [Sub α] [OrderedSub α]
rw [add_tsub_cancel_right, cast_add, add_tsub_cancel_right]
#align nat.cast_tsub Nat.cast_tsub
-/- warning: nat.cast_min -> Nat.cast_min is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {a : Nat} {b : Nat}, Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) (LinearOrder.min.{0} Nat Nat.linearOrder a b)) (LinearOrder.min.{u1} α (LinearOrderedAddCommMonoid.toLinearOrder.{u1} α (LinearOrderedSemiring.toLinearOrderedAddCommMonoid.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) a) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {a : Nat} {b : Nat}, Eq.{succ u1} α (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Min.min.{0} Nat instMinNat a b)) (Min.min.{u1} α (LinearOrderedSemiring.toMin.{u1} α _inst_1) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) a) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) b))
-Case conversion may be inaccurate. Consider using '#align nat.cast_min Nat.cast_minₓ'. -/
@[simp, norm_cast]
theorem cast_min [LinearOrderedSemiring α] {a b : ℕ} : (↑(min a b) : α) = min a b :=
(@mono_cast α _).map_min
#align nat.cast_min Nat.cast_min
-/- warning: nat.cast_max -> Nat.cast_max is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {a : Nat} {b : Nat}, Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) (LinearOrder.max.{0} Nat Nat.linearOrder a b)) (LinearOrder.max.{u1} α (LinearOrderedAddCommMonoid.toLinearOrder.{u1} α (LinearOrderedSemiring.toLinearOrderedAddCommMonoid.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) a) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {a : Nat} {b : Nat}, Eq.{succ u1} α (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Max.max.{0} Nat Nat.instMaxNat a b)) (Max.max.{u1} α (LinearOrderedSemiring.toMax.{u1} α _inst_1) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) a) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) b))
-Case conversion may be inaccurate. Consider using '#align nat.cast_max Nat.cast_maxₓ'. -/
@[simp, norm_cast]
theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : (↑(max a b) : α) = max a b :=
(@mono_cast α _).map_max
#align nat.cast_max Nat.cast_max
-/- warning: nat.abs_cast -> Nat.abs_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (SemilatticeSup.toHasSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (LinearOrder.toLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) (SemilatticeSup.toSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1)))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) a)) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) a)
-Case conversion may be inaccurate. Consider using '#align nat.abs_cast Nat.abs_castₓ'. -/
@[simp, norm_cast]
theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
abs_of_nonneg (cast_nonneg a)
@@ -321,12 +201,6 @@ section AddMonoidHomClass
variable {A B F : Type _} [AddMonoidWithOne B]
-/- warning: ext_nat' -> ext_nat' is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {F : Type.{u2}} [_inst_2 : AddMonoid.{u1} A] [_inst_3 : AddMonoidHomClass.{u2, 0, u1} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)] (f : F) (g : F), (Eq.{succ u1} A (coeFn.{succ u2, succ u1} F (fun (_x : F) => Nat -> A) (FunLike.hasCoeToFun.{succ u2, 1, succ u1} F Nat (fun (_x : Nat) => A) (AddHomClass.toFunLike.{u2, 0, u1} F Nat A (AddZeroClass.toHasAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toHasAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u2, 0, u1} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) _inst_3))) f (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (coeFn.{succ u2, succ u1} F (fun (_x : F) => Nat -> A) (FunLike.hasCoeToFun.{succ u2, 1, succ u1} F Nat (fun (_x : Nat) => A) (AddHomClass.toFunLike.{u2, 0, u1} F Nat A (AddZeroClass.toHasAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toHasAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u2, 0, u1} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) _inst_3))) g (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) -> (Eq.{succ u2} F f g)
-but is expected to have type
- forall {A : Type.{u2}} {F : Type.{u1}} [_inst_2 : AddMonoid.{u2} A] [_inst_3 : AddMonoidHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2)] (f : F) (g : F), (Eq.{succ u2} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u2} F Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u2} F Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u2} A (AddMonoid.toAddZeroClass.{u2} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2) _inst_3)) f (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u2} F Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u2} F Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u2} A (AddMonoid.toAddZeroClass.{u2} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2) _inst_3)) g (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) -> (Eq.{succ u1} F f g)
-Case conversion may be inaccurate. Consider using '#align ext_nat' ext_nat'ₓ'. -/
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
FunLike.ext f g <| by
apply Nat.rec
@@ -334,12 +208,6 @@ theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 =
simp (config := { contextual := true }) [Nat.succ_eq_add_one, h]
#align ext_nat' ext_nat'
-/- warning: add_monoid_hom.ext_nat -> AddMonoidHom.ext_nat is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} [_inst_2 : AddMonoid.{u1} A] {f : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)} {g : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)}, (Eq.{succ u1} A (coeFn.{succ u1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (fun (_x : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) => Nat -> A) (AddMonoidHom.hasCoeToFun.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) f (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (coeFn.{succ u1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (fun (_x : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) => Nat -> A) (AddMonoidHom.hasCoeToFun.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) g (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) -> (Eq.{succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) f g)
-but is expected to have type
- forall {A : Type.{u1}} [_inst_2 : AddMonoid.{u1} A] {f : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)} {g : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)}, (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)))) f (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)))) g (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) -> (Eq.{succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) f g)
-Case conversion may be inaccurate. Consider using '#align add_monoid_hom.ext_nat AddMonoidHom.ext_natₓ'. -/
@[ext]
theorem AddMonoidHom.ext_nat [AddMonoid A] : ∀ {f g : ℕ →+ A}, ∀ h : f 1 = g 1, f = g :=
ext_nat'
@@ -381,12 +249,6 @@ theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n :
#align ext_nat'' ext_nat''
-/
-/- warning: monoid_with_zero_hom.ext_nat -> MonoidWithZeroHom.ext_nat is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) n) -> (Eq.{succ u1} A (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f n) (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
-but is expected to have type
- forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n) -> (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => A) n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) f n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
-Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.ext_nat MonoidWithZeroHom.ext_natₓ'. -/
@[ext]
theorem MonoidWithZeroHom.ext_nat : ∀ {f g : ℕ →*₀ A}, (∀ {n : ℕ}, 0 < n → f n = g n) → f = g :=
ext_nat''
@@ -405,12 +267,6 @@ theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
#align eq_nat_cast eq_natCast
-/
-/- warning: map_nat_cast -> map_natCast is a dubious translation:
-lean 3 declaration is
- forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u2} S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n)
-but is expected to have type
- forall {R : Type.{u2}} {S : Type.{u1}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u2} R] [_inst_2 : NonAssocSemiring.{u1} S] [_inst_3 : RingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (FunLike.coe.{succ u3, succ u2, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{u3, u2, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u3, u2, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2 _inst_3))) f (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (Nat.cast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (NonAssocSemiring.toNatCast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) _inst_2) n)
-Case conversion may be inaccurate. Consider using '#align map_nat_cast map_natCastₓ'. -/
@[simp]
theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
map_natCast' f <| map_one f
@@ -422,23 +278,11 @@ theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
#align ext_nat ext_nat
-/
-/- warning: ne_zero.nat_of_injective -> NeZero.nat_of_injective is a dubious translation:
-lean 3 declaration is
- forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] {n : Nat} [h : NeZero.{u1} R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u1, succ u2} R S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f)) -> (NeZero.{u2} S (MulZeroClass.toHasZero.{u2} S (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n))
-but is expected to have type
- forall {R : Type.{u3}} {S : Type.{u1}} {F : Type.{u2}} [_inst_1 : NonAssocSemiring.{u3} R] [_inst_2 : NonAssocSemiring.{u1} S] {n : Nat} [h : NeZero.{u3} R (MulZeroOneClass.toZero.{u3} R (NonAssocSemiring.toMulZeroOneClass.{u3} R _inst_1)) (Nat.cast.{u3} R (NonAssocSemiring.toNatCast.{u3} R _inst_1) n)] [_inst_3 : RingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u3, succ u1} R S (FunLike.coe.{succ u2, succ u3, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{u2, u3, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u3} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u2, u3, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2 _inst_3))) f)) -> (NeZero.{u1} S (MulZeroOneClass.toZero.{u1} S (NonAssocSemiring.toMulZeroOneClass.{u1} S _inst_2)) (Nat.cast.{u1} S (NonAssocSemiring.toNatCast.{u1} S _inst_2) n))
-Case conversion may be inaccurate. Consider using '#align ne_zero.nat_of_injective NeZero.nat_of_injectiveₓ'. -/
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
⟨fun h => NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero] ⟩
#align ne_zero.nat_of_injective NeZero.nat_of_injective
-/- warning: ne_zero.nat_of_ne_zero -> NeZero.nat_of_neZero is a dubious translation:
-lean 3 declaration is
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : Semiring.{u1} R] [_inst_4 : Semiring.{u2} S] {F : Type.{u3}} [_inst_5 : RingHomClass.{u3, u1, u2} F R S (Semiring.toNonAssocSemiring.{u1} R _inst_3) (Semiring.toNonAssocSemiring.{u2} S _inst_4)], F -> (forall {n : Nat} [hn : NeZero.{u2} S (MulZeroClass.toHasZero.{u2} S (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S _inst_4)))) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S (Semiring.toNonAssocSemiring.{u2} S _inst_4))))))) n)], NeZero.{u1} R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_3)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_3))))))) n))
-but is expected to have type
- forall {R : Type.{u3}} {S : Type.{u2}} [_inst_3 : Semiring.{u3} R] [_inst_4 : Semiring.{u2} S] {F : Type.{u1}} [_inst_5 : RingHomClass.{u1, u3, u2} F R S (Semiring.toNonAssocSemiring.{u3} R _inst_3) (Semiring.toNonAssocSemiring.{u2} S _inst_4)], F -> (forall {n : Nat} [hn : NeZero.{u2} S (MonoidWithZero.toZero.{u2} S (Semiring.toMonoidWithZero.{u2} S _inst_4)) (Nat.cast.{u2} S (Semiring.toNatCast.{u2} S _inst_4) n)], NeZero.{u3} R (MonoidWithZero.toZero.{u3} R (Semiring.toMonoidWithZero.{u3} R _inst_3)) (Nat.cast.{u3} R (Semiring.toNatCast.{u3} R _inst_3) n))
-Case conversion may be inaccurate. Consider using '#align ne_zero.nat_of_ne_zero NeZero.nat_of_neZeroₓ'. -/
theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
{n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) := by apply NeZero.of_map f;
simp only [map_natCast, hn]
@@ -492,12 +336,6 @@ theorem nat_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
#align pi.nat_apply Pi.nat_apply
-/
-/- warning: pi.coe_nat -> Pi.coe_nat is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {π : α -> Type.{u2}} [_inst_1 : forall (a : α), NatCast.{u2} (π a)] (n : Nat), Eq.{max (succ u1) (succ u2)} (forall (a : α), π a) ((fun (a : Type) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{1, max (succ u1) (succ u2)} a b] => self.0) Nat (forall (a : α), π a) (HasLiftT.mk.{1, max (succ u1) (succ u2)} Nat (forall (a : α), π a) (CoeTCₓ.coe.{1, max (succ u1) (succ u2)} Nat (forall (a : α), π a) (Nat.castCoe.{max u1 u2} (forall (a : α), π a) (Pi.hasNatCast.{u1, u2} α (fun (a : α) => π a) (fun (a : α) => _inst_1 a))))) n) (fun (_x : α) => (fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat (π _x) (HasLiftT.mk.{1, succ u2} Nat (π _x) (CoeTCₓ.coe.{1, succ u2} Nat (π _x) (Nat.castCoe.{u2} (π _x) (_inst_1 _x)))) n)
-but is expected to have type
- forall {α : Type.{u2}} {π : α -> Type.{u1}} [_inst_1 : forall (a : α), NatCast.{u1} (π a)] (n : Nat), Eq.{max (succ u2) (succ u1)} (forall (a : α), π a) (Nat.cast.{max u2 u1} (forall (a : α), π a) (Pi.natCast.{u2, u1} α (fun (a : α) => π a) (fun (a : α) => _inst_1 a)) n) (fun (_x : α) => Nat.cast.{u1} (π _x) (_inst_1 _x) n)
-Case conversion may be inaccurate. Consider using '#align pi.coe_nat Pi.coe_natₓ'. -/
@[simp]
theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ => n :=
rfl
@@ -505,12 +343,6 @@ theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ => n :=
end Pi
-/- warning: sum.elim_nat_cast_nat_cast -> Sum.elim_natCast_natCast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : NatCast.{u3} γ] (n : Nat), Eq.{max (max (succ u1) (succ u2)) (succ u3)} ((Sum.{u1, u2} α β) -> γ) (Sum.elim.{u1, u2, succ u3} α β γ ((fun (a : Type) (b : Sort.{max (succ u1) (succ u3)}) [self : HasLiftT.{1, max (succ u1) (succ u3)} a b] => self.0) Nat (α -> γ) (HasLiftT.mk.{1, max (succ u1) (succ u3)} Nat (α -> γ) (CoeTCₓ.coe.{1, max (succ u1) (succ u3)} Nat (α -> γ) (Nat.castCoe.{max u1 u3} (α -> γ) (Pi.hasNatCast.{u1, u3} α (fun (ᾰ : α) => γ) (fun (a : α) => _inst_1))))) n) ((fun (a : Type) (b : Sort.{max (succ u2) (succ u3)}) [self : HasLiftT.{1, max (succ u2) (succ u3)} a b] => self.0) Nat (β -> γ) (HasLiftT.mk.{1, max (succ u2) (succ u3)} Nat (β -> γ) (CoeTCₓ.coe.{1, max (succ u2) (succ u3)} Nat (β -> γ) (Nat.castCoe.{max u2 u3} (β -> γ) (Pi.hasNatCast.{u2, u3} β (fun (ᾰ : β) => γ) (fun (a : β) => _inst_1))))) n)) ((fun (a : Type) (b : Sort.{max (max (succ u1) (succ u2)) (succ u3)}) [self : HasLiftT.{1, max (max (succ u1) (succ u2)) (succ u3)} a b] => self.0) Nat ((Sum.{u1, u2} α β) -> γ) (HasLiftT.mk.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (CoeTCₓ.coe.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (Nat.castCoe.{max (max u1 u2) u3} ((Sum.{u1, u2} α β) -> γ) (Pi.hasNatCast.{max u1 u2, u3} (Sum.{u1, u2} α β) (fun (ᾰ : Sum.{u1, u2} α β) => γ) (fun (a : Sum.{u1, u2} α β) => _inst_1))))) n)
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2264 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2271 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
-Case conversion may be inaccurate. Consider using '#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCastₓ'. -/
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
@Sum.elim_lam_const_lam_const α β γ n
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -440,9 +440,7 @@ but is expected to have type
forall {R : Type.{u3}} {S : Type.{u2}} [_inst_3 : Semiring.{u3} R] [_inst_4 : Semiring.{u2} S] {F : Type.{u1}} [_inst_5 : RingHomClass.{u1, u3, u2} F R S (Semiring.toNonAssocSemiring.{u3} R _inst_3) (Semiring.toNonAssocSemiring.{u2} S _inst_4)], F -> (forall {n : Nat} [hn : NeZero.{u2} S (MonoidWithZero.toZero.{u2} S (Semiring.toMonoidWithZero.{u2} S _inst_4)) (Nat.cast.{u2} S (Semiring.toNatCast.{u2} S _inst_4) n)], NeZero.{u3} R (MonoidWithZero.toZero.{u3} R (Semiring.toMonoidWithZero.{u3} R _inst_3)) (Nat.cast.{u3} R (Semiring.toNatCast.{u3} R _inst_3) n))
Case conversion may be inaccurate. Consider using '#align ne_zero.nat_of_ne_zero NeZero.nat_of_neZeroₓ'. -/
theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
- {n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) :=
- by
- apply NeZero.of_map f
+ {n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) := by apply NeZero.of_map f;
simp only [map_natCast, hn]
#align ne_zero.nat_of_ne_zero NeZero.nat_of_neZero
mathlib commit https://github.com/leanprover-community/mathlib/commit/95a87616d63b3cb49d3fe678d416fbe9c4217bf4
@@ -82,7 +82,7 @@ def castRingHom (α : Type _) [NonAssocSemiring α] : ℕ →+* α :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} ((fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (Nat.castRingHom.{u1} α _inst_1)) (coeFn.{succ u1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (RingHom.hasCoeToFun.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (Nat.castRingHom.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => α) _x) (MulHomClass.toFunLike.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonUnitalNonAssocSemiring.toMul.{0} Nat (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (NonUnitalRingHomClass.toMulHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1) (RingHomClass.toNonUnitalRingHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1 (RingHom.instRingHomClassRingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1)))) (Nat.castRingHom.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1))
+ forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => α) _x) (MulHomClass.toFunLike.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonUnitalNonAssocSemiring.toMul.{0} Nat (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (NonUnitalRingHomClass.toMulHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1) (RingHomClass.toNonUnitalRingHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1 (RingHom.instRingHomClassRingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1)))) (Nat.castRingHom.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1))
Case conversion may be inaccurate. Consider using '#align nat.coe_cast_ring_hom Nat.coe_castRingHomₓ'. -/
@[simp]
theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) = coe :=
@@ -385,7 +385,7 @@ theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n :
lean 3 declaration is
forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) n) -> (Eq.{succ u1} A (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f n) (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
but is expected to have type
- forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n) -> (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => A) n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) f n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
+ forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n) -> (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => A) n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) f n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.ext_nat MonoidWithZeroHom.ext_natₓ'. -/
@[ext]
theorem MonoidWithZeroHom.ext_nat : ∀ {f g : ℕ →*₀ A}, (∀ {n : ℕ}, 0 < n → f n = g n) → f = g :=
@@ -409,7 +409,7 @@ theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u2} S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n)
but is expected to have type
- forall {R : Type.{u2}} {S : Type.{u1}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u2} R] [_inst_2 : NonAssocSemiring.{u1} S] [_inst_3 : RingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (FunLike.coe.{succ u3, succ u2, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{u3, u2, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u3, u2, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2 _inst_3))) f (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (Nat.cast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (NonAssocSemiring.toNatCast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) _inst_2) n)
+ forall {R : Type.{u2}} {S : Type.{u1}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u2} R] [_inst_2 : NonAssocSemiring.{u1} S] [_inst_3 : RingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (FunLike.coe.{succ u3, succ u2, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{u3, u2, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u3, u2, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2 _inst_3))) f (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (Nat.cast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (NonAssocSemiring.toNatCast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) _inst_2) n)
Case conversion may be inaccurate. Consider using '#align map_nat_cast map_natCastₓ'. -/
@[simp]
theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
@@ -426,7 +426,7 @@ theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] {n : Nat} [h : NeZero.{u1} R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u1, succ u2} R S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f)) -> (NeZero.{u2} S (MulZeroClass.toHasZero.{u2} S (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n))
but is expected to have type
- forall {R : Type.{u3}} {S : Type.{u1}} {F : Type.{u2}} [_inst_1 : NonAssocSemiring.{u3} R] [_inst_2 : NonAssocSemiring.{u1} S] {n : Nat} [h : NeZero.{u3} R (MulZeroOneClass.toZero.{u3} R (NonAssocSemiring.toMulZeroOneClass.{u3} R _inst_1)) (Nat.cast.{u3} R (NonAssocSemiring.toNatCast.{u3} R _inst_1) n)] [_inst_3 : RingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u3, succ u1} R S (FunLike.coe.{succ u2, succ u3, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{u2, u3, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u3} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u2, u3, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2 _inst_3))) f)) -> (NeZero.{u1} S (MulZeroOneClass.toZero.{u1} S (NonAssocSemiring.toMulZeroOneClass.{u1} S _inst_2)) (Nat.cast.{u1} S (NonAssocSemiring.toNatCast.{u1} S _inst_2) n))
+ forall {R : Type.{u3}} {S : Type.{u1}} {F : Type.{u2}} [_inst_1 : NonAssocSemiring.{u3} R] [_inst_2 : NonAssocSemiring.{u1} S] {n : Nat} [h : NeZero.{u3} R (MulZeroOneClass.toZero.{u3} R (NonAssocSemiring.toMulZeroOneClass.{u3} R _inst_1)) (Nat.cast.{u3} R (NonAssocSemiring.toNatCast.{u3} R _inst_1) n)] [_inst_3 : RingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u3, succ u1} R S (FunLike.coe.{succ u2, succ u3, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{u2, u3, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u3} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u2, u3, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2 _inst_3))) f)) -> (NeZero.{u1} S (MulZeroOneClass.toZero.{u1} S (NonAssocSemiring.toMulZeroOneClass.{u1} S _inst_2)) (Nat.cast.{u1} S (NonAssocSemiring.toNatCast.{u1} S _inst_2) n))
Case conversion may be inaccurate. Consider using '#align ne_zero.nat_of_injective NeZero.nat_of_injectiveₓ'. -/
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -134,7 +134,7 @@ theorem mono_cast : Monotone (coe : ℕ → α) :=
/- warning: nat.cast_nonneg -> Nat.cast_nonneg is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] (n : Nat), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] (n : Nat), LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] (n : Nat), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)
Case conversion may be inaccurate. Consider using '#align nat.cast_nonneg Nat.cast_nonnegₓ'. -/
@@ -149,7 +149,7 @@ variable [Nontrivial α]
/- warning: nat.cast_add_one_pos -> Nat.cast_add_one_pos is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] (n : Nat), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))))
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] (n : Nat), LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] (n : Nat), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))
Case conversion may be inaccurate. Consider using '#align nat.cast_add_one_pos Nat.cast_add_one_posₓ'. -/
@@ -159,7 +159,7 @@ theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
/- warning: nat.cast_pos -> Nat.cast_pos is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) n)
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : Nontrivial.{u1} α] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n)
Case conversion may be inaccurate. Consider using '#align nat.cast_pos Nat.cast_posₓ'. -/
@@ -177,58 +177,86 @@ theorem strictMono_cast : StrictMono (coe : ℕ → α) :=
#align nat.strict_mono_cast Nat.strictMono_cast
-/
-#print Nat.castOrderEmbedding /-
+/- warning: nat.cast_order_embedding -> Nat.castOrderEmbedding is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))], OrderEmbedding.{0, u1} Nat α Nat.hasLe (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))], OrderEmbedding.{0, u1} Nat α instLENat (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1)))
+Case conversion may be inaccurate. Consider using '#align nat.cast_order_embedding Nat.castOrderEmbeddingₓ'. -/
/-- `coe : ℕ → α` as an `order_embedding` -/
@[simps (config := { fullyApplied := false })]
def castOrderEmbedding : ℕ ↪o α :=
OrderEmbedding.ofStrictMono coe Nat.strictMono_cast
#align nat.cast_order_embedding Nat.castOrderEmbedding
--/
-#print Nat.cast_le /-
+/- warning: nat.cast_le -> Nat.cast_le is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LE.le.{0} Nat Nat.hasLe m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) m) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LE.le.{0} Nat instLENat m n)
+Case conversion may be inaccurate. Consider using '#align nat.cast_le Nat.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
strictMono_cast.le_iff_le
#align nat.cast_le Nat.cast_le
--/
-#print Nat.cast_lt /-
+/- warning: nat.cast_lt -> Nat.cast_lt is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LT.lt.{0} Nat Nat.hasLt m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {m : Nat} {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) m) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LT.lt.{0} Nat instLTNat m n)
+Case conversion may be inaccurate. Consider using '#align nat.cast_lt Nat.cast_ltₓ'. -/
@[simp, norm_cast, mono]
theorem cast_lt : (m : α) < n ↔ m < n :=
strictMono_cast.lt_iff_lt
#align nat.cast_lt Nat.cast_lt
--/
-#print Nat.one_lt_cast /-
+/- warning: nat.one_lt_cast -> Nat.one_lt_cast is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) n)
+Case conversion may be inaccurate. Consider using '#align nat.one_lt_cast Nat.one_lt_castₓ'. -/
@[simp, norm_cast]
theorem one_lt_cast : 1 < (n : α) ↔ 1 < n := by rw [← cast_one, cast_lt]
#align nat.one_lt_cast Nat.one_lt_cast
--/
-#print Nat.one_le_cast /-
+/- warning: nat.one_le_cast -> Nat.one_le_cast is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n)) (LE.le.{0} Nat Nat.hasLe (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n)) (LE.le.{0} Nat instLENat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) n)
+Case conversion may be inaccurate. Consider using '#align nat.one_le_cast Nat.one_le_castₓ'. -/
@[simp, norm_cast]
theorem one_le_cast : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le]
#align nat.one_le_cast Nat.one_le_cast
--/
-#print Nat.cast_lt_one /-
+/- warning: nat.cast_lt_one -> Nat.cast_lt_one is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))))))) (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))
+Case conversion may be inaccurate. Consider using '#align nat.cast_lt_one Nat.cast_lt_oneₓ'. -/
@[simp, norm_cast]
theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
rw [← cast_one, cast_lt, lt_succ_iff, ← bot_eq_zero, le_bot_iff]
#align nat.cast_lt_one Nat.cast_lt_one
--/
-#print Nat.cast_le_one /-
+/- warning: nat.cast_le_one -> Nat.cast_le_one is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)))))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))))))) (LE.le.{0} Nat Nat.hasLe n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} α] [_inst_2 : CharZero.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))] {n : Nat}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α _inst_1))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (OrderedSemiring.toSemiring.{u1} α _inst_1))))) (LE.le.{0} Nat instLENat n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
+Case conversion may be inaccurate. Consider using '#align nat.cast_le_one Nat.cast_le_oneₓ'. -/
@[simp, norm_cast]
theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le]
#align nat.cast_le_one Nat.cast_le_one
--/
end OrderedSemiring
/- warning: nat.cast_tsub -> Nat.cast_tsub is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))))) (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))] (m : Nat) (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) n))
+ forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))))) (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))] (m : Nat) (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) n))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.925 : α) => HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.925) (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.940 : α) => LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.940)] (m : Nat) (n : Nat), Eq.{succ u1} α (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) m) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) n))
Case conversion may be inaccurate. Consider using '#align nat.cast_tsub Nat.cast_tsubₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/08e1d8d4d989df3a6df86f385e9053ec8a372cc1
@@ -271,7 +271,7 @@ theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : (↑(max a b) : α) =
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (SemilatticeSup.toHasSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (LinearOrder.toLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) (SemilatticeSup.toSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1)))))) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) (SemilatticeSup.toSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1)))))) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) a)) (Nat.cast.{u1} α (Semiring.toNatCast.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) a)
Case conversion may be inaccurate. Consider using '#align nat.abs_cast Nat.abs_castₓ'. -/
@[simp, norm_cast]
theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/36b8aa61ea7c05727161f96a0532897bd72aedab
@@ -483,7 +483,7 @@ end Pi
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : NatCast.{u3} γ] (n : Nat), Eq.{max (max (succ u1) (succ u2)) (succ u3)} ((Sum.{u1, u2} α β) -> γ) (Sum.elim.{u1, u2, succ u3} α β γ ((fun (a : Type) (b : Sort.{max (succ u1) (succ u3)}) [self : HasLiftT.{1, max (succ u1) (succ u3)} a b] => self.0) Nat (α -> γ) (HasLiftT.mk.{1, max (succ u1) (succ u3)} Nat (α -> γ) (CoeTCₓ.coe.{1, max (succ u1) (succ u3)} Nat (α -> γ) (Nat.castCoe.{max u1 u3} (α -> γ) (Pi.hasNatCast.{u1, u3} α (fun (ᾰ : α) => γ) (fun (a : α) => _inst_1))))) n) ((fun (a : Type) (b : Sort.{max (succ u2) (succ u3)}) [self : HasLiftT.{1, max (succ u2) (succ u3)} a b] => self.0) Nat (β -> γ) (HasLiftT.mk.{1, max (succ u2) (succ u3)} Nat (β -> γ) (CoeTCₓ.coe.{1, max (succ u2) (succ u3)} Nat (β -> γ) (Nat.castCoe.{max u2 u3} (β -> γ) (Pi.hasNatCast.{u2, u3} β (fun (ᾰ : β) => γ) (fun (a : β) => _inst_1))))) n)) ((fun (a : Type) (b : Sort.{max (max (succ u1) (succ u2)) (succ u3)}) [self : HasLiftT.{1, max (max (succ u1) (succ u2)) (succ u3)} a b] => self.0) Nat ((Sum.{u1, u2} α β) -> γ) (HasLiftT.mk.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (CoeTCₓ.coe.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (Nat.castCoe.{max (max u1 u2) u3} ((Sum.{u1, u2} α β) -> γ) (Pi.hasNatCast.{max u1 u2, u3} (Sum.{u1, u2} α β) (fun (ᾰ : Sum.{u1, u2} α β) => γ) (fun (a : Sum.{u1, u2} α β) => _inst_1))))) n)
but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2266 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2273 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
+ forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2264 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2271 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
Case conversion may be inaccurate. Consider using '#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCastₓ'. -/
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/728baa2f54e6062c5879a3e397ac6bac323e506f
@@ -483,7 +483,7 @@ end Pi
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : NatCast.{u3} γ] (n : Nat), Eq.{max (max (succ u1) (succ u2)) (succ u3)} ((Sum.{u1, u2} α β) -> γ) (Sum.elim.{u1, u2, succ u3} α β γ ((fun (a : Type) (b : Sort.{max (succ u1) (succ u3)}) [self : HasLiftT.{1, max (succ u1) (succ u3)} a b] => self.0) Nat (α -> γ) (HasLiftT.mk.{1, max (succ u1) (succ u3)} Nat (α -> γ) (CoeTCₓ.coe.{1, max (succ u1) (succ u3)} Nat (α -> γ) (Nat.castCoe.{max u1 u3} (α -> γ) (Pi.hasNatCast.{u1, u3} α (fun (ᾰ : α) => γ) (fun (a : α) => _inst_1))))) n) ((fun (a : Type) (b : Sort.{max (succ u2) (succ u3)}) [self : HasLiftT.{1, max (succ u2) (succ u3)} a b] => self.0) Nat (β -> γ) (HasLiftT.mk.{1, max (succ u2) (succ u3)} Nat (β -> γ) (CoeTCₓ.coe.{1, max (succ u2) (succ u3)} Nat (β -> γ) (Nat.castCoe.{max u2 u3} (β -> γ) (Pi.hasNatCast.{u2, u3} β (fun (ᾰ : β) => γ) (fun (a : β) => _inst_1))))) n)) ((fun (a : Type) (b : Sort.{max (max (succ u1) (succ u2)) (succ u3)}) [self : HasLiftT.{1, max (max (succ u1) (succ u2)) (succ u3)} a b] => self.0) Nat ((Sum.{u1, u2} α β) -> γ) (HasLiftT.mk.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (CoeTCₓ.coe.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (Nat.castCoe.{max (max u1 u2) u3} ((Sum.{u1, u2} α β) -> γ) (Pi.hasNatCast.{max u1 u2, u3} (Sum.{u1, u2} α β) (fun (ᾰ : Sum.{u1, u2} α β) => γ) (fun (a : Sum.{u1, u2} α β) => _inst_1))))) n)
but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2224 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2231 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
+ forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2266 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2273 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
Case conversion may be inaccurate. Consider using '#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCastₓ'. -/
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce86f4e05e9a9b8da5e316b22c76ce76440c56a1
@@ -269,7 +269,7 @@ theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : (↑(max a b) : α) =
/- warning: nat.abs_cast -> Nat.abs_cast is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (NonAssocRing.toAddGroupWithOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (SemilatticeSup.toHasSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (LinearOrder.toLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (NonAssocRing.toAddGroupWithOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (NonAssocRing.toAddGroupWithOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (SemilatticeSup.toHasSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (LinearOrder.toLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) (SemilatticeSup.toSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1)))))) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)
Case conversion may be inaccurate. Consider using '#align nat.abs_cast Nat.abs_castₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/b19481deb571022990f1baa9cbf9172e6757a479
@@ -483,7 +483,7 @@ end Pi
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : NatCast.{u3} γ] (n : Nat), Eq.{max (max (succ u1) (succ u2)) (succ u3)} ((Sum.{u1, u2} α β) -> γ) (Sum.elim.{u1, u2, succ u3} α β γ ((fun (a : Type) (b : Sort.{max (succ u1) (succ u3)}) [self : HasLiftT.{1, max (succ u1) (succ u3)} a b] => self.0) Nat (α -> γ) (HasLiftT.mk.{1, max (succ u1) (succ u3)} Nat (α -> γ) (CoeTCₓ.coe.{1, max (succ u1) (succ u3)} Nat (α -> γ) (Nat.castCoe.{max u1 u3} (α -> γ) (Pi.hasNatCast.{u1, u3} α (fun (ᾰ : α) => γ) (fun (a : α) => _inst_1))))) n) ((fun (a : Type) (b : Sort.{max (succ u2) (succ u3)}) [self : HasLiftT.{1, max (succ u2) (succ u3)} a b] => self.0) Nat (β -> γ) (HasLiftT.mk.{1, max (succ u2) (succ u3)} Nat (β -> γ) (CoeTCₓ.coe.{1, max (succ u2) (succ u3)} Nat (β -> γ) (Nat.castCoe.{max u2 u3} (β -> γ) (Pi.hasNatCast.{u2, u3} β (fun (ᾰ : β) => γ) (fun (a : β) => _inst_1))))) n)) ((fun (a : Type) (b : Sort.{max (max (succ u1) (succ u2)) (succ u3)}) [self : HasLiftT.{1, max (max (succ u1) (succ u2)) (succ u3)} a b] => self.0) Nat ((Sum.{u1, u2} α β) -> γ) (HasLiftT.mk.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (CoeTCₓ.coe.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (Nat.castCoe.{max (max u1 u2) u3} ((Sum.{u1, u2} α β) -> γ) (Pi.hasNatCast.{max u1 u2, u3} (Sum.{u1, u2} α β) (fun (ᾰ : Sum.{u1, u2} α β) => γ) (fun (a : Sum.{u1, u2} α β) => _inst_1))))) n)
but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2276 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2283 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
+ forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2224 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2231 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
Case conversion may be inaccurate. Consider using '#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCastₓ'. -/
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/1f4705ccdfe1e557fc54a0ce081a05e33d2e6240
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
! This file was ported from Lean 3 source module data.nat.cast.basic
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
+! leanprover-community/mathlib commit acebd8d49928f6ed8920e502a6c90674e75bd441
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -454,34 +454,6 @@ instance Nat.uniqueRingHom {R : Type _} [NonAssocSemiring R] : Unique (ℕ →+*
#align nat.unique_ring_hom Nat.uniqueRingHom
-/
-namespace MulOpposite
-
-variable [AddMonoidWithOne α]
-
-/- warning: mul_opposite.op_nat_cast -> MulOpposite.op_natCast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} (MulOpposite.{u1} α) (MulOpposite.op.{u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat (MulOpposite.{u1} α) (HasLiftT.mk.{1, succ u1} Nat (MulOpposite.{u1} α) (CoeTCₓ.coe.{1, succ u1} Nat (MulOpposite.{u1} α) (Nat.castCoe.{u1} (MulOpposite.{u1} α) (AddMonoidWithOne.toNatCast.{u1} (MulOpposite.{u1} α) (MulOpposite.addMonoidWithOne.{u1} α _inst_1))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} (MulOpposite.{u1} α) (MulOpposite.op.{u1} α (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) n)) (Nat.cast.{u1} (MulOpposite.{u1} α) (AddMonoidWithOne.toNatCast.{u1} (MulOpposite.{u1} α) (MulOpposite.instAddMonoidWithOneMulOpposite.{u1} α _inst_1)) n)
-Case conversion may be inaccurate. Consider using '#align mul_opposite.op_nat_cast MulOpposite.op_natCastₓ'. -/
-@[simp, norm_cast]
-theorem op_natCast (n : ℕ) : op (n : α) = n :=
- rfl
-#align mul_opposite.op_nat_cast MulOpposite.op_natCast
-
-/- warning: mul_opposite.unop_nat_cast -> MulOpposite.unop_natCast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (MulOpposite.unop.{u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat (MulOpposite.{u1} α) (HasLiftT.mk.{1, succ u1} Nat (MulOpposite.{u1} α) (CoeTCₓ.coe.{1, succ u1} Nat (MulOpposite.{u1} α) (Nat.castCoe.{u1} (MulOpposite.{u1} α) (AddMonoidWithOne.toNatCast.{u1} (MulOpposite.{u1} α) (MulOpposite.addMonoidWithOne.{u1} α _inst_1))))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (MulOpposite.unop.{u1} α (Nat.cast.{u1} (MulOpposite.{u1} α) (AddMonoidWithOne.toNatCast.{u1} (MulOpposite.{u1} α) (MulOpposite.instAddMonoidWithOneMulOpposite.{u1} α _inst_1)) n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) n)
-Case conversion may be inaccurate. Consider using '#align mul_opposite.unop_nat_cast MulOpposite.unop_natCastₓ'. -/
-@[simp, norm_cast]
-theorem unop_natCast (n : ℕ) : unop (n : αᵐᵒᵖ) = n :=
- rfl
-#align mul_opposite.unop_nat_cast MulOpposite.unop_natCast
-
-end MulOpposite
-
namespace Pi
variable {π : α → Type _} [∀ a, NatCast (π a)]
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -50,7 +50,7 @@ def castAddMonoidHom (α : Type _) [AddMonoidWithOne α] : ℕ →+ α
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α], Eq.{succ u1} ((fun (_x : AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) => Nat -> α) (Nat.castAddMonoidHom.{u1} α _inst_1)) (coeFn.{succ u1, succ u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (fun (_x : AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) => Nat -> α) (AddMonoidHom.hasCoeToFun.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (Nat.castAddMonoidHom.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => α) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat α (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))))) (Nat.castAddMonoidHom.{u1} α _inst_1)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1))
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => α) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat α (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat α (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))))) (Nat.castAddMonoidHom.{u1} α _inst_1)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1))
Case conversion may be inaccurate. Consider using '#align nat.coe_cast_add_monoid_hom Nat.coe_castAddMonoidHomₓ'. -/
@[simp]
theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ → α) = coe :=
@@ -82,7 +82,7 @@ def castRingHom (α : Type _) [NonAssocSemiring α] : ℕ →+* α :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} ((fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (Nat.castRingHom.{u1} α _inst_1)) (coeFn.{succ u1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (RingHom.hasCoeToFun.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (Nat.castRingHom.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => α) _x) (MulHomClass.toFunLike.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonUnitalNonAssocSemiring.toMul.{0} Nat (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (NonUnitalRingHomClass.toMulHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1) (RingHomClass.toNonUnitalRingHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1 (RingHom.instRingHomClassRingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1)))) (Nat.castRingHom.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1))
+ forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => α) _x) (MulHomClass.toFunLike.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonUnitalNonAssocSemiring.toMul.{0} Nat (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (NonUnitalRingHomClass.toMulHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1) (RingHomClass.toNonUnitalRingHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1 (RingHom.instRingHomClassRingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1)))) (Nat.castRingHom.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1))
Case conversion may be inaccurate. Consider using '#align nat.coe_cast_ring_hom Nat.coe_castRingHomₓ'. -/
@[simp]
theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) = coe :=
@@ -230,7 +230,7 @@ end OrderedSemiring
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))))) (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommMonoid.toPartialOrder.{u1} α (OrderedSemiring.toOrderedAddCommMonoid.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))] (m : Nat) (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))))) n))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.921 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923 : α) => HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.921 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923) (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.936 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938 : α) => LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.936 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938)] (m : Nat) (n : Nat), Eq.{succ u1} α (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) m) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) n))
+ forall {α : Type.{u1}} [_inst_1 : CanonicallyOrderedCommSemiring.{u1} α] [_inst_2 : Sub.{u1} α] [_inst_3 : OrderedSub.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))))) _inst_2] [_inst_4 : ContravariantClass.{u1, u1} α α (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.925 : α) => HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (OrderedSemiring.toSemiring.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1)))))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.923 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.925) (fun (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938 : α) (x._@.Mathlib.Data.Nat.Cast.Basic._hyg.940 : α) => LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedSemiring.toPartialOrder.{u1} α (OrderedCommSemiring.toOrderedSemiring.{u1} α (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} α _inst_1))))) x._@.Mathlib.Data.Nat.Cast.Basic._hyg.938 x._@.Mathlib.Data.Nat.Cast.Basic._hyg.940)] (m : Nat) (n : Nat), Eq.{succ u1} α (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α _inst_2) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) m) (Nat.cast.{u1} α (CanonicallyOrderedCommSemiring.toNatCast.{u1} α _inst_1) n))
Case conversion may be inaccurate. Consider using '#align nat.cast_tsub Nat.cast_tsubₓ'. -/
/-- A version of `nat.cast_sub` that works for `ℝ≥0` and `ℚ≥0`. Note that this proof doesn't work
for `ℕ∞` and `ℝ≥0∞`, so we use type-specific lemmas for these types. -/
@@ -297,7 +297,7 @@ variable {A B F : Type _} [AddMonoidWithOne B]
lean 3 declaration is
forall {A : Type.{u1}} {F : Type.{u2}} [_inst_2 : AddMonoid.{u1} A] [_inst_3 : AddMonoidHomClass.{u2, 0, u1} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)] (f : F) (g : F), (Eq.{succ u1} A (coeFn.{succ u2, succ u1} F (fun (_x : F) => Nat -> A) (FunLike.hasCoeToFun.{succ u2, 1, succ u1} F Nat (fun (_x : Nat) => A) (AddHomClass.toFunLike.{u2, 0, u1} F Nat A (AddZeroClass.toHasAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toHasAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u2, 0, u1} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) _inst_3))) f (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (coeFn.{succ u2, succ u1} F (fun (_x : F) => Nat -> A) (FunLike.hasCoeToFun.{succ u2, 1, succ u1} F Nat (fun (_x : Nat) => A) (AddHomClass.toFunLike.{u2, 0, u1} F Nat A (AddZeroClass.toHasAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toHasAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u2, 0, u1} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) _inst_3))) g (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) -> (Eq.{succ u2} F f g)
but is expected to have type
- forall {A : Type.{u2}} {F : Type.{u1}} [_inst_2 : AddMonoid.{u2} A] [_inst_3 : AddMonoidHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2)] (f : F) (g : F), (Eq.{succ u2} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => A) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u2} F Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u2} F Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u2} A (AddMonoid.toAddZeroClass.{u2} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2) _inst_3)) f (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u2} F Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u2} F Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u2} A (AddMonoid.toAddZeroClass.{u2} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2) _inst_3)) g (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) -> (Eq.{succ u1} F f g)
+ forall {A : Type.{u2}} {F : Type.{u1}} [_inst_2 : AddMonoid.{u2} A] [_inst_3 : AddMonoidHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2)] (f : F) (g : F), (Eq.{succ u2} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u2} F Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u2} F Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u2} A (AddMonoid.toAddZeroClass.{u2} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2) _inst_3)) f (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u2} F Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u2} F Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u2} A (AddMonoid.toAddZeroClass.{u2} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u2} F Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u2} A _inst_2) _inst_3)) g (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) -> (Eq.{succ u1} F f g)
Case conversion may be inaccurate. Consider using '#align ext_nat' ext_nat'ₓ'. -/
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
FunLike.ext f g <| by
@@ -310,7 +310,7 @@ theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 =
lean 3 declaration is
forall {A : Type.{u1}} [_inst_2 : AddMonoid.{u1} A] {f : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)} {g : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)}, (Eq.{succ u1} A (coeFn.{succ u1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (fun (_x : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) => Nat -> A) (AddMonoidHom.hasCoeToFun.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) f (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (coeFn.{succ u1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (fun (_x : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) => Nat -> A) (AddMonoidHom.hasCoeToFun.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) g (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) -> (Eq.{succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) f g)
but is expected to have type
- forall {A : Type.{u1}} [_inst_2 : AddMonoid.{u1} A] {f : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)} {g : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)}, (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => A) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)))) f (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.398 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)))) g (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) -> (Eq.{succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) f g)
+ forall {A : Type.{u1}} [_inst_2 : AddMonoid.{u1} A] {f : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)} {g : AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)}, (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)))) f (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (FunLike.coe.{succ u1, 1, succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Nat) => A) _x) (AddHomClass.toFunLike.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddZeroClass.toAdd.{0} Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddZeroClass.toAdd.{u1} A (AddMonoid.toAddZeroClass.{u1} A _inst_2)) (AddMonoidHomClass.toAddHomClass.{u1, 0, u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2) (AddMonoidHom.addMonoidHomClass.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)))) g (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) -> (Eq.{succ u1} (AddMonoidHom.{0, u1} Nat A (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid) (AddMonoid.toAddZeroClass.{u1} A _inst_2)) f g)
Case conversion may be inaccurate. Consider using '#align add_monoid_hom.ext_nat AddMonoidHom.ext_natₓ'. -/
@[ext]
theorem AddMonoidHom.ext_nat [AddMonoid A] : ∀ {f g : ℕ →+ A}, ∀ h : f 1 = g 1, f = g :=
@@ -357,7 +357,7 @@ theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n :
lean 3 declaration is
forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) n) -> (Eq.{succ u1} A (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f n) (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
but is expected to have type
- forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n) -> (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => A) n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) f n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
+ forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n) -> (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => A) n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) f n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.ext_nat MonoidWithZeroHom.ext_natₓ'. -/
@[ext]
theorem MonoidWithZeroHom.ext_nat : ∀ {f g : ℕ →*₀ A}, (∀ {n : ℕ}, 0 < n → f n = g n) → f = g :=
@@ -381,7 +381,7 @@ theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u2} S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n)
but is expected to have type
- forall {R : Type.{u2}} {S : Type.{u1}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u2} R] [_inst_2 : NonAssocSemiring.{u1} S] [_inst_3 : RingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (FunLike.coe.{succ u3, succ u2, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{u3, u2, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u3, u2, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2 _inst_3))) f (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (Nat.cast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (NonAssocSemiring.toNatCast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) _inst_2) n)
+ forall {R : Type.{u2}} {S : Type.{u1}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u2} R] [_inst_2 : NonAssocSemiring.{u1} S] [_inst_3 : RingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (FunLike.coe.{succ u3, succ u2, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{u3, u2, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u3, u2, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2 _inst_3))) f (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (Nat.cast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (NonAssocSemiring.toNatCast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) _inst_2) n)
Case conversion may be inaccurate. Consider using '#align map_nat_cast map_natCastₓ'. -/
@[simp]
theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
@@ -398,7 +398,7 @@ theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] {n : Nat} [h : NeZero.{u1} R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u1, succ u2} R S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f)) -> (NeZero.{u2} S (MulZeroClass.toHasZero.{u2} S (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n))
but is expected to have type
- forall {R : Type.{u3}} {S : Type.{u1}} {F : Type.{u2}} [_inst_1 : NonAssocSemiring.{u3} R] [_inst_2 : NonAssocSemiring.{u1} S] {n : Nat} [h : NeZero.{u3} R (MulZeroOneClass.toZero.{u3} R (NonAssocSemiring.toMulZeroOneClass.{u3} R _inst_1)) (Nat.cast.{u3} R (NonAssocSemiring.toNatCast.{u3} R _inst_1) n)] [_inst_3 : RingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u3, succ u1} R S (FunLike.coe.{succ u2, succ u3, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{u2, u3, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u3} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u2, u3, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2 _inst_3))) f)) -> (NeZero.{u1} S (MulZeroOneClass.toZero.{u1} S (NonAssocSemiring.toMulZeroOneClass.{u1} S _inst_2)) (Nat.cast.{u1} S (NonAssocSemiring.toNatCast.{u1} S _inst_2) n))
+ forall {R : Type.{u3}} {S : Type.{u1}} {F : Type.{u2}} [_inst_1 : NonAssocSemiring.{u3} R] [_inst_2 : NonAssocSemiring.{u1} S] {n : Nat} [h : NeZero.{u3} R (MulZeroOneClass.toZero.{u3} R (NonAssocSemiring.toMulZeroOneClass.{u3} R _inst_1)) (Nat.cast.{u3} R (NonAssocSemiring.toNatCast.{u3} R _inst_1) n)] [_inst_3 : RingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u3, succ u1} R S (FunLike.coe.{succ u2, succ u3, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{u2, u3, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u3} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u2, u3, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2 _inst_3))) f)) -> (NeZero.{u1} S (MulZeroOneClass.toZero.{u1} S (NonAssocSemiring.toMulZeroOneClass.{u1} S _inst_2)) (Nat.cast.{u1} S (NonAssocSemiring.toNatCast.{u1} S _inst_2) n))
Case conversion may be inaccurate. Consider using '#align ne_zero.nat_of_injective NeZero.nat_of_injectiveₓ'. -/
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
@@ -511,7 +511,7 @@ end Pi
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : NatCast.{u3} γ] (n : Nat), Eq.{max (max (succ u1) (succ u2)) (succ u3)} ((Sum.{u1, u2} α β) -> γ) (Sum.elim.{u1, u2, succ u3} α β γ ((fun (a : Type) (b : Sort.{max (succ u1) (succ u3)}) [self : HasLiftT.{1, max (succ u1) (succ u3)} a b] => self.0) Nat (α -> γ) (HasLiftT.mk.{1, max (succ u1) (succ u3)} Nat (α -> γ) (CoeTCₓ.coe.{1, max (succ u1) (succ u3)} Nat (α -> γ) (Nat.castCoe.{max u1 u3} (α -> γ) (Pi.hasNatCast.{u1, u3} α (fun (ᾰ : α) => γ) (fun (a : α) => _inst_1))))) n) ((fun (a : Type) (b : Sort.{max (succ u2) (succ u3)}) [self : HasLiftT.{1, max (succ u2) (succ u3)} a b] => self.0) Nat (β -> γ) (HasLiftT.mk.{1, max (succ u2) (succ u3)} Nat (β -> γ) (CoeTCₓ.coe.{1, max (succ u2) (succ u3)} Nat (β -> γ) (Nat.castCoe.{max u2 u3} (β -> γ) (Pi.hasNatCast.{u2, u3} β (fun (ᾰ : β) => γ) (fun (a : β) => _inst_1))))) n)) ((fun (a : Type) (b : Sort.{max (max (succ u1) (succ u2)) (succ u3)}) [self : HasLiftT.{1, max (max (succ u1) (succ u2)) (succ u3)} a b] => self.0) Nat ((Sum.{u1, u2} α β) -> γ) (HasLiftT.mk.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (CoeTCₓ.coe.{1, max (max (succ u1) (succ u2)) (succ u3)} Nat ((Sum.{u1, u2} α β) -> γ) (Nat.castCoe.{max (max u1 u2) u3} ((Sum.{u1, u2} α β) -> γ) (Pi.hasNatCast.{max u1 u2, u3} (Sum.{u1, u2} α β) (fun (ᾰ : Sum.{u1, u2} α β) => γ) (fun (a : Sum.{u1, u2} α β) => _inst_1))))) n)
but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2257 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2263 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
+ forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_1 : NatCast.{u1} γ] (n : Nat), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((Sum.{u3, u2} α β) -> γ) (Sum.elim.{u3, u2, succ u1} α β γ (Nat.cast.{max u3 u1} (α -> γ) (Pi.natCast.{u3, u1} α (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2276 : α) => γ) (fun (a : α) => _inst_1)) n) (Nat.cast.{max u2 u1} (β -> γ) (Pi.natCast.{u2, u1} β (fun (a._@.Mathlib.Data.Nat.Cast.Basic._hyg.2283 : β) => γ) (fun (a : β) => _inst_1)) n)) (Nat.cast.{max (max u3 u2) u1} ((Sum.{u3, u2} α β) -> γ) (Pi.natCast.{max u3 u2, u1} (Sum.{u3, u2} α β) (fun (a._@.Mathlib.Data.Sum.Basic._hyg.1871 : Sum.{u3, u2} α β) => γ) (fun (a : Sum.{u3, u2} α β) => _inst_1)) n)
Case conversion may be inaccurate. Consider using '#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCastₓ'. -/
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/38f16f960f5006c6c0c2bac7b0aba5273188f4e5
@@ -82,7 +82,7 @@ def castRingHom (α : Type _) [NonAssocSemiring α] : ℕ →+* α :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} ((fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (Nat.castRingHom.{u1} α _inst_1)) (coeFn.{succ u1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (fun (_x : RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) => Nat -> α) (RingHom.hasCoeToFun.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) (Nat.castRingHom.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α _inst_1)))))))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : Nat) => α) _x) (MulHomClass.toFunLike.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonUnitalNonAssocSemiring.toMul.{0} Nat (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (NonUnitalRingHomClass.toMulHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1) (RingHomClass.toNonUnitalRingHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1 (RingHom.instRingHomClassRingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1)))) (Nat.castRingHom.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1))
+ forall {α : Type.{u1}} [_inst_1 : NonAssocSemiring.{u1} α], Eq.{succ u1} (forall (a : Nat), (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => α) a) (FunLike.coe.{succ u1, 1, succ u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => α) _x) (MulHomClass.toFunLike.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonUnitalNonAssocSemiring.toMul.{0} Nat (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1)) (NonUnitalRingHomClass.toMulHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α _inst_1) (RingHomClass.toNonUnitalRingHomClass.{u1, 0, u1} (RingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1) Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1 (RingHom.instRingHomClassRingHom.{0, u1} Nat α (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring) _inst_1)))) (Nat.castRingHom.{u1} α _inst_1)) (Nat.cast.{u1} α (NonAssocSemiring.toNatCast.{u1} α _inst_1))
Case conversion may be inaccurate. Consider using '#align nat.coe_cast_ring_hom Nat.coe_castRingHomₓ'. -/
@[simp]
theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) = coe :=
@@ -357,7 +357,7 @@ theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n :
lean 3 declaration is
forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) n) -> (Eq.{succ u1} A (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f n) (coeFn.{succ u1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) (fun (_x : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) => Nat -> A) (MonoidWithZeroHom.hasCoeToFun.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
but is expected to have type
- forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n) -> (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : Nat) => A) n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) f n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
+ forall {A : Type.{u1}} [_inst_1 : MulZeroOneClass.{u1} A] {f : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1} {g : MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1}, (forall {n : Nat}, (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) n) -> (Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => A) n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) f n) (FunLike.coe.{succ u1, 1, succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat (fun (_x : Nat) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : Nat) => A) _x) (MulHomClass.toFunLike.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulOneClass.toMul.{0} Nat (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)))) (MulOneClass.toMul.{u1} A (MulZeroOneClass.toMulOneClass.{u1} A _inst_1)) (MonoidHomClass.toMulHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (MulZeroOneClass.toMulOneClass.{0} Nat (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring))) (MulZeroOneClass.toMulOneClass.{u1} A _inst_1) (MonoidWithZeroHomClass.toMonoidHomClass.{u1, 0, u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1 (MonoidWithZeroHom.monoidWithZeroHomClass.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1)))) g n))) -> (Eq.{succ u1} (MonoidWithZeroHom.{0, u1} Nat A (NonAssocSemiring.toMulZeroOneClass.{0} Nat (Semiring.toNonAssocSemiring.{0} Nat Nat.semiring)) _inst_1) f g)
Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.ext_nat MonoidWithZeroHom.ext_natₓ'. -/
@[ext]
theorem MonoidWithZeroHom.ext_nat : ∀ {f g : ℕ →*₀ A}, (∀ {n : ℕ}, 0 < n → f n = g n) → f = g :=
@@ -381,7 +381,7 @@ theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u2} S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n)
but is expected to have type
- forall {R : Type.{u2}} {S : Type.{u1}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u2} R] [_inst_2 : NonAssocSemiring.{u1} S] [_inst_3 : RingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (FunLike.coe.{succ u3, succ u2, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) _x) (MulHomClass.toFunLike.{u3, u2, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u3, u2, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2 _inst_3))) f (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (Nat.cast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (NonAssocSemiring.toNatCast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) _inst_2) n)
+ forall {R : Type.{u2}} {S : Type.{u1}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u2} R] [_inst_2 : NonAssocSemiring.{u1} S] [_inst_3 : RingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2] (f : F) (n : Nat), Eq.{succ u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (FunLike.coe.{succ u3, succ u2, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{u3, u2, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u3, u2, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u2, u1} F R S _inst_1 _inst_2 _inst_3))) f (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (Nat.cast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) (NonAssocSemiring.toNatCast.{u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) (Nat.cast.{u2} R (NonAssocSemiring.toNatCast.{u2} R _inst_1) n)) _inst_2) n)
Case conversion may be inaccurate. Consider using '#align map_nat_cast map_natCastₓ'. -/
@[simp]
theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
@@ -398,7 +398,7 @@ theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} {F : Type.{u3}} [_inst_1 : NonAssocSemiring.{u1} R] [_inst_2 : NonAssocSemiring.{u2} S] {n : Nat} [h : NeZero.{u1} R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R _inst_1)))))) n)] [_inst_3 : RingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u1, succ u2} R S (coeFn.{succ u3, max (succ u1) (succ u2)} F (fun (_x : F) => R -> S) (FunLike.hasCoeToFun.{succ u3, succ u1, succ u2} F R (fun (_x : R) => S) (MulHomClass.toFunLike.{u3, u1, u2} F R S (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1))) (Distrib.toHasMul.{u2} S (NonUnitalNonAssocSemiring.toDistrib.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{u3, u1, u2} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u3, u1, u2} F R S _inst_1 _inst_2 _inst_3)))) f)) -> (NeZero.{u2} S (MulZeroClass.toHasZero.{u2} S (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S _inst_2))) ((fun (a : Type) (b : Type.{u2}) [self : HasLiftT.{1, succ u2} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u2} Nat S (CoeTCₓ.coe.{1, succ u2} Nat S (Nat.castCoe.{u2} S (AddMonoidWithOne.toNatCast.{u2} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} S (NonAssocSemiring.toAddCommMonoidWithOne.{u2} S _inst_2)))))) n))
but is expected to have type
- forall {R : Type.{u3}} {S : Type.{u1}} {F : Type.{u2}} [_inst_1 : NonAssocSemiring.{u3} R] [_inst_2 : NonAssocSemiring.{u1} S] {n : Nat} [h : NeZero.{u3} R (MulZeroOneClass.toZero.{u3} R (NonAssocSemiring.toMulZeroOneClass.{u3} R _inst_1)) (Nat.cast.{u3} R (NonAssocSemiring.toNatCast.{u3} R _inst_1) n)] [_inst_3 : RingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u3, succ u1} R S (FunLike.coe.{succ u2, succ u3, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) _x) (MulHomClass.toFunLike.{u2, u3, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u3} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u2, u3, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2 _inst_3))) f)) -> (NeZero.{u1} S (MulZeroOneClass.toZero.{u1} S (NonAssocSemiring.toMulZeroOneClass.{u1} S _inst_2)) (Nat.cast.{u1} S (NonAssocSemiring.toNatCast.{u1} S _inst_2) n))
+ forall {R : Type.{u3}} {S : Type.{u1}} {F : Type.{u2}} [_inst_1 : NonAssocSemiring.{u3} R] [_inst_2 : NonAssocSemiring.{u1} S] {n : Nat} [h : NeZero.{u3} R (MulZeroOneClass.toZero.{u3} R (NonAssocSemiring.toMulZeroOneClass.{u3} R _inst_1)) (Nat.cast.{u3} R (NonAssocSemiring.toNatCast.{u3} R _inst_1) n)] [_inst_3 : RingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2] {f : F}, (Function.Injective.{succ u3, succ u1} R S (FunLike.coe.{succ u2, succ u3, succ u1} F R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{u2, u3, u1} F R S (NonUnitalNonAssocSemiring.toMul.{u3} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1)) (NonUnitalNonAssocSemiring.toMul.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2)) (NonUnitalRingHomClass.toMulHomClass.{u2, u3, u1} F R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} R _inst_1) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S _inst_2) (RingHomClass.toNonUnitalRingHomClass.{u2, u3, u1} F R S _inst_1 _inst_2 _inst_3))) f)) -> (NeZero.{u1} S (MulZeroOneClass.toZero.{u1} S (NonAssocSemiring.toMulZeroOneClass.{u1} S _inst_2)) (Nat.cast.{u1} S (NonAssocSemiring.toNatCast.{u1} S _inst_2) n))
Case conversion may be inaccurate. Consider using '#align ne_zero.nat_of_injective NeZero.nat_of_injectiveₓ'. -/
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/9da1b3534b65d9661eb8f42443598a92bbb49211
@@ -271,7 +271,7 @@ theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : (↑(max a b) : α) =
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (NonAssocRing.toAddGroupWithOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (SemilatticeSup.toHasSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (LinearOrder.toLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (NonAssocRing.toAddGroupWithOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (NonAssocRing.toAddGroupWithOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))))) a)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) (SemilatticeSup.toHasSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1)))))) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] (a : Nat), Eq.{succ u1} α (Abs.abs.{u1} α (Neg.toHasAbs.{u1} α (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) (SemilatticeSup.toSup.{u1} α (Lattice.toSemilatticeSup.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (LinearOrderedRing.toLinearOrder.{u1} α _inst_1)))))) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)) (Nat.cast.{u1} α (NonAssocRing.toNatCast.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) a)
Case conversion may be inaccurate. Consider using '#align nat.abs_cast Nat.abs_castₓ'. -/
@[simp, norm_cast]
theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Int
and Rat
instances (#12235)
Fix a few names and deduplicate the AddCommGroup ℤ
instance
@@ -311,7 +311,7 @@ variable {π : α → Type*} [∀ a, NatCast (π a)]
/- Porting note: manually wrote this instance.
Was `by refine_struct { .. } <;> pi_instance_derive_field` -/
-instance natCast : NatCast (∀ a, π a) := { natCast := fun n _ ↦ n }
+instance instNatCast : NatCast (∀ a, π a) where natCast n _ := n
theorem natCast_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
rfl
@@ -313,14 +313,18 @@ variable {π : α → Type*} [∀ a, NatCast (π a)]
Was `by refine_struct { .. } <;> pi_instance_derive_field` -/
instance natCast : NatCast (∀ a, π a) := { natCast := fun n _ ↦ n }
-theorem nat_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
+theorem natCast_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
rfl
-#align pi.nat_apply Pi.nat_apply
+#align pi.nat_apply Pi.natCast_apply
@[simp]
-theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ ↦ ↑n :=
+theorem natCast_def (n : ℕ) : (n : ∀ a, π a) = fun _ ↦ ↑n :=
rfl
-#align pi.coe_nat Pi.coe_nat
+#align pi.coe_nat Pi.natCast_def
+
+-- 2024-04-05
+@[deprecated] alias nat_apply := natCast_apply
+@[deprecated] alias coe_nat := natCast_def
@[simp]
theorem ofNat_apply (n : ℕ) [n.AtLeastTwo] (a : α) : (OfNat.ofNat n : ∀ a, π a) a = n := rfl
Data.{Nat,Int}{.Order}.Basic
in group vs ring instances (#11924)
Scatter the content of Data.Nat.Basic
across:
Data.Nat.Defs
for the lemmas having no dependenciesAlgebra.Group.Nat
for the monoid instances and the few miscellaneous lemmas needing them.Algebra.Ring.Nat
for the semiring instance and the few miscellaneous lemmas following it.Similarly, scatter
Data.Int.Basic
across Data.Int.Defs
, Algebra.Group.Int
, Algebra.Ring.Int
Data.Nat.Order.Basic
across Data.Nat.Defs
, Algebra.Order.Group.Nat
, Algebra.Order.Ring.Nat
Data.Int.Order.Basic
across Data.Int.Defs
, Algebra.Order.Group.Int
, Algebra.Order.Ring.Int
Also move a few lemmas from Data.Nat.Order.Lemmas
to Data.Nat.Defs
.
Before
After
@@ -7,7 +7,7 @@ import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Algebra.CharZero.Defs
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Data.Nat.Cast.NeZero
-import Mathlib.Data.Nat.Order.Basic
+import Mathlib.Algebra.Order.Ring.Nat
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
Data.{Nat,Int}{.Order}.Basic
in group vs ring instances (#11924)
Scatter the content of Data.Nat.Basic
across:
Data.Nat.Defs
for the lemmas having no dependenciesAlgebra.Group.Nat
for the monoid instances and the few miscellaneous lemmas needing them.Algebra.Ring.Nat
for the semiring instance and the few miscellaneous lemmas following it.Similarly, scatter
Data.Int.Basic
across Data.Int.Defs
, Algebra.Group.Int
, Algebra.Ring.Int
Data.Nat.Order.Basic
across Data.Nat.Defs
, Algebra.Order.Group.Nat
, Algebra.Order.Ring.Nat
Data.Int.Order.Basic
across Data.Int.Defs
, Algebra.Order.Group.Int
, Algebra.Order.Ring.Int
Also move a few lemmas from Data.Nat.Order.Lemmas
to Data.Nat.Defs
.
Before
After
@@ -7,7 +7,7 @@ import Mathlib.Algebra.Divisibility.Basic
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Algebra.Group.TypeTags
import Mathlib.Algebra.Ring.Hom.Defs
-import Mathlib.Data.Nat.Basic
+import Mathlib.Algebra.Ring.Nat
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
coe_nat
to natCast
(#11637)
Reduce the diff of #11499
All in the Int
namespace:
ofNat_eq_cast
→ ofNat_eq_natCast
cast_eq_cast_iff_Nat
→ natCast_inj
natCast_eq_ofNat
→ ofNat_eq_natCast
coe_nat_sub
→ natCast_sub
coe_nat_nonneg
→ natCast_nonneg
sign_coe_add_one
→ sign_natCast_add_one
nat_succ_eq_int_succ
→ natCast_succ
succ_neg_nat_succ
→ succ_neg_natCast_succ
coe_pred_of_pos
→ natCast_pred_of_pos
coe_nat_div
→ natCast_div
coe_nat_ediv
→ natCast_ediv
sign_coe_nat_of_nonzero
→ sign_natCast_of_ne_zero
toNat_coe_nat
→ toNat_natCast
toNat_coe_nat_add_one
→ toNat_natCast_add_one
coe_nat_dvd
→ natCast_dvd_natCast
coe_nat_dvd_left
→ natCast_dvd
coe_nat_dvd_right
→ dvd_natCast
le_coe_nat_sub
→ le_natCast_sub
succ_coe_nat_pos
→ succ_natCast_pos
coe_nat_modEq_iff
→ natCast_modEq_iff
coe_natAbs
→ natCast_natAbs
coe_nat_eq_zero
→ natCast_eq_zero
coe_nat_ne_zero
→ natCast_ne_zero
coe_nat_ne_zero_iff_pos
→ natCast_ne_zero_iff_pos
abs_coe_nat
→ abs_natCast
coe_nat_nonpos_iff
→ natCast_nonpos_iff
Also rename Nat.coe_nat_dvd
to Nat.cast_dvd_cast
@@ -85,10 +85,10 @@ lemma cast_pow (m : ℕ) : ∀ n : ℕ, ↑(m ^ n) = (m ^ n : α)
| n + 1 => by rw [_root_.pow_succ', _root_.pow_succ', cast_mul, cast_pow m n]
#align nat.cast_pow Nat.cast_pow
-lemma coe_nat_dvd (h : m ∣ n) : (m : α) ∣ (n : α) := map_dvd (Nat.castRingHom α) h
-#align nat.coe_nat_dvd Nat.coe_nat_dvd
+lemma cast_dvd_cast (h : m ∣ n) : (m : α) ∣ (n : α) := map_dvd (Nat.castRingHom α) h
+#align nat.coe_nat_dvd Nat.cast_dvd_cast
-alias _root_.Dvd.dvd.natCast := coe_nat_dvd
+alias _root_.Dvd.dvd.natCast := cast_dvd_cast
end Semiring
end Nat
We change the following field in the definition of an additive commutative monoid:
nsmul_succ : ∀ (n : ℕ) (x : G),
- AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+ AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
where the latter is more natural
We adjust the definitions of ^
in monoids, groups, etc.
Originally there was a warning comment about why this natural order was preferred
use
x * npowRec n x
and notnpowRec n x * x
in the definition to make sure that definitional unfolding ofnpowRec
is blocked, to avoid deep recursion issues.
but it seems to no longer apply.
Remarks on the PR :
pow_succ
and pow_succ'
have switched their meanings.Ideal.IsPrime.mul_mem_pow
which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul
.@@ -65,13 +65,13 @@ def castRingHom : ℕ →+* α :=
lemma _root_.nsmul_eq_mul' (a : α) (n : ℕ) : n • a = a * n := by
induction n with
| zero => rw [zero_nsmul, Nat.cast_zero, mul_zero]
- | succ n ih => rw [succ_nsmul', ih, Nat.cast_succ, mul_add, mul_one]
+ | succ n ih => rw [succ_nsmul, ih, Nat.cast_succ, mul_add, mul_one]
#align nsmul_eq_mul' nsmul_eq_mul'
@[simp] lemma _root_.nsmul_eq_mul (n : ℕ) (a : α) : n • a = n * a := by
induction n with
| zero => rw [zero_nsmul, Nat.cast_zero, zero_mul]
- | succ n ih => rw [succ_nsmul', ih, Nat.cast_succ, add_mul, one_mul]
+ | succ n ih => rw [succ_nsmul, ih, Nat.cast_succ, add_mul, one_mul]
#align nsmul_eq_mul nsmul_eq_mul
end NonAssocSemiring
@@ -175,7 +175,7 @@ theorem map_natCast [FunLike F R S] [RingHomClass F R S] (f : F) : ∀ n : ℕ,
map_natCast' f <| map_one f
#align map_nat_cast map_natCast
--- Porting note: new theorem
+-- Porting note (#10756): new theorem
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem map_ofNat [FunLike F R S] [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -175,7 +175,7 @@ theorem map_natCast [FunLike F R S] [RingHomClass F R S] (f : F) : ∀ n : ℕ,
map_natCast' f <| map_one f
#align map_nat_cast map_natCast
---Porting note: new theorem
+-- Porting note: new theorem
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem map_ofNat [FunLike F R S] [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
@@ -235,7 +235,7 @@ def multiplesHom : α ≃ (ℕ →+ α) where
/-- Monoid homomorphisms from `Multiplicative ℕ` are defined by the image
of `Multiplicative.ofAdd 1`. -/
-@[to_additive existing multiplesHom]
+@[to_additive existing]
def powersHom : α ≃ (Multiplicative ℕ →* α) :=
Additive.ofMul.trans <| (multiplesHom _).trans <| AddMonoidHom.toMultiplicative''
@@ -246,7 +246,7 @@ variable {α}
lemma multiplesHom_apply (x : α) (n : ℕ) : multiplesHom α x n = n • x := rfl
#align multiples_hom_apply multiplesHom_apply
-@[to_additive existing (attr := simp) multiplesHom_apply]
+@[to_additive existing (attr := simp)]
lemma powersHom_apply (x : α) (n : Multiplicative ℕ) :
powersHom α x n = x ^ Multiplicative.toAdd n := rfl
#align powers_hom_apply powersHom_apply
@@ -254,7 +254,7 @@ lemma powersHom_apply (x : α) (n : Multiplicative ℕ) :
lemma multiplesHom_symm_apply (f : ℕ →+ α) : (multiplesHom α).symm f = f 1 := rfl
#align multiples_hom_symm_apply multiplesHom_symm_apply
-@[to_additive existing (attr := simp) multiplesHom_symm_apply]
+@[to_additive existing (attr := simp)]
lemma powersHom_symm_apply (f : Multiplicative ℕ →* α) :
(powersHom α).symm f = f (Multiplicative.ofAdd 1) := rfl
#align powers_hom_symm_apply powersHom_symm_apply
@@ -136,7 +136,7 @@ theorem map_ofNat' {A} [AddMonoidWithOne A] [FunLike F A B] [AddMonoidHomClass F
{ toFun := fun n ↦ n • (1 : A)
map_zero' := zero_nsmul _
map_add' := add_nsmul _ }
- exact eq_natCast' f $ by simp
+ exact eq_natCast' f $ by simp [f]
#align nsmul_one nsmul_one
end AddMonoidHomClass
I loogled for every occurrence of "cast", Nat
and "natCast"
and where the casted nat was n
, and made sure there were corresponding @[simp]
lemmas for 0
, 1
, and OfNat.ofNat n
. This is necessary in general for simp confluence. Example:
import Mathlib
variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo]
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp only [Nat.cast_le] -- this `@[simp]` lemma can apply
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by
simp only [Nat.cast_ofNat] -- and so can this one
example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue.
As far as I know, the only file this PR leaves with ofNat
gaps is PartENat.lean
. #8002 is addressing that file in parallel.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -45,11 +45,23 @@ theorem toDual_natCast [NatCast α] (n : ℕ) : toDual (n : α) = n :=
rfl
#align to_dual_nat_cast toDual_natCast
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem toDual_ofNat [NatCast α] (n : ℕ) [n.AtLeastTwo] :
+ (toDual (no_index (OfNat.ofNat n : α))) = OfNat.ofNat n :=
+ rfl
+
@[simp]
theorem ofDual_natCast [NatCast α] (n : ℕ) : (ofDual n : α) = n :=
rfl
#align of_dual_nat_cast ofDual_natCast
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem ofDual_ofNat [NatCast α] (n : ℕ) [n.AtLeastTwo] :
+ (ofDual (no_index (OfNat.ofNat n : αᵒᵈ))) = OfNat.ofNat n :=
+ rfl
+
/-! ### Lexicographic order -/
@@ -67,7 +79,18 @@ theorem toLex_natCast [NatCast α] (n : ℕ) : toLex (n : α) = n :=
rfl
#align to_lex_nat_cast toLex_natCast
+@[simp]
+theorem toLex_ofNat [NatCast α] (n : ℕ) [n.AtLeastTwo] :
+ (toLex (no_index (OfNat.ofNat n : α))) = OfNat.ofNat n :=
+ rfl
+
@[simp]
theorem ofLex_natCast [NatCast α] (n : ℕ) : (ofLex n : α) = n :=
rfl
+
+@[simp]
+theorem ofLex_ofNat [NatCast α] (n : ℕ) [n.AtLeastTwo] :
+ (ofLex (no_index (OfNat.ofNat n : Lex α))) = OfNat.ofNat n :=
+ rfl
+
#align of_lex_nat_cast ofLex_natCast
I loogled for every occurrence of "cast", Nat
and "natCast"
and where the casted nat was n
, and made sure there were corresponding @[simp]
lemmas for 0
, 1
, and OfNat.ofNat n
. This is necessary in general for simp confluence. Example:
import Mathlib
variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo]
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp only [Nat.cast_le] -- this `@[simp]` lemma can apply
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by
simp only [Nat.cast_ofNat] -- and so can this one
example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue.
As far as I know, the only file this PR leaves with ofNat
gaps is PartENat.lean
. #8002 is addressing that file in parallel.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -25,7 +25,7 @@ section OrderedSemiring
we use a generic collection of instances so that it applies in other settings (e.g., in a
`StarOrderedRing`, or the `selfAdjoint` or `StarOrderedRing.positive` parts thereof). -/
-variable [AddCommMonoidWithOne α] [PartialOrder α]
+variable [AddMonoidWithOne α] [PartialOrder α]
variable [CovariantClass α α (· + ·) (· ≤ ·)] [ZeroLEOneClass α]
@[mono]
@@ -51,6 +51,18 @@ theorem cast_nonneg {α} [OrderedSemiring α] (n : ℕ) : 0 ≤ (n : α) :=
cast_nonneg' n
#align nat.cast_nonneg Nat.cast_nonneg
+/-- See also `Nat.ofNat_nonneg`, specialised for an `OrderedSemiring`. -/
+-- See note [no_index around OfNat.ofNat]
+@[simp low]
+theorem ofNat_nonneg' (n : ℕ) [n.AtLeastTwo] : 0 ≤ (no_index (OfNat.ofNat n : α)) := cast_nonneg' n
+
+/-- Specialisation of `Nat.ofNat_nonneg'`, which seems to be easier for Lean to use. -/
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem ofNat_nonneg {α} [OrderedSemiring α] (n : ℕ) [n.AtLeastTwo] :
+ 0 ≤ (no_index (OfNat.ofNat n : α)) :=
+ ofNat_nonneg' n
+
@[simp, norm_cast]
theorem cast_min {α} [LinearOrderedSemiring α] {a b : ℕ} : ((min a b : ℕ) : α) = min (a : α) b :=
(@mono_cast α _).map_min
@@ -65,11 +77,13 @@ section Nontrivial
variable [NeZero (1 : α)]
-theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
- zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg'
+theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 := by
+ apply zero_lt_one.trans_le
+ convert (@mono_cast α _).imp (?_ : 1 ≤ n + 1)
+ <;> simp
#align nat.cast_add_one_pos Nat.cast_add_one_pos
-/-- See also `Nat.cast_pos`, a specialisation of this to an `OrderedSemiring`. -/
+/-- See also `Nat.cast_pos`, specialised for an `OrderedSemiring`. -/
@[simp low]
theorem cast_pos' {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
@@ -78,6 +92,19 @@ theorem cast_pos' {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cas
theorem cast_pos {α} [OrderedSemiring α] [Nontrivial α] {n : ℕ} : (0 : α) < n ↔ 0 < n := cast_pos'
#align nat.cast_pos Nat.cast_pos
+/-- See also `Nat.ofNat_pos`, specialised for an `OrderedSemiring`. -/
+-- See note [no_index around OfNat.ofNat]
+@[simp low]
+theorem ofNat_pos' {n : ℕ} [n.AtLeastTwo] : 0 < (no_index (OfNat.ofNat n : α)) :=
+ cast_pos'.mpr (NeZero.pos n)
+
+/-- Specialisation of `Nat.ofNat_pos'`, which seems to be easier for Lean to use. -/
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem ofNat_pos {α} [OrderedSemiring α] [Nontrivial α] {n : ℕ} [n.AtLeastTwo] :
+ 0 < (no_index (OfNat.ofNat n : α)) :=
+ ofNat_pos'
+
end Nontrivial
variable [CharZero α] {m n : ℕ}
@@ -120,6 +147,67 @@ theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le]
#align nat.cast_le_one Nat.cast_le_one
+variable [m.AtLeastTwo] [n.AtLeastTwo]
+
+
+-- TODO: These lemmas need to be `@[simp]` for confluence in the presence of `cast_lt`, `cast_le`,
+-- and `Nat.cast_ofNat`, but their LHSs match literally every inequality, so they're too expensive.
+-- If lean4#2867 is fixed in a performant way, these can be made `@[simp]`.
+
+-- See note [no_index around OfNat.ofNat]
+-- @[simp]
+theorem ofNat_le :
+ (no_index (OfNat.ofNat m : α)) ≤ (no_index (OfNat.ofNat n)) ↔
+ (OfNat.ofNat m : ℕ) ≤ OfNat.ofNat n :=
+ cast_le
+
+-- See note [no_index around OfNat.ofNat]
+-- @[simp]
+theorem ofNat_lt :
+ (no_index (OfNat.ofNat m : α)) < (no_index (OfNat.ofNat n)) ↔
+ (OfNat.ofNat m : ℕ) < OfNat.ofNat n :=
+ cast_lt
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem ofNat_le_cast : (no_index (OfNat.ofNat m : α)) ≤ n ↔ (OfNat.ofNat m : ℕ) ≤ n :=
+ cast_le
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem ofNat_lt_cast : (no_index (OfNat.ofNat m : α)) < n ↔ (OfNat.ofNat m : ℕ) < n :=
+ cast_lt
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem cast_le_ofNat : (m : α) ≤ (no_index (OfNat.ofNat n)) ↔ m ≤ OfNat.ofNat n :=
+ cast_le
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem cast_lt_ofNat : (m : α) < (no_index (OfNat.ofNat n)) ↔ m < OfNat.ofNat n :=
+ cast_lt
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem one_lt_ofNat : 1 < (no_index (OfNat.ofNat n : α)) :=
+ one_lt_cast.mpr AtLeastTwo.one_lt
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem one_le_ofNat : 1 ≤ (no_index (OfNat.ofNat n : α)) :=
+ one_le_cast.mpr NeZero.one_le
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem not_ofNat_le_one : ¬(no_index (OfNat.ofNat n : α)) ≤ 1 :=
+ (cast_le_one.not.trans not_le).mpr AtLeastTwo.one_lt
+
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem not_ofNat_lt_one : ¬(no_index (OfNat.ofNat n : α)) < 1 :=
+ mt le_of_lt not_ofNat_le_one
+
end OrderedSemiring
/-- A version of `Nat.cast_sub` that works for `ℝ≥0` and `ℚ≥0`. Note that this proof doesn't work
@@ -139,6 +227,12 @@ theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
abs_of_nonneg (cast_nonneg a)
#align nat.abs_cast Nat.abs_cast
+-- See note [no_index around OfNat.ofNat]
+@[simp]
+theorem abs_ofNat [LinearOrderedRing α] (n : ℕ) [n.AtLeastTwo] :
+ |(no_index (OfNat.ofNat n : α))| = OfNat.ofNat n :=
+ abs_cast n
+
end Nat
instance [AddMonoidWithOne α] [CharZero α] : Nontrivial α where exists_pair_ne :=
I loogled for every occurrence of "cast", Nat
and "natCast"
and where the casted nat was n
, and made sure there were corresponding @[simp]
lemmas for 0
, 1
, and OfNat.ofNat n
. This is necessary in general for simp confluence. Example:
import Mathlib
variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo]
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp only [Nat.cast_le] -- this `@[simp]` lemma can apply
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by
simp only [Nat.cast_ofNat] -- and so can this one
example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue.
As far as I know, the only file this PR leaves with ofNat
gaps is PartENat.lean
. #8002 is addressing that file in parallel.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -127,6 +127,10 @@ theorem map_natCast' {A} [AddMonoidWithOne A] [FunLike F A B] [AddMonoidHomClass
rw [Nat.cast_add, map_add, Nat.cast_add, map_natCast' f h n, Nat.cast_one, h, Nat.cast_one]
#align map_nat_cast' map_natCast'
+theorem map_ofNat' {A} [AddMonoidWithOne A] [FunLike F A B] [AddMonoidHomClass F A B]
+ (f : F) (h : f 1 = 1) (n : ℕ) [n.AtLeastTwo] : f (OfNat.ofNat n) = OfNat.ofNat n :=
+ map_natCast' f h n
+
@[simp] lemma nsmul_one {A} [AddMonoidWithOne A] : ∀ n : ℕ, n • (1 : A) = n := by
let f : ℕ →+ A :=
{ toFun := fun n ↦ n • (1 : A)
@@ -82,17 +82,17 @@ variable [Semiring α] {a b : α}
variable (a) (m n : ℕ)
--- Porting note: `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_right`
+-- Porting note (#10618): `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_right`
-- @[simp]
lemma self_cast_nat_mul : Commute a (n * a) := (Commute.refl a).cast_nat_mul_right n
#align commute.self_cast_nat_mul Commute.self_cast_nat_mul
--- Porting note: `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_left`
+-- Porting note (#10618): `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_left`
-- @[simp]
lemma cast_nat_mul_self : Commute (n * a) a := (Commute.refl a).cast_nat_mul_left n
#align commute.cast_nat_mul_self Commute.cast_nat_mul_self
--- Porting note: `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_left`,
+-- Porting note (#10618): `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_left`,
-- `Commute.cast_nat_mul_right`
-- @[simp]
lemma self_cast_nat_mul_cast_nat_mul : Commute (m * a) (n * a) :=
@[gcongr]
tags around (#9393)
import Mathlib.Tactic.GCongr.Core
to Algebra/Order/Ring/Lemmas
.@[gcongr]
tags next to the lemmas.See Zulip thread
Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
@@ -34,6 +34,12 @@ theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
#align nat.mono_cast Nat.mono_cast
+@[deprecated mono_cast] -- Since 2024-02-10
+theorem cast_le_cast {a b : ℕ} (h : a ≤ b) : (a : α) ≤ b := mono_cast h
+
+@[gcongr]
+theorem _root_.GCongr.natCast_le_natCast {a b : ℕ} (h : a ≤ b) : (a : α) ≤ b := mono_cast h
+
/-- See also `Nat.cast_nonneg`, specialised for an `OrderedSemiring`. -/
@[simp low]
theorem cast_nonneg' (n : ℕ) : 0 ≤ (n : α) :=
@@ -63,13 +63,15 @@ def castRingHom : ℕ →+* α :=
#align nat.coe_cast_ring_hom Nat.coe_castRingHom
lemma _root_.nsmul_eq_mul' (a : α) (n : ℕ) : n • a = a * n := by
- induction' n with n ih <;> [rw [zero_nsmul, Nat.cast_zero, mul_zero];
- rw [succ_nsmul', ih, Nat.cast_succ, mul_add, mul_one]]
+ induction n with
+ | zero => rw [zero_nsmul, Nat.cast_zero, mul_zero]
+ | succ n ih => rw [succ_nsmul', ih, Nat.cast_succ, mul_add, mul_one]
#align nsmul_eq_mul' nsmul_eq_mul'
@[simp] lemma _root_.nsmul_eq_mul (n : ℕ) (a : α) : n • a = n * a := by
- induction' n with n ih <;> [rw [zero_nsmul, Nat.cast_zero, zero_mul];
- rw [succ_nsmul', ih, Nat.cast_succ, add_mul, one_mul]]
+ induction n with
+ | zero => rw [zero_nsmul, Nat.cast_zero, zero_mul]
+ | succ n ih => rw [succ_nsmul', ih, Nat.cast_succ, add_mul, one_mul]
#align nsmul_eq_mul nsmul_eq_mul
end NonAssocSemiring
@@ -107,7 +107,7 @@ theorem one_le_cast : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le
@[simp, norm_cast]
theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
- rw [← cast_one, cast_lt, lt_succ_iff, ← bot_eq_zero, le_bot_iff]
+ rw [← cast_one, cast_lt, Nat.lt_succ_iff, ← bot_eq_zero, le_bot_iff]
#align nat.cast_lt_one Nat.cast_lt_one
@[simp, norm_cast]
@@ -144,7 +144,7 @@ variable {R S F : Type*} [NonAssocSemiring R] [NonAssocSemiring S] [FunLike F R
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
- ⟨fun h ↦ NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero f] ⟩
+ ⟨fun h ↦ NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero f]⟩
#align ne_zero.nat_of_injective NeZero.nat_of_injective
end RingHomClass
The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun
instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike
is EquivLike
, since that has a custom coe_injective'
field that is easier to implement. All other classes should take FunLike
or EquivLike
as a parameter.
Previously, morphism classes would be Type
-valued and extend FunLike
:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
After this PR, they should be Prop
-valued and take FunLike
as a parameter:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
[FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
(Note that A B
stay marked as outParam
even though they are not purely required to be so due to the FunLike
parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam
is slightly faster.)
Similarly, MyEquivClass
should take EquivLike
as a parameter.
As a result, every mention of [MyHomClass F A B]
should become [FunLike F A B] [MyHomClass F A B]
.
While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul
is more expensive. This is due to suboptimal processing of arguments. For example:
variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)
theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y
example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _
Before this PR, applying map_mul f
gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Since M
and N
are out_param
s, [MulHomClass F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found.
After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Now [FunLike F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found, before trying MulHomClass F M N
which fails. Since the Mul
hierarchy is very big, this can be slow to fail, especially when there is no such Mul
instance.
A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul
to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N]
because MulHomClass
fails or succeeds much faster than the others.
As a consequence, the simpNF
linter is much slower since by design it tries and fails to apply many map_
lemmas. The same issue occurs a few times in existing calls to simp [map_mul]
, where map_mul
is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.
simp
not firing sometimesThis affects map_smulₛₗ
and related definitions. For simp
lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw
can find every argument to map_smulₛₗ
successfully but simp
can't: leanprover/lean4#3701.
Especially in the category theory library, we might sometimes have a type A
which is also accessible as a synonym (Bundled A hA).1
. Instance synthesis doesn't always work if we have f : A →* B
but x * y : (Bundled A hA).1
or vice versa. This seems to be mostly fixed by keeping A B
as outParam
s in MulHomClass F A B
. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1
instead of using the syntax in the discrimination tree.)
The timeouts can be worked around for now by specifying which map_mul
we mean, either as map_mul f
for some explicit f
, or as e.g. MonoidHomClass.map_mul
.
map_smulₛₗ
not firing as simp
lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ
a simp
lemma instead of the generic map_smulₛₗ
. Writing simp [map_smulₛₗ _]
also works.
Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@@ -140,7 +140,7 @@ instance [AddMonoidWithOne α] [CharZero α] : Nontrivial α where exists_pair_n
section RingHomClass
-variable {R S F : Type*} [NonAssocSemiring R] [NonAssocSemiring S]
+variable {R S F : Type*} [NonAssocSemiring R] [NonAssocSemiring S] [FunLike F R S]
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun
instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike
is EquivLike
, since that has a custom coe_injective'
field that is easier to implement. All other classes should take FunLike
or EquivLike
as a parameter.
Previously, morphism classes would be Type
-valued and extend FunLike
:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
After this PR, they should be Prop
-valued and take FunLike
as a parameter:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
[FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
(Note that A B
stay marked as outParam
even though they are not purely required to be so due to the FunLike
parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam
is slightly faster.)
Similarly, MyEquivClass
should take EquivLike
as a parameter.
As a result, every mention of [MyHomClass F A B]
should become [FunLike F A B] [MyHomClass F A B]
.
While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul
is more expensive. This is due to suboptimal processing of arguments. For example:
variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)
theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y
example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _
Before this PR, applying map_mul f
gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Since M
and N
are out_param
s, [MulHomClass F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found.
After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Now [FunLike F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found, before trying MulHomClass F M N
which fails. Since the Mul
hierarchy is very big, this can be slow to fail, especially when there is no such Mul
instance.
A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul
to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N]
because MulHomClass
fails or succeeds much faster than the others.
As a consequence, the simpNF
linter is much slower since by design it tries and fails to apply many map_
lemmas. The same issue occurs a few times in existing calls to simp [map_mul]
, where map_mul
is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.
simp
not firing sometimesThis affects map_smulₛₗ
and related definitions. For simp
lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw
can find every argument to map_smulₛₗ
successfully but simp
can't: leanprover/lean4#3701.
Especially in the category theory library, we might sometimes have a type A
which is also accessible as a synonym (Bundled A hA).1
. Instance synthesis doesn't always work if we have f : A →* B
but x * y : (Bundled A hA).1
or vice versa. This seems to be mostly fixed by keeping A B
as outParam
s in MulHomClass F A B
. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1
instead of using the syntax in the discrimination tree.)
The timeouts can be worked around for now by specifying which map_mul
we mean, either as map_mul f
for some explicit f
, or as e.g. MonoidHomClass.map_mul
.
map_smulₛₗ
not firing as simp
lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ
a simp
lemma instead of the generic map_smulₛₗ
. Writing simp [map_smulₛₗ _]
also works.
Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@@ -93,7 +93,7 @@ end Nat
section AddMonoidHomClass
-variable {A B F : Type*} [AddMonoidWithOne B]
+variable {A B F : Type*} [AddMonoidWithOne B] [FunLike F ℕ A]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
DFunLike.ext f g <| by
@@ -117,7 +117,8 @@ theorem eq_natCast' [AddMonoidHomClass F ℕ A] (f : F) (h1 : f 1 = 1) : ∀ n :
| n + 1 => by rw [map_add, h1, eq_natCast' f h1 n, Nat.cast_add_one]
#align eq_nat_cast' eq_natCast'
-theorem map_natCast' {A} [AddMonoidWithOne A] [AddMonoidHomClass F A B] (f : F) (h : f 1 = 1) :
+theorem map_natCast' {A} [AddMonoidWithOne A] [FunLike F A B] [AddMonoidHomClass F A B]
+ (f : F) (h : f 1 = 1) :
∀ n : ℕ, f n = n
| 0 => by simp [map_zero f]
| n + 1 => by
@@ -136,7 +137,7 @@ end AddMonoidHomClass
section MonoidWithZeroHomClass
-variable {A F : Type*} [MulZeroOneClass A]
+variable {A F : Type*} [MulZeroOneClass A] [FunLike F ℕ A]
/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
@@ -159,27 +160,28 @@ section RingHomClass
variable {R S F : Type*} [NonAssocSemiring R] [NonAssocSemiring S]
@[simp]
-theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
+theorem eq_natCast [FunLike F ℕ R] [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
eq_natCast' f <| map_one f
#align eq_nat_cast eq_natCast
@[simp]
-theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
+theorem map_natCast [FunLike F R S] [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
map_natCast' f <| map_one f
#align map_nat_cast map_natCast
--Porting note: new theorem
-- See note [no_index around OfNat.ofNat]
@[simp]
-theorem map_ofNat [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
+theorem map_ofNat [FunLike F R S] [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
(f (no_index (OfNat.ofNat n)) : S) = OfNat.ofNat n :=
map_natCast f n
-theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
+theorem ext_nat [FunLike F ℕ R] [RingHomClass F ℕ R] (f g : F) : f = g :=
ext_nat' f g <| by simp only [map_one f, map_one g]
#align ext_nat ext_nat
-theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
+theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S]
+ {F} [FunLike F R S] [RingHomClass F R S] (f : F)
{n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) :=
.of_map (f := f) (neZero := by simp only [map_natCast, hn])
#align ne_zero.nat_of_ne_zero NeZero.nat_of_neZero
@@ -3,7 +3,7 @@ Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathlib.Data.Nat.Cast.Basic
+import Mathlib.Data.Nat.Cast.Defs
import Mathlib.Order.Synonym
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -3,7 +3,6 @@ Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Algebra.GroupWithZero.Commute
import Mathlib.Algebra.Ring.Commute
FunLike
to DFunLike
(#9785)
This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.
This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:
sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@@ -96,7 +96,7 @@ section AddMonoidHomClass
variable {A B F : Type*} [AddMonoidWithOne B]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
- FunLike.ext f g <| by
+ DFunLike.ext f g <| by
intro n
induction n with
| zero => simp_rw [Nat.zero_eq, map_zero f, map_zero g]
@@ -141,7 +141,7 @@ variable {A F : Type*} [MulZeroOneClass A]
/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
f = g := by
- apply FunLike.ext
+ apply DFunLike.ext
rintro (_ | n)
· simp [map_zero f, map_zero g]
· exact h_pos n.succ_pos
@@ -43,3 +43,61 @@ theorem _root_.Commute.ofNat_right (x : α) (n : ℕ) [n.AtLeastTwo] : Commute x
n.commute_cast x
end Commute
+end Nat
+
+namespace SemiconjBy
+variable [Semiring α] {a x y : α}
+
+@[simp]
+lemma cast_nat_mul_right (h : SemiconjBy a x y) (n : ℕ) : SemiconjBy a (n * x) (n * y) :=
+ SemiconjBy.mul_right (Nat.commute_cast _ _) h
+#align semiconj_by.cast_nat_mul_right SemiconjBy.cast_nat_mul_right
+
+@[simp]
+lemma cast_nat_mul_left (h : SemiconjBy a x y) (n : ℕ) : SemiconjBy (n * a) x y :=
+ SemiconjBy.mul_left (Nat.cast_commute _ _) h
+#align semiconj_by.cast_nat_mul_left SemiconjBy.cast_nat_mul_left
+
+@[simp]
+lemma cast_nat_mul_cast_nat_mul (h : SemiconjBy a x y) (m n : ℕ) :
+ SemiconjBy (m * a) (n * x) (n * y) :=
+ (h.cast_nat_mul_left m).cast_nat_mul_right n
+#align semiconj_by.cast_nat_mul_cast_nat_mul SemiconjBy.cast_nat_mul_cast_nat_mul
+
+end SemiconjBy
+
+namespace Commute
+variable [Semiring α] {a b : α}
+
+@[simp] lemma cast_nat_mul_right (h : Commute a b) (n : ℕ) : Commute a (n * b) :=
+ SemiconjBy.cast_nat_mul_right h n
+#align commute.cast_nat_mul_right Commute.cast_nat_mul_right
+
+@[simp] lemma cast_nat_mul_left (h : Commute a b) (n : ℕ) : Commute (n * a) b :=
+ SemiconjBy.cast_nat_mul_left h n
+#align commute.cast_nat_mul_left Commute.cast_nat_mul_left
+
+@[simp] lemma cast_nat_mul_cast_nat_mul (h : Commute a b) (m n : ℕ) : Commute (m * a) (n * b) :=
+ SemiconjBy.cast_nat_mul_cast_nat_mul h m n
+#align commute.cast_nat_mul_cast_nat_mul Commute.cast_nat_mul_cast_nat_mul
+
+variable (a) (m n : ℕ)
+
+-- Porting note: `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_right`
+-- @[simp]
+lemma self_cast_nat_mul : Commute a (n * a) := (Commute.refl a).cast_nat_mul_right n
+#align commute.self_cast_nat_mul Commute.self_cast_nat_mul
+
+-- Porting note: `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_left`
+-- @[simp]
+lemma cast_nat_mul_self : Commute (n * a) a := (Commute.refl a).cast_nat_mul_left n
+#align commute.cast_nat_mul_self Commute.cast_nat_mul_self
+
+-- Porting note: `simp` can prove this using `Commute.refl`, `Commute.cast_nat_mul_left`,
+-- `Commute.cast_nat_mul_right`
+-- @[simp]
+lemma self_cast_nat_mul_cast_nat_mul : Commute (m * a) (n * a) :=
+ (Commute.refl a).cast_nat_mul_cast_nat_mul m n
+#align commute.self_cast_nat_mul_cast_nat_mul Commute.self_cast_nat_mul_cast_nat_mul
+
+end Commute
@@ -4,7 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Algebra.Divisibility.Basic
-import Mathlib.Algebra.Group.Hom.Basic
+import Mathlib.Algebra.Group.Equiv.Basic
+import Mathlib.Algebra.Group.TypeTags
import Mathlib.Algebra.Ring.Hom.Defs
import Mathlib.Data.Nat.Basic
@@ -26,6 +27,8 @@ the natural numbers into an additive monoid with a one (`Nat.cast`).
-- where `simp [map_zero]` should suffice. (Similarly for `map_one`.)
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20regression.20with.20MonoidHomClass
+open Additive Multiplicative
+
variable {α β : Type*}
namespace Nat
@@ -43,29 +46,49 @@ theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ
rfl
#align nat.coe_cast_add_monoid_hom Nat.coe_castAddMonoidHom
-@[simp, norm_cast]
-theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
+section NonAssocSemiring
+variable [NonAssocSemiring α]
+
+@[simp, norm_cast] lemma cast_mul (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
induction n <;> simp [mul_succ, mul_add, *]
#align nat.cast_mul Nat.cast_mul
+variable (α) in
/-- `Nat.cast : ℕ → α` as a `RingHom` -/
-def castRingHom (α : Type*) [NonAssocSemiring α] : ℕ →+* α :=
+def castRingHom : ℕ →+* α :=
{ castAddMonoidHom α with toFun := Nat.cast, map_one' := cast_one, map_mul' := cast_mul }
#align nat.cast_ring_hom Nat.castRingHom
-@[simp]
-theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) = Nat.cast :=
- rfl
+@[simp, norm_cast] lemma coe_castRingHom : (castRingHom α : ℕ → α) = Nat.cast := rfl
#align nat.coe_cast_ring_hom Nat.coe_castRingHom
+lemma _root_.nsmul_eq_mul' (a : α) (n : ℕ) : n • a = a * n := by
+ induction' n with n ih <;> [rw [zero_nsmul, Nat.cast_zero, mul_zero];
+ rw [succ_nsmul', ih, Nat.cast_succ, mul_add, mul_one]]
+#align nsmul_eq_mul' nsmul_eq_mul'
+@[simp] lemma _root_.nsmul_eq_mul (n : ℕ) (a : α) : n • a = n * a := by
+ induction' n with n ih <;> [rw [zero_nsmul, Nat.cast_zero, zero_mul];
+ rw [succ_nsmul', ih, Nat.cast_succ, add_mul, one_mul]]
+#align nsmul_eq_mul nsmul_eq_mul
+
+end NonAssocSemiring
+
+section Semiring
+variable [Semiring α] {m n : ℕ}
+
+@[simp, norm_cast]
+lemma cast_pow (m : ℕ) : ∀ n : ℕ, ↑(m ^ n) = (m ^ n : α)
+ | 0 => by simp
+ | n + 1 => by rw [_root_.pow_succ', _root_.pow_succ', cast_mul, cast_pow m n]
+#align nat.cast_pow Nat.cast_pow
-theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
- map_dvd (Nat.castRingHom α) h
+lemma coe_nat_dvd (h : m ∣ n) : (m : α) ∣ (n : α) := map_dvd (Nat.castRingHom α) h
#align nat.coe_nat_dvd Nat.coe_nat_dvd
alias _root_.Dvd.dvd.natCast := coe_nat_dvd
+end Semiring
end Nat
section AddMonoidHomClass
@@ -101,6 +124,14 @@ theorem map_natCast' {A} [AddMonoidWithOne A] [AddMonoidHomClass F A B] (f : F)
rw [Nat.cast_add, map_add, Nat.cast_add, map_natCast' f h n, Nat.cast_one, h, Nat.cast_one]
#align map_nat_cast' map_natCast'
+@[simp] lemma nsmul_one {A} [AddMonoidWithOne A] : ∀ n : ℕ, n • (1 : A) = n := by
+ let f : ℕ →+ A :=
+ { toFun := fun n ↦ n • (1 : A)
+ map_zero' := zero_nsmul _
+ map_add' := add_nsmul _ }
+ exact eq_natCast' f $ by simp
+#align nsmul_one nsmul_one
+
end AddMonoidHomClass
section MonoidWithZeroHomClass
@@ -180,6 +211,92 @@ instance Nat.uniqueRingHom {R : Type*} [NonAssocSemiring R] : Unique (ℕ →+*
default := Nat.castRingHom R
uniq := RingHom.eq_natCast'
+section Monoid
+variable (α) [Monoid α] [AddMonoid α]
+
+/-- Additive homomorphisms from `ℕ` are defined by the image of `1`. -/
+def multiplesHom : α ≃ (ℕ →+ α) where
+ toFun x :=
+ { toFun := fun n ↦ n • x
+ map_zero' := zero_nsmul x
+ map_add' := fun _ _ ↦ add_nsmul _ _ _ }
+ invFun f := f 1
+ left_inv := one_nsmul
+ right_inv f := AddMonoidHom.ext_nat <| one_nsmul (f 1)
+#align multiples_hom multiplesHom
+
+/-- Monoid homomorphisms from `Multiplicative ℕ` are defined by the image
+of `Multiplicative.ofAdd 1`. -/
+@[to_additive existing multiplesHom]
+def powersHom : α ≃ (Multiplicative ℕ →* α) :=
+ Additive.ofMul.trans <| (multiplesHom _).trans <| AddMonoidHom.toMultiplicative''
+
+variable {α}
+
+-- TODO: can `to_additive` generate the following lemmas automatically?
+
+lemma multiplesHom_apply (x : α) (n : ℕ) : multiplesHom α x n = n • x := rfl
+#align multiples_hom_apply multiplesHom_apply
+
+@[to_additive existing (attr := simp) multiplesHom_apply]
+lemma powersHom_apply (x : α) (n : Multiplicative ℕ) :
+ powersHom α x n = x ^ Multiplicative.toAdd n := rfl
+#align powers_hom_apply powersHom_apply
+
+lemma multiplesHom_symm_apply (f : ℕ →+ α) : (multiplesHom α).symm f = f 1 := rfl
+#align multiples_hom_symm_apply multiplesHom_symm_apply
+
+@[to_additive existing (attr := simp) multiplesHom_symm_apply]
+lemma powersHom_symm_apply (f : Multiplicative ℕ →* α) :
+ (powersHom α).symm f = f (Multiplicative.ofAdd 1) := rfl
+#align powers_hom_symm_apply powersHom_symm_apply
+
+lemma MonoidHom.apply_mnat (f : Multiplicative ℕ →* α) (n : Multiplicative ℕ) :
+ f n = f (Multiplicative.ofAdd 1) ^ (Multiplicative.toAdd n) := by
+ rw [← powersHom_symm_apply, ← powersHom_apply, Equiv.apply_symm_apply]
+#align monoid_hom.apply_mnat MonoidHom.apply_mnat
+
+@[ext]
+lemma MonoidHom.ext_mnat ⦃f g : Multiplicative ℕ →* α⦄
+ (h : f (Multiplicative.ofAdd 1) = g (Multiplicative.ofAdd 1)) : f = g :=
+ MonoidHom.ext fun n ↦ by rw [f.apply_mnat, g.apply_mnat, h]
+#align monoid_hom.ext_mnat MonoidHom.ext_mnat
+
+lemma AddMonoidHom.apply_nat (f : ℕ →+ α) (n : ℕ) : f n = n • f 1 := by
+ rw [← multiplesHom_symm_apply, ← multiplesHom_apply, Equiv.apply_symm_apply]
+#align add_monoid_hom.apply_nat AddMonoidHom.apply_nat
+
+end Monoid
+
+section CommMonoid
+variable (α) [CommMonoid α] [AddCommMonoid α]
+
+/-- If `α` is commutative, `multiplesHom` is an additive equivalence. -/
+def multiplesAddHom : α ≃+ (ℕ →+ α) :=
+ { multiplesHom α with map_add' := fun a b ↦ AddMonoidHom.ext fun n ↦ by simp [nsmul_add] }
+#align multiples_add_hom multiplesAddHom
+
+/-- If `α` is commutative, `powersHom` is a multiplicative equivalence. -/
+def powersMulHom : α ≃* (Multiplicative ℕ →* α) :=
+ { powersHom α with map_mul' := fun a b ↦ MonoidHom.ext fun n ↦ by simp [mul_pow] }
+#align powers_mul_hom powersMulHom
+
+@[simp] lemma multiplesAddHom_apply (x : α) (n : ℕ) : multiplesAddHom α x n = n • x := rfl
+#align multiples_add_hom_apply multiplesAddHom_apply
+
+@[simp]
+lemma powersMulHom_apply (x : α) (n : Multiplicative ℕ) : powersMulHom α x n = x ^ toAdd n := rfl
+#align powers_mul_hom_apply powersMulHom_apply
+
+@[simp] lemma multiplesAddHom_symm_apply (f : ℕ →+ α) : (multiplesAddHom α).symm f = f 1 := rfl
+#align multiples_add_hom_symm_apply multiplesAddHom_symm_apply
+
+@[simp] lemma powersMulHom_symm_apply (f : Multiplicative ℕ →* α) :
+ (powersMulHom α).symm f = f (ofAdd 1) := rfl
+#align powers_mul_hom_symm_apply powersMulHom_symm_apply
+
+end CommMonoid
+
namespace Pi
variable {π : α → Type*} [∀ a, NatCast (π a)]
This file introduces the BinomialRing
mixin (for semirings) and the Ring.multichoose
function, which generalizes Nat.multichoose
. These are preliminaries to introducing generalized binomial coefficients.
Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com> Co-authored-by: Junyan Xu <junyanxu.math@gmail.com> Co-authored-by: ScottCarnahan <scottcarnahan@gmail.com>
@@ -20,26 +20,26 @@ namespace Nat
section Commute
-theorem cast_commute [NonAssocSemiring α] (n : ℕ) (x : α) : Commute (n : α) x := by
+variable [NonAssocSemiring α]
+
+theorem cast_commute (n : ℕ) (x : α) : Commute (n : α) x := by
induction n with
| zero => rw [Nat.cast_zero]; exact Commute.zero_left x
| succ n ihn => rw [Nat.cast_succ]; exact ihn.add_left (Commute.one_left x)
#align nat.cast_commute Nat.cast_commute
-theorem _root_.Commute.ofNat_left [NonAssocSemiring α] (n : ℕ) [n.AtLeastTwo] (x : α) :
- Commute (OfNat.ofNat n) x :=
+theorem _root_.Commute.ofNat_left (n : ℕ) [n.AtLeastTwo] (x : α) : Commute (OfNat.ofNat n) x :=
n.cast_commute x
-theorem cast_comm [NonAssocSemiring α] (n : ℕ) (x : α) : (n : α) * x = x * n :=
+theorem cast_comm (n : ℕ) (x : α) : (n : α) * x = x * n :=
(cast_commute n x).eq
#align nat.cast_comm Nat.cast_comm
-theorem commute_cast [NonAssocSemiring α] (x : α) (n : ℕ) : Commute x n :=
+theorem commute_cast (x : α) (n : ℕ) : Commute x n :=
(n.cast_commute x).symm
#align nat.commute_cast Nat.commute_cast
-theorem _root_.Commute.ofNat_right [NonAssocSemiring α] (x : α) (n : ℕ) [n.AtLeastTwo] :
- Commute x (OfNat.ofNat n) :=
+theorem _root_.Commute.ofNat_right (x : α) (n : ℕ) [n.AtLeastTwo] : Commute x (OfNat.ofNat n) :=
n.commute_cast x
end Commute
cases'
(#9171)
I literally went through and regex'd some uses of cases'
, replacing them with rcases
; this is meant to be a low effort PR as I hope that tools can do this in the future.
rcases
is an easier replacement than cases
, though with better tools we could in future do a second pass converting simple rcases
added here (and existing ones) to cases
.
@@ -121,7 +121,7 @@ for `ℕ∞` and `ℝ≥0∞`, so we use type-specific lemmas for these types. -
@[simp, norm_cast]
theorem cast_tsub [CanonicallyOrderedCommSemiring α] [Sub α] [OrderedSub α]
[ContravariantClass α α (· + ·) (· ≤ ·)] (m n : ℕ) : ↑(m - n) = (m - n : α) := by
- cases' le_total m n with h h
+ rcases le_total m n with h | h
· rw [Nat.sub_eq_zero_of_le h, cast_zero, tsub_eq_zero_of_le]
exact mono_cast h
· rcases le_iff_exists_add'.mp h with ⟨m, rfl⟩
@@ -138,6 +138,7 @@ theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
#align map_nat_cast map_natCast
--Porting note: new theorem
+-- See note [no_index around OfNat.ofNat]
@[simp]
theorem map_ofNat [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
(f (no_index (OfNat.ofNat n)) : S) = OfNat.ofNat n :=
Use .asFn
and .lemmasOnly
as simps
configuration options.
For reference, these are defined here:
@@ -81,7 +81,7 @@ theorem strictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
#align nat.strict_mono_cast Nat.strictMono_cast
/-- `Nat.cast : ℕ → α` as an `OrderEmbedding` -/
-@[simps! (config := { fullyApplied := false })]
+@[simps! (config := .asFn)]
def castOrderEmbedding : ℕ ↪o α :=
OrderEmbedding.ofStrictMono Nat.cast Nat.strictMono_cast
#align nat.cast_order_embedding Nat.castOrderEmbedding
Hom
and file name (#8095)
I believe the file defining a type of morphisms belongs alongside the file defining the structure this morphism works on. So I would like to reorganize the files in the Mathlib.Algebra.Hom
folder so that e.g. Mathlib.Algebra.Hom.Ring
becomes Mathlib.Algebra.Ring.Hom
and Mathlib.Algebra.Hom.NonUnitalAlg
becomes Mathlib.Algebra.Algebra.NonUnitalHom
.
While fixing the imports I went ahead and sorted them for good luck.
The full list of changes is: renamed: Mathlib/Algebra/Hom/NonUnitalAlg.lean -> Mathlib/Algebra/Algebra/NonUnitalHom.lean renamed: Mathlib/Algebra/Hom/Aut.lean -> Mathlib/Algebra/Group/Aut.lean renamed: Mathlib/Algebra/Hom/Commute.lean -> Mathlib/Algebra/Group/Commute/Hom.lean renamed: Mathlib/Algebra/Hom/Embedding.lean -> Mathlib/Algebra/Group/Embedding.lean renamed: Mathlib/Algebra/Hom/Equiv/Basic.lean -> Mathlib/Algebra/Group/Equiv/Basic.lean renamed: Mathlib/Algebra/Hom/Equiv/TypeTags.lean -> Mathlib/Algebra/Group/Equiv/TypeTags.lean renamed: Mathlib/Algebra/Hom/Equiv/Units/Basic.lean -> Mathlib/Algebra/Group/Units/Equiv.lean renamed: Mathlib/Algebra/Hom/Equiv/Units/GroupWithZero.lean -> Mathlib/Algebra/GroupWithZero/Units/Equiv.lean renamed: Mathlib/Algebra/Hom/Freiman.lean -> Mathlib/Algebra/Group/Freiman.lean renamed: Mathlib/Algebra/Hom/Group/Basic.lean -> Mathlib/Algebra/Group/Hom/Basic.lean renamed: Mathlib/Algebra/Hom/Group/Defs.lean -> Mathlib/Algebra/Group/Hom/Defs.lean renamed: Mathlib/Algebra/Hom/GroupAction.lean -> Mathlib/GroupTheory/GroupAction/Hom.lean renamed: Mathlib/Algebra/Hom/GroupInstances.lean -> Mathlib/Algebra/Group/Hom/Instances.lean renamed: Mathlib/Algebra/Hom/Iterate.lean -> Mathlib/Algebra/GroupPower/IterateHom.lean renamed: Mathlib/Algebra/Hom/Centroid.lean -> Mathlib/Algebra/Ring/CentroidHom.lean renamed: Mathlib/Algebra/Hom/Ring/Basic.lean -> Mathlib/Algebra/Ring/Hom/Basic.lean renamed: Mathlib/Algebra/Hom/Ring/Defs.lean -> Mathlib/Algebra/Ring/Hom/Defs.lean renamed: Mathlib/Algebra/Hom/Units.lean -> Mathlib/Algebra/Group/Units/Hom.lean
Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Reorganizing.20.60Mathlib.2EAlgebra.2EHom.60
@@ -3,9 +3,9 @@ Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathlib.Algebra.Hom.Ring.Defs
-import Mathlib.Algebra.Hom.Group.Basic
import Mathlib.Algebra.Divisibility.Basic
+import Mathlib.Algebra.Group.Hom.Basic
+import Mathlib.Algebra.Ring.Hom.Defs
import Mathlib.Data.Nat.Basic
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -34,12 +34,12 @@ theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
#align nat.mono_cast Nat.mono_cast
--- See also `Nat.cast_nonneg`, specialised for an `OrderedSemiring`.
+/-- See also `Nat.cast_nonneg`, specialised for an `OrderedSemiring`. -/
@[simp low]
theorem cast_nonneg' (n : ℕ) : 0 ≤ (n : α) :=
@Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
--- Specialisation of `Nat.cast_nonneg'`, which seems to be easier for Lean to use.
+/-- Specialisation of `Nat.cast_nonneg'`, which seems to be easier for Lean to use. -/
@[simp]
theorem cast_nonneg {α} [OrderedSemiring α] (n : ℕ) : 0 ≤ (n : α) :=
cast_nonneg' n
@@ -63,11 +63,11 @@ theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg'
#align nat.cast_add_one_pos Nat.cast_add_one_pos
--- See also `Nat.cast_pos`, a specialisation of this to an `OrderedSemiring`.
+/-- See also `Nat.cast_pos`, a specialisation of this to an `OrderedSemiring`. -/
@[simp low]
theorem cast_pos' {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
--- Specialisation of `Nat.cast_pos'`, which seems to be easier for Lean to use.
+/-- Specialisation of `Nat.cast_pos'`, which seems to be easier for Lean to use. -/
@[simp]
theorem cast_pos {α} [OrderedSemiring α] [Nontrivial α] {n : ℕ} : (0 : α) < n ↔ 0 < n := cast_pos'
#align nat.cast_pos Nat.cast_pos
@@ -203,7 +203,7 @@ end Pi
theorem Sum.elim_natCast_natCast {α β γ : Type*} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
- @Sum.elim_lam_const_lam_const α β γ n
+ Sum.elim_lam_const_lam_const (γ := γ) n
#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCast
-- Guard against import creep regression.
@@ -7,6 +7,7 @@ import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Algebra.CharZero.Defs
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Data.Nat.Cast.NeZero
+import Mathlib.Data.Nat.Order.Basic
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -26,6 +27,53 @@ we use a generic collection of instances so that it applies in other settings (e
variable [AddCommMonoidWithOne α] [PartialOrder α]
variable [CovariantClass α α (· + ·) (· ≤ ·)] [ZeroLEOneClass α]
+
+@[mono]
+theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
+ monotone_nat_of_le_succ fun n ↦ by
+ rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
+#align nat.mono_cast Nat.mono_cast
+
+-- See also `Nat.cast_nonneg`, specialised for an `OrderedSemiring`.
+@[simp low]
+theorem cast_nonneg' (n : ℕ) : 0 ≤ (n : α) :=
+ @Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
+
+-- Specialisation of `Nat.cast_nonneg'`, which seems to be easier for Lean to use.
+@[simp]
+theorem cast_nonneg {α} [OrderedSemiring α] (n : ℕ) : 0 ≤ (n : α) :=
+ cast_nonneg' n
+#align nat.cast_nonneg Nat.cast_nonneg
+
+@[simp, norm_cast]
+theorem cast_min {α} [LinearOrderedSemiring α] {a b : ℕ} : ((min a b : ℕ) : α) = min (a : α) b :=
+ (@mono_cast α _).map_min
+#align nat.cast_min Nat.cast_min
+
+@[simp, norm_cast]
+theorem cast_max {α} [LinearOrderedSemiring α] {a b : ℕ} : ((max a b : ℕ) : α) = max (a : α) b :=
+ (@mono_cast α _).map_max
+#align nat.cast_max Nat.cast_max
+
+section Nontrivial
+
+variable [NeZero (1 : α)]
+
+theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
+ zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg'
+#align nat.cast_add_one_pos Nat.cast_add_one_pos
+
+-- See also `Nat.cast_pos`, a specialisation of this to an `OrderedSemiring`.
+@[simp low]
+theorem cast_pos' {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
+
+-- Specialisation of `Nat.cast_pos'`, which seems to be easier for Lean to use.
+@[simp]
+theorem cast_pos {α} [OrderedSemiring α] [Nontrivial α] {n : ℕ} : (0 : α) < n ↔ 0 < n := cast_pos'
+#align nat.cast_pos Nat.cast_pos
+
+end Nontrivial
+
variable [CharZero α] {m n : ℕ}
theorem strictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
@@ -68,6 +116,18 @@ theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le
end OrderedSemiring
+/-- A version of `Nat.cast_sub` that works for `ℝ≥0` and `ℚ≥0`. Note that this proof doesn't work
+for `ℕ∞` and `ℝ≥0∞`, so we use type-specific lemmas for these types. -/
+@[simp, norm_cast]
+theorem cast_tsub [CanonicallyOrderedCommSemiring α] [Sub α] [OrderedSub α]
+ [ContravariantClass α α (· + ·) (· ≤ ·)] (m n : ℕ) : ↑(m - n) = (m - n : α) := by
+ cases' le_total m n with h h
+ · rw [Nat.sub_eq_zero_of_le h, cast_zero, tsub_eq_zero_of_le]
+ exact mono_cast h
+ · rcases le_iff_exists_add'.mp h with ⟨m, rfl⟩
+ rw [add_tsub_cancel_right, cast_add, add_tsub_cancel_right]
+#align nat.cast_tsub Nat.cast_tsub
+
@[simp, norm_cast]
theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
abs_of_nonneg (cast_nonneg a)
@@ -6,7 +6,7 @@ Authors: Mario Carneiro
import Mathlib.Algebra.Hom.Ring.Defs
import Mathlib.Algebra.Hom.Group.Basic
import Mathlib.Algebra.Divisibility.Basic
-import Mathlib.Data.Nat.Order.Basic
+import Mathlib.Data.Nat.Basic
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -58,71 +58,7 @@ theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) =
rfl
#align nat.coe_cast_ring_hom Nat.coe_castRingHom
-section OrderedSemiring
-/- Note: even though the section indicates `OrderedSemiring`, which is the common use case,
-we use a generic collection of instances so that it applies in other settings (e.g., in a
-`StarOrderedRing`, or the `selfAdjoint` or `StarOrderedRing.positive` parts thereof). -/
-variable [AddCommMonoidWithOne α] [PartialOrder α]
-variable [CovariantClass α α (· + ·) (· ≤ ·)] [ZeroLEOneClass α]
-
-@[mono]
-theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
- monotone_nat_of_le_succ fun n ↦ by
- rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
-#align nat.mono_cast Nat.mono_cast
-
-@[simp low]
-theorem cast_nonneg' (n : ℕ) : 0 ≤ (n : α) :=
- @Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
-
--- without this more specific version Lean often chokes
-@[simp]
-theorem cast_nonneg {α} [OrderedSemiring α] (n : ℕ) : 0 ≤ (n : α) :=
- cast_nonneg' n
-#align nat.cast_nonneg Nat.cast_nonneg
-
-section Nontrivial
-
-variable [NeZero (1 : α)]
-
-theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
- zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg'
-#align nat.cast_add_one_pos Nat.cast_add_one_pos
-
-@[simp low]
-theorem cast_pos' {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
-
--- without this more specific version Lean often chokes
-@[simp]
-theorem cast_pos {α} [OrderedSemiring α] [Nontrivial α] {n : ℕ} : (0 : α) < n ↔ 0 < n := cast_pos'
-#align nat.cast_pos Nat.cast_pos
-
-end Nontrivial
-
-end OrderedSemiring
-
-/-- A version of `Nat.cast_sub` that works for `ℝ≥0` and `ℚ≥0`. Note that this proof doesn't work
-for `ℕ∞` and `ℝ≥0∞`, so we use type-specific lemmas for these types. -/
-@[simp, norm_cast]
-theorem cast_tsub [CanonicallyOrderedCommSemiring α] [Sub α] [OrderedSub α]
- [ContravariantClass α α (· + ·) (· ≤ ·)] (m n : ℕ) : ↑(m - n) = (m - n : α) := by
- cases' le_total m n with h h
- · rw [tsub_eq_zero_of_le h, cast_zero, tsub_eq_zero_of_le]
- exact mono_cast h
- · rcases le_iff_exists_add'.mp h with ⟨m, rfl⟩
- rw [add_tsub_cancel_right, cast_add, add_tsub_cancel_right]
-#align nat.cast_tsub Nat.cast_tsub
-
-@[simp, norm_cast]
-theorem cast_min [LinearOrderedSemiring α] {a b : ℕ} : ((min a b : ℕ) : α) = min (a : α) b :=
- (@mono_cast α _).map_min
-#align nat.cast_min Nat.cast_min
-
-@[simp, norm_cast]
-theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : ((max a b : ℕ) : α) = max (a : α) b :=
- (@mono_cast α _).map_max
-#align nat.cast_max Nat.cast_max
theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
map_dvd (Nat.castRingHom α) h
@@ -270,53 +206,8 @@ theorem Sum.elim_natCast_natCast {α β γ : Type*} [NatCast γ] (n : ℕ) :
@Sum.elim_lam_const_lam_const α β γ n
#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCast
-/-! ### Order dual -/
-
-
-open OrderDual
-
-instance [h : NatCast α] : NatCast αᵒᵈ :=
- h
-
-instance [h : AddMonoidWithOne α] : AddMonoidWithOne αᵒᵈ :=
- h
-
-instance [h : AddCommMonoidWithOne α] : AddCommMonoidWithOne αᵒᵈ :=
- h
-
-@[simp]
-theorem toDual_natCast [NatCast α] (n : ℕ) : toDual (n : α) = n :=
- rfl
-#align to_dual_nat_cast toDual_natCast
-
-@[simp]
-theorem ofDual_natCast [NatCast α] (n : ℕ) : (ofDual n : α) = n :=
- rfl
-#align of_dual_nat_cast ofDual_natCast
-
-/-! ### Lexicographic order -/
-
-
-instance [h : NatCast α] : NatCast (Lex α) :=
- h
-
-instance [h : AddMonoidWithOne α] : AddMonoidWithOne (Lex α) :=
- h
-
-instance [h : AddCommMonoidWithOne α] : AddCommMonoidWithOne (Lex α) :=
- h
-
-@[simp]
-theorem toLex_natCast [NatCast α] (n : ℕ) : toLex (n : α) = n :=
- rfl
-#align to_lex_nat_cast toLex_natCast
-
-@[simp]
-theorem ofLex_natCast [NatCast α] (n : ℕ) : (ofLex n : α) = n :=
- rfl
-#align of_lex_nat_cast ofLex_natCast
-
-- Guard against import creep regression.
+assert_not_exists OrderedCommGroup
assert_not_exists CharZero
assert_not_exists Commute.zero_right
assert_not_exists Commute.add_right
@@ -3,7 +3,9 @@ Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathlib.Algebra.Hom.Ring
+import Mathlib.Algebra.Hom.Ring.Defs
+import Mathlib.Algebra.Hom.Group.Basic
+import Mathlib.Algebra.Divisibility.Basic
import Mathlib.Data.Nat.Order.Basic
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -3,14 +3,8 @@ Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathlib.Algebra.CharZero.Defs
-import Mathlib.Algebra.GroupWithZero.Commute
import Mathlib.Algebra.Hom.Ring
-import Mathlib.Algebra.Order.Group.Abs
-import Mathlib.Algebra.Ring.Commute
import Mathlib.Data.Nat.Order.Basic
-import Mathlib.Data.Nat.Cast.NeZero
-import Mathlib.Algebra.Group.Opposite
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -62,28 +56,6 @@ theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) =
rfl
#align nat.coe_cast_ring_hom Nat.coe_castRingHom
-theorem cast_commute [NonAssocSemiring α] (n : ℕ) (x : α) : Commute (n : α) x := by
- induction n with
- | zero => rw [Nat.cast_zero]; exact Commute.zero_left x
- | succ n ihn => rw [Nat.cast_succ]; exact ihn.add_left (Commute.one_left x)
-#align nat.cast_commute Nat.cast_commute
-
-theorem _root_.Commute.ofNat_left [NonAssocSemiring α] (n : ℕ) [n.AtLeastTwo] (x : α) :
- Commute (OfNat.ofNat n) x :=
- n.cast_commute x
-
-theorem cast_comm [NonAssocSemiring α] (n : ℕ) (x : α) : (n : α) * x = x * n :=
- (cast_commute n x).eq
-#align nat.cast_comm Nat.cast_comm
-
-theorem commute_cast [NonAssocSemiring α] (x : α) (n : ℕ) : Commute x n :=
- (n.cast_commute x).symm
-#align nat.commute_cast Nat.commute_cast
-
-theorem _root_.Commute.ofNat_right [NonAssocSemiring α] (x : α) (n : ℕ) [n.AtLeastTwo] :
- Commute x (OfNat.ofNat n) :=
- n.commute_cast x
-
section OrderedSemiring
/- Note: even though the section indicates `OrderedSemiring`, which is the common use case,
we use a generic collection of instances so that it applies in other settings (e.g., in a
@@ -126,46 +98,6 @@ theorem cast_pos {α} [OrderedSemiring α] [Nontrivial α] {n : ℕ} : (0 : α)
end Nontrivial
-variable [CharZero α] {m n : ℕ}
-
-theorem strictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
- mono_cast.strictMono_of_injective cast_injective
-#align nat.strict_mono_cast Nat.strictMono_cast
-
-/-- `Nat.cast : ℕ → α` as an `OrderEmbedding` -/
-@[simps! (config := { fullyApplied := false })]
-def castOrderEmbedding : ℕ ↪o α :=
- OrderEmbedding.ofStrictMono Nat.cast Nat.strictMono_cast
-#align nat.cast_order_embedding Nat.castOrderEmbedding
-#align nat.cast_order_embedding_apply Nat.castOrderEmbedding_apply
-
-@[simp, norm_cast]
-theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
- strictMono_cast.le_iff_le
-#align nat.cast_le Nat.cast_le
-
-@[simp, norm_cast, mono]
-theorem cast_lt : (m : α) < n ↔ m < n :=
- strictMono_cast.lt_iff_lt
-#align nat.cast_lt Nat.cast_lt
-
-@[simp, norm_cast]
-theorem one_lt_cast : 1 < (n : α) ↔ 1 < n := by rw [← cast_one, cast_lt]
-#align nat.one_lt_cast Nat.one_lt_cast
-
-@[simp, norm_cast]
-theorem one_le_cast : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le]
-#align nat.one_le_cast Nat.one_le_cast
-
-@[simp, norm_cast]
-theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
- rw [← cast_one, cast_lt, lt_succ_iff, ← bot_eq_zero, le_bot_iff]
-#align nat.cast_lt_one Nat.cast_lt_one
-
-@[simp, norm_cast]
-theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le]
-#align nat.cast_le_one Nat.cast_le_one
-
end OrderedSemiring
/-- A version of `Nat.cast_sub` that works for `ℝ≥0` and `ℚ≥0`. Note that this proof doesn't work
@@ -190,11 +122,6 @@ theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : ((max a b : ℕ) : α)
(@mono_cast α _).map_max
#align nat.cast_max Nat.cast_max
-@[simp, norm_cast]
-theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
- abs_of_nonneg (cast_nonneg a)
-#align nat.abs_cast Nat.abs_cast
-
theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
map_dvd (Nat.castRingHom α) h
#align nat.coe_nat_dvd Nat.coe_nat_dvd
@@ -203,9 +130,6 @@ alias _root_.Dvd.dvd.natCast := coe_nat_dvd
end Nat
-instance [AddMonoidWithOne α] [CharZero α] : Nontrivial α where exists_pair_ne :=
- ⟨1, 0, (Nat.cast_one (R := α) ▸ Nat.cast_ne_zero.2 (by decide))⟩
-
section AddMonoidHomClass
variable {A B F : Type*} [AddMonoidWithOne B]
@@ -285,11 +209,6 @@ theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
ext_nat' f g <| by simp only [map_one f, map_one g]
#align ext_nat ext_nat
-theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
- (hf : Function.Injective f) : NeZero (n : S) :=
- ⟨fun h ↦ NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero f] ⟩
-#align ne_zero.nat_of_injective NeZero.nat_of_injective
-
theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
{n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) :=
.of_map (f := f) (neZero := by simp only [map_natCast, hn])
@@ -394,3 +313,11 @@ theorem toLex_natCast [NatCast α] (n : ℕ) : toLex (n : α) = n :=
theorem ofLex_natCast [NatCast α] (n : ℕ) : (ofLex n : α) = n :=
rfl
#align of_lex_nat_cast ofLex_natCast
+
+-- Guard against import creep regression.
+assert_not_exists CharZero
+assert_not_exists Commute.zero_right
+assert_not_exists Commute.add_right
+assert_not_exists abs_eq_max_neg
+assert_not_exists natCast_ne
+assert_not_exists MulOpposite.natCast
@@ -9,6 +9,7 @@ import Mathlib.Algebra.Hom.Ring
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Ring.Commute
import Mathlib.Data.Nat.Order.Basic
+import Mathlib.Data.Nat.Cast.NeZero
import Mathlib.Algebra.Group.Opposite
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
@@ -198,7 +198,7 @@ theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n :
map_dvd (Nat.castRingHom α) h
#align nat.coe_nat_dvd Nat.coe_nat_dvd
-alias coe_nat_dvd ← _root_.Dvd.dvd.natCast
+alias _root_.Dvd.dvd.natCast := coe_nat_dvd
end Nat
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -29,12 +29,12 @@ the natural numbers into an additive monoid with a one (`Nat.cast`).
-- where `simp [map_zero]` should suffice. (Similarly for `map_one`.)
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20regression.20with.20MonoidHomClass
-variable {α β : Type _}
+variable {α β : Type*}
namespace Nat
/-- `Nat.cast : ℕ → α` as an `AddMonoidHom`. -/
-def castAddMonoidHom (α : Type _) [AddMonoidWithOne α] :
+def castAddMonoidHom (α : Type*) [AddMonoidWithOne α] :
ℕ →+ α where
toFun := Nat.cast
map_add' := cast_add
@@ -52,7 +52,7 @@ theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m *
#align nat.cast_mul Nat.cast_mul
/-- `Nat.cast : ℕ → α` as a `RingHom` -/
-def castRingHom (α : Type _) [NonAssocSemiring α] : ℕ →+* α :=
+def castRingHom (α : Type*) [NonAssocSemiring α] : ℕ →+* α :=
{ castAddMonoidHom α with toFun := Nat.cast, map_one' := cast_one, map_mul' := cast_mul }
#align nat.cast_ring_hom Nat.castRingHom
@@ -207,7 +207,7 @@ instance [AddMonoidWithOne α] [CharZero α] : Nontrivial α where exists_pair_n
section AddMonoidHomClass
-variable {A B F : Type _} [AddMonoidWithOne B]
+variable {A B F : Type*} [AddMonoidWithOne B]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
FunLike.ext f g <| by
@@ -242,7 +242,7 @@ end AddMonoidHomClass
section MonoidWithZeroHomClass
-variable {A F : Type _} [MulZeroOneClass A]
+variable {A F : Type*} [MulZeroOneClass A]
/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
@@ -262,7 +262,7 @@ end MonoidWithZeroHomClass
section RingHomClass
-variable {R S F : Type _} [NonAssocSemiring R] [NonAssocSemiring S]
+variable {R S F : Type*} [NonAssocSemiring R] [NonAssocSemiring S]
@[simp]
theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
@@ -317,13 +317,13 @@ theorem Nat.castRingHom_nat : Nat.castRingHom ℕ = RingHom.id ℕ :=
/-- We don't use `RingHomClass` here, since that might cause type-class slowdown for
`Subsingleton`-/
-instance Nat.uniqueRingHom {R : Type _} [NonAssocSemiring R] : Unique (ℕ →+* R) where
+instance Nat.uniqueRingHom {R : Type*} [NonAssocSemiring R] : Unique (ℕ →+* R) where
default := Nat.castRingHom R
uniq := RingHom.eq_natCast'
namespace Pi
-variable {π : α → Type _} [∀ a, NatCast (π a)]
+variable {π : α → Type*} [∀ a, NatCast (π a)]
/- Porting note: manually wrote this instance.
Was `by refine_struct { .. } <;> pi_instance_derive_field` -/
@@ -343,7 +343,7 @@ theorem ofNat_apply (n : ℕ) [n.AtLeastTwo] (a : α) : (OfNat.ofNat n : ∀ a,
end Pi
-theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
+theorem Sum.elim_natCast_natCast {α β γ : Type*} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
@Sum.elim_lam_const_lam_const α β γ n
#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCast
Nat.cast
lemmas (#6229)
This generalizes some Nat.cast
lemmas from OrderedSemiring α
to the conjunction of AddCommMonoidWithOne α
, PartialOrder α
, CovariantClass α α (· + ·) (· ≤ ·)
, ZeroLEOneClass α
; collectively, these make up an OrderedAddCommMonoidWithOne
, but that type class doesn't actually exist.
This generalization is not without purpose, the new lemmas will apply to StarOrderedRing
s, as well as the selfAdjoint
part thereof, as well as the subtype {x : α // 0 ≤ x}
of positive elements in a StarOrderedRing
. These can be seen in #4871.
Because we are generalizing some fundamental simp
lemmas from a single bundled type class to a bag of several classes, Lean had trouble in a few places. So, we opt to keep the OrderedSemiring
versions of these simp
lemmas as a special case, and we mark the more general versions with @[simp low]
. This also avoids needing to update the positivity
extension for Nat.cast
to the more general setting for the time being.
@@ -84,8 +84,12 @@ theorem _root_.Commute.ofNat_right [NonAssocSemiring α] (x : α) (n : ℕ) [n.A
n.commute_cast x
section OrderedSemiring
+/- Note: even though the section indicates `OrderedSemiring`, which is the common use case,
+we use a generic collection of instances so that it applies in other settings (e.g., in a
+`StarOrderedRing`, or the `selfAdjoint` or `StarOrderedRing.positive` parts thereof). -/
-variable [OrderedSemiring α]
+variable [AddCommMonoidWithOne α] [PartialOrder α]
+variable [CovariantClass α α (· + ·) (· ≤ ·)] [ZeroLEOneClass α]
@[mono]
theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
@@ -93,21 +97,30 @@ theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
#align nat.mono_cast Nat.mono_cast
-@[simp]
-theorem cast_nonneg (n : ℕ) : 0 ≤ (n : α) :=
+@[simp low]
+theorem cast_nonneg' (n : ℕ) : 0 ≤ (n : α) :=
@Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
+
+-- without this more specific version Lean often chokes
+@[simp]
+theorem cast_nonneg {α} [OrderedSemiring α] (n : ℕ) : 0 ≤ (n : α) :=
+ cast_nonneg' n
#align nat.cast_nonneg Nat.cast_nonneg
section Nontrivial
-variable [Nontrivial α]
+variable [NeZero (1 : α)]
theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
- zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg
+ zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg'
#align nat.cast_add_one_pos Nat.cast_add_one_pos
+@[simp low]
+theorem cast_pos' {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
+
+-- without this more specific version Lean often chokes
@[simp]
-theorem cast_pos {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
+theorem cast_pos {α} [OrderedSemiring α] [Nontrivial α] {n : ℕ} : (0 : α) < n ↔ 0 < n := cast_pos'
#align nat.cast_pos Nat.cast_pos
end Nontrivial
@@ -2,11 +2,6 @@
Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.nat.cast.basic
-! leanprover-community/mathlib commit acebd8d49928f6ed8920e502a6c90674e75bd441
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.CharZero.Defs
import Mathlib.Algebra.GroupWithZero.Commute
@@ -16,6 +11,8 @@ import Mathlib.Algebra.Ring.Commute
import Mathlib.Data.Nat.Order.Basic
import Mathlib.Algebra.Group.Opposite
+#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
+
/-!
# Cast of natural numbers (additional theorems)
@@ -266,7 +266,7 @@ theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
--Porting note: new theorem
@[simp]
-theorem map_ofNat [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
+theorem map_ofNat [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
(f (no_index (OfNat.ofNat n)) : S) = OfNat.ofNat n :=
map_natCast f n
@@ -328,6 +328,9 @@ theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ ↦ ↑n :=
rfl
#align pi.coe_nat Pi.coe_nat
+@[simp]
+theorem ofNat_apply (n : ℕ) [n.AtLeastTwo] (a : α) : (OfNat.ofNat n : ∀ a, π a) a = n := rfl
+
end Pi
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Co-authored-by: Komyyy <pol_tta@outlook.jp> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -267,7 +267,7 @@ theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
--Porting note: new theorem
@[simp]
theorem map_ofNat [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
- (f (OfNat.ofNat n) : S) = OfNat.ofNat n :=
+ (f (no_index (OfNat.ofNat n)) : S) = OfNat.ofNat n :=
map_natCast f n
theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
@@ -70,6 +70,10 @@ theorem cast_commute [NonAssocSemiring α] (n : ℕ) (x : α) : Commute (n : α)
| succ n ihn => rw [Nat.cast_succ]; exact ihn.add_left (Commute.one_left x)
#align nat.cast_commute Nat.cast_commute
+theorem _root_.Commute.ofNat_left [NonAssocSemiring α] (n : ℕ) [n.AtLeastTwo] (x : α) :
+ Commute (OfNat.ofNat n) x :=
+ n.cast_commute x
+
theorem cast_comm [NonAssocSemiring α] (n : ℕ) (x : α) : (n : α) * x = x * n :=
(cast_commute n x).eq
#align nat.cast_comm Nat.cast_comm
@@ -78,6 +82,10 @@ theorem commute_cast [NonAssocSemiring α] (x : α) (n : ℕ) : Commute x n :=
(n.cast_commute x).symm
#align nat.commute_cast Nat.commute_cast
+theorem _root_.Commute.ofNat_right [NonAssocSemiring α] (x : α) (n : ℕ) [n.AtLeastTwo] :
+ Commute x (OfNat.ofNat n) :=
+ n.commute_cast x
+
section OrderedSemiring
variable [OrderedSemiring α]
@@ -256,6 +256,12 @@ theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
map_natCast' f <| map_one f
#align map_nat_cast map_natCast
+--Porting note: new theorem
+@[simp]
+theorem map_ofNat [RingHomClass F R S] (f : F) (n : ℕ) [Nat.AtLeastTwo n] :
+ (f (OfNat.ofNat n) : S) = OfNat.ofNat n :=
+ map_natCast f n
+
theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
ext_nat' f g <| by simp only [map_one f, map_one g]
#align ext_nat ext_nat
Match https://github.com/leanprover-community/mathlib/pull/18602
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
! This file was ported from Lean 3 source module data.nat.cast.basic
-! leanprover-community/mathlib commit fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e
+! leanprover-community/mathlib commit acebd8d49928f6ed8920e502a6c90674e75bd441
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -297,22 +297,6 @@ instance Nat.uniqueRingHom {R : Type _} [NonAssocSemiring R] : Unique (ℕ →+*
default := Nat.castRingHom R
uniq := RingHom.eq_natCast'
-namespace MulOpposite
-
-variable [AddMonoidWithOne α]
-
-@[simp, norm_cast]
-theorem op_natCast (n : ℕ) : op (n : α) = n :=
- rfl
-#align mul_opposite.op_nat_cast MulOpposite.op_natCast
-
-@[simp, norm_cast]
-theorem unop_natCast (n : ℕ) : unop (n : αᵐᵒᵖ) = n :=
- rfl
-#align mul_opposite.unop_nat_cast MulOpposite.unop_natCast
-
-end MulOpposite
-
namespace Pi
variable {π : α → Type _} [∀ a, NatCast (π a)]
@@ -125,9 +125,7 @@ theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
strictMono_cast.le_iff_le
#align nat.cast_le Nat.cast_le
--- porting note: missing mono attribute
--- @[simp, norm_cast, mono]
-@[simp, norm_cast]
+@[simp, norm_cast, mono]
theorem cast_lt : (m : α) < n ↔ m < n :=
strictMono_cast.lt_iff_lt
#align nat.cast_lt Nat.cast_lt
@@ -109,27 +109,27 @@ end Nontrivial
variable [CharZero α] {m n : ℕ}
-theorem StrictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
+theorem strictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
mono_cast.strictMono_of_injective cast_injective
-#align nat.strict_mono_cast Nat.StrictMono_cast
+#align nat.strict_mono_cast Nat.strictMono_cast
/-- `Nat.cast : ℕ → α` as an `OrderEmbedding` -/
@[simps! (config := { fullyApplied := false })]
def castOrderEmbedding : ℕ ↪o α :=
- OrderEmbedding.ofStrictMono Nat.cast Nat.StrictMono_cast
+ OrderEmbedding.ofStrictMono Nat.cast Nat.strictMono_cast
#align nat.cast_order_embedding Nat.castOrderEmbedding
#align nat.cast_order_embedding_apply Nat.castOrderEmbedding_apply
@[simp, norm_cast]
theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
- StrictMono_cast.le_iff_le
+ strictMono_cast.le_iff_le
#align nat.cast_le Nat.cast_le
-- porting note: missing mono attribute
-- @[simp, norm_cast, mono]
@[simp, norm_cast]
theorem cast_lt : (m : α) < n ↔ m < n :=
- StrictMono_cast.lt_iff_lt
+ strictMono_cast.lt_iff_lt
#align nat.cast_lt Nat.cast_lt
@[simp, norm_cast]
This is an extremely partial port of the mono*
tactic from Lean 3, implemented as a macro on top of solve_by_elim
. The original mono
had many configuration options and no documentation, so quite a bit is missing (and almost all the Lean 3 tests fail). Nonetheless I think it's worth merging this, because
@[mono]
mono
will succeed fairly often in the port even though it fails nearly all the testsCo-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
@@ -82,8 +82,7 @@ section OrderedSemiring
variable [OrderedSemiring α]
--- porting note: missing mono attribute
--- @[mono]
+@[mono]
theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
monotone_nat_of_le_succ fun n ↦ by
rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
simps
, just raises a linter error if you run simps
in a more expensive mode without writing !
.to_additive, simps
. Will do that systematically in future PR.OmegaCompletePartialOrder.ContinuousHom.ofMono
a bitCo-authored-by: Yury G. Kudryashov <urkud@urkud.name>
@@ -115,7 +115,7 @@ theorem StrictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
#align nat.strict_mono_cast Nat.StrictMono_cast
/-- `Nat.cast : ℕ → α` as an `OrderEmbedding` -/
-@[simps (config := { fullyApplied := false })]
+@[simps! (config := { fullyApplied := false })]
def castOrderEmbedding : ℕ ↪o α :=
OrderEmbedding.ofStrictMono Nat.cast Nat.StrictMono_cast
#align nat.cast_order_embedding Nat.castOrderEmbedding
This PR is the result of a slight variant on the following "algorithm"
_
and make all uppercase letters into lowercase_
and make all uppercase letters into lowercase(original_lean3_name, OriginalLean4Name)
#align
statement just before the next empty line#align
statement to have been inserted too early)@@ -42,6 +42,7 @@ def castAddMonoidHom (α : Type _) [AddMonoidWithOne α] :
toFun := Nat.cast
map_add' := cast_add
map_zero' := cast_zero
+#align nat.cast_add_monoid_hom Nat.castAddMonoidHom
@[simp]
theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ → α) = Nat.cast :=
@@ -51,10 +52,12 @@ theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ
@[simp, norm_cast]
theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
induction n <;> simp [mul_succ, mul_add, *]
+#align nat.cast_mul Nat.cast_mul
/-- `Nat.cast : ℕ → α` as a `RingHom` -/
def castRingHom (α : Type _) [NonAssocSemiring α] : ℕ →+* α :=
{ castAddMonoidHom α with toFun := Nat.cast, map_one' := cast_one, map_mul' := cast_mul }
+#align nat.cast_ring_hom Nat.castRingHom
@[simp]
theorem coe_castRingHom [NonAssocSemiring α] : (castRingHom α : ℕ → α) = Nat.cast :=
@@ -65,12 +68,15 @@ theorem cast_commute [NonAssocSemiring α] (n : ℕ) (x : α) : Commute (n : α)
induction n with
| zero => rw [Nat.cast_zero]; exact Commute.zero_left x
| succ n ihn => rw [Nat.cast_succ]; exact ihn.add_left (Commute.one_left x)
+#align nat.cast_commute Nat.cast_commute
theorem cast_comm [NonAssocSemiring α] (n : ℕ) (x : α) : (n : α) * x = x * n :=
(cast_commute n x).eq
+#align nat.cast_comm Nat.cast_comm
theorem commute_cast [NonAssocSemiring α] (x : α) (n : ℕ) : Commute x n :=
(n.cast_commute x).symm
+#align nat.commute_cast Nat.commute_cast
section OrderedSemiring
@@ -81,10 +87,12 @@ variable [OrderedSemiring α]
theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
monotone_nat_of_le_succ fun n ↦ by
rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
+#align nat.mono_cast Nat.mono_cast
@[simp]
theorem cast_nonneg (n : ℕ) : 0 ≤ (n : α) :=
@Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
+#align nat.cast_nonneg Nat.cast_nonneg
section Nontrivial
@@ -92,9 +100,11 @@ variable [Nontrivial α]
theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 :=
zero_lt_one.trans_le <| le_add_of_nonneg_left n.cast_nonneg
+#align nat.cast_add_one_pos Nat.cast_add_one_pos
@[simp]
theorem cast_pos {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
+#align nat.cast_pos Nat.cast_pos
end Nontrivial
@@ -108,29 +118,37 @@ theorem StrictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
@[simps (config := { fullyApplied := false })]
def castOrderEmbedding : ℕ ↪o α :=
OrderEmbedding.ofStrictMono Nat.cast Nat.StrictMono_cast
+#align nat.cast_order_embedding Nat.castOrderEmbedding
+#align nat.cast_order_embedding_apply Nat.castOrderEmbedding_apply
@[simp, norm_cast]
theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
StrictMono_cast.le_iff_le
+#align nat.cast_le Nat.cast_le
-- porting note: missing mono attribute
-- @[simp, norm_cast, mono]
@[simp, norm_cast]
theorem cast_lt : (m : α) < n ↔ m < n :=
StrictMono_cast.lt_iff_lt
+#align nat.cast_lt Nat.cast_lt
@[simp, norm_cast]
theorem one_lt_cast : 1 < (n : α) ↔ 1 < n := by rw [← cast_one, cast_lt]
+#align nat.one_lt_cast Nat.one_lt_cast
@[simp, norm_cast]
theorem one_le_cast : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le]
+#align nat.one_le_cast Nat.one_le_cast
@[simp, norm_cast]
theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
rw [← cast_one, cast_lt, lt_succ_iff, ← bot_eq_zero, le_bot_iff]
+#align nat.cast_lt_one Nat.cast_lt_one
@[simp, norm_cast]
theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le]
+#align nat.cast_le_one Nat.cast_le_one
end OrderedSemiring
@@ -144,21 +162,26 @@ theorem cast_tsub [CanonicallyOrderedCommSemiring α] [Sub α] [OrderedSub α]
exact mono_cast h
· rcases le_iff_exists_add'.mp h with ⟨m, rfl⟩
rw [add_tsub_cancel_right, cast_add, add_tsub_cancel_right]
+#align nat.cast_tsub Nat.cast_tsub
@[simp, norm_cast]
theorem cast_min [LinearOrderedSemiring α] {a b : ℕ} : ((min a b : ℕ) : α) = min (a : α) b :=
(@mono_cast α _).map_min
+#align nat.cast_min Nat.cast_min
@[simp, norm_cast]
theorem cast_max [LinearOrderedSemiring α] {a b : ℕ} : ((max a b : ℕ) : α) = max (a : α) b :=
(@mono_cast α _).map_max
+#align nat.cast_max Nat.cast_max
@[simp, norm_cast]
theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
abs_of_nonneg (cast_nonneg a)
+#align nat.abs_cast Nat.abs_cast
theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
map_dvd (Nat.castRingHom α) h
+#align nat.coe_nat_dvd Nat.coe_nat_dvd
alias coe_nat_dvd ← _root_.Dvd.dvd.natCast
@@ -178,10 +201,12 @@ theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 =
| zero => simp_rw [Nat.zero_eq, map_zero f, map_zero g]
| succ n ihn =>
simp [Nat.succ_eq_add_one, h, ihn]
+#align ext_nat' ext_nat'
@[ext]
theorem AddMonoidHom.ext_nat [AddMonoid A] {f g : ℕ →+ A} : f 1 = g 1 → f = g :=
ext_nat' f g
+#align add_monoid_hom.ext_nat AddMonoidHom.ext_nat
variable [AddMonoidWithOne A]
@@ -189,12 +214,14 @@ variable [AddMonoidWithOne A]
theorem eq_natCast' [AddMonoidHomClass F ℕ A] (f : F) (h1 : f 1 = 1) : ∀ n : ℕ, f n = n
| 0 => by simp [map_zero f]
| n + 1 => by rw [map_add, h1, eq_natCast' f h1 n, Nat.cast_add_one]
+#align eq_nat_cast' eq_natCast'
theorem map_natCast' {A} [AddMonoidWithOne A] [AddMonoidHomClass F A B] (f : F) (h : f 1 = 1) :
∀ n : ℕ, f n = n
| 0 => by simp [map_zero f]
| n + 1 => by
rw [Nat.cast_add, map_add, Nat.cast_add, map_natCast' f h n, Nat.cast_one, h, Nat.cast_one]
+#align map_nat_cast' map_natCast'
end AddMonoidHomClass
@@ -209,10 +236,12 @@ theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n :
rintro (_ | n)
· simp [map_zero f, map_zero g]
· exact h_pos n.succ_pos
+#align ext_nat'' ext_nat''
@[ext]
theorem MonoidWithZeroHom.ext_nat {f g : ℕ →*₀ A} : (∀ {n : ℕ}, 0 < n → f n = g n) → f = g :=
ext_nat'' f g
+#align monoid_with_zero_hom.ext_nat MonoidWithZeroHom.ext_nat
end MonoidWithZeroHomClass
@@ -223,21 +252,26 @@ variable {R S F : Type _} [NonAssocSemiring R] [NonAssocSemiring S]
@[simp]
theorem eq_natCast [RingHomClass F ℕ R] (f : F) : ∀ n, f n = n :=
eq_natCast' f <| map_one f
+#align eq_nat_cast eq_natCast
@[simp]
theorem map_natCast [RingHomClass F R S] (f : F) : ∀ n : ℕ, f (n : R) = n :=
map_natCast' f <| map_one f
+#align map_nat_cast map_natCast
theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
ext_nat' f g <| by simp only [map_one f, map_one g]
+#align ext_nat ext_nat
theorem NeZero.nat_of_injective {n : ℕ} [h : NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
⟨fun h ↦ NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero f] ⟩
+#align ne_zero.nat_of_injective NeZero.nat_of_injective
theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
{n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) :=
.of_map (f := f) (neZero := by simp only [map_natCast, hn])
+#align ne_zero.nat_of_ne_zero NeZero.nat_of_neZero
end RingHomClass
@@ -253,10 +287,12 @@ end RingHom
@[simp, norm_cast]
theorem Nat.cast_id (n : ℕ) : n.cast = n :=
rfl
+#align nat.cast_id Nat.cast_id
@[simp]
theorem Nat.castRingHom_nat : Nat.castRingHom ℕ = RingHom.id ℕ :=
rfl
+#align nat.cast_ring_hom_nat Nat.castRingHom_nat
/-- We don't use `RingHomClass` here, since that might cause type-class slowdown for
`Subsingleton`-/
@@ -271,10 +307,12 @@ variable [AddMonoidWithOne α]
@[simp, norm_cast]
theorem op_natCast (n : ℕ) : op (n : α) = n :=
rfl
+#align mul_opposite.op_nat_cast MulOpposite.op_natCast
@[simp, norm_cast]
theorem unop_natCast (n : ℕ) : unop (n : αᵐᵒᵖ) = n :=
rfl
+#align mul_opposite.unop_nat_cast MulOpposite.unop_natCast
end MulOpposite
@@ -288,16 +326,19 @@ instance natCast : NatCast (∀ a, π a) := { natCast := fun n _ ↦ n }
theorem nat_apply (n : ℕ) (a : α) : (n : ∀ a, π a) a = n :=
rfl
+#align pi.nat_apply Pi.nat_apply
@[simp]
theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ ↦ ↑n :=
rfl
+#align pi.coe_nat Pi.coe_nat
end Pi
theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Sum.elim (n : α → γ) (n : β → γ) = n :=
@Sum.elim_lam_const_lam_const α β γ n
+#align sum.elim_nat_cast_nat_cast Sum.elim_natCast_natCast
/-! ### Order dual -/
@@ -316,12 +316,12 @@ instance [h : AddCommMonoidWithOne α] : AddCommMonoidWithOne αᵒᵈ :=
@[simp]
theorem toDual_natCast [NatCast α] (n : ℕ) : toDual (n : α) = n :=
rfl
-#align to_dual_natCast toDual_natCast
+#align to_dual_nat_cast toDual_natCast
@[simp]
theorem ofDual_natCast [NatCast α] (n : ℕ) : (ofDual n : α) = n :=
rfl
-#align of_dual_natCast ofDual_natCast
+#align of_dual_nat_cast ofDual_natCast
/-! ### Lexicographic order -/
@@ -338,9 +338,9 @@ instance [h : AddCommMonoidWithOne α] : AddCommMonoidWithOne (Lex α) :=
@[simp]
theorem toLex_natCast [NatCast α] (n : ℕ) : toLex (n : α) = n :=
rfl
-#align to_lex_natCast toLex_natCast
+#align to_lex_nat_cast toLex_natCast
@[simp]
theorem ofLex_natCast [NatCast α] (n : ℕ) : (ofLex n : α) = n :=
rfl
-#align of_lex_natCast ofLex_natCast
+#align of_lex_nat_cast ofLex_natCast
=
, ≠
, <
, and ≤
functionality for norm_num
(#1568)
This PR gives norm_num
basic inequality (and equality) functionality (towards #1567), including the following:
example {α} [DivisionRing α] [CharZero α] : (-1:α) ≠ 2 := by norm_num
We implement basic logical extensions to handle =
and ≠
together, namely ¬
, True
, and False
. ≠
is not given an extension, as it is handled by =
and ¬
.
For now we only can prove ≠
for numbers given a CharZero α
instance.
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -164,6 +164,9 @@ alias coe_nat_dvd ← _root_.Dvd.dvd.natCast
end Nat
+instance [AddMonoidWithOne α] [CharZero α] : Nontrivial α where exists_pair_ne :=
+ ⟨1, 0, (Nat.cast_one (R := α) ▸ Nat.cast_ne_zero.2 (by decide))⟩
+
section AddMonoidHomClass
variable {A B F : Type _} [AddMonoidWithOne B]
@@ -160,7 +160,7 @@ theorem abs_cast [LinearOrderedRing α] (a : ℕ) : |(a : α)| = a :=
theorem coe_nat_dvd [Semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) :=
map_dvd (Nat.castRingHom α) h
-alias coe_nat_dvd ← _root_.has_dvd.dvd.natCast
+alias coe_nat_dvd ← _root_.Dvd.dvd.natCast
end Nat
The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md
@@ -2,6 +2,11 @@
Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
+
+! This file was ported from Lean 3 source module data.nat.cast.basic
+! leanprover-community/mathlib commit fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Algebra.CharZero.Defs
import Mathlib.Algebra.GroupWithZero.Commute
The unported dependencies are