control.applicative
⟷
Mathlib.Control.Applicative
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)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2017 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-/
-import Mathbin.Algebra.Group.Defs
-import Mathbin.Control.Functor
+import Algebra.Group.Defs
+import Control.Functor
#align_import control.applicative from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2017 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.applicative
-! 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.Algebra.Group.Defs
import Mathbin.Control.Functor
+#align_import control.applicative from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
+
/-!
# `applicative` instances
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -37,14 +37,19 @@ variable [Applicative F] [LawfulApplicative F]
variable {α β γ σ : Type u}
+#print Applicative.map_seq_map /-
theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) :
f <$> x <*> g <$> y = (flip (· ∘ ·) g ∘ f) <$> x <*> y := by simp [flip, functor_norm]
#align applicative.map_seq_map Applicative.map_seq_map
+-/
+#print Applicative.pure_seq_eq_map' /-
theorem Applicative.pure_seq_eq_map' (f : α → β) : (· <*> ·) (pure f : F (α → β)) = (· <$> ·) f :=
by ext <;> simp [functor_norm]
#align applicative.pure_seq_eq_map' Applicative.pure_seq_eq_map'
+-/
+#print Applicative.ext /-
theorem Applicative.ext {F} :
∀ {A1 : Applicative F} {A2 : Applicative F} [@LawfulApplicative F A1] [@LawfulApplicative F A2]
(H1 : ∀ {α : Type u} (x : α), @Pure.pure _ A1.toHasPure _ x = @Pure.pure _ A2.toHasPure _ x)
@@ -73,6 +78,7 @@ theorem Applicative.ext {F} :
· exact (L1_seq_left_eq _ _).trans (L2_seq_left_eq _ _).symm
· exact (L1_seq_right_eq _ _).trans (L2_seq_right_eq _ _).symm
#align applicative.ext Applicative.ext
+-/
end Lemmas
@@ -100,18 +106,24 @@ theorem map_pure (f : α → β) (x : α) : (f <$> pure x : Comp F G β) = pure
#align functor.comp.map_pure Functor.Comp.map_pure
-/
+#print Functor.Comp.seq_pure /-
theorem seq_pure (f : Comp F G (α → β)) (x : α) : f <*> pure x = (fun g : α → β => g x) <$> f :=
Comp.ext <| by simp [(· ∘ ·), functor_norm]
#align functor.comp.seq_pure Functor.Comp.seq_pure
+-/
+#print Functor.Comp.seq_assoc /-
theorem seq_assoc (x : Comp F G α) (f : Comp F G (α → β)) (g : Comp F G (β → γ)) :
g <*> (f <*> x) = @Function.comp α β γ <$> g <*> f <*> x :=
Comp.ext <| by simp [(· ∘ ·), functor_norm]
#align functor.comp.seq_assoc Functor.Comp.seq_assoc
+-/
+#print Functor.Comp.pure_seq_eq_map /-
theorem pure_seq_eq_map (f : α → β) (x : Comp F G α) : pure f <*> x = f <$> x :=
Comp.ext <| by simp [Applicative.pure_seq_eq_map', functor_norm]
#align functor.comp.pure_seq_eq_map Functor.Comp.pure_seq_eq_map
+-/
instance : LawfulApplicative (Comp F G)
where
@@ -120,17 +132,21 @@ instance : LawfulApplicative (Comp F G)
seq_pure := @Comp.seq_pure F G _ _ _ _
seq_assoc := @Comp.seq_assoc F G _ _ _ _
+#print Functor.Comp.applicative_id_comp /-
theorem applicative_id_comp {F} [AF : Applicative F] [LF : LawfulApplicative F] :
@Comp.applicative id F _ _ = AF :=
@Applicative.ext F _ _ (@Comp.lawfulApplicative id F _ _ _ _) _ (fun α x => rfl) fun α β f x =>
rfl
#align functor.comp.applicative_id_comp Functor.Comp.applicative_id_comp
+-/
+#print Functor.Comp.applicative_comp_id /-
theorem applicative_comp_id {F} [AF : Applicative F] [LF : LawfulApplicative F] :
@Comp.applicative F id _ _ = AF :=
@Applicative.ext F _ _ (@Comp.lawfulApplicative F id _ _ _ _) _ (fun α x => rfl) fun α β f x =>
show id <$> f <*> x = f <*> x by rw [id_map]
#align functor.comp.applicative_comp_id Functor.Comp.applicative_comp_id
+-/
open CommApplicative
@@ -149,12 +165,14 @@ end Functor
open Functor
+#print Comp.seq_mk /-
@[functor_norm]
theorem Comp.seq_mk {α β : Type w} {f : Type u → Type v} {g : Type w → Type u} [Applicative f]
[Applicative g] (h : f (g (α → β))) (x : f (g α)) :
Comp.mk h <*> Comp.mk x = Comp.mk (Seq.seq <$> h <*> x) :=
rfl
#align comp.seq_mk Comp.seq_mk
+-/
instance {α} [One α] [Mul α] : Applicative (Const α)
where
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -138,10 +138,10 @@ instance {f : Type u → Type w} {g : Type v → Type u} [Applicative f] [Applic
[CommApplicative f] [CommApplicative g] : CommApplicative (Comp f g) :=
by
refine' { @comp.is_lawful_applicative f g _ _ _ _ with .. }
- intros ; casesm*comp _ _ _; simp! [map, Seq.seq, functor_norm]
+ intros; casesm*comp _ _ _; simp! [map, Seq.seq, functor_norm]
rw [commutative_map]
simp [comp.mk, flip, (· ∘ ·), functor_norm]
- congr ; funext; rw [commutative_map]; congr
+ congr; funext; rw [commutative_map]; congr
end Comp
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -37,32 +37,14 @@ variable [Applicative F] [LawfulApplicative F]
variable {α β γ σ : Type u}
-/- warning: applicative.map_seq_map -> Applicative.map_seq_map is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} F] [_inst_2 : LawfulApplicative.{u1, u2} F _inst_1] {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} {σ : Type.{u1}} (f : α -> β -> γ) (g : σ -> β) (x : F α) (y : F σ), Eq.{succ u2} (F γ) (Seq.seq.{u1, u2} (fun {α : Type.{u1}} => F α) (Applicative.toHasSeq.{u1, u2} (fun {α : Type.{u1}} => F α) _inst_1) β γ (Functor.map.{u1, u2} (fun {α : Type.{u1}} => F α) (Applicative.toFunctor.{u1, u2} (fun {α : Type.{u1}} => F α) _inst_1) α (β -> γ) f x) (Functor.map.{u1, u2} F (Applicative.toFunctor.{u1, u2} F _inst_1) σ β g y)) (Seq.seq.{u1, u2} F (Applicative.toHasSeq.{u1, u2} F _inst_1) σ γ (Functor.map.{u1, u2} F (Applicative.toFunctor.{u1, u2} F _inst_1) α (σ -> γ) (Function.comp.{succ u1, succ u1, succ u1} α (β -> γ) (σ -> γ) (flip.{succ u1, succ u1, succ u1} (β -> γ) (σ -> β) (σ -> γ) (Function.comp.{succ u1, succ u1, succ u1} σ β γ) g) f) x) y)
-but is expected to have type
- forall {F : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} F] [_inst_2 : LawfulApplicative.{u1, u2} F _inst_1] {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} {σ : Type.{u1}} (f : α -> β -> γ) (g : σ -> β) (x : F α) (y : F σ), Eq.{succ u2} (F γ) (Seq.seq.{u1, u2} F (Applicative.toSeq.{u1, u2} F _inst_1) β γ (Functor.map.{u1, u2} F (Applicative.toFunctor.{u1, u2} F _inst_1) α (β -> γ) f x) (fun (x._@.Mathlib.Control.Applicative._hyg.84 : Unit) => Functor.map.{u1, u2} F (Applicative.toFunctor.{u1, u2} F _inst_1) σ β g y)) (Seq.seq.{u1, u2} F (Applicative.toSeq.{u1, u2} F _inst_1) σ γ (Functor.map.{u1, u2} F (Applicative.toFunctor.{u1, u2} F _inst_1) α (σ -> γ) (Function.comp.{succ u1, succ u1, succ u1} α (β -> γ) (σ -> γ) (flip.{succ u1, succ u1, succ u1} (β -> γ) (σ -> β) (σ -> γ) (fun (x._@.Mathlib.Control.Applicative._hyg.105 : β -> γ) (x._@.Mathlib.Control.Applicative._hyg.107 : σ -> β) => Function.comp.{succ u1, succ u1, succ u1} σ β γ x._@.Mathlib.Control.Applicative._hyg.105 x._@.Mathlib.Control.Applicative._hyg.107) g) f) x) (fun (x._@.Mathlib.Control.Applicative._hyg.124 : Unit) => y))
-Case conversion may be inaccurate. Consider using '#align applicative.map_seq_map Applicative.map_seq_mapₓ'. -/
theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) :
f <$> x <*> g <$> y = (flip (· ∘ ·) g ∘ f) <$> x <*> y := by simp [flip, functor_norm]
#align applicative.map_seq_map Applicative.map_seq_map
-/- warning: applicative.pure_seq_eq_map' -> Applicative.pure_seq_eq_map' is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} F] [_inst_2 : LawfulApplicative.{u1, u2} F _inst_1] {α : Type.{u1}} {β : Type.{u1}} (f : α -> β), Eq.{succ u2} ((F α) -> (F β)) (Seq.seq.{u1, u2} F (Applicative.toHasSeq.{u1, u2} F _inst_1) α β (Pure.pure.{u1, u2} F (Applicative.toHasPure.{u1, u2} F _inst_1) (α -> β) f)) (Functor.map.{u1, u2} F (Applicative.toFunctor.{u1, u2} F _inst_1) α β f)
-but is expected to have type
- forall {F : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} F] [_inst_2 : LawfulApplicative.{u1, u2} F _inst_1] {α : Type.{u1}} {β : Type.{u1}} (f : α -> β), Eq.{succ u2} ((F α) -> (F β)) ((fun (x._@.Mathlib.Control.Applicative._hyg.160 : F (α -> β)) (x._@.Mathlib.Control.Applicative._hyg.162 : F α) => Seq.seq.{u1, u2} F (Applicative.toSeq.{u1, u2} F _inst_1) α β x._@.Mathlib.Control.Applicative._hyg.160 (fun (x._@.Mathlib.Control.Applicative._hyg.175 : Unit) => x._@.Mathlib.Control.Applicative._hyg.162)) (Pure.pure.{u1, u2} F (Applicative.toPure.{u1, u2} F _inst_1) (α -> β) f)) ((fun (x._@.Mathlib.Control.Applicative._hyg.192 : α -> β) (x._@.Mathlib.Control.Applicative._hyg.194 : F α) => Functor.map.{u1, u2} F (Applicative.toFunctor.{u1, u2} F _inst_1) α β x._@.Mathlib.Control.Applicative._hyg.192 x._@.Mathlib.Control.Applicative._hyg.194) f)
-Case conversion may be inaccurate. Consider using '#align applicative.pure_seq_eq_map' Applicative.pure_seq_eq_map'ₓ'. -/
theorem Applicative.pure_seq_eq_map' (f : α → β) : (· <*> ·) (pure f : F (α → β)) = (· <$> ·) f :=
by ext <;> simp [functor_norm]
#align applicative.pure_seq_eq_map' Applicative.pure_seq_eq_map'
-/- warning: applicative.ext -> Applicative.ext is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u2}} {A1 : Applicative.{u1, u2} F} {A2 : Applicative.{u1, u2} F} [_inst_3 : LawfulApplicative.{u1, u2} F A1] [_inst_4 : LawfulApplicative.{u1, u2} F A2], (forall {α : Type.{u1}} (x : α), Eq.{succ u2} (F α) (Pure.pure.{u1, u2} F (Applicative.toHasPure.{u1, u2} F A1) α x) (Pure.pure.{u1, u2} F (Applicative.toHasPure.{u1, u2} F A2) α x)) -> (forall {α : Type.{u1}} {β : Type.{u1}} (f : F (α -> β)) (x : F α), Eq.{succ u2} (F β) (Seq.seq.{u1, u2} F (Applicative.toHasSeq.{u1, u2} F A1) α β f x) (Seq.seq.{u1, u2} F (Applicative.toHasSeq.{u1, u2} F A2) α β f x)) -> (Eq.{max (succ (succ u1)) (succ u2)} (Applicative.{u1, u2} F) A1 A2)
-but is expected to have type
- forall {F : Type.{u2} -> Type.{u1}} {A1 : Applicative.{u2, u1} F} {A2 : Applicative.{u2, u1} F} [_inst_3 : LawfulApplicative.{u2, u1} F A1] [_inst_4 : LawfulApplicative.{u2, u1} F A2], (forall {α : Type.{u2}} (x : α), Eq.{succ u1} (F α) (Pure.pure.{u2, u1} F (Applicative.toPure.{u2, u1} F A1) α x) (Pure.pure.{u2, u1} F (Applicative.toPure.{u2, u1} F A2) α x)) -> (forall {α : Type.{u2}} {β : Type.{u2}} (f : F (α -> β)) (x : F α), Eq.{succ u1} (F β) (Seq.seq.{u2, u1} F (Applicative.toSeq.{u2, u1} F A1) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.293 : Unit) => x)) (Seq.seq.{u2, u1} F (Applicative.toSeq.{u2, u1} F A2) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.306 : Unit) => x))) -> (Eq.{max (succ (succ u2)) (succ u1)} (Applicative.{u2, u1} F) A1 A2)
-Case conversion may be inaccurate. Consider using '#align applicative.ext Applicative.extₓ'. -/
theorem Applicative.ext {F} :
∀ {A1 : Applicative F} {A2 : Applicative F} [@LawfulApplicative F A1] [@LawfulApplicative F A2]
(H1 : ∀ {α : Type u} (x : α), @Pure.pure _ A1.toHasPure _ x = @Pure.pure _ A2.toHasPure _ x)
@@ -118,33 +100,15 @@ theorem map_pure (f : α → β) (x : α) : (f <$> pure x : Comp F G β) = pure
#align functor.comp.map_pure Functor.Comp.map_pure
-/
-/- warning: functor.comp.seq_pure -> Functor.Comp.seq_pure is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (x : α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α β f (Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasPure.{u1, u2, u3} F G _inst_1 _inst_2) α x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (α -> β) β (fun (g : α -> β) => g x) f)
-but is expected to have type
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (x : α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.1006 : Unit) => Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instPureComp.{u1, u2, u3} F G _inst_1 _inst_2) α x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (α -> β) β (fun (g : α -> β) => g x) f)
-Case conversion may be inaccurate. Consider using '#align functor.comp.seq_pure Functor.Comp.seq_pureₓ'. -/
theorem seq_pure (f : Comp F G (α → β)) (x : α) : f <*> pure x = (fun g : α → β => g x) <$> f :=
Comp.ext <| by simp [(· ∘ ·), functor_norm]
#align functor.comp.seq_pure Functor.Comp.seq_pure
-/- warning: functor.comp.seq_assoc -> Functor.Comp.seq_assoc is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} {γ : Type.{u2}} (x : Functor.Comp.{u1, u2, u3} F G α) (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (g : Functor.Comp.{u1, u2, u3} F G (β -> γ)), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G γ) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) β γ g (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α β f x)) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α γ (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) (α -> γ) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (β -> γ) ((α -> β) -> α -> γ) (Function.comp.{succ u2, succ u2, succ u2} α β γ) g) f) x)
-but is expected to have type
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} {γ : Type.{u2}} (x : Functor.Comp.{u1, u2, u3} F G α) (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (g : Functor.Comp.{u1, u2, u3} F G (β -> γ)), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G γ) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) β γ g (fun (x._@.Mathlib.Control.Applicative._hyg.1090 : Unit) => Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.1102 : Unit) => x))) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α γ (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) (α -> γ) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (β -> γ) ((α -> β) -> α -> γ) (Function.comp.{succ u2, succ u2, succ u2} α β γ) g) (fun (x._@.Mathlib.Control.Applicative._hyg.1122 : Unit) => f)) (fun (x._@.Mathlib.Control.Applicative._hyg.1129 : Unit) => x))
-Case conversion may be inaccurate. Consider using '#align functor.comp.seq_assoc Functor.Comp.seq_assocₓ'. -/
theorem seq_assoc (x : Comp F G α) (f : Comp F G (α → β)) (g : Comp F G (β → γ)) :
g <*> (f <*> x) = @Function.comp α β γ <$> g <*> f <*> x :=
Comp.ext <| by simp [(· ∘ ·), functor_norm]
#align functor.comp.seq_assoc Functor.Comp.seq_assoc
-/- warning: functor.comp.pure_seq_eq_map -> Functor.Comp.pure_seq_eq_map is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : α -> β) (x : Functor.Comp.{u1, u2, u3} F G α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (fun {α : Type.{u2}} => Functor.Comp.{u1, u2, u3} F G α) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α β (Pure.pure.{u2, u3} (fun {α : Type.{u2}} => Functor.Comp.{u1, u2, u3} F G α) (Functor.Comp.hasPure.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) f) x) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) α β f x)
-but is expected to have type
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : α -> β) (x : Functor.Comp.{u1, u2, u3} F G α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β (Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instPureComp.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) f) (fun (x._@.Mathlib.Control.Applicative._hyg.1186 : Unit) => x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) α β f x)
-Case conversion may be inaccurate. Consider using '#align functor.comp.pure_seq_eq_map Functor.Comp.pure_seq_eq_mapₓ'. -/
theorem pure_seq_eq_map (f : α → β) (x : Comp F G α) : pure f <*> x = f <$> x :=
Comp.ext <| by simp [Applicative.pure_seq_eq_map', functor_norm]
#align functor.comp.pure_seq_eq_map Functor.Comp.pure_seq_eq_map
@@ -156,24 +120,12 @@ instance : LawfulApplicative (Comp F G)
seq_pure := @Comp.seq_pure F G _ _ _ _
seq_assoc := @Comp.seq_assoc F G _ _ _ _
-/- warning: functor.comp.applicative_id_comp -> Functor.Comp.applicative_id_comp is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u2}} [AF : Applicative.{u1, u2} F] [LF : LawfulApplicative.{u1, u2} F AF], Eq.{max (succ (succ u1)) (succ u2)} (Applicative.{u1, u2} (Functor.Comp.{u2, u1, u2} (id.{succ (succ u2)} Type.{u2}) F)) (Functor.Comp.applicative.{u2, u1, u2} (id.{succ (succ u2)} Type.{u2}) F (Monad.toApplicative.{u2, u2} (id.{succ (succ u2)} Type.{u2}) id.monad.{u2}) AF) AF
-but is expected to have type
- forall {F : Type.{u2} -> Type.{u1}} [AF : Applicative.{u2, u1} F] [LF : LawfulApplicative.{u2, u1} F AF], Eq.{max (succ u1) (succ (succ u2))} (Applicative.{u2, u1} (Functor.Comp.{u1, u2, u1} Id.{u1} F)) (Functor.Comp.instApplicativeComp.{u1, u2, u1} Id.{u1} F (Monad.toApplicative.{u1, u1} Id.{u1} Id.instMonadId.{u1}) AF) AF
-Case conversion may be inaccurate. Consider using '#align functor.comp.applicative_id_comp Functor.Comp.applicative_id_compₓ'. -/
theorem applicative_id_comp {F} [AF : Applicative F] [LF : LawfulApplicative F] :
@Comp.applicative id F _ _ = AF :=
@Applicative.ext F _ _ (@Comp.lawfulApplicative id F _ _ _ _) _ (fun α x => rfl) fun α β f x =>
rfl
#align functor.comp.applicative_id_comp Functor.Comp.applicative_id_comp
-/- warning: functor.comp.applicative_comp_id -> Functor.Comp.applicative_comp_id is a dubious translation:
-lean 3 declaration is
- forall {F : Type.{u1} -> Type.{u2}} [AF : Applicative.{u1, u2} F] [LF : LawfulApplicative.{u1, u2} F AF], Eq.{max (succ (succ u1)) (succ u2)} (Applicative.{u1, u2} (Functor.Comp.{u1, u1, u2} F (id.{succ (succ u1)} Type.{u1}))) (Functor.Comp.applicative.{u1, u1, u2} F (id.{succ (succ u1)} Type.{u1}) AF (Monad.toApplicative.{u1, u1} (id.{succ (succ u1)} Type.{u1}) id.monad.{u1})) AF
-but is expected to have type
- forall {F : Type.{u2} -> Type.{u1}} [AF : Applicative.{u2, u1} F] [LF : LawfulApplicative.{u2, u1} F AF], Eq.{max (succ u1) (succ (succ u2))} (Applicative.{u2, u1} (Functor.Comp.{u2, u2, u1} F Id.{u2})) (Functor.Comp.instApplicativeComp.{u2, u2, u1} F Id.{u2} AF (Monad.toApplicative.{u2, u2} Id.{u2} Id.instMonadId.{u2})) AF
-Case conversion may be inaccurate. Consider using '#align functor.comp.applicative_comp_id Functor.Comp.applicative_comp_idₓ'. -/
theorem applicative_comp_id {F} [AF : Applicative F] [LF : LawfulApplicative F] :
@Comp.applicative F id _ _ = AF :=
@Applicative.ext F _ _ (@Comp.lawfulApplicative F id _ _ _ _) _ (fun α x => rfl) fun α β f x =>
@@ -197,12 +149,6 @@ end Functor
open Functor
-/- warning: comp.seq_mk -> Comp.seq_mk is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u3}} {β : Type.{u3}} {f : Type.{u1} -> Type.{u2}} {g : Type.{u3} -> Type.{u1}} [_inst_1 : Applicative.{u1, u2} f] [_inst_2 : Applicative.{u3, u1} g] (h : f (g (α -> β))) (x : f (g α)), Eq.{succ u2} (Functor.Comp.{u1, u3, u2} f g β) (Seq.seq.{u3, u2} (Functor.Comp.{u1, u3, u2} f g) (Functor.Comp.hasSeq.{u1, u3, u2} f g _inst_1 _inst_2) α β (Functor.Comp.mk.{u1, u3, u2} f g (α -> β) h) (Functor.Comp.mk.{u1, u3, u2} f g α x)) (Functor.Comp.mk.{u1, u3, u2} f g β (Seq.seq.{u1, u2} f (Applicative.toHasSeq.{u1, u2} f _inst_1) (g α) (g β) (Functor.map.{u1, u2} f (Applicative.toFunctor.{u1, u2} f _inst_1) (g (α -> β)) ((g α) -> (g β)) (Seq.seq.{u3, u1} g (Applicative.toHasSeq.{u3, u1} g _inst_2) α β) h) x))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u3}} {f : Type.{u1} -> Type.{u2}} {g : Type.{u3} -> Type.{u1}} [_inst_1 : Applicative.{u1, u2} f] [_inst_2 : Applicative.{u3, u1} g] (h : f (g (α -> β))) (x : f (g α)), Eq.{succ u2} (Functor.Comp.{u1, u3, u2} f g β) (Seq.seq.{u3, u2} (Functor.Comp.{u1, u3, u2} f g) (Functor.Comp.instSeqComp.{u1, u3, u2} f g _inst_1 _inst_2) α β (Functor.Comp.mk.{u1, u3, u2} f g (α -> β) h) (fun (x._@.Mathlib.Control.Applicative._hyg.1734 : Unit) => Functor.Comp.mk.{u1, u3, u2} f g α x)) (Functor.Comp.mk.{u1, u3, u2} f g β (Seq.seq.{u1, u2} f (Applicative.toSeq.{u1, u2} f _inst_1) (g α) (g β) (Functor.map.{u1, u2} f (Applicative.toFunctor.{u1, u2} f _inst_1) (g (α -> β)) ((g α) -> (g β)) (fun (x._@.Mathlib.Control.Applicative._hyg.1750 : g (α -> β)) (x._@.Mathlib.Control.Applicative._hyg.1752 : g α) => Seq.seq.{u3, u1} g (Applicative.toSeq.{u3, u1} g _inst_2) α β x._@.Mathlib.Control.Applicative._hyg.1750 (fun (x._@.Mathlib.Control.Applicative._hyg.1765 : Unit) => x._@.Mathlib.Control.Applicative._hyg.1752)) h) (fun (x._@.Mathlib.Control.Applicative._hyg.1773 : Unit) => x)))
-Case conversion may be inaccurate. Consider using '#align comp.seq_mk Comp.seq_mkₓ'. -/
@[functor_norm]
theorem Comp.seq_mk {α β : Type w} {f : Type u → Type v} {g : Type w → Type u} [Applicative f]
[Applicative g] (h : f (g (α → β))) (x : f (g α)) :
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -81,18 +81,11 @@ theorem Applicative.ext {F} :
seqLeft := sl2
seqRight := sr2 }, L1, L2, H1, H2 =>
by
- obtain rfl : @p1 = @p2 := by
- funext α x
- apply H1
- obtain rfl : @s1 = @s2 := by
- funext α β f x
- apply H2
- cases L1
- cases L2
+ obtain rfl : @p1 = @p2 := by funext α x; apply H1
+ obtain rfl : @s1 = @s2 := by funext α β f x; apply H2
+ cases L1; cases L2
obtain rfl : F1 = F2 := by
- skip
- apply Functor.ext
- intros
+ skip; apply Functor.ext; intros
exact (L1_pure_seq_eq_map _ _).symm.trans (L2_pure_seq_eq_map _ _)
congr <;> funext α β x y
· exact (L1_seq_left_eq _ _).trans (L2_seq_left_eq _ _).symm
@@ -193,15 +186,10 @@ instance {f : Type u → Type w} {g : Type v → Type u} [Applicative f] [Applic
[CommApplicative f] [CommApplicative g] : CommApplicative (Comp f g) :=
by
refine' { @comp.is_lawful_applicative f g _ _ _ _ with .. }
- intros
- casesm*comp _ _ _
- simp! [map, Seq.seq, functor_norm]
+ intros ; casesm*comp _ _ _; simp! [map, Seq.seq, functor_norm]
rw [commutative_map]
simp [comp.mk, flip, (· ∘ ·), functor_norm]
- congr
- funext
- rw [commutative_map]
- congr
+ congr ; funext; rw [commutative_map]; congr
end Comp
mathlib commit https://github.com/leanprover-community/mathlib/commit/95a87616d63b3cb49d3fe678d416fbe9c4217bf4
@@ -129,7 +129,7 @@ theorem map_pure (f : α → β) (x : α) : (f <$> pure x : Comp F G β) = pure
lean 3 declaration is
forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (x : α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α β f (Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasPure.{u1, u2, u3} F G _inst_1 _inst_2) α x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (α -> β) β (fun (g : α -> β) => g x) f)
but is expected to have type
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (x : α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.1000 : Unit) => Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instPureComp.{u1, u2, u3} F G _inst_1 _inst_2) α x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (α -> β) β (fun (g : α -> β) => g x) f)
+ forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (x : α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.1006 : Unit) => Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instPureComp.{u1, u2, u3} F G _inst_1 _inst_2) α x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (α -> β) β (fun (g : α -> β) => g x) f)
Case conversion may be inaccurate. Consider using '#align functor.comp.seq_pure Functor.Comp.seq_pureₓ'. -/
theorem seq_pure (f : Comp F G (α → β)) (x : α) : f <*> pure x = (fun g : α → β => g x) <$> f :=
Comp.ext <| by simp [(· ∘ ·), functor_norm]
@@ -139,7 +139,7 @@ theorem seq_pure (f : Comp F G (α → β)) (x : α) : f <*> pure x = (fun g :
lean 3 declaration is
forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} {γ : Type.{u2}} (x : Functor.Comp.{u1, u2, u3} F G α) (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (g : Functor.Comp.{u1, u2, u3} F G (β -> γ)), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G γ) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) β γ g (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α β f x)) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α γ (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) (α -> γ) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (β -> γ) ((α -> β) -> α -> γ) (Function.comp.{succ u2, succ u2, succ u2} α β γ) g) f) x)
but is expected to have type
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} {γ : Type.{u2}} (x : Functor.Comp.{u1, u2, u3} F G α) (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (g : Functor.Comp.{u1, u2, u3} F G (β -> γ)), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G γ) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) β γ g (fun (x._@.Mathlib.Control.Applicative._hyg.1084 : Unit) => Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.1096 : Unit) => x))) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α γ (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) (α -> γ) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (β -> γ) ((α -> β) -> α -> γ) (Function.comp.{succ u2, succ u2, succ u2} α β γ) g) (fun (x._@.Mathlib.Control.Applicative._hyg.1116 : Unit) => f)) (fun (x._@.Mathlib.Control.Applicative._hyg.1123 : Unit) => x))
+ forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} {γ : Type.{u2}} (x : Functor.Comp.{u1, u2, u3} F G α) (f : Functor.Comp.{u1, u2, u3} F G (α -> β)) (g : Functor.Comp.{u1, u2, u3} F G (β -> γ)), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G γ) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) β γ g (fun (x._@.Mathlib.Control.Applicative._hyg.1090 : Unit) => Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β f (fun (x._@.Mathlib.Control.Applicative._hyg.1102 : Unit) => x))) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α γ (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) (α -> γ) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) (β -> γ) ((α -> β) -> α -> γ) (Function.comp.{succ u2, succ u2, succ u2} α β γ) g) (fun (x._@.Mathlib.Control.Applicative._hyg.1122 : Unit) => f)) (fun (x._@.Mathlib.Control.Applicative._hyg.1129 : Unit) => x))
Case conversion may be inaccurate. Consider using '#align functor.comp.seq_assoc Functor.Comp.seq_assocₓ'. -/
theorem seq_assoc (x : Comp F G α) (f : Comp F G (α → β)) (g : Comp F G (β → γ)) :
g <*> (f <*> x) = @Function.comp α β γ <$> g <*> f <*> x :=
@@ -150,7 +150,7 @@ theorem seq_assoc (x : Comp F G α) (f : Comp F G (α → β)) (g : Comp F G (β
lean 3 declaration is
forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : α -> β) (x : Functor.Comp.{u1, u2, u3} F G α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (fun {α : Type.{u2}} => Functor.Comp.{u1, u2, u3} F G α) (Functor.Comp.hasSeq.{u1, u2, u3} F G _inst_1 _inst_2) α β (Pure.pure.{u2, u3} (fun {α : Type.{u2}} => Functor.Comp.{u1, u2, u3} F G α) (Functor.Comp.hasPure.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) f) x) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) α β f x)
but is expected to have type
- forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : α -> β) (x : Functor.Comp.{u1, u2, u3} F G α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β (Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instPureComp.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) f) (fun (x._@.Mathlib.Control.Applicative._hyg.1180 : Unit) => x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) α β f x)
+ forall {F : Type.{u1} -> Type.{u3}} {G : Type.{u2} -> Type.{u1}} [_inst_1 : Applicative.{u1, u3} F] [_inst_2 : Applicative.{u2, u1} G] [_inst_3 : LawfulApplicative.{u1, u3} F _inst_1] [_inst_4 : LawfulApplicative.{u2, u1} G _inst_2] {α : Type.{u2}} {β : Type.{u2}} (f : α -> β) (x : Functor.Comp.{u1, u2, u3} F G α), Eq.{succ u3} (Functor.Comp.{u1, u2, u3} F G β) (Seq.seq.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instSeqComp.{u1, u2, u3} F G _inst_1 _inst_2) α β (Pure.pure.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.instPureComp.{u1, u2, u3} F G _inst_1 _inst_2) (α -> β) f) (fun (x._@.Mathlib.Control.Applicative._hyg.1186 : Unit) => x)) (Functor.map.{u2, u3} (Functor.Comp.{u1, u2, u3} F G) (Functor.Comp.functor.{u1, u2, u3} F G (Applicative.toFunctor.{u1, u3} F _inst_1) (Applicative.toFunctor.{u2, u1} G _inst_2)) α β f x)
Case conversion may be inaccurate. Consider using '#align functor.comp.pure_seq_eq_map Functor.Comp.pure_seq_eq_mapₓ'. -/
theorem pure_seq_eq_map (f : α → β) (x : Comp F G α) : pure f <*> x = f <$> x :=
Comp.ext <| by simp [Applicative.pure_seq_eq_map', functor_norm]
@@ -213,7 +213,7 @@ open Functor
lean 3 declaration is
forall {α : Type.{u3}} {β : Type.{u3}} {f : Type.{u1} -> Type.{u2}} {g : Type.{u3} -> Type.{u1}} [_inst_1 : Applicative.{u1, u2} f] [_inst_2 : Applicative.{u3, u1} g] (h : f (g (α -> β))) (x : f (g α)), Eq.{succ u2} (Functor.Comp.{u1, u3, u2} f g β) (Seq.seq.{u3, u2} (Functor.Comp.{u1, u3, u2} f g) (Functor.Comp.hasSeq.{u1, u3, u2} f g _inst_1 _inst_2) α β (Functor.Comp.mk.{u1, u3, u2} f g (α -> β) h) (Functor.Comp.mk.{u1, u3, u2} f g α x)) (Functor.Comp.mk.{u1, u3, u2} f g β (Seq.seq.{u1, u2} f (Applicative.toHasSeq.{u1, u2} f _inst_1) (g α) (g β) (Functor.map.{u1, u2} f (Applicative.toFunctor.{u1, u2} f _inst_1) (g (α -> β)) ((g α) -> (g β)) (Seq.seq.{u3, u1} g (Applicative.toHasSeq.{u3, u1} g _inst_2) α β) h) x))
but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u3}} {f : Type.{u1} -> Type.{u2}} {g : Type.{u3} -> Type.{u1}} [_inst_1 : Applicative.{u1, u2} f] [_inst_2 : Applicative.{u3, u1} g] (h : f (g (α -> β))) (x : f (g α)), Eq.{succ u2} (Functor.Comp.{u1, u3, u2} f g β) (Seq.seq.{u3, u2} (Functor.Comp.{u1, u3, u2} f g) (Functor.Comp.instSeqComp.{u1, u3, u2} f g _inst_1 _inst_2) α β (Functor.Comp.mk.{u1, u3, u2} f g (α -> β) h) (fun (x._@.Mathlib.Control.Applicative._hyg.1722 : Unit) => Functor.Comp.mk.{u1, u3, u2} f g α x)) (Functor.Comp.mk.{u1, u3, u2} f g β (Seq.seq.{u1, u2} f (Applicative.toSeq.{u1, u2} f _inst_1) (g α) (g β) (Functor.map.{u1, u2} f (Applicative.toFunctor.{u1, u2} f _inst_1) (g (α -> β)) ((g α) -> (g β)) (fun (x._@.Mathlib.Control.Applicative._hyg.1738 : g (α -> β)) (x._@.Mathlib.Control.Applicative._hyg.1740 : g α) => Seq.seq.{u3, u1} g (Applicative.toSeq.{u3, u1} g _inst_2) α β x._@.Mathlib.Control.Applicative._hyg.1738 (fun (x._@.Mathlib.Control.Applicative._hyg.1753 : Unit) => x._@.Mathlib.Control.Applicative._hyg.1740)) h) (fun (x._@.Mathlib.Control.Applicative._hyg.1761 : Unit) => x)))
+ forall {α : Type.{u3}} {β : Type.{u3}} {f : Type.{u1} -> Type.{u2}} {g : Type.{u3} -> Type.{u1}} [_inst_1 : Applicative.{u1, u2} f] [_inst_2 : Applicative.{u3, u1} g] (h : f (g (α -> β))) (x : f (g α)), Eq.{succ u2} (Functor.Comp.{u1, u3, u2} f g β) (Seq.seq.{u3, u2} (Functor.Comp.{u1, u3, u2} f g) (Functor.Comp.instSeqComp.{u1, u3, u2} f g _inst_1 _inst_2) α β (Functor.Comp.mk.{u1, u3, u2} f g (α -> β) h) (fun (x._@.Mathlib.Control.Applicative._hyg.1734 : Unit) => Functor.Comp.mk.{u1, u3, u2} f g α x)) (Functor.Comp.mk.{u1, u3, u2} f g β (Seq.seq.{u1, u2} f (Applicative.toSeq.{u1, u2} f _inst_1) (g α) (g β) (Functor.map.{u1, u2} f (Applicative.toFunctor.{u1, u2} f _inst_1) (g (α -> β)) ((g α) -> (g β)) (fun (x._@.Mathlib.Control.Applicative._hyg.1750 : g (α -> β)) (x._@.Mathlib.Control.Applicative._hyg.1752 : g α) => Seq.seq.{u3, u1} g (Applicative.toSeq.{u3, u1} g _inst_2) α β x._@.Mathlib.Control.Applicative._hyg.1750 (fun (x._@.Mathlib.Control.Applicative._hyg.1765 : Unit) => x._@.Mathlib.Control.Applicative._hyg.1752)) h) (fun (x._@.Mathlib.Control.Applicative._hyg.1773 : Unit) => x)))
Case conversion may be inaccurate. Consider using '#align comp.seq_mk Comp.seq_mkₓ'. -/
@[functor_norm]
theorem Comp.seq_mk {α β : Type w} {f : Type u → Type v} {g : Type w → Type u} [Applicative f]
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)
@@ -25,9 +25,7 @@ section Lemmas
open Function
variable {F : Type u → Type v}
-
variable [Applicative F] [LawfulApplicative F]
-
variable {α β γ σ : Type u}
theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) :
@@ -84,11 +82,8 @@ open Function hiding comp
open Functor
variable {F : Type u → Type w} {G : Type v → Type u}
-
variable [Applicative F] [Applicative G]
-
variable [LawfulApplicative F] [LawfulApplicative G]
-
variable {α β γ : Type v}
theorem map_pure (f : α → β) (x : α) : (f <$> pure x : Comp F G β) = pure (f x) :=
(· op ·) a
by (a op ·)
(#8843)
I used the regex \(\(· (.) ·\) (.)\)
, replacing with ($2 $1 ·)
.
@@ -31,11 +31,11 @@ variable [Applicative F] [LawfulApplicative F]
variable {α β γ σ : Type u}
theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) :
- f <$> x <*> g <$> y = (flip (· ∘ ·) g ∘ f) <$> x <*> y := by
+ f <$> x <*> g <$> y = ((· ∘ g) ∘ f) <$> x <*> y := by
simp [flip, functor_norm]
#align applicative.map_seq_map Applicative.map_seq_map
-theorem Applicative.pure_seq_eq_map' (f : α → β) : (· <*> ·) (pure f : F (α → β)) = (· <$> ·) f :=
+theorem Applicative.pure_seq_eq_map' (f : α → β) : ((pure f : F (α → β)) <*> ·) = (f <$> ·) :=
by ext; simp [functor_norm]
#align applicative.pure_seq_eq_map' Applicative.pure_seq_eq_map'
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -31,7 +31,8 @@ variable [Applicative F] [LawfulApplicative F]
variable {α β γ σ : Type u}
theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) :
- f <$> x <*> g <$> y = (flip (· ∘ ·) g ∘ f) <$> x <*> y := by simp [flip, functor_norm]
+ f <$> x <*> g <$> y = (flip (· ∘ ·) g ∘ f) <$> x <*> y := by
+ simp [flip, functor_norm]
#align applicative.map_seq_map Applicative.map_seq_map
theorem Applicative.pure_seq_eq_map' (f : α → β) : (· <*> ·) (pure f : F (α → β)) = (· <$> ·) f :=
Removes nonterminal simps on lines looking like simp [...]
@@ -138,7 +138,7 @@ instance {f : Type u → Type w} {g : Type v → Type u} [Applicative f] [Applic
intros
simp! [map, Seq.seq, functor_norm]
rw [commutative_map]
- simp [Comp.mk, flip, (· ∘ ·), functor_norm]
+ simp only [mk, flip, seq_map_assoc, Function.comp, map_map]
congr
funext x y
rw [commutative_map]
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -108,7 +108,7 @@ theorem pure_seq_eq_map (f : α → β) (x : Comp F G α) : pure f <*> x = f <$>
#align functor.comp.pure_seq_eq_map Functor.Comp.pure_seq_eq_map
-- TODO: the first two results were handled by `control_laws_tac` in mathlib3
-instance : LawfulApplicative (Comp F G) where
+instance instLawfulApplicativeComp : LawfulApplicative (Comp F G) where
seqLeft_eq := by intros; rfl
seqRight_eq := by intros; rfl
pure_seq := @Comp.pure_seq_eq_map F G _ _ _ _
@@ -120,13 +120,13 @@ instance : LawfulApplicative (Comp F G) where
theorem applicative_id_comp {F} [AF : Applicative F] [LawfulApplicative F] :
@instApplicativeComp Id F _ _ = AF :=
- @Applicative.ext F _ _ (@instLawfulApplicativeCompInstApplicativeComp Id F _ _ _ _) _
+ @Applicative.ext F _ _ (@instLawfulApplicativeComp Id F _ _ _ _) _
(fun _ => rfl) (fun _ _ => rfl)
#align functor.comp.applicative_id_comp Functor.Comp.applicative_id_comp
theorem applicative_comp_id {F} [AF : Applicative F] [LawfulApplicative F] :
@Comp.instApplicativeComp F Id _ _ = AF :=
- @Applicative.ext F _ _ (@Comp.instLawfulApplicativeCompInstApplicativeComp F Id _ _ _ _) _
+ @Applicative.ext F _ _ (@Comp.instLawfulApplicativeComp F Id _ _ _ _) _
(fun _ => rfl) (fun f x => show id <$> f <*> x = f <*> x by rw [id_map])
#align functor.comp.applicative_comp_id Functor.Comp.applicative_comp_id
@@ -134,7 +134,7 @@ open CommApplicative
instance {f : Type u → Type w} {g : Type v → Type u} [Applicative f] [Applicative g]
[CommApplicative f] [CommApplicative g] : CommApplicative (Comp f g) := by
- refine' { @instLawfulApplicativeCompInstApplicativeComp f g _ _ _ _ with .. }
+ refine' { @instLawfulApplicativeComp f g _ _ _ _ with .. }
intros
simp! [map, Seq.seq, functor_norm]
rw [commutative_map]
@@ -2,15 +2,12 @@
Copyright (c) 2017 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.applicative
-! leanprover-community/mathlib commit 70d50ecfd4900dd6d328da39ab7ebd516abe4025
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.Group.Defs
import Mathlib.Control.Functor
+#align_import control.applicative from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
+
/-!
# `applicative` instances
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".
@@ -48,8 +48,8 @@ theorem Applicative.ext {F} :
@Seq.seq _ A1.toSeq _ _ f (fun _ => x) = @Seq.seq _ A2.toSeq _ _ f (fun _ => x)) →
A1 = A2
| { toFunctor := F1, seq := s1, pure := p1, seqLeft := sl1, seqRight := sr1 },
- { toFunctor := F2, seq := s2, pure := p2, seqLeft := sl2, seqRight := sr2 }, L1, L2, H1, H2 =>
- by
+ { toFunctor := F2, seq := s2, pure := p2, seqLeft := sl2, seqRight := sr2 },
+ L1, L2, H1, H2 => by
obtain rfl : @p1 = @p2 := by
funext α x
apply H1
This PR fixes two things:
align
statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align
). This is often seen in the mathport output after ending calc
blocks.#align
statements. (This was needed for a script I wrote for #3630.)@@ -65,7 +65,6 @@ theorem Applicative.ext {F} :
congr <;> funext α β x y
· exact (seqLeft_eq1 _ (y Unit.unit)).trans (seqLeft_eq2 _ _).symm
· exact (seqRight_eq1 _ (y Unit.unit)).trans (seqRight_eq2 _ (y Unit.unit)).symm
-
#align applicative.ext Applicative.ext
end Lemmas
@@ -14,11 +14,11 @@ import Mathlib.Control.Functor
/-!
# `applicative` instances
-This file provides `applicative` instances for concrete functors:
+This file provides `Applicative` instances for concrete functors:
* `id`
-* `functor.comp`
-* `functor.const`
-* `functor.add_const`
+* `Functor.comp`
+* `Functor.const`
+* `Functor.add_const`
-/
universe u v w
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) 2017 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.applicative
+! leanprover-community/mathlib commit 70d50ecfd4900dd6d328da39ab7ebd516abe4025
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Algebra.Group.Defs
import Mathlib.Control.Functor
All dependencies are ported!