canonically_ordered_comm_semiring_two_mulCounterexamples.CanonicallyOrderedCommSemiringTwoMul

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2021 Damiano Testa. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
 -/
-import Data.Zmod.Basic
+import Data.ZMod.Basic
 import RingTheory.Subsemiring.Basic
 import Algebra.Order.Monoid.Basic
 
@@ -241,7 +241,7 @@ theorem exists_add_of_le : ∀ a b : L, a ≤ b → ∃ c, b = a + c :=
   ·
     exact
       ⟨⟨b - a.1, fun H => (tsub_pos_of_lt h).ne' (Prod.mk.inj_iff.1 H).1⟩,
-        Subtype.ext <| Prod.ext (add_tsub_cancel_of_le h.le).symm (add_sub_cancel'_right _ _).symm⟩
+        Subtype.ext <| Prod.ext (add_tsub_cancel_of_le h.le).symm (add_sub_cancel _ _).symm⟩
 #align counterexample.ex_L.exists_add_of_le Counterexample.ExL.exists_add_of_le
 
 theorem le_self_add : ∀ a b : L, a ≤ a + b :=
Diff
@@ -113,7 +113,7 @@ theorem lt_def : a < b ↔ a.1 < b.1 :=
     · exact (not_or_distrib.mp h1).1.elim rfl
     · exact a1
   refine' ⟨Or.inr h, not_or_distrib.mpr ⟨fun k => _, not_lt.mpr h.le⟩⟩
-  rw [k] at h 
+  rw [k] at h
   exact Nat.lt_asymm h h
 #align counterexample.Nxzmod_2.lt_def Counterexample.Nxzmod2.lt_def
 
@@ -259,7 +259,7 @@ theorem eq_zero_or_eq_zero_of_hMul_eq_zero : ∀ a b : L, a * b = 0 → a = 0 
   rintro ⟨⟨a, a2⟩, ha⟩ ⟨⟨b, b2⟩, hb⟩ ab1
   injection ab1 with ab
   injection ab with abn ab2
-  rw [mul_eq_zero] at abn 
+  rw [mul_eq_zero] at abn
   rcases abn with (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩)
   · refine' Or.inl _
     rcases mem_zmod_2 a2 with (rfl | rfl)
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2021 Damiano Testa. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
 -/
-import Mathbin.Data.Zmod.Basic
-import Mathbin.RingTheory.Subsemiring.Basic
-import Mathbin.Algebra.Order.Monoid.Basic
+import Data.Zmod.Basic
+import RingTheory.Subsemiring.Basic
+import Algebra.Order.Monoid.Basic
 
 #align_import canonically_ordered_comm_semiring_two_mul from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
 
Diff
@@ -138,13 +138,13 @@ theorem le_of_add_le_add_left : ∀ a b c : ℕ × ZMod 2, a + b ≤ a + c → b
 instance : ZeroLEOneClass (ℕ × ZMod 2) :=
   ⟨by decide⟩
 
-theorem mul_lt_mul_of_pos_left : ∀ a b c : ℕ × ZMod 2, a < b → 0 < c → c * a < c * b :=
+theorem hMul_lt_hMul_of_pos_left : ∀ a b c : ℕ × ZMod 2, a < b → 0 < c → c * a < c * b :=
   fun a b c ab c0 => lt_def.mpr ((mul_lt_mul_left (lt_def.mp c0)).mpr (lt_def.mp ab))
-#align counterexample.Nxzmod_2.mul_lt_mul_of_pos_left Counterexample.Nxzmod2.mul_lt_mul_of_pos_left
+#align counterexample.Nxzmod_2.mul_lt_mul_of_pos_left Counterexample.Nxzmod2.hMul_lt_hMul_of_pos_left
 
-theorem mul_lt_mul_of_pos_right : ∀ a b c : ℕ × ZMod 2, a < b → 0 < c → a * c < b * c :=
+theorem hMul_lt_hMul_of_pos_right : ∀ a b c : ℕ × ZMod 2, a < b → 0 < c → a * c < b * c :=
   fun a b c ab c0 => lt_def.mpr ((mul_lt_mul_right (lt_def.mp c0)).mpr (lt_def.mp ab))
-#align counterexample.Nxzmod_2.mul_lt_mul_of_pos_right Counterexample.Nxzmod2.mul_lt_mul_of_pos_right
+#align counterexample.Nxzmod_2.mul_lt_mul_of_pos_right Counterexample.Nxzmod2.hMul_lt_hMul_of_pos_right
 
 instance socsN2 : StrictOrderedCommSemiring (ℕ × ZMod 2) :=
   { Nxzmod2.csrN21, (inferInstance : PartialOrder (ℕ × ZMod 2)),
@@ -154,8 +154,8 @@ instance socsN2 : StrictOrderedCommSemiring (ℕ × ZMod 2) :=
     add_le_add_left := add_le_add_left
     le_of_add_le_add_left := le_of_add_le_add_left
     zero_le_one := zero_le_one
-    mul_lt_mul_of_pos_left := mul_lt_mul_of_pos_left
-    mul_lt_mul_of_pos_right := mul_lt_mul_of_pos_right }
+    mul_lt_mul_of_pos_left := hMul_lt_hMul_of_pos_left
+    mul_lt_mul_of_pos_right := hMul_lt_hMul_of_pos_right }
 #align counterexample.Nxzmod_2.socsN2 Counterexample.Nxzmod2.socsN2
 
 end Nxzmod2
@@ -180,7 +180,7 @@ theorem add_L {a b : ℕ × ZMod 2} (ha : a ≠ (0, 1)) (hb : b ≠ (0, 1)) : a
   · simp [(a + b).succ_ne_zero]
 #align counterexample.ex_L.add_L Counterexample.ExL.add_L
 
-theorem mul_L {a b : ℕ × ZMod 2} (ha : a ≠ (0, 1)) (hb : b ≠ (0, 1)) : a * b ≠ (0, 1) :=
+theorem hMul_L {a b : ℕ × ZMod 2} (ha : a ≠ (0, 1)) (hb : b ≠ (0, 1)) : a * b ≠ (0, 1) :=
   by
   rcases a with ⟨a, a2⟩
   rcases b with ⟨b, b2⟩
@@ -201,7 +201,7 @@ theorem mul_L {a b : ℕ × ZMod 2} (ha : a ≠ (0, 1)) (hb : b ≠ (0, 1)) : a
       simp
     exact ha rfl
   · simp [mul_ne_zero _ _, Nat.succ_ne_zero _]
-#align counterexample.ex_L.mul_L Counterexample.ExL.mul_L
+#align counterexample.ex_L.mul_L Counterexample.ExL.hMul_L
 
 /-- The subsemiring corresponding to the elements of `L`, used to transfer instances. -/
 def lSubsemiring : Subsemiring (ℕ × ZMod 2)
@@ -210,7 +210,7 @@ def lSubsemiring : Subsemiring (ℕ × ZMod 2)
   zero_mem' := by decide
   one_mem' := by decide
   add_mem' _ _ := add_L
-  mul_mem' _ _ := mul_L
+  hMul_mem' _ _ := hMul_L
 #align counterexample.ex_L.L_subsemiring Counterexample.ExL.lSubsemiring
 
 instance : OrderedCommSemiring L :=
@@ -254,7 +254,7 @@ theorem le_self_add : ∀ a b : L, a ≤ a + b :=
   · exact Or.inr ((lt_add_iff_pos_right _).mpr h)
 #align counterexample.ex_L.le_self_add Counterexample.ExL.le_self_add
 
-theorem eq_zero_or_eq_zero_of_mul_eq_zero : ∀ a b : L, a * b = 0 → a = 0 ∨ b = 0 :=
+theorem eq_zero_or_eq_zero_of_hMul_eq_zero : ∀ a b : L, a * b = 0 → a = 0 ∨ b = 0 :=
   by
   rintro ⟨⟨a, a2⟩, ha⟩ ⟨⟨b, b2⟩, hb⟩ ab1
   injection ab1 with ab
@@ -269,7 +269,7 @@ theorem eq_zero_or_eq_zero_of_mul_eq_zero : ∀ a b : L, a * b = 0 → a = 0 ∨
     rcases mem_zmod_2 b2 with (rfl | rfl)
     · rfl
     · exact (hb rfl).elim
-#align counterexample.ex_L.eq_zero_or_eq_zero_of_mul_eq_zero Counterexample.ExL.eq_zero_or_eq_zero_of_mul_eq_zero
+#align counterexample.ex_L.eq_zero_or_eq_zero_of_mul_eq_zero Counterexample.ExL.eq_zero_or_eq_zero_of_hMul_eq_zero
 
 instance can : CanonicallyOrderedCommSemiring L :=
   { (inferInstance : OrderBot L),
@@ -277,7 +277,7 @@ instance can : CanonicallyOrderedCommSemiring L :=
       OrderedCommSemiring L) with
     exists_add_of_le := exists_add_of_le
     le_self_add := le_self_add
-    eq_zero_or_eq_zero_of_mul_eq_zero := eq_zero_or_eq_zero_of_mul_eq_zero }
+    eq_zero_or_eq_zero_of_mul_eq_zero := eq_zero_or_eq_zero_of_hMul_eq_zero }
 #align counterexample.ex_L.can Counterexample.ExL.can
 
 /-- The elements `(1,0)` and `(1,1)` of `L` are different, but their doubles coincide.
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2021 Damiano Testa. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
-
-! This file was ported from Lean 3 source module canonically_ordered_comm_semiring_two_mul
-! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Zmod.Basic
 import Mathbin.RingTheory.Subsemiring.Basic
 import Mathbin.Algebra.Order.Monoid.Basic
 
+#align_import canonically_ordered_comm_semiring_two_mul from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
+
 /-!
 
 A `canonically_ordered_comm_semiring` with two different elements `a` and `b` such that
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
 
 ! This file was ported from Lean 3 source module canonically_ordered_comm_semiring_two_mul
-! leanprover-community/mathlib commit 328375597f2c0dd00522d9c2e5a33b6a6128feeb
+! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -27,6 +27,9 @@ multiplication cannot be strengthened to **strict** monotonicity.
 
 Reference:
 https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/canonically_ordered.20pathology
+
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
 -/
 
 

Changes in mathlib4

mathlib3
mathlib4
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -199,7 +199,7 @@ theorem exists_add_of_le : ∀ a b : L, a ≤ b → ∃ c, b = a + c := by
   · exact ⟨0, (add_zero _).symm⟩
   · exact
       ⟨⟨b - a.1, fun H => (tsub_pos_of_lt h).ne' (Prod.mk.inj_iff.1 H).1⟩,
-        Subtype.ext <| Prod.ext (add_tsub_cancel_of_le h.le).symm (add_sub_cancel'_right _ _).symm⟩
+        Subtype.ext <| Prod.ext (add_tsub_cancel_of_le h.le).symm (add_sub_cancel _ _).symm⟩
 #align counterexample.ex_L.exists_add_of_le Counterexample.ExL.exists_add_of_le
 
 theorem le_self_add : ∀ a b : L, a ≤ a + b := by
chore: split Ordered instances for subobjects into separate files (#10900)

Moving these to separate files should make typeclass synthesis less expensive. Additionally two of them are quite long and this shrinks them slightly.

This handles:

  • Submonoid
  • Subgroup
  • Subsemiring
  • Subring
  • Subfield
  • Submodule
  • Subalgebra

This also moves Units.posSubgroup into its own file.

The copyright headers are from:

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: Damiano Testa
 -/
 import Mathlib.Data.ZMod.Basic
-import Mathlib.RingTheory.Subsemiring.Basic
+import Mathlib.RingTheory.Subsemiring.Order
 import Mathlib.Algebra.Order.Monoid.Basic
 
 #align_import canonically_ordered_comm_semiring_two_mul from "leanprover-community/mathlib"@"328375597f2c0dd00522d9c2e5a33b6a6128feeb"
refactor: more readable error message when borelize fails (#7231)

borelize X fails when ‹TopologicalSpace X› depends on i : MeasurableSpace X, but this message isn't readable:

failed to create binder due to failure when reverting variable dependencies

This is probrem in this case: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/borelize.20gives.20.22failed.20to.20create.20binder.2E.2E.2E.22

This PR make error messages more readable:

‹TopologicalSpace X› := (expr depends on i)"
depends on
i : MeasurableSpace X
so `borelize` isn't avaliable
Diff
@@ -31,34 +31,6 @@ set_option linter.uppercaseLean3 false
 
 namespace Counterexample
 
-namespace FromBhavik
-
-/-- Bhavik Mehta's example.  There are only the initial definitions, but no proofs.  The Type
-`K` is a canonically ordered commutative semiring with the property that `2 * (1/2) ≤ 2 * 1`, even
-though it is not true that `1/2 ≤ 1`, since `1/2` and `1` are not comparable. -/
-def K : Type :=
-  Subsemiring.closure ({1.5} : Set ℚ)
-deriving CommSemiring
-#align counterexample.from_Bhavik.K Counterexample.FromBhavik.K
-
-instance : Coe K ℚ :=
-  ⟨fun x => x.1⟩
-
-instance inhabitedK : Inhabited K :=
-  ⟨0⟩
-#align counterexample.from_Bhavik.inhabited_K Counterexample.FromBhavik.inhabitedK
-
-instance : Preorder K where
-  le x y := x = y ∨ (x : ℚ) + 1 ≤ (y : ℚ)
-  le_refl x := Or.inl rfl
-  le_trans x y z xy yz := by
-    rcases xy with (rfl | xy); · apply yz
-    rcases yz with (rfl | yz); · right; apply xy
-    right
-    exact xy.trans (le_trans ((le_add_iff_nonneg_right _).mpr zero_le_one) yz)
-
-end FromBhavik
-
 theorem mem_zmod_2 (a : ZMod 2) : a = 0 ∨ a = 1 := by
   rcases a with ⟨_ | _, _ | _ | _ | _⟩
   · exact Or.inl rfl
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) 2021 Damiano Testa. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
-
-! This file was ported from Lean 3 source module canonically_ordered_comm_semiring_two_mul
-! leanprover-community/mathlib commit 328375597f2c0dd00522d9c2e5a33b6a6128feeb
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.ZMod.Basic
 import Mathlib.RingTheory.Subsemiring.Basic
 import Mathlib.Algebra.Order.Monoid.Basic
 
+#align_import canonically_ordered_comm_semiring_two_mul from "leanprover-community/mathlib"@"328375597f2c0dd00522d9c2e5a33b6a6128feeb"
+
 /-!
 
 A `CanonicallyOrderedCommSemiring` with two different elements `a` and `b` such that
chore: have CI run on tests in subdirectories (#5065)

Also fix bug in elementwise that wasn't caught while tests weren't running.

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Heather Macbeth <25316162+hrmacbeth@users.noreply.github.com>

Dependencies 8 + 480

481 files ported (98.4%)
198385 lines ported (98.5%)
Show graph

The unported dependencies are