data.finset.functor
⟷
Mathlib.Data.Finset.Functor
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.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -122,7 +122,7 @@ instance : LawfulApplicative Finset :=
rw [if_neg ht.ne_empty, mem_sup]
refine' ⟨fun ha => ⟨const β a, mem_image_of_mem _ ha, mem_image_const_self.2 ht⟩, _⟩
rintro ⟨f, hf, ha⟩
- rw [mem_image] at hf ha
+ rw [mem_image] at hf ha
obtain ⟨b, hb, rfl⟩ := hf
obtain ⟨_, _, rfl⟩ := ha
exact hb
@@ -135,7 +135,7 @@ instance : LawfulApplicative Finset :=
rw [if_neg hs.ne_empty, mem_sup]
refine' ⟨fun ha => ⟨id, mem_image_const_self.2 hs, by rwa [image_id]⟩, _⟩
rintro ⟨f, hf, ha⟩
- rw [mem_image] at hf ha
+ rw [mem_image] at hf ha
obtain ⟨b, hb, rfl⟩ := ha
obtain ⟨_, _, rfl⟩ := hf
exact hb
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2021 Yaël Dillies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Scott Morrison
-/
-import Mathbin.Data.Finset.Lattice
-import Mathbin.Data.Finset.NAry
-import Mathbin.Data.Multiset.Functor
+import Data.Finset.Lattice
+import Data.Finset.NAry
+import Data.Multiset.Functor
#align_import data.finset.functor from "leanprover-community/mathlib"@"f16e7a22e11fc09c71f25446ac1db23a24e8a0bd"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2021 Yaël Dillies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Scott Morrison
-
-! This file was ported from Lean 3 source module data.finset.functor
-! leanprover-community/mathlib commit f16e7a22e11fc09c71f25446ac1db23a24e8a0bd
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Finset.Lattice
import Mathbin.Data.Finset.NAry
import Mathbin.Data.Multiset.Functor
+#align_import data.finset.functor from "leanprover-community/mathlib"@"f16e7a22e11fc09c71f25446ac1db23a24e8a0bd"
+
/-!
# Functoriality of `finset`
mathlib commit https://github.com/leanprover-community/mathlib/commit/8efcf8022aac8e01df8d302dcebdbc25d6a886c8
@@ -187,8 +187,8 @@ theorem bind_def {α β} : (· >>= ·) = @sup (Finset α) β _ _ :=
instance : LawfulMonad Finset :=
{
Finset.lawfulApplicative with
- bind_pure_comp_eq_map := fun α β f s => sup_singleton'' _ _
- bind_map_eq_seq := fun α β t s => rfl
+ bind_pure_comp := fun α β f s => sup_singleton'' _ _
+ bind_map := fun α β t s => rfl
pure_bind := fun α β t s => sup_singleton
bind_assoc := fun α β γ s f g => by convert sup_bUnion _ _; exact sup_eq_bUnion _ _ }
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -177,10 +177,12 @@ variable [∀ P, Decidable P]
instance : Monad Finset :=
{ Finset.applicative with bind := fun α β => @sup _ _ _ _ }
+#print Finset.bind_def /-
@[simp]
theorem bind_def {α β} : (· >>= ·) = @sup (Finset α) β _ _ :=
rfl
#align finset.bind_def Finset.bind_def
+-/
instance : LawfulMonad Finset :=
{
@@ -221,10 +223,12 @@ def traverse [DecidableEq β] (f : α → F β) (s : Finset α) : F (Finset β)
#align finset.traverse Finset.traverse
-/
+#print Finset.id_traverse /-
@[simp]
theorem id_traverse [DecidableEq α] (s : Finset α) : traverse id.mk s = s := by
rw [traverse, Multiset.id_traverse]; exact s.val_to_finset
#align finset.id_traverse Finset.id_traverse
+-/
open scoped Classical
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -125,7 +125,7 @@ instance : LawfulApplicative Finset :=
rw [if_neg ht.ne_empty, mem_sup]
refine' ⟨fun ha => ⟨const β a, mem_image_of_mem _ ha, mem_image_const_self.2 ht⟩, _⟩
rintro ⟨f, hf, ha⟩
- rw [mem_image] at hf ha
+ rw [mem_image] at hf ha
obtain ⟨b, hb, rfl⟩ := hf
obtain ⟨_, _, rfl⟩ := ha
exact hb
@@ -138,7 +138,7 @@ instance : LawfulApplicative Finset :=
rw [if_neg hs.ne_empty, mem_sup]
refine' ⟨fun ha => ⟨id, mem_image_const_self.2 hs, by rwa [image_id]⟩, _⟩
rintro ⟨f, hf, ha⟩
- rw [mem_image] at hf ha
+ rw [mem_image] at hf ha
obtain ⟨b, hb, rfl⟩ := ha
obtain ⟨_, _, rfl⟩ := hf
exact hb
@@ -162,7 +162,7 @@ instance : CommApplicative Finset :=
by
simp_rw [seq_def, fmap_def, sup_image, sup_eq_bUnion]
change (s.bUnion fun a => t.image fun b => (a, b)) = t.bUnion fun b => s.image fun a => (a, b)
- trans s ×ˢ t <;> [rw [product_eq_bUnion];rw [product_eq_bUnion_right]] <;> congr <;> ext <;>
+ trans s ×ˢ t <;> [rw [product_eq_bUnion]; rw [product_eq_bUnion_right]] <;> congr <;> ext <;>
simp_rw [mem_image] }
end Applicative
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -226,7 +226,7 @@ theorem id_traverse [DecidableEq α] (s : Finset α) : traverse id.mk s = s := b
rw [traverse, Multiset.id_traverse]; exact s.val_to_finset
#align finset.id_traverse Finset.id_traverse
-open Classical
+open scoped Classical
#print Finset.map_comp_coe /-
@[simp]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -177,12 +177,6 @@ variable [∀ P, Decidable P]
instance : Monad Finset :=
{ Finset.applicative with bind := fun α β => @sup _ _ _ _ }
-/- warning: finset.bind_def -> Finset.bind_def is a dubious translation:
-lean 3 declaration is
- forall [_inst_1 : forall (P : Prop), Decidable P] {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Finset.{u1} β) -> (β -> (Finset.{u1} α)) -> (Finset.{u1} α)) (Bind.bind.{u1, u1} Finset.{u1} (Monad.toHasBind.{u1, u1} Finset.{u1} (Finset.monad.{u1} (fun (P : Prop) => _inst_1 P))) β α) (Finset.sup.{u1, u1} (Finset.{u1} α) β (Lattice.toSemilatticeSup.{u1} (Finset.{u1} α) (Finset.lattice.{u1} α (fun (a : α) (b : α) => _inst_1 (Eq.{succ u1} α a b)))) (Finset.orderBot.{u1} α))
-but is expected to have type
- forall [_inst_1 : forall (P : Prop), Decidable P] {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Finset.{u1} β) -> (β -> (Finset.{u1} α)) -> (Finset.{u1} α)) (fun (x._@.Mathlib.Data.Finset.Functor._hyg.1279 : Finset.{u1} β) (x._@.Mathlib.Data.Finset.Functor._hyg.1281 : β -> (Finset.{u1} α)) => Bind.bind.{u1, u1} Finset.{u1} (Monad.toBind.{u1, u1} Finset.{u1} (Finset.instMonadFinset.{u1} (fun (P : Prop) => _inst_1 P))) β α x._@.Mathlib.Data.Finset.Functor._hyg.1279 x._@.Mathlib.Data.Finset.Functor._hyg.1281) (Finset.sup.{u1, u1} (Finset.{u1} α) β (Lattice.toSemilatticeSup.{u1} (Finset.{u1} α) (Finset.instLatticeFinset.{u1} α (fun (a : α) (b : α) => _inst_1 (Eq.{succ u1} α a b)))) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} α))
-Case conversion may be inaccurate. Consider using '#align finset.bind_def Finset.bind_defₓ'. -/
@[simp]
theorem bind_def {α β} : (· >>= ·) = @sup (Finset α) β _ _ :=
rfl
@@ -227,12 +221,6 @@ def traverse [DecidableEq β] (f : α → F β) (s : Finset α) : F (Finset β)
#align finset.traverse Finset.traverse
-/
-/- warning: finset.id_traverse -> Finset.id_traverse is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_5 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (id.{succ (succ u1)} Type.{u1} (Finset.{u1} α)) (Finset.traverse.{u1} α α (id.{succ (succ u1)} Type.{u1}) (Monad.toApplicative.{u1, u1} (id.{succ (succ u1)} Type.{u1}) id.monad.{u1}) id.commApplicative.{u1} (fun (a : α) (b : α) => _inst_5 a b) (id.mk.{succ u1} α) s) s
-but is expected to have type
- forall {α : Type.{u1}} [_inst_5 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Id.{u1} (Finset.{u1} α)) (Finset.traverse.{u1} α α Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) instCommApplicativeIdToApplicativeInstMonadId.{u1} (fun (a : α) (b : α) => _inst_5 a b) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) α) s) s
-Case conversion may be inaccurate. Consider using '#align finset.id_traverse Finset.id_traverseₓ'. -/
@[simp]
theorem id_traverse [DecidableEq α] (s : Finset α) : traverse id.mk s = s := by
rw [traverse, Multiset.id_traverse]; exact s.val_to_finset
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -110,9 +110,7 @@ theorem seqRight_def (s : Finset α) (t : Finset β) : s *> t = if s = ∅ then
/-- `finset.image₂` in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism. -/
theorem image₂_def {α β γ : Type _} (f : α → β → γ) (s : Finset α) (t : Finset β) :
- image₂ f s t = f <$> s <*> t := by
- ext
- simp [mem_sup]
+ image₂ f s t = f <$> s <*> t := by ext; simp [mem_sup]
#align finset.image₂_def Finset.image₂_def
-/
@@ -122,8 +120,7 @@ instance : LawfulApplicative Finset :=
seqLeft_eq := fun α β s t => by
rw [seq_def, fmap_def, seq_left_def]
obtain rfl | ht := t.eq_empty_or_nonempty
- · simp_rw [if_pos rfl, image_empty]
- exact (sup_bot _).symm
+ · simp_rw [if_pos rfl, image_empty]; exact (sup_bot _).symm
· ext a
rw [if_neg ht.ne_empty, mem_sup]
refine' ⟨fun ha => ⟨const β a, mem_image_of_mem _ ha, mem_image_const_self.2 ht⟩, _⟩
@@ -197,9 +194,7 @@ instance : LawfulMonad Finset :=
bind_pure_comp_eq_map := fun α β f s => sup_singleton'' _ _
bind_map_eq_seq := fun α β t s => rfl
pure_bind := fun α β t s => sup_singleton
- bind_assoc := fun α β γ s f g => by
- convert sup_bUnion _ _
- exact sup_eq_bUnion _ _ }
+ bind_assoc := fun α β γ s f g => by convert sup_bUnion _ _; exact sup_eq_bUnion _ _ }
end Monad
@@ -239,10 +234,8 @@ but is expected to have type
forall {α : Type.{u1}} [_inst_5 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Id.{u1} (Finset.{u1} α)) (Finset.traverse.{u1} α α Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) instCommApplicativeIdToApplicativeInstMonadId.{u1} (fun (a : α) (b : α) => _inst_5 a b) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) α) s) s
Case conversion may be inaccurate. Consider using '#align finset.id_traverse Finset.id_traverseₓ'. -/
@[simp]
-theorem id_traverse [DecidableEq α] (s : Finset α) : traverse id.mk s = s :=
- by
- rw [traverse, Multiset.id_traverse]
- exact s.val_to_finset
+theorem id_traverse [DecidableEq α] (s : Finset α) : traverse id.mk s = s := by
+ rw [traverse, Multiset.id_traverse]; exact s.val_to_finset
#align finset.id_traverse Finset.id_traverse
open Classical
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -165,7 +165,7 @@ instance : CommApplicative Finset :=
by
simp_rw [seq_def, fmap_def, sup_image, sup_eq_bUnion]
change (s.bUnion fun a => t.image fun b => (a, b)) = t.bUnion fun b => s.image fun a => (a, b)
- trans s ×ˢ t <;> [rw [product_eq_bUnion], rw [product_eq_bUnion_right]] <;> congr <;> ext <;>
+ trans s ×ˢ t <;> [rw [product_eq_bUnion];rw [product_eq_bUnion_right]] <;> congr <;> ext <;>
simp_rw [mem_image] }
end Applicative
mathlib commit https://github.com/leanprover-community/mathlib/commit/36b8aa61ea7c05727161f96a0532897bd72aedab
@@ -184,7 +184,7 @@ instance : Monad Finset :=
lean 3 declaration is
forall [_inst_1 : forall (P : Prop), Decidable P] {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Finset.{u1} β) -> (β -> (Finset.{u1} α)) -> (Finset.{u1} α)) (Bind.bind.{u1, u1} Finset.{u1} (Monad.toHasBind.{u1, u1} Finset.{u1} (Finset.monad.{u1} (fun (P : Prop) => _inst_1 P))) β α) (Finset.sup.{u1, u1} (Finset.{u1} α) β (Lattice.toSemilatticeSup.{u1} (Finset.{u1} α) (Finset.lattice.{u1} α (fun (a : α) (b : α) => _inst_1 (Eq.{succ u1} α a b)))) (Finset.orderBot.{u1} α))
but is expected to have type
- forall [_inst_1 : forall (P : Prop), Decidable P] {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Finset.{u1} β) -> (β -> (Finset.{u1} α)) -> (Finset.{u1} α)) (fun (x._@.Mathlib.Data.Finset.Functor._hyg.1288 : Finset.{u1} β) (x._@.Mathlib.Data.Finset.Functor._hyg.1290 : β -> (Finset.{u1} α)) => Bind.bind.{u1, u1} Finset.{u1} (Monad.toBind.{u1, u1} Finset.{u1} (Finset.instMonadFinset.{u1} (fun (P : Prop) => _inst_1 P))) β α x._@.Mathlib.Data.Finset.Functor._hyg.1288 x._@.Mathlib.Data.Finset.Functor._hyg.1290) (Finset.sup.{u1, u1} (Finset.{u1} α) β (Lattice.toSemilatticeSup.{u1} (Finset.{u1} α) (Finset.instLatticeFinset.{u1} α (fun (a : α) (b : α) => _inst_1 (Eq.{succ u1} α a b)))) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} α))
+ forall [_inst_1 : forall (P : Prop), Decidable P] {α : Type.{u1}} {β : Type.{u1}}, Eq.{succ u1} ((Finset.{u1} β) -> (β -> (Finset.{u1} α)) -> (Finset.{u1} α)) (fun (x._@.Mathlib.Data.Finset.Functor._hyg.1279 : Finset.{u1} β) (x._@.Mathlib.Data.Finset.Functor._hyg.1281 : β -> (Finset.{u1} α)) => Bind.bind.{u1, u1} Finset.{u1} (Monad.toBind.{u1, u1} Finset.{u1} (Finset.instMonadFinset.{u1} (fun (P : Prop) => _inst_1 P))) β α x._@.Mathlib.Data.Finset.Functor._hyg.1279 x._@.Mathlib.Data.Finset.Functor._hyg.1281) (Finset.sup.{u1, u1} (Finset.{u1} α) β (Lattice.toSemilatticeSup.{u1} (Finset.{u1} α) (Finset.instLatticeFinset.{u1} α (fun (a : α) (b : α) => _inst_1 (Eq.{succ u1} α a b)))) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} α))
Case conversion may be inaccurate. Consider using '#align finset.bind_def Finset.bind_defₓ'. -/
@[simp]
theorem bind_def {α β} : (· >>= ·) = @sup (Finset α) β _ _ :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
open Classical
(#11199)
We remove all but one open Classical
s, instead preferring to use open scoped Classical
. The only real side-effect this led to is moving a couple declarations to use Exists.choose
instead of Classical.choose
.
The first few commits are explicitly labelled regex replaces for ease of review.
@@ -202,7 +202,7 @@ theorem id_traverse [DecidableEq α] (s : Finset α) : traverse (pure : α → I
exact s.val_toFinset
#align finset.id_traverse Finset.id_traverse
-open Classical
+open scoped Classical
@[simp]
theorem map_comp_coe (h : α → β) :
@@ -165,7 +165,7 @@ instance : LawfulMonad Finset :=
bind_pure_comp := fun f s => sup_singleton'' _ _
bind_map := fun t s => rfl
pure_bind := fun t s => sup_singleton
- bind_assoc := fun s f g => by simp only [bind, ←sup_biUnion, sup_eq_biUnion, biUnion_biUnion] }
+ bind_assoc := fun s f g => by simp only [bind, ← sup_biUnion, sup_eq_biUnion, biUnion_biUnion] }
end Monad
Type _
before the colon (#7718)
We have turned to Type*
instead of Type _
, but many of them remained in mathlib because the straight replacement did not work. In general, having Type _
before the colon is a code smell, though, as it hides which types should be in the same universe and which shouldn't, and is not very robust.
This PR replaces most of the remaining Type _
before the colon (except those in category theory) by Type*
or Type u
. This has uncovered a few bugs (where declarations were not as polymorphic as they should be).
I had to increase heartbeats at two places when replacing Type _
by Type*
, but I think it's worth it as it's really more robust.
@@ -89,7 +89,7 @@ theorem seqRight_def (s : Finset α) (t : Finset β) : s *> t = if s = ∅ then
/-- `Finset.image₂` in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism. -/
-theorem image₂_def {α β γ : Type _} (f : α → β → γ) (s : Finset α) (t : Finset β) :
+theorem image₂_def {α β γ : Type u} (f : α → β → γ) (s : Finset α) (t : Finset β) :
image₂ f s t = f <$> s <*> t := by
ext
simp [mem_sup]
@@ -2,16 +2,13 @@
Copyright (c) 2021 Yaël Dillies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Scott Morrison
-
-! This file was ported from Lean 3 source module data.finset.functor
-! leanprover-community/mathlib commit bcfa726826abd57587355b4b5b7e78ad6527b7e4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Finset.NAry
import Mathlib.Data.Multiset.Functor
+#align_import data.finset.functor from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
+
/-!
# Functoriality of `Finset`
SProd
to implement overloaded notation · ×ˢ ·
(#4200)
Currently, the following notations are changed from · ×ˢ ·
because Lean 4 can't deal with ambiguous notations.
| Definition | Notation |
| :
Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Chris Hughes <chrishughes24@gmail.com>
@@ -144,7 +144,7 @@ instance commApplicative : CommApplicative Finset :=
simp_rw [seq_def, fmap_def, sup_image, sup_eq_biUnion]
change (s.biUnion fun a => t.image fun b => (a, b))
= t.biUnion fun b => s.image fun a => (a, b)
- trans s.product t <;> [rw [product_eq_biUnion]; rw [product_eq_biUnion_right]] }
+ trans s ×ˢ t <;> [rw [product_eq_biUnion]; rw [product_eq_biUnion_right]] }
end Applicative
The main breaking change is that tac <;> [t1, t2]
is now written tac <;> [t1; t2]
, to avoid clashing with tactics like cases
and use
that take comma-separated lists.
@@ -144,7 +144,7 @@ instance commApplicative : CommApplicative Finset :=
simp_rw [seq_def, fmap_def, sup_image, sup_eq_biUnion]
change (s.biUnion fun a => t.image fun b => (a, b))
= t.biUnion fun b => s.image fun a => (a, b)
- trans s.product t <;> [rw [product_eq_biUnion], rw [product_eq_biUnion_right]] }
+ trans s.product t <;> [rw [product_eq_biUnion]; rw [product_eq_biUnion_right]] }
end Applicative
sSup
/iSup
(#3938)
As discussed on Zulip
supₛ
→ sSup
infₛ
→ sInf
supᵢ
→ iSup
infᵢ
→ iInf
bsupₛ
→ bsSup
binfₛ
→ bsInf
bsupᵢ
→ biSup
binfᵢ
→ biInf
csupₛ
→ csSup
cinfₛ
→ csInf
csupᵢ
→ ciSup
cinfᵢ
→ ciInf
unionₛ
→ sUnion
interₛ
→ sInter
unionᵢ
→ iUnion
interᵢ
→ iInter
bunionₛ
→ bsUnion
binterₛ
→ bsInter
bunionᵢ
→ biUnion
binterᵢ
→ biInter
Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
@@ -141,10 +141,10 @@ instance lawfulApplicative : LawfulApplicative Finset :=
instance commApplicative : CommApplicative Finset :=
{ Finset.lawfulApplicative with
commutative_prod := fun s t => by
- simp_rw [seq_def, fmap_def, sup_image, sup_eq_bunionᵢ]
- change (s.bunionᵢ fun a => t.image fun b => (a, b))
- = t.bunionᵢ fun b => s.image fun a => (a, b)
- trans s.product t <;> [rw [product_eq_bunionᵢ], rw [product_eq_bunionᵢ_right]] }
+ simp_rw [seq_def, fmap_def, sup_image, sup_eq_biUnion]
+ change (s.biUnion fun a => t.image fun b => (a, b))
+ = t.biUnion fun b => s.image fun a => (a, b)
+ trans s.product t <;> [rw [product_eq_biUnion], rw [product_eq_biUnion_right]] }
end Applicative
@@ -168,7 +168,7 @@ instance : LawfulMonad Finset :=
bind_pure_comp := fun f s => sup_singleton'' _ _
bind_map := fun t s => rfl
pure_bind := fun t s => sup_singleton
- bind_assoc := fun s f g => by simp only [bind, ←sup_bunionᵢ, sup_eq_bunionᵢ, bunionᵢ_bunionᵢ] }
+ bind_assoc := fun s f g => by simp only [bind, ←sup_biUnion, sup_eq_biUnion, biUnion_biUnion] }
end Monad
by
s! (#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 by
s".
@@ -100,8 +100,7 @@ theorem image₂_def {α β γ : Type _} (f : α → β → γ) (s : Finset α)
instance lawfulApplicative : LawfulApplicative Finset :=
{ Finset.lawfulFunctor with
- seqLeft_eq := fun s t =>
- by
+ seqLeft_eq := fun s t => by
rw [seq_def, fmap_def, seqLeft_def]
obtain rfl | ht := t.eq_empty_or_nonempty
· simp_rw [image_empty, if_true]
@@ -114,8 +113,7 @@ instance lawfulApplicative : LawfulApplicative Finset :=
obtain ⟨b, hb, rfl⟩ := hf
obtain ⟨_, _, rfl⟩ := ha
exact hb
- seqRight_eq := fun s t =>
- by
+ seqRight_eq := fun s t => by
rw [seq_def, fmap_def, seqRight_def]
obtain rfl | hs := s.eq_empty_or_nonempty
· rw [if_pos rfl, image_empty, sup_empty, bot_eq_empty]
closes #3680, see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Stepping.20through.20simp_rw/near/326712986
@@ -104,7 +104,7 @@ instance lawfulApplicative : LawfulApplicative Finset :=
by
rw [seq_def, fmap_def, seqLeft_def]
obtain rfl | ht := t.eq_empty_or_nonempty
- · simp_rw [if_pos rfl, image_empty, if_true]
+ · simp_rw [image_empty, if_true]
exact (sup_bot _).symm
· ext a
rw [if_neg ht.ne_empty, mem_sup]
The unported dependencies are