set_theory.surreal.dyadicMathlib.SetTheory.Surreal.Dyadic

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)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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
@@ -251,7 +251,7 @@ theorem nsmul_pow_two_powHalf (n : ℕ) : 2 ^ n • powHalf n = 1 :=
   · simp only [nsmul_one, pow_half_zero, Nat.cast_one, pow_zero]
   ·
     rw [← hn, ← double_pow_half_succ_eq_pow_half n, smul_smul (2 ^ n) 2 (pow_half n.succ), mul_comm,
-      pow_succ]
+      pow_succ']
 #align surreal.nsmul_pow_two_pow_half Surreal.nsmul_pow_two_powHalf
 -/
 
Diff
@@ -264,7 +264,7 @@ theorem nsmul_pow_two_powHalf' (n k : ℕ) : 2 ^ n • powHalf (n + k) = powHalf
     simp only [add_zero, Surreal.nsmul_pow_two_powHalf, Nat.zero_eq, eq_self_iff_true,
       Surreal.powHalf_zero]
   · rw [← double_pow_half_succ_eq_pow_half (n + k), ← double_pow_half_succ_eq_pow_half k,
-      smul_algebra_smul_comm] at hk 
+      smul_algebra_smul_comm] at hk
     rwa [← zsmul_eq_zsmul_iff' two_ne_zero]
 #align surreal.nsmul_pow_two_pow_half' Surreal.nsmul_pow_two_powHalf'
 -/
@@ -287,11 +287,11 @@ theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ =
   · intro m₁ m₂ aux; exact (this (le_of_not_le h) aux.symm).symm
   intro m₁ m₂ h₂
   obtain ⟨c, rfl⟩ := le_iff_exists_add.mp h
-  rw [add_comm, pow_add, ← mul_assoc, mul_eq_mul_right_iff] at h₂ 
+  rw [add_comm, pow_add, ← mul_assoc, mul_eq_mul_right_iff] at h₂
   cases h₂
   · rw [h₂, add_comm, zsmul_pow_two_pow_half m₂ c y₁]
   · have := Nat.one_le_pow y₁ 2 Nat.succ_pos'
-    norm_cast at h₂ ; linarith
+    norm_cast at h₂; linarith
 #align surreal.dyadic_aux Surreal.dyadic_aux
 -/
 
@@ -304,7 +304,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
       by
       intro m₁ m₂ n₁ n₂ h₁
       obtain ⟨⟨n₃, y₃, hn₃⟩, h₂⟩ := localization.r_iff_exists.mp h₁
-      simp only [Subtype.coe_mk, mul_eq_mul_left_iff] at h₂ 
+      simp only [Subtype.coe_mk, mul_eq_mul_left_iff] at h₂
       cases h₂
       · simp only
         obtain ⟨a₁, ha₁⟩ := n₁.prop
@@ -324,7 +324,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
       rintro ⟨a, ⟨b, ⟨b', rfl⟩⟩⟩ ⟨c, ⟨d, ⟨d', rfl⟩⟩⟩
       have h₂ : 1 < (2 : ℤ).natAbs := one_lt_two
       have hpow₂ := Submonoid.log_pow_int_eq_self h₂
-      simp_rw [Submonoid.pow_apply] at hpow₂ 
+      simp_rw [Submonoid.pow_apply] at hpow₂
       simp_rw [Localization.add_mk, Localization.liftOn_mk, Subtype.coe_mk,
         Submonoid.log_mul (Int.pow_right_injective h₂), hpow₂]
       calc
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2021 Apurva Nakade. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Apurva Nakade
 -/
-import Mathbin.Algebra.Algebra.Basic
-import Mathbin.SetTheory.Game.Birthday
-import Mathbin.SetTheory.Surreal.Basic
-import Mathbin.RingTheory.Localization.Basic
+import Algebra.Algebra.Basic
+import SetTheory.Game.Birthday
+import SetTheory.Surreal.Basic
+import RingTheory.Localization.Basic
 
 #align_import set_theory.surreal.dyadic from "leanprover-community/mathlib"@"d0b1936853671209a866fa35b9e54949c81116e2"
 
Diff
@@ -32,136 +32,145 @@ rational numbers to construct an ordered field embedding of ℝ into `surreal`.
 
 universe u
 
-local infixl:0 " ≈ " => PGame.Equiv
+local infixl:0 " ≈ " => SetTheory.PGame.Equiv
 
-namespace PGame
+namespace SetTheory.PGame
 
-#print PGame.powHalf /-
+#print SetTheory.PGame.powHalf /-
 /-- For a natural number `n`, the pre-game `pow_half (n + 1)` is recursively defined as
 `{0 | pow_half n}`. These are the explicit expressions of powers of `1 / 2`. By definition, we have
 `pow_half 0 = 1` and `pow_half 1 ≈ 1 / 2` and we prove later on that
 `pow_half (n + 1) + pow_half (n + 1) ≈ pow_half n`. -/
-def powHalf : ℕ → PGame
+def SetTheory.PGame.powHalf : ℕ → SetTheory.PGame
   | 0 => 1
   | n + 1 => ⟨PUnit, PUnit, 0, fun _ => pow_half n⟩
-#align pgame.pow_half PGame.powHalf
+#align pgame.pow_half SetTheory.PGame.powHalf
 -/
 
-#print PGame.powHalf_zero /-
+#print SetTheory.PGame.powHalf_zero /-
 @[simp]
-theorem powHalf_zero : powHalf 0 = 1 :=
+theorem SetTheory.PGame.powHalf_zero : SetTheory.PGame.powHalf 0 = 1 :=
   rfl
-#align pgame.pow_half_zero PGame.powHalf_zero
+#align pgame.pow_half_zero SetTheory.PGame.powHalf_zero
 -/
 
-#print PGame.powHalf_leftMoves /-
-theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by cases n <;> rfl
-#align pgame.pow_half_left_moves PGame.powHalf_leftMoves
+#print SetTheory.PGame.powHalf_leftMoves /-
+theorem SetTheory.PGame.powHalf_leftMoves (n) : (SetTheory.PGame.powHalf n).LeftMoves = PUnit := by
+  cases n <;> rfl
+#align pgame.pow_half_left_moves SetTheory.PGame.powHalf_leftMoves
 -/
 
-#print PGame.powHalf_zero_rightMoves /-
-theorem powHalf_zero_rightMoves : (powHalf 0).RightMoves = PEmpty :=
+#print SetTheory.PGame.powHalf_zero_rightMoves /-
+theorem SetTheory.PGame.powHalf_zero_rightMoves : (SetTheory.PGame.powHalf 0).RightMoves = PEmpty :=
   rfl
-#align pgame.pow_half_zero_right_moves PGame.powHalf_zero_rightMoves
+#align pgame.pow_half_zero_right_moves SetTheory.PGame.powHalf_zero_rightMoves
 -/
 
-#print PGame.powHalf_succ_rightMoves /-
-theorem powHalf_succ_rightMoves (n) : (powHalf (n + 1)).RightMoves = PUnit :=
+#print SetTheory.PGame.powHalf_succ_rightMoves /-
+theorem SetTheory.PGame.powHalf_succ_rightMoves (n) :
+    (SetTheory.PGame.powHalf (n + 1)).RightMoves = PUnit :=
   rfl
-#align pgame.pow_half_succ_right_moves PGame.powHalf_succ_rightMoves
+#align pgame.pow_half_succ_right_moves SetTheory.PGame.powHalf_succ_rightMoves
 -/
 
-#print PGame.powHalf_moveLeft /-
+#print SetTheory.PGame.powHalf_moveLeft /-
 @[simp]
-theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> cases i <;> rfl
-#align pgame.pow_half_move_left PGame.powHalf_moveLeft
+theorem SetTheory.PGame.powHalf_moveLeft (n i) : (SetTheory.PGame.powHalf n).moveLeft i = 0 := by
+  cases n <;> cases i <;> rfl
+#align pgame.pow_half_move_left SetTheory.PGame.powHalf_moveLeft
 -/
 
-#print PGame.powHalf_succ_moveRight /-
+#print SetTheory.PGame.powHalf_succ_moveRight /-
 @[simp]
-theorem powHalf_succ_moveRight (n i) : (powHalf (n + 1)).moveRight i = powHalf n :=
+theorem SetTheory.PGame.powHalf_succ_moveRight (n i) :
+    (SetTheory.PGame.powHalf (n + 1)).moveRight i = SetTheory.PGame.powHalf n :=
   rfl
-#align pgame.pow_half_succ_move_right PGame.powHalf_succ_moveRight
+#align pgame.pow_half_succ_move_right SetTheory.PGame.powHalf_succ_moveRight
 -/
 
-#print PGame.uniquePowHalfLeftMoves /-
-instance uniquePowHalfLeftMoves (n) : Unique (powHalf n).LeftMoves := by
-  cases n <;> exact PUnit.unique
-#align pgame.unique_pow_half_left_moves PGame.uniquePowHalfLeftMoves
+#print SetTheory.PGame.uniquePowHalfLeftMoves /-
+instance SetTheory.PGame.uniquePowHalfLeftMoves (n) :
+    Unique (SetTheory.PGame.powHalf n).LeftMoves := by cases n <;> exact PUnit.unique
+#align pgame.unique_pow_half_left_moves SetTheory.PGame.uniquePowHalfLeftMoves
 -/
 
-#print PGame.isEmpty_powHalf_zero_rightMoves /-
-instance isEmpty_powHalf_zero_rightMoves : IsEmpty (powHalf 0).RightMoves :=
+#print SetTheory.PGame.isEmpty_powHalf_zero_rightMoves /-
+instance SetTheory.PGame.isEmpty_powHalf_zero_rightMoves :
+    IsEmpty (SetTheory.PGame.powHalf 0).RightMoves :=
   PEmpty.isEmpty
-#align pgame.is_empty_pow_half_zero_right_moves PGame.isEmpty_powHalf_zero_rightMoves
+#align pgame.is_empty_pow_half_zero_right_moves SetTheory.PGame.isEmpty_powHalf_zero_rightMoves
 -/
 
-#print PGame.uniquePowHalfSuccRightMoves /-
-instance uniquePowHalfSuccRightMoves (n) : Unique (powHalf (n + 1)).RightMoves :=
+#print SetTheory.PGame.uniquePowHalfSuccRightMoves /-
+instance SetTheory.PGame.uniquePowHalfSuccRightMoves (n) :
+    Unique (SetTheory.PGame.powHalf (n + 1)).RightMoves :=
   PUnit.unique
-#align pgame.unique_pow_half_succ_right_moves PGame.uniquePowHalfSuccRightMoves
+#align pgame.unique_pow_half_succ_right_moves SetTheory.PGame.uniquePowHalfSuccRightMoves
 -/
 
-#print PGame.birthday_half /-
+#print SetTheory.PGame.birthday_half /-
 @[simp]
-theorem birthday_half : birthday (powHalf 1) = 2 := by rw [birthday_def]; dsimp;
-  simpa using Order.le_succ (1 : Ordinal)
-#align pgame.birthday_half PGame.birthday_half
+theorem SetTheory.PGame.birthday_half : SetTheory.PGame.birthday (SetTheory.PGame.powHalf 1) = 2 :=
+  by rw [birthday_def]; dsimp; simpa using Order.le_succ (1 : Ordinal)
+#align pgame.birthday_half SetTheory.PGame.birthday_half
 -/
 
-#print PGame.numeric_powHalf /-
+#print SetTheory.PGame.numeric_powHalf /-
 /-- For all natural numbers `n`, the pre-games `pow_half n` are numeric. -/
-theorem numeric_powHalf (n) : (powHalf n).Numeric :=
+theorem SetTheory.PGame.numeric_powHalf (n) : (SetTheory.PGame.powHalf n).Numeric :=
   by
   induction' n with n hn
   · exact numeric_one
   · constructor
     · simpa using hn.move_left_lt default
     · exact ⟨fun _ => numeric_zero, fun _ => hn⟩
-#align pgame.numeric_pow_half PGame.numeric_powHalf
+#align pgame.numeric_pow_half SetTheory.PGame.numeric_powHalf
 -/
 
-#print PGame.powHalf_succ_lt_powHalf /-
-theorem powHalf_succ_lt_powHalf (n : ℕ) : powHalf (n + 1) < powHalf n :=
-  (numeric_powHalf (n + 1)).lt_moveRight default
-#align pgame.pow_half_succ_lt_pow_half PGame.powHalf_succ_lt_powHalf
+#print SetTheory.PGame.powHalf_succ_lt_powHalf /-
+theorem SetTheory.PGame.powHalf_succ_lt_powHalf (n : ℕ) :
+    SetTheory.PGame.powHalf (n + 1) < SetTheory.PGame.powHalf n :=
+  (SetTheory.PGame.numeric_powHalf (n + 1)).lt_moveRight default
+#align pgame.pow_half_succ_lt_pow_half SetTheory.PGame.powHalf_succ_lt_powHalf
 -/
 
-#print PGame.powHalf_succ_le_powHalf /-
-theorem powHalf_succ_le_powHalf (n : ℕ) : powHalf (n + 1) ≤ powHalf n :=
-  (powHalf_succ_lt_powHalf n).le
-#align pgame.pow_half_succ_le_pow_half PGame.powHalf_succ_le_powHalf
+#print SetTheory.PGame.powHalf_succ_le_powHalf /-
+theorem SetTheory.PGame.powHalf_succ_le_powHalf (n : ℕ) :
+    SetTheory.PGame.powHalf (n + 1) ≤ SetTheory.PGame.powHalf n :=
+  (SetTheory.PGame.powHalf_succ_lt_powHalf n).le
+#align pgame.pow_half_succ_le_pow_half SetTheory.PGame.powHalf_succ_le_powHalf
 -/
 
-#print PGame.powHalf_le_one /-
-theorem powHalf_le_one (n : ℕ) : powHalf n ≤ 1 :=
+#print SetTheory.PGame.powHalf_le_one /-
+theorem SetTheory.PGame.powHalf_le_one (n : ℕ) : SetTheory.PGame.powHalf n ≤ 1 :=
   by
   induction' n with n hn
   · exact le_rfl
   · exact (pow_half_succ_le_pow_half n).trans hn
-#align pgame.pow_half_le_one PGame.powHalf_le_one
+#align pgame.pow_half_le_one SetTheory.PGame.powHalf_le_one
 -/
 
-#print PGame.powHalf_succ_lt_one /-
-theorem powHalf_succ_lt_one (n : ℕ) : powHalf (n + 1) < 1 :=
-  (powHalf_succ_lt_powHalf n).trans_le <| powHalf_le_one n
-#align pgame.pow_half_succ_lt_one PGame.powHalf_succ_lt_one
+#print SetTheory.PGame.powHalf_succ_lt_one /-
+theorem SetTheory.PGame.powHalf_succ_lt_one (n : ℕ) : SetTheory.PGame.powHalf (n + 1) < 1 :=
+  (SetTheory.PGame.powHalf_succ_lt_powHalf n).trans_le <| SetTheory.PGame.powHalf_le_one n
+#align pgame.pow_half_succ_lt_one SetTheory.PGame.powHalf_succ_lt_one
 -/
 
-#print PGame.powHalf_pos /-
-theorem powHalf_pos (n : ℕ) : 0 < powHalf n := by
+#print SetTheory.PGame.powHalf_pos /-
+theorem SetTheory.PGame.powHalf_pos (n : ℕ) : 0 < SetTheory.PGame.powHalf n := by
   rw [← lf_iff_lt numeric_zero (numeric_pow_half n), zero_lf_le]; simp
-#align pgame.pow_half_pos PGame.powHalf_pos
+#align pgame.pow_half_pos SetTheory.PGame.powHalf_pos
 -/
 
-#print PGame.zero_le_powHalf /-
-theorem zero_le_powHalf (n : ℕ) : 0 ≤ powHalf n :=
-  (powHalf_pos n).le
-#align pgame.zero_le_pow_half PGame.zero_le_powHalf
+#print SetTheory.PGame.zero_le_powHalf /-
+theorem SetTheory.PGame.zero_le_powHalf (n : ℕ) : 0 ≤ SetTheory.PGame.powHalf n :=
+  (SetTheory.PGame.powHalf_pos n).le
+#align pgame.zero_le_pow_half SetTheory.PGame.zero_le_powHalf
 -/
 
-#print PGame.add_powHalf_succ_self_eq_powHalf /-
-theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1) ≈ powHalf n :=
+#print SetTheory.PGame.add_powHalf_succ_self_eq_powHalf /-
+theorem SetTheory.PGame.add_powHalf_succ_self_eq_powHalf (n) :
+    SetTheory.PGame.powHalf (n + 1) + SetTheory.PGame.powHalf (n + 1) ≈ SetTheory.PGame.powHalf n :=
   by
   induction' n using Nat.strong_induction_on with n hn
   · constructor <;> rw [le_iff_forall_lf] <;> constructor
@@ -197,25 +206,26 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
         calc
           pow_half n ≈ 0 + pow_half n := (zero_add_equiv _).symm
           _ < pow_half n.succ + pow_half n := add_lt_add_right (pow_half_pos _) _
-#align pgame.add_pow_half_succ_self_eq_pow_half PGame.add_powHalf_succ_self_eq_powHalf
+#align pgame.add_pow_half_succ_self_eq_pow_half SetTheory.PGame.add_powHalf_succ_self_eq_powHalf
 -/
 
-#print PGame.half_add_half_equiv_one /-
-theorem half_add_half_equiv_one : powHalf 1 + powHalf 1 ≈ 1 :=
-  add_powHalf_succ_self_eq_powHalf 0
-#align pgame.half_add_half_equiv_one PGame.half_add_half_equiv_one
+#print SetTheory.PGame.half_add_half_equiv_one /-
+theorem SetTheory.PGame.half_add_half_equiv_one :
+    SetTheory.PGame.powHalf 1 + SetTheory.PGame.powHalf 1 ≈ 1 :=
+  SetTheory.PGame.add_powHalf_succ_self_eq_powHalf 0
+#align pgame.half_add_half_equiv_one SetTheory.PGame.half_add_half_equiv_one
 -/
 
-end PGame
+end SetTheory.PGame
 
 namespace Surreal
 
-open PGame
+open SetTheory.PGame
 
 #print Surreal.powHalf /-
 /-- Powers of the surreal number `half`. -/
 def powHalf (n : ℕ) : Surreal :=
-  ⟦⟨PGame.powHalf n, PGame.numeric_powHalf n⟩⟧
+  ⟦⟨SetTheory.PGame.powHalf n, SetTheory.PGame.numeric_powHalf n⟩⟧
 #align surreal.pow_half Surreal.powHalf
 -/
 
@@ -229,7 +239,7 @@ theorem powHalf_zero : powHalf 0 = 1 :=
 #print Surreal.double_powHalf_succ_eq_powHalf /-
 @[simp]
 theorem double_powHalf_succ_eq_powHalf (n : ℕ) : 2 • powHalf n.succ = powHalf n := by
-  rw [two_nsmul]; exact Quotient.sound (PGame.add_powHalf_succ_self_eq_powHalf n)
+  rw [two_nsmul]; exact Quotient.sound (SetTheory.PGame.add_powHalf_succ_self_eq_powHalf n)
 #align surreal.double_pow_half_succ_eq_pow_half Surreal.double_powHalf_succ_eq_powHalf
 -/
 
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2021 Apurva Nakade. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Apurva Nakade
-
-! This file was ported from Lean 3 source module set_theory.surreal.dyadic
-! leanprover-community/mathlib commit d0b1936853671209a866fa35b9e54949c81116e2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.Algebra.Basic
 import Mathbin.SetTheory.Game.Birthday
 import Mathbin.SetTheory.Surreal.Basic
 import Mathbin.RingTheory.Localization.Basic
 
+#align_import set_theory.surreal.dyadic from "leanprover-community/mathlib"@"d0b1936853671209a866fa35b9e54949c81116e2"
+
 /-!
 # Dyadic numbers
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Apurva Nakade
 
 ! This file was ported from Lean 3 source module set_theory.surreal.dyadic
-! leanprover-community/mathlib commit 92ca63f0fb391a9ca5f22d2409a6080e786d99f7
+! leanprover-community/mathlib commit d0b1936853671209a866fa35b9e54949c81116e2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.RingTheory.Localization.Basic
 
 /-!
 # Dyadic numbers
+
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
 Dyadic numbers are obtained by localizing ℤ away from 2. They are the initial object in the category
 of rings with no 2-torsion.
 
Diff
@@ -36,6 +36,7 @@ local infixl:0 " ≈ " => PGame.Equiv
 
 namespace PGame
 
+#print PGame.powHalf /-
 /-- For a natural number `n`, the pre-game `pow_half (n + 1)` is recursively defined as
 `{0 | pow_half n}`. These are the explicit expressions of powers of `1 / 2`. By definition, we have
 `pow_half 0 = 1` and `pow_half 1 ≈ 1 / 2` and we prove later on that
@@ -44,49 +45,71 @@ def powHalf : ℕ → PGame
   | 0 => 1
   | n + 1 => ⟨PUnit, PUnit, 0, fun _ => pow_half n⟩
 #align pgame.pow_half PGame.powHalf
+-/
 
+#print PGame.powHalf_zero /-
 @[simp]
 theorem powHalf_zero : powHalf 0 = 1 :=
   rfl
 #align pgame.pow_half_zero PGame.powHalf_zero
+-/
 
+#print PGame.powHalf_leftMoves /-
 theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by cases n <;> rfl
 #align pgame.pow_half_left_moves PGame.powHalf_leftMoves
+-/
 
+#print PGame.powHalf_zero_rightMoves /-
 theorem powHalf_zero_rightMoves : (powHalf 0).RightMoves = PEmpty :=
   rfl
 #align pgame.pow_half_zero_right_moves PGame.powHalf_zero_rightMoves
+-/
 
+#print PGame.powHalf_succ_rightMoves /-
 theorem powHalf_succ_rightMoves (n) : (powHalf (n + 1)).RightMoves = PUnit :=
   rfl
 #align pgame.pow_half_succ_right_moves PGame.powHalf_succ_rightMoves
+-/
 
+#print PGame.powHalf_moveLeft /-
 @[simp]
 theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> cases i <;> rfl
 #align pgame.pow_half_move_left PGame.powHalf_moveLeft
+-/
 
+#print PGame.powHalf_succ_moveRight /-
 @[simp]
 theorem powHalf_succ_moveRight (n i) : (powHalf (n + 1)).moveRight i = powHalf n :=
   rfl
 #align pgame.pow_half_succ_move_right PGame.powHalf_succ_moveRight
+-/
 
+#print PGame.uniquePowHalfLeftMoves /-
 instance uniquePowHalfLeftMoves (n) : Unique (powHalf n).LeftMoves := by
   cases n <;> exact PUnit.unique
 #align pgame.unique_pow_half_left_moves PGame.uniquePowHalfLeftMoves
+-/
 
+#print PGame.isEmpty_powHalf_zero_rightMoves /-
 instance isEmpty_powHalf_zero_rightMoves : IsEmpty (powHalf 0).RightMoves :=
   PEmpty.isEmpty
 #align pgame.is_empty_pow_half_zero_right_moves PGame.isEmpty_powHalf_zero_rightMoves
+-/
 
+#print PGame.uniquePowHalfSuccRightMoves /-
 instance uniquePowHalfSuccRightMoves (n) : Unique (powHalf (n + 1)).RightMoves :=
   PUnit.unique
 #align pgame.unique_pow_half_succ_right_moves PGame.uniquePowHalfSuccRightMoves
+-/
 
+#print PGame.birthday_half /-
 @[simp]
 theorem birthday_half : birthday (powHalf 1) = 2 := by rw [birthday_def]; dsimp;
   simpa using Order.le_succ (1 : Ordinal)
 #align pgame.birthday_half PGame.birthday_half
+-/
 
+#print PGame.numeric_powHalf /-
 /-- For all natural numbers `n`, the pre-games `pow_half n` are numeric. -/
 theorem numeric_powHalf (n) : (powHalf n).Numeric :=
   by
@@ -96,34 +119,48 @@ theorem numeric_powHalf (n) : (powHalf n).Numeric :=
     · simpa using hn.move_left_lt default
     · exact ⟨fun _ => numeric_zero, fun _ => hn⟩
 #align pgame.numeric_pow_half PGame.numeric_powHalf
+-/
 
+#print PGame.powHalf_succ_lt_powHalf /-
 theorem powHalf_succ_lt_powHalf (n : ℕ) : powHalf (n + 1) < powHalf n :=
   (numeric_powHalf (n + 1)).lt_moveRight default
 #align pgame.pow_half_succ_lt_pow_half PGame.powHalf_succ_lt_powHalf
+-/
 
+#print PGame.powHalf_succ_le_powHalf /-
 theorem powHalf_succ_le_powHalf (n : ℕ) : powHalf (n + 1) ≤ powHalf n :=
   (powHalf_succ_lt_powHalf n).le
 #align pgame.pow_half_succ_le_pow_half PGame.powHalf_succ_le_powHalf
+-/
 
+#print PGame.powHalf_le_one /-
 theorem powHalf_le_one (n : ℕ) : powHalf n ≤ 1 :=
   by
   induction' n with n hn
   · exact le_rfl
   · exact (pow_half_succ_le_pow_half n).trans hn
 #align pgame.pow_half_le_one PGame.powHalf_le_one
+-/
 
+#print PGame.powHalf_succ_lt_one /-
 theorem powHalf_succ_lt_one (n : ℕ) : powHalf (n + 1) < 1 :=
   (powHalf_succ_lt_powHalf n).trans_le <| powHalf_le_one n
 #align pgame.pow_half_succ_lt_one PGame.powHalf_succ_lt_one
+-/
 
+#print PGame.powHalf_pos /-
 theorem powHalf_pos (n : ℕ) : 0 < powHalf n := by
   rw [← lf_iff_lt numeric_zero (numeric_pow_half n), zero_lf_le]; simp
 #align pgame.pow_half_pos PGame.powHalf_pos
+-/
 
+#print PGame.zero_le_powHalf /-
 theorem zero_le_powHalf (n : ℕ) : 0 ≤ powHalf n :=
   (powHalf_pos n).le
 #align pgame.zero_le_pow_half PGame.zero_le_powHalf
+-/
 
+#print PGame.add_powHalf_succ_self_eq_powHalf /-
 theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1) ≈ powHalf n :=
   by
   induction' n using Nat.strong_induction_on with n hn
@@ -161,10 +198,13 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
           pow_half n ≈ 0 + pow_half n := (zero_add_equiv _).symm
           _ < pow_half n.succ + pow_half n := add_lt_add_right (pow_half_pos _) _
 #align pgame.add_pow_half_succ_self_eq_pow_half PGame.add_powHalf_succ_self_eq_powHalf
+-/
 
+#print PGame.half_add_half_equiv_one /-
 theorem half_add_half_equiv_one : powHalf 1 + powHalf 1 ≈ 1 :=
   add_powHalf_succ_self_eq_powHalf 0
 #align pgame.half_add_half_equiv_one PGame.half_add_half_equiv_one
+-/
 
 end PGame
 
@@ -172,21 +212,28 @@ namespace Surreal
 
 open PGame
 
+#print Surreal.powHalf /-
 /-- Powers of the surreal number `half`. -/
 def powHalf (n : ℕ) : Surreal :=
   ⟦⟨PGame.powHalf n, PGame.numeric_powHalf n⟩⟧
 #align surreal.pow_half Surreal.powHalf
+-/
 
+#print Surreal.powHalf_zero /-
 @[simp]
 theorem powHalf_zero : powHalf 0 = 1 :=
   rfl
 #align surreal.pow_half_zero Surreal.powHalf_zero
+-/
 
+#print Surreal.double_powHalf_succ_eq_powHalf /-
 @[simp]
 theorem double_powHalf_succ_eq_powHalf (n : ℕ) : 2 • powHalf n.succ = powHalf n := by
   rw [two_nsmul]; exact Quotient.sound (PGame.add_powHalf_succ_self_eq_powHalf n)
 #align surreal.double_pow_half_succ_eq_pow_half Surreal.double_powHalf_succ_eq_powHalf
+-/
 
+#print Surreal.nsmul_pow_two_powHalf /-
 @[simp]
 theorem nsmul_pow_two_powHalf (n : ℕ) : 2 ^ n • powHalf n = 1 :=
   by
@@ -196,9 +243,11 @@ theorem nsmul_pow_two_powHalf (n : ℕ) : 2 ^ n • powHalf n = 1 :=
     rw [← hn, ← double_pow_half_succ_eq_pow_half n, smul_smul (2 ^ n) 2 (pow_half n.succ), mul_comm,
       pow_succ]
 #align surreal.nsmul_pow_two_pow_half Surreal.nsmul_pow_two_powHalf
+-/
 
+#print Surreal.nsmul_pow_two_powHalf' /-
 @[simp]
-theorem nsmul_pow_two_pow_half' (n k : ℕ) : 2 ^ n • powHalf (n + k) = powHalf k :=
+theorem nsmul_pow_two_powHalf' (n k : ℕ) : 2 ^ n • powHalf (n + k) = powHalf k :=
   by
   induction' k with k hk
   ·
@@ -207,8 +256,10 @@ theorem nsmul_pow_two_pow_half' (n k : ℕ) : 2 ^ n • powHalf (n + k) = powHal
   · rw [← double_pow_half_succ_eq_pow_half (n + k), ← double_pow_half_succ_eq_pow_half k,
       smul_algebra_smul_comm] at hk 
     rwa [← zsmul_eq_zsmul_iff' two_ne_zero]
-#align surreal.nsmul_pow_two_pow_half' Surreal.nsmul_pow_two_pow_half'
+#align surreal.nsmul_pow_two_pow_half' Surreal.nsmul_pow_two_powHalf'
+-/
 
+#print Surreal.zsmul_pow_two_powHalf /-
 theorem zsmul_pow_two_powHalf (m : ℤ) (n k : ℕ) : (m * 2 ^ n) • powHalf (n + k) = m • powHalf k :=
   by
   rw [mul_zsmul]
@@ -216,7 +267,9 @@ theorem zsmul_pow_two_powHalf (m : ℤ) (n k : ℕ) : (m * 2 ^ n) • powHalf (n
   norm_cast
   exact nsmul_pow_two_pow_half' n k
 #align surreal.zsmul_pow_two_pow_half Surreal.zsmul_pow_two_powHalf
+-/
 
+#print Surreal.dyadic_aux /-
 theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ = m₂ * 2 ^ y₂) :
     m₁ • powHalf y₂ = m₂ • powHalf y₁ := by
   revert m₁ m₂
@@ -230,7 +283,9 @@ theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ =
   · have := Nat.one_le_pow y₁ 2 Nat.succ_pos'
     norm_cast at h₂ ; linarith
 #align surreal.dyadic_aux Surreal.dyadic_aux
+-/
 
+#print Surreal.dyadicMap /-
 /-- The additive monoid morphism `dyadic_map` sends ⟦⟨m, 2^n⟩⟧ to m • half ^ n. -/
 def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
     where
@@ -269,25 +324,32 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
         _ = c • pow_half d' + a • pow_half b' := by simp only [zsmul_pow_two_pow_half]
         _ = a • pow_half b' + c • pow_half d' := add_comm _ _
 #align surreal.dyadic_map Surreal.dyadicMap
+-/
 
+#print Surreal.dyadicMap_apply /-
 @[simp]
 theorem dyadicMap_apply (m : ℤ) (p : Submonoid.powers (2 : ℤ)) :
     dyadicMap (IsLocalization.mk' (Localization (Submonoid.powers 2)) m p) =
       m • powHalf (Submonoid.log p) :=
   by rw [← Localization.mk_eq_mk']; rfl
 #align surreal.dyadic_map_apply Surreal.dyadicMap_apply
+-/
 
+#print Surreal.dyadicMap_apply_pow /-
 @[simp]
 theorem dyadicMap_apply_pow (m : ℤ) (n : ℕ) :
     dyadicMap (IsLocalization.mk' (Localization (Submonoid.powers 2)) m (Submonoid.pow 2 n)) =
       m • powHalf n :=
   by rw [dyadic_map_apply, @Submonoid.log_pow_int_eq_self 2 one_lt_two]
 #align surreal.dyadic_map_apply_pow Surreal.dyadicMap_apply_pow
+-/
 
+#print Surreal.dyadic /-
 /-- We define dyadic surreals as the range of the map `dyadic_map`. -/
 def dyadic : Set Surreal :=
   Set.range dyadicMap
 #align surreal.dyadic Surreal.dyadic
+-/
 
 -- We conclude with some ideas for further work on surreals; these would make fun projects.
 -- TODO show that the map from dyadic rationals to surreals is injective
Diff
@@ -32,7 +32,6 @@ rational numbers to construct an ordered field embedding of ℝ into `surreal`.
 
 universe u
 
--- mathport name: pgame.equiv
 local infixl:0 " ≈ " => PGame.Equiv
 
 namespace PGame
Diff
@@ -134,12 +134,10 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
         calc
           0 + pow_half n.succ ≈ pow_half n.succ := zero_add_equiv _
           _ < pow_half n := pow_half_succ_lt_pow_half n
-          
       ·
         calc
           pow_half n.succ + 0 ≈ pow_half n.succ := add_zero_equiv _
           _ < pow_half n := pow_half_succ_lt_pow_half n
-          
     · cases n; · rintro ⟨⟩
       rintro ⟨⟩
       apply lf_of_move_right_le
@@ -148,25 +146,21 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
         pow_half n.succ + pow_half (n.succ + 1) ≤ pow_half n.succ + pow_half n.succ :=
           add_le_add_left (pow_half_succ_le_pow_half _) _
         _ ≈ pow_half n := hn _ (Nat.lt_succ_self n)
-        
     · simp only [pow_half_move_left, forall_const]
       apply lf_of_lt
       calc
         0 ≈ 0 + 0 := (add_zero_equiv 0).symm
         _ ≤ pow_half n.succ + 0 := (add_le_add_right (zero_le_pow_half _) _)
         _ < pow_half n.succ + pow_half n.succ := add_lt_add_left (pow_half_pos _) _
-        
     · rintro (⟨⟨⟩⟩ | ⟨⟨⟩⟩) <;> apply lf_of_lt
       ·
         calc
           pow_half n ≈ pow_half n + 0 := (add_zero_equiv _).symm
           _ < pow_half n + pow_half n.succ := add_lt_add_left (pow_half_pos _) _
-          
       ·
         calc
           pow_half n ≈ 0 + pow_half n := (zero_add_equiv _).symm
           _ < pow_half n.succ + pow_half n := add_lt_add_right (pow_half_pos _) _
-          
 #align pgame.add_pow_half_succ_self_eq_pow_half PGame.add_powHalf_succ_self_eq_powHalf
 
 theorem half_add_half_equiv_one : powHalf 1 + powHalf 1 ≈ 1 :=
@@ -275,7 +269,6 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
           by simp only [add_smul, mul_comm, add_comm]
         _ = c • pow_half d' + a • pow_half b' := by simp only [zsmul_pow_two_pow_half]
         _ = a • pow_half b' + c • pow_half d' := add_comm _ _
-        
 #align surreal.dyadic_map Surreal.dyadicMap
 
 @[simp]
Diff
@@ -235,7 +235,7 @@ theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ =
   cases h₂
   · rw [h₂, add_comm, zsmul_pow_two_pow_half m₂ c y₁]
   · have := Nat.one_le_pow y₁ 2 Nat.succ_pos'
-    norm_cast  at h₂ ; linarith
+    norm_cast at h₂ ; linarith
 #align surreal.dyadic_aux Surreal.dyadic_aux
 
 /-- The additive monoid morphism `dyadic_map` sends ⟦⟨m, 2^n⟩⟧ to m • half ^ n. -/
Diff
@@ -212,7 +212,7 @@ theorem nsmul_pow_two_pow_half' (n k : ℕ) : 2 ^ n • powHalf (n + k) = powHal
     simp only [add_zero, Surreal.nsmul_pow_two_powHalf, Nat.zero_eq, eq_self_iff_true,
       Surreal.powHalf_zero]
   · rw [← double_pow_half_succ_eq_pow_half (n + k), ← double_pow_half_succ_eq_pow_half k,
-      smul_algebra_smul_comm] at hk
+      smul_algebra_smul_comm] at hk 
     rwa [← zsmul_eq_zsmul_iff' two_ne_zero]
 #align surreal.nsmul_pow_two_pow_half' Surreal.nsmul_pow_two_pow_half'
 
@@ -231,11 +231,11 @@ theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ =
   · intro m₁ m₂ aux; exact (this (le_of_not_le h) aux.symm).symm
   intro m₁ m₂ h₂
   obtain ⟨c, rfl⟩ := le_iff_exists_add.mp h
-  rw [add_comm, pow_add, ← mul_assoc, mul_eq_mul_right_iff] at h₂
+  rw [add_comm, pow_add, ← mul_assoc, mul_eq_mul_right_iff] at h₂ 
   cases h₂
   · rw [h₂, add_comm, zsmul_pow_two_pow_half m₂ c y₁]
   · have := Nat.one_le_pow y₁ 2 Nat.succ_pos'
-    norm_cast  at h₂; linarith
+    norm_cast  at h₂ ; linarith
 #align surreal.dyadic_aux Surreal.dyadic_aux
 
 /-- The additive monoid morphism `dyadic_map` sends ⟦⟨m, 2^n⟩⟧ to m • half ^ n. -/
@@ -246,7 +246,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
       by
       intro m₁ m₂ n₁ n₂ h₁
       obtain ⟨⟨n₃, y₃, hn₃⟩, h₂⟩ := localization.r_iff_exists.mp h₁
-      simp only [Subtype.coe_mk, mul_eq_mul_left_iff] at h₂
+      simp only [Subtype.coe_mk, mul_eq_mul_left_iff] at h₂ 
       cases h₂
       · simp only
         obtain ⟨a₁, ha₁⟩ := n₁.prop
@@ -266,7 +266,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
       rintro ⟨a, ⟨b, ⟨b', rfl⟩⟩⟩ ⟨c, ⟨d, ⟨d', rfl⟩⟩⟩
       have h₂ : 1 < (2 : ℤ).natAbs := one_lt_two
       have hpow₂ := Submonoid.log_pow_int_eq_self h₂
-      simp_rw [Submonoid.pow_apply] at hpow₂
+      simp_rw [Submonoid.pow_apply] at hpow₂ 
       simp_rw [Localization.add_mk, Localization.liftOn_mk, Subtype.coe_mk,
         Submonoid.log_mul (Int.pow_right_injective h₂), hpow₂]
       calc
Diff
@@ -84,10 +84,7 @@ instance uniquePowHalfSuccRightMoves (n) : Unique (powHalf (n + 1)).RightMoves :
 #align pgame.unique_pow_half_succ_right_moves PGame.uniquePowHalfSuccRightMoves
 
 @[simp]
-theorem birthday_half : birthday (powHalf 1) = 2 :=
-  by
-  rw [birthday_def]
-  dsimp
+theorem birthday_half : birthday (powHalf 1) = 2 := by rw [birthday_def]; dsimp;
   simpa using Order.le_succ (1 : Ordinal)
 #align pgame.birthday_half PGame.birthday_half
 
@@ -120,10 +117,8 @@ theorem powHalf_succ_lt_one (n : ℕ) : powHalf (n + 1) < 1 :=
   (powHalf_succ_lt_powHalf n).trans_le <| powHalf_le_one n
 #align pgame.pow_half_succ_lt_one PGame.powHalf_succ_lt_one
 
-theorem powHalf_pos (n : ℕ) : 0 < powHalf n :=
-  by
-  rw [← lf_iff_lt numeric_zero (numeric_pow_half n), zero_lf_le]
-  simp
+theorem powHalf_pos (n : ℕ) : 0 < powHalf n := by
+  rw [← lf_iff_lt numeric_zero (numeric_pow_half n), zero_lf_le]; simp
 #align pgame.pow_half_pos PGame.powHalf_pos
 
 theorem zero_le_powHalf (n : ℕ) : 0 ≤ powHalf n :=
@@ -145,12 +140,10 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
           pow_half n.succ + 0 ≈ pow_half n.succ := add_zero_equiv _
           _ < pow_half n := pow_half_succ_lt_pow_half n
           
-    · cases n
-      · rintro ⟨⟩
+    · cases n; · rintro ⟨⟩
       rintro ⟨⟩
       apply lf_of_move_right_le
-      swap
-      exact Sum.inl default
+      swap; exact Sum.inl default
       calc
         pow_half n.succ + pow_half (n.succ + 1) ≤ pow_half n.succ + pow_half n.succ :=
           add_le_add_left (pow_half_succ_le_pow_half _) _
@@ -197,10 +190,8 @@ theorem powHalf_zero : powHalf 0 = 1 :=
 #align surreal.pow_half_zero Surreal.powHalf_zero
 
 @[simp]
-theorem double_powHalf_succ_eq_powHalf (n : ℕ) : 2 • powHalf n.succ = powHalf n :=
-  by
-  rw [two_nsmul]
-  exact Quotient.sound (PGame.add_powHalf_succ_self_eq_powHalf n)
+theorem double_powHalf_succ_eq_powHalf (n : ℕ) : 2 • powHalf n.succ = powHalf n := by
+  rw [two_nsmul]; exact Quotient.sound (PGame.add_powHalf_succ_self_eq_powHalf n)
 #align surreal.double_pow_half_succ_eq_pow_half Surreal.double_powHalf_succ_eq_powHalf
 
 @[simp]
@@ -237,16 +228,14 @@ theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ =
     m₁ • powHalf y₂ = m₂ • powHalf y₁ := by
   revert m₁ m₂
   wlog h : y₁ ≤ y₂
-  · intro m₁ m₂ aux
-    exact (this (le_of_not_le h) aux.symm).symm
+  · intro m₁ m₂ aux; exact (this (le_of_not_le h) aux.symm).symm
   intro m₁ m₂ h₂
   obtain ⟨c, rfl⟩ := le_iff_exists_add.mp h
   rw [add_comm, pow_add, ← mul_assoc, mul_eq_mul_right_iff] at h₂
   cases h₂
   · rw [h₂, add_comm, zsmul_pow_two_pow_half m₂ c y₁]
   · have := Nat.one_le_pow y₁ 2 Nat.succ_pos'
-    norm_cast  at h₂
-    linarith
+    norm_cast  at h₂; linarith
 #align surreal.dyadic_aux Surreal.dyadic_aux
 
 /-- The additive monoid morphism `dyadic_map` sends ⟦⟨m, 2^n⟩⟧ to m • half ^ n. -/
@@ -293,9 +282,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal
 theorem dyadicMap_apply (m : ℤ) (p : Submonoid.powers (2 : ℤ)) :
     dyadicMap (IsLocalization.mk' (Localization (Submonoid.powers 2)) m p) =
       m • powHalf (Submonoid.log p) :=
-  by
-  rw [← Localization.mk_eq_mk']
-  rfl
+  by rw [← Localization.mk_eq_mk']; rfl
 #align surreal.dyadic_map_apply Surreal.dyadicMap_apply
 
 @[simp]
Diff
@@ -33,55 +33,55 @@ rational numbers to construct an ordered field embedding of ℝ into `surreal`.
 universe u
 
 -- mathport name: pgame.equiv
-local infixl:0 " ≈ " => Pgame.Equiv
+local infixl:0 " ≈ " => PGame.Equiv
 
-namespace Pgame
+namespace PGame
 
 /-- For a natural number `n`, the pre-game `pow_half (n + 1)` is recursively defined as
 `{0 | pow_half n}`. These are the explicit expressions of powers of `1 / 2`. By definition, we have
 `pow_half 0 = 1` and `pow_half 1 ≈ 1 / 2` and we prove later on that
 `pow_half (n + 1) + pow_half (n + 1) ≈ pow_half n`. -/
-def powHalf : ℕ → Pgame
+def powHalf : ℕ → PGame
   | 0 => 1
   | n + 1 => ⟨PUnit, PUnit, 0, fun _ => pow_half n⟩
-#align pgame.pow_half Pgame.powHalf
+#align pgame.pow_half PGame.powHalf
 
 @[simp]
 theorem powHalf_zero : powHalf 0 = 1 :=
   rfl
-#align pgame.pow_half_zero Pgame.powHalf_zero
+#align pgame.pow_half_zero PGame.powHalf_zero
 
 theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by cases n <;> rfl
-#align pgame.pow_half_left_moves Pgame.powHalf_leftMoves
+#align pgame.pow_half_left_moves PGame.powHalf_leftMoves
 
 theorem powHalf_zero_rightMoves : (powHalf 0).RightMoves = PEmpty :=
   rfl
-#align pgame.pow_half_zero_right_moves Pgame.powHalf_zero_rightMoves
+#align pgame.pow_half_zero_right_moves PGame.powHalf_zero_rightMoves
 
 theorem powHalf_succ_rightMoves (n) : (powHalf (n + 1)).RightMoves = PUnit :=
   rfl
-#align pgame.pow_half_succ_right_moves Pgame.powHalf_succ_rightMoves
+#align pgame.pow_half_succ_right_moves PGame.powHalf_succ_rightMoves
 
 @[simp]
 theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> cases i <;> rfl
-#align pgame.pow_half_move_left Pgame.powHalf_moveLeft
+#align pgame.pow_half_move_left PGame.powHalf_moveLeft
 
 @[simp]
 theorem powHalf_succ_moveRight (n i) : (powHalf (n + 1)).moveRight i = powHalf n :=
   rfl
-#align pgame.pow_half_succ_move_right Pgame.powHalf_succ_moveRight
+#align pgame.pow_half_succ_move_right PGame.powHalf_succ_moveRight
 
 instance uniquePowHalfLeftMoves (n) : Unique (powHalf n).LeftMoves := by
   cases n <;> exact PUnit.unique
-#align pgame.unique_pow_half_left_moves Pgame.uniquePowHalfLeftMoves
+#align pgame.unique_pow_half_left_moves PGame.uniquePowHalfLeftMoves
 
 instance isEmpty_powHalf_zero_rightMoves : IsEmpty (powHalf 0).RightMoves :=
   PEmpty.isEmpty
-#align pgame.is_empty_pow_half_zero_right_moves Pgame.isEmpty_powHalf_zero_rightMoves
+#align pgame.is_empty_pow_half_zero_right_moves PGame.isEmpty_powHalf_zero_rightMoves
 
 instance uniquePowHalfSuccRightMoves (n) : Unique (powHalf (n + 1)).RightMoves :=
   PUnit.unique
-#align pgame.unique_pow_half_succ_right_moves Pgame.uniquePowHalfSuccRightMoves
+#align pgame.unique_pow_half_succ_right_moves PGame.uniquePowHalfSuccRightMoves
 
 @[simp]
 theorem birthday_half : birthday (powHalf 1) = 2 :=
@@ -89,7 +89,7 @@ theorem birthday_half : birthday (powHalf 1) = 2 :=
   rw [birthday_def]
   dsimp
   simpa using Order.le_succ (1 : Ordinal)
-#align pgame.birthday_half Pgame.birthday_half
+#align pgame.birthday_half PGame.birthday_half
 
 /-- For all natural numbers `n`, the pre-games `pow_half n` are numeric. -/
 theorem numeric_powHalf (n) : (powHalf n).Numeric :=
@@ -99,36 +99,36 @@ theorem numeric_powHalf (n) : (powHalf n).Numeric :=
   · constructor
     · simpa using hn.move_left_lt default
     · exact ⟨fun _ => numeric_zero, fun _ => hn⟩
-#align pgame.numeric_pow_half Pgame.numeric_powHalf
+#align pgame.numeric_pow_half PGame.numeric_powHalf
 
 theorem powHalf_succ_lt_powHalf (n : ℕ) : powHalf (n + 1) < powHalf n :=
   (numeric_powHalf (n + 1)).lt_moveRight default
-#align pgame.pow_half_succ_lt_pow_half Pgame.powHalf_succ_lt_powHalf
+#align pgame.pow_half_succ_lt_pow_half PGame.powHalf_succ_lt_powHalf
 
 theorem powHalf_succ_le_powHalf (n : ℕ) : powHalf (n + 1) ≤ powHalf n :=
   (powHalf_succ_lt_powHalf n).le
-#align pgame.pow_half_succ_le_pow_half Pgame.powHalf_succ_le_powHalf
+#align pgame.pow_half_succ_le_pow_half PGame.powHalf_succ_le_powHalf
 
 theorem powHalf_le_one (n : ℕ) : powHalf n ≤ 1 :=
   by
   induction' n with n hn
   · exact le_rfl
   · exact (pow_half_succ_le_pow_half n).trans hn
-#align pgame.pow_half_le_one Pgame.powHalf_le_one
+#align pgame.pow_half_le_one PGame.powHalf_le_one
 
 theorem powHalf_succ_lt_one (n : ℕ) : powHalf (n + 1) < 1 :=
   (powHalf_succ_lt_powHalf n).trans_le <| powHalf_le_one n
-#align pgame.pow_half_succ_lt_one Pgame.powHalf_succ_lt_one
+#align pgame.pow_half_succ_lt_one PGame.powHalf_succ_lt_one
 
 theorem powHalf_pos (n : ℕ) : 0 < powHalf n :=
   by
   rw [← lf_iff_lt numeric_zero (numeric_pow_half n), zero_lf_le]
   simp
-#align pgame.pow_half_pos Pgame.powHalf_pos
+#align pgame.pow_half_pos PGame.powHalf_pos
 
 theorem zero_le_powHalf (n : ℕ) : 0 ≤ powHalf n :=
   (powHalf_pos n).le
-#align pgame.zero_le_pow_half Pgame.zero_le_powHalf
+#align pgame.zero_le_pow_half PGame.zero_le_powHalf
 
 theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1) ≈ powHalf n :=
   by
@@ -174,21 +174,21 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
           pow_half n ≈ 0 + pow_half n := (zero_add_equiv _).symm
           _ < pow_half n.succ + pow_half n := add_lt_add_right (pow_half_pos _) _
           
-#align pgame.add_pow_half_succ_self_eq_pow_half Pgame.add_powHalf_succ_self_eq_powHalf
+#align pgame.add_pow_half_succ_self_eq_pow_half PGame.add_powHalf_succ_self_eq_powHalf
 
 theorem half_add_half_equiv_one : powHalf 1 + powHalf 1 ≈ 1 :=
   add_powHalf_succ_self_eq_powHalf 0
-#align pgame.half_add_half_equiv_one Pgame.half_add_half_equiv_one
+#align pgame.half_add_half_equiv_one PGame.half_add_half_equiv_one
 
-end Pgame
+end PGame
 
 namespace Surreal
 
-open Pgame
+open PGame
 
 /-- Powers of the surreal number `half`. -/
 def powHalf (n : ℕ) : Surreal :=
-  ⟦⟨Pgame.powHalf n, Pgame.numeric_powHalf n⟩⟧
+  ⟦⟨PGame.powHalf n, PGame.numeric_powHalf n⟩⟧
 #align surreal.pow_half Surreal.powHalf
 
 @[simp]
@@ -200,7 +200,7 @@ theorem powHalf_zero : powHalf 0 = 1 :=
 theorem double_powHalf_succ_eq_powHalf (n : ℕ) : 2 • powHalf n.succ = powHalf n :=
   by
   rw [two_nsmul]
-  exact Quotient.sound (Pgame.add_powHalf_succ_self_eq_powHalf n)
+  exact Quotient.sound (PGame.add_powHalf_succ_self_eq_powHalf n)
 #align surreal.double_pow_half_succ_eq_pow_half Surreal.double_powHalf_succ_eq_powHalf
 
 @[simp]
Diff
@@ -160,7 +160,7 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
       apply lf_of_lt
       calc
         0 ≈ 0 + 0 := (add_zero_equiv 0).symm
-        _ ≤ pow_half n.succ + 0 := add_le_add_right (zero_le_pow_half _) _
+        _ ≤ pow_half n.succ + 0 := (add_le_add_right (zero_le_pow_half _) _)
         _ < pow_half n.succ + pow_half n.succ := add_lt_add_left (pow_half_pos _) _
         
     · rintro (⟨⟨⟩⟩ | ⟨⟨⟩⟩) <;> apply lf_of_lt

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 3 (#12372)

A PR analogous to #12338 and #12361: reformatting proofs following the multiple goals linter of #12339.

Diff
@@ -134,7 +134,8 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
       · rintro ⟨⟩
       rintro ⟨⟩
       apply lf_of_moveRight_le
-      swap; exact Sum.inl default
+      swap
+      · exact Sum.inl default
       calc
         powHalf n.succ + powHalf (n.succ + 1) ≤ powHalf n.succ + powHalf n.succ :=
           add_le_add_left (powHalf_succ_le_powHalf _) _
chore: split Algebra.Algebra.Basic (#12486)

Splits Algebra.Algebra.Defs off Algebra.Algebra.Basic. Most imports only need the Defs file, which has significantly smaller imports. The remaining Algebra.Algebra.Basic is now a grab-bag of unrelated results, and should probably be split further or rehomed.

This is mostly motivated by the wasted effort during minimization upon encountering Algebra.Algebra.Basic.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2021 Apurva Nakade. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Apurva Nakade
 -/
-import Mathlib.Algebra.Algebra.Basic
+import Mathlib.Algebra.Algebra.Defs
 import Mathlib.Algebra.GroupPower.Order
 import Mathlib.RingTheory.Localization.Basic
 import Mathlib.SetTheory.Game.Birthday
chore: superfluous parentheses part 2 (#12131)

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

Diff
@@ -142,15 +142,15 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
     · simp only [powHalf_moveLeft, forall_const]
       apply lf_of_lt
       calc
-        0 ≈ 0 + 0 := (Equiv.symm (add_zero_equiv 0))
-        _ ≤ powHalf n.succ + 0 := (add_le_add_right (zero_le_powHalf _) _)
+        0 ≈ 0 + 0 := Equiv.symm (add_zero_equiv 0)
+        _ ≤ powHalf n.succ + 0 := add_le_add_right (zero_le_powHalf _) _
         _ < powHalf n.succ + powHalf n.succ := add_lt_add_left (powHalf_pos _) _
     · rintro (⟨⟨⟩⟩ | ⟨⟨⟩⟩) <;> apply lf_of_lt
       · calc
-          powHalf n ≈ powHalf n + 0 := (Equiv.symm (add_zero_equiv _))
+          powHalf n ≈ powHalf n + 0 := Equiv.symm (add_zero_equiv _)
           _ < powHalf n + powHalf n.succ := add_lt_add_left (powHalf_pos _) _
       · calc
-          powHalf n ≈ 0 + powHalf n := (Equiv.symm (zero_add_equiv _))
+          powHalf n ≈ 0 + powHalf n := Equiv.symm (zero_add_equiv _)
           _ < powHalf n.succ + powHalf n := add_lt_add_right (powHalf_pos _) _
 #align pgame.add_pow_half_succ_self_eq_pow_half SetTheory.PGame.add_powHalf_succ_self_eq_powHalf
 
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -186,7 +186,7 @@ theorem nsmul_pow_two_powHalf (n : ℕ) : 2 ^ n • powHalf n = 1 := by
   induction' n with n hn
   · simp only [Nat.zero_eq, pow_zero, powHalf_zero, one_smul]
   · rw [← hn, ← double_powHalf_succ_eq_powHalf n, smul_smul (2 ^ n) 2 (powHalf n.succ), mul_comm,
-      pow_succ]
+      pow_succ']
 #align surreal.nsmul_pow_two_pow_half Surreal.nsmul_pow_two_powHalf
 
 @[simp]
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
@@ -239,7 +239,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal where
         apply dyadic_aux
         rwa [ha₁, ha₂, mul_comm, mul_comm m₂]
       · have : (1 : ℤ) ≤ 2 ^ y₃ := mod_cast Nat.one_le_pow y₃ 2 Nat.succ_pos'
-        omega
+        linarith
   map_zero' := Localization.liftOn_zero _ _
   map_add' x y :=
     Localization.induction_on₂ x y <| by
refactor: optimize proofs with omega (#11093)

I ran tryAtEachStep on all files under Mathlib to find all locations where omega succeeds. For each that was a linarith without an only, I tried replacing it with omega, and I verified that elaboration time got smaller. (In almost all cases, there was a noticeable speedup.) I also replaced some slow aesops along the way.

Diff
@@ -218,7 +218,7 @@ theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ =
   cases' h₂ with h₂ h₂
   · rw [h₂, add_comm, zsmul_pow_two_powHalf m₂ c y₁]
   · have := Nat.one_le_pow y₁ 2 Nat.succ_pos'
-    norm_cast at h₂; linarith
+    norm_cast at h₂; omega
 #align surreal.dyadic_aux Surreal.dyadic_aux
 
 /-- The additive monoid morphism `dyadicMap` sends ⟦⟨m, 2^n⟩⟧ to m • half ^ n. -/
@@ -239,7 +239,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal where
         apply dyadic_aux
         rwa [ha₁, ha₂, mul_comm, mul_comm m₂]
       · have : (1 : ℤ) ≤ 2 ^ y₃ := mod_cast Nat.one_le_pow y₃ 2 Nat.succ_pos'
-        linarith
+        omega
   map_zero' := Localization.liftOn_zero _ _
   map_add' x y :=
     Localization.induction_on₂ x y <| by
chore: add lemmas for nat literals corresponding to lemmas for nat casts (#8006)

I loogled for every occurrence of "cast", Nat and "natCast" and where the casted nat was n, and made sure there were corresponding @[simp] lemmas for 0, 1, and OfNat.ofNat n. This is necessary in general for simp confluence. Example:

import Mathlib

variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo]

example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
  simp only [Nat.cast_le] -- this `@[simp]` lemma can apply

example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by
  simp only [Nat.cast_ofNat] -- and so can this one

example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
  simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue.

As far as I know, the only file this PR leaves with ofNat gaps is PartENat.lean. #8002 is addressing that file in parallel.

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

Diff
@@ -82,7 +82,7 @@ instance uniquePowHalfSuccRightMoves (n) : Unique (powHalf (n + 1)).RightMoves :
 
 @[simp]
 theorem birthday_half : birthday (powHalf 1) = 2 := by
-  rw [birthday_def]; dsimp; simpa using Order.le_succ (1 : Ordinal)
+  rw [birthday_def]; simp
 #align pgame.birthday_half SetTheory.PGame.birthday_half
 
 /-- For all natural numbers `n`, the pre-games `powHalf n` are numeric. -/
chore: Move positivity extensions (#10140)

The goal here is to have access to positivity earlier in the import hierarchy

Diff
@@ -4,9 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Apurva Nakade
 -/
 import Mathlib.Algebra.Algebra.Basic
+import Mathlib.Algebra.GroupPower.Order
+import Mathlib.RingTheory.Localization.Basic
 import Mathlib.SetTheory.Game.Birthday
 import Mathlib.SetTheory.Surreal.Basic
-import Mathlib.RingTheory.Localization.Basic
 
 #align_import set_theory.surreal.dyadic from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
 
chore: replace exact_mod_cast tactic with mod_cast elaborator where possible (#8404)

We still have the exact_mod_cast tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast are the ones that don't work using the term elaborator by itself.

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

Diff
@@ -237,7 +237,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal where
         rw [hn₁, hn₂, Submonoid.log_pow_int_eq_self h₂, Submonoid.log_pow_int_eq_self h₂]
         apply dyadic_aux
         rwa [ha₁, ha₂, mul_comm, mul_comm m₂]
-      · have : (1 : ℤ) ≤ 2 ^ y₃ := by exact_mod_cast Nat.one_le_pow y₃ 2 Nat.succ_pos'
+      · have : (1 : ℤ) ≤ 2 ^ y₃ := mod_cast Nat.one_le_pow y₃ 2 Nat.succ_pos'
         linarith
   map_zero' := Localization.liftOn_zero _ _
   map_add' x y :=
chore: move Game to SetTheory.Game (#6365)

move Game and PGame into namespace SetTheory as _root_.Game might collide with other definitions (e.g. in projects depending on mathlib)

Diff
@@ -29,6 +29,8 @@ rational numbers to construct an ordered field embedding of ℝ into `Surreal`.
 
 universe u
 
+namespace SetTheory
+
 namespace PGame
 
 /-- For a natural number `n`, the pre-game `powHalf (n + 1)` is recursively defined as
@@ -38,49 +40,49 @@ namespace PGame
 def powHalf : ℕ → PGame
   | 0 => 1
   | n + 1 => ⟨PUnit, PUnit, 0, fun _ => powHalf n⟩
-#align pgame.pow_half PGame.powHalf
+#align pgame.pow_half SetTheory.PGame.powHalf
 
 @[simp]
 theorem powHalf_zero : powHalf 0 = 1 :=
   rfl
-#align pgame.pow_half_zero PGame.powHalf_zero
+#align pgame.pow_half_zero SetTheory.PGame.powHalf_zero
 
 theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by cases n <;> rfl
-#align pgame.pow_half_left_moves PGame.powHalf_leftMoves
+#align pgame.pow_half_left_moves SetTheory.PGame.powHalf_leftMoves
 
 theorem powHalf_zero_rightMoves : (powHalf 0).RightMoves = PEmpty :=
   rfl
-#align pgame.pow_half_zero_right_moves PGame.powHalf_zero_rightMoves
+#align pgame.pow_half_zero_right_moves SetTheory.PGame.powHalf_zero_rightMoves
 
 theorem powHalf_succ_rightMoves (n) : (powHalf (n + 1)).RightMoves = PUnit :=
   rfl
-#align pgame.pow_half_succ_right_moves PGame.powHalf_succ_rightMoves
+#align pgame.pow_half_succ_right_moves SetTheory.PGame.powHalf_succ_rightMoves
 
 @[simp]
 theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> cases i <;> rfl
-#align pgame.pow_half_move_left PGame.powHalf_moveLeft
+#align pgame.pow_half_move_left SetTheory.PGame.powHalf_moveLeft
 
 @[simp]
 theorem powHalf_succ_moveRight (n i) : (powHalf (n + 1)).moveRight i = powHalf n :=
   rfl
-#align pgame.pow_half_succ_move_right PGame.powHalf_succ_moveRight
+#align pgame.pow_half_succ_move_right SetTheory.PGame.powHalf_succ_moveRight
 
 instance uniquePowHalfLeftMoves (n) : Unique (powHalf n).LeftMoves := by
   cases n <;> exact PUnit.unique
-#align pgame.unique_pow_half_left_moves PGame.uniquePowHalfLeftMoves
+#align pgame.unique_pow_half_left_moves SetTheory.PGame.uniquePowHalfLeftMoves
 
 instance isEmpty_powHalf_zero_rightMoves : IsEmpty (powHalf 0).RightMoves :=
   inferInstanceAs (IsEmpty PEmpty)
-#align pgame.is_empty_pow_half_zero_right_moves PGame.isEmpty_powHalf_zero_rightMoves
+#align pgame.is_empty_pow_half_zero_right_moves SetTheory.PGame.isEmpty_powHalf_zero_rightMoves
 
 instance uniquePowHalfSuccRightMoves (n) : Unique (powHalf (n + 1)).RightMoves :=
   PUnit.unique
-#align pgame.unique_pow_half_succ_right_moves PGame.uniquePowHalfSuccRightMoves
+#align pgame.unique_pow_half_succ_right_moves SetTheory.PGame.uniquePowHalfSuccRightMoves
 
 @[simp]
 theorem birthday_half : birthday (powHalf 1) = 2 := by
   rw [birthday_def]; dsimp; simpa using Order.le_succ (1 : Ordinal)
-#align pgame.birthday_half PGame.birthday_half
+#align pgame.birthday_half SetTheory.PGame.birthday_half
 
 /-- For all natural numbers `n`, the pre-games `powHalf n` are numeric. -/
 theorem numeric_powHalf (n) : (powHalf n).Numeric := by
@@ -89,33 +91,33 @@ theorem numeric_powHalf (n) : (powHalf n).Numeric := by
   · constructor
     · simpa using hn.moveLeft_lt default
     · exact ⟨fun _ => numeric_zero, fun _ => hn⟩
-#align pgame.numeric_pow_half PGame.numeric_powHalf
+#align pgame.numeric_pow_half SetTheory.PGame.numeric_powHalf
 
 theorem powHalf_succ_lt_powHalf (n : ℕ) : powHalf (n + 1) < powHalf n :=
   (numeric_powHalf (n + 1)).lt_moveRight default
-#align pgame.pow_half_succ_lt_pow_half PGame.powHalf_succ_lt_powHalf
+#align pgame.pow_half_succ_lt_pow_half SetTheory.PGame.powHalf_succ_lt_powHalf
 
 theorem powHalf_succ_le_powHalf (n : ℕ) : powHalf (n + 1) ≤ powHalf n :=
   (powHalf_succ_lt_powHalf n).le
-#align pgame.pow_half_succ_le_pow_half PGame.powHalf_succ_le_powHalf
+#align pgame.pow_half_succ_le_pow_half SetTheory.PGame.powHalf_succ_le_powHalf
 
 theorem powHalf_le_one (n : ℕ) : powHalf n ≤ 1 := by
   induction' n with n hn
   · exact le_rfl
   · exact (powHalf_succ_le_powHalf n).trans hn
-#align pgame.pow_half_le_one PGame.powHalf_le_one
+#align pgame.pow_half_le_one SetTheory.PGame.powHalf_le_one
 
 theorem powHalf_succ_lt_one (n : ℕ) : powHalf (n + 1) < 1 :=
   (powHalf_succ_lt_powHalf n).trans_le <| powHalf_le_one n
-#align pgame.pow_half_succ_lt_one PGame.powHalf_succ_lt_one
+#align pgame.pow_half_succ_lt_one SetTheory.PGame.powHalf_succ_lt_one
 
 theorem powHalf_pos (n : ℕ) : 0 < powHalf n := by
   rw [← lf_iff_lt numeric_zero (numeric_powHalf n), zero_lf_le]; simp
-#align pgame.pow_half_pos PGame.powHalf_pos
+#align pgame.pow_half_pos SetTheory.PGame.powHalf_pos
 
 theorem zero_le_powHalf (n : ℕ) : 0 ≤ powHalf n :=
   (powHalf_pos n).le
-#align pgame.zero_le_pow_half PGame.zero_le_powHalf
+#align pgame.zero_le_pow_half SetTheory.PGame.zero_le_powHalf
 
 theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1) ≈ powHalf n := by
   induction' n using Nat.strong_induction_on with n hn
@@ -149,17 +151,19 @@ theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1)
       · calc
           powHalf n ≈ 0 + powHalf n := (Equiv.symm (zero_add_equiv _))
           _ < powHalf n.succ + powHalf n := add_lt_add_right (powHalf_pos _) _
-#align pgame.add_pow_half_succ_self_eq_pow_half PGame.add_powHalf_succ_self_eq_powHalf
+#align pgame.add_pow_half_succ_self_eq_pow_half SetTheory.PGame.add_powHalf_succ_self_eq_powHalf
 
 theorem half_add_half_equiv_one : powHalf 1 + powHalf 1 ≈ 1 :=
   add_powHalf_succ_self_eq_powHalf 0
-#align pgame.half_add_half_equiv_one PGame.half_add_half_equiv_one
+#align pgame.half_add_half_equiv_one SetTheory.PGame.half_add_half_equiv_one
 
 end PGame
 
+end SetTheory
+
 namespace Surreal
 
-open PGame
+open SetTheory PGame
 
 /-- Powers of the surreal number `half`. -/
 def powHalf (n : ℕ) : Surreal :=
chore: remove unused simps (#6632)

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

Diff
@@ -242,7 +242,7 @@ def dyadicMap : Localization.Away (2 : ℤ) →+ Surreal where
       have h₂ : 1 < (2 : ℤ).natAbs := one_lt_two
       have hpow₂ := Submonoid.log_pow_int_eq_self h₂
       simp_rw [Submonoid.pow_apply] at hpow₂
-      simp_rw [Localization.add_mk, Localization.liftOn_mk, Subtype.coe_mk,
+      simp_rw [Localization.add_mk, Localization.liftOn_mk,
         Submonoid.log_mul (Int.pow_right_injective h₂), hpow₂]
       calc
         (2 ^ b' * c + 2 ^ d' * a) • powHalf (b' + d') =
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,17 +2,14 @@
 Copyright (c) 2021 Apurva Nakade. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Apurva Nakade
-
-! This file was ported from Lean 3 source module set_theory.surreal.dyadic
-! leanprover-community/mathlib commit 92ca63f0fb391a9ca5f22d2409a6080e786d99f7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.Algebra.Basic
 import Mathlib.SetTheory.Game.Birthday
 import Mathlib.SetTheory.Surreal.Basic
 import Mathlib.RingTheory.Localization.Basic
 
+#align_import set_theory.surreal.dyadic from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
+
 /-!
 # Dyadic numbers
 Dyadic numbers are obtained by localizing ℤ away from 2. They are the initial object in the category
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -216,7 +216,7 @@ theorem dyadic_aux {m₁ m₂ : ℤ} {y₁ y₂ : ℕ} (h₂ : m₁ * 2 ^ y₁ =
   cases' h₂ with h₂ h₂
   · rw [h₂, add_comm, zsmul_pow_two_powHalf m₂ c y₁]
   · have := Nat.one_le_pow y₁ 2 Nat.succ_pos'
-    norm_cast at h₂ ; linarith
+    norm_cast at h₂; linarith
 #align surreal.dyadic_aux Surreal.dyadic_aux
 
 /-- The additive monoid morphism `dyadicMap` sends ⟦⟨m, 2^n⟩⟧ to m • half ^ n. -/
feat: port SetTheory.Surreal.Dyadic (#5552)

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Dependencies 8 + 420

421 files ported (98.1%)
177462 lines ported (98.3%)
Show graph

The unported dependencies are