logic.unique
⟷
Mathlib.Logic.Unique
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)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -128,11 +128,9 @@ theorem Fin.eq_zero : ∀ n : Fin 1, n = 0
instance {n : ℕ} : Inhabited (Fin n.succ) :=
⟨0⟩
-#print inhabitedFinOneAdd /-
instance inhabitedFinOneAdd (n : ℕ) : Inhabited (Fin (1 + n)) :=
⟨⟨0, Nat.zero_lt_one_add n⟩⟩
#align inhabited_fin_one_add inhabitedFinOneAdd
--/
#print Fin.default_eq_zero /-
@[simp]
@@ -141,11 +139,9 @@ theorem Fin.default_eq_zero (n : ℕ) : (default : Fin n.succ) = 0 :=
#align fin.default_eq_zero Fin.default_eq_zero
-/
-#print Fin.unique /-
instance Fin.unique : Unique (Fin 1) :=
{ Fin.inhabited with uniq := Fin.eq_zero }
#align fin.unique Fin.unique
--/
namespace Unique
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
-import Mathbin.Tactic.Basic
-import Mathbin.Logic.IsEmpty
+import Tactic.Basic
+import Logic.IsEmpty
#align_import logic.unique from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-
-! This file was ported from Lean 3 source module logic.unique
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Tactic.Basic
import Mathbin.Logic.IsEmpty
+#align_import logic.unique from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
+
/-!
# Types with a unique term
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -239,20 +239,26 @@ theorem Pi.default_apply {β : α → Sort v} [∀ a, Inhabited (β a)] (a : α)
#align pi.default_apply Pi.default_apply
-/
+#print Pi.unique /-
instance Pi.unique {β : α → Sort v} [∀ a, Unique (β a)] : Unique (∀ a, β a) :=
{ Pi.inhabited α with uniq := fun f => funext fun x => Unique.eq_default _ }
#align pi.unique Pi.unique
+-/
+#print Pi.uniqueOfIsEmpty /-
/-- There is a unique function on an empty domain. -/
instance Pi.uniqueOfIsEmpty [IsEmpty α] (β : α → Sort v) : Unique (∀ a, β a)
where
default := isEmptyElim
uniq f := funext isEmptyElim
#align pi.unique_of_is_empty Pi.uniqueOfIsEmpty
+-/
+#print eq_const_of_unique /-
theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (f default) := by ext x;
rw [Subsingleton.elim x default]
#align eq_const_of_unique eq_const_of_unique
+-/
#print heq_const_of_unique /-
theorem heq_const_of_unique [Unique α] {β : α → Sort v} (f : ∀ a, β a) :
@@ -265,17 +271,21 @@ namespace Function
variable {f : α → β}
+#print Function.Injective.subsingleton /-
/-- If the codomain of an injective function is a subsingleton, then the domain
is a subsingleton as well. -/
protected theorem Injective.subsingleton (hf : Injective f) [Subsingleton β] : Subsingleton α :=
⟨fun x y => hf <| Subsingleton.elim _ _⟩
#align function.injective.subsingleton Function.Injective.subsingleton
+-/
+#print Function.Surjective.subsingleton /-
/-- If the domain of a surjective function is a subsingleton, then the codomain is a subsingleton as
well. -/
protected theorem Surjective.subsingleton [Subsingleton α] (hf : Surjective f) : Subsingleton β :=
⟨hf.Forall₂.2 fun x y => congr_arg f <| Subsingleton.elim x y⟩
#align function.surjective.subsingleton Function.Surjective.subsingleton
+-/
#print Function.Surjective.unique /-
/-- If the domain of a surjective function is a singleton,
@@ -302,11 +312,13 @@ def Surjective.uniqueOfSurjectiveConst (α : Type _) {β : Type _} (b : β)
end Function
+#print Unique.bijective /-
theorem Unique.bijective {A B} [Unique A] [Unique B] {f : A → B} : Function.Bijective f :=
by
rw [Function.bijective_iff_has_inverse]
refine' ⟨default, _, _⟩ <;> intro x <;> simp
#align unique.bijective Unique.bijective
+-/
namespace Option
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -76,7 +76,7 @@ theorem unique_iff_exists_unique (α : Sort u) : Nonempty (Unique α) ↔ ∃! a
theorem unique_subtype_iff_exists_unique {α} (p : α → Prop) :
Nonempty (Unique (Subtype p)) ↔ ∃! a, p a :=
⟨fun ⟨u⟩ => ⟨u.default.1, u.default.2, fun a h => congr_arg Subtype.val (u.uniq ⟨a, h⟩)⟩,
- fun ⟨a, ha, he⟩ => ⟨⟨⟨⟨a, ha⟩⟩, fun ⟨b, hb⟩ => by congr ; exact he b hb⟩⟩⟩
+ fun ⟨a, ha, he⟩ => ⟨⟨⟨⟨a, ha⟩⟩, fun ⟨b, hb⟩ => by congr; exact he b hb⟩⟩⟩
#align unique_subtype_iff_exists_unique unique_subtype_iff_exists_unique
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -239,22 +239,10 @@ theorem Pi.default_apply {β : α → Sort v} [∀ a, Inhabited (β a)] (a : α)
#align pi.default_apply Pi.default_apply
-/
-/- warning: pi.unique -> Pi.unique is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} {β : α -> Sort.{u2}} [_inst_1 : forall (a : α), Unique.{u2} (β a)], Unique.{imax u1 u2} (forall (a : α), β a)
-but is expected to have type
- forall {α : Sort.{u2}} {β : α -> Sort.{u1}} [_inst_1 : forall (a : α), Unique.{u1} (β a)], Unique.{imax u2 u1} (forall (a : α), β a)
-Case conversion may be inaccurate. Consider using '#align pi.unique Pi.uniqueₓ'. -/
instance Pi.unique {β : α → Sort v} [∀ a, Unique (β a)] : Unique (∀ a, β a) :=
{ Pi.inhabited α with uniq := fun f => funext fun x => Unique.eq_default _ }
#align pi.unique Pi.unique
-/- warning: pi.unique_of_is_empty -> Pi.uniqueOfIsEmpty is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} [_inst_1 : IsEmpty.{u1} α] (β : α -> Sort.{u2}), Unique.{imax u1 u2} (forall (a : α), β a)
-but is expected to have type
- forall {α : Sort.{u2}} [_inst_1 : IsEmpty.{u2} α] (β : α -> Sort.{u1}), Unique.{imax u2 u1} (forall (a : α), β a)
-Case conversion may be inaccurate. Consider using '#align pi.unique_of_is_empty Pi.uniqueOfIsEmptyₓ'. -/
/-- There is a unique function on an empty domain. -/
instance Pi.uniqueOfIsEmpty [IsEmpty α] (β : α → Sort v) : Unique (∀ a, β a)
where
@@ -262,12 +250,6 @@ instance Pi.uniqueOfIsEmpty [IsEmpty α] (β : α → Sort v) : Unique (∀ a,
uniq f := funext isEmptyElim
#align pi.unique_of_is_empty Pi.uniqueOfIsEmpty
-/- warning: eq_const_of_unique -> eq_const_of_unique is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} {β : Sort.{u2}} [_inst_1 : Unique.{u1} α] (f : α -> β), Eq.{imax u1 u2} (α -> β) f (Function.const.{u2, u1} β α (f (Inhabited.default.{u1} α (Unique.inhabited.{u1} α _inst_1))))
-but is expected to have type
- forall {α : Sort.{u2}} {β : Sort.{u1}} [_inst_1 : Unique.{u2} α] (f : α -> β), Eq.{imax u2 u1} (α -> β) f (Function.const.{u1, u2} β α (f (Inhabited.default.{u2} α (Unique.instInhabited.{u2} α _inst_1))))
-Case conversion may be inaccurate. Consider using '#align eq_const_of_unique eq_const_of_uniqueₓ'. -/
theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (f default) := by ext x;
rw [Subsingleton.elim x default]
#align eq_const_of_unique eq_const_of_unique
@@ -283,24 +265,12 @@ namespace Function
variable {f : α → β}
-/- warning: function.injective.subsingleton -> Function.Injective.subsingleton is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} {β : Sort.{u2}} {f : α -> β}, (Function.Injective.{u1, u2} α β f) -> (forall [_inst_1 : Subsingleton.{u2} β], Subsingleton.{u1} α)
-but is expected to have type
- forall {α : Sort.{u2}} {β : Sort.{u1}} {f : α -> β}, (Function.Injective.{u2, u1} α β f) -> (forall [_inst_1 : Subsingleton.{u1} β], Subsingleton.{u2} α)
-Case conversion may be inaccurate. Consider using '#align function.injective.subsingleton Function.Injective.subsingletonₓ'. -/
/-- If the codomain of an injective function is a subsingleton, then the domain
is a subsingleton as well. -/
protected theorem Injective.subsingleton (hf : Injective f) [Subsingleton β] : Subsingleton α :=
⟨fun x y => hf <| Subsingleton.elim _ _⟩
#align function.injective.subsingleton Function.Injective.subsingleton
-/- warning: function.surjective.subsingleton -> Function.Surjective.subsingleton is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} {β : Sort.{u2}} {f : α -> β} [_inst_1 : Subsingleton.{u1} α], (Function.Surjective.{u1, u2} α β f) -> (Subsingleton.{u2} β)
-but is expected to have type
- forall {α : Sort.{u2}} {β : Sort.{u1}} {f : α -> β} [_inst_1 : Subsingleton.{u2} α], (Function.Surjective.{u2, u1} α β f) -> (Subsingleton.{u1} β)
-Case conversion may be inaccurate. Consider using '#align function.surjective.subsingleton Function.Surjective.subsingletonₓ'. -/
/-- If the domain of a surjective function is a subsingleton, then the codomain is a subsingleton as
well. -/
protected theorem Surjective.subsingleton [Subsingleton α] (hf : Surjective f) : Subsingleton β :=
@@ -332,12 +302,6 @@ def Surjective.uniqueOfSurjectiveConst (α : Type _) {β : Type _} (b : β)
end Function
-/- warning: unique.bijective -> Unique.bijective is a dubious translation:
-lean 3 declaration is
- forall {A : Sort.{u1}} {B : Sort.{u2}} [_inst_1 : Unique.{u1} A] [_inst_2 : Unique.{u2} B] {f : A -> B}, Function.Bijective.{u1, u2} A B f
-but is expected to have type
- forall {A : Sort.{u2}} {B : Sort.{u1}} [_inst_1 : Unique.{u2} A] [_inst_2 : Unique.{u1} B] {f : A -> B}, Function.Bijective.{u2, u1} A B f
-Case conversion may be inaccurate. Consider using '#align unique.bijective Unique.bijectiveₓ'. -/
theorem Unique.bijective {A B} [Unique A] [Unique B] {f : A → B} : Function.Bijective f :=
by
rw [Function.bijective_iff_has_inverse]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -76,10 +76,7 @@ theorem unique_iff_exists_unique (α : Sort u) : Nonempty (Unique α) ↔ ∃! a
theorem unique_subtype_iff_exists_unique {α} (p : α → Prop) :
Nonempty (Unique (Subtype p)) ↔ ∃! a, p a :=
⟨fun ⟨u⟩ => ⟨u.default.1, u.default.2, fun a h => congr_arg Subtype.val (u.uniq ⟨a, h⟩)⟩,
- fun ⟨a, ha, he⟩ =>
- ⟨⟨⟨⟨a, ha⟩⟩, fun ⟨b, hb⟩ => by
- congr
- exact he b hb⟩⟩⟩
+ fun ⟨a, ha, he⟩ => ⟨⟨⟨⟨a, ha⟩⟩, fun ⟨b, hb⟩ => by congr ; exact he b hb⟩⟩⟩
#align unique_subtype_iff_exists_unique unique_subtype_iff_exists_unique
-/
@@ -223,10 +220,7 @@ end Unique
theorem unique_iff_subsingleton_and_nonempty (α : Sort u) :
Nonempty (Unique α) ↔ Subsingleton α ∧ Nonempty α :=
⟨fun ⟨u⟩ => by constructor <;> exact inferInstance, fun ⟨hs, hn⟩ =>
- ⟨by
- skip
- inhabit α
- exact Unique.mk' α⟩⟩
+ ⟨by skip; inhabit α; exact Unique.mk' α⟩⟩
#align unique_iff_subsingleton_and_nonempty unique_iff_subsingleton_and_nonempty
-/
@@ -274,9 +268,7 @@ lean 3 declaration is
but is expected to have type
forall {α : Sort.{u2}} {β : Sort.{u1}} [_inst_1 : Unique.{u2} α] (f : α -> β), Eq.{imax u2 u1} (α -> β) f (Function.const.{u1, u2} β α (f (Inhabited.default.{u2} α (Unique.instInhabited.{u2} α _inst_1))))
Case conversion may be inaccurate. Consider using '#align eq_const_of_unique eq_const_of_uniqueₓ'. -/
-theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (f default) :=
- by
- ext x
+theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (f default) := by ext x;
rw [Subsingleton.elim x default]
#align eq_const_of_unique eq_const_of_unique
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
In one case, replacing this naively errored, so I just merged the single declaration using it.
Delete two unused variables in Logic/Basic.
@@ -42,8 +42,6 @@ for good definitional properties of the default term.
-/
-set_option autoImplicit true
-
universe u v w
/-- `Unique α` expresses that `α` is a type with a unique term `default`.
@@ -115,7 +113,7 @@ open Function
section
-variable [Unique α]
+variable {α : Sort*} [Unique α]
-- see Note [lower instance priority]
instance (priority := 100) : Inhabited α :=
@@ -143,6 +141,8 @@ theorem exists_iff {p : α → Prop} : Exists p ↔ p default :=
end
+variable {α : Sort*}
+
@[ext]
protected theorem subsingleton_unique' : ∀ h₁ h₂ : Unique α, h₁ = h₂
| ⟨⟨x⟩, h⟩, ⟨⟨y⟩, _⟩ => by congr; rw [h x, h y]
@@ -166,6 +166,8 @@ theorem unique_iff_subsingleton_and_nonempty (α : Sort u) :
fun ⟨hs, hn⟩ ↦ ⟨by inhabit α; exact Unique.mk' α⟩⟩
#align unique_iff_subsingleton_and_nonempty unique_iff_subsingleton_and_nonempty
+variable {α : Sort*}
+
@[simp]
theorem Pi.default_def {β : α → Sort v} [∀ a, Inhabited (β a)] :
@default (∀ a, β a) _ = fun a : α ↦ @default (β a) _ :=
@@ -185,11 +187,11 @@ instance Pi.uniqueOfIsEmpty [IsEmpty α] (β : α → Sort v) : Unique (∀ a,
default := isEmptyElim
uniq _ := funext isEmptyElim
-theorem eq_const_of_subsingleton [Subsingleton α] (f : α → β) (a : α) :
+theorem eq_const_of_subsingleton {β : Sort*} [Subsingleton α] (f : α → β) (a : α) :
f = Function.const α (f a) :=
funext fun x ↦ Subsingleton.elim x a ▸ rfl
-theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (f default) :=
+theorem eq_const_of_unique {β : Sort*} [Unique α] (f : α → β) : f = Function.const α (f default) :=
eq_const_of_subsingleton ..
#align eq_const_of_unique eq_const_of_unique
@@ -200,7 +202,7 @@ theorem heq_const_of_unique [Unique α] {β : α → Sort v} (f : ∀ a, β a) :
namespace Function
-variable {f : α → β}
+variable {β : Sort*} {f : α → β}
/-- If the codomain of an injective function is a subsingleton, then the domain
is a subsingleton as well. -/
@@ -216,7 +218,8 @@ protected theorem Surjective.subsingleton [Subsingleton α] (hf : Surjective f)
/-- If the domain of a surjective function is a singleton,
then the codomain is a singleton as well. -/
-protected def Surjective.unique (f : α → β) (hf : Surjective f) [Unique.{u} α] : Unique β :=
+protected def Surjective.unique {α : Sort u} (f : α → β) (hf : Surjective f) [Unique.{u} α] :
+ Unique β :=
@Unique.mk' _ ⟨f default⟩ hf.subsingleton
#align function.surjective.unique Function.Surjective.unique
@@ -236,6 +239,7 @@ end Function
section Pi
variable {ι : Sort*} {α : ι → Sort*}
+
/-- Given one value over a unique, we get a dependent function. -/
def uniqueElim [Unique ι] (x : α (default : ι)) (i : ι) : α i := by
rw [Unique.eq_default i]
@@ -246,7 +250,8 @@ theorem uniqueElim_default {_ : Unique ι} (x : α (default : ι)) : uniqueElim
rfl
@[simp]
-theorem uniqueElim_const {_ : Unique ι} (x : β) (i : ι) : uniqueElim (α := fun _ ↦ β) x i = x :=
+theorem uniqueElim_const {β : Sort*} {_ : Unique ι} (x : β) (i : ι) :
+ uniqueElim (α := fun _ ↦ β) x i = x :=
rfl
end Pi
Fin
(#8510)
Unique
should be available earlier than results about Fin n
, by virtue of being a very basic logic typeclass with no dependencies on Nat or algebra.
This also generalizes some of the moved instances and lemmas. There are no new declarations in this PR, only renames of existing ones.
@@ -5,7 +5,6 @@ Authors: Johan Commelin
-/
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
-import Mathlib.Init.Data.Fin.Basic
import Mathlib.Tactic.Inhabit
#align_import logic.unique from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
@@ -110,24 +109,6 @@ def uniqueProp {p : Prop} (h : p) : Unique.{0} p where
instance : Unique True :=
uniqueProp trivial
-theorem Fin.eq_zero : ∀ n : Fin 1, n = 0
- | ⟨_, hn⟩ => Fin.eq_of_veq (Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ hn))
-#align fin.eq_zero Fin.eq_zero
-
-instance {n : ℕ} : Inhabited (Fin n.succ) :=
- ⟨0⟩
-
-instance inhabitedFinOneAdd (n : ℕ) : Inhabited (Fin (1 + n)) :=
- ⟨⟨0, by rw [Nat.add_comm]; exact Nat.zero_lt_succ _⟩⟩
-
-@[simp]
-theorem Fin.default_eq_zero (n : ℕ) : (default : Fin n.succ) = 0 :=
- rfl
-#align fin.default_eq_zero Fin.default_eq_zero
-
-instance Fin.unique : Unique (Fin 1) where
- uniq := Fin.eq_zero
-
namespace Unique
open Function
attribute [simp] ... in
-> attribute [local simp] ... in
(#7678)
Mathlib.Logic.Unique contains the line attribute [simp] eq_iff_true_of_subsingleton in ...
:
Despite what the in
part may imply, this adds the lemma to the simp set "globally", including for downstream files; it is likely that attribute [local simp] eq_iff_true_of_subsingleton in ...
was meant instead (or maybe scoped simp
, but I think "scoped" refers to the current namespace). Indeed, the relevant lemma is not marked with @[simp]
for possible slowness: https://github.com/leanprover/std4/blob/846e9e1d6bb534774d1acd2dc430e70987da3c18/Std/Logic.lean#L749. Adding it to the simp set causes the example at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Regression.20in.20simp to slow down.
This PR changes this and fixes the relevant downstream simp
s. There was also one ocurrence of attribute [simp] FullSubcategory.comp_def FullSubcategory.id_def in
in Mathlib.CategoryTheory.Monoidal.Subcategory but that was much easier to fix.
@@ -271,7 +271,7 @@ theorem uniqueElim_const {_ : Unique ι} (x : β) (i : ι) : uniqueElim (α := f
end Pi
-- TODO: Mario turned this off as a simp lemma in Std, wanting to profile it.
-attribute [simp] eq_iff_true_of_subsingleton in
+attribute [local simp] eq_iff_true_of_subsingleton in
theorem Unique.bijective {A B} [Unique A] [Unique B] {f : A → B} : Function.Bijective f := by
rw [Function.bijective_iff_has_inverse]
refine' ⟨default, _, _⟩ <;> intro x <;> simp
MeasurableSpace
arguments for consistency with other lemmas.Equiv.piSubsingleton
and MulEquiv.piSubsingleton
to Equiv.piUnique
and MulEquiv.piUnique
.@@ -254,7 +254,7 @@ end Function
section Pi
-variable {ι : Type*} {α : ι → Type*}
+variable {ι : Sort*} {α : ι → Sort*}
/-- Given one value over a unique, we get a dependent function. -/
def uniqueElim [Unique ι] (x : α (default : ι)) (i : ι) : α i := by
rw [Unique.eq_default i]
@@ -264,6 +264,10 @@ def uniqueElim [Unique ι] (x : α (default : ι)) (i : ι) : α i := by
theorem uniqueElim_default {_ : Unique ι} (x : α (default : ι)) : uniqueElim x (default : ι) = x :=
rfl
+@[simp]
+theorem uniqueElim_const {_ : Unique ι} (x : β) (i : ι) : uniqueElim (α := fun _ ↦ β) x i = x :=
+ rfl
+
end Pi
-- TODO: Mario turned this off as a simp lemma in Std, wanting to profile it.
@@ -252,6 +252,20 @@ def Surjective.uniqueOfSurjectiveConst (α : Type*) {β : Type*} (b : β)
end Function
+section Pi
+
+variable {ι : Type*} {α : ι → Type*}
+/-- Given one value over a unique, we get a dependent function. -/
+def uniqueElim [Unique ι] (x : α (default : ι)) (i : ι) : α i := by
+ rw [Unique.eq_default i]
+ exact x
+
+@[simp]
+theorem uniqueElim_default {_ : Unique ι} (x : α (default : ι)) : uniqueElim x (default : ι) = x :=
+ rfl
+
+end Pi
+
-- TODO: Mario turned this off as a simp lemma in Std, wanting to profile it.
attribute [simp] eq_iff_true_of_subsingleton in
theorem Unique.bijective {A B} [Unique A] [Unique B] {f : A → B} : Function.Bijective f := by
Function.update_eq_const
and eq_const_of_subsingleton
(#7275)
Also golf Function.update_apply
.
@@ -204,10 +204,12 @@ instance Pi.uniqueOfIsEmpty [IsEmpty α] (β : α → Sort v) : Unique (∀ a,
default := isEmptyElim
uniq _ := funext isEmptyElim
-theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (f default) := by
- ext x
- rw [Subsingleton.elim x default]
- rfl
+theorem eq_const_of_subsingleton [Subsingleton α] (f : α → β) (a : α) :
+ f = Function.const α (f a) :=
+ funext fun x ↦ Subsingleton.elim x a ▸ rfl
+
+theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (f default) :=
+ eq_const_of_subsingleton ..
#align eq_const_of_unique eq_const_of_unique
theorem heq_const_of_unique [Unique α] {β : α → Sort v} (f : ∀ a, β a) :
I know that this is contrary to what we've done previously, but:
norm_num
/ ring
/ linarith
)(Oh
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -6,7 +6,7 @@ Authors: Johan Commelin
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
import Mathlib.Init.Data.Fin.Basic
-import Mathlib.Tactic.Common
+import Mathlib.Tactic.Inhabit
#align_import logic.unique from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.
The intent of this PR is to make autoImplicit
opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true
in the few files that rely on it.
That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.
I claim that many of the uses of autoImplicit
in these files are accidental; situations such as:
variables
are in scope, but pasting the lemma in the wrong sectionHaving set_option autoImplicit false
as the default prevents these types of mistake being made in the 90% of files where autoImplicit
s are not used at all, and causes them to be caught by CI during review.
I think there were various points during the port where we encouraged porters to delete the universes u v
lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.
A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18
as the no:dontcare:yes
vote ratio.
While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true
has been placed locally within a section, rather than at the top of the file.
@@ -43,6 +43,7 @@ for good definitional properties of the default term.
-/
+set_option autoImplicit true
universe u v w
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -82,7 +82,7 @@ equivalent by `Unique.Subsingleton.unique`.
See note [reducible non-instances]. -/
@[reducible]
-def uniqueOfSubsingleton {α : Sort _} [Subsingleton α] (a : α) : Unique α where
+def uniqueOfSubsingleton {α : Sort*} [Subsingleton α] (a : α) : Unique α where
default := a
uniq _ := Subsingleton.elim _ _
#align unique_of_subsingleton uniqueOfSubsingleton
@@ -242,7 +242,7 @@ protected def Injective.unique [Inhabited α] [Subsingleton β] (hf : Injective
#align function.injective.unique Function.Injective.unique
/-- If a constant function is surjective, then the codomain is a singleton. -/
-def Surjective.uniqueOfSurjectiveConst (α : Type _) {β : Type _} (b : β)
+def Surjective.uniqueOfSurjectiveConst (α : Type*) {β : Type*} (b : β)
(h : Function.Surjective (Function.const α b)) : Unique β :=
@uniqueOfSubsingleton _ (subsingleton_of_forall_eq b <| h.forall.mpr fun _ ↦ rfl) b
#align function.surjective.unique_of_surjective_const Function.Surjective.uniqueOfSurjectiveConst
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -148,7 +148,7 @@ theorem default_eq (a : α) : default = a :=
#align unique.default_eq Unique.default_eq
-- see Note [lower instance priority]
-instance (priority := 100) : Subsingleton α :=
+instance (priority := 100) instSubsingleton : Subsingleton α :=
subsingleton_of_forall_eq _ eq_default
theorem forall_iff {p : α → Prop} : (∀ a, p a) ↔ p default :=
@@ -2,17 +2,14 @@
Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-
-! This file was ported from Lean 3 source module logic.unique
-! leanprover-community/mathlib commit c4658a649d216f57e99621708b09dcb3dcccbd23
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
import Mathlib.Init.Data.Fin.Basic
import Mathlib.Tactic.Common
+#align_import logic.unique from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
+
/-!
# Types with a unique term
fix-comments.py
on all files.@@ -30,7 +30,7 @@ In other words, a type that is `Inhabited` and a `Subsingleton`.
would lead to loops in typeclass inference.
* `Function.Surjective.unique`: if the domain of a surjective function is `Unique`, then its
- codomain is `unique` as well.
+ codomain is `Unique` as well.
* `Function.Injective.subsingleton`: if the codomain of an injective function is `Subsingleton`,
then its domain is `Subsingleton` as well.
This makes a mathlib4 version of mathlib3's tactic.basic
, now called Mathlib.Tactic.Common
, which imports all tactics which do not have significant theory requirements, and then is imported all across the base of the hierarchy.
This ensures that all common tactics are available nearly everywhere in the library, rather than having to be imported one-by-one as you need them.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -11,7 +11,7 @@ Authors: Johan Commelin
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
import Mathlib.Init.Data.Fin.Basic
-import Mathlib.Tactic.Inhabit
+import Mathlib.Tactic.Common
/-!
# Types with a unique term
@@ -11,7 +11,7 @@ Authors: Johan Commelin
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
import Mathlib.Init.Data.Fin.Basic
-import Mathlib.Tactic.Common
+import Mathlib.Tactic.Inhabit
/-!
# Types with a unique term
@@ -11,7 +11,7 @@ Authors: Johan Commelin
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
import Mathlib.Init.Data.Fin.Basic
-import Mathlib.Tactic.Inhabit
+import Mathlib.Tactic.Common
/-!
# Types with a unique term
This PR fixes two things:
align
statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align
). This is often seen in the mathport output after ending calc
blocks.#align
statements. (This was needed for a script I wrote for #3630.)@@ -101,7 +101,6 @@ instance PUnit.unique : Unique PUnit.{u} where
@[simp, nolint simpNF]
theorem PUnit.default_eq_unit : (default : PUnit) = PUnit.unit :=
rfl
-
#align punit.default_eq_star PUnit.default_eq_unit
/-- Every provable proposition is unique, as all proofs are equal. -/
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)@@ -57,6 +57,9 @@ for good definitional properties of the default term. -/
structure Unique (α : Sort u) extends Inhabited α where
/-- In a `Unique` type, every term is equal to the default element (from `Inhabited`). -/
uniq : ∀ a : α, a = default
+#align unique Unique
+#align unique.ext_iff Unique.ext_iff
+#align unique.ext Unique.ext
attribute [class] Unique
-- The simplifier can already prove this using `eq_iff_true_of_subsingleton`
@@ -65,6 +68,7 @@ attribute [nolint simpNF] Unique.mk.injEq
theorem unique_iff_exists_unique (α : Sort u) : Nonempty (Unique α) ↔ ∃! _ : α, True :=
⟨fun ⟨u⟩ ↦ ⟨u.default, trivial, fun a _ ↦ u.uniq a⟩,
fun ⟨a, _, h⟩ ↦ ⟨⟨⟨a⟩, fun _ ↦ h _ trivial⟩⟩⟩
+#align unique_iff_exists_unique unique_iff_exists_unique
theorem unique_subtype_iff_exists_unique {α} (p : α → Prop) :
Nonempty (Unique (Subtype p)) ↔ ∃! a, p a :=
@@ -72,6 +76,7 @@ theorem unique_subtype_iff_exists_unique {α} (p : α → Prop) :
fun ⟨a, ha, he⟩ ↦ ⟨⟨⟨⟨a, ha⟩⟩, fun ⟨b, hb⟩ ↦ by
congr
exact he b hb⟩⟩⟩
+#align unique_subtype_iff_exists_unique unique_subtype_iff_exists_unique
/-- Given an explicit `a : α` with `Subsingleton α`, we can construct
a `Unique α` instance. This is a def because the typeclass search cannot
@@ -83,6 +88,7 @@ See note [reducible non-instances]. -/
def uniqueOfSubsingleton {α : Sort _} [Subsingleton α] (a : α) : Unique α where
default := a
uniq _ := Subsingleton.elim _ _
+#align unique_of_subsingleton uniqueOfSubsingleton
instance PUnit.unique : Unique PUnit.{u} where
default := PUnit.unit
@@ -102,12 +108,14 @@ theorem PUnit.default_eq_unit : (default : PUnit) = PUnit.unit :=
def uniqueProp {p : Prop} (h : p) : Unique.{0} p where
default := h
uniq _ := rfl
+#align unique_prop uniqueProp
instance : Unique True :=
uniqueProp trivial
theorem Fin.eq_zero : ∀ n : Fin 1, n = 0
| ⟨_, hn⟩ => Fin.eq_of_veq (Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ hn))
+#align fin.eq_zero Fin.eq_zero
instance {n : ℕ} : Inhabited (Fin n.succ) :=
⟨0⟩
@@ -118,6 +126,7 @@ instance inhabitedFinOneAdd (n : ℕ) : Inhabited (Fin (1 + n)) :=
@[simp]
theorem Fin.default_eq_zero (n : ℕ) : (default : Fin n.succ) = 0 :=
rfl
+#align fin.default_eq_zero Fin.default_eq_zero
instance Fin.unique : Unique (Fin 1) where
uniq := Fin.eq_zero
@@ -136,9 +145,11 @@ instance (priority := 100) : Inhabited α :=
theorem eq_default (a : α) : a = default :=
uniq _ a
+#align unique.eq_default Unique.eq_default
theorem default_eq (a : α) : default = a :=
(uniq _ a).symm
+#align unique.default_eq Unique.default_eq
-- see Note [lower instance priority]
instance (priority := 100) : Subsingleton α :=
@@ -146,15 +157,18 @@ instance (priority := 100) : Subsingleton α :=
theorem forall_iff {p : α → Prop} : (∀ a, p a) ↔ p default :=
⟨fun h ↦ h _, fun h x ↦ by rwa [Unique.eq_default x]⟩
+#align unique.forall_iff Unique.forall_iff
theorem exists_iff {p : α → Prop} : Exists p ↔ p default :=
⟨fun ⟨a, ha⟩ ↦ eq_default a ▸ ha, Exists.intro default⟩
+#align unique.exists_iff Unique.exists_iff
end
@[ext]
protected theorem subsingleton_unique' : ∀ h₁ h₂ : Unique α, h₁ = h₂
| ⟨⟨x⟩, h⟩, ⟨⟨y⟩, _⟩ => by congr; rw [h x, h y]
+#align unique.subsingleton_unique' Unique.subsingleton_unique'
instance subsingleton_unique : Subsingleton (Unique α) :=
⟨Unique.subsingleton_unique'⟩
@@ -164,6 +178,7 @@ a loop in the class inheritance graph. -/
@[reducible]
def mk' (α : Sort u) [h₁ : Inhabited α] [Subsingleton α] : Unique α :=
{ h₁ with uniq := fun _ ↦ Subsingleton.elim _ _ }
+#align unique.mk' Unique.mk'
end Unique
@@ -171,15 +186,18 @@ theorem unique_iff_subsingleton_and_nonempty (α : Sort u) :
Nonempty (Unique α) ↔ Subsingleton α ∧ Nonempty α :=
⟨fun ⟨u⟩ ↦ by constructor <;> exact inferInstance,
fun ⟨hs, hn⟩ ↦ ⟨by inhabit α; exact Unique.mk' α⟩⟩
+#align unique_iff_subsingleton_and_nonempty unique_iff_subsingleton_and_nonempty
@[simp]
theorem Pi.default_def {β : α → Sort v} [∀ a, Inhabited (β a)] :
@default (∀ a, β a) _ = fun a : α ↦ @default (β a) _ :=
rfl
+#align pi.default_def Pi.default_def
theorem Pi.default_apply {β : α → Sort v} [∀ a, Inhabited (β a)] (a : α) :
@default (∀ a, β a) _ a = default :=
rfl
+#align pi.default_apply Pi.default_apply
instance Pi.unique {β : α → Sort v} [∀ a, Unique (β a)] : Unique (∀ a, β a) where
uniq := fun _ ↦ funext fun _ ↦ Unique.eq_default _
@@ -193,10 +211,12 @@ theorem eq_const_of_unique [Unique α] (f : α → β) : f = Function.const α (
ext x
rw [Subsingleton.elim x default]
rfl
+#align eq_const_of_unique eq_const_of_unique
theorem heq_const_of_unique [Unique α] {β : α → Sort v} (f : ∀ a, β a) :
HEq f (Function.const α (f default)) :=
(Function.hfunext rfl) fun i _ _ ↦ by rw [Subsingleton.elim i default]; rfl
+#align heq_const_of_unique heq_const_of_unique
namespace Function
@@ -206,25 +226,30 @@ variable {f : α → β}
is a subsingleton as well. -/
protected theorem Injective.subsingleton (hf : Injective f) [Subsingleton β] : Subsingleton α :=
⟨fun _ _ ↦ hf <| Subsingleton.elim _ _⟩
+#align function.injective.subsingleton Function.Injective.subsingleton
/-- If the domain of a surjective function is a subsingleton, then the codomain is a subsingleton as
well. -/
protected theorem Surjective.subsingleton [Subsingleton α] (hf : Surjective f) : Subsingleton β :=
⟨hf.forall₂.2 fun x y ↦ congr_arg f <| Subsingleton.elim x y⟩
+#align function.surjective.subsingleton Function.Surjective.subsingleton
/-- If the domain of a surjective function is a singleton,
then the codomain is a singleton as well. -/
protected def Surjective.unique (f : α → β) (hf : Surjective f) [Unique.{u} α] : Unique β :=
@Unique.mk' _ ⟨f default⟩ hf.subsingleton
+#align function.surjective.unique Function.Surjective.unique
/-- If `α` is inhabited and admits an injective map to a subsingleton type, then `α` is `Unique`. -/
protected def Injective.unique [Inhabited α] [Subsingleton β] (hf : Injective f) : Unique α :=
@Unique.mk' _ _ hf.subsingleton
+#align function.injective.unique Function.Injective.unique
/-- If a constant function is surjective, then the codomain is a singleton. -/
def Surjective.uniqueOfSurjectiveConst (α : Type _) {β : Type _} (b : β)
(h : Function.Surjective (Function.const α b)) : Unique β :=
@uniqueOfSubsingleton _ (subsingleton_of_forall_eq b <| h.forall.mpr fun _ ↦ rfl) b
+#align function.surjective.unique_of_surjective_const Function.Surjective.uniqueOfSurjectiveConst
end Function
@@ -233,6 +258,7 @@ attribute [simp] eq_iff_true_of_subsingleton in
theorem Unique.bijective {A B} [Unique A] [Unique B] {f : A → B} : Function.Bijective f := by
rw [Function.bijective_iff_has_inverse]
refine' ⟨default, _, _⟩ <;> intro x <;> simp
+#align unique.bijective Unique.bijective
namespace Option
Fix a lot of wrong casing mostly in the docstrings but also sometimes in def/theorem names. E.g. fin 2 --> Fin 2
, add_monoid_hom --> AddMonoidHom
Remove \n
from to_additive
docstrings that were inserted by mathport.
Move files and directories with Gcd
and Smul
to GCD
and SMul
@@ -236,7 +236,7 @@ theorem Unique.bijective {A B} [Unique A] [Unique B] {f : A → B} : Function.Bi
namespace Option
-/-- `option α` is a `subsingleton` if and only if `α` is empty. -/
+/-- `Option α` is a `Subsingleton` if and only if `α` is empty. -/
theorem subsingleton_iff_isEmpty {α : Type u} : Subsingleton (Option α) ↔ IsEmpty α :=
⟨fun h ↦ ⟨fun x ↦ Option.noConfusion <| @Subsingleton.elim _ h x none⟩,
fun h ↦ ⟨fun x y ↦
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) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
+
+! This file was ported from Lean 3 source module logic.unique
+! leanprover-community/mathlib commit c4658a649d216f57e99621708b09dcb3dcccbd23
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
All dependencies are ported!