order.rel_classesMathlib.Order.RelClasses

This file has been ported!

Changes since the initial port

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.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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)

feat(data/list/cycle): well-founded or transitive irreflexive relations don't have cycles (#18512)

Since simp can prove statements such as cycle r [a, b, c] ↔ r a b ∧ r b c ∧ r c a, this gives us a nice generalization of asymmetry.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -3,8 +3,9 @@ Copyright (c) 2020 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 -/
-import order.basic
 import logic.is_empty
+import logic.relation
+import order.basic
 
 /-!
 # Unbundled relation classes
@@ -247,6 +248,9 @@ instance is_well_founded.is_asymm (r : α → α → Prop) [is_well_founded α r
 instance is_well_founded.is_irrefl (r : α → α → Prop) [is_well_founded α r] : is_irrefl α r :=
 is_asymm.is_irrefl
 
+instance (r : α → α → Prop) [i : is_well_founded α r] : is_well_founded α (relation.trans_gen r) :=
+⟨i.wf.trans_gen⟩
+
 /-- A class for a well founded relation `<`. -/
 @[reducible] def well_founded_lt (α : Type*) [has_lt α] : Prop := is_well_founded α (<)
 

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(data/{set,finset}/basic): Convenience lemmas (#17957)

Add a few convenient corollaries to existing lemmas.

Diff
@@ -459,6 +459,8 @@ instance is_nonstrict_strict_order.to_is_irrefl {r : α → α → Prop} {s : α
 section subset
 variables [has_subset α] {a b c : α}
 
+lemma subset_of_eq_of_subset (hab : a = b) (hbc : b ⊆ c) : a ⊆ c := by rwa hab
+lemma subset_of_subset_of_eq (hab : a ⊆ b) (hbc : b = c) : a ⊆ c := by rwa ←hbc
 @[refl] lemma subset_refl [is_refl α (⊆)] (a : α) : a ⊆ a := refl _
 lemma subset_rfl [is_refl α (⊆)] : a ⊆ a := refl _
 lemma subset_of_eq [is_refl α (⊆)] : a = b → a ⊆ b := λ h, h ▸ subset_rfl
@@ -473,6 +475,8 @@ antisymm h h'
 lemma superset_antisymm [is_antisymm α (⊆)] (h : a ⊆ b) (h' : b ⊆ a) : b = a :=
 antisymm' h h'
 
+alias subset_of_eq_of_subset ← eq.trans_subset
+alias subset_of_subset_of_eq ← has_subset.subset.trans_eq
 alias subset_of_eq ← eq.subset' --TODO: Fix it and kill `eq.subset`
 alias superset_of_eq ← eq.superset
 alias subset_trans      ← has_subset.subset.trans
@@ -488,8 +492,10 @@ lemma superset_antisymm_iff [is_refl α (⊆)] [is_antisymm α (⊆)] : a = b 
 end subset
 
 section ssubset
-variables [has_ssubset α]
+variables [has_ssubset α] {a b c : α}
 
+lemma ssubset_of_eq_of_ssubset (hab : a = b) (hbc : b ⊂ c) : a ⊂ c := by rwa hab
+lemma ssubset_of_ssubset_of_eq (hab : a ⊂ b) (hbc : b = c) : a ⊂ c := by rwa ←hbc
 lemma ssubset_irrefl [is_irrefl α (⊂)] (a : α) : ¬ a ⊂ a := irrefl _
 lemma ssubset_irrfl [is_irrefl α (⊂)] {a : α} : ¬ a ⊂ a := irrefl _
 lemma ne_of_ssubset [is_irrefl α (⊂)] {a b : α} : a ⊂ b → a ≠ b := ne_of_irrefl
@@ -497,6 +503,8 @@ lemma ne_of_ssuperset [is_irrefl α (⊂)] {a b : α} : a ⊂ b → b ≠ a := n
 @[trans] lemma ssubset_trans [is_trans α (⊂)] {a b c : α} : a ⊂ b → b ⊂ c → a ⊂ c := trans
 lemma ssubset_asymm [is_asymm α (⊂)] {a b : α} (h : a ⊂ b) : ¬ b ⊂ a := asymm h
 
+alias ssubset_of_eq_of_ssubset ← eq.trans_ssubset
+alias ssubset_of_ssubset_of_eq ← has_ssubset.ssubset.trans_eq
 alias ssubset_irrfl   ← has_ssubset.ssubset.false
 alias ne_of_ssubset   ← has_ssubset.ssubset.ne
 alias ne_of_ssuperset ← has_ssubset.ssubset.ne'

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -268,7 +268,7 @@ def partialOrderOfSO (r) [IsStrictOrder α r] : PartialOrder α
     | _, h₁, Or.inl rfl => rfl
     | _, Or.inr h₁, Or.inr h₂ => (asymm h₁ h₂).elim
   lt_iff_le_not_le x y :=
-    ⟨fun h => ⟨Or.inr h, not_or_of_not (fun e => by rw [e] at h  <;> exact irrefl _ h) (asymm h)⟩,
+    ⟨fun h => ⟨Or.inr h, not_or_of_not (fun e => by rw [e] at h <;> exact irrefl _ h) (asymm h)⟩,
       fun ⟨h₁, h₂⟩ => h₁.resolve_left fun e => h₂ <| e ▸ Or.inl rfl⟩
 #align partial_order_of_SO partialOrderOfSO
 -/
Diff
@@ -408,13 +408,12 @@ def toHasWellFounded : WellFoundedRelation α :=
 
 end IsWellFounded
 
-/- ./././Mathport/Syntax/Translate/Command.lean:298:8: warning: using_well_founded used, estimated equivalent -/
+/- ./././Mathport/Syntax/Translate/Command.lean:299:8: warning: using_well_founded used, estimated equivalent -/
 #print WellFounded.asymmetric /-
 theorem WellFounded.asymmetric {α : Sort _} {r : α → α → Prop} (h : WellFounded r) :
     ∀ ⦃a b⦄, r a b → ¬r b a
   | a => fun b hab hba => WellFounded.asymmetric hba hab
-termination_by
-  _ x => WellFounded.wrap h x
+termination_by x => WellFounded.wrap h x
 #align well_founded.asymmetric WellFounded.asymmetric
 -/
 
Diff
@@ -408,11 +408,13 @@ def toHasWellFounded : WellFoundedRelation α :=
 
 end IsWellFounded
 
+/- ./././Mathport/Syntax/Translate/Command.lean:298:8: warning: using_well_founded used, estimated equivalent -/
 #print WellFounded.asymmetric /-
 theorem WellFounded.asymmetric {α : Sort _} {r : α → α → Prop} (h : WellFounded r) :
     ∀ ⦃a b⦄, r a b → ¬r b a
   | a => fun b hab hba => WellFounded.asymmetric hba hab
-termination_by' ⟨_, h⟩
+termination_by
+  _ x => WellFounded.wrap h x
 #align well_founded.asymmetric WellFounded.asymmetric
 -/
 
Diff
@@ -683,7 +683,8 @@ def Bounded (r : α → α → Prop) (s : Set α) : Prop :=
 #print Set.not_bounded_iff /-
 @[simp]
 theorem not_bounded_iff {r : α → α → Prop} (s : Set α) : ¬Bounded r s ↔ Unbounded r s := by
-  simp only [bounded, unbounded, not_forall, not_exists, exists_prop, not_and, Classical.not_not]
+  simp only [bounded, unbounded, Classical.not_forall, not_exists, exists_prop, not_and,
+    Classical.not_not]
 #align set.not_bounded_iff Set.not_bounded_iff
 -/
 
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2020 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 -/
-import Mathbin.Logic.IsEmpty
-import Mathbin.Logic.Relation
-import Mathbin.Order.Basic
+import Logic.IsEmpty
+import Logic.Relation
+import Order.Basic
 
 #align_import order.rel_classes from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
 
Diff
@@ -841,26 +841,26 @@ theorem superset_antisymm [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) (h' : b ⊆
 #align superset_antisymm superset_antisymm
 -/
 
-alias subset_of_eq_of_subset ← Eq.trans_subset
+alias Eq.trans_subset := subset_of_eq_of_subset
 #align eq.trans_subset Eq.trans_subset
 
-alias subset_of_subset_of_eq ← HasSubset.subset.trans_eq
+alias HasSubset.subset.trans_eq := subset_of_subset_of_eq
 #align has_subset.subset.trans_eq HasSubset.subset.trans_eq
 
-alias subset_of_eq ← Eq.subset'
+alias Eq.subset' := subset_of_eq
 #align eq.subset' Eq.subset'
 
 --TODO: Fix it and kill `eq.subset`
-alias superset_of_eq ← Eq.superset
+alias Eq.superset := superset_of_eq
 #align eq.superset Eq.superset
 
-alias subset_trans ← HasSubset.Subset.trans
+alias HasSubset.Subset.trans := subset_trans
 #align has_subset.subset.trans HasSubset.Subset.trans
 
-alias subset_antisymm ← HasSubset.Subset.antisymm
+alias HasSubset.Subset.antisymm := subset_antisymm
 #align has_subset.subset.antisymm HasSubset.Subset.antisymm
 
-alias superset_antisymm ← HasSubset.Subset.antisymm'
+alias HasSubset.Subset.antisymm' := superset_antisymm
 #align has_subset.subset.antisymm' HasSubset.Subset.antisymm'
 
 #print subset_antisymm_iff /-
@@ -928,25 +928,25 @@ theorem ssubset_asymm [IsAsymm α (· ⊂ ·)] {a b : α} (h : a ⊂ b) : ¬b 
 #align ssubset_asymm ssubset_asymm
 -/
 
-alias ssubset_of_eq_of_ssubset ← Eq.trans_ssubset
+alias Eq.trans_ssubset := ssubset_of_eq_of_ssubset
 #align eq.trans_ssubset Eq.trans_ssubset
 
-alias ssubset_of_ssubset_of_eq ← HasSSubset.SSubset.trans_eq
+alias HasSSubset.SSubset.trans_eq := ssubset_of_ssubset_of_eq
 #align has_ssubset.ssubset.trans_eq HasSSubset.SSubset.trans_eq
 
-alias ssubset_irrfl ← HasSSubset.SSubset.false
+alias HasSSubset.SSubset.false := ssubset_irrfl
 #align has_ssubset.ssubset.false HasSSubset.SSubset.false
 
-alias ne_of_ssubset ← HasSSubset.SSubset.ne
+alias HasSSubset.SSubset.ne := ne_of_ssubset
 #align has_ssubset.ssubset.ne HasSSubset.SSubset.ne
 
-alias ne_of_ssuperset ← HasSSubset.SSubset.ne'
+alias HasSSubset.SSubset.ne' := ne_of_ssuperset
 #align has_ssubset.ssubset.ne' HasSSubset.SSubset.ne'
 
-alias ssubset_trans ← HasSSubset.SSubset.trans
+alias HasSSubset.SSubset.trans := ssubset_trans
 #align has_ssubset.ssubset.trans HasSSubset.SSubset.trans
 
-alias ssubset_asymm ← HasSSubset.SSubset.asymm
+alias HasSSubset.SSubset.asymm := ssubset_asymm
 #align has_ssubset.ssubset.asymm HasSSubset.SSubset.asymm
 
 end Ssubset
@@ -984,16 +984,16 @@ theorem ssubset_of_subset_not_subset (h₁ : a ⊆ b) (h₂ : ¬b ⊆ a) : a ⊂
 #align ssubset_of_subset_not_subset ssubset_of_subset_not_subset
 -/
 
-alias subset_of_ssubset ← HasSSubset.SSubset.subset
+alias HasSSubset.SSubset.subset := subset_of_ssubset
 #align has_ssubset.ssubset.subset HasSSubset.SSubset.subset
 
-alias not_subset_of_ssubset ← HasSSubset.SSubset.not_subset
+alias HasSSubset.SSubset.not_subset := not_subset_of_ssubset
 #align has_ssubset.ssubset.not_subset HasSSubset.SSubset.not_subset
 
-alias not_ssubset_of_subset ← HasSubset.Subset.not_ssubset
+alias HasSubset.Subset.not_ssubset := not_ssubset_of_subset
 #align has_subset.subset.not_ssubset HasSubset.Subset.not_ssubset
 
-alias ssubset_of_subset_not_subset ← HasSubset.Subset.ssubset_of_not_subset
+alias HasSubset.Subset.ssubset_of_not_subset := ssubset_of_subset_not_subset
 #align has_subset.subset.ssubset_of_not_subset HasSubset.Subset.ssubset_of_not_subset
 
 #print ssubset_of_subset_of_ssubset /-
@@ -1032,22 +1032,22 @@ theorem ssubset_or_eq_of_subset [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) : a 
 #align ssubset_or_eq_of_subset ssubset_or_eq_of_subset
 -/
 
-alias ssubset_of_subset_of_ssubset ← HasSubset.Subset.trans_ssubset
+alias HasSubset.Subset.trans_ssubset := ssubset_of_subset_of_ssubset
 #align has_subset.subset.trans_ssubset HasSubset.Subset.trans_ssubset
 
-alias ssubset_of_ssubset_of_subset ← HasSSubset.SSubset.trans_subset
+alias HasSSubset.SSubset.trans_subset := ssubset_of_ssubset_of_subset
 #align has_ssubset.ssubset.trans_subset HasSSubset.SSubset.trans_subset
 
-alias ssubset_of_subset_of_ne ← HasSubset.Subset.ssubset_of_ne
+alias HasSubset.Subset.ssubset_of_ne := ssubset_of_subset_of_ne
 #align has_subset.subset.ssubset_of_ne HasSubset.Subset.ssubset_of_ne
 
-alias ssubset_of_ne_of_subset ← Ne.ssubset_of_subset
+alias Ne.ssubset_of_subset := ssubset_of_ne_of_subset
 #align ne.ssubset_of_subset Ne.ssubset_of_subset
 
-alias eq_or_ssubset_of_subset ← HasSubset.Subset.eq_or_ssubset
+alias HasSubset.Subset.eq_or_ssubset := eq_or_ssubset_of_subset
 #align has_subset.subset.eq_or_ssubset HasSubset.Subset.eq_or_ssubset
 
-alias ssubset_or_eq_of_subset ← HasSubset.Subset.ssubset_or_eq
+alias HasSubset.Subset.ssubset_or_eq := ssubset_or_eq_of_subset
 #align has_subset.subset.ssubset_or_eq HasSubset.Subset.ssubset_or_eq
 
 #print ssubset_iff_subset_ne /-
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2020 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
-
-! This file was ported from Lean 3 source module order.rel_classes
-! leanprover-community/mathlib commit 7413128c3bcb3b0818e3e18720abc9ea3100fb49
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Logic.IsEmpty
 import Mathbin.Logic.Relation
 import Mathbin.Order.Basic
 
+#align_import order.rel_classes from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
+
 /-!
 # Unbundled relation classes
 
Diff
@@ -396,11 +396,13 @@ def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, r y x → C y) → C x)
 #align is_well_founded.fix IsWellFounded.fix
 -/
 
+#print IsWellFounded.fix_eq /-
 /-- The value from `is_well_founded.fix` is built from the previous ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, r y x → C y) → C x) :
     ∀ x, fix r F x = F x fun y h => fix r F y :=
   wf.fix_eq F
 #align is_well_founded.fix_eq IsWellFounded.fix_eq
+-/
 
 /-- Derive a `has_well_founded` instance from an `is_well_founded` instance. -/
 def toHasWellFounded : WellFoundedRelation α :=
@@ -526,11 +528,13 @@ def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, y < x → C y) → C x)
 #align well_founded_lt.fix WellFoundedLT.fix
 -/
 
+#print WellFoundedLT.fix_eq /-
 /-- The value from `well_founded_lt.fix` is built from the previous ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, y < x → C y) → C x) :
     ∀ x, fix F x = F x fun y h => fix F y :=
   IsWellFounded.fix_eq _ F
 #align well_founded_lt.fix_eq WellFoundedLT.fix_eq
+-/
 
 /-- Derive a `has_well_founded` instance from a `well_founded_lt` instance. -/
 def toHasWellFounded : WellFoundedRelation α :=
@@ -565,11 +569,13 @@ def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, x < y → C y) → C x)
 #align well_founded_gt.fix WellFoundedGT.fix
 -/
 
+#print WellFoundedGT.fix_eq /-
 /-- The value from `well_founded_gt.fix` is built from the successive ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, x < y → C y) → C x) :
     ∀ x, fix F x = F x fun y h => fix F y :=
   IsWellFounded.fix_eq _ F
 #align well_founded_gt.fix_eq WellFoundedGT.fix_eq
+-/
 
 /-- Derive a `has_well_founded` instance from a `well_founded_gt` instance. -/
 def toHasWellFounded : WellFoundedRelation α :=
Diff
@@ -271,7 +271,7 @@ def partialOrderOfSO (r) [IsStrictOrder α r] : PartialOrder α
     | _, h₁, Or.inl rfl => rfl
     | _, Or.inr h₁, Or.inr h₂ => (asymm h₁ h₂).elim
   lt_iff_le_not_le x y :=
-    ⟨fun h => ⟨Or.inr h, not_or_of_not (fun e => by rw [e] at h <;> exact irrefl _ h) (asymm h)⟩,
+    ⟨fun h => ⟨Or.inr h, not_or_of_not (fun e => by rw [e] at h  <;> exact irrefl _ h) (asymm h)⟩,
       fun ⟨h₁, h₂⟩ => h₁.resolve_left fun e => h₂ <| e ▸ Or.inl rfl⟩
 #align partial_order_of_SO partialOrderOfSO
 -/
@@ -412,7 +412,8 @@ end IsWellFounded
 #print WellFounded.asymmetric /-
 theorem WellFounded.asymmetric {α : Sort _} {r : α → α → Prop} (h : WellFounded r) :
     ∀ ⦃a b⦄, r a b → ¬r b a
-  | a => fun b hab hba => WellFounded.asymmetric hba hab termination_by' ⟨_, h⟩
+  | a => fun b hab hba => WellFounded.asymmetric hba hab
+termination_by' ⟨_, h⟩
 #align well_founded.asymmetric WellFounded.asymmetric
 -/
 
@@ -470,7 +471,7 @@ theorem wellFoundedLT_dual_iff (α : Type _) [LT α] : WellFoundedLT αᵒᵈ 
 #print IsWellOrder /-
 /-- A well order is a well-founded linear order. -/
 class IsWellOrder (α : Type u) (r : α → α → Prop) extends IsTrichotomous α r, IsTrans α r,
-  IsWellFounded α r : Prop
+    IsWellFounded α r : Prop
 #align is_well_order IsWellOrder
 -/
 
Diff
@@ -1157,21 +1157,29 @@ instance [LinearOrder α] : IsIncompTrans α (· < ·) := by infer_instance
 
 instance [LinearOrder α] : IsStrictWeakOrder α (· < ·) := by infer_instance
 
+#print transitive_le /-
 theorem transitive_le [Preorder α] : Transitive (@LE.le α _) :=
   transitive_of_trans _
 #align transitive_le transitive_le
+-/
 
+#print transitive_lt /-
 theorem transitive_lt [Preorder α] : Transitive (@LT.lt α _) :=
   transitive_of_trans _
 #align transitive_lt transitive_lt
+-/
 
+#print transitive_ge /-
 theorem transitive_ge [Preorder α] : Transitive (@GE.ge α _) :=
   transitive_of_trans _
 #align transitive_ge transitive_ge
+-/
 
+#print transitive_gt /-
 theorem transitive_gt [Preorder α] : Transitive (@GT.gt α _) :=
   transitive_of_trans _
 #align transitive_gt transitive_gt
+-/
 
 #print OrderDual.isTotal_le /-
 instance OrderDual.isTotal_le [LE α] [IsTotal α (· ≤ ·)] : IsTotal αᵒᵈ (· ≤ ·) :=
Diff
@@ -396,12 +396,6 @@ def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, r y x → C y) → C x)
 #align is_well_founded.fix IsWellFounded.fix
 -/
 
-/- warning: is_well_founded.fix_eq -> IsWellFounded.fix_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} (r : α -> α -> Prop) [_inst_1 : IsWellFounded.{u1} α r] {C : α -> Sort.{u2}} (F : forall (x : α), (forall (y : α), (r y x) -> (C y)) -> (C x)) (x : α), Eq.{u2} (C x) (IsWellFounded.fix.{u1, u2} α r _inst_1 (fun (y : α) => C y) F x) (F x (fun (y : α) (h : r y x) => IsWellFounded.fix.{u1, u2} α r _inst_1 C F y))
-but is expected to have type
-  forall {α : Type.{u2}} (r : α -> α -> Prop) [_inst_1 : IsWellFounded.{u2} α r] {C : α -> Sort.{u1}} (F : forall (x : α), (forall (y : α), (r y x) -> (C y)) -> (C x)) (x : α), Eq.{u1} (C x) (IsWellFounded.fix.{u2, u1} α r _inst_1 (fun (y : α) => C y) F x) (F x (fun (y : α) (h : r y x) => IsWellFounded.fix.{u2, u1} α r _inst_1 (fun (y : α) => C y) F y))
-Case conversion may be inaccurate. Consider using '#align is_well_founded.fix_eq IsWellFounded.fix_eqₓ'. -/
 /-- The value from `is_well_founded.fix` is built from the previous ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, r y x → C y) → C x) :
     ∀ x, fix r F x = F x fun y h => fix r F y :=
@@ -531,12 +525,6 @@ def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, y < x → C y) → C x)
 #align well_founded_lt.fix WellFoundedLT.fix
 -/
 
-/- warning: well_founded_lt.fix_eq -> WellFoundedLT.fix_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LT.{u1} α] [_inst_2 : WellFoundedLT.{u1} α _inst_1] {C : α -> Sort.{u2}} (F : forall (x : α), (forall (y : α), (LT.lt.{u1} α _inst_1 y x) -> (C y)) -> (C x)) (x : α), Eq.{u2} (C x) (WellFoundedLT.fix.{u1, u2} α _inst_1 _inst_2 (fun (y : α) => C y) F x) (F x (fun (y : α) (h : LT.lt.{u1} α _inst_1 y x) => WellFoundedLT.fix.{u1, u2} α _inst_1 _inst_2 C F y))
-but is expected to have type
-  forall {α : Type.{u2}} [_inst_1 : LT.{u2} α] [_inst_2 : WellFoundedLT.{u2} α _inst_1] {C : α -> Sort.{u1}} (F : forall (x : α), (forall (y : α), (LT.lt.{u2} α _inst_1 y x) -> (C y)) -> (C x)) (x : α), Eq.{u1} (C x) (WellFoundedLT.fix.{u2, u1} α _inst_1 _inst_2 (fun (y : α) => C y) F x) (F x (fun (y : α) (h : LT.lt.{u2} α _inst_1 y x) => WellFoundedLT.fix.{u2, u1} α _inst_1 _inst_2 (fun (y : α) => C y) F y))
-Case conversion may be inaccurate. Consider using '#align well_founded_lt.fix_eq WellFoundedLT.fix_eqₓ'. -/
 /-- The value from `well_founded_lt.fix` is built from the previous ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, y < x → C y) → C x) :
     ∀ x, fix F x = F x fun y h => fix F y :=
@@ -576,12 +564,6 @@ def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, x < y → C y) → C x)
 #align well_founded_gt.fix WellFoundedGT.fix
 -/
 
-/- warning: well_founded_gt.fix_eq -> WellFoundedGT.fix_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LT.{u1} α] [_inst_2 : WellFoundedGT.{u1} α _inst_1] {C : α -> Sort.{u2}} (F : forall (x : α), (forall (y : α), (LT.lt.{u1} α _inst_1 x y) -> (C y)) -> (C x)) (x : α), Eq.{u2} (C x) (WellFoundedGT.fix.{u1, u2} α _inst_1 _inst_2 (fun (y : α) => C y) F x) (F x (fun (y : α) (h : LT.lt.{u1} α _inst_1 x y) => WellFoundedGT.fix.{u1, u2} α _inst_1 _inst_2 C F y))
-but is expected to have type
-  forall {α : Type.{u2}} [_inst_1 : LT.{u2} α] [_inst_2 : WellFoundedGT.{u2} α _inst_1] {C : α -> Sort.{u1}} (F : forall (x : α), (forall (y : α), (LT.lt.{u2} α _inst_1 x y) -> (C y)) -> (C x)) (x : α), Eq.{u1} (C x) (WellFoundedGT.fix.{u2, u1} α _inst_1 _inst_2 (fun (y : α) => C y) F x) (F x (fun (y : α) (h : LT.lt.{u2} α _inst_1 x y) => WellFoundedGT.fix.{u2, u1} α _inst_1 _inst_2 (fun (y : α) => C y) F y))
-Case conversion may be inaccurate. Consider using '#align well_founded_gt.fix_eq WellFoundedGT.fix_eqₓ'. -/
 /-- The value from `well_founded_gt.fix` is built from the successive ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, x < y → C y) → C x) :
     ∀ x, fix F x = F x fun y h => fix F y :=
@@ -1175,42 +1157,18 @@ instance [LinearOrder α] : IsIncompTrans α (· < ·) := by infer_instance
 
 instance [LinearOrder α] : IsStrictWeakOrder α (· < ·) := by infer_instance
 
-/- warning: transitive_le -> transitive_le is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LE.le.{u1} α (Preorder.toHasLe.{u1} α _inst_1))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LE.le.{u1} α (Preorder.toLE.{u1} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align transitive_le transitive_leₓ'. -/
 theorem transitive_le [Preorder α] : Transitive (@LE.le α _) :=
   transitive_of_trans _
 #align transitive_le transitive_le
 
-/- warning: transitive_lt -> transitive_lt is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align transitive_lt transitive_ltₓ'. -/
 theorem transitive_lt [Preorder α] : Transitive (@LT.lt α _) :=
   transitive_of_trans _
 #align transitive_lt transitive_lt
 
-/- warning: transitive_ge -> transitive_ge is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GE.ge.{u1} α (Preorder.toHasLe.{u1} α _inst_1))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GE.ge.{u1} α (Preorder.toLE.{u1} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align transitive_ge transitive_geₓ'. -/
 theorem transitive_ge [Preorder α] : Transitive (@GE.ge α _) :=
   transitive_of_trans _
 #align transitive_ge transitive_ge
 
-/- warning: transitive_gt -> transitive_gt is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GT.gt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GT.gt.{u1} α (Preorder.toLT.{u1} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align transitive_gt transitive_gtₓ'. -/
 theorem transitive_gt [Preorder α] : Transitive (@GT.gt α _) :=
   transitive_of_trans _
 #align transitive_gt transitive_gt
Diff
@@ -50,9 +50,7 @@ theorem antisymm' [IsAntisymm α r] {a b : α} : r a b → r b a → b = a := fu
 
 #print antisymm_iff /-
 theorem antisymm_iff [IsRefl α r] [IsAntisymm α r] {a b : α} : r a b ∧ r b a ↔ a = b :=
-  ⟨fun h => antisymm h.1 h.2, by
-    rintro rfl
-    exact ⟨refl _, refl _⟩⟩
+  ⟨fun h => antisymm h.1 h.2, by rintro rfl; exact ⟨refl _, refl _⟩⟩
 #align antisymm_iff antisymm_iff
 -/
 
Diff
@@ -1177,29 +1177,45 @@ instance [LinearOrder α] : IsIncompTrans α (· < ·) := by infer_instance
 
 instance [LinearOrder α] : IsStrictWeakOrder α (· < ·) := by infer_instance
 
-#print transitive_le /-
+/- warning: transitive_le -> transitive_le is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LE.le.{u1} α (Preorder.toHasLe.{u1} α _inst_1))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LE.le.{u1} α (Preorder.toLE.{u1} α _inst_1))
+Case conversion may be inaccurate. Consider using '#align transitive_le transitive_leₓ'. -/
 theorem transitive_le [Preorder α] : Transitive (@LE.le α _) :=
   transitive_of_trans _
 #align transitive_le transitive_le
--/
 
-#print transitive_lt /-
+/- warning: transitive_lt -> transitive_lt is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1))
+Case conversion may be inaccurate. Consider using '#align transitive_lt transitive_ltₓ'. -/
 theorem transitive_lt [Preorder α] : Transitive (@LT.lt α _) :=
   transitive_of_trans _
 #align transitive_lt transitive_lt
--/
 
-#print transitive_ge /-
+/- warning: transitive_ge -> transitive_ge is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GE.ge.{u1} α (Preorder.toHasLe.{u1} α _inst_1))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GE.ge.{u1} α (Preorder.toLE.{u1} α _inst_1))
+Case conversion may be inaccurate. Consider using '#align transitive_ge transitive_geₓ'. -/
 theorem transitive_ge [Preorder α] : Transitive (@GE.ge α _) :=
   transitive_of_trans _
 #align transitive_ge transitive_ge
--/
 
-#print transitive_gt /-
+/- warning: transitive_gt -> transitive_gt is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GT.gt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α], Transitive.{succ u1} α (GT.gt.{u1} α (Preorder.toLT.{u1} α _inst_1))
+Case conversion may be inaccurate. Consider using '#align transitive_gt transitive_gtₓ'. -/
 theorem transitive_gt [Preorder α] : Transitive (@GT.gt α _) :=
   transitive_of_trans _
 #align transitive_gt transitive_gt
--/
 
 #print OrderDual.isTotal_le /-
 instance OrderDual.isTotal_le [LE α] [IsTotal α (· ≤ ·)] : IsTotal αᵒᵈ (· ≤ ·) :=
Diff
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 
 ! This file was ported from Lean 3 source module order.rel_classes
-! leanprover-community/mathlib commit bc7d81beddb3d6c66f71449c5bc76c38cb77cf9e
+! leanprover-community/mathlib commit 7413128c3bcb3b0818e3e18720abc9ea3100fb49
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.Order.Basic
 import Mathbin.Logic.IsEmpty
+import Mathbin.Logic.Relation
+import Mathbin.Order.Basic
 
 /-!
 # Unbundled relation classes
@@ -435,6 +436,9 @@ instance (priority := 100) IsWellFounded.isIrrefl (r : α → α → Prop) [IsWe
   IsAsymm.isIrrefl
 #align is_well_founded.is_irrefl IsWellFounded.isIrrefl
 
+instance (r : α → α → Prop) [i : IsWellFounded α r] : IsWellFounded α (Relation.TransGen r) :=
+  ⟨i.wf.TransGen⟩
+
 #print WellFoundedLT /-
 /-- A class for a well founded relation `<`. -/
 @[reducible]
Diff
@@ -364,10 +364,12 @@ class IsWellFounded (α : Type u) (r : α → α → Prop) : Prop where
 #align is_well_founded IsWellFounded
 -/
 
+#print WellFoundedRelation.isWellFounded /-
 instance WellFoundedRelation.isWellFounded [h : WellFoundedRelation α] :
     IsWellFounded α WellFoundedRelation.R :=
   { h with }
 #align has_well_founded.is_well_founded WellFoundedRelation.isWellFounded
+-/
 
 namespace IsWellFounded
 

Changes in mathlib4

mathlib3
mathlib4
chore: replace λ by fun (#11301)

Per the style guidelines, λ is disallowed in mathlib. This is close to exhaustive; I left some tactic code alone when it seemed to me that tactic could be upstreamed soon.

Notes

  • In lines I was modifying anyway, I also converted => to .
  • Also contains some mild in-passing indentation fixes in Mathlib/Order/SupClosed.
  • Some doc comments still contained Lean 3 syntax λ x, , which I also replaced.
Diff
@@ -258,8 +258,8 @@ theorem isStrictWeakOrder_of_isOrderConnected [IsAsymm α r] [IsOrderConnected 
 -- see Note [lower instance priority]
 instance (priority := 100) isStrictOrderConnected_of_isStrictTotalOrder [IsStrictTotalOrder α r] :
     IsOrderConnected α r :=
-  ⟨λ _ _ _ h => (trichotomous _ _).imp_right
-    fun o => o.elim (fun e => e ▸ h) fun h' => _root_.trans h' h⟩
+  ⟨fun _ _ _ h ↦ (trichotomous _ _).imp_right
+    fun o ↦ o.elim (fun e ↦ e ▸ h) fun h' ↦ _root_.trans h' h⟩
 #align is_order_connected_of_is_strict_total_order isStrictOrderConnected_of_isStrictTotalOrder
 
 -- see Note [lower instance priority]
chore: move Mathlib to v4.7.0-rc1 (#11162)

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>

Diff
@@ -215,7 +215,7 @@ def linearOrderOfSTO (r) [IsStrictTotalOrder α r] [∀ x y, Decidable ¬r x y]
       decidable_of_iff (¬r y x)
         ⟨fun h => ((trichotomous_of r y x).resolve_left h).imp Eq.symm id, fun h =>
           h.elim (fun h => h ▸ irrefl_of _ _) (asymm_of r)⟩
-  { partialOrderOfSO r with
+  { __ := partialOrderOfSO r
     le_total := fun x y =>
       match y, trichotomous_of r x y with
       | y, Or.inl h => Or.inl (Or.inr h)
chore: move to v4.6.0-rc1, merging adaptations from bump/v4.6.0 (#10176)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>

Diff
@@ -289,7 +289,7 @@ instance WellFoundedRelation.isWellFounded [h : WellFoundedRelation α] :
 theorem WellFoundedRelation.asymmetric {α : Sort*} [WellFoundedRelation α] {a b : α} :
     WellFoundedRelation.rel a b → ¬ WellFoundedRelation.rel b a :=
   fun hab hba => WellFoundedRelation.asymmetric hba hab
-termination_by _ => a
+termination_by a
 
 lemma WellFounded.prod_lex {ra : α → α → Prop} {rb : β → β → Prop} (ha : WellFounded ra)
     (hb : WellFounded rb) : WellFounded (Prod.Lex ra rb) :=
refactor: decapitalize names in @[mk_iff] (#9378)
  • @[mk_iff] class MyPred now generates myPred_iff, not MyPred_iff
  • add Lean.Name.decapitalize
  • fix indentation and a few typos in the docs/comments.

Partially addresses issue #9129

Diff
@@ -276,7 +276,7 @@ instance (priority := 100) isStrictTotalOrder_of_isStrictTotalOrder [IsStrictTot
   /-- The relation is `WellFounded`, as a proposition. -/
   wf : WellFounded r
 #align is_well_founded IsWellFounded
-#align is_well_founded_iff IsWellFounded_iff
+#align is_well_founded_iff isWellFounded_iff
 
 #align has_well_founded WellFoundedRelation
 set_option linter.uppercaseLean3 false in
feat: Finsets and multisets are graded (#8892)

Characterise IsAtom, IsCoatom, Covby in Set α, Multiset α, Finset α and deduce that Multiset α, Finset α are graded orders.

Note I am moving some existing characterisations to here because it makes sense thematically, but I could be convinced otherwise.

Diff
@@ -793,6 +793,12 @@ theorem ssubset_or_eq_of_subset [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) : a 
   (eq_or_ssubset_of_subset h).symm
 #align ssubset_or_eq_of_subset ssubset_or_eq_of_subset
 
+lemma eq_of_subset_of_not_ssubset [IsAntisymm α (· ⊆ ·)] (hab : a ⊆ b) (hba : ¬ a ⊂ b) : a = b :=
+  (eq_or_ssubset_of_subset hab).resolve_right hba
+
+lemma eq_of_superset_of_not_ssuperset [IsAntisymm α (· ⊆ ·)] (hab : a ⊆ b) (hba : ¬ a ⊂ b) :
+    b = a := ((eq_or_ssubset_of_subset hab).resolve_right hba).symm
+
 alias HasSubset.Subset.trans_ssubset := ssubset_of_subset_of_ssubset
 #align has_subset.subset.trans_ssubset HasSubset.Subset.trans_ssubset
 
@@ -811,6 +817,9 @@ alias HasSubset.Subset.eq_or_ssubset := eq_or_ssubset_of_subset
 alias HasSubset.Subset.ssubset_or_eq := ssubset_or_eq_of_subset
 #align has_subset.subset.ssubset_or_eq HasSubset.Subset.ssubset_or_eq
 
+alias HasSubset.Subset.eq_of_not_ssubset := eq_of_subset_of_not_ssubset
+alias HasSubset.Subset.eq_of_not_ssuperset := eq_of_superset_of_not_ssuperset
+
 theorem ssubset_iff_subset_ne [IsAntisymm α (· ⊆ ·)] : a ⊂ b ↔ a ⊆ b ∧ a ≠ b :=
   ⟨fun h => ⟨h.subset, h.ne⟩, fun h => h.1.ssubset_of_ne h.2⟩
 #align ssubset_iff_subset_ne ssubset_iff_subset_ne
chore: space after (#8178)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -620,7 +620,7 @@ variable [HasSubset α] {a b c : α}
 lemma subset_of_eq_of_subset (hab : a = b) (hbc : b ⊆ c) : a ⊆ c := by rwa [hab]
 #align subset_of_eq_of_subset subset_of_eq_of_subset
 
-lemma subset_of_subset_of_eq (hab : a ⊆ b) (hbc : b = c) : a ⊆ c := by rwa [←hbc]
+lemma subset_of_subset_of_eq (hab : a ⊆ b) (hbc : b = c) : a ⊆ c := by rwa [← hbc]
 #align subset_of_subset_of_eq subset_of_subset_of_eq
 
 @[refl]
@@ -689,7 +689,7 @@ variable [HasSSubset α] {a b c : α}
 lemma ssubset_of_eq_of_ssubset (hab : a = b) (hbc : b ⊂ c) : a ⊂ c := by rwa [hab]
 #align ssubset_of_eq_of_ssubset ssubset_of_eq_of_ssubset
 
-lemma ssubset_of_ssubset_of_eq (hab : a ⊂ b) (hbc : b = c) : a ⊂ c := by rwa [←hbc]
+lemma ssubset_of_ssubset_of_eq (hab : a ⊂ b) (hbc : b = c) : a ⊂ c := by rwa [← hbc]
 #align ssubset_of_ssubset_of_eq ssubset_of_ssubset_of_eq
 
 lemma ssubset_irrefl [IsIrrefl α (· ⊂ ·)] (a : α) : ¬a ⊂ a := irrefl _
style: cleanup by putting by on the same line as := (#8407)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -385,8 +385,8 @@ instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] :
     IsStrictTotalOrder α r where
 
 -- see Note [lower instance priority]
-instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsTrichotomous α r :=
-  by infer_instance
+instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsTrichotomous α r := by
+  infer_instance
 
 -- see Note [lower instance priority]
 instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsTrans α r := by
chore: fix typo in docstring (#8326)

Metric.bounded doesn't exist any more.

Diff
@@ -547,7 +547,7 @@ def Unbounded (r : α → α → Prop) (s : Set α) : Prop :=
   ∀ a, ∃ b ∈ s, ¬r b a
 #align set.unbounded Set.Unbounded
 
-/-- A bounded or final set. Not to be confused with `Metric.bounded`. -/
+/-- A bounded or final set. Not to be confused with `Bornology.IsBounded`. -/
 def Bounded (r : α → α → Prop) (s : Set α) : Prop :=
   ∃ a, ∀ b ∈ s, r b a
 #align set.bounded Set.Bounded
feat: Shorthands for well-foundedness of < and > (#7865)

We already have WellFoundedLT/WellFoundedGT as wrappers around IsWellFounded, but we didn't have the corresponding wrapper lemmas.

Diff
@@ -356,6 +356,9 @@ def WellFoundedGT (α : Type*) [LT α] : Prop :=
   IsWellFounded α (· > ·)
 #align well_founded_gt WellFoundedGT
 
+lemma wellFounded_lt [LT α] [WellFoundedLT α] : @WellFounded α (· < ·) := IsWellFounded.wf
+lemma wellFounded_gt [LT α] [WellFoundedGT α] : @WellFounded α (· > ·) := IsWellFounded.wf
+
 -- See note [lower instance priority]
 instance (priority := 100) (α : Type*) [LT α] [h : WellFoundedLT α] : WellFoundedGT αᵒᵈ :=
   h
chore: bump Std to Std#340 (#8104)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -128,7 +128,7 @@ protected theorem IsTotal.isTrichotomous (r) [IsTotal α r] : IsTrichotomous α
 
 -- see Note [lower instance priority]
 instance (priority := 100) IsTotal.to_isRefl (r) [IsTotal α r] : IsRefl α r :=
-  ⟨fun a => (or_self_iff _).1 <| total_of r a a⟩
+  ⟨fun a => or_self_iff.1 <| total_of r a a⟩
 
 theorem ne_of_irrefl {r} [IsIrrefl α r] : ∀ {x y : α}, r x y → x ≠ y
   | _, _, h, rfl => irrefl _ h
fix: fix link in docstring of IsWellFounded (#7063)
Diff
@@ -271,7 +271,7 @@ instance (priority := 100) isStrictTotalOrder_of_isStrictTotalOrder [IsStrictTot
 /-! ### Well-order -/
 
 
-/-- A well-founded relation. Not to be confused with `isWellOrder`. -/
+/-- A well-founded relation. Not to be confused with `IsWellOrder`. -/
 @[mk_iff] class IsWellFounded (α : Type u) (r : α → α → Prop) : Prop where
   /-- The relation is `WellFounded`, as a proposition. -/
   wf : WellFounded r
chore: cleanup in Mathlib.Init (#6977)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -3,6 +3,7 @@ Copyright (c) 2020 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 -/
+import Mathlib.Init.Data.Nat.Lemmas
 import Mathlib.Logic.IsEmpty
 import Mathlib.Logic.Relation
 import Mathlib.Order.Basic
feat: patch for new alias command (#6172)
Diff
@@ -648,25 +648,25 @@ lemma subset_antisymm [IsAntisymm α (· ⊆ ·)] : a ⊆ b → b ⊆ a → a =
 lemma superset_antisymm [IsAntisymm α (· ⊆ ·)] : a ⊆ b → b ⊆ a → b = a := antisymm'
 #align superset_antisymm superset_antisymm
 
-alias subset_of_eq_of_subset ← Eq.trans_subset
+alias Eq.trans_subset := subset_of_eq_of_subset
 #align eq.trans_subset Eq.trans_subset
 
-alias subset_of_subset_of_eq ← HasSubset.subset.trans_eq
+alias HasSubset.subset.trans_eq := subset_of_subset_of_eq
 #align has_subset.subset.trans_eq HasSubset.subset.trans_eq
 
-alias subset_of_eq ← Eq.subset' --TODO: Fix it and kill `Eq.subset`
+alias Eq.subset' := subset_of_eq --TODO: Fix it and kill `Eq.subset`
 #align eq.subset' Eq.subset'
 
-alias superset_of_eq ← Eq.superset
+alias Eq.superset := superset_of_eq
 #align eq.superset Eq.superset
 
-alias subset_trans ← HasSubset.Subset.trans
+alias HasSubset.Subset.trans := subset_trans
 #align has_subset.subset.trans HasSubset.Subset.trans
 
-alias subset_antisymm ← HasSubset.Subset.antisymm
+alias HasSubset.Subset.antisymm := subset_antisymm
 #align has_subset.subset.antisymm HasSubset.Subset.antisymm
 
-alias superset_antisymm ← HasSubset.Subset.antisymm'
+alias HasSubset.Subset.antisymm' := superset_antisymm
 #align has_subset.subset.antisymm' HasSubset.Subset.antisymm'
 
 theorem subset_antisymm_iff [IsRefl α (· ⊆ ·)] [IsAntisymm α (· ⊆ ·)] : a = b ↔ a ⊆ b ∧ b ⊆ a :=
@@ -707,25 +707,25 @@ lemma ssubset_trans [IsTrans α (· ⊂ ·)] {a b c : α} : a ⊂ b → b ⊂ c
 lemma ssubset_asymm [IsAsymm α (· ⊂ ·)] {a b : α} : a ⊂ b → ¬b ⊂ a := asymm
 #align ssubset_asymm ssubset_asymm
 
-alias ssubset_of_eq_of_ssubset ← Eq.trans_ssubset
+alias Eq.trans_ssubset := ssubset_of_eq_of_ssubset
 #align eq.trans_ssubset Eq.trans_ssubset
 
-alias ssubset_of_ssubset_of_eq ← HasSSubset.SSubset.trans_eq
+alias HasSSubset.SSubset.trans_eq := ssubset_of_ssubset_of_eq
 #align has_ssubset.ssubset.trans_eq HasSSubset.SSubset.trans_eq
 
-alias ssubset_irrfl ← HasSSubset.SSubset.false
+alias HasSSubset.SSubset.false := ssubset_irrfl
 #align has_ssubset.ssubset.false HasSSubset.SSubset.false
 
-alias ne_of_ssubset ← HasSSubset.SSubset.ne
+alias HasSSubset.SSubset.ne := ne_of_ssubset
 #align has_ssubset.ssubset.ne HasSSubset.SSubset.ne
 
-alias ne_of_ssuperset ← HasSSubset.SSubset.ne'
+alias HasSSubset.SSubset.ne' := ne_of_ssuperset
 #align has_ssubset.ssubset.ne' HasSSubset.SSubset.ne'
 
-alias ssubset_trans ← HasSSubset.SSubset.trans
+alias HasSSubset.SSubset.trans := ssubset_trans
 #align has_ssubset.ssubset.trans HasSSubset.SSubset.trans
 
-alias ssubset_asymm ← HasSSubset.SSubset.asymm
+alias HasSSubset.SSubset.asymm := ssubset_asymm
 #align has_ssubset.ssubset.asymm HasSSubset.SSubset.asymm
 
 end Ssubset
@@ -753,16 +753,16 @@ theorem ssubset_of_subset_not_subset (h₁ : a ⊆ b) (h₂ : ¬b ⊆ a) : a ⊂
   ssubset_iff_subset_not_subset.2 ⟨h₁, h₂⟩
 #align ssubset_of_subset_not_subset ssubset_of_subset_not_subset
 
-alias subset_of_ssubset ← HasSSubset.SSubset.subset
+alias HasSSubset.SSubset.subset := subset_of_ssubset
 #align has_ssubset.ssubset.subset HasSSubset.SSubset.subset
 
-alias not_subset_of_ssubset ← HasSSubset.SSubset.not_subset
+alias HasSSubset.SSubset.not_subset := not_subset_of_ssubset
 #align has_ssubset.ssubset.not_subset HasSSubset.SSubset.not_subset
 
-alias not_ssubset_of_subset ← HasSubset.Subset.not_ssubset
+alias HasSubset.Subset.not_ssubset := not_ssubset_of_subset
 #align has_subset.subset.not_ssubset HasSubset.Subset.not_ssubset
 
-alias ssubset_of_subset_not_subset ← HasSubset.Subset.ssubset_of_not_subset
+alias HasSubset.Subset.ssubset_of_not_subset := ssubset_of_subset_not_subset
 #align has_subset.subset.ssubset_of_not_subset HasSubset.Subset.ssubset_of_not_subset
 
 theorem ssubset_of_subset_of_ssubset [IsTrans α (· ⊆ ·)] (h₁ : a ⊆ b) (h₂ : b ⊂ c) : a ⊂ c :=
@@ -789,22 +789,22 @@ theorem ssubset_or_eq_of_subset [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) : a 
   (eq_or_ssubset_of_subset h).symm
 #align ssubset_or_eq_of_subset ssubset_or_eq_of_subset
 
-alias ssubset_of_subset_of_ssubset ← HasSubset.Subset.trans_ssubset
+alias HasSubset.Subset.trans_ssubset := ssubset_of_subset_of_ssubset
 #align has_subset.subset.trans_ssubset HasSubset.Subset.trans_ssubset
 
-alias ssubset_of_ssubset_of_subset ← HasSSubset.SSubset.trans_subset
+alias HasSSubset.SSubset.trans_subset := ssubset_of_ssubset_of_subset
 #align has_ssubset.ssubset.trans_subset HasSSubset.SSubset.trans_subset
 
-alias ssubset_of_subset_of_ne ← HasSubset.Subset.ssubset_of_ne
+alias HasSubset.Subset.ssubset_of_ne := ssubset_of_subset_of_ne
 #align has_subset.subset.ssubset_of_ne HasSubset.Subset.ssubset_of_ne
 
-alias ssubset_of_ne_of_subset ← Ne.ssubset_of_subset
+alias Ne.ssubset_of_subset := ssubset_of_ne_of_subset
 #align ne.ssubset_of_subset Ne.ssubset_of_subset
 
-alias eq_or_ssubset_of_subset ← HasSubset.Subset.eq_or_ssubset
+alias HasSubset.Subset.eq_or_ssubset := eq_or_ssubset_of_subset
 #align has_subset.subset.eq_or_ssubset HasSubset.Subset.eq_or_ssubset
 
-alias ssubset_or_eq_of_subset ← HasSubset.Subset.ssubset_or_eq
+alias HasSubset.Subset.ssubset_or_eq := ssubset_or_eq_of_subset
 #align has_subset.subset.ssubset_or_eq HasSubset.Subset.ssubset_or_eq
 
 theorem ssubset_iff_subset_ne [IsAntisymm α (· ⊆ ·)] : a ⊂ b ↔ a ⊆ b ∧ a ≠ b :=
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -285,7 +285,7 @@ instance WellFoundedRelation.isWellFounded [h : WellFoundedRelation α] :
     IsWellFounded α WellFoundedRelation.rel :=
   { h with }
 
-theorem WellFoundedRelation.asymmetric {α : Sort _} [WellFoundedRelation α] {a b : α} :
+theorem WellFoundedRelation.asymmetric {α : Sort*} [WellFoundedRelation α] {a b : α} :
     WellFoundedRelation.rel a b → ¬ WellFoundedRelation.rel b a :=
   fun hab hba => WellFoundedRelation.asymmetric hba hab
 termination_by _ => a
@@ -311,12 +311,12 @@ theorem apply : ∀ a, Acc r a :=
 
 /-- Creates data, given a way to generate a value from all that compare as less under a well-founded
 relation. See also `IsWellFounded.fix_eq`. -/
-def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, r y x → C y) → C x) → ∀ x : α, C x :=
+def fix {C : α → Sort*} : (∀ x : α, (∀ y : α, r y x → C y) → C x) → ∀ x : α, C x :=
   wf.fix
 #align is_well_founded.fix IsWellFounded.fix
 
 /-- The value from `IsWellFounded.fix` is built from the previous ones as specified. -/
-theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, r y x → C y) → C x) :
+theorem fix_eq {C : α → Sort*} (F : ∀ x : α, (∀ y : α, r y x → C y) → C x) :
     ∀ x, fix r F x = F x fun y _ => fix r F y :=
   wf.fix_eq F
 #align is_well_founded.fix_eq IsWellFounded.fix_eq
@@ -327,7 +327,7 @@ def toWellFoundedRelation : WellFoundedRelation α :=
 
 end IsWellFounded
 
-theorem WellFounded.asymmetric {α : Sort _} {r : α → α → Prop} (h : WellFounded r) (a b) :
+theorem WellFounded.asymmetric {α : Sort*} {r : α → α → Prop} (h : WellFounded r) (a b) :
     r a b → ¬r b a :=
   @WellFoundedRelation.asymmetric _ ⟨_, h⟩ _ _
 #align well_founded.asymmetric WellFounded.asymmetric
@@ -345,29 +345,29 @@ instance (r : α → α → Prop) [i : IsWellFounded α r] : IsWellFounded α (R
 
 /-- A class for a well founded relation `<`. -/
 @[reducible]
-def WellFoundedLT (α : Type _) [LT α] : Prop :=
+def WellFoundedLT (α : Type*) [LT α] : Prop :=
   IsWellFounded α (· < ·)
 #align well_founded_lt WellFoundedLT
 
 /-- A class for a well founded relation `>`. -/
 @[reducible]
-def WellFoundedGT (α : Type _) [LT α] : Prop :=
+def WellFoundedGT (α : Type*) [LT α] : Prop :=
   IsWellFounded α (· > ·)
 #align well_founded_gt WellFoundedGT
 
 -- See note [lower instance priority]
-instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedLT α] : WellFoundedGT αᵒᵈ :=
+instance (priority := 100) (α : Type*) [LT α] [h : WellFoundedLT α] : WellFoundedGT αᵒᵈ :=
   h
 
 -- See note [lower instance priority]
-instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedGT α] : WellFoundedLT αᵒᵈ :=
+instance (priority := 100) (α : Type*) [LT α] [h : WellFoundedGT α] : WellFoundedLT αᵒᵈ :=
   h
 
-theorem wellFoundedGT_dual_iff (α : Type _) [LT α] : WellFoundedGT αᵒᵈ ↔ WellFoundedLT α :=
+theorem wellFoundedGT_dual_iff (α : Type*) [LT α] : WellFoundedGT αᵒᵈ ↔ WellFoundedLT α :=
   ⟨fun h => ⟨h.wf⟩, fun h => ⟨h.wf⟩⟩
 #align well_founded_gt_dual_iff wellFoundedGT_dual_iff
 
-theorem wellFoundedLT_dual_iff (α : Type _) [LT α] : WellFoundedLT αᵒᵈ ↔ WellFoundedGT α :=
+theorem wellFoundedLT_dual_iff (α : Type*) [LT α] : WellFoundedLT αᵒᵈ ↔ WellFoundedGT α :=
   ⟨fun h => ⟨h.wf⟩, fun h => ⟨h.wf⟩⟩
 #align well_founded_lt_dual_iff wellFoundedLT_dual_iff
 
@@ -412,12 +412,12 @@ theorem apply : ∀ a : α, Acc (· < ·) a :=
 
 /-- Creates data, given a way to generate a value from all that compare as lesser. See also
 `WellFoundedLT.fix_eq`. -/
-def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, y < x → C y) → C x) → ∀ x : α, C x :=
+def fix {C : α → Sort*} : (∀ x : α, (∀ y : α, y < x → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· < ·)
 #align well_founded_lt.fix WellFoundedLT.fix
 
 /-- The value from `WellFoundedLT.fix` is built from the previous ones as specified. -/
-theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, y < x → C y) → C x) :
+theorem fix_eq {C : α → Sort*} (F : ∀ x : α, (∀ y : α, y < x → C y) → C x) :
     ∀ x, fix F x = F x fun y _ => fix F y :=
   IsWellFounded.fix_eq _ F
 #align well_founded_lt.fix_eq WellFoundedLT.fix_eq
@@ -444,12 +444,12 @@ theorem apply : ∀ a : α, Acc (· > ·) a :=
 
 /-- Creates data, given a way to generate a value from all that compare as greater. See also
 `WellFoundedGT.fix_eq`. -/
-def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, x < y → C y) → C x) → ∀ x : α, C x :=
+def fix {C : α → Sort*} : (∀ x : α, (∀ y : α, x < y → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· > ·)
 #align well_founded_gt.fix WellFoundedGT.fix
 
 /-- The value from `WellFoundedGT.fix` is built from the successive ones as specified. -/
-theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, x < y → C y) → C x) :
+theorem fix_eq {C : α → Sort*} (F : ∀ x : α, (∀ y : α, x < y → C y) → C x) :
     ∀ x, fix F x = F x fun y _ => fix F y :=
   IsWellFounded.fix_eq _ F
 #align well_founded_gt.fix_eq WellFoundedGT.fix_eq
@@ -588,7 +588,7 @@ end Prod
 /-- An unbundled relation class stating that `r` is the nonstrict relation corresponding to the
 strict relation `s`. Compare `Preorder.lt_iff_le_not_le`. This is mostly meant to provide dot
 notation on `(⊆)` and `(⊂)`. -/
-class IsNonstrictStrictOrder (α : Type _) (r : semiOutParam (α → α → Prop)) (s : α → α → Prop) :
+class IsNonstrictStrictOrder (α : Type*) (r : semiOutParam (α → α → Prop)) (s : α → α → Prop) :
     Prop where
   /-- The relation `r` is the nonstrict relation corresponding to the strict relation `s`. -/
   right_iff_left_not_left (a b : α) : s a b ↔ r a b ∧ ¬r b a
feat: Linter that checks that Prop classes are Props (#6148)
Diff
@@ -588,7 +588,8 @@ end Prod
 /-- An unbundled relation class stating that `r` is the nonstrict relation corresponding to the
 strict relation `s`. Compare `Preorder.lt_iff_le_not_le`. This is mostly meant to provide dot
 notation on `(⊆)` and `(⊂)`. -/
-class IsNonstrictStrictOrder (α : Type _) (r : semiOutParam (α → α → Prop)) (s : α → α → Prop) where
+class IsNonstrictStrictOrder (α : Type _) (r : semiOutParam (α → α → Prop)) (s : α → α → Prop) :
+    Prop where
   /-- The relation `r` is the nonstrict relation corresponding to the strict relation `s`. -/
   right_iff_left_not_left (a b : α) : s a b ↔ r a b ∧ ¬r b a
 #align is_nonstrict_strict_order IsNonstrictStrictOrder
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2020 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
-
-! This file was ported from Lean 3 source module order.rel_classes
-! leanprover-community/mathlib commit 7413128c3bcb3b0818e3e18720abc9ea3100fb49
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Logic.IsEmpty
 import Mathlib.Logic.Relation
 import Mathlib.Order.Basic
 
+#align_import order.rel_classes from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
+
 /-!
 # Unbundled relation classes
 
feat: missing WellFoundedLT instances (#5899)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -521,6 +521,24 @@ theorem Subrelation.isWellFounded (r : α → α → Prop) [IsWellFounded α r]
   ⟨h.wf IsWellFounded.wf⟩
 #align subrelation.is_well_founded Subrelation.isWellFounded
 
+instance Prod.wellFoundedLT [PartialOrder α] [WellFoundedLT α] [Preorder β] [WellFoundedLT β] :
+    WellFoundedLT (α × β) where
+  wf := by
+    refine @Subrelation.wf (α × β) (Prod.Lex (· < ·) (· < ·)) (· < ·) ?_ IsWellFounded.wf
+    rintro ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ w
+    simp only [Prod.mk_lt_mk] at w
+    rcases eq_or_ne a₁ a₂ with rfl | ha
+    · right
+      simpa using w
+    · left
+      rcases w with ⟨a_lt, _⟩ | ⟨a_le, _⟩
+      · assumption
+      · exact Ne.lt_of_le ha a_le
+
+instance Prod.wellFoundedGT [PartialOrder α] [WellFoundedGT α] [Preorder β] [WellFoundedGT β] :
+    WellFoundedGT (α × β) :=
+  @Prod.wellFoundedLT αᵒᵈ βᵒᵈ _ _ _ _
+
 namespace Set
 
 /-- An unbounded or cofinal set. -/
chore: bump to nightly-2023-07-01 (#5409)

Open in Gitpod

Co-authored-by: Komyyy <pol_tta@outlook.jp> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -513,7 +513,7 @@ instance [IsWellOrder α r] [IsWellOrder β s] : IsWellOrder (α × β) (Prod.Le
 instance (r : α → α → Prop) [IsWellFounded α r] (f : β → α) : IsWellFounded _ (InvImage r f) :=
   ⟨InvImage.wf f IsWellFounded.wf⟩
 
-instance (f : α → ℕ) : IsWellFounded _ (Measure f) :=
+instance (f : α → ℕ) : IsWellFounded _ (InvImage (· < ·) f) :=
   ⟨(measure f).wf⟩
 
 theorem Subrelation.isWellFounded (r : α → α → Prop) [IsWellFounded α r] {s : α → α → Prop}
feat: port RingTheory.Valuation.ValuationSubring (#4791)

Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Xavier-François Roblot <46200072+xroblot@users.noreply.github.com>

Diff
@@ -862,7 +862,7 @@ instance [PartialOrder α] : IsPartialOrder α (· ≤ ·) where
 
 instance [PartialOrder α] : IsPartialOrder α (· ≥ ·) where
 
-instance [LinearOrder α] : IsTotal α (· ≤ ·) :=
+instance LE.isTotal [LinearOrder α] : IsTotal α (· ≤ ·) :=
   ⟨le_total⟩
 
 instance [LinearOrder α] : IsTotal α (· ≥ ·) :=
chore: fix grammar 3/3 (#5003)

Part 3 of #5001

Diff
@@ -184,7 +184,7 @@ theorem extensional_of_trichotomous_of_irrefl (r : α → α → Prop) [IsTricho
     <| irrefl b
 #align extensional_of_trichotomous_of_irrefl extensional_of_trichotomous_of_irrefl
 
-/-- Construct a partial order from a `isStrictOrder` relation.
+/-- Construct a partial order from an `isStrictOrder` relation.
 
 See note [reducible non-instances]. -/
 @[reducible]
@@ -469,7 +469,7 @@ noncomputable def IsWellOrder.linearOrder (r : α → α → Prop) [IsWellOrder
   linearOrderOfSTO r
 #align is_well_order.linear_order IsWellOrder.linearOrder
 
-/-- Derive a `WellFoundedRelation` instance from a `IsWellOrder` instance. -/
+/-- Derive a `WellFoundedRelation` instance from an `IsWellOrder` instance. -/
 def IsWellOrder.toHasWellFounded [LT α] [hwo : IsWellOrder α (· < ·)] : WellFoundedRelation α where
   rel := (· < ·)
   wf := hwo.wf
feat: add compile_inductive% and compile_def% commands (#4097)

Add a #compile inductive command to compile the recursors of an inductive type, which works by creating a recursive definition and using @[csimp].

Co-authored-by: Parth Shastri <31370288+cppio@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -312,10 +312,8 @@ theorem apply : ∀ a, Acc r a :=
   wf.apply
 #align is_well_founded.apply IsWellFounded.apply
 
--- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as less under a well-founded
 relation. See also `IsWellFounded.fix_eq`. -/
-noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, r y x → C y) → C x) → ∀ x : α, C x :=
   wf.fix
 #align is_well_founded.fix IsWellFounded.fix
@@ -415,10 +413,8 @@ theorem apply : ∀ a : α, Acc (· < ·) a :=
   IsWellFounded.apply _
 #align well_founded_lt.apply WellFoundedLT.apply
 
--- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as lesser. See also
 `WellFoundedLT.fix_eq`. -/
-noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, y < x → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· < ·)
 #align well_founded_lt.fix WellFoundedLT.fix
@@ -449,10 +445,8 @@ theorem apply : ∀ a : α, Acc (· > ·) a :=
   IsWellFounded.apply _
 #align well_founded_gt.apply WellFoundedGT.apply
 
--- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as greater. See also
 `WellFoundedGT.fix_eq`. -/
-noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, x < y → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· > ·)
 #align well_founded_gt.fix WellFoundedGT.fix
feat: add Mathlib.Tactic.Common, and import (#4056)

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>

Diff
@@ -11,7 +11,6 @@ Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 import Mathlib.Logic.IsEmpty
 import Mathlib.Logic.Relation
 import Mathlib.Order.Basic
-import Mathlib.Tactic.MkIffOfInductiveProp
 
 /-!
 # Unbundled relation classes
fix: correct names of LinearOrder decidable fields (#4006)

This renames

  • decidable_eq to decidableEq
  • decidable_lt to decidableLT
  • decidable_le to decidableLE
  • decidableLT_of_decidableLE to decidableLTOfDecidableLE
  • decidableEq_of_decidableLE to decidableEqOfDecidableLE

These fields are data not proofs, so they should be lowerCamelCased.

Diff
@@ -226,7 +226,7 @@ def linearOrderOfSTO (r) [IsStrictTotalOrder α r] [∀ x y, Decidable ¬r x y]
       | _, Or.inr (Or.inr h) => Or.inr (Or.inr h),
     toMin := minOfLe,
     toMax := maxOfLe,
-    decidable_le := hD }
+    decidableLE := hD }
 set_option linter.uppercaseLean3 false in
 #align linear_order_of_STO linearOrderOfSTO
 
feat: well-founded or transitive relations don't have cycles (#3793)

Match https://github.com/leanprover-community/mathlib/pull/18512

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 
 ! This file was ported from Lean 3 source module order.rel_classes
-! leanprover-community/mathlib commit 172bf2812857f5e56938cc148b7a539f52f84ca9
+! leanprover-community/mathlib commit 7413128c3bcb3b0818e3e18720abc9ea3100fb49
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathlib.Order.Basic
 import Mathlib.Logic.IsEmpty
+import Mathlib.Logic.Relation
+import Mathlib.Order.Basic
 import Mathlib.Tactic.MkIffOfInductiveProp
 
 /-!
@@ -345,6 +346,9 @@ instance (priority := 100) (r : α → α → Prop) [IsWellFounded α r] : IsAsy
 instance (priority := 100) (r : α → α → Prop) [IsWellFounded α r] : IsIrrefl α r :=
   IsAsymm.isIrrefl
 
+instance (r : α → α → Prop) [i : IsWellFounded α r] : IsWellFounded α (Relation.TransGen r) :=
+  ⟨i.wf.transGen⟩
+
 /-- A class for a well founded relation `<`. -/
 @[reducible]
 def WellFoundedLT (α : Type _) [LT α] : Prop :=
chore: bump to nightly-2023-04-11 (#3139)
Diff
@@ -576,7 +576,7 @@ end Prod
 /-- An unbundled relation class stating that `r` is the nonstrict relation corresponding to the
 strict relation `s`. Compare `Preorder.lt_iff_le_not_le`. This is mostly meant to provide dot
 notation on `(⊆)` and `(⊂)`. -/
-class IsNonstrictStrictOrder (α : Type _) (r s : α → α → Prop) where
+class IsNonstrictStrictOrder (α : Type _) (r : semiOutParam (α → α → Prop)) (s : α → α → Prop) where
   /-- The relation `r` is the nonstrict relation corresponding to the strict relation `s`. -/
   right_iff_left_not_left (a b : α) : s a b ↔ r a b ∧ ¬r b a
 #align is_nonstrict_strict_order IsNonstrictStrictOrder
@@ -592,9 +592,6 @@ theorem right_iff_left_not_left_of (r s : α → α → Prop) [IsNonstrictStrict
   right_iff_left_not_left
 #align right_iff_left_not_left_of right_iff_left_not_left_of
 
--- The free parameter `r` is strictly speaking not uniquely determined by `s`, but in practice it
--- always has a unique instance, so this is not dangerous.
-@[nolint dangerousInstance]
 instance {s : α → α → Prop} [IsNonstrictStrictOrder α r s] : IsIrrefl α s :=
   ⟨fun _ h => ((right_iff_left_not_left_of r s).1 h).2 ((right_iff_left_not_left_of r s).1 h).1⟩
 
feat: pnat is well-order (#3245)

Mathlib 3: https://github.com/leanprover-community/mathlib/pull/18700

Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 
 ! This file was ported from Lean 3 source module order.rel_classes
-! leanprover-community/mathlib commit bc7d81beddb3d6c66f71449c5bc76c38cb77cf9e
+! leanprover-community/mathlib commit 172bf2812857f5e56938cc148b7a539f52f84ca9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -283,7 +283,9 @@ instance (priority := 100) isStrictTotalOrder_of_isStrictTotalOrder [IsStrictTot
 #align has_well_founded WellFoundedRelation
 set_option linter.uppercaseLean3 false in
 #align has_well_founded.R WellFoundedRelation.rel
-instance [h : WellFoundedRelation α] : IsWellFounded α WellFoundedRelation.rel :=
+
+instance WellFoundedRelation.isWellFounded [h : WellFoundedRelation α] :
+    IsWellFounded α WellFoundedRelation.rel :=
   { h with }
 
 theorem WellFoundedRelation.asymmetric {α : Sort _} [WellFoundedRelation α] {a b : α} :
chore: update SHA of already forward-ported files (#2181)

Update some SHAs of files that changed in mathlib3.

These 17 files need mainly only updated SHA as they've been only touched by backports or already have been forward-ported.

The relevant changes are:

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
 
 ! This file was ported from Lean 3 source module order.rel_classes
-! leanprover-community/mathlib commit c4658a649d216f57e99621708b09dcb3dcccbd23
+! leanprover-community/mathlib commit bc7d81beddb3d6c66f71449c5bc76c38cb77cf9e
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -603,39 +603,57 @@ variable [HasSubset α] {a b c : α}
 
 lemma subset_of_eq_of_subset (hab : a = b) (hbc : b ⊆ c) : a ⊆ c := by rwa [hab]
 #align subset_of_eq_of_subset subset_of_eq_of_subset
+
 lemma subset_of_subset_of_eq (hab : a ⊆ b) (hbc : b = c) : a ⊆ c := by rwa [←hbc]
 #align subset_of_subset_of_eq subset_of_subset_of_eq
-@[refl] lemma subset_refl [IsRefl α (· ⊆ ·)] (a : α) : a ⊆ a := refl _
+
+@[refl]
+lemma subset_refl [IsRefl α (· ⊆ ·)] (a : α) : a ⊆ a := refl _
 #align subset_refl subset_refl
+
 lemma subset_rfl [IsRefl α (· ⊆ ·)] : a ⊆ a := refl _
 #align subset_rfl subset_rfl
+
 lemma subset_of_eq [IsRefl α (· ⊆ ·)] : a = b → a ⊆ b := fun h => h ▸ subset_rfl
 #align subset_of_eq subset_of_eq
+
 lemma superset_of_eq [IsRefl α (· ⊆ ·)] : a = b → b ⊆ a := fun h => h ▸ subset_rfl
 #align superset_of_eq superset_of_eq
+
 lemma ne_of_not_subset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → a ≠ b := mt subset_of_eq
 #align ne_of_not_subset ne_of_not_subset
+
 lemma ne_of_not_superset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → b ≠ a := mt superset_of_eq
 #align ne_of_not_superset ne_of_not_superset
-@[trans] lemma subset_trans [IsTrans α (· ⊆ ·)] {a b c : α} : a ⊆ b → b ⊆ c → a ⊆ c := _root_.trans
+
+@[trans]
+lemma subset_trans [IsTrans α (· ⊆ ·)] {a b c : α} : a ⊆ b → b ⊆ c → a ⊆ c := _root_.trans
 #align subset_trans subset_trans
+
 lemma subset_antisymm [IsAntisymm α (· ⊆ ·)] : a ⊆ b → b ⊆ a → a = b := antisymm
 #align subset_antisymm subset_antisymm
+
 lemma superset_antisymm [IsAntisymm α (· ⊆ ·)] : a ⊆ b → b ⊆ a → b = a := antisymm'
 #align superset_antisymm superset_antisymm
 
 alias subset_of_eq_of_subset ← Eq.trans_subset
 #align eq.trans_subset Eq.trans_subset
+
 alias subset_of_subset_of_eq ← HasSubset.subset.trans_eq
 #align has_subset.subset.trans_eq HasSubset.subset.trans_eq
+
 alias subset_of_eq ← Eq.subset' --TODO: Fix it and kill `Eq.subset`
 #align eq.subset' Eq.subset'
+
 alias superset_of_eq ← Eq.superset
 #align eq.superset Eq.superset
+
 alias subset_trans ← HasSubset.Subset.trans
 #align has_subset.subset.trans HasSubset.Subset.trans
+
 alias subset_antisymm ← HasSubset.Subset.antisymm
 #align has_subset.subset.antisymm HasSubset.Subset.antisymm
+
 alias superset_antisymm ← HasSubset.Subset.antisymm'
 #align has_subset.subset.antisymm' HasSubset.Subset.antisymm'
 
@@ -654,33 +672,47 @@ variable [HasSSubset α] {a b c : α}
 
 lemma ssubset_of_eq_of_ssubset (hab : a = b) (hbc : b ⊂ c) : a ⊂ c := by rwa [hab]
 #align ssubset_of_eq_of_ssubset ssubset_of_eq_of_ssubset
+
 lemma ssubset_of_ssubset_of_eq (hab : a ⊂ b) (hbc : b = c) : a ⊂ c := by rwa [←hbc]
 #align ssubset_of_ssubset_of_eq ssubset_of_ssubset_of_eq
+
 lemma ssubset_irrefl [IsIrrefl α (· ⊂ ·)] (a : α) : ¬a ⊂ a := irrefl _
 #align ssubset_irrefl ssubset_irrefl
+
 lemma ssubset_irrfl [IsIrrefl α (· ⊂ ·)] {a : α} : ¬a ⊂ a := irrefl _
 #align ssubset_irrfl ssubset_irrfl
+
 lemma ne_of_ssubset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → a ≠ b := ne_of_irrefl
 #align ne_of_ssubset ne_of_ssubset
+
 lemma ne_of_ssuperset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → b ≠ a := ne_of_irrefl'
 #align ne_of_ssuperset ne_of_ssuperset
-@[trans] lemma ssubset_trans [IsTrans α (· ⊂ ·)] {a b c : α} : a ⊂ b → b ⊂ c → a ⊂ c := _root_.trans
+
+@[trans]
+lemma ssubset_trans [IsTrans α (· ⊂ ·)] {a b c : α} : a ⊂ b → b ⊂ c → a ⊂ c := _root_.trans
 #align ssubset_trans ssubset_trans
+
 lemma ssubset_asymm [IsAsymm α (· ⊂ ·)] {a b : α} : a ⊂ b → ¬b ⊂ a := asymm
 #align ssubset_asymm ssubset_asymm
 
 alias ssubset_of_eq_of_ssubset ← Eq.trans_ssubset
 #align eq.trans_ssubset Eq.trans_ssubset
+
 alias ssubset_of_ssubset_of_eq ← HasSSubset.SSubset.trans_eq
 #align has_ssubset.ssubset.trans_eq HasSSubset.SSubset.trans_eq
+
 alias ssubset_irrfl ← HasSSubset.SSubset.false
 #align has_ssubset.ssubset.false HasSSubset.SSubset.false
+
 alias ne_of_ssubset ← HasSSubset.SSubset.ne
 #align has_ssubset.ssubset.ne HasSSubset.SSubset.ne
+
 alias ne_of_ssuperset ← HasSSubset.SSubset.ne'
 #align has_ssubset.ssubset.ne' HasSSubset.SSubset.ne'
+
 alias ssubset_trans ← HasSSubset.SSubset.trans
 #align has_ssubset.ssubset.trans HasSSubset.SSubset.trans
+
 alias ssubset_asymm ← HasSSubset.SSubset.asymm
 #align has_ssubset.ssubset.asymm HasSSubset.SSubset.asymm
 
feat: port Order.Extension.Well (#2333)
Diff
@@ -291,6 +291,11 @@ theorem WellFoundedRelation.asymmetric {α : Sort _} [WellFoundedRelation α] {a
   fun hab hba => WellFoundedRelation.asymmetric hba hab
 termination_by _ => a
 
+lemma WellFounded.prod_lex {ra : α → α → Prop} {rb : β → β → Prop} (ha : WellFounded ra)
+    (hb : WellFounded rb) : WellFounded (Prod.Lex ra rb) :=
+  (Prod.lex ⟨_, ha⟩ ⟨_, hb⟩).wf
+#align prod.lex_wf WellFounded.prod_lex
+
 namespace IsWellFounded
 
 variable (r) [IsWellFounded α r]
@@ -489,7 +494,7 @@ instance (priority := 100) [IsEmpty α] (r : α → α → Prop) : IsWellOrder 
   wf := wellFounded_of_isEmpty r
 
 instance [IsWellFounded α r] [IsWellFounded β s] : IsWellFounded (α × β) (Prod.Lex r s) :=
-  ⟨(Prod.lex (IsWellFounded.toWellFoundedRelation _) (IsWellFounded.toWellFoundedRelation _)).wf⟩
+  ⟨IsWellFounded.wf.prod_lex IsWellFounded.wf⟩
 
 instance [IsWellOrder α r] [IsWellOrder β s] : IsWellOrder (α × β) (Prod.Lex r s) where
   trichotomous := fun ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ =>
@@ -505,8 +510,6 @@ instance [IsWellOrder α r] [IsWellOrder β s] : IsWellOrder (α × β) (Prod.Le
     cases' h₁ with a₁ a₂ b₁ b₂ ab a₁ b₁ b₂ ab <;> cases' h₂ with _ _ c₁ c₂ bc _ _ c₂ bc
     exacts [.left _ _ (_root_.trans ab bc), .left _ _ ab, .left _ _ bc,
       .right _ (_root_.trans ab bc)]
-  wf := (Prod.lex (IsWellFounded.toWellFoundedRelation _)
-    (IsWellFounded.toWellFoundedRelation _)).wf
 
 instance (r : α → α → Prop) [IsWellFounded α r] (f : β → α) : IsWellFounded _ (InvImage r f) :=
   ⟨InvImage.wf f IsWellFounded.wf⟩
chore: add missing #align statements (#1902)

This PR is the result of a slight variant on the following "algorithm"

  • take all mathlib 3 names, remove _ and make all uppercase letters into lowercase
  • take all mathlib 4 names, remove _ and make all uppercase letters into lowercase
  • look for matches, and create pairs (original_lean3_name, OriginalLean4Name)
  • for pairs that do not have an align statement:
    • use Lean 4 to lookup the file + position of the Lean 4 name
    • add an #align statement just before the next empty line
  • manually fix some tiny mistakes (e.g., empty lines in proofs might cause the #align statement to have been inserted too early)
Diff
@@ -30,16 +30,20 @@ open Function
 
 theorem of_eq [IsRefl α r] : ∀ {a b}, a = b → r a b
   | _, _, .refl _ => refl _
+#align of_eq of_eq
 
 theorem comm [IsSymm α r] {a b : α} : r a b ↔ r b a :=
   ⟨symm, symm⟩
+#align comm comm
 
 theorem antisymm' [IsAntisymm α r] {a b : α} : r a b → r b a → b = a := fun h h' => antisymm h' h
+#align antisymm' antisymm'
 
 theorem antisymm_iff [IsRefl α r] [IsAntisymm α r] {a b : α} : r a b ∧ r b a ↔ a = b :=
   ⟨fun h => antisymm h.1 h.2, by
     rintro rfl
     exact ⟨refl _, refl _⟩⟩
+#align antisymm_iff antisymm_iff
 
 /-- A version of `antisymm` with `r` explicit.
 
@@ -47,6 +51,7 @@ This lemma matches the lemmas from lean core in `Init.Algebra.Classes`, but is m
 @[elab_without_expected_type]
 theorem antisymm_of (r : α → α → Prop) [IsAntisymm α r] {a b : α} : r a b → r b a → a = b :=
   antisymm
+#align antisymm_of antisymm_of
 
 /-- A version of `antisymm'` with `r` explicit.
 
@@ -54,57 +59,74 @@ This lemma matches the lemmas from lean core in `Init.Algebra.Classes`, but is m
 @[elab_without_expected_type]
 theorem antisymm_of' (r : α → α → Prop) [IsAntisymm α r] {a b : α} : r a b → r b a → b = a :=
   antisymm'
+#align antisymm_of' antisymm_of'
 
 /-- A version of `comm` with `r` explicit.
 
 This lemma matches the lemmas from lean core in `Init.Algebra.Classes`, but is missing there.  -/
 theorem comm_of (r : α → α → Prop) [IsSymm α r] {a b : α} : r a b ↔ r b a :=
   comm
+#align comm_of comm_of
 
 theorem IsRefl.swap (r) [IsRefl α r] : IsRefl α (swap r) :=
   ⟨refl_of r⟩
+#align is_refl.swap IsRefl.swap
 
 theorem IsIrrefl.swap (r) [IsIrrefl α r] : IsIrrefl α (swap r) :=
   ⟨irrefl_of r⟩
+#align is_irrefl.swap IsIrrefl.swap
 
 theorem IsTrans.swap (r) [IsTrans α r] : IsTrans α (swap r) :=
   ⟨fun _ _ _ h₁ h₂ => trans_of r h₂ h₁⟩
+#align is_trans.swap IsTrans.swap
 
 theorem IsAntisymm.swap (r) [IsAntisymm α r] : IsAntisymm α (swap r) :=
   ⟨fun _ _ h₁ h₂ => _root_.antisymm h₂ h₁⟩
+#align is_antisymm.swap IsAntisymm.swap
 
 theorem IsAsymm.swap (r) [IsAsymm α r] : IsAsymm α (swap r) :=
   ⟨fun _ _ h₁ h₂ => asymm_of r h₂ h₁⟩
+#align is_asymm.swap IsAsymm.swap
 
 theorem IsTotal.swap (r) [IsTotal α r] : IsTotal α (swap r) :=
   ⟨fun a b => (total_of r a b).symm⟩
+#align is_total.swap IsTotal.swap
 
 theorem IsTrichotomous.swap (r) [IsTrichotomous α r] : IsTrichotomous α (swap r) :=
   ⟨fun a b => by simpa [Function.swap, or_comm, or_left_comm] using trichotomous_of r a b⟩
+#align is_trichotomous.swap IsTrichotomous.swap
 
 theorem IsPreorder.swap (r) [IsPreorder α r] : IsPreorder α (swap r) :=
   { @IsRefl.swap α r _, @IsTrans.swap α r _ with }
+#align is_preorder.swap IsPreorder.swap
 
 theorem IsStrictOrder.swap (r) [IsStrictOrder α r] : IsStrictOrder α (swap r) :=
   { @IsIrrefl.swap α r _, @IsTrans.swap α r _ with }
+#align is_strict_order.swap IsStrictOrder.swap
 
 theorem IsPartialOrder.swap (r) [IsPartialOrder α r] : IsPartialOrder α (swap r) :=
   { @IsPreorder.swap α r _, @IsAntisymm.swap α r _ with }
+#align is_partial_order.swap IsPartialOrder.swap
 
 theorem IsTotalPreorder.swap (r) [IsTotalPreorder α r] : IsTotalPreorder α (swap r) :=
   { @IsPreorder.swap α r _, @IsTotal.swap α r _ with }
+#align is_total_preorder.swap IsTotalPreorder.swap
 
 theorem IsLinearOrder.swap (r) [IsLinearOrder α r] : IsLinearOrder α (swap r) :=
   { @IsPartialOrder.swap α r _, @IsTotal.swap α r _ with }
+#align is_linear_order.swap IsLinearOrder.swap
 
 protected theorem IsAsymm.isAntisymm (r) [IsAsymm α r] : IsAntisymm α r :=
   ⟨fun _ _ h₁ h₂ => (_root_.asymm h₁ h₂).elim⟩
+#align is_asymm.is_antisymm IsAsymm.isAntisymm
 
 protected theorem IsAsymm.isIrrefl [IsAsymm α r] : IsIrrefl α r :=
   ⟨fun _ h => _root_.asymm h h⟩
+#align is_asymm.is_irrefl IsAsymm.isIrrefl
 
 protected theorem IsTotal.isTrichotomous (r) [IsTotal α r] : IsTrichotomous α r :=
   ⟨fun a b => or_left_comm.1 (Or.inr <| total_of r a b)⟩
+#align is_total.is_trichotomous IsTotal.isTrichotomous
 
 -- see Note [lower instance priority]
 instance (priority := 100) IsTotal.to_isRefl (r) [IsTotal α r] : IsRefl α r :=
@@ -112,22 +134,28 @@ instance (priority := 100) IsTotal.to_isRefl (r) [IsTotal α r] : IsRefl α r :=
 
 theorem ne_of_irrefl {r} [IsIrrefl α r] : ∀ {x y : α}, r x y → x ≠ y
   | _, _, h, rfl => irrefl _ h
+#align ne_of_irrefl ne_of_irrefl
 
 theorem ne_of_irrefl' {r} [IsIrrefl α r] : ∀ {x y : α}, r x y → y ≠ x
   | _, _, h, rfl => irrefl _ h
+#align ne_of_irrefl' ne_of_irrefl'
 
 theorem not_rel_of_subsingleton (r) [IsIrrefl α r] [Subsingleton α] (x y) : ¬r x y :=
   Subsingleton.elim x y ▸ irrefl x
+#align not_rel_of_subsingleton not_rel_of_subsingleton
 
 theorem rel_of_subsingleton (r) [IsRefl α r] [Subsingleton α] (x y) : r x y :=
   Subsingleton.elim x y ▸ refl x
+#align rel_of_subsingleton rel_of_subsingleton
 
 @[simp]
 theorem empty_relation_apply (a b : α) : EmptyRelation a b ↔ False :=
   Iff.rfl
+#align empty_relation_apply empty_relation_apply
 
 theorem eq_empty_relation (r) [IsIrrefl α r] [Subsingleton α] : r = EmptyRelation :=
   funext₂ <| by simpa using not_rel_of_subsingleton r
+#align eq_empty_relation eq_empty_relation
 
 instance : IsIrrefl α EmptyRelation :=
   ⟨fun _ => id⟩
@@ -137,20 +165,24 @@ theorem trans_trichotomous_left [IsTrans α r] [IsTrichotomous α r] {a b c : α
   intro h₁ h₂
   rcases trichotomous_of r a b with (h₃ | rfl | h₃)
   exacts [_root_.trans h₃ h₂, h₂, absurd h₃ h₁]
+#align trans_trichotomous_left trans_trichotomous_left
 
 theorem trans_trichotomous_right [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
     r a b → ¬r c b → r a c := by
   intro h₁ h₂
   rcases trichotomous_of r b c with (h₃ | rfl | h₃)
   exacts [_root_.trans h₁ h₃, h₁, absurd h₃ h₂]
+#align trans_trichotomous_right trans_trichotomous_right
 
 theorem transitive_of_trans (r : α → α → Prop) [IsTrans α r] : Transitive r := IsTrans.trans
+#align transitive_of_trans transitive_of_trans
 
 /-- In a trichotomous irreflexive order, every element is determined by the set of predecessors. -/
 theorem extensional_of_trichotomous_of_irrefl (r : α → α → Prop) [IsTrichotomous α r] [IsIrrefl α r]
     {a b : α} (H : ∀ x, r x a ↔ r x b) : a = b :=
   ((@trichotomous _ r _ a b).resolve_left <| mt (H _).2 <| irrefl a).resolve_right <| mt (H _).1
     <| irrefl b
+#align extensional_of_trichotomous_of_irrefl extensional_of_trichotomous_of_irrefl
 
 /-- Construct a partial order from a `isStrictOrder` relation.
 
@@ -173,6 +205,8 @@ def partialOrderOfSO (r) [IsStrictOrder α r] : PartialOrder α where
   lt_iff_le_not_le x y :=
     ⟨fun h => ⟨Or.inr h, not_or_of_not (fun e => by rw [e] at h; exact irrefl _ h) (asymm h)⟩,
       fun ⟨h₁, h₂⟩ => h₁.resolve_left fun e => h₂ <| e ▸ Or.inl rfl⟩
+set_option linter.uppercaseLean3 false in
+#align partial_order_of_SO partialOrderOfSO
 
 /-- Construct a linear order from an `IsStrictTotalOrder` relation.
 
@@ -192,9 +226,12 @@ def linearOrderOfSTO (r) [IsStrictTotalOrder α r] [∀ x y, Decidable ¬r x y]
     toMin := minOfLe,
     toMax := maxOfLe,
     decidable_le := hD }
+set_option linter.uppercaseLean3 false in
+#align linear_order_of_STO linearOrderOfSTO
 
 theorem IsStrictTotalOrder.swap (r) [IsStrictTotalOrder α r] : IsStrictTotalOrder α (swap r) :=
   { IsTrichotomous.swap r, IsStrictOrder.swap r with }
+#align is_strict_total_order.swap IsStrictTotalOrder.swap
 
 /-! ### Order connection -/
 
@@ -205,10 +242,12 @@ theorem IsStrictTotalOrder.swap (r) [IsStrictTotalOrder α r] : IsStrictTotalOrd
 class IsOrderConnected (α : Type u) (lt : α → α → Prop) : Prop where
   /-- A connected order is one satisfying the condition `a < c → a < b ∨ b < c`. -/
   conn : ∀ a b c, lt a c → lt a b ∨ lt b c
+#align is_order_connected IsOrderConnected
 
 theorem IsOrderConnected.neg_trans {r : α → α → Prop} [IsOrderConnected α r] {a b c}
     (h₁ : ¬r a b) (h₂ : ¬r b c) : ¬r a c :=
   mt (IsOrderConnected.conn a b c) <| by simp [h₁, h₂]
+#align is_order_connected.neg_trans IsOrderConnected.neg_trans
 
 theorem isStrictWeakOrder_of_isOrderConnected [IsAsymm α r] [IsOrderConnected α r] :
     IsStrictWeakOrder α r :=
@@ -238,6 +277,8 @@ instance (priority := 100) isStrictTotalOrder_of_isStrictTotalOrder [IsStrictTot
 @[mk_iff] class IsWellFounded (α : Type u) (r : α → α → Prop) : Prop where
   /-- The relation is `WellFounded`, as a proposition. -/
   wf : WellFounded r
+#align is_well_founded IsWellFounded
+#align is_well_founded_iff IsWellFounded_iff
 
 #align has_well_founded WellFoundedRelation
 set_option linter.uppercaseLean3 false in
@@ -257,10 +298,12 @@ variable (r) [IsWellFounded α r]
 /-- Induction on a well-founded relation. -/
 theorem induction {C : α → Prop} : ∀ a, (∀ x, (∀ y, r y x → C y) → C x) → C a :=
   wf.induction
+#align is_well_founded.induction IsWellFounded.induction
 
 /-- All values are accessible under the well-founded relation. -/
 theorem apply : ∀ a, Acc r a :=
   wf.apply
+#align is_well_founded.apply IsWellFounded.apply
 
 -- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as less under a well-founded
@@ -268,11 +311,13 @@ relation. See also `IsWellFounded.fix_eq`. -/
 noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, r y x → C y) → C x) → ∀ x : α, C x :=
   wf.fix
+#align is_well_founded.fix IsWellFounded.fix
 
 /-- The value from `IsWellFounded.fix` is built from the previous ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, r y x → C y) → C x) :
     ∀ x, fix r F x = F x fun y _ => fix r F y :=
   wf.fix_eq F
+#align is_well_founded.fix_eq IsWellFounded.fix_eq
 
 /-- Derive a `WellFoundedRelation` instance from an `isWellFounded` instance. -/
 def toWellFoundedRelation : WellFoundedRelation α :=
@@ -283,6 +328,7 @@ end IsWellFounded
 theorem WellFounded.asymmetric {α : Sort _} {r : α → α → Prop} (h : WellFounded r) (a b) :
     r a b → ¬r b a :=
   @WellFoundedRelation.asymmetric _ ⟨_, h⟩ _ _
+#align well_founded.asymmetric WellFounded.asymmetric
 
 -- see Note [lower instance priority]
 instance (priority := 100) (r : α → α → Prop) [IsWellFounded α r] : IsAsymm α r :=
@@ -296,11 +342,13 @@ instance (priority := 100) (r : α → α → Prop) [IsWellFounded α r] : IsIrr
 @[reducible]
 def WellFoundedLT (α : Type _) [LT α] : Prop :=
   IsWellFounded α (· < ·)
+#align well_founded_lt WellFoundedLT
 
 /-- A class for a well founded relation `>`. -/
 @[reducible]
 def WellFoundedGT (α : Type _) [LT α] : Prop :=
   IsWellFounded α (· > ·)
+#align well_founded_gt WellFoundedGT
 
 -- See note [lower instance priority]
 instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedLT α] : WellFoundedGT αᵒᵈ :=
@@ -312,13 +360,16 @@ instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedGT α] : WellFo
 
 theorem wellFoundedGT_dual_iff (α : Type _) [LT α] : WellFoundedGT αᵒᵈ ↔ WellFoundedLT α :=
   ⟨fun h => ⟨h.wf⟩, fun h => ⟨h.wf⟩⟩
+#align well_founded_gt_dual_iff wellFoundedGT_dual_iff
 
 theorem wellFoundedLT_dual_iff (α : Type _) [LT α] : WellFoundedLT αᵒᵈ ↔ WellFoundedGT α :=
   ⟨fun h => ⟨h.wf⟩, fun h => ⟨h.wf⟩⟩
+#align well_founded_lt_dual_iff wellFoundedLT_dual_iff
 
 /-- A well order is a well-founded linear order. -/
 class IsWellOrder (α : Type u) (r : α → α → Prop) extends
   IsTrichotomous α r, IsTrans α r, IsWellFounded α r : Prop
+#align is_well_order IsWellOrder
 
 -- see Note [lower instance priority]
 instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] :
@@ -347,10 +398,12 @@ variable [LT α] [WellFoundedLT α]
 /-- Inducts on a well-founded `<` relation. -/
 theorem induction {C : α → Prop} : ∀ a, (∀ x, (∀ y, y < x → C y) → C x) → C a :=
   IsWellFounded.induction _
+#align well_founded_lt.induction WellFoundedLT.induction
 
 /-- All values are accessible under the well-founded `<`. -/
 theorem apply : ∀ a : α, Acc (· < ·) a :=
   IsWellFounded.apply _
+#align well_founded_lt.apply WellFoundedLT.apply
 
 -- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as lesser. See also
@@ -358,11 +411,13 @@ theorem apply : ∀ a : α, Acc (· < ·) a :=
 noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, y < x → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· < ·)
+#align well_founded_lt.fix WellFoundedLT.fix
 
 /-- The value from `WellFoundedLT.fix` is built from the previous ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, y < x → C y) → C x) :
     ∀ x, fix F x = F x fun y _ => fix F y :=
   IsWellFounded.fix_eq _ F
+#align well_founded_lt.fix_eq WellFoundedLT.fix_eq
 
 /-- Derive a `WellFoundedRelation` instance from a `WellFoundedLT` instance. -/
 def toWellFoundedRelation : WellFoundedRelation α :=
@@ -377,10 +432,12 @@ variable [LT α] [WellFoundedGT α]
 /-- Inducts on a well-founded `>` relation. -/
 theorem induction {C : α → Prop} : ∀ a, (∀ x, (∀ y, x < y → C y) → C x) → C a :=
   IsWellFounded.induction _
+#align well_founded_gt.induction WellFoundedGT.induction
 
 /-- All values are accessible under the well-founded `>`. -/
 theorem apply : ∀ a : α, Acc (· > ·) a :=
   IsWellFounded.apply _
+#align well_founded_gt.apply WellFoundedGT.apply
 
 -- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as greater. See also
@@ -388,11 +445,13 @@ theorem apply : ∀ a : α, Acc (· > ·) a :=
 noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, x < y → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· > ·)
+#align well_founded_gt.fix WellFoundedGT.fix
 
 /-- The value from `WellFoundedGT.fix` is built from the successive ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, x < y → C y) → C x) :
     ∀ x, fix F x = F x fun y _ => fix F y :=
   IsWellFounded.fix_eq _ F
+#align well_founded_gt.fix_eq WellFoundedGT.fix_eq
 
 /-- Derive a `WellFoundedRelation` instance from a `WellFoundedGT` instance. -/
 def toWellFoundedRelation : WellFoundedRelation α :=
@@ -404,11 +463,13 @@ end WellFoundedGT
 noncomputable def IsWellOrder.linearOrder (r : α → α → Prop) [IsWellOrder α r] : LinearOrder α :=
   letI := fun x y => Classical.dec ¬r x y
   linearOrderOfSTO r
+#align is_well_order.linear_order IsWellOrder.linearOrder
 
 /-- Derive a `WellFoundedRelation` instance from a `IsWellOrder` instance. -/
 def IsWellOrder.toHasWellFounded [LT α] [hwo : IsWellOrder α (· < ·)] : WellFoundedRelation α where
   rel := (· < ·)
   wf := hwo.wf
+#align is_well_order.to_has_well_founded IsWellOrder.toHasWellFounded
 
 -- This isn't made into an instance as it loops with `IsIrrefl α r`.
 theorem Subsingleton.isWellOrder [Subsingleton α] (r : α → α → Prop) [hr : IsIrrefl α r] :
@@ -417,6 +478,7 @@ theorem Subsingleton.isWellOrder [Subsingleton α] (r : α → α → Prop) [hr
     trichotomous := fun a b => Or.inr <| Or.inl <| Subsingleton.elim a b,
     trans := fun a b _ h => (not_rel_of_subsingleton r a b h).elim,
     wf := ⟨fun a => ⟨_, fun y h => (not_rel_of_subsingleton r y a h).elim⟩⟩ }
+#align subsingleton.is_well_order Subsingleton.isWellOrder
 
 instance [Subsingleton α] : IsWellOrder α EmptyRelation :=
   Subsingleton.isWellOrder _
@@ -455,27 +517,33 @@ instance (f : α → ℕ) : IsWellFounded _ (Measure f) :=
 theorem Subrelation.isWellFounded (r : α → α → Prop) [IsWellFounded α r] {s : α → α → Prop}
     (h : Subrelation s r) : IsWellFounded α s :=
   ⟨h.wf IsWellFounded.wf⟩
+#align subrelation.is_well_founded Subrelation.isWellFounded
 
 namespace Set
 
 /-- An unbounded or cofinal set. -/
 def Unbounded (r : α → α → Prop) (s : Set α) : Prop :=
   ∀ a, ∃ b ∈ s, ¬r b a
+#align set.unbounded Set.Unbounded
 
 /-- A bounded or final set. Not to be confused with `Metric.bounded`. -/
 def Bounded (r : α → α → Prop) (s : Set α) : Prop :=
   ∃ a, ∀ b ∈ s, r b a
+#align set.bounded Set.Bounded
 
 @[simp]
 theorem not_bounded_iff {r : α → α → Prop} (s : Set α) : ¬Bounded r s ↔ Unbounded r s := by
   simp only [Bounded, Unbounded, not_forall, not_exists, exists_prop, not_and, not_not]
+#align set.not_bounded_iff Set.not_bounded_iff
 
 @[simp]
 theorem not_unbounded_iff {r : α → α → Prop} (s : Set α) : ¬Unbounded r s ↔ Bounded r s := by
   rw [not_iff_comm, not_bounded_iff]
+#align set.not_unbounded_iff Set.not_unbounded_iff
 
 theorem unbounded_of_isEmpty [IsEmpty α] {r : α → α → Prop} (s : Set α) : Unbounded r s :=
   isEmptyElim
+#align set.unbounded_of_is_empty Set.unbounded_of_isEmpty
 
 end Set
 
@@ -506,15 +574,18 @@ notation on `(⊆)` and `(⊂)`. -/
 class IsNonstrictStrictOrder (α : Type _) (r s : α → α → Prop) where
   /-- The relation `r` is the nonstrict relation corresponding to the strict relation `s`. -/
   right_iff_left_not_left (a b : α) : s a b ↔ r a b ∧ ¬r b a
+#align is_nonstrict_strict_order IsNonstrictStrictOrder
 
 theorem right_iff_left_not_left {r s : α → α → Prop} [IsNonstrictStrictOrder α r s] {a b : α} :
     s a b ↔ r a b ∧ ¬r b a :=
   IsNonstrictStrictOrder.right_iff_left_not_left _ _
+#align right_iff_left_not_left right_iff_left_not_left
 
 /-- A version of `right_iff_left_not_left` with explicit `r` and `s`. -/
 theorem right_iff_left_not_left_of (r s : α → α → Prop) [IsNonstrictStrictOrder α r s] {a b : α} :
     s a b ↔ r a b ∧ ¬r b a :=
   right_iff_left_not_left
+#align right_iff_left_not_left_of right_iff_left_not_left_of
 
 -- The free parameter `r` is strictly speaking not uniquely determined by `s`, but in practice it
 -- always has a unique instance, so this is not dangerous.
@@ -563,12 +634,15 @@ alias subset_trans ← HasSubset.Subset.trans
 alias subset_antisymm ← HasSubset.Subset.antisymm
 #align has_subset.subset.antisymm HasSubset.Subset.antisymm
 alias superset_antisymm ← HasSubset.Subset.antisymm'
+#align has_subset.subset.antisymm' HasSubset.Subset.antisymm'
 
 theorem subset_antisymm_iff [IsRefl α (· ⊆ ·)] [IsAntisymm α (· ⊆ ·)] : a = b ↔ a ⊆ b ∧ b ⊆ a :=
   ⟨fun h => ⟨h.subset', h.superset⟩, fun h => h.1.antisymm h.2⟩
+#align subset_antisymm_iff subset_antisymm_iff
 
 theorem superset_antisymm_iff [IsRefl α (· ⊆ ·)] [IsAntisymm α (· ⊆ ·)] : a = b ↔ b ⊆ a ∧ a ⊆ b :=
   ⟨fun h => ⟨h.superset, h.subset'⟩, fun h => h.1.antisymm' h.2⟩
+#align superset_antisymm_iff superset_antisymm_iff
 
 end Subset
 
@@ -615,63 +689,85 @@ variable [HasSubset α] [HasSSubset α] [IsNonstrictStrictOrder α (· ⊆ ·) (
 
 theorem ssubset_iff_subset_not_subset : a ⊂ b ↔ a ⊆ b ∧ ¬b ⊆ a :=
   right_iff_left_not_left
+#align ssubset_iff_subset_not_subset ssubset_iff_subset_not_subset
 
 theorem subset_of_ssubset (h : a ⊂ b) : a ⊆ b :=
   (ssubset_iff_subset_not_subset.1 h).1
+#align subset_of_ssubset subset_of_ssubset
 
 theorem not_subset_of_ssubset (h : a ⊂ b) : ¬b ⊆ a :=
   (ssubset_iff_subset_not_subset.1 h).2
+#align not_subset_of_ssubset not_subset_of_ssubset
 
 theorem not_ssubset_of_subset (h : a ⊆ b) : ¬b ⊂ a := fun h' => not_subset_of_ssubset h' h
+#align not_ssubset_of_subset not_ssubset_of_subset
 
 theorem ssubset_of_subset_not_subset (h₁ : a ⊆ b) (h₂ : ¬b ⊆ a) : a ⊂ b :=
   ssubset_iff_subset_not_subset.2 ⟨h₁, h₂⟩
+#align ssubset_of_subset_not_subset ssubset_of_subset_not_subset
 
 alias subset_of_ssubset ← HasSSubset.SSubset.subset
 #align has_ssubset.ssubset.subset HasSSubset.SSubset.subset
 
 alias not_subset_of_ssubset ← HasSSubset.SSubset.not_subset
+#align has_ssubset.ssubset.not_subset HasSSubset.SSubset.not_subset
 
 alias not_ssubset_of_subset ← HasSubset.Subset.not_ssubset
+#align has_subset.subset.not_ssubset HasSubset.Subset.not_ssubset
 
 alias ssubset_of_subset_not_subset ← HasSubset.Subset.ssubset_of_not_subset
+#align has_subset.subset.ssubset_of_not_subset HasSubset.Subset.ssubset_of_not_subset
 
 theorem ssubset_of_subset_of_ssubset [IsTrans α (· ⊆ ·)] (h₁ : a ⊆ b) (h₂ : b ⊂ c) : a ⊂ c :=
   (h₁.trans h₂.subset).ssubset_of_not_subset fun h => h₂.not_subset <| h.trans h₁
+#align ssubset_of_subset_of_ssubset ssubset_of_subset_of_ssubset
 
 theorem ssubset_of_ssubset_of_subset [IsTrans α (· ⊆ ·)] (h₁ : a ⊂ b) (h₂ : b ⊆ c) : a ⊂ c :=
   (h₁.subset.trans h₂).ssubset_of_not_subset fun h => h₁.not_subset <| h₂.trans h
+#align ssubset_of_ssubset_of_subset ssubset_of_ssubset_of_subset
 
 theorem ssubset_of_subset_of_ne [IsAntisymm α (· ⊆ ·)] (h₁ : a ⊆ b) (h₂ : a ≠ b) : a ⊂ b :=
   h₁.ssubset_of_not_subset <| mt h₁.antisymm h₂
+#align ssubset_of_subset_of_ne ssubset_of_subset_of_ne
 
 theorem ssubset_of_ne_of_subset [IsAntisymm α (· ⊆ ·)] (h₁ : a ≠ b) (h₂ : a ⊆ b) : a ⊂ b :=
   ssubset_of_subset_of_ne h₂ h₁
+#align ssubset_of_ne_of_subset ssubset_of_ne_of_subset
 
 theorem eq_or_ssubset_of_subset [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) : a = b ∨ a ⊂ b :=
   (em (b ⊆ a)).imp h.antisymm h.ssubset_of_not_subset
+#align eq_or_ssubset_of_subset eq_or_ssubset_of_subset
 
 theorem ssubset_or_eq_of_subset [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) : a ⊂ b ∨ a = b :=
   (eq_or_ssubset_of_subset h).symm
+#align ssubset_or_eq_of_subset ssubset_or_eq_of_subset
 
 alias ssubset_of_subset_of_ssubset ← HasSubset.Subset.trans_ssubset
+#align has_subset.subset.trans_ssubset HasSubset.Subset.trans_ssubset
 
 alias ssubset_of_ssubset_of_subset ← HasSSubset.SSubset.trans_subset
+#align has_ssubset.ssubset.trans_subset HasSSubset.SSubset.trans_subset
 
 alias ssubset_of_subset_of_ne ← HasSubset.Subset.ssubset_of_ne
+#align has_subset.subset.ssubset_of_ne HasSubset.Subset.ssubset_of_ne
 
 alias ssubset_of_ne_of_subset ← Ne.ssubset_of_subset
+#align ne.ssubset_of_subset Ne.ssubset_of_subset
 
 alias eq_or_ssubset_of_subset ← HasSubset.Subset.eq_or_ssubset
+#align has_subset.subset.eq_or_ssubset HasSubset.Subset.eq_or_ssubset
 
 alias ssubset_or_eq_of_subset ← HasSubset.Subset.ssubset_or_eq
+#align has_subset.subset.ssubset_or_eq HasSubset.Subset.ssubset_or_eq
 
 theorem ssubset_iff_subset_ne [IsAntisymm α (· ⊆ ·)] : a ⊂ b ↔ a ⊆ b ∧ a ≠ b :=
   ⟨fun h => ⟨h.subset, h.ne⟩, fun h => h.1.ssubset_of_ne h.2⟩
+#align ssubset_iff_subset_ne ssubset_iff_subset_ne
 
 theorem subset_iff_ssubset_or_eq [IsRefl α (· ⊆ ·)] [IsAntisymm α (· ⊆ ·)] :
     a ⊆ b ↔ a ⊂ b ∨ a = b :=
   ⟨fun h => h.ssubset_or_eq, fun h => h.elim subset_of_ssubset subset_of_eq⟩
+#align subset_iff_ssubset_or_eq subset_iff_ssubset_or_eq
 
 end SubsetSsubset
 
@@ -772,15 +868,19 @@ instance [LinearOrder α] : IsStrictWeakOrder α (· < ·) := by infer_instance
 
 theorem transitive_le [Preorder α] : Transitive (@LE.le α _) :=
   transitive_of_trans _
+#align transitive_le transitive_le
 
 theorem transitive_lt [Preorder α] : Transitive (@LT.lt α _) :=
   transitive_of_trans _
+#align transitive_lt transitive_lt
 
 theorem transitive_ge [Preorder α] : Transitive (@GE.ge α _) :=
   transitive_of_trans _
+#align transitive_ge transitive_ge
 
 theorem transitive_gt [Preorder α] : Transitive (@GT.gt α _) :=
   transitive_of_trans _
+#align transitive_gt transitive_gt
 
 instance OrderDual.isTotal_le [LE α] [h : IsTotal α (· ≤ ·)] : IsTotal αᵒᵈ (· ≤ ·) :=
   @IsTotal.swap α _ h
feat: add uppercase lean 3 linter (#1796)

Implements a linter for lean 3 declarations containing capital letters (as suggested on Zulip).

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -240,6 +240,7 @@ instance (priority := 100) isStrictTotalOrder_of_isStrictTotalOrder [IsStrictTot
   wf : WellFounded r
 
 #align has_well_founded WellFoundedRelation
+set_option linter.uppercaseLean3 false in
 #align has_well_founded.R WellFoundedRelation.rel
 instance [h : WellFoundedRelation α] : IsWellFounded α WellFoundedRelation.rel :=
   { h with }
Feat: prove IsTrans α r → Trans r r r and Trans r r r → IsTrans α r (#1522)

Now Trans.trans conflicts with _root_.trans.

Diff
@@ -135,24 +135,16 @@ instance : IsIrrefl α EmptyRelation :=
 theorem trans_trichotomous_left [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
     ¬r b a → r b c → r a c := by
   intro h₁ h₂
-  rcases trichotomous_of r a b with (h₃ | h₃ | h₃)
-  exact trans h₃ h₂
-  rw [h₃]
-  exact h₂
-  exfalso
-  exact h₁ h₃
+  rcases trichotomous_of r a b with (h₃ | rfl | h₃)
+  exacts [_root_.trans h₃ h₂, h₂, absurd h₃ h₁]
 
 theorem trans_trichotomous_right [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
     r a b → ¬r c b → r a c := by
   intro h₁ h₂
-  rcases trichotomous_of r b c with (h₃ | h₃ | h₃)
-  exact trans h₁ h₃
-  rw [← h₃]
-  exact h₁
-  exfalso
-  exact h₂ h₃
+  rcases trichotomous_of r b c with (h₃ | rfl | h₃)
+  exacts [_root_.trans h₁ h₃, h₁, absurd h₃ h₂]
 
-theorem transitive_of_trans (r : α → α → Prop) [IsTrans α r] : Transitive r := fun _ _ _ => trans
+theorem transitive_of_trans (r : α → α → Prop) [IsTrans α r] : Transitive r := IsTrans.trans
 
 /-- In a trichotomous irreflexive order, every element is determined by the set of predecessors. -/
 theorem extensional_of_trichotomous_of_irrefl (r : α → α → Prop) [IsTrichotomous α r] [IsIrrefl α r]
@@ -172,7 +164,7 @@ def partialOrderOfSO (r) [IsStrictOrder α r] : PartialOrder α where
     match y, z, h₁, h₂ with
     | _, _, Or.inl rfl, h₂ => h₂
     | _, _, h₁, Or.inl rfl => h₁
-    | _, _, Or.inr h₁, Or.inr h₂ => Or.inr (trans h₁ h₂)
+    | _, _, Or.inr h₁, Or.inr h₂ => Or.inr (_root_.trans h₁ h₂)
   le_antisymm x y h₁ h₂ :=
     match y, h₁, h₂ with
     | _, Or.inl rfl, _ => rfl
@@ -206,7 +198,6 @@ theorem IsStrictTotalOrder.swap (r) [IsStrictTotalOrder α r] : IsStrictTotalOrd
 
 /-! ### Order connection -/
 
-
 /-- A connected order is one satisfying the condition `a < c → a < b ∨ b < c`.
   This is recognizable as an intuitionistic substitute for `a ≤ b ∨ b ≤ a` on
   the constructive reals, and is also known as negative transitivity,
@@ -230,7 +221,8 @@ theorem isStrictWeakOrder_of_isOrderConnected [IsAsymm α r] [IsOrderConnected 
 -- see Note [lower instance priority]
 instance (priority := 100) isStrictOrderConnected_of_isStrictTotalOrder [IsStrictTotalOrder α r] :
     IsOrderConnected α r :=
-  ⟨λ _ _ _ h => (trichotomous _ _).imp_right fun o => o.elim (fun e => e ▸ h) fun h' => trans h' h⟩
+  ⟨λ _ _ _ h => (trichotomous _ _).imp_right
+    fun o => o.elim (fun e => e ▸ h) fun h' => _root_.trans h' h⟩
 #align is_order_connected_of_is_strict_total_order isStrictOrderConnected_of_isStrictTotalOrder
 
 -- see Note [lower instance priority]
@@ -448,10 +440,8 @@ instance [IsWellOrder α r] [IsWellOrder β s] : IsWellOrder (α × β) (Prod.Le
         | Or.inr (Or.inl (.refl _)) => Or.inr <| Or.inl rfl
   trans a b c h₁ h₂ := by
     cases' h₁ with a₁ a₂ b₁ b₂ ab a₁ b₁ b₂ ab <;> cases' h₂ with _ _ c₁ c₂ bc _ _ c₂ bc
-    · exact Prod.Lex.left _ _ (trans ab bc)
-    · exact Prod.Lex.left _ _ ab
-    · exact Prod.Lex.left _ _ bc
-    · exact Prod.Lex.right _ (trans ab bc)
+    exacts [.left _ _ (_root_.trans ab bc), .left _ _ ab, .left _ _ bc,
+      .right _ (_root_.trans ab bc)]
   wf := (Prod.lex (IsWellFounded.toWellFoundedRelation _)
     (IsWellFounded.toWellFoundedRelation _)).wf
 
@@ -552,7 +542,7 @@ lemma ne_of_not_subset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → a ≠ b := mt sub
 #align ne_of_not_subset ne_of_not_subset
 lemma ne_of_not_superset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → b ≠ a := mt superset_of_eq
 #align ne_of_not_superset ne_of_not_superset
-@[trans] lemma subset_trans [IsTrans α (· ⊆ ·)] {a b c : α} : a ⊆ b → b ⊆ c → a ⊆ c := trans
+@[trans] lemma subset_trans [IsTrans α (· ⊆ ·)] {a b c : α} : a ⊆ b → b ⊆ c → a ⊆ c := _root_.trans
 #align subset_trans subset_trans
 lemma subset_antisymm [IsAntisymm α (· ⊆ ·)] : a ⊆ b → b ⊆ a → a = b := antisymm
 #align subset_antisymm subset_antisymm
@@ -596,7 +586,7 @@ lemma ne_of_ssubset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → a ≠ b :
 #align ne_of_ssubset ne_of_ssubset
 lemma ne_of_ssuperset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → b ≠ a := ne_of_irrefl'
 #align ne_of_ssuperset ne_of_ssuperset
-@[trans] lemma ssubset_trans [IsTrans α (· ⊂ ·)] {a b c : α} : a ⊂ b → b ⊂ c → a ⊂ c := trans
+@[trans] lemma ssubset_trans [IsTrans α (· ⊂ ·)] {a b c : α} : a ⊂ b → b ⊂ c → a ⊂ c := _root_.trans
 #align ssubset_trans ssubset_trans
 lemma ssubset_asymm [IsAsymm α (· ⊂ ·)] {a b : α} : a ⊂ b → ¬b ⊂ a := asymm
 #align ssubset_asymm ssubset_asymm
Diff
@@ -533,48 +533,44 @@ instance {s : α → α → Prop} [IsNonstrictStrictOrder α r s] : IsIrrefl α
 
 /-! #### `⊆` and `⊂` -/
 
-
 section Subset
-
 variable [HasSubset α] {a b c : α}
 
-@[refl]
-theorem subset_refl [IsRefl α (· ⊆ ·)] (a : α) : a ⊆ a :=
-  refl _
-
-theorem subset_rfl [IsRefl α (· ⊆ ·)] : a ⊆ a :=
-  refl _
-
-theorem subset_of_eq [IsRefl α (· ⊆ ·)] : a = b → a ⊆ b := fun h => h ▸ subset_rfl
-
-theorem superset_of_eq [IsRefl α (· ⊆ ·)] : a = b → b ⊆ a := fun h => h ▸ subset_rfl
-
-theorem ne_of_not_subset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → a ≠ b :=
-  mt subset_of_eq
-
-theorem ne_of_not_superset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → b ≠ a :=
-  mt superset_of_eq
-
-@[trans]
-theorem subset_trans [IsTrans α (· ⊆ ·)] {a b c : α} : a ⊆ b → b ⊆ c → a ⊆ c :=
-  trans
-
-theorem subset_antisymm [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) (h' : b ⊆ a) : a = b :=
-  antisymm h h'
-
-theorem superset_antisymm [IsAntisymm α (· ⊆ ·)] (h : a ⊆ b) (h' : b ⊆ a) : b = a :=
-  antisymm' h h'
-
-alias subset_of_eq ← Eq.subset'
-
---TODO: Fix it and kill `Eq.subset`
+lemma subset_of_eq_of_subset (hab : a = b) (hbc : b ⊆ c) : a ⊆ c := by rwa [hab]
+#align subset_of_eq_of_subset subset_of_eq_of_subset
+lemma subset_of_subset_of_eq (hab : a ⊆ b) (hbc : b = c) : a ⊆ c := by rwa [←hbc]
+#align subset_of_subset_of_eq subset_of_subset_of_eq
+@[refl] lemma subset_refl [IsRefl α (· ⊆ ·)] (a : α) : a ⊆ a := refl _
+#align subset_refl subset_refl
+lemma subset_rfl [IsRefl α (· ⊆ ·)] : a ⊆ a := refl _
+#align subset_rfl subset_rfl
+lemma subset_of_eq [IsRefl α (· ⊆ ·)] : a = b → a ⊆ b := fun h => h ▸ subset_rfl
+#align subset_of_eq subset_of_eq
+lemma superset_of_eq [IsRefl α (· ⊆ ·)] : a = b → b ⊆ a := fun h => h ▸ subset_rfl
+#align superset_of_eq superset_of_eq
+lemma ne_of_not_subset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → a ≠ b := mt subset_of_eq
+#align ne_of_not_subset ne_of_not_subset
+lemma ne_of_not_superset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → b ≠ a := mt superset_of_eq
+#align ne_of_not_superset ne_of_not_superset
+@[trans] lemma subset_trans [IsTrans α (· ⊆ ·)] {a b c : α} : a ⊆ b → b ⊆ c → a ⊆ c := trans
+#align subset_trans subset_trans
+lemma subset_antisymm [IsAntisymm α (· ⊆ ·)] : a ⊆ b → b ⊆ a → a = b := antisymm
+#align subset_antisymm subset_antisymm
+lemma superset_antisymm [IsAntisymm α (· ⊆ ·)] : a ⊆ b → b ⊆ a → b = a := antisymm'
+#align superset_antisymm superset_antisymm
+
+alias subset_of_eq_of_subset ← Eq.trans_subset
+#align eq.trans_subset Eq.trans_subset
+alias subset_of_subset_of_eq ← HasSubset.subset.trans_eq
+#align has_subset.subset.trans_eq HasSubset.subset.trans_eq
+alias subset_of_eq ← Eq.subset' --TODO: Fix it and kill `Eq.subset`
+#align eq.subset' Eq.subset'
 alias superset_of_eq ← Eq.superset
 #align eq.superset Eq.superset
-
 alias subset_trans ← HasSubset.Subset.trans
-
+#align has_subset.subset.trans HasSubset.Subset.trans
 alias subset_antisymm ← HasSubset.Subset.antisymm
-
+#align has_subset.subset.antisymm HasSubset.Subset.antisymm
 alias superset_antisymm ← HasSubset.Subset.antisymm'
 
 theorem subset_antisymm_iff [IsRefl α (· ⊆ ·)] [IsAntisymm α (· ⊆ ·)] : a = b ↔ a ⊆ b ∧ b ⊆ a :=
@@ -586,38 +582,39 @@ theorem superset_antisymm_iff [IsRefl α (· ⊆ ·)] [IsAntisymm α (· ⊆ ·)
 end Subset
 
 section Ssubset
-
-variable [HasSSubset α]
-
-theorem ssubset_irrefl [IsIrrefl α (· ⊂ ·)] (a : α) : ¬a ⊂ a :=
-  irrefl _
-
-theorem ssubset_irrfl [IsIrrefl α (· ⊂ ·)] {a : α} : ¬a ⊂ a :=
-  irrefl _
-
-theorem ne_of_ssubset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → a ≠ b :=
-  ne_of_irrefl
-
-theorem ne_of_ssuperset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → b ≠ a :=
-  ne_of_irrefl'
-
-@[trans]
-theorem ssubset_trans [IsTrans α (· ⊂ ·)] {a b c : α} : a ⊂ b → b ⊂ c → a ⊂ c :=
-  trans
-
-theorem ssubset_asymm [IsAsymm α (· ⊂ ·)] {a b : α} (h : a ⊂ b) : ¬b ⊂ a :=
-  asymm h
-
+variable [HasSSubset α] {a b c : α}
+
+lemma ssubset_of_eq_of_ssubset (hab : a = b) (hbc : b ⊂ c) : a ⊂ c := by rwa [hab]
+#align ssubset_of_eq_of_ssubset ssubset_of_eq_of_ssubset
+lemma ssubset_of_ssubset_of_eq (hab : a ⊂ b) (hbc : b = c) : a ⊂ c := by rwa [←hbc]
+#align ssubset_of_ssubset_of_eq ssubset_of_ssubset_of_eq
+lemma ssubset_irrefl [IsIrrefl α (· ⊂ ·)] (a : α) : ¬a ⊂ a := irrefl _
+#align ssubset_irrefl ssubset_irrefl
+lemma ssubset_irrfl [IsIrrefl α (· ⊂ ·)] {a : α} : ¬a ⊂ a := irrefl _
+#align ssubset_irrfl ssubset_irrfl
+lemma ne_of_ssubset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → a ≠ b := ne_of_irrefl
+#align ne_of_ssubset ne_of_ssubset
+lemma ne_of_ssuperset [IsIrrefl α (· ⊂ ·)] {a b : α} : a ⊂ b → b ≠ a := ne_of_irrefl'
+#align ne_of_ssuperset ne_of_ssuperset
+@[trans] lemma ssubset_trans [IsTrans α (· ⊂ ·)] {a b c : α} : a ⊂ b → b ⊂ c → a ⊂ c := trans
+#align ssubset_trans ssubset_trans
+lemma ssubset_asymm [IsAsymm α (· ⊂ ·)] {a b : α} : a ⊂ b → ¬b ⊂ a := asymm
+#align ssubset_asymm ssubset_asymm
+
+alias ssubset_of_eq_of_ssubset ← Eq.trans_ssubset
+#align eq.trans_ssubset Eq.trans_ssubset
+alias ssubset_of_ssubset_of_eq ← HasSSubset.SSubset.trans_eq
+#align has_ssubset.ssubset.trans_eq HasSSubset.SSubset.trans_eq
 alias ssubset_irrfl ← HasSSubset.SSubset.false
-
+#align has_ssubset.ssubset.false HasSSubset.SSubset.false
 alias ne_of_ssubset ← HasSSubset.SSubset.ne
 #align has_ssubset.ssubset.ne HasSSubset.SSubset.ne
-
 alias ne_of_ssuperset ← HasSSubset.SSubset.ne'
-
+#align has_ssubset.ssubset.ne' HasSSubset.SSubset.ne'
 alias ssubset_trans ← HasSSubset.SSubset.trans
-
+#align has_ssubset.ssubset.trans HasSSubset.SSubset.trans
 alias ssubset_asymm ← HasSSubset.SSubset.asymm
+#align has_ssubset.ssubset.asymm HasSSubset.SSubset.asymm
 
 end Ssubset
 
chore: remove iff_self from simp only after lean4#1933 (#1406)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -477,7 +477,7 @@ def Bounded (r : α → α → Prop) (s : Set α) : Prop :=
 
 @[simp]
 theorem not_bounded_iff {r : α → α → Prop} (s : Set α) : ¬Bounded r s ↔ Unbounded r s := by
-  simp only [Bounded, Unbounded, not_forall, not_exists, exists_prop, not_and, not_not, iff_self]
+  simp only [Bounded, Unbounded, not_forall, not_exists, exists_prop, not_and, not_not]
 
 @[simp]
 theorem not_unbounded_iff {r : α → α → Prop} (s : Set α) : ¬Unbounded r s ↔ Bounded r s := by
chore: fix more casing errors per naming scheme (#1232)

I've avoided anything under Tactic or test.

In correcting the names, I found Option.isNone_iff_eq_none duplicated between Std and Mathlib, so the Mathlib one has been removed.

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Diff
@@ -107,7 +107,7 @@ protected theorem IsTotal.isTrichotomous (r) [IsTotal α r] : IsTrichotomous α
   ⟨fun a b => or_left_comm.1 (Or.inr <| total_of r a b)⟩
 
 -- see Note [lower instance priority]
-instance (priority := 100) IsTotal.to_is_refl (r) [IsTotal α r] : IsRefl α r :=
+instance (priority := 100) IsTotal.to_isRefl (r) [IsTotal α r] : IsRefl α r :=
   ⟨fun a => (or_self_iff _).1 <| total_of r a a⟩
 
 theorem ne_of_irrefl {r} [IsIrrefl α r] : ∀ {x y : α}, r x y → x ≠ y
@@ -301,26 +301,26 @@ instance (priority := 100) (r : α → α → Prop) [IsWellFounded α r] : IsIrr
 
 /-- A class for a well founded relation `<`. -/
 @[reducible]
-def WellFoundedLt (α : Type _) [LT α] : Prop :=
+def WellFoundedLT (α : Type _) [LT α] : Prop :=
   IsWellFounded α (· < ·)
 
 /-- A class for a well founded relation `>`. -/
 @[reducible]
-def WellFoundedGt (α : Type _) [LT α] : Prop :=
+def WellFoundedGT (α : Type _) [LT α] : Prop :=
   IsWellFounded α (· > ·)
 
 -- See note [lower instance priority]
-instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedLt α] : WellFoundedGt αᵒᵈ :=
+instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedLT α] : WellFoundedGT αᵒᵈ :=
   h
 
 -- See note [lower instance priority]
-instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedGt α] : WellFoundedLt αᵒᵈ :=
+instance (priority := 100) (α : Type _) [LT α] [h : WellFoundedGT α] : WellFoundedLT αᵒᵈ :=
   h
 
-theorem wellFoundedGt_dual_iff (α : Type _) [LT α] : WellFoundedGt αᵒᵈ ↔ WellFoundedLt α :=
+theorem wellFoundedGT_dual_iff (α : Type _) [LT α] : WellFoundedGT αᵒᵈ ↔ WellFoundedLT α :=
   ⟨fun h => ⟨h.wf⟩, fun h => ⟨h.wf⟩⟩
 
-theorem wellFoundedLt_dual_iff (α : Type _) [LT α] : WellFoundedLt αᵒᵈ ↔ WellFoundedGt α :=
+theorem wellFoundedLT_dual_iff (α : Type _) [LT α] : WellFoundedLT αᵒᵈ ↔ WellFoundedGT α :=
   ⟨fun h => ⟨h.wf⟩, fun h => ⟨h.wf⟩⟩
 
 /-- A well order is a well-founded linear order. -/
@@ -347,9 +347,9 @@ instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : Is
 instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsAsymm α r := by
   infer_instance
 
-namespace WellFoundedLt
+namespace WellFoundedLT
 
-variable [LT α] [WellFoundedLt α]
+variable [LT α] [WellFoundedLT α]
 
 /-- Inducts on a well-founded `<` relation. -/
 theorem induction {C : α → Prop} : ∀ a, (∀ x, (∀ y, y < x → C y) → C x) → C a :=
@@ -361,25 +361,25 @@ theorem apply : ∀ a : α, Acc (· < ·) a :=
 
 -- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as lesser. See also
-`WellFoundedLt.fix_eq`. -/
+`WellFoundedLT.fix_eq`. -/
 noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, y < x → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· < ·)
 
-/-- The value from `WellFoundedLt.fix` is built from the previous ones as specified. -/
+/-- The value from `WellFoundedLT.fix` is built from the previous ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, y < x → C y) → C x) :
     ∀ x, fix F x = F x fun y _ => fix F y :=
   IsWellFounded.fix_eq _ F
 
-/-- Derive a `WellFoundedRelation` instance from a `WellFoundedLt` instance. -/
+/-- Derive a `WellFoundedRelation` instance from a `WellFoundedLT` instance. -/
 def toWellFoundedRelation : WellFoundedRelation α :=
   IsWellFounded.toWellFoundedRelation (· < ·)
 
-end WellFoundedLt
+end WellFoundedLT
 
-namespace WellFoundedGt
+namespace WellFoundedGT
 
-variable [LT α] [WellFoundedGt α]
+variable [LT α] [WellFoundedGT α]
 
 /-- Inducts on a well-founded `>` relation. -/
 theorem induction {C : α → Prop} : ∀ a, (∀ x, (∀ y, x < y → C y) → C x) → C a :=
@@ -391,21 +391,21 @@ theorem apply : ∀ a : α, Acc (· > ·) a :=
 
 -- Porting note: WellFounded.fix is noncomputable, at 2022-10-29 lean
 /-- Creates data, given a way to generate a value from all that compare as greater. See also
-`WellFoundedGt.fix_eq`. -/
+`WellFoundedGT.fix_eq`. -/
 noncomputable
 def fix {C : α → Sort _} : (∀ x : α, (∀ y : α, x < y → C y) → C x) → ∀ x : α, C x :=
   IsWellFounded.fix (· > ·)
 
-/-- The value from `WellFoundedGt.fix` is built from the successive ones as specified. -/
+/-- The value from `WellFoundedGT.fix` is built from the successive ones as specified. -/
 theorem fix_eq {C : α → Sort _} (F : ∀ x : α, (∀ y : α, x < y → C y) → C x) :
     ∀ x, fix F x = F x fun y _ => fix F y :=
   IsWellFounded.fix_eq _ F
 
-/-- Derive a `WellFoundedRelation` instance from a `WellFoundedGt` instance. -/
+/-- Derive a `WellFoundedRelation` instance from a `WellFoundedGT` instance. -/
 def toWellFoundedRelation : WellFoundedRelation α :=
   IsWellFounded.toWellFoundedRelation (· > ·)
 
-end WellFoundedGt
+end WellFoundedGT
 
 /-- Construct a decidable linear order from a well-founded linear order. -/
 noncomputable def IsWellOrder.linearOrder (r : α → α → Prop) [IsWellOrder α r] : LinearOrder α :=
@@ -417,7 +417,7 @@ def IsWellOrder.toHasWellFounded [LT α] [hwo : IsWellOrder α (· < ·)] : Well
   rel := (· < ·)
   wf := hwo.wf
 
--- This isn't made into an instance as it loops with `is_irrefl α r`.
+-- This isn't made into an instance as it loops with `IsIrrefl α r`.
 theorem Subsingleton.isWellOrder [Subsingleton α] (r : α → α → Prop) [hr : IsIrrefl α r] :
     IsWellOrder α r :=
   { hr with
@@ -797,7 +797,7 @@ theorem transitive_gt [Preorder α] : Transitive (@GT.gt α _) :=
 instance OrderDual.isTotal_le [LE α] [h : IsTotal α (· ≤ ·)] : IsTotal αᵒᵈ (· ≤ ·) :=
   @IsTotal.swap α _ h
 
-instance : WellFoundedLt ℕ :=
+instance : WellFoundedLT ℕ :=
   ⟨Nat.lt_wfRel.wf⟩
 #align nat.lt_wf Nat.lt_wfRel
 
feat: port Order.SuccPred.Basic (#1233)

Port of order.succ_pred.basic

Diff
@@ -408,7 +408,7 @@ def toWellFoundedRelation : WellFoundedRelation α :=
 end WellFoundedGt
 
 /-- Construct a decidable linear order from a well-founded linear order. -/
-noncomputable def IsWellOrder.LinearOrder (r : α → α → Prop) [IsWellOrder α r] : LinearOrder α :=
+noncomputable def IsWellOrder.linearOrder (r : α → α → Prop) [IsWellOrder α r] : LinearOrder α :=
   letI := fun x y => Classical.dec ¬r x y
   linearOrderOfSTO r
 
chore: add source headers to ported theory files (#1094)

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

Diff
@@ -2,6 +2,11 @@
 Copyright (c) 2020 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Mario Carneiro, Yury G. Kudryashov
+
+! This file was ported from Lean 3 source module order.rel_classes
+! 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.Order.Basic
 import Mathlib.Logic.IsEmpty

Dependencies 9

10 files ported (100.0%)
5730 lines ported (100.0%)

All dependencies are ported!