data.multiset.functorMathlib.Data.Multiset.Functor

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)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2018 Simon Hudon. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Johannes Hölzl, Simon Hudon, Kenny Lau
 -/
-import Mathbin.Data.Multiset.Bind
-import Mathbin.Control.Traversable.Lemmas
-import Mathbin.Control.Traversable.Instances
+import Data.Multiset.Bind
+import Control.Traversable.Lemmas
+import Control.Traversable.Instances
 
 #align_import data.multiset.functor from "leanprover-community/mathlib"@"e46da4e335b8671848ac711ccb34b42538c0d800"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2018 Simon Hudon. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Johannes Hölzl, Simon Hudon, Kenny Lau
-
-! This file was ported from Lean 3 source module data.multiset.functor
-! leanprover-community/mathlib commit e46da4e335b8671848ac711ccb34b42538c0d800
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Multiset.Bind
 import Mathbin.Control.Traversable.Lemmas
 import Mathbin.Control.Traversable.Instances
 
+#align_import data.multiset.functor from "leanprover-community/mathlib"@"e46da4e335b8671848ac711ccb34b42538c0d800"
+
 /-!
 # Functoriality of `multiset`.
 
Diff
@@ -37,7 +37,7 @@ theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.ma
 
 instance : LawfulFunctor Multiset := by refine' { .. } <;> intros <;> simp
 
-open IsLawfulTraversable CommApplicative
+open LawfulTraversable CommApplicative
 
 variable {F : Type u → Type u} [Applicative F] [CommApplicative F]
 
@@ -97,7 +97,7 @@ instance : LawfulMonad Multiset
 
 open Functor
 
-open Traversable IsLawfulTraversable
+open Traversable LawfulTraversable
 
 #print Multiset.lift_coe /-
 @[simp]
@@ -153,8 +153,7 @@ theorem traverse_map {G : Type _ → Type _} [Applicative G] [CommApplicative G]
 theorem naturality {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G]
     [CommApplicative H] (eta : ApplicativeTransformation G H) {α β : Type _} (f : α → G β)
     (x : Multiset α) : eta (traverse f x) = traverse (@eta _ ∘ f) x :=
-  Quotient.inductionOn x
-    (by intro <;> simp [traverse, IsLawfulTraversable.naturality, functor_norm])
+  Quotient.inductionOn x (by intro <;> simp [traverse, LawfulTraversable.naturality, functor_norm])
 #align multiset.naturality Multiset.naturality
 -/
 
Diff
@@ -91,7 +91,7 @@ theorem bind_def {α β} : (· >>= ·) = @bind α β :=
 
 instance : LawfulMonad Multiset
     where
-  bind_pure_comp_eq_map α β f s := Multiset.induction_on s rfl fun a s ih => by simp
+  bind_pure_comp α β f s := Multiset.induction_on s rfl fun a s ih => by simp
   pure_bind α β x f := by simp [pure]
   bind_assoc := @bind_assoc
 
Diff
@@ -75,15 +75,19 @@ instance : Monad Multiset :=
     pure := fun α x => {x}
     bind := @bind }
 
+#print Multiset.pure_def /-
 @[simp]
 theorem pure_def {α} : (pure : α → Multiset α) = singleton :=
   rfl
 #align multiset.pure_def Multiset.pure_def
+-/
 
+#print Multiset.bind_def /-
 @[simp]
 theorem bind_def {α β} : (· >>= ·) = @bind α β :=
   rfl
 #align multiset.bind_def Multiset.bind_def
+-/
 
 instance : LawfulMonad Multiset
     where
@@ -95,22 +99,29 @@ open Functor
 
 open Traversable IsLawfulTraversable
 
+#print Multiset.lift_coe /-
 @[simp]
 theorem lift_coe {α β : Type _} (x : List α) (f : List α → β)
     (h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x :=
   Quotient.lift_mk _ _ _
 #align multiset.lift_coe Multiset.lift_coe
+-/
 
+#print Multiset.map_comp_coe /-
 @[simp]
 theorem map_comp_coe {α β} (h : α → β) :
     Functor.map h ∘ coe = (coe ∘ Functor.map h : List α → Multiset β) := by
   funext <;> simp [Functor.map]
 #align multiset.map_comp_coe Multiset.map_comp_coe
+-/
 
+#print Multiset.id_traverse /-
 theorem id_traverse {α : Type _} (x : Multiset α) : traverse id.mk x = x :=
   Quotient.inductionOn x (by intro; simp [traverse]; rfl)
 #align multiset.id_traverse Multiset.id_traverse
+-/
 
+#print Multiset.comp_traverse /-
 theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G]
     [CommApplicative H] {α β γ : Type _} (g : α → G β) (h : β → H γ) (x : Multiset α) :
     traverse (Comp.mk ∘ Functor.map h ∘ g) x = Comp.mk (Functor.map (traverse h) (traverse g x)) :=
@@ -119,6 +130,7 @@ theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H]
       intro <;> simp [traverse, comp_traverse, functor_norm] <;>
         simp [(· <$> ·), (· ∘ ·), functor_norm])
 #align multiset.comp_traverse Multiset.comp_traverse
+-/
 
 #print Multiset.map_traverse /-
 theorem map_traverse {G : Type _ → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
Diff
@@ -64,7 +64,7 @@ def traverse : Multiset α' → F (Multiset β') :=
             (fun a b l => ↑(a :: b :: l)) <$> f p_x <*> f p_y :=
           by
           rw [CommApplicative.commutative_map]
-          congr ; funext a b l; simpa [flip] using perm.swap b a l
+          congr; funext a b l; simpa [flip] using perm.swap b a l
         simp [(· ∘ ·), this, functor_norm]
       case trans => simp [*])
 #align multiset.traverse Multiset.traverse
@@ -108,7 +108,7 @@ theorem map_comp_coe {α β} (h : α → β) :
 #align multiset.map_comp_coe Multiset.map_comp_coe
 
 theorem id_traverse {α : Type _} (x : Multiset α) : traverse id.mk x = x :=
-  Quotient.inductionOn x (by intro ; simp [traverse]; rfl)
+  Quotient.inductionOn x (by intro; simp [traverse]; rfl)
 #align multiset.id_traverse Multiset.id_traverse
 
 theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G]
@@ -133,7 +133,7 @@ theorem map_traverse {G : Type _ → Type _} [Applicative G] [CommApplicative G]
 theorem traverse_map {G : Type _ → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
     (g : α → β) (h : β → G γ) (x : Multiset α) : traverse h (map g x) = traverse (h ∘ g) x :=
   Quotient.inductionOn x
-    (by intro <;> simp [traverse] <;> rw [← Traversable.traverse_map h g] <;> [rfl;infer_instance])
+    (by intro <;> simp [traverse] <;> rw [← Traversable.traverse_map h g] <;> [rfl; infer_instance])
 #align multiset.traverse_map Multiset.traverse_map
 -/
 
Diff
@@ -75,23 +75,11 @@ instance : Monad Multiset :=
     pure := fun α x => {x}
     bind := @bind }
 
-/- warning: multiset.pure_def -> Multiset.pure_def is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}}, Eq.{succ u1} (α -> (Multiset.{u1} α)) (Pure.pure.{u1, u1} (fun {α : Type.{u1}} => Multiset.{u1} α) (Applicative.toHasPure.{u1, u1} (fun {α : Type.{u1}} => Multiset.{u1} α) (Monad.toApplicative.{u1, u1} (fun {α : Type.{u1}} => Multiset.{u1} α) Multiset.monad.{u1})) α) (Singleton.singleton.{u1, u1} α (Multiset.{u1} α) (Multiset.hasSingleton.{u1} α))
-but is expected to have type
-  forall {α : Type.{u1}}, Eq.{succ u1} (α -> (Multiset.{u1} α)) (Pure.pure.{u1, u1} Multiset.{u1} (Applicative.toPure.{u1, u1} Multiset.{u1} (Monad.toApplicative.{u1, u1} Multiset.{u1} Multiset.instMonadMultiset.{u1})) α) (Singleton.singleton.{u1, u1} α (Multiset.{u1} α) (Multiset.instSingletonMultiset.{u1} α))
-Case conversion may be inaccurate. Consider using '#align multiset.pure_def Multiset.pure_defₓ'. -/
 @[simp]
 theorem pure_def {α} : (pure : α → Multiset α) = singleton :=
   rfl
 #align multiset.pure_def Multiset.pure_def
 
-/- warning: multiset.bind_def -> Multiset.bind_def is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Multiset.{u1} α) -> (α -> (Multiset.{u1} β)) -> (Multiset.{u1} β)) (Bind.bind.{u1, u1} Multiset.{u1} (Monad.toHasBind.{u1, u1} Multiset.{u1} Multiset.monad.{u1}) α β) (Multiset.bind.{u1, u1} α β)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Multiset.{u1} α) -> (α -> (Multiset.{u1} β)) -> (Multiset.{u1} β)) (fun (x._@.Mathlib.Data.Multiset.Functor._hyg.720 : Multiset.{u1} α) (x._@.Mathlib.Data.Multiset.Functor._hyg.722 : α -> (Multiset.{u1} β)) => Bind.bind.{u1, u1} Multiset.{u1} (Monad.toBind.{u1, u1} Multiset.{u1} Multiset.instMonadMultiset.{u1}) α β x._@.Mathlib.Data.Multiset.Functor._hyg.720 x._@.Mathlib.Data.Multiset.Functor._hyg.722) (Multiset.bind.{u1, u1} α β)
-Case conversion may be inaccurate. Consider using '#align multiset.bind_def Multiset.bind_defₓ'. -/
 @[simp]
 theorem bind_def {α β} : (· >>= ·) = @bind α β :=
   rfl
@@ -107,46 +95,22 @@ open Functor
 
 open Traversable IsLawfulTraversable
 
-/- warning: multiset.lift_coe -> Multiset.lift_coe is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (x : List.{u1} α) (f : (List.{u1} α) -> β) (h : forall (a : List.{u1} α) (b : List.{u1} α), (HasEquivₓ.Equiv.{succ u1} (List.{u1} α) (setoidHasEquiv.{succ u1} (List.{u1} α) (List.isSetoid.{u1} α)) a b) -> (Eq.{succ u2} β (f a) (f b))), Eq.{succ u2} β (Quotient.lift.{succ u1, succ u2} (List.{u1} α) β (List.isSetoid.{u1} α) f h ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) (List.{u1} α) (Multiset.{u1} α) (HasLiftT.mk.{succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (coeBase.{succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (Multiset.hasCoe.{u1} α)))) x)) (f x)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (x : List.{u2} α) (f : (List.{u2} α) -> β) (h : forall (a : List.{u2} α) (b : List.{u2} α), (HasEquiv.Equiv.{succ u2, 0} (List.{u2} α) (instHasEquiv.{succ u2} (List.{u2} α) (List.isSetoid.{u2} α)) a b) -> (Eq.{succ u1} β (f a) (f b))), Eq.{succ u1} β (Quotient.lift.{succ u2, succ u1} (List.{u2} α) β (List.isSetoid.{u2} α) f h (Multiset.ofList.{u2} α x)) (f x)
-Case conversion may be inaccurate. Consider using '#align multiset.lift_coe Multiset.lift_coeₓ'. -/
 @[simp]
 theorem lift_coe {α β : Type _} (x : List α) (f : List α → β)
     (h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x :=
   Quotient.lift_mk _ _ _
 #align multiset.lift_coe Multiset.lift_coe
 
-/- warning: multiset.map_comp_coe -> Multiset.map_comp_coe is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u1}} (h : α -> β), Eq.{succ u1} ((List.{u1} α) -> (Multiset.{u1} β)) (Function.comp.{succ u1, succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (Multiset.{u1} β) (Functor.map.{u1, u1} (fun {β : Type.{u1}} => Multiset.{u1} β) Multiset.functor.{u1} α β h) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) (List.{u1} α) (Multiset.{u1} α) (HasLiftT.mk.{succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (coeBase.{succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (Multiset.hasCoe.{u1} α)))))) (Function.comp.{succ u1, succ u1, succ u1} (List.{u1} α) (List.{u1} β) (Multiset.{u1} β) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) (List.{u1} β) (Multiset.{u1} β) (HasLiftT.mk.{succ u1, succ u1} (List.{u1} β) (Multiset.{u1} β) (CoeTCₓ.coe.{succ u1, succ u1} (List.{u1} β) (Multiset.{u1} β) (coeBase.{succ u1, succ u1} (List.{u1} β) (Multiset.{u1} β) (Multiset.hasCoe.{u1} β))))) (Functor.map.{u1, u1} List.{u1} (Traversable.toFunctor.{u1} List.{u1} List.traversable.{u1}) α β h))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u1}} (h : α -> β), Eq.{succ u1} ((List.{u1} α) -> (Multiset.{u1} β)) (Function.comp.{succ u1, succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (Multiset.{u1} β) (Functor.map.{u1, u1} Multiset.{u1} Multiset.functor.{u1} α β h) (Coe.coe.{succ u1, succ u1} (List.{u1} α) (Multiset.{u1} α) (Multiset.instCoeListMultiset.{u1} α))) (Function.comp.{succ u1, succ u1, succ u1} (List.{u1} α) (List.{u1} β) (Multiset.{u1} β) (Coe.coe.{succ u1, succ u1} (List.{u1} β) (Multiset.{u1} β) (Multiset.instCoeListMultiset.{u1} β)) (Functor.map.{u1, u1} List.{u1} List.instFunctorList.{u1} α β h))
-Case conversion may be inaccurate. Consider using '#align multiset.map_comp_coe Multiset.map_comp_coeₓ'. -/
 @[simp]
 theorem map_comp_coe {α β} (h : α → β) :
     Functor.map h ∘ coe = (coe ∘ Functor.map h : List α → Multiset β) := by
   funext <;> simp [Functor.map]
 #align multiset.map_comp_coe Multiset.map_comp_coe
 
-/- warning: multiset.id_traverse -> Multiset.id_traverse is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} (x : Multiset.{u1} α), Eq.{succ u1} (id.{succ (succ u1)} Type.{u1} (Multiset.{u1} α)) (Multiset.traverse.{u1} (id.{succ (succ u1)} Type.{u1}) (Monad.toApplicative.{u1, u1} (id.{succ (succ u1)} Type.{u1}) id.monad.{u1}) id.commApplicative.{u1} α α (id.mk.{succ u1} α) x) x
-but is expected to have type
-  forall {α : Type.{u1}} (x : Multiset.{u1} α), Eq.{succ u1} (Id.{u1} (Multiset.{u1} α)) (Multiset.traverse.{u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) instCommApplicativeIdToApplicativeInstMonadId.{u1} α α (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) α) x) x
-Case conversion may be inaccurate. Consider using '#align multiset.id_traverse Multiset.id_traverseₓ'. -/
 theorem id_traverse {α : Type _} (x : Multiset α) : traverse id.mk x = x :=
   Quotient.inductionOn x (by intro ; simp [traverse]; rfl)
 #align multiset.id_traverse Multiset.id_traverse
 
-/- warning: multiset.comp_traverse -> Multiset.comp_traverse is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1} -> Type.{u1}} {H : Type.{u1} -> Type.{u1}} [_inst_3 : Applicative.{u1, u1} G] [_inst_4 : Applicative.{u1, u1} H] [_inst_5 : CommApplicative.{u1, u1} G _inst_3] [_inst_6 : CommApplicative.{u1, u1} H _inst_4] {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} (g : α -> (G β)) (h : β -> (H γ)) (x : Multiset.{u1} α), Eq.{succ u1} (Functor.Comp.{u1, u1, u1} (fun {β : Type.{u1}} => G β) H (Multiset.{u1} γ)) (Multiset.traverse.{u1} (Functor.Comp.{u1, u1, u1} (fun {β : Type.{u1}} => G β) H) (Functor.Comp.applicative.{u1, u1, u1} (fun {β : Type.{u1}} => G β) H _inst_3 _inst_4) (Functor.Comp.commApplicative.{u1, u1, u1} (fun {β : Type.{u1}} => G β) H _inst_3 _inst_4 _inst_5 _inst_6) α γ (Function.comp.{succ u1, succ u1, succ u1} α (G (H γ)) (Functor.Comp.{u1, u1, u1} (fun {β : Type.{u1}} => G β) H γ) (Functor.Comp.mk.{u1, u1, u1} (fun {β : Type.{u1}} => G β) H γ) (Function.comp.{succ u1, succ u1, succ u1} α (G β) (G (H γ)) (Functor.map.{u1, u1} (fun {β : Type.{u1}} => G β) (Applicative.toFunctor.{u1, u1} (fun {β : Type.{u1}} => G β) _inst_3) β (H γ) h) g)) x) (Functor.Comp.mk.{u1, u1, u1} (fun {β : Type.{u1}} => G β) H (Multiset.{u1} γ) (Functor.map.{u1, u1} G (Applicative.toFunctor.{u1, u1} G _inst_3) (Multiset.{u1} β) (H (Multiset.{u1} γ)) (Multiset.traverse.{u1} H _inst_4 _inst_6 β γ h) (Multiset.traverse.{u1} G _inst_3 _inst_5 α β g x)))
-but is expected to have type
-  forall {G : Type.{u1} -> Type.{u1}} {H : Type.{u1} -> Type.{u1}} [_inst_3 : Applicative.{u1, u1} G] [_inst_4 : Applicative.{u1, u1} H] [_inst_5 : CommApplicative.{u1, u1} G _inst_3] [_inst_6 : CommApplicative.{u1, u1} H _inst_4] {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} (g : α -> (G β)) (h : β -> (H γ)) (x : Multiset.{u1} α), Eq.{succ u1} (Functor.Comp.{u1, u1, u1} G H (Multiset.{u1} γ)) (Multiset.traverse.{u1} (Functor.Comp.{u1, u1, u1} G H) (Functor.Comp.instApplicativeComp.{u1, u1, u1} G H _inst_3 _inst_4) (Functor.Comp.instCommApplicativeCompInstApplicativeComp.{u1, u1, u1} G H _inst_3 _inst_4 _inst_5 _inst_6) α γ (Function.comp.{succ u1, succ u1, succ u1} α (G (H γ)) (Functor.Comp.{u1, u1, u1} G H γ) (Functor.Comp.mk.{u1, u1, u1} G H γ) (Function.comp.{succ u1, succ u1, succ u1} α (G β) (G (H γ)) (Functor.map.{u1, u1} G (Applicative.toFunctor.{u1, u1} G _inst_3) β (H γ) h) g)) x) (Functor.Comp.mk.{u1, u1, u1} G H (Multiset.{u1} γ) (Functor.map.{u1, u1} G (Applicative.toFunctor.{u1, u1} G _inst_3) (Multiset.{u1} β) (H (Multiset.{u1} γ)) (Multiset.traverse.{u1} H _inst_4 _inst_6 β γ h) (Multiset.traverse.{u1} G _inst_3 _inst_5 α β g x)))
-Case conversion may be inaccurate. Consider using '#align multiset.comp_traverse Multiset.comp_traverseₓ'. -/
 theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G]
     [CommApplicative H] {α β γ : Type _} (g : α → G β) (h : β → H γ) (x : Multiset α) :
     traverse (Comp.mk ∘ Functor.map h ∘ g) x = Comp.mk (Functor.map (traverse h) (traverse g x)) :=
Diff
@@ -64,9 +64,7 @@ def traverse : Multiset α' → F (Multiset β') :=
             (fun a b l => ↑(a :: b :: l)) <$> f p_x <*> f p_y :=
           by
           rw [CommApplicative.commutative_map]
-          congr
-          funext a b l
-          simpa [flip] using perm.swap b a l
+          congr ; funext a b l; simpa [flip] using perm.swap b a l
         simp [(· ∘ ·), this, functor_norm]
       case trans => simp [*])
 #align multiset.traverse Multiset.traverse
Diff
@@ -171,7 +171,7 @@ theorem map_traverse {G : Type _ → Type _} [Applicative G] [CommApplicative G]
 theorem traverse_map {G : Type _ → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
     (g : α → β) (h : β → G γ) (x : Multiset α) : traverse h (map g x) = traverse (h ∘ g) x :=
   Quotient.inductionOn x
-    (by intro <;> simp [traverse] <;> rw [← Traversable.traverse_map h g] <;> [rfl, infer_instance])
+    (by intro <;> simp [traverse] <;> rw [← Traversable.traverse_map h g] <;> [rfl;infer_instance])
 #align multiset.traverse_map Multiset.traverse_map
 -/
 
Diff
@@ -92,7 +92,7 @@ theorem pure_def {α} : (pure : α → Multiset α) = singleton :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Multiset.{u1} α) -> (α -> (Multiset.{u1} β)) -> (Multiset.{u1} β)) (Bind.bind.{u1, u1} Multiset.{u1} (Monad.toHasBind.{u1, u1} Multiset.{u1} Multiset.monad.{u1}) α β) (Multiset.bind.{u1, u1} α β)
 but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Multiset.{u1} α) -> (α -> (Multiset.{u1} β)) -> (Multiset.{u1} β)) (fun (x._@.Mathlib.Data.Multiset.Functor._hyg.718 : Multiset.{u1} α) (x._@.Mathlib.Data.Multiset.Functor._hyg.720 : α -> (Multiset.{u1} β)) => Bind.bind.{u1, u1} Multiset.{u1} (Monad.toBind.{u1, u1} Multiset.{u1} Multiset.instMonadMultiset.{u1}) α β x._@.Mathlib.Data.Multiset.Functor._hyg.718 x._@.Mathlib.Data.Multiset.Functor._hyg.720) (Multiset.bind.{u1, u1} α β)
+  forall {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Multiset.{u1} α) -> (α -> (Multiset.{u1} β)) -> (Multiset.{u1} β)) (fun (x._@.Mathlib.Data.Multiset.Functor._hyg.720 : Multiset.{u1} α) (x._@.Mathlib.Data.Multiset.Functor._hyg.722 : α -> (Multiset.{u1} β)) => Bind.bind.{u1, u1} Multiset.{u1} (Monad.toBind.{u1, u1} Multiset.{u1} Multiset.instMonadMultiset.{u1}) α β x._@.Mathlib.Data.Multiset.Functor._hyg.720 x._@.Mathlib.Data.Multiset.Functor._hyg.722) (Multiset.bind.{u1, u1} α β)
 Case conversion may be inaccurate. Consider using '#align multiset.bind_def Multiset.bind_defₓ'. -/
 @[simp]
 theorem bind_def {α β} : (· >>= ·) = @bind α β :=

Changes in mathlib4

mathlib3
mathlib4
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -32,7 +32,6 @@ instance : LawfulFunctor Multiset := by refine' { .. } <;> intros <;> (try simp)
 open LawfulTraversable CommApplicative
 
 variable {F : Type u → Type u} [Applicative F] [CommApplicative F]
-
 variable {α' β' : Type u} (f : α' → F β')
 
 /-- Map each element of a `Multiset` to an action, evaluate these actions in order,
chore: Rename lemmas about the coercion List → Multiset (#11099)

These did not respect the naming convention by having the coe as a prefix instead of a suffix, or vice-versa. Also add a bunch of norm_cast

Diff
@@ -94,7 +94,7 @@ theorem lift_coe {α β : Type*} (x : List α) (f : List α → β)
 @[simp]
 theorem map_comp_coe {α β} (h : α → β) :
     Functor.map h ∘ Coe.coe = (Coe.coe ∘ Functor.map h : List α → Multiset β) := by
-  funext; simp only [Function.comp_apply, Coe.coe, fmap_def, coe_map, List.map_eq_map]
+  funext; simp only [Function.comp_apply, Coe.coe, fmap_def, map_coe, List.map_eq_map]
 #align multiset.map_comp_coe Multiset.map_comp_coe
 
 theorem id_traverse {α : Type*} (x : Multiset α) : traverse (pure : α → Id α) x = x := by
@@ -128,7 +128,7 @@ theorem traverse_map {G : Type* → Type _} [Applicative G] [CommApplicative G]
     (g : α → β) (h : β → G γ) (x : Multiset α) : traverse h (map g x) = traverse (h ∘ g) x := by
   refine' Quotient.inductionOn x _
   intro
-  simp only [traverse, quot_mk_to_coe, coe_map, lift_coe, Function.comp_apply]
+  simp only [traverse, quot_mk_to_coe, map_coe, lift_coe, Function.comp_apply]
   rw [← Traversable.traverse_map h g, List.map_eq_map]
 #align multiset.traverse_map Multiset.traverse_map
 
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
@@ -41,14 +41,14 @@ variable {α' β' : Type u} (f : α' → F β')
 def traverse : Multiset α' → F (Multiset β') := by
   refine' Quotient.lift (Functor.map Coe.coe ∘ Traversable.traverse f) _
   introv p; unfold Function.comp
-  induction p
-  case nil => rfl
-  case cons x l₁ l₂ _ h =>
+  induction p with
+  | nil => rfl
+  | @cons x l₁ l₂ _ h =>
     have :
       Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₁ =
         Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₂ := by rw [h]
     simpa [functor_norm] using this
-  case swap x y l =>
+  | swap x y l =>
     have :
       (fun a b (l : List β') ↦ (↑(a :: b :: l) : Multiset β')) <$> f y <*> f x =
         (fun a b l ↦ ↑(a :: b :: l)) <$> f x <*> f y := by
@@ -57,7 +57,7 @@ def traverse : Multiset α' → F (Multiset β') := by
       funext a b l
       simpa [flip] using Perm.swap a b l
     simp [(· ∘ ·), this, functor_norm, Coe.coe]
-  case trans => simp [*]
+  | trans => simp [*]
 #align multiset.traverse Multiset.traverse
 
 instance : Monad Multiset :=
chore: bump to nightly-2023-08-17 (#6019)

The major change here is adapting to simp failing if it makes no progress. The vast majority of the redundant simps found due to this change were extracted to #6632.

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

Diff
@@ -27,7 +27,7 @@ theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.ma
   rfl
 #align multiset.fmap_def Multiset.fmap_def
 
-instance : LawfulFunctor Multiset := by refine' { .. } <;> intros <;> simp; rfl
+instance : LawfulFunctor Multiset := by refine' { .. } <;> intros <;> (try simp); rfl
 
 open LawfulTraversable CommApplicative
 
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
@@ -86,7 +86,7 @@ open Functor
 open Traversable LawfulTraversable
 
 @[simp]
-theorem lift_coe {α β : Type _} (x : List α) (f : List α → β)
+theorem lift_coe {α β : Type*} (x : List α) (f : List α → β)
     (h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x :=
   Quotient.lift_mk _ _ _
 #align multiset.lift_coe Multiset.lift_coe
@@ -97,7 +97,7 @@ theorem map_comp_coe {α β} (h : α → β) :
   funext; simp only [Function.comp_apply, Coe.coe, fmap_def, coe_map, List.map_eq_map]
 #align multiset.map_comp_coe Multiset.map_comp_coe
 
-theorem id_traverse {α : Type _} (x : Multiset α) : traverse (pure : α → Id α) x = x := by
+theorem id_traverse {α : Type*} (x : Multiset α) : traverse (pure : α → Id α) x = x := by
   refine' Quotient.inductionOn x _
   intro
   simp [traverse, Coe.coe]
@@ -114,7 +114,7 @@ theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H]
   simp only [Function.comp, lift_coe]
 #align multiset.comp_traverse Multiset.comp_traverse
 
-theorem map_traverse {G : Type _ → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
+theorem map_traverse {G : Type* → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
     (g : α → G β) (h : β → γ) (x : Multiset α) :
     Functor.map (Functor.map h) (traverse g x) = traverse (Functor.map h ∘ g) x := by
   refine' Quotient.inductionOn x _
@@ -124,7 +124,7 @@ theorem map_traverse {G : Type _ → Type _} [Applicative G] [CommApplicative G]
   rfl
 #align multiset.map_traverse Multiset.map_traverse
 
-theorem traverse_map {G : Type _ → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
+theorem traverse_map {G : Type* → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
     (g : α → β) (h : β → G γ) (x : Multiset α) : traverse h (map g x) = traverse (h ∘ g) x := by
   refine' Quotient.inductionOn x _
   intro
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) 2018 Simon Hudon. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro, Johannes Hölzl, Simon Hudon, Kenny Lau
-
-! This file was ported from Lean 3 source module data.multiset.functor
-! leanprover-community/mathlib commit 1f0096e6caa61e9c849ec2adbd227e960e9dff58
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Multiset.Bind
 import Mathlib.Control.Traversable.Lemmas
 import Mathlib.Control.Traversable.Instances
 
+#align_import data.multiset.functor from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
+
 /-!
 # Functoriality of `Multiset`.
 -/
style: IsLawfulTraversable -> LawfulTraversable (#5737)
Diff
@@ -32,7 +32,7 @@ theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.ma
 
 instance : LawfulFunctor Multiset := by refine' { .. } <;> intros <;> simp; rfl
 
-open IsLawfulTraversable CommApplicative
+open LawfulTraversable CommApplicative
 
 variable {F : Type u → Type u} [Applicative F] [CommApplicative F]
 
@@ -86,7 +86,7 @@ instance : LawfulMonad Multiset := LawfulMonad.mk'
 
 open Functor
 
-open Traversable IsLawfulTraversable
+open Traversable LawfulTraversable
 
 @[simp]
 theorem lift_coe {α β : Type _} (x : List α) (f : List α → β)
@@ -141,7 +141,7 @@ theorem naturality {G H : Type _ → Type _} [Applicative G] [Applicative H] [Co
   refine' Quotient.inductionOn x _
   intro
   simp only [quot_mk_to_coe, traverse, lift_coe, Function.comp_apply,
-    ApplicativeTransformation.preserves_map, IsLawfulTraversable.naturality]
+    ApplicativeTransformation.preserves_map, LawfulTraversable.naturality]
 #align multiset.naturality Multiset.naturality
 
 end Multiset
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
@@ -30,7 +30,7 @@ theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.ma
   rfl
 #align multiset.fmap_def Multiset.fmap_def
 
-instance : LawfulFunctor Multiset := by refine' { .. } <;> intros <;> simp ; rfl
+instance : LawfulFunctor Multiset := by refine' { .. } <;> intros <;> simp; rfl
 
 open IsLawfulTraversable CommApplicative
 
@@ -97,7 +97,7 @@ theorem lift_coe {α β : Type _} (x : List α) (f : List α → β)
 @[simp]
 theorem map_comp_coe {α β} (h : α → β) :
     Functor.map h ∘ Coe.coe = (Coe.coe ∘ Functor.map h : List α → Multiset β) := by
-  funext ; simp only [Function.comp_apply, Coe.coe, fmap_def, coe_map, List.map_eq_map]
+  funext; simp only [Function.comp_apply, Coe.coe, fmap_def, coe_map, List.map_eq_map]
 #align multiset.map_comp_coe Multiset.map_comp_coe
 
 theorem id_traverse {α : Type _} (x : Multiset α) : traverse (pure : α → Id α) x = x := by
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -108,8 +108,8 @@ theorem id_traverse {α : Type _} (x : Multiset α) : traverse (pure : α → Id
 
 theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G]
     [CommApplicative H] {α β γ : Type _} (g : α → G β) (h : β → H γ) (x : Multiset α) :
-    traverse (Comp.mk ∘ Functor.map h ∘ g) x = Comp.mk (Functor.map (traverse h) (traverse g x)) :=
-  by
+    traverse (Comp.mk ∘ Functor.map h ∘ g) x =
+    Comp.mk (Functor.map (traverse h) (traverse g x)) := by
   refine' Quotient.inductionOn x _
   intro
   simp only [traverse, quot_mk_to_coe, lift_coe, Coe.coe, Function.comp_apply, Functor.map_map,
feat: Port data.multiset.functor (#1790)

Co-authored-by: int-y1 <jason_yuen2007@hotmail.com> Co-authored-by: Adam Topaz <adamtopaz@users.noreply.github.com>

Dependencies 2 + 160

161 files ported (98.8%)
73624 lines ported (99.8%)
Show graph

The unported dependencies are