logic.hydraMathlib.Logic.Hydra

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -70,10 +70,10 @@ theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
   fun s t ⟨u, a, hr, he⟩ => by
   classical
   refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
-  · apply_fun count b at he ; simp_rw [count_add] at he 
+  · apply_fun count b at he; simp_rw [count_add] at he
     convert he <;> convert (add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
     exacts [h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
-  · apply_fun count a at he ; simp_rw [count_add, count_singleton_self] at he 
+  · apply_fun count a at he; simp_rw [count_add, count_singleton_self] at he
     apply Nat.lt_of_succ_le; convert he.le; convert (add_zero _).symm
     exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
@@ -129,7 +129,7 @@ theorem cutExpand_fibration (r : α → α → Prop) :
   rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he ⊢
   classical
   obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
-  rw [add_assoc, mem_add] at ha 
+  rw [add_assoc, mem_add] at ha
   obtain h | h := ha
   · refine' ⟨(s₁.erase a + t, s₂), game_add.fst ⟨t, a, hr, _⟩, _⟩
     · rw [add_comm, ← add_assoc, singleton_add, cons_erase h]
Diff
@@ -67,7 +67,15 @@ variable {r : α → α → Prop}
 #print Relation.cutExpand_le_invImage_lex /-
 theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp :=
-  fun s t ⟨u, a, hr, he⟩ => by classical
+  fun s t ⟨u, a, hr, he⟩ => by
+  classical
+  refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
+  · apply_fun count b at he ; simp_rw [count_add] at he 
+    convert he <;> convert (add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
+    exacts [h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
+  · apply_fun count a at he ; simp_rw [count_add, count_singleton_self] at he 
+    apply Nat.lt_of_succ_le; convert he.le; convert (add_zero _).symm
+    exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
 -/
 
@@ -105,7 +113,10 @@ theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
 -/
 
 #print Relation.not_cutExpand_zero /-
-theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by classical
+theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by
+  classical
+  rw [cut_expand_iff]
+  rintro ⟨_, _, _, ⟨⟩, _⟩
 #align relation.not_cut_expand_zero Relation.not_cutExpand_zero
 -/
 
@@ -117,6 +128,15 @@ theorem cutExpand_fibration (r : α → α → Prop) :
   by
   rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he ⊢
   classical
+  obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
+  rw [add_assoc, mem_add] at ha 
+  obtain h | h := ha
+  · refine' ⟨(s₁.erase a + t, s₂), game_add.fst ⟨t, a, hr, _⟩, _⟩
+    · rw [add_comm, ← add_assoc, singleton_add, cons_erase h]
+    · rw [add_assoc s₁, erase_add_left_pos _ h, add_right_comm, add_assoc]
+  · refine' ⟨(s₁, (s₂ + t).eraseₓ a), game_add.snd ⟨t, a, hr, _⟩, _⟩
+    · rw [add_comm, singleton_add, cons_erase h]
+    · rw [add_assoc, erase_add_right_pos _ h]
 #align relation.cut_expand_fibration Relation.cutExpand_fibration
 -/
 
@@ -144,6 +164,11 @@ theorem Acc.cutExpand [IsIrrefl α r] {a : α} (hacc : Acc r a) : Acc (CutExpand
   induction' hacc with a h ih
   refine' Acc.intro _ fun s => _
   classical
+  rw [cut_expand_iff]
+  rintro ⟨t, a, hr, rfl | ⟨⟨⟩⟩, rfl⟩
+  refine' acc_of_singleton fun a' => _
+  rw [erase_singleton, zero_add]
+  exact ih a' ∘ hr a'
 #align acc.cut_expand Acc.cutExpand
 -/
 
Diff
@@ -67,15 +67,7 @@ variable {r : α → α → Prop}
 #print Relation.cutExpand_le_invImage_lex /-
 theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp :=
-  fun s t ⟨u, a, hr, he⟩ => by
-  classical
-  refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
-  · apply_fun count b at he ; simp_rw [count_add] at he 
-    convert he <;> convert (add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
-    exacts [h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
-  · apply_fun count a at he ; simp_rw [count_add, count_singleton_self] at he 
-    apply Nat.lt_of_succ_le; convert he.le; convert (add_zero _).symm
-    exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
+  fun s t ⟨u, a, hr, he⟩ => by classical
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
 -/
 
@@ -113,10 +105,7 @@ theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
 -/
 
 #print Relation.not_cutExpand_zero /-
-theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by
-  classical
-  rw [cut_expand_iff]
-  rintro ⟨_, _, _, ⟨⟩, _⟩
+theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by classical
 #align relation.not_cut_expand_zero Relation.not_cutExpand_zero
 -/
 
@@ -128,15 +117,6 @@ theorem cutExpand_fibration (r : α → α → Prop) :
   by
   rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he ⊢
   classical
-  obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
-  rw [add_assoc, mem_add] at ha 
-  obtain h | h := ha
-  · refine' ⟨(s₁.erase a + t, s₂), game_add.fst ⟨t, a, hr, _⟩, _⟩
-    · rw [add_comm, ← add_assoc, singleton_add, cons_erase h]
-    · rw [add_assoc s₁, erase_add_left_pos _ h, add_right_comm, add_assoc]
-  · refine' ⟨(s₁, (s₂ + t).eraseₓ a), game_add.snd ⟨t, a, hr, _⟩, _⟩
-    · rw [add_comm, singleton_add, cons_erase h]
-    · rw [add_assoc, erase_add_right_pos _ h]
 #align relation.cut_expand_fibration Relation.cutExpand_fibration
 -/
 
@@ -164,11 +144,6 @@ theorem Acc.cutExpand [IsIrrefl α r] {a : α} (hacc : Acc r a) : Acc (CutExpand
   induction' hacc with a h ih
   refine' Acc.intro _ fun s => _
   classical
-  rw [cut_expand_iff]
-  rintro ⟨t, a, hr, rfl | ⟨⟨⟩⟩, rfl⟩
-  refine' acc_of_singleton fun a' => _
-  rw [erase_singleton, zero_add]
-  exact ih a' ∘ hr a'
 #align acc.cut_expand Acc.cutExpand
 -/
 
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2022 Junyan Xu. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Junyan Xu
 -/
-import Mathbin.Data.Finsupp.Lex
-import Mathbin.Data.Finsupp.Multiset
-import Mathbin.Order.GameAdd
+import Data.Finsupp.Lex
+import Data.Finsupp.Multiset
+import Order.GameAdd
 
 #align_import logic.hydra from "leanprover-community/mathlib"@"d64d67d000b974f0d86a2be7918cf800be6271c8"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2022 Junyan Xu. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Junyan Xu
-
-! This file was ported from Lean 3 source module logic.hydra
-! leanprover-community/mathlib commit d64d67d000b974f0d86a2be7918cf800be6271c8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Finsupp.Lex
 import Mathbin.Data.Finsupp.Multiset
 import Mathbin.Order.GameAdd
 
+#align_import logic.hydra from "leanprover-community/mathlib"@"d64d67d000b974f0d86a2be7918cf800be6271c8"
+
 /-!
 # Termination of a hydra game
 
Diff
@@ -67,6 +67,7 @@ def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
 
 variable {r : α → α → Prop}
 
+#print Relation.cutExpand_le_invImage_lex /-
 theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp :=
   fun s t ⟨u, a, hr, he⟩ => by
@@ -79,6 +80,7 @@ theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     apply Nat.lt_of_succ_le; convert he.le; convert (add_zero _).symm
     exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
+-/
 
 #print Relation.cutExpand_singleton /-
 theorem cutExpand_singleton {s x} (h : ∀ x' ∈ s, r x' x) : CutExpand r s {x} :=
Diff
@@ -71,13 +71,13 @@ theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp :=
   fun s t ⟨u, a, hr, he⟩ => by
   classical
-    refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
-    · apply_fun count b  at he ; simp_rw [count_add] at he 
-      convert he <;> convert(add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
-      exacts [h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
-    · apply_fun count a  at he ; simp_rw [count_add, count_singleton_self] at he 
-      apply Nat.lt_of_succ_le; convert he.le; convert(add_zero _).symm
-      exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
+  refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
+  · apply_fun count b at he ; simp_rw [count_add] at he 
+    convert he <;> convert (add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
+    exacts [h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
+  · apply_fun count a at he ; simp_rw [count_add, count_singleton_self] at he 
+    apply Nat.lt_of_succ_le; convert he.le; convert (add_zero _).symm
+    exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
 
 #print Relation.cutExpand_singleton /-
@@ -116,8 +116,8 @@ theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
 #print Relation.not_cutExpand_zero /-
 theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by
   classical
-    rw [cut_expand_iff]
-    rintro ⟨_, _, _, ⟨⟩, _⟩
+  rw [cut_expand_iff]
+  rintro ⟨_, _, _, ⟨⟩, _⟩
 #align relation.not_cut_expand_zero Relation.not_cutExpand_zero
 -/
 
@@ -129,15 +129,15 @@ theorem cutExpand_fibration (r : α → α → Prop) :
   by
   rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he ⊢
   classical
-    obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
-    rw [add_assoc, mem_add] at ha 
-    obtain h | h := ha
-    · refine' ⟨(s₁.erase a + t, s₂), game_add.fst ⟨t, a, hr, _⟩, _⟩
-      · rw [add_comm, ← add_assoc, singleton_add, cons_erase h]
-      · rw [add_assoc s₁, erase_add_left_pos _ h, add_right_comm, add_assoc]
-    · refine' ⟨(s₁, (s₂ + t).eraseₓ a), game_add.snd ⟨t, a, hr, _⟩, _⟩
-      · rw [add_comm, singleton_add, cons_erase h]
-      · rw [add_assoc, erase_add_right_pos _ h]
+  obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
+  rw [add_assoc, mem_add] at ha 
+  obtain h | h := ha
+  · refine' ⟨(s₁.erase a + t, s₂), game_add.fst ⟨t, a, hr, _⟩, _⟩
+    · rw [add_comm, ← add_assoc, singleton_add, cons_erase h]
+    · rw [add_assoc s₁, erase_add_left_pos _ h, add_right_comm, add_assoc]
+  · refine' ⟨(s₁, (s₂ + t).eraseₓ a), game_add.snd ⟨t, a, hr, _⟩, _⟩
+    · rw [add_comm, singleton_add, cons_erase h]
+    · rw [add_assoc, erase_add_right_pos _ h]
 #align relation.cut_expand_fibration Relation.cutExpand_fibration
 -/
 
@@ -165,11 +165,11 @@ theorem Acc.cutExpand [IsIrrefl α r] {a : α} (hacc : Acc r a) : Acc (CutExpand
   induction' hacc with a h ih
   refine' Acc.intro _ fun s => _
   classical
-    rw [cut_expand_iff]
-    rintro ⟨t, a, hr, rfl | ⟨⟨⟩⟩, rfl⟩
-    refine' acc_of_singleton fun a' => _
-    rw [erase_singleton, zero_add]
-    exact ih a' ∘ hr a'
+  rw [cut_expand_iff]
+  rintro ⟨t, a, hr, rfl | ⟨⟨⟩⟩, rfl⟩
+  refine' acc_of_singleton fun a' => _
+  rw [erase_singleton, zero_add]
+  exact ih a' ∘ hr a'
 #align acc.cut_expand Acc.cutExpand
 -/
 
Diff
@@ -61,7 +61,7 @@ variable {α : Type _}
   The lemma `relation.cut_expand_iff` below converts between this convenient definition
   and the direct translation when `r` is irreflexive. -/
 def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
-  ∃ (t : Multiset α)(a : α), (∀ a' ∈ t, r a' a) ∧ s' + {a} = s + t
+  ∃ (t : Multiset α) (a : α), (∀ a' ∈ t, r a' a) ∧ s' + {a} = s + t
 #align relation.cut_expand Relation.CutExpand
 -/
 
@@ -72,10 +72,10 @@ theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
   fun s t ⟨u, a, hr, he⟩ => by
   classical
     refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
-    · apply_fun count b  at he; simp_rw [count_add] at he
+    · apply_fun count b  at he ; simp_rw [count_add] at he 
       convert he <;> convert(add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
-      exacts[h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
-    · apply_fun count a  at he; simp_rw [count_add, count_singleton_self] at he
+      exacts [h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
+    · apply_fun count a  at he ; simp_rw [count_add, count_singleton_self] at he 
       apply Nat.lt_of_succ_le; convert he.le; convert(add_zero _).symm
       exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
@@ -101,13 +101,13 @@ theorem cutExpand_add_left {t u} (s) : CutExpand r (s + t) (s + u) ↔ CutExpand
 #print Relation.cutExpand_iff /-
 theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
     CutExpand r s' s ↔
-      ∃ (t : Multiset α)(a : _), (∀ a' ∈ t, r a' a) ∧ a ∈ s ∧ s' = s.eraseₓ a + t :=
+      ∃ (t : Multiset α) (a : _), (∀ a' ∈ t, r a' a) ∧ a ∈ s ∧ s' = s.eraseₓ a + t :=
   by
   simp_rw [cut_expand, add_singleton_eq_iff]
   refine' exists₂_congr fun t a => ⟨_, _⟩
   · rintro ⟨ht, ha, rfl⟩
     obtain h | h := mem_add.1 ha
-    exacts[⟨ht, h, t.erase_add_left_pos h⟩, (@irrefl α r _ a (ht a h)).elim]
+    exacts [⟨ht, h, t.erase_add_left_pos h⟩, (@irrefl α r _ a (ht a h)).elim]
   · rintro ⟨ht, h, rfl⟩
     exact ⟨ht, mem_add.2 (Or.inl h), (t.erase_add_left_pos h).symm⟩
 #align relation.cut_expand_iff Relation.cutExpand_iff
@@ -127,10 +127,10 @@ theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by
 theorem cutExpand_fibration (r : α → α → Prop) :
     Fibration (GameAdd (CutExpand r) (CutExpand r)) (CutExpand r) fun s => s.1 + s.2 :=
   by
-  rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he⊢
+  rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he ⊢
   classical
     obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
-    rw [add_assoc, mem_add] at ha
+    rw [add_assoc, mem_add] at ha 
     obtain h | h := ha
     · refine' ⟨(s₁.erase a + t, s₂), game_add.fst ⟨t, a, hr, _⟩, _⟩
       · rw [add_comm, ← add_assoc, singleton_add, cons_erase h]
Diff
@@ -67,12 +67,6 @@ def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
 
 variable {r : α → α → Prop}
 
-/- warning: relation.cut_expand_le_inv_image_lex -> Relation.cutExpand_le_invImage_lex is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {r : α -> α -> Prop} [hi : IsIrrefl.{u1} α r], LE.le.{u1} ((Multiset.{u1} α) -> (Multiset.{u1} α) -> Prop) (Pi.hasLe.{u1, u1} (Multiset.{u1} α) (fun (s' : Multiset.{u1} α) => (Multiset.{u1} α) -> Prop) (fun (i : Multiset.{u1} α) => Pi.hasLe.{u1, 0} (Multiset.{u1} α) (fun (s : Multiset.{u1} α) => Prop) (fun (i : Multiset.{u1} α) => Prop.le))) (Relation.CutExpand.{u1} α r) (InvImage.{succ u1, succ u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Finsupp.Lex.{u1, 0} α Nat Nat.hasZero (Inf.inf.{u1} (α -> α -> Prop) (Pi.hasInf.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasInf.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => SemilatticeInf.toHasInf.{0} Prop (Lattice.toSemilatticeInf.{0} Prop (ConditionallyCompleteLattice.toLattice.{0} Prop (CompleteLattice.toConditionallyCompleteLattice.{0} Prop Prop.completeLattice)))))) (HasCompl.compl.{u1} (α -> α -> Prop) (Pi.hasCompl.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasCompl.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Prop.hasCompl))) r) (Ne.{succ u1} α)) (LT.lt.{0} Nat Nat.hasLt)) (coeFn.{succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (fun (_x : AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) => (Multiset.{u1} α) -> (Finsupp.{u1, 0} α Nat Nat.hasZero)) (AddEquiv.hasCoeToFun.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.toFinsupp.{u1} α)))
-but is expected to have type
-  forall {α : Type.{u1}} {r : α -> α -> Prop} [hi : IsIrrefl.{u1} α r], LE.le.{u1} ((Multiset.{u1} α) -> (Multiset.{u1} α) -> Prop) (Pi.hasLe.{u1, u1} (Multiset.{u1} α) (fun (s' : Multiset.{u1} α) => (Multiset.{u1} α) -> Prop) (fun (i : Multiset.{u1} α) => Pi.hasLe.{u1, 0} (Multiset.{u1} α) (fun (s : Multiset.{u1} α) => Prop) (fun (i : Multiset.{u1} α) => Prop.le))) (Relation.CutExpand.{u1} α r) (InvImage.{succ u1, succ u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Finsupp.Lex.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) (Inf.inf.{u1} (α -> α -> Prop) (Pi.instInfForAll.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.instInfForAll.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Lattice.toInf.{0} Prop (ConditionallyCompleteLattice.toLattice.{0} Prop (ConditionallyCompleteLinearOrder.toConditionallyCompleteLattice.{0} Prop (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} Prop (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} Prop Prop.completeLinearOrder))))))) (HasCompl.compl.{u1} (α -> α -> Prop) (Pi.hasCompl.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasCompl.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Prop.hasCompl))) r) (fun (x._@.Mathlib.Logic.Hydra._hyg.153 : α) (x._@.Mathlib.Logic.Hydra._hyg.155 : α) => Ne.{succ u1} α x._@.Mathlib.Logic.Hydra._hyg.153 x._@.Mathlib.Logic.Hydra._hyg.155)) (fun (x._@.Mathlib.Logic.Hydra._hyg.168 : Nat) (x._@.Mathlib.Logic.Hydra._hyg.170 : Nat) => LT.lt.{0} Nat instLTNat x._@.Mathlib.Logic.Hydra._hyg.168 x._@.Mathlib.Logic.Hydra._hyg.170)) (FunLike.coe.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (fun (_x : Multiset.{u1} α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Multiset.{u1} α) => Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) _x) (EmbeddingLike.toFunLike.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (EquivLike.toEmbeddingLike.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddEquivClass.toEquivLike.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddEquiv.instAddEquivClassAddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)))))) (Multiset.toFinsupp.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lexₓ'. -/
 theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp :=
   fun s t ⟨u, a, hr, he⟩ => by
Diff
@@ -78,15 +78,11 @@ theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
   fun s t ⟨u, a, hr, he⟩ => by
   classical
     refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
-    · apply_fun count b  at he
-      simp_rw [count_add] at he
+    · apply_fun count b  at he; simp_rw [count_add] at he
       convert he <;> convert(add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
       exacts[h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
-    · apply_fun count a  at he
-      simp_rw [count_add, count_singleton_self] at he
-      apply Nat.lt_of_succ_le
-      convert he.le
-      convert(add_zero _).symm
+    · apply_fun count a  at he; simp_rw [count_add, count_singleton_self] at he
+      apply Nat.lt_of_succ_le; convert he.le; convert(add_zero _).symm
       exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
 
@@ -159,8 +155,7 @@ theorem acc_of_singleton [IsIrrefl α r] {s : Multiset α} :
   by
   refine' Multiset.induction _ _ s
   · exact fun _ => Acc.intro 0 fun s h => (not_cut_expand_zero s h).elim
-  · intro a s ih hacc
-    rw [← s.singleton_add a]
+  · intro a s ih hacc; rw [← s.singleton_add a]
     exact
       ((hacc a <| s.mem_cons_self a).prod_gameAdd <|
             ih fun a ha => hacc a <| mem_cons_of_mem ha).of_fibration
Diff
@@ -71,7 +71,7 @@ variable {r : α → α → Prop}
 lean 3 declaration is
   forall {α : Type.{u1}} {r : α -> α -> Prop} [hi : IsIrrefl.{u1} α r], LE.le.{u1} ((Multiset.{u1} α) -> (Multiset.{u1} α) -> Prop) (Pi.hasLe.{u1, u1} (Multiset.{u1} α) (fun (s' : Multiset.{u1} α) => (Multiset.{u1} α) -> Prop) (fun (i : Multiset.{u1} α) => Pi.hasLe.{u1, 0} (Multiset.{u1} α) (fun (s : Multiset.{u1} α) => Prop) (fun (i : Multiset.{u1} α) => Prop.le))) (Relation.CutExpand.{u1} α r) (InvImage.{succ u1, succ u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Finsupp.Lex.{u1, 0} α Nat Nat.hasZero (Inf.inf.{u1} (α -> α -> Prop) (Pi.hasInf.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasInf.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => SemilatticeInf.toHasInf.{0} Prop (Lattice.toSemilatticeInf.{0} Prop (ConditionallyCompleteLattice.toLattice.{0} Prop (CompleteLattice.toConditionallyCompleteLattice.{0} Prop Prop.completeLattice)))))) (HasCompl.compl.{u1} (α -> α -> Prop) (Pi.hasCompl.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasCompl.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Prop.hasCompl))) r) (Ne.{succ u1} α)) (LT.lt.{0} Nat Nat.hasLt)) (coeFn.{succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (fun (_x : AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) => (Multiset.{u1} α) -> (Finsupp.{u1, 0} α Nat Nat.hasZero)) (AddEquiv.hasCoeToFun.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.toFinsupp.{u1} α)))
 but is expected to have type
-  forall {α : Type.{u1}} {r : α -> α -> Prop} [hi : IsIrrefl.{u1} α r], LE.le.{u1} ((Multiset.{u1} α) -> (Multiset.{u1} α) -> Prop) (Pi.hasLe.{u1, u1} (Multiset.{u1} α) (fun (s' : Multiset.{u1} α) => (Multiset.{u1} α) -> Prop) (fun (i : Multiset.{u1} α) => Pi.hasLe.{u1, 0} (Multiset.{u1} α) (fun (s : Multiset.{u1} α) => Prop) (fun (i : Multiset.{u1} α) => Prop.le))) (Relation.CutExpand.{u1} α r) (InvImage.{succ u1, succ u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Finsupp.Lex.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) (Inf.inf.{u1} (α -> α -> Prop) (Pi.instInfForAll.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.instInfForAll.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Lattice.toInf.{0} Prop (ConditionallyCompleteLattice.toLattice.{0} Prop (ConditionallyCompleteLinearOrder.toConditionallyCompleteLattice.{0} Prop (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} Prop (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} Prop Prop.completeLinearOrder))))))) (HasCompl.compl.{u1} (α -> α -> Prop) (Pi.hasCompl.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasCompl.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Prop.hasCompl))) r) (fun (x._@.Mathlib.Logic.Hydra._hyg.153 : α) (x._@.Mathlib.Logic.Hydra._hyg.155 : α) => Ne.{succ u1} α x._@.Mathlib.Logic.Hydra._hyg.153 x._@.Mathlib.Logic.Hydra._hyg.155)) (fun (x._@.Mathlib.Logic.Hydra._hyg.168 : Nat) (x._@.Mathlib.Logic.Hydra._hyg.170 : Nat) => LT.lt.{0} Nat instLTNat x._@.Mathlib.Logic.Hydra._hyg.168 x._@.Mathlib.Logic.Hydra._hyg.170)) (FunLike.coe.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (fun (_x : Multiset.{u1} α) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Multiset.{u1} α) => Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) _x) (AddHomClass.toFunLike.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddZeroClass.toAdd.{u1} (Multiset.{u1} α) (AddMonoid.toAddZeroClass.{u1} (Multiset.{u1} α) (AddRightCancelMonoid.toAddMonoid.{u1} (Multiset.{u1} α) (AddCancelMonoid.toAddRightCancelMonoid.{u1} (Multiset.{u1} α) (AddCancelCommMonoid.toAddCancelMonoid.{u1} (Multiset.{u1} α) (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} (Multiset.{u1} α) (Multiset.instOrderedCancelAddCommMonoidMultiset.{u1} α))))))) (AddZeroClass.toAdd.{u1} (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Finsupp.addZeroClass.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (AddMonoidHomClass.toAddHomClass.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddMonoid.toAddZeroClass.{u1} (Multiset.{u1} α) (AddRightCancelMonoid.toAddMonoid.{u1} (Multiset.{u1} α) (AddCancelMonoid.toAddRightCancelMonoid.{u1} (Multiset.{u1} α) (AddCancelCommMonoid.toAddCancelMonoid.{u1} (Multiset.{u1} α) (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} (Multiset.{u1} α) (Multiset.instOrderedCancelAddCommMonoidMultiset.{u1} α)))))) (Finsupp.addZeroClass.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddEquivClass.instAddMonoidHomClass.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddMonoid.toAddZeroClass.{u1} (Multiset.{u1} α) (AddRightCancelMonoid.toAddMonoid.{u1} (Multiset.{u1} α) (AddCancelMonoid.toAddRightCancelMonoid.{u1} (Multiset.{u1} α) (AddCancelCommMonoid.toAddCancelMonoid.{u1} (Multiset.{u1} α) (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} (Multiset.{u1} α) (Multiset.instOrderedCancelAddCommMonoidMultiset.{u1} α)))))) (Finsupp.addZeroClass.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddEquiv.instAddEquivClassAddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)))))) (Multiset.toFinsupp.{u1} α)))
+  forall {α : Type.{u1}} {r : α -> α -> Prop} [hi : IsIrrefl.{u1} α r], LE.le.{u1} ((Multiset.{u1} α) -> (Multiset.{u1} α) -> Prop) (Pi.hasLe.{u1, u1} (Multiset.{u1} α) (fun (s' : Multiset.{u1} α) => (Multiset.{u1} α) -> Prop) (fun (i : Multiset.{u1} α) => Pi.hasLe.{u1, 0} (Multiset.{u1} α) (fun (s : Multiset.{u1} α) => Prop) (fun (i : Multiset.{u1} α) => Prop.le))) (Relation.CutExpand.{u1} α r) (InvImage.{succ u1, succ u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Finsupp.Lex.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) (Inf.inf.{u1} (α -> α -> Prop) (Pi.instInfForAll.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.instInfForAll.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Lattice.toInf.{0} Prop (ConditionallyCompleteLattice.toLattice.{0} Prop (ConditionallyCompleteLinearOrder.toConditionallyCompleteLattice.{0} Prop (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} Prop (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} Prop Prop.completeLinearOrder))))))) (HasCompl.compl.{u1} (α -> α -> Prop) (Pi.hasCompl.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasCompl.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Prop.hasCompl))) r) (fun (x._@.Mathlib.Logic.Hydra._hyg.153 : α) (x._@.Mathlib.Logic.Hydra._hyg.155 : α) => Ne.{succ u1} α x._@.Mathlib.Logic.Hydra._hyg.153 x._@.Mathlib.Logic.Hydra._hyg.155)) (fun (x._@.Mathlib.Logic.Hydra._hyg.168 : Nat) (x._@.Mathlib.Logic.Hydra._hyg.170 : Nat) => LT.lt.{0} Nat instLTNat x._@.Mathlib.Logic.Hydra._hyg.168 x._@.Mathlib.Logic.Hydra._hyg.170)) (FunLike.coe.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (fun (_x : Multiset.{u1} α) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Multiset.{u1} α) => Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) _x) (EmbeddingLike.toFunLike.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (EquivLike.toEmbeddingLike.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddEquivClass.toEquivLike.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddEquiv.instAddEquivClassAddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)))))) (Multiset.toFinsupp.{u1} α)))
 Case conversion may be inaccurate. Consider using '#align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lexₓ'. -/
 theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp :=
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Junyan Xu
 
 ! This file was ported from Lean 3 source module logic.hydra
-! leanprover-community/mathlib commit e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa
+! leanprover-community/mathlib commit d64d67d000b974f0d86a2be7918cf800be6271c8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.Order.GameAdd
 /-!
 # Termination of a hydra game
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file deals with the following version of the hydra game: each head of the hydra is
 labelled by an element in a type `α`, and when you cut off one head with label `a`, it
 grows back an arbitrary but finite number of heads, all labelled by elements smaller than
Diff
@@ -42,6 +42,7 @@ open Multiset Prod
 
 variable {α : Type _}
 
+#print Relation.CutExpand /-
 /-- The relation that specifies valid moves in our hydra game. `cut_expand r s' s`
   means that `s'` is obtained by removing one head `a ∈ s` and adding back an arbitrary
   multiset `t` of heads such that all `a' ∈ t` satisfy `r a' a`.
@@ -59,9 +60,16 @@ variable {α : Type _}
 def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
   ∃ (t : Multiset α)(a : α), (∀ a' ∈ t, r a' a) ∧ s' + {a} = s + t
 #align relation.cut_expand Relation.CutExpand
+-/
 
 variable {r : α → α → Prop}
 
+/- warning: relation.cut_expand_le_inv_image_lex -> Relation.cutExpand_le_invImage_lex is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {r : α -> α -> Prop} [hi : IsIrrefl.{u1} α r], LE.le.{u1} ((Multiset.{u1} α) -> (Multiset.{u1} α) -> Prop) (Pi.hasLe.{u1, u1} (Multiset.{u1} α) (fun (s' : Multiset.{u1} α) => (Multiset.{u1} α) -> Prop) (fun (i : Multiset.{u1} α) => Pi.hasLe.{u1, 0} (Multiset.{u1} α) (fun (s : Multiset.{u1} α) => Prop) (fun (i : Multiset.{u1} α) => Prop.le))) (Relation.CutExpand.{u1} α r) (InvImage.{succ u1, succ u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Finsupp.Lex.{u1, 0} α Nat Nat.hasZero (Inf.inf.{u1} (α -> α -> Prop) (Pi.hasInf.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasInf.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => SemilatticeInf.toHasInf.{0} Prop (Lattice.toSemilatticeInf.{0} Prop (ConditionallyCompleteLattice.toLattice.{0} Prop (CompleteLattice.toConditionallyCompleteLattice.{0} Prop Prop.completeLattice)))))) (HasCompl.compl.{u1} (α -> α -> Prop) (Pi.hasCompl.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasCompl.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Prop.hasCompl))) r) (Ne.{succ u1} α)) (LT.lt.{0} Nat Nat.hasLt)) (coeFn.{succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (fun (_x : AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) => (Multiset.{u1} α) -> (Finsupp.{u1, 0} α Nat Nat.hasZero)) (AddEquiv.hasCoeToFun.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat Nat.hasZero) (Multiset.hasAdd.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.toFinsupp.{u1} α)))
+but is expected to have type
+  forall {α : Type.{u1}} {r : α -> α -> Prop} [hi : IsIrrefl.{u1} α r], LE.le.{u1} ((Multiset.{u1} α) -> (Multiset.{u1} α) -> Prop) (Pi.hasLe.{u1, u1} (Multiset.{u1} α) (fun (s' : Multiset.{u1} α) => (Multiset.{u1} α) -> Prop) (fun (i : Multiset.{u1} α) => Pi.hasLe.{u1, 0} (Multiset.{u1} α) (fun (s : Multiset.{u1} α) => Prop) (fun (i : Multiset.{u1} α) => Prop.le))) (Relation.CutExpand.{u1} α r) (InvImage.{succ u1, succ u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Finsupp.Lex.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) (Inf.inf.{u1} (α -> α -> Prop) (Pi.instInfForAll.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.instInfForAll.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Lattice.toInf.{0} Prop (ConditionallyCompleteLattice.toLattice.{0} Prop (ConditionallyCompleteLinearOrder.toConditionallyCompleteLattice.{0} Prop (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} Prop (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} Prop Prop.completeLinearOrder))))))) (HasCompl.compl.{u1} (α -> α -> Prop) (Pi.hasCompl.{u1, u1} α (fun (ᾰ : α) => α -> Prop) (fun (i : α) => Pi.hasCompl.{u1, 0} α (fun (ᾰ : α) => Prop) (fun (i : α) => Prop.hasCompl))) r) (fun (x._@.Mathlib.Logic.Hydra._hyg.153 : α) (x._@.Mathlib.Logic.Hydra._hyg.155 : α) => Ne.{succ u1} α x._@.Mathlib.Logic.Hydra._hyg.153 x._@.Mathlib.Logic.Hydra._hyg.155)) (fun (x._@.Mathlib.Logic.Hydra._hyg.168 : Nat) (x._@.Mathlib.Logic.Hydra._hyg.170 : Nat) => LT.lt.{0} Nat instLTNat x._@.Mathlib.Logic.Hydra._hyg.168 x._@.Mathlib.Logic.Hydra._hyg.170)) (FunLike.coe.{succ u1, succ u1, succ u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (fun (_x : Multiset.{u1} α) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.403 : Multiset.{u1} α) => Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) _x) (AddHomClass.toFunLike.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddZeroClass.toAdd.{u1} (Multiset.{u1} α) (AddMonoid.toAddZeroClass.{u1} (Multiset.{u1} α) (AddRightCancelMonoid.toAddMonoid.{u1} (Multiset.{u1} α) (AddCancelMonoid.toAddRightCancelMonoid.{u1} (Multiset.{u1} α) (AddCancelCommMonoid.toAddCancelMonoid.{u1} (Multiset.{u1} α) (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} (Multiset.{u1} α) (Multiset.instOrderedCancelAddCommMonoidMultiset.{u1} α))))))) (AddZeroClass.toAdd.{u1} (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Finsupp.addZeroClass.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (AddMonoidHomClass.toAddHomClass.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddMonoid.toAddZeroClass.{u1} (Multiset.{u1} α) (AddRightCancelMonoid.toAddMonoid.{u1} (Multiset.{u1} α) (AddCancelMonoid.toAddRightCancelMonoid.{u1} (Multiset.{u1} α) (AddCancelCommMonoid.toAddCancelMonoid.{u1} (Multiset.{u1} α) (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} (Multiset.{u1} α) (Multiset.instOrderedCancelAddCommMonoidMultiset.{u1} α)))))) (Finsupp.addZeroClass.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddEquivClass.instAddMonoidHomClass.{u1, u1, u1} (AddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid))) (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (AddMonoid.toAddZeroClass.{u1} (Multiset.{u1} α) (AddRightCancelMonoid.toAddMonoid.{u1} (Multiset.{u1} α) (AddCancelMonoid.toAddRightCancelMonoid.{u1} (Multiset.{u1} α) (AddCancelCommMonoid.toAddCancelMonoid.{u1} (Multiset.{u1} α) (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} (Multiset.{u1} α) (Multiset.instOrderedCancelAddCommMonoidMultiset.{u1} α)))))) (Finsupp.addZeroClass.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)) (AddEquiv.instAddEquivClassAddEquiv.{u1, u1} (Multiset.{u1} α) (Finsupp.{u1, 0} α Nat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Multiset.instAddMultiset.{u1} α) (Finsupp.add.{u1, 0} α Nat (AddMonoid.toAddZeroClass.{0} Nat Nat.addMonoid)))))) (Multiset.toFinsupp.{u1} α)))
+Case conversion may be inaccurate. Consider using '#align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lexₓ'. -/
 theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp :=
   fun s t ⟨u, a, hr, he⟩ => by
@@ -79,18 +87,25 @@ theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
       exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
 
+#print Relation.cutExpand_singleton /-
 theorem cutExpand_singleton {s x} (h : ∀ x' ∈ s, r x' x) : CutExpand r s {x} :=
   ⟨s, x, h, add_comm s _⟩
 #align relation.cut_expand_singleton Relation.cutExpand_singleton
+-/
 
+#print Relation.cutExpand_singleton_singleton /-
 theorem cutExpand_singleton_singleton {x' x} (h : r x' x) : CutExpand r {x'} {x} :=
   cutExpand_singleton fun a h => by rwa [mem_singleton.1 h]
 #align relation.cut_expand_singleton_singleton Relation.cutExpand_singleton_singleton
+-/
 
+#print Relation.cutExpand_add_left /-
 theorem cutExpand_add_left {t u} (s) : CutExpand r (s + t) (s + u) ↔ CutExpand r t u :=
   exists₂_congr fun _ _ => and_congr Iff.rfl <| by rw [add_assoc, add_assoc, add_left_cancel_iff]
 #align relation.cut_expand_add_left Relation.cutExpand_add_left
+-/
 
+#print Relation.cutExpand_iff /-
 theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
     CutExpand r s' s ↔
       ∃ (t : Multiset α)(a : _), (∀ a' ∈ t, r a' a) ∧ a ∈ s ∧ s' = s.eraseₓ a + t :=
@@ -103,13 +118,17 @@ theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
   · rintro ⟨ht, h, rfl⟩
     exact ⟨ht, mem_add.2 (Or.inl h), (t.erase_add_left_pos h).symm⟩
 #align relation.cut_expand_iff Relation.cutExpand_iff
+-/
 
+#print Relation.not_cutExpand_zero /-
 theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by
   classical
     rw [cut_expand_iff]
     rintro ⟨_, _, _, ⟨⟩, _⟩
 #align relation.not_cut_expand_zero Relation.not_cutExpand_zero
+-/
 
+#print Relation.cutExpand_fibration /-
 /-- For any relation `r` on `α`, multiset addition `multiset α × multiset α → multiset α` is a
   fibration between the game sum of `cut_expand r` with itself and `cut_expand r` itself. -/
 theorem cutExpand_fibration (r : α → α → Prop) :
@@ -127,7 +146,9 @@ theorem cutExpand_fibration (r : α → α → Prop) :
       · rw [add_comm, singleton_add, cons_erase h]
       · rw [add_assoc, erase_add_right_pos _ h]
 #align relation.cut_expand_fibration Relation.cutExpand_fibration
+-/
 
+#print Relation.acc_of_singleton /-
 /-- A multiset is accessible under `cut_expand` if all its singleton subsets are,
   assuming `r` is irreflexive. -/
 theorem acc_of_singleton [IsIrrefl α r] {s : Multiset α} :
@@ -142,7 +163,9 @@ theorem acc_of_singleton [IsIrrefl α r] {s : Multiset α} :
             ih fun a ha => hacc a <| mem_cons_of_mem ha).of_fibration
         _ (cut_expand_fibration r)
 #align relation.acc_of_singleton Relation.acc_of_singleton
+-/
 
+#print Acc.cutExpand /-
 /-- A singleton `{a}` is accessible under `cut_expand r` if `a` is accessible under `r`,
   assuming `r` is irreflexive. -/
 theorem Acc.cutExpand [IsIrrefl α r] {a : α} (hacc : Acc r a) : Acc (CutExpand r) {a} :=
@@ -156,12 +179,15 @@ theorem Acc.cutExpand [IsIrrefl α r] {a : α} (hacc : Acc r a) : Acc (CutExpand
     rw [erase_singleton, zero_add]
     exact ih a' ∘ hr a'
 #align acc.cut_expand Acc.cutExpand
+-/
 
+#print WellFounded.cutExpand /-
 /-- `cut_expand r` is well-founded when `r` is. -/
 theorem WellFounded.cutExpand (hr : WellFounded r) : WellFounded (CutExpand r) :=
   ⟨letI h := hr.is_irrefl
     fun s => acc_of_singleton fun a _ => (hr.apply a).CutExpand⟩
 #align well_founded.cut_expand WellFounded.cutExpand
+-/
 
 end Relation
 
Diff
@@ -69,13 +69,13 @@ theorem cutExpand_le_invImage_lex [hi : IsIrrefl α r] :
     refine' ⟨a, fun b h => _, _⟩ <;> simp_rw [to_finsupp_apply]
     · apply_fun count b  at he
       simp_rw [count_add] at he
-      convert he <;> convert (add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
+      convert he <;> convert(add_zero _).symm <;> rw [count_eq_zero] <;> intro hb
       exacts[h.2 (mem_singleton.1 hb), h.1 (hr b hb)]
     · apply_fun count a  at he
       simp_rw [count_add, count_singleton_self] at he
       apply Nat.lt_of_succ_le
       convert he.le
-      convert (add_zero _).symm
+      convert(add_zero _).symm
       exact count_eq_zero.2 fun ha => hi.irrefl a <| hr a ha
 #align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
 

Changes in mathlib4

mathlib3
mathlib4
style: use cases x with | ... instead of cases x; case => ... (#9321)

This converts usages of the pattern

cases h
case inl h' => ...
case inr h' => ...

which derive from mathported code, to the "structured cases" syntax:

cases h with
| inl h' => ...
| inr h' => ...

The case where the subgoals are handled with · instead of case is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases', induction, induction', and rcases. Furthermore, there is a similar transformation for by_cases:

by_cases h : cond
case pos => ...
case neg => ...

is replaced by:

if h : cond then
  ...
else
  ...

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

Diff
@@ -125,9 +125,9 @@ theorem cutExpand_fibration (r : α → α → Prop) :
   assuming `r` is irreflexive. -/
 theorem acc_of_singleton [IsIrrefl α r] {s : Multiset α} (hs : ∀ a ∈ s, Acc (CutExpand r) {a}) :
     Acc (CutExpand r) s := by
-  induction s using Multiset.induction
-  case empty => exact Acc.intro 0 fun s h ↦ (not_cutExpand_zero s h).elim
-  case cons a s ihs =>
+  induction s using Multiset.induction with
+  | empty => exact Acc.intro 0 fun s h ↦ (not_cutExpand_zero s h).elim
+  | @cons a s ihs =>
     rw [← s.singleton_add a]
     rw [forall_mem_cons] at hs
     exact (hs.1.prod_gameAdd <| ihs fun a ha ↦ hs.2 a ha).of_fibration _ (cutExpand_fibration r)
chore: clear some porting notes on rfl (#8063)

We remove some porting notes for rfls that by now work again.

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

Diff
@@ -110,10 +110,7 @@ theorem cutExpand_fibration (r : α → α → Prop) :
     Fibration (GameAdd (CutExpand r) (CutExpand r)) (CutExpand r) fun s ↦ s.1 + s.2 := by
   rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he ⊢
   classical
-  -- Porting note: Originally `obtain ⟨ha, rfl⟩`
-  -- This is https://github.com/leanprover/std4/issues/62
-  obtain ⟨ha, hb⟩ := add_singleton_eq_iff.1 he
-  rw [hb]
+  obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
   rw [add_assoc, mem_add] at ha
   obtain h | h := ha
   · refine' ⟨(s₁.erase a + t, s₂), GameAdd.fst ⟨t, a, hr, _⟩, _⟩
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
@@ -37,7 +37,7 @@ namespace Relation
 
 open Multiset Prod
 
-variable {α : Type _}
+variable {α : Type*}
 
 /-- The relation that specifies valid moves in our hydra game. `CutExpand r s' s`
   means that `s'` is obtained by removing one head `a ∈ s` and adding back an arbitrary
feat(Data/Finsupp): make toMultiset and antidiagonal computable (#6331)

In Lean 3, the computability of Finsupp.toMultiset was poisoned by the AddMonoid (α →₀ ℕ) instance, even though this was not used in computation. This is no longer the case in Lean 4, so we can make this computable by adding a DecidableEq α argument.

We loosely follow the pattern used with DFinsupp, where we split the declaration in two, as only one direction needs DecidableEq α. As a result, Finsupp.toMultiset is now only an AddMonoidHom, though Multiset.toFinset remains an equiv.

We're missing some of the formatting infrastructure for this to be pretty, but this now works:

#eval ((Finsupp.mk Finset.univ ![1, 2, 3] sorry).antidiagonal).image
  fun x : _ × _ => (x.1.toFun, x.2.toFun)
Diff
@@ -59,7 +59,7 @@ def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
 
 variable {r : α → α → Prop}
 
-theorem cutExpand_le_invImage_lex [IsIrrefl α r] :
+theorem cutExpand_le_invImage_lex [DecidableEq α] [IsIrrefl α r] :
     CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp := by
   rintro s t ⟨u, a, hr, he⟩
   replace hr := fun a' ↦ mt (hr a')
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) 2022 Junyan Xu. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Junyan Xu
-
-! This file was ported from Lean 3 source module logic.hydra
-! leanprover-community/mathlib commit 48085f140e684306f9e7da907cd5932056d1aded
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Finsupp.Lex
 import Mathlib.Data.Finsupp.Multiset
 import Mathlib.Order.GameAdd
 
+#align_import logic.hydra from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
+
 /-!
 # Termination of a hydra game
 
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -68,10 +68,10 @@ theorem cutExpand_le_invImage_lex [IsIrrefl α r] :
   replace hr := fun a' ↦ mt (hr a')
   classical
   refine ⟨a, fun b h ↦ ?_, ?_⟩ <;> simp_rw [toFinsupp_apply]
-  · apply_fun count b  at he
+  · apply_fun count b at he
     simpa only [count_add, count_singleton, if_neg h.2, add_zero, count_eq_zero.2 (hr b h.1)]
       using he
-  · apply_fun count a  at he
+  · apply_fun count a at he
     simp only [count_add, count_singleton_self, count_eq_zero.2 (hr _ (irrefl_of r a)),
       add_zero] at he
     exact he ▸ Nat.lt_succ_self _
feat: port Logic.Hydra (#2290)

Co-authored-by: Jason Yuen <jason_yuen2007@hotmail.com> Co-authored-by: int-y1 <jason_yuen2007@hotmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: ChrisHughes24 <chrishughes24@gmail.com>

Dependencies 8 + 327

328 files ported (97.6%)
134859 lines ported (97.7%)
Show graph

The unported dependencies are