control.traversable.lemmas
⟷
Mathlib.Control.Traversable.Lemmas
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)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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
@@ -104,7 +104,7 @@ theorem traverse_map (f : β → F γ) (g : α → β) (x : t α) :
theorem pure_traverse (x : t α) : traverse pure x = (pure x : F (t α)) := by
have : traverse pure x = pure (traverse id.mk x) :=
(naturality (pure_transformation F) id.mk x).symm <;>
- rwa [id_traverse] at this
+ rwa [id_traverse] at this
#align traversable.pure_traverse Traversable.pure_traverse
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-/
-import Mathbin.Control.Applicative
-import Mathbin.Control.Traversable.Basic
+import Control.Applicative
+import Control.Traversable.Basic
#align_import control.traversable.lemmas from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module control.traversable.lemmas
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Control.Applicative
import Mathbin.Control.Traversable.Basic
+#align_import control.traversable.lemmas from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
+
/-!
# Traversing collections
mathlib commit https://github.com/leanprover-community/mathlib/commit/5dc6092d09e5e489106865241986f7f2ad28d4c8
@@ -28,21 +28,21 @@ Inspired by [The Essence of the Iterator Pattern][gibbons2009].
universe u
-open IsLawfulTraversable
+open LawfulTraversable
open Function hiding comp
open Functor
-attribute [functor_norm] IsLawfulTraversable.naturality
+attribute [functor_norm] LawfulTraversable.naturality
-attribute [simp] IsLawfulTraversable.id_traverse
+attribute [simp] LawfulTraversable.id_traverse
namespace Traversable
variable {t : Type u → Type u}
-variable [Traversable t] [IsLawfulTraversable t]
+variable [Traversable t] [LawfulTraversable t]
variable (F G : Type u → Type u)
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -78,9 +78,11 @@ theorem pureTransformation_apply {α} (x : id α) : PureTransformation F x = pur
variable {F G} (x : t β)
+#print Traversable.map_eq_traverse_id /-
theorem map_eq_traverse_id : map f = @traverse t _ _ _ _ _ (id.mk ∘ f) :=
funext fun y => (traverse_eq_map_id f y).symm
#align traversable.map_eq_traverse_id Traversable.map_eq_traverse_id
+-/
#print Traversable.map_traverse /-
theorem map_traverse (x : t α) : map f <$> traverse g x = traverse (map f ∘ g) x :=
@@ -109,14 +111,18 @@ theorem pure_traverse (x : t α) : traverse pure x = (pure x : F (t α)) := by
#align traversable.pure_traverse Traversable.pure_traverse
-/
+#print Traversable.id_sequence /-
theorem id_sequence (x : t α) : sequence (id.mk <$> x) = id.mk x := by
simp [sequence, traverse_map, id_traverse] <;> rfl
#align traversable.id_sequence Traversable.id_sequence
+-/
+#print Traversable.comp_sequence /-
theorem comp_sequence (x : t (F (G α))) :
sequence (Comp.mk <$> x) = Comp.mk (sequence <$> sequence x) := by
simp [sequence, traverse_map] <;> rw [← comp_traverse] <;> simp [map_id]
#align traversable.comp_sequence Traversable.comp_sequence
+-/
#print Traversable.naturality' /-
theorem naturality' (η : ApplicativeTransformation F G) (x : t (F α)) :
@@ -124,20 +130,26 @@ theorem naturality' (η : ApplicativeTransformation F G) (x : t (F α)) :
#align traversable.naturality' Traversable.naturality'
-/
+#print Traversable.traverse_id /-
@[functor_norm]
theorem traverse_id : traverse id.mk = (id.mk : t α → id (t α)) := by ext; exact id_traverse _
#align traversable.traverse_id Traversable.traverse_id
+-/
+#print Traversable.traverse_comp /-
@[functor_norm]
theorem traverse_comp (g : α → F β) (h : β → G γ) :
traverse (Comp.mk ∘ map h ∘ g) =
(Comp.mk ∘ map (traverse h) ∘ traverse g : t α → Comp F G (t γ)) :=
by ext; exact comp_traverse _ _ _
#align traversable.traverse_comp Traversable.traverse_comp
+-/
+#print Traversable.traverse_eq_map_id' /-
theorem traverse_eq_map_id' (f : β → γ) : traverse (id.mk ∘ f) = id.mk ∘ (map f : t β → t γ) := by
ext; exact traverse_eq_map_id _ _
#align traversable.traverse_eq_map_id' Traversable.traverse_eq_map_id'
+-/
#print Traversable.traverse_map' /-
-- @[functor_norm]
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -87,7 +87,7 @@ theorem map_traverse (x : t α) : map f <$> traverse g x = traverse (map f ∘ g
by
rw [@map_eq_traverse_id t _ _ _ _ f]
refine' (comp_traverse (id.mk ∘ f) g x).symm.trans _
- congr ; apply comp.applicative_comp_id
+ congr; apply comp.applicative_comp_id
#align traversable.map_traverse Traversable.map_traverse
-/
@@ -97,7 +97,7 @@ theorem traverse_map (f : β → F γ) (g : α → β) (x : t α) :
by
rw [@map_eq_traverse_id t _ _ _ _ g]
refine' (comp_traverse f (id.mk ∘ g) x).symm.trans _
- congr ; apply comp.applicative_id_comp
+ congr; apply comp.applicative_id_comp
#align traversable.traverse_map Traversable.traverse_map
-/
@@ -105,7 +105,7 @@ theorem traverse_map (f : β → F γ) (g : α → β) (x : t α) :
theorem pure_traverse (x : t α) : traverse pure x = (pure x : F (t α)) := by
have : traverse pure x = pure (traverse id.mk x) :=
(naturality (pure_transformation F) id.mk x).symm <;>
- rwa [id_traverse] at this
+ rwa [id_traverse] at this
#align traversable.pure_traverse Traversable.pure_traverse
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -78,12 +78,6 @@ theorem pureTransformation_apply {α} (x : id α) : PureTransformation F x = pur
variable {F G} (x : t β)
-/- warning: traversable.map_eq_traverse_id -> Traversable.map_eq_traverse_id is a dubious translation:
-lean 3 declaration is
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {β : Type.{u1}} {γ : Type.{u1}} (f : β -> γ), Eq.{succ u1} ((t β) -> (t γ)) (Functor.map.{u1, u1} (fun {β : Type.{u1}} => t β) (Traversable.toFunctor.{u1} (fun {β : Type.{u1}} => t β) _inst_1) β γ f) (Traversable.traverse.{u1} t _inst_1 (id.{succ (succ u1)} Type.{u1}) (Monad.toApplicative.{u1, u1} (id.{succ (succ u1)} Type.{u1}) id.monad.{u1}) β γ (Function.comp.{succ u1, succ u1, succ u1} β γ (id.{succ (succ u1)} Type.{u1} γ) (id.mk.{succ u1} γ) f))
-but is expected to have type
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {β : Type.{u1}} {γ : Type.{u1}} (f : β -> γ), Eq.{succ u1} ((t β) -> (t γ)) (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) β γ f) (Traversable.traverse.{u1} t _inst_1 Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) β γ (Function.comp.{succ u1, succ u1, succ u1} β γ (Id.{u1} γ) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) γ) f))
-Case conversion may be inaccurate. Consider using '#align traversable.map_eq_traverse_id Traversable.map_eq_traverse_idₓ'. -/
theorem map_eq_traverse_id : map f = @traverse t _ _ _ _ _ (id.mk ∘ f) :=
funext fun y => (traverse_eq_map_id f y).symm
#align traversable.map_eq_traverse_id Traversable.map_eq_traverse_id
@@ -115,22 +109,10 @@ theorem pure_traverse (x : t α) : traverse pure x = (pure x : F (t α)) := by
#align traversable.pure_traverse Traversable.pure_traverse
-/
-/- warning: traversable.id_sequence -> Traversable.id_sequence is a dubious translation:
-lean 3 declaration is
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {α : Type.{u1}} (x : t α), Eq.{succ u1} (id.{succ (succ u1)} Type.{u1} (t α)) (sequence.{u1} t α (id.{succ (succ u1)} Type.{u1}) (Monad.toApplicative.{u1, u1} (id.{succ (succ u1)} Type.{u1}) id.monad.{u1}) _inst_1 (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) α (id.{succ (succ u1)} Type.{u1} α) (id.mk.{succ u1} α) x)) (id.mk.{succ u1} (t α) x)
-but is expected to have type
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {α : Type.{u1}} (x : t α), Eq.{succ u1} (Id.{u1} (t α)) (sequence.{u1} t α Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) _inst_1 (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) α (Id.{u1} α) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) α) x)) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) (t α) x)
-Case conversion may be inaccurate. Consider using '#align traversable.id_sequence Traversable.id_sequenceₓ'. -/
theorem id_sequence (x : t α) : sequence (id.mk <$> x) = id.mk x := by
simp [sequence, traverse_map, id_traverse] <;> rfl
#align traversable.id_sequence Traversable.id_sequence
-/- warning: traversable.comp_sequence -> Traversable.comp_sequence is a dubious translation:
-lean 3 declaration is
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {F : Type.{u1} -> Type.{u1}} {G : Type.{u1} -> Type.{u1}} [_inst_3 : Applicative.{u1, u1} F] [_inst_4 : LawfulApplicative.{u1, u1} F _inst_3] [_inst_5 : Applicative.{u1, u1} G] [_inst_6 : LawfulApplicative.{u1, u1} G _inst_5] {α : Type.{u1}} (x : t (F (G α))), Eq.{succ u1} (Functor.Comp.{u1, u1, u1} F G (t α)) (sequence.{u1} t α (Functor.Comp.{u1, u1, u1} F G) (Functor.Comp.applicative.{u1, u1, u1} F G _inst_3 _inst_5) _inst_1 (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) (F (G α)) (Functor.Comp.{u1, u1, u1} F G α) (Functor.Comp.mk.{u1, u1, u1} F G α) x)) (Functor.Comp.mk.{u1, u1, u1} F G (t α) (Functor.map.{u1, u1} F (Applicative.toFunctor.{u1, u1} F _inst_3) (t (G α)) (G (t α)) (sequence.{u1} t α G _inst_5 _inst_1) (sequence.{u1} t (G α) F _inst_3 _inst_1 x)))
-but is expected to have type
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {F : Type.{u1} -> Type.{u1}} {G : Type.{u1} -> Type.{u1}} [_inst_3 : Applicative.{u1, u1} F] [_inst_4 : LawfulApplicative.{u1, u1} F _inst_3] [_inst_5 : Applicative.{u1, u1} G] [_inst_6 : LawfulApplicative.{u1, u1} G _inst_5] {α : Type.{u1}} (x : t (F (G α))), Eq.{succ u1} (Functor.Comp.{u1, u1, u1} F G (t α)) (sequence.{u1} t α (Functor.Comp.{u1, u1, u1} F G) (Functor.Comp.instApplicativeComp.{u1, u1, u1} F G _inst_3 _inst_5) _inst_1 (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) (F (G α)) (Functor.Comp.{u1, u1, u1} F G α) (Functor.Comp.mk.{u1, u1, u1} F G α) x)) (Functor.Comp.mk.{u1, u1, u1} F G (t α) (Functor.map.{u1, u1} F (Applicative.toFunctor.{u1, u1} F _inst_3) (t (G α)) (G (t α)) (sequence.{u1} t α G _inst_5 _inst_1) (sequence.{u1} t (G α) F _inst_3 _inst_1 x)))
-Case conversion may be inaccurate. Consider using '#align traversable.comp_sequence Traversable.comp_sequenceₓ'. -/
theorem comp_sequence (x : t (F (G α))) :
sequence (Comp.mk <$> x) = Comp.mk (sequence <$> sequence x) := by
simp [sequence, traverse_map] <;> rw [← comp_traverse] <;> simp [map_id]
@@ -142,22 +124,10 @@ theorem naturality' (η : ApplicativeTransformation F G) (x : t (F α)) :
#align traversable.naturality' Traversable.naturality'
-/
-/- warning: traversable.traverse_id -> Traversable.traverse_id is a dubious translation:
-lean 3 declaration is
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {α : Type.{u1}}, Eq.{succ u1} ((t α) -> (id.{succ (succ u1)} Type.{u1} (t α))) (Traversable.traverse.{u1} t _inst_1 (id.{succ (succ u1)} Type.{u1}) (Monad.toApplicative.{u1, u1} (id.{succ (succ u1)} Type.{u1}) id.monad.{u1}) α α (id.mk.{succ u1} α)) (id.mk.{succ u1} (t α))
-but is expected to have type
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {α : Type.{u1}}, Eq.{succ u1} ((t α) -> (Id.{u1} (t α))) (Traversable.traverse.{u1} t _inst_1 Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) α α (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) α)) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) (t α))
-Case conversion may be inaccurate. Consider using '#align traversable.traverse_id Traversable.traverse_idₓ'. -/
@[functor_norm]
theorem traverse_id : traverse id.mk = (id.mk : t α → id (t α)) := by ext; exact id_traverse _
#align traversable.traverse_id Traversable.traverse_id
-/- warning: traversable.traverse_comp -> Traversable.traverse_comp is a dubious translation:
-lean 3 declaration is
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {F : Type.{u1} -> Type.{u1}} {G : Type.{u1} -> Type.{u1}} [_inst_3 : Applicative.{u1, u1} F] [_inst_4 : LawfulApplicative.{u1, u1} F _inst_3] [_inst_5 : Applicative.{u1, u1} G] [_inst_6 : LawfulApplicative.{u1, u1} G _inst_5] {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} (g : α -> (F β)) (h : β -> (G γ)), Eq.{succ u1} ((t α) -> (Functor.Comp.{u1, u1, u1} (fun {β : Type.{u1}} => F β) G (t γ))) (Traversable.traverse.{u1} (fun {α : Type.{u1}} => t α) _inst_1 (Functor.Comp.{u1, u1, u1} (fun {β : Type.{u1}} => F β) G) (Functor.Comp.applicative.{u1, u1, u1} (fun {β : Type.{u1}} => F β) G _inst_3 _inst_5) α γ (Function.comp.{succ u1, succ u1, succ u1} α (F (G γ)) (Functor.Comp.{u1, u1, u1} (fun {β : Type.{u1}} => F β) G γ) (Functor.Comp.mk.{u1, u1, u1} (fun {β : Type.{u1}} => F β) G γ) (Function.comp.{succ u1, succ u1, succ u1} α (F β) (F (G γ)) (Functor.map.{u1, u1} (fun {β : Type.{u1}} => F β) (Applicative.toFunctor.{u1, u1} (fun {β : Type.{u1}} => F β) _inst_3) β (G γ) h) g))) (Function.comp.{succ u1, succ u1, succ u1} (t α) (F (G (t γ))) (Functor.Comp.{u1, u1, u1} F G (t γ)) (Functor.Comp.mk.{u1, u1, u1} F G (t γ)) (Function.comp.{succ u1, succ u1, succ u1} (t α) (F (t β)) (F (G (t γ))) (Functor.map.{u1, u1} F (Applicative.toFunctor.{u1, u1} F _inst_3) (t β) (G (t γ)) (Traversable.traverse.{u1} t _inst_1 G _inst_5 β γ h)) (Traversable.traverse.{u1} t _inst_1 F _inst_3 α β g)))
-but is expected to have type
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {F : Type.{u1} -> Type.{u1}} {G : Type.{u1} -> Type.{u1}} [_inst_3 : Applicative.{u1, u1} F] [_inst_4 : LawfulApplicative.{u1, u1} F _inst_3] [_inst_5 : Applicative.{u1, u1} G] [_inst_6 : LawfulApplicative.{u1, u1} G _inst_5] {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} (g : α -> (F β)) (h : β -> (G γ)), Eq.{succ u1} ((t α) -> (Functor.Comp.{u1, u1, u1} F G (t γ))) (Traversable.traverse.{u1} t _inst_1 (Functor.Comp.{u1, u1, u1} F G) (Functor.Comp.instApplicativeComp.{u1, u1, u1} F G _inst_3 _inst_5) α γ (Function.comp.{succ u1, succ u1, succ u1} α (F (G γ)) (Functor.Comp.{u1, u1, u1} F G γ) (Functor.Comp.mk.{u1, u1, u1} F G γ) (Function.comp.{succ u1, succ u1, succ u1} α (F β) (F (G γ)) (Functor.map.{u1, u1} F (Applicative.toFunctor.{u1, u1} F _inst_3) β (G γ) h) g))) (Function.comp.{succ u1, succ u1, succ u1} (t α) (F (G (t γ))) (Functor.Comp.{u1, u1, u1} F G (t γ)) (Functor.Comp.mk.{u1, u1, u1} F G (t γ)) (Function.comp.{succ u1, succ u1, succ u1} (t α) (F (t β)) (F (G (t γ))) (Functor.map.{u1, u1} F (Applicative.toFunctor.{u1, u1} F _inst_3) (t β) (G (t γ)) (Traversable.traverse.{u1} t _inst_1 G _inst_5 β γ h)) (Traversable.traverse.{u1} t _inst_1 F _inst_3 α β g)))
-Case conversion may be inaccurate. Consider using '#align traversable.traverse_comp Traversable.traverse_compₓ'. -/
@[functor_norm]
theorem traverse_comp (g : α → F β) (h : β → G γ) :
traverse (Comp.mk ∘ map h ∘ g) =
@@ -165,12 +135,6 @@ theorem traverse_comp (g : α → F β) (h : β → G γ) :
by ext; exact comp_traverse _ _ _
#align traversable.traverse_comp Traversable.traverse_comp
-/- warning: traversable.traverse_eq_map_id' -> Traversable.traverse_eq_map_id' is a dubious translation:
-lean 3 declaration is
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {β : Type.{u1}} {γ : Type.{u1}} (f : β -> γ), Eq.{succ u1} ((t β) -> (id.{succ (succ u1)} Type.{u1} (t γ))) (Traversable.traverse.{u1} (fun {β : Type.{u1}} => t β) _inst_1 (id.{succ (succ u1)} Type.{u1}) (Monad.toApplicative.{u1, u1} (id.{succ (succ u1)} Type.{u1}) id.monad.{u1}) β γ (Function.comp.{succ u1, succ u1, succ u1} β γ (id.{succ (succ u1)} Type.{u1} γ) (id.mk.{succ u1} γ) f)) (Function.comp.{succ u1, succ u1, succ u1} (t β) (t γ) (id.{succ (succ u1)} Type.{u1} (t γ)) (id.mk.{succ u1} (t γ)) (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) β γ f))
-but is expected to have type
- forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {β : Type.{u1}} {γ : Type.{u1}} (f : β -> γ), Eq.{succ u1} ((t β) -> (Id.{u1} (t γ))) (Traversable.traverse.{u1} t _inst_1 Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) β γ (Function.comp.{succ u1, succ u1, succ u1} β γ (Id.{u1} γ) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) γ) f)) (Function.comp.{succ u1, succ u1, succ u1} (t β) (t γ) (Id.{u1} (t γ)) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) (t γ)) (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) β γ f))
-Case conversion may be inaccurate. Consider using '#align traversable.traverse_eq_map_id' Traversable.traverse_eq_map_id'ₓ'. -/
theorem traverse_eq_map_id' (f : β → γ) : traverse (id.mk ∘ f) = id.mk ∘ (map f : t β → t γ) := by
ext; exact traverse_eq_map_id _ _
#align traversable.traverse_eq_map_id' Traversable.traverse_eq_map_id'
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -65,9 +65,7 @@ def PureTransformation : ApplicativeTransformation id F
where
app := @pure F _
preserves_pure' α x := rfl
- preserves_seq' α β f x := by
- simp only [map_pure, seq_pure]
- rfl
+ preserves_seq' α β f x := by simp only [map_pure, seq_pure]; rfl
#align traversable.pure_transformation Traversable.PureTransformation
-/
@@ -151,10 +149,7 @@ but is expected to have type
forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {α : Type.{u1}}, Eq.{succ u1} ((t α) -> (Id.{u1} (t α))) (Traversable.traverse.{u1} t _inst_1 Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) α α (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) α)) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) (t α))
Case conversion may be inaccurate. Consider using '#align traversable.traverse_id Traversable.traverse_idₓ'. -/
@[functor_norm]
-theorem traverse_id : traverse id.mk = (id.mk : t α → id (t α)) :=
- by
- ext
- exact id_traverse _
+theorem traverse_id : traverse id.mk = (id.mk : t α → id (t α)) := by ext; exact id_traverse _
#align traversable.traverse_id Traversable.traverse_id
/- warning: traversable.traverse_comp -> Traversable.traverse_comp is a dubious translation:
@@ -167,9 +162,7 @@ Case conversion may be inaccurate. Consider using '#align traversable.traverse_c
theorem traverse_comp (g : α → F β) (h : β → G γ) :
traverse (Comp.mk ∘ map h ∘ g) =
(Comp.mk ∘ map (traverse h) ∘ traverse g : t α → Comp F G (t γ)) :=
- by
- ext
- exact comp_traverse _ _ _
+ by ext; exact comp_traverse _ _ _
#align traversable.traverse_comp Traversable.traverse_comp
/- warning: traversable.traverse_eq_map_id' -> Traversable.traverse_eq_map_id' is a dubious translation:
@@ -178,37 +171,27 @@ lean 3 declaration is
but is expected to have type
forall {t : Type.{u1} -> Type.{u1}} [_inst_1 : Traversable.{u1} t] [_inst_2 : IsLawfulTraversable.{u1} t _inst_1] {β : Type.{u1}} {γ : Type.{u1}} (f : β -> γ), Eq.{succ u1} ((t β) -> (Id.{u1} (t γ))) (Traversable.traverse.{u1} t _inst_1 Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) β γ (Function.comp.{succ u1, succ u1, succ u1} β γ (Id.{u1} γ) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) γ) f)) (Function.comp.{succ u1, succ u1, succ u1} (t β) (t γ) (Id.{u1} (t γ)) (Pure.pure.{u1, u1} Id.{u1} (Applicative.toPure.{u1, u1} Id.{u1} (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1})) (t γ)) (Functor.map.{u1, u1} t (Traversable.toFunctor.{u1} t _inst_1) β γ f))
Case conversion may be inaccurate. Consider using '#align traversable.traverse_eq_map_id' Traversable.traverse_eq_map_id'ₓ'. -/
-theorem traverse_eq_map_id' (f : β → γ) : traverse (id.mk ∘ f) = id.mk ∘ (map f : t β → t γ) :=
- by
- ext
- exact traverse_eq_map_id _ _
+theorem traverse_eq_map_id' (f : β → γ) : traverse (id.mk ∘ f) = id.mk ∘ (map f : t β → t γ) := by
+ ext; exact traverse_eq_map_id _ _
#align traversable.traverse_eq_map_id' Traversable.traverse_eq_map_id'
#print Traversable.traverse_map' /-
-- @[functor_norm]
theorem traverse_map' (g : α → β) (h : β → G γ) :
- traverse (h ∘ g) = (traverse h ∘ map g : t α → G (t γ)) :=
- by
- ext
- rw [comp_app, traverse_map]
+ traverse (h ∘ g) = (traverse h ∘ map g : t α → G (t γ)) := by ext; rw [comp_app, traverse_map]
#align traversable.traverse_map' Traversable.traverse_map'
-/
#print Traversable.map_traverse' /-
theorem map_traverse' (g : α → G β) (h : β → γ) :
- traverse (map h ∘ g) = (map (map h) ∘ traverse g : t α → G (t γ)) :=
- by
- ext
+ traverse (map h ∘ g) = (map (map h) ∘ traverse g : t α → G (t γ)) := by ext;
rw [comp_app, map_traverse]
#align traversable.map_traverse' Traversable.map_traverse'
-/
#print Traversable.naturality_pf /-
theorem naturality_pf (η : ApplicativeTransformation F G) (f : α → F β) :
- traverse (@η _ ∘ f) = @η _ ∘ (traverse f : t α → F (t β)) :=
- by
- ext
- rw [comp_app, naturality]
+ traverse (@η _ ∘ f) = @η _ ∘ (traverse f : t α → F (t β)) := by ext; rw [comp_app, naturality]
#align traversable.naturality_pf Traversable.naturality_pf
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
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)
@@ -35,21 +35,13 @@ attribute [simp] LawfulTraversable.id_traverse
namespace Traversable
variable {t : Type u → Type u}
-
variable [Traversable t] [LawfulTraversable t]
-
variable (F G : Type u → Type u)
-
variable [Applicative F] [LawfulApplicative F]
-
variable [Applicative G] [LawfulApplicative G]
-
variable {α β γ : Type u}
-
variable (g : α → F β)
-
variable (h : β → G γ)
-
variable (f : β → γ)
/-- The natural applicative transformation from the identity functor
@@ -100,7 +100,7 @@ theorem id_sequence (x : t α) : sequence (f := Id) (pure <$> x) = pure x := by
theorem comp_sequence (x : t (F (G α))) :
sequence (Comp.mk <$> x) = Comp.mk (sequence <$> sequence x) := by
- simp [sequence, traverse_map]; rw [← comp_traverse]; simp [map_id]
+ simp only [sequence, traverse_map, id_comp]; rw [← comp_traverse]; simp [map_id]
#align traversable.comp_sequence Traversable.comp_sequence
theorem naturality' (η : ApplicativeTransformation F G) (x : t (F α)) :
@@ -122,7 +122,7 @@ theorem traverse_comp (g : α → F β) (h : β → G γ) :
#align traversable.traverse_comp Traversable.traverse_comp
theorem traverse_eq_map_id' (f : β → γ) :
- traverse (m := Id) (pure ∘ f) = pure ∘ (map f : t β → t γ) := by
+ traverse (m := Id) (pure ∘ f) = pure ∘ (map f : t β → t γ) := by
ext
exact traverse_eq_map_id _ _
#align traversable.traverse_eq_map_id' Traversable.traverse_eq_map_id'
@@ -2,15 +2,12 @@
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module control.traversable.lemmas
-! leanprover-community/mathlib commit 3342d1b2178381196f818146ff79bc0e7ccd9e2d
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Control.Applicative
import Mathlib.Control.Traversable.Basic
+#align_import control.traversable.lemmas from "leanprover-community/mathlib"@"3342d1b2178381196f818146ff79bc0e7ccd9e2d"
+
/-!
# Traversing collections
@@ -25,21 +25,21 @@ Inspired by [The Essence of the Iterator Pattern][gibbons2009].
universe u
-open IsLawfulTraversable
+open LawfulTraversable
open Function hiding comp
open Functor
-attribute [functor_norm] IsLawfulTraversable.naturality
+attribute [functor_norm] LawfulTraversable.naturality
-attribute [simp] IsLawfulTraversable.id_traverse
+attribute [simp] LawfulTraversable.id_traverse
namespace Traversable
variable {t : Type u → Type u}
-variable [Traversable t] [IsLawfulTraversable t]
+variable [Traversable t] [LawfulTraversable t]
variable (F G : Type u → Type u)
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.
@@ -81,14 +81,14 @@ theorem map_eq_traverse_id : map (f := t) f = traverse (m := Id) (pure ∘ f) :=
theorem map_traverse (x : t α) : map f <$> traverse g x = traverse (map f ∘ g) x := by
rw [map_eq_traverse_id f]
refine' (comp_traverse (pure ∘ f) g x).symm.trans _
- congr ; apply Comp.applicative_comp_id
+ congr; apply Comp.applicative_comp_id
#align traversable.map_traverse Traversable.map_traverse
theorem traverse_map (f : β → F γ) (g : α → β) (x : t α) :
traverse f (g <$> x) = traverse (f ∘ g) x := by
rw [@map_eq_traverse_id t _ _ _ _ g]
refine' (comp_traverse (G := Id) f (pure ∘ g) x).symm.trans _
- congr ; apply Comp.applicative_id_comp
+ congr; apply Comp.applicative_id_comp
#align traversable.traverse_map Traversable.traverse_map
theorem pure_traverse (x : t α) : traverse pure x = (pure x : F (t α)) := by
by
line breaks (#1523)
During porting, I usually fix the desired format we seem to want for the line breaks around by
with
awk '{do {{if (match($0, "^ by$") && length(p) < 98) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}' Mathlib/File/Im/Working/On.lean
I noticed there are some more files that slipped through.
This pull request is the result of running this command:
grep -lr "^ by\$" Mathlib | xargs -n 1 awk -i inplace '{do {{if (match($0, "^ by$") && length(p) < 98 && not (match(p, "^[ \t]*--"))) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}'
Co-authored-by: Moritz Firsching <firsching@google.com>
@@ -119,8 +119,7 @@ theorem traverse_id : traverse pure = (pure : t α → Id (t α)) := by
@[functor_norm]
theorem traverse_comp (g : α → F β) (h : β → G γ) :
traverse (Comp.mk ∘ map h ∘ g) =
- (Comp.mk ∘ map (traverse h) ∘ traverse g : t α → Comp F G (t γ)) :=
- by
+ (Comp.mk ∘ map (traverse h) ∘ traverse g : t α → Comp F G (t γ)) := by
ext
exact comp_traverse _ _ _
#align traversable.traverse_comp Traversable.traverse_comp
The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md
@@ -2,6 +2,11 @@
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
+
+! This file was ported from Lean 3 source module control.traversable.lemmas
+! leanprover-community/mathlib commit 3342d1b2178381196f818146ff79bc0e7ccd9e2d
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Control.Applicative
import Mathlib.Control.Traversable.Basic
All dependencies are ported!