logic.nontrivial
⟷
Mathlib.Logic.Nontrivial.Defs
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)
@@ -178,13 +178,10 @@ end pi
instance function.nontrivial [h : nonempty α] [nontrivial β] : nontrivial (α → β) :=
h.elim $ λ a, pi.nontrivial_at a
-mk_simp_attribute nontriviality "Simp lemmas for `nontriviality` tactic"
-
+@[nontriviality]
protected lemma subsingleton.le [preorder α] [subsingleton α] (x y : α) : x ≤ y :=
le_of_eq (subsingleton.elim x y)
-attribute [nontriviality] eq_iff_true_of_subsingleton subsingleton.le
-
namespace bool
instance : nontrivial bool := ⟨⟨tt,ff, tt_eq_ff_eq_false⟩⟩
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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
@@ -166,7 +166,7 @@ theorem not_subsingleton (α) [h : Nontrivial α] : ¬Subsingleton α :=
#print subsingleton_or_nontrivial /-
/-- A type is either a subsingleton or nontrivial. -/
theorem subsingleton_or_nontrivial (α : Type _) : Subsingleton α ∨ Nontrivial α := by
- rw [← not_nontrivial_iff_subsingleton, or_comm']; exact Classical.em _
+ rw [← not_nontrivial_iff_subsingleton, or_comm]; exact Classical.em _
#align subsingleton_or_nontrivial subsingleton_or_nontrivial
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -54,7 +54,7 @@ protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α)
by
rcases exists_pair_ne α with ⟨y, y', h⟩
by_cases hx : x = y
- · rw [← hx] at h
+ · rw [← hx] at h
exact ⟨y', h.symm⟩
· exact ⟨y, Ne.symm hx⟩
#align decidable.exists_ne Decidable.exists_ne
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -61,7 +61,7 @@ protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α)
-/
#print exists_ne /-
-theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := by classical
+theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := by classical exact Decidable.exists_ne x
#align exists_ne exists_ne
-/
@@ -237,7 +237,8 @@ variable {I : Type _} {f : I → Type _}
#print Pi.nontrivial_at /-
/-- A pi type is nontrivial if it's nonempty everywhere and nontrivial somewhere. -/
theorem nontrivial_at (i' : I) [inst : ∀ i, Nonempty (f i)] [Nontrivial (f i')] :
- Nontrivial (∀ i : I, f i) := by classical
+ Nontrivial (∀ i : I, f i) := by
+ classical exact (Function.update_injective (fun i => Classical.choice (inst i)) i').Nontrivial
#align pi.nontrivial_at Pi.nontrivial_at
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -61,7 +61,7 @@ protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α)
-/
#print exists_ne /-
-theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := by classical exact Decidable.exists_ne x
+theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := by classical
#align exists_ne exists_ne
-/
@@ -237,8 +237,7 @@ variable {I : Type _} {f : I → Type _}
#print Pi.nontrivial_at /-
/-- A pi type is nontrivial if it's nonempty everywhere and nontrivial somewhere. -/
theorem nontrivial_at (i' : I) [inst : ∀ i, Nonempty (f i)] [Nontrivial (f i')] :
- Nontrivial (∀ i : I, f i) := by
- classical exact (Function.update_injective (fun i => Classical.choice (inst i)) i').Nontrivial
+ Nontrivial (∀ i : I, f i) := by classical
#align pi.nontrivial_at Pi.nontrivial_at
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,10 +3,10 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
-import Mathbin.Data.Prod.Basic
-import Mathbin.Data.Subtype
-import Mathbin.Logic.Function.Basic
-import Mathbin.Logic.Unique
+import Data.Prod.Basic
+import Data.Subtype
+import Logic.Function.Basic
+import Logic.Unique
#align_import logic.nontrivial from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,17 +2,14 @@
Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module logic.nontrivial
-! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Prod.Basic
import Mathbin.Data.Subtype
import Mathbin.Logic.Function.Basic
import Mathbin.Logic.Unique
+#align_import logic.nontrivial from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
+
/-!
# Nontrivial types
mathlib commit https://github.com/leanprover-community/mathlib/commit/728ef9dbb281241906f25cbeb30f90d83e0bb451
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
! This file was ported from Lean 3 source module logic.nontrivial
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
+! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -264,18 +264,13 @@ instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α
#align function.nontrivial Function.nontrivial
-/
--- PLEASE REPORT THIS TO MATHPORT DEVS, THIS SHOULD NOT HAPPEN.
--- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
-/-- Simp lemmas for `nontriviality` tactic -/ register_simp_attr nontriviality
-
#print Subsingleton.le /-
+@[nontriviality]
protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x ≤ y :=
le_of_eq (Subsingleton.elim x y)
#align subsingleton.le Subsingleton.le
-/
-attribute [nontriviality] eq_iff_true_of_subsingleton Subsingleton.le
-
namespace Bool
instance : Nontrivial Bool :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -186,12 +186,14 @@ instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by inhabit
#align option.nontrivial Option.nontrivial
-/
+#print Function.Injective.nontrivial /-
/-- Pushforward a `nontrivial` instance along an injective function. -/
protected theorem Function.Injective.nontrivial [Nontrivial α] {f : α → β}
(hf : Function.Injective f) : Nontrivial β :=
let ⟨x, y, h⟩ := exists_pair_ne α
⟨⟨f x, f y, hf.Ne h⟩⟩
#align function.injective.nontrivial Function.Injective.nontrivial
+-/
#print Function.Surjective.nontrivial /-
/-- Pullback a `nontrivial` instance along a surjective function. -/
@@ -206,6 +208,7 @@ protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
#align function.surjective.nontrivial Function.Surjective.nontrivial
-/
+#print Function.Injective.exists_ne /-
/-- An injective function from a nontrivial type has an argument at
which it does not take a given value. -/
protected theorem Function.Injective.exists_ne [Nontrivial α] {f : α → β}
@@ -216,6 +219,7 @@ protected theorem Function.Injective.exists_ne [Nontrivial α] {f : α → β}
· exact ⟨x₁, (hf.ne_iff' h).2 hx⟩
· exact ⟨x₂, h⟩
#align function.injective.exists_ne Function.Injective.exists_ne
+-/
#print nontrivial_prod_right /-
instance nontrivial_prod_right [Nonempty α] [Nontrivial β] : Nontrivial (α × β) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/31c24aa72e7b3e5ed97a8412470e904f82b81004
@@ -260,11 +260,8 @@ instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α
#align function.nontrivial Function.nontrivial
-/
-/- failed to parenthesize: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
-[PrettyPrinter.parenthesize.input] (Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr
- [(Command.docComment "/--" "Simp lemmas for `nontriviality` tactic -/")]
- "register_simp_attr"
- `nontriviality)-/-- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
+-- PLEASE REPORT THIS TO MATHPORT DEVS, THIS SHOULD NOT HAPPEN.
+-- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
/-- Simp lemmas for `nontriviality` tactic -/ register_simp_attr nontriviality
#print Subsingleton.le /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -57,7 +57,7 @@ protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α)
by
rcases exists_pair_ne α with ⟨y, y', h⟩
by_cases hx : x = y
- · rw [← hx] at h
+ · rw [← hx] at h
exact ⟨y', h.symm⟩
· exact ⟨y, Ne.symm hx⟩
#align decidable.exists_ne Decidable.exists_ne
@@ -104,7 +104,7 @@ theorem nontrivial_iff_exists_ne (x : α) : Nontrivial α ↔ ∃ y, y ≠ x :=
#print Subtype.nontrivial_iff_exists_ne /-
theorem Subtype.nontrivial_iff_exists_ne (p : α → Prop) (x : Subtype p) :
- Nontrivial (Subtype p) ↔ ∃ (y : α)(hy : p y), y ≠ x := by
+ Nontrivial (Subtype p) ↔ ∃ (y : α) (hy : p y), y ≠ x := by
simp only [nontrivial_iff_exists_ne x, Subtype.exists, Ne.def, Subtype.ext_iff, Subtype.coe_mk]
#align subtype.nontrivial_iff_exists_ne Subtype.nontrivial_iff_exists_ne
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -29,7 +29,7 @@ We introduce a typeclass `nontrivial` formalizing this property.
variable {α : Type _} {β : Type _}
-open Classical
+open scoped Classical
#print Nontrivial /-
/-- Predicate typeclass for expressing that a type is not reduced to a single element. In rings,
@@ -75,20 +75,26 @@ theorem nontrivial_of_ne (x y : α) (h : x ≠ y) : Nontrivial α :=
#align nontrivial_of_ne nontrivial_of_ne
-/
+#print nontrivial_of_lt /-
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
⟨⟨x, y, ne_of_lt h⟩⟩
#align nontrivial_of_lt nontrivial_of_lt
+-/
+#print exists_pair_lt /-
theorem exists_pair_lt (α : Type _) [Nontrivial α] [LinearOrder α] : ∃ x y : α, x < y :=
by
rcases exists_pair_ne α with ⟨x, y, hxy⟩
cases lt_or_gt_of_ne hxy <;> exact ⟨_, _, h⟩
#align exists_pair_lt exists_pair_lt
+-/
+#print nontrivial_iff_lt /-
theorem nontrivial_iff_lt [LinearOrder α] : Nontrivial α ↔ ∃ x y : α, x < y :=
⟨fun h => @exists_pair_lt α h _, fun ⟨x, y, h⟩ => nontrivial_of_lt x y h⟩
#align nontrivial_iff_lt nontrivial_iff_lt
+-/
#print nontrivial_iff_exists_ne /-
theorem nontrivial_iff_exists_ne (x : α) : Nontrivial α ↔ ∃ y, y ≠ x :=
@@ -261,9 +267,11 @@ instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α
`nontriviality)-/-- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
/-- Simp lemmas for `nontriviality` tactic -/ register_simp_attr nontriviality
+#print Subsingleton.le /-
protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x ≤ y :=
le_of_eq (Subsingleton.elim x y)
#align subsingleton.le Subsingleton.le
+-/
attribute [nontriviality] eq_iff_true_of_subsingleton Subsingleton.le
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -75,35 +75,17 @@ theorem nontrivial_of_ne (x y : α) (h : x ≠ y) : Nontrivial α :=
#align nontrivial_of_ne nontrivial_of_ne
-/
-/- warning: nontrivial_of_lt -> nontrivial_of_lt is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] (x : α) (y : α), (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) x y) -> (Nontrivial.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] (x : α) (y : α), (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x y) -> (Nontrivial.{u1} α)
-Case conversion may be inaccurate. Consider using '#align nontrivial_of_lt nontrivial_of_ltₓ'. -/
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
⟨⟨x, y, ne_of_lt h⟩⟩
#align nontrivial_of_lt nontrivial_of_lt
-/- warning: exists_pair_lt -> exists_pair_lt is a dubious translation:
-lean 3 declaration is
- forall (α : Type.{u1}) [_inst_1 : Nontrivial.{u1} α] [_inst_2 : LinearOrder.{u1} α], Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_2))) x y))
-but is expected to have type
- forall (α : Type.{u1}) [_inst_1 : Nontrivial.{u1} α] [_inst_2 : LinearOrder.{u1} α], Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_2))) x y))
-Case conversion may be inaccurate. Consider using '#align exists_pair_lt exists_pair_ltₓ'. -/
theorem exists_pair_lt (α : Type _) [Nontrivial α] [LinearOrder α] : ∃ x y : α, x < y :=
by
rcases exists_pair_ne α with ⟨x, y, hxy⟩
cases lt_or_gt_of_ne hxy <;> exact ⟨_, _, h⟩
#align exists_pair_lt exists_pair_lt
-/- warning: nontrivial_iff_lt -> nontrivial_iff_lt is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], Iff (Nontrivial.{u1} α) (Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_1))) x y)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], Iff (Nontrivial.{u1} α) (Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_1))) x y)))
-Case conversion may be inaccurate. Consider using '#align nontrivial_iff_lt nontrivial_iff_ltₓ'. -/
theorem nontrivial_iff_lt [LinearOrder α] : Nontrivial α ↔ ∃ x y : α, x < y :=
⟨fun h => @exists_pair_lt α h _, fun ⟨x, y, h⟩ => nontrivial_of_lt x y h⟩
#align nontrivial_iff_lt nontrivial_iff_lt
@@ -198,12 +180,6 @@ instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by inhabit
#align option.nontrivial Option.nontrivial
-/
-/- warning: function.injective.nontrivial -> Function.Injective.nontrivial is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Nontrivial.{u1} α] {f : α -> β}, (Function.Injective.{succ u1, succ u2} α β f) -> (Nontrivial.{u2} β)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Nontrivial.{u2} α] {f : α -> β}, (Function.Injective.{succ u2, succ u1} α β f) -> (Nontrivial.{u1} β)
-Case conversion may be inaccurate. Consider using '#align function.injective.nontrivial Function.Injective.nontrivialₓ'. -/
/-- Pushforward a `nontrivial` instance along an injective function. -/
protected theorem Function.Injective.nontrivial [Nontrivial α] {f : α → β}
(hf : Function.Injective f) : Nontrivial β :=
@@ -224,12 +200,6 @@ protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
#align function.surjective.nontrivial Function.Surjective.nontrivial
-/
-/- warning: function.injective.exists_ne -> Function.Injective.exists_ne is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Nontrivial.{u1} α] {f : α -> β}, (Function.Injective.{succ u1, succ u2} α β f) -> (forall (y : β), Exists.{succ u1} α (fun (x : α) => Ne.{succ u2} β (f x) y))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Nontrivial.{u2} α] {f : α -> β}, (Function.Injective.{succ u2, succ u1} α β f) -> (forall (y : β), Exists.{succ u2} α (fun (x : α) => Ne.{succ u1} β (f x) y))
-Case conversion may be inaccurate. Consider using '#align function.injective.exists_ne Function.Injective.exists_neₓ'. -/
/-- An injective function from a nontrivial type has an argument at
which it does not take a given value. -/
protected theorem Function.Injective.exists_ne [Nontrivial α] {f : α → β}
@@ -291,12 +261,6 @@ instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α
`nontriviality)-/-- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
/-- Simp lemmas for `nontriviality` tactic -/ register_simp_attr nontriviality
-/- warning: subsingleton.le -> Subsingleton.le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : Subsingleton.{succ u1} α] (x : α) (y : α), LE.le.{u1} α (Preorder.toHasLe.{u1} α _inst_1) x y
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : Subsingleton.{succ u1} α] (x : α) (y : α), LE.le.{u1} α (Preorder.toLE.{u1} α _inst_1) x y
-Case conversion may be inaccurate. Consider using '#align subsingleton.le Subsingleton.leₓ'. -/
protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x ≤ y :=
le_of_eq (Subsingleton.elim x y)
#align subsingleton.le Subsingleton.le
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -155,18 +155,13 @@ noncomputable def nontrivialPSumUnique (α : Type _) [Inhabited α] :
#print subsingleton_iff /-
theorem subsingleton_iff : Subsingleton α ↔ ∀ x y : α, x = y :=
- ⟨by
- intro h
- exact Subsingleton.elim, fun h => ⟨h⟩⟩
+ ⟨by intro h; exact Subsingleton.elim, fun h => ⟨h⟩⟩
#align subsingleton_iff subsingleton_iff
-/
#print not_nontrivial_iff_subsingleton /-
-theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α :=
- by
- rw [nontrivial_iff, subsingleton_iff]
- push_neg
- rfl
+theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α := by
+ rw [nontrivial_iff, subsingleton_iff]; push_neg; rfl
#align not_nontrivial_iff_subsingleton not_nontrivial_iff_subsingleton
-/
@@ -185,10 +180,8 @@ theorem not_subsingleton (α) [h : Nontrivial α] : ¬Subsingleton α :=
#print subsingleton_or_nontrivial /-
/-- A type is either a subsingleton or nontrivial. -/
-theorem subsingleton_or_nontrivial (α : Type _) : Subsingleton α ∨ Nontrivial α :=
- by
- rw [← not_nontrivial_iff_subsingleton, or_comm']
- exact Classical.em _
+theorem subsingleton_or_nontrivial (α : Type _) : Subsingleton α ∨ Nontrivial α := by
+ rw [← not_nontrivial_iff_subsingleton, or_comm']; exact Classical.em _
#align subsingleton_or_nontrivial subsingleton_or_nontrivial
-/
@@ -200,9 +193,7 @@ theorem false_of_nontrivial_of_subsingleton (α : Type _) [Nontrivial α] [Subsi
-/
#print Option.nontrivial /-
-instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) :=
- by
- inhabit α
+instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by inhabit α;
use none, some default
#align option.nontrivial Option.nontrivial
-/
@@ -228,9 +219,7 @@ protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
rcases exists_pair_ne β with ⟨x, y, h⟩
rcases hf x with ⟨x', hx'⟩
rcases hf y with ⟨y', hy'⟩
- have : x' ≠ y' := by
- contrapose! h
- rw [← hx', ← hy', h]
+ have : x' ≠ y' := by contrapose! h; rw [← hx', ← hy', h]
exact ⟨⟨x', y', this⟩⟩
#align function.surjective.nontrivial Function.Surjective.nontrivial
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -75,26 +75,38 @@ theorem nontrivial_of_ne (x y : α) (h : x ≠ y) : Nontrivial α :=
#align nontrivial_of_ne nontrivial_of_ne
-/
-#print nontrivial_of_lt /-
+/- warning: nontrivial_of_lt -> nontrivial_of_lt is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] (x : α) (y : α), (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) x y) -> (Nontrivial.{u1} α)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] (x : α) (y : α), (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x y) -> (Nontrivial.{u1} α)
+Case conversion may be inaccurate. Consider using '#align nontrivial_of_lt nontrivial_of_ltₓ'. -/
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
⟨⟨x, y, ne_of_lt h⟩⟩
#align nontrivial_of_lt nontrivial_of_lt
--/
-#print exists_pair_lt /-
+/- warning: exists_pair_lt -> exists_pair_lt is a dubious translation:
+lean 3 declaration is
+ forall (α : Type.{u1}) [_inst_1 : Nontrivial.{u1} α] [_inst_2 : LinearOrder.{u1} α], Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_2))) x y))
+but is expected to have type
+ forall (α : Type.{u1}) [_inst_1 : Nontrivial.{u1} α] [_inst_2 : LinearOrder.{u1} α], Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_2))) x y))
+Case conversion may be inaccurate. Consider using '#align exists_pair_lt exists_pair_ltₓ'. -/
theorem exists_pair_lt (α : Type _) [Nontrivial α] [LinearOrder α] : ∃ x y : α, x < y :=
by
rcases exists_pair_ne α with ⟨x, y, hxy⟩
cases lt_or_gt_of_ne hxy <;> exact ⟨_, _, h⟩
#align exists_pair_lt exists_pair_lt
--/
-#print nontrivial_iff_lt /-
+/- warning: nontrivial_iff_lt -> nontrivial_iff_lt is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], Iff (Nontrivial.{u1} α) (Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_1))) x y)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], Iff (Nontrivial.{u1} α) (Exists.{succ u1} α (fun (x : α) => Exists.{succ u1} α (fun (y : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (LinearOrder.toPartialOrder.{u1} α _inst_1))) x y)))
+Case conversion may be inaccurate. Consider using '#align nontrivial_iff_lt nontrivial_iff_ltₓ'. -/
theorem nontrivial_iff_lt [LinearOrder α] : Nontrivial α ↔ ∃ x y : α, x < y :=
⟨fun h => @exists_pair_lt α h _, fun ⟨x, y, h⟩ => nontrivial_of_lt x y h⟩
#align nontrivial_iff_lt nontrivial_iff_lt
--/
#print nontrivial_iff_exists_ne /-
theorem nontrivial_iff_exists_ne (x : α) : Nontrivial α ↔ ∃ y, y ≠ x :=
@@ -290,11 +302,15 @@ instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α
`nontriviality)-/-- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
/-- Simp lemmas for `nontriviality` tactic -/ register_simp_attr nontriviality
-#print Subsingleton.le /-
+/- warning: subsingleton.le -> Subsingleton.le is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : Subsingleton.{succ u1} α] (x : α) (y : α), LE.le.{u1} α (Preorder.toHasLe.{u1} α _inst_1) x y
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : Subsingleton.{succ u1} α] (x : α) (y : α), LE.le.{u1} α (Preorder.toLE.{u1} α _inst_1) x y
+Case conversion may be inaccurate. Consider using '#align subsingleton.le Subsingleton.leₓ'. -/
protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x ≤ y :=
le_of_eq (Subsingleton.elim x y)
#align subsingleton.le Subsingleton.le
--/
attribute [nontriviality] eq_iff_true_of_subsingleton Subsingleton.le
mathlib commit https://github.com/leanprover-community/mathlib/commit/09079525fd01b3dda35e96adaa08d2f943e1648c
@@ -124,7 +124,7 @@ instance (priority := 500) Nontrivial.to_nonempty [Nontrivial α] : Nonempty α
#align nontrivial.to_nonempty Nontrivial.to_nonempty
-/
-attribute [instance] instNonempty
+attribute [instance 500] instNonempty
#print nontrivialPSumUnique /-
/-- An inhabited type is either nontrivial, or has a unique element. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -81,7 +81,7 @@ theorem subsingleton_iff : Subsingleton α ↔ ∀ x y : α, x = y :=
#align subsingleton_iff subsingleton_iff
theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α := by
- simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, Classical.not_not]
+ simp only [nontrivial_iff, subsingleton_iff, not_exists, Classical.not_not]
#align not_nontrivial_iff_subsingleton not_nontrivial_iff_subsingleton
theorem not_nontrivial (α) [Subsingleton α] : ¬Nontrivial α :=
@@ -40,7 +40,7 @@ theorem nontrivial_iff_lt [LinearOrder α] : Nontrivial α ↔ ∃ x y : α, x <
theorem Subtype.nontrivial_iff_exists_ne (p : α → Prop) (x : Subtype p) :
Nontrivial (Subtype p) ↔ ∃ (y : α) (_ : p y), y ≠ x := by
- simp only [_root_.nontrivial_iff_exists_ne x, Subtype.exists, Ne.def, Subtype.ext_iff]
+ simp only [_root_.nontrivial_iff_exists_ne x, Subtype.exists, Ne, Subtype.ext_iff]
#align subtype.nontrivial_iff_exists_ne Subtype.nontrivial_iff_exists_ne
/-- An inhabited type is either nontrivial, or has a unique element. -/
open Classical
(#11199)
We remove all but one open Classical
s, instead preferring to use open scoped Classical
. The only real side-effect this led to is moving a couple declarations to use Exists.choose
instead of Classical.choose
.
The first few commits are explicitly labelled regex replaces for ease of review.
@@ -24,7 +24,7 @@ Basic results about nontrivial types are in `Mathlib.Logic.Nontrivial.Basic`.
variable {α : Type*} {β : Type*}
-open Classical
+open scoped Classical
/-- Predicate typeclass for expressing that a type is not reduced to a single element. In rings,
this is equivalent to `0 ≠ 1`. In vector spaces, this is equivalent to positive dimension. -/
@@ -81,7 +81,7 @@ theorem subsingleton_iff : Subsingleton α ↔ ∀ x y : α, x = y :=
#align subsingleton_iff subsingleton_iff
theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α := by
- simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, not_not]
+ simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, Classical.not_not]
#align not_nontrivial_iff_subsingleton not_nontrivial_iff_subsingleton
theorem not_nontrivial (α) [Subsingleton α] : ¬Nontrivial α :=
@@ -93,7 +93,7 @@ theorem not_subsingleton (α) [Nontrivial α] : ¬Subsingleton α :=
#align not_subsingleton not_subsingleton
lemma not_subsingleton_iff_nontrivial : ¬ Subsingleton α ↔ Nontrivial α := by
- rw [← not_nontrivial_iff_subsingleton, not_not]
+ rw [← not_nontrivial_iff_subsingleton, Classical.not_not]
/-- A type is either a subsingleton or nontrivial. -/
theorem subsingleton_or_nontrivial (α : Type*) : Subsingleton α ∨ Nontrivial α := by
open Classical
(#11199)
We remove all but one open Classical
s, instead preferring to use open scoped Classical
. The only real side-effect this led to is moving a couple declarations to use Exists.choose
instead of Classical.choose
.
The first few commits are explicitly labelled regex replaces for ease of review.
@@ -22,7 +22,7 @@ Results about `Nontrivial`.
variable {α : Type*} {β : Type*}
-open Classical
+open scoped Classical
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -120,6 +120,6 @@ protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
namespace Bool
instance : Nontrivial Bool :=
- ⟨⟨true, false, fun .⟩⟩
+ ⟨⟨true, false, nofun⟩⟩
end Bool
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -57,7 +57,7 @@ noncomputable def nontrivialPSumUnique (α : Type*) [Inhabited α] :
instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by
inhabit α
- exact ⟨none, some default, fun .⟩
+ exact ⟨none, some default, nofun⟩
/-- Pushforward a `Nontrivial` instance along an injective function. -/
protected theorem Function.Injective.nontrivial [Nontrivial α] {f : α → β}
@@ -3,6 +3,7 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
+import Mathlib.Init.Logic
import Mathlib.Init.Function
import Mathlib.Tactic.TypeStar
We are not that far from the point that Algebra/Group/Defs
depends on nothing significant besides simps
and to_additive
.
This removes from Mathlib.Algebra.Group.Defs
the dependencies on
Mathlib.Tactic.Basic
(which is a grab-bag of random stuff)Mathlib.Init.Algebra.Classes
(which is ancient and half-baked)Mathlib.Logic.Function.Basic
(not particularly important, but it is barely used in this file)The goal is to avoid all unnecessary imports to set up the definitions of basic algebraic structures.
We also separate out Mathlib.Tactic.TypeStar
and Mathlib.Tactic.Lemma
as prerequisites to Mathlib.Tactic.Basic
, but which can be imported separately when the rest of Mathlib.Tactic.Basic
is not needed.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
import Mathlib.Init.Function
+import Mathlib.Tactic.TypeStar
#align_import logic.nontrivial from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
@@ -90,6 +90,9 @@ theorem not_subsingleton (α) [Nontrivial α] : ¬Subsingleton α :=
fun _ => not_nontrivial _ ‹_›
#align not_subsingleton not_subsingleton
+lemma not_subsingleton_iff_nontrivial : ¬ Subsingleton α ↔ Nontrivial α := by
+ rw [← not_nontrivial_iff_subsingleton, not_not]
+
/-- A type is either a subsingleton or nontrivial. -/
theorem subsingleton_or_nontrivial (α : Type*) : Subsingleton α ∨ Nontrivial α := by
rw [← not_nontrivial_iff_subsingleton, or_comm]
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>
@@ -3,6 +3,7 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
+import Mathlib.Init.Order.Defs
import Mathlib.Logic.Nontrivial.Defs
import Mathlib.Tactic.Attr.Register
import Mathlib.Data.Prod.Basic
@@ -3,7 +3,7 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
-import Mathlib.Logic.Basic
+import Mathlib.Init.Function
#align_import logic.nontrivial from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
@@ -48,9 +48,7 @@ protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α)
· exact ⟨y, Ne.symm hx⟩
#align decidable.exists_ne Decidable.exists_ne
-
-theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := by
- letI := Classical.decEq α; exact Decidable.exists_ne x
+theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := Decidable.exists_ne x
#align exists_ne exists_ne
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
@@ -3,11 +3,7 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
-import Mathlib.Tactic.Attr.Register
-import Mathlib.Data.Prod.Basic
-import Mathlib.Data.Subtype
-import Mathlib.Logic.Function.Basic
-import Mathlib.Logic.Unique
+import Mathlib.Logic.Basic
#align_import logic.nontrivial from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
@@ -19,6 +15,8 @@ A type is *nontrivial* if it contains at least two elements. This is useful in p
(where it is equivalent to the fact that the dimension is positive).
We introduce a typeclass `Nontrivial` formalizing this property.
+
+Basic results about nontrivial types are in `Mathlib.Logic.Nontrivial.Basic`.
-/
@@ -60,29 +58,10 @@ theorem nontrivial_of_ne (x y : α) (h : x ≠ y) : Nontrivial α :=
⟨⟨x, y, h⟩⟩
#align nontrivial_of_ne nontrivial_of_ne
--- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
-theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
- ⟨⟨x, y, ne_of_lt h⟩⟩
-#align nontrivial_of_lt nontrivial_of_lt
-
-theorem exists_pair_lt (α : Type*) [Nontrivial α] [LinearOrder α] : ∃ x y : α, x < y := by
- rcases exists_pair_ne α with ⟨x, y, hxy⟩
- cases lt_or_gt_of_ne hxy <;> exact ⟨_, _, ‹_›⟩
-#align exists_pair_lt exists_pair_lt
-
-theorem nontrivial_iff_lt [LinearOrder α] : Nontrivial α ↔ ∃ x y : α, x < y :=
- ⟨fun h ↦ @exists_pair_lt α h _, fun ⟨x, y, h⟩ ↦ nontrivial_of_lt x y h⟩
-#align nontrivial_iff_lt nontrivial_iff_lt
-
theorem nontrivial_iff_exists_ne (x : α) : Nontrivial α ↔ ∃ y, y ≠ x :=
⟨fun h ↦ @exists_ne α h x, fun ⟨_, hy⟩ ↦ nontrivial_of_ne _ _ hy⟩
#align nontrivial_iff_exists_ne nontrivial_iff_exists_ne
-theorem Subtype.nontrivial_iff_exists_ne (p : α → Prop) (x : Subtype p) :
- Nontrivial (Subtype p) ↔ ∃ (y : α) (_ : p y), y ≠ x := by
- simp only [_root_.nontrivial_iff_exists_ne x, Subtype.exists, Ne.def, Subtype.ext_iff]
-#align subtype.nontrivial_iff_exists_ne Subtype.nontrivial_iff_exists_ne
-
instance : Nontrivial Prop :=
⟨⟨True, False, true_ne_false⟩⟩
@@ -95,18 +74,6 @@ instance (priority := 500) Nontrivial.to_nonempty [Nontrivial α] : Nonempty α
let ⟨x, _⟩ := _root_.exists_pair_ne α
⟨x⟩
-/-- An inhabited type is either nontrivial, or has a unique element. -/
-noncomputable def nontrivialPSumUnique (α : Type*) [Inhabited α] :
- PSum (Nontrivial α) (Unique α) :=
- if h : Nontrivial α then PSum.inl h
- else
- PSum.inr
- { default := default,
- uniq := fun x : α ↦ by
- by_contra H
- exact h ⟨_, _, H⟩ }
-#align nontrivial_psum_unique nontrivialPSumUnique
-
theorem subsingleton_iff : Subsingleton α ↔ ∀ x y : α, x = y :=
⟨by
intro h
@@ -135,17 +102,6 @@ theorem false_of_nontrivial_of_subsingleton (α : Type*) [Nontrivial α] [Subsin
not_nontrivial _ ‹_›
#align false_of_nontrivial_of_subsingleton false_of_nontrivial_of_subsingleton
-instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by
- inhabit α
- exact ⟨none, some default, fun .⟩
-
-/-- Pushforward a `Nontrivial` instance along an injective function. -/
-protected theorem Function.Injective.nontrivial [Nontrivial α] {f : α → β}
- (hf : Function.Injective f) : Nontrivial β :=
- let ⟨x, y, h⟩ := exists_pair_ne α
- ⟨⟨f x, f y, hf.ne h⟩⟩
-#align function.injective.nontrivial Function.Injective.nontrivial
-
/-- Pullback a `Nontrivial` instance along a surjective function. -/
protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
(hf : Function.Surjective f) : Nontrivial α := by
@@ -158,56 +114,6 @@ protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
exact ⟨⟨x', y', this⟩⟩
#align function.surjective.nontrivial Function.Surjective.nontrivial
-/-- An injective function from a nontrivial type has an argument at
-which it does not take a given value. -/
-protected theorem Function.Injective.exists_ne [Nontrivial α] {f : α → β}
- (hf : Function.Injective f) (y : β) : ∃ x, f x ≠ y := by
- rcases exists_pair_ne α with ⟨x₁, x₂, hx⟩
- by_cases h:f x₂ = y
- · exact ⟨x₁, (hf.ne_iff' h).2 hx⟩
- · exact ⟨x₂, h⟩
-#align function.injective.exists_ne Function.Injective.exists_ne
-
-
-instance nontrivial_prod_right [Nonempty α] [Nontrivial β] : Nontrivial (α × β) :=
- Prod.snd_surjective.nontrivial
-
-instance nontrivial_prod_left [Nontrivial α] [Nonempty β] : Nontrivial (α × β) :=
- Prod.fst_surjective.nontrivial
-
-namespace Pi
-
-variable {I : Type*} {f : I → Type*}
-
-/-- A pi type is nontrivial if it's nonempty everywhere and nontrivial somewhere. -/
-theorem nontrivial_at (i' : I) [inst : ∀ i, Nonempty (f i)] [Nontrivial (f i')] :
- Nontrivial (∀ i : I, f i) := by
- letI := Classical.decEq (∀ i : I, f i)
- exact (Function.update_injective (fun i ↦ Classical.choice (inst i)) i').nontrivial
-#align pi.nontrivial_at Pi.nontrivial_at
-
-/-- As a convenience, provide an instance automatically if `(f default)` is nontrivial.
-
-If a different index has the non-trivial type, then use `haveI := nontrivial_at that_index`.
--/
-instance nontrivial [Inhabited I] [∀ i, Nonempty (f i)] [Nontrivial (f default)] :
- Nontrivial (∀ i : I, f i) :=
- nontrivial_at default
-
-end Pi
-
-instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α → β) :=
- h.elim fun a ↦ Pi.nontrivial_at a
-
-@[nontriviality]
-protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x ≤ y :=
- le_of_eq (Subsingleton.elim x y)
-#align subsingleton.le Subsingleton.le
-
-@[to_additive]
-theorem Subsingleton.eq_one [One α] [Subsingleton α] (a : α) : a = 1 :=
- Subsingleton.elim _ _
-
namespace Bool
instance : Nontrivial Bool :=
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -22,13 +22,13 @@ We introduce a typeclass `Nontrivial` formalizing this property.
-/
-variable {α : Type _} {β : Type _}
+variable {α : Type*} {β : Type*}
open Classical
/-- Predicate typeclass for expressing that a type is not reduced to a single element. In rings,
this is equivalent to `0 ≠ 1`. In vector spaces, this is equivalent to positive dimension. -/
-class Nontrivial (α : Type _) : Prop where
+class Nontrivial (α : Type*) : Prop where
/-- In a nontrivial type, there exists a pair of distinct terms. -/
exists_pair_ne : ∃ x y : α, x ≠ y
#align nontrivial Nontrivial
@@ -37,7 +37,7 @@ theorem nontrivial_iff : Nontrivial α ↔ ∃ x y : α, x ≠ y :=
⟨fun h ↦ h.exists_pair_ne, fun h ↦ ⟨h⟩⟩
#align nontrivial_iff nontrivial_iff
-theorem exists_pair_ne (α : Type _) [Nontrivial α] : ∃ x y : α, x ≠ y :=
+theorem exists_pair_ne (α : Type*) [Nontrivial α] : ∃ x y : α, x ≠ y :=
Nontrivial.exists_pair_ne
#align exists_pair_ne exists_pair_ne
@@ -65,7 +65,7 @@ theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
⟨⟨x, y, ne_of_lt h⟩⟩
#align nontrivial_of_lt nontrivial_of_lt
-theorem exists_pair_lt (α : Type _) [Nontrivial α] [LinearOrder α] : ∃ x y : α, x < y := by
+theorem exists_pair_lt (α : Type*) [Nontrivial α] [LinearOrder α] : ∃ x y : α, x < y := by
rcases exists_pair_ne α with ⟨x, y, hxy⟩
cases lt_or_gt_of_ne hxy <;> exact ⟨_, _, ‹_›⟩
#align exists_pair_lt exists_pair_lt
@@ -96,7 +96,7 @@ instance (priority := 500) Nontrivial.to_nonempty [Nontrivial α] : Nonempty α
⟨x⟩
/-- An inhabited type is either nontrivial, or has a unique element. -/
-noncomputable def nontrivialPSumUnique (α : Type _) [Inhabited α] :
+noncomputable def nontrivialPSumUnique (α : Type*) [Inhabited α] :
PSum (Nontrivial α) (Unique α) :=
if h : Nontrivial α then PSum.inl h
else
@@ -126,12 +126,12 @@ theorem not_subsingleton (α) [Nontrivial α] : ¬Subsingleton α :=
#align not_subsingleton not_subsingleton
/-- A type is either a subsingleton or nontrivial. -/
-theorem subsingleton_or_nontrivial (α : Type _) : Subsingleton α ∨ Nontrivial α := by
+theorem subsingleton_or_nontrivial (α : Type*) : Subsingleton α ∨ Nontrivial α := by
rw [← not_nontrivial_iff_subsingleton, or_comm]
exact Classical.em _
#align subsingleton_or_nontrivial subsingleton_or_nontrivial
-theorem false_of_nontrivial_of_subsingleton (α : Type _) [Nontrivial α] [Subsingleton α] : False :=
+theorem false_of_nontrivial_of_subsingleton (α : Type*) [Nontrivial α] [Subsingleton α] : False :=
not_nontrivial _ ‹_›
#align false_of_nontrivial_of_subsingleton false_of_nontrivial_of_subsingleton
@@ -177,7 +177,7 @@ instance nontrivial_prod_left [Nontrivial α] [Nonempty β] : Nontrivial (α ×
namespace Pi
-variable {I : Type _} {f : I → Type _}
+variable {I : Type*} {f : I → Type*}
/-- A pi type is nontrivial if it's nonempty everywhere and nontrivial somewhere. -/
theorem nontrivial_at (i' : I) [inst : ∀ i, Nonempty (f i)] [Nontrivial (f i')] :
@@ -204,6 +204,10 @@ protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x
le_of_eq (Subsingleton.elim x y)
#align subsingleton.le Subsingleton.le
+@[to_additive]
+theorem Subsingleton.eq_one [One α] [Subsingleton α] (a : α) : a = 1 :=
+ Subsingleton.elim _ _
+
namespace Bool
instance : Nontrivial Bool :=
@@ -2,11 +2,6 @@
Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module logic.nontrivial
-! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Tactic.Attr.Register
import Mathlib.Data.Prod.Basic
@@ -14,6 +9,8 @@ import Mathlib.Data.Subtype
import Mathlib.Logic.Function.Basic
import Mathlib.Logic.Unique
+#align_import logic.nontrivial from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
+
/-!
# Nontrivial types
register_simp_attr
s to 1 file (#5681)
There are slight differences between mathlib3
and mathlib4
(different set of attributes, different lemmas are in core/std), so I redid the same refactor instead of forward-porting changes.
mathlib3 PR: leanprover-community/mathlib#19223
@@ -4,10 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
! This file was ported from Lean 3 source module logic.nontrivial
-! leanprover-community/mathlib commit f340f229b1f461aa1c8ee11e0a172d0a3b301a4a
+! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
+import Mathlib.Tactic.Attr.Register
import Mathlib.Data.Prod.Basic
import Mathlib.Data.Subtype
import Mathlib.Logic.Function.Basic
@@ -201,6 +202,7 @@ end Pi
instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α → β) :=
h.elim fun a ↦ Pi.nontrivial_at a
+@[nontriviality]
protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x ≤ y :=
le_of_eq (Subsingleton.elim x y)
#align subsingleton.le Subsingleton.le
fix-comments.py
on all files.@@ -141,14 +141,14 @@ instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by
inhabit α
exact ⟨none, some default, fun .⟩
-/-- Pushforward a `nontrivial` instance along an injective function. -/
+/-- Pushforward a `Nontrivial` instance along an injective function. -/
protected theorem Function.Injective.nontrivial [Nontrivial α] {f : α → β}
(hf : Function.Injective f) : Nontrivial β :=
let ⟨x, y, h⟩ := exists_pair_ne α
⟨⟨f x, f y, hf.ne h⟩⟩
#align function.injective.nontrivial Function.Injective.nontrivial
-/-- Pullback a `nontrivial` instance along a surjective function. -/
+/-- Pullback a `Nontrivial` instance along a surjective function. -/
protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
(hf : Function.Surjective f) : Nontrivial α := by
rcases exists_pair_ne β with ⟨x, y, h⟩
@@ -116,7 +116,7 @@ theorem subsingleton_iff : Subsingleton α ↔ ∀ x y : α, x = y :=
#align subsingleton_iff subsingleton_iff
theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α := by
- simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, _root_.not_not]
+ simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, not_not]
#align not_nontrivial_iff_subsingleton not_nontrivial_iff_subsingleton
theorem not_nontrivial (α) [Subsingleton α] : ¬Nontrivial α :=
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)@@ -33,12 +33,15 @@ this is equivalent to `0 ≠ 1`. In vector spaces, this is equivalent to positiv
class Nontrivial (α : Type _) : Prop where
/-- In a nontrivial type, there exists a pair of distinct terms. -/
exists_pair_ne : ∃ x y : α, x ≠ y
+#align nontrivial Nontrivial
theorem nontrivial_iff : Nontrivial α ↔ ∃ x y : α, x ≠ y :=
⟨fun h ↦ h.exists_pair_ne, fun h ↦ ⟨h⟩⟩
+#align nontrivial_iff nontrivial_iff
theorem exists_pair_ne (α : Type _) [Nontrivial α] : ∃ x y : α, x ≠ y :=
Nontrivial.exists_pair_ne
+#align exists_pair_ne exists_pair_ne
-- See Note [decidable namespace]
protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α) : ∃ y, y ≠ x := by
@@ -47,32 +50,40 @@ protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α)
· rw [← hx] at h
exact ⟨y', h.symm⟩
· exact ⟨y, Ne.symm hx⟩
+#align decidable.exists_ne Decidable.exists_ne
theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := by
letI := Classical.decEq α; exact Decidable.exists_ne x
+#align exists_ne exists_ne
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
theorem nontrivial_of_ne (x y : α) (h : x ≠ y) : Nontrivial α :=
⟨⟨x, y, h⟩⟩
+#align nontrivial_of_ne nontrivial_of_ne
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
⟨⟨x, y, ne_of_lt h⟩⟩
+#align nontrivial_of_lt nontrivial_of_lt
theorem exists_pair_lt (α : Type _) [Nontrivial α] [LinearOrder α] : ∃ x y : α, x < y := by
rcases exists_pair_ne α with ⟨x, y, hxy⟩
cases lt_or_gt_of_ne hxy <;> exact ⟨_, _, ‹_›⟩
+#align exists_pair_lt exists_pair_lt
theorem nontrivial_iff_lt [LinearOrder α] : Nontrivial α ↔ ∃ x y : α, x < y :=
⟨fun h ↦ @exists_pair_lt α h _, fun ⟨x, y, h⟩ ↦ nontrivial_of_lt x y h⟩
+#align nontrivial_iff_lt nontrivial_iff_lt
theorem nontrivial_iff_exists_ne (x : α) : Nontrivial α ↔ ∃ y, y ≠ x :=
⟨fun h ↦ @exists_ne α h x, fun ⟨_, hy⟩ ↦ nontrivial_of_ne _ _ hy⟩
+#align nontrivial_iff_exists_ne nontrivial_iff_exists_ne
theorem Subtype.nontrivial_iff_exists_ne (p : α → Prop) (x : Subtype p) :
Nontrivial (Subtype p) ↔ ∃ (y : α) (_ : p y), y ≠ x := by
simp only [_root_.nontrivial_iff_exists_ne x, Subtype.exists, Ne.def, Subtype.ext_iff]
+#align subtype.nontrivial_iff_exists_ne Subtype.nontrivial_iff_exists_ne
instance : Nontrivial Prop :=
⟨⟨True, False, true_ne_false⟩⟩
@@ -96,28 +107,35 @@ noncomputable def nontrivialPSumUnique (α : Type _) [Inhabited α] :
uniq := fun x : α ↦ by
by_contra H
exact h ⟨_, _, H⟩ }
+#align nontrivial_psum_unique nontrivialPSumUnique
theorem subsingleton_iff : Subsingleton α ↔ ∀ x y : α, x = y :=
⟨by
intro h
exact Subsingleton.elim, fun h ↦ ⟨h⟩⟩
+#align subsingleton_iff subsingleton_iff
theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α := by
simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, _root_.not_not]
+#align not_nontrivial_iff_subsingleton not_nontrivial_iff_subsingleton
theorem not_nontrivial (α) [Subsingleton α] : ¬Nontrivial α :=
fun ⟨⟨x, y, h⟩⟩ ↦ h <| Subsingleton.elim x y
+#align not_nontrivial not_nontrivial
theorem not_subsingleton (α) [Nontrivial α] : ¬Subsingleton α :=
fun _ => not_nontrivial _ ‹_›
+#align not_subsingleton not_subsingleton
/-- A type is either a subsingleton or nontrivial. -/
theorem subsingleton_or_nontrivial (α : Type _) : Subsingleton α ∨ Nontrivial α := by
rw [← not_nontrivial_iff_subsingleton, or_comm]
exact Classical.em _
+#align subsingleton_or_nontrivial subsingleton_or_nontrivial
theorem false_of_nontrivial_of_subsingleton (α : Type _) [Nontrivial α] [Subsingleton α] : False :=
not_nontrivial _ ‹_›
+#align false_of_nontrivial_of_subsingleton false_of_nontrivial_of_subsingleton
instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by
inhabit α
@@ -128,6 +146,7 @@ protected theorem Function.Injective.nontrivial [Nontrivial α] {f : α → β}
(hf : Function.Injective f) : Nontrivial β :=
let ⟨x, y, h⟩ := exists_pair_ne α
⟨⟨f x, f y, hf.ne h⟩⟩
+#align function.injective.nontrivial Function.Injective.nontrivial
/-- Pullback a `nontrivial` instance along a surjective function. -/
protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
@@ -139,6 +158,7 @@ protected theorem Function.Surjective.nontrivial [Nontrivial β] {f : α → β}
refine fun H ↦ h ?_
rw [← hx', ← hy', H]
exact ⟨⟨x', y', this⟩⟩
+#align function.surjective.nontrivial Function.Surjective.nontrivial
/-- An injective function from a nontrivial type has an argument at
which it does not take a given value. -/
@@ -148,6 +168,7 @@ protected theorem Function.Injective.exists_ne [Nontrivial α] {f : α → β}
by_cases h:f x₂ = y
· exact ⟨x₁, (hf.ne_iff' h).2 hx⟩
· exact ⟨x₂, h⟩
+#align function.injective.exists_ne Function.Injective.exists_ne
instance nontrivial_prod_right [Nonempty α] [Nontrivial β] : Nontrivial (α × β) :=
@@ -165,6 +186,7 @@ theorem nontrivial_at (i' : I) [inst : ∀ i, Nonempty (f i)] [Nontrivial (f i')
Nontrivial (∀ i : I, f i) := by
letI := Classical.decEq (∀ i : I, f i)
exact (Function.update_injective (fun i ↦ Classical.choice (inst i)) i').nontrivial
+#align pi.nontrivial_at Pi.nontrivial_at
/-- As a convenience, provide an instance automatically if `(f default)` is nontrivial.
@@ -181,6 +203,7 @@ instance Function.nontrivial [h : Nonempty α] [Nontrivial β] : Nontrivial (α
protected theorem Subsingleton.le [Preorder α] [Subsingleton α] (x y : α) : x ≤ y :=
le_of_eq (Subsingleton.elim x y)
+#align subsingleton.le Subsingleton.le
namespace Bool
=
, ≠
, <
, 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>
@@ -108,9 +108,8 @@ theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α :=
theorem not_nontrivial (α) [Subsingleton α] : ¬Nontrivial α :=
fun ⟨⟨x, y, h⟩⟩ ↦ h <| Subsingleton.elim x y
-theorem not_subsingleton (α) [h : Nontrivial α] : ¬Subsingleton α :=
- let ⟨⟨x, y, hxy⟩⟩ := h
- fun ⟨h'⟩ ↦ hxy <| h' x y
+theorem not_subsingleton (α) [Nontrivial α] : ¬Subsingleton α :=
+ fun _ => not_nontrivial _ ‹_›
/-- A type is either a subsingleton or nontrivial. -/
theorem subsingleton_or_nontrivial (α : Type _) : Subsingleton α ∨ Nontrivial α := by
@@ -118,8 +117,7 @@ theorem subsingleton_or_nontrivial (α : Type _) : Subsingleton α ∨ Nontrivia
exact Classical.em _
theorem false_of_nontrivial_of_subsingleton (α : Type _) [Nontrivial α] [Subsingleton α] : False :=
- let ⟨x, y, h⟩ := exists_pair_ne α
- h <| Subsingleton.elim x y
+ not_nontrivial _ ‹_›
instance Option.nontrivial [Nonempty α] : Nontrivial (Option α) := by
inhabit α
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -72,7 +72,7 @@ theorem nontrivial_iff_exists_ne (x : α) : Nontrivial α ↔ ∃ y, y ≠ x :=
theorem Subtype.nontrivial_iff_exists_ne (p : α → Prop) (x : Subtype p) :
Nontrivial (Subtype p) ↔ ∃ (y : α) (_ : p y), y ≠ x := by
- simp only [_root_.nontrivial_iff_exists_ne x, Subtype.exists, Ne.def, Subtype.ext_iff, iff_self]
+ simp only [_root_.nontrivial_iff_exists_ne x, Subtype.exists, Ne.def, Subtype.ext_iff]
instance : Nontrivial Prop :=
⟨⟨True, False, true_ne_false⟩⟩
@@ -103,7 +103,7 @@ theorem subsingleton_iff : Subsingleton α ↔ ∀ x y : α, x = y :=
exact Subsingleton.elim, fun h ↦ ⟨h⟩⟩
theorem not_nontrivial_iff_subsingleton : ¬Nontrivial α ↔ Subsingleton α := by
- simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, _root_.not_not, iff_self]
+ simp only [nontrivial_iff, subsingleton_iff, not_exists, Ne.def, _root_.not_not]
theorem not_nontrivial (α) [Subsingleton α] : ¬Nontrivial α :=
fun ⟨⟨x, y, h⟩⟩ ↦ h <| Subsingleton.elim x y
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
@@ -87,7 +87,7 @@ instance (priority := 500) Nontrivial.to_nonempty [Nontrivial α] : Nonempty α
⟨x⟩
/-- An inhabited type is either nontrivial, or has a unique element. -/
-noncomputable def nontrivial_Psum_Unique (α : Type _) [Inhabited α] :
+noncomputable def nontrivialPSumUnique (α : Type _) [Inhabited α] :
PSum (Nontrivial α) (Unique α) :=
if h : Nontrivial α then PSum.inl h
else
@@ -86,8 +86,6 @@ instance (priority := 500) Nontrivial.to_nonempty [Nontrivial α] : Nonempty α
let ⟨x, _⟩ := _root_.exists_pair_ne α
⟨x⟩
-attribute [instance] nonempty_of_inhabited
-
/-- An inhabited type is either nontrivial, or has a unique element. -/
noncomputable def nontrivial_Psum_Unique (α : Type _) [Inhabited α] :
PSum (Nontrivial α) (Unique α) :=
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) 2020 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
+
+! This file was ported from Lean 3 source module logic.nontrivial
+! leanprover-community/mathlib commit f340f229b1f461aa1c8ee11e0a172d0a3b301a4a
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Data.Prod.Basic
import Mathlib.Data.Subtype
All dependencies are ported!