Skip to content

Commit 5e62b58

Browse files
committed
feat: add LaxMonoidal instance for Applicative functors (leanprover-community#30407)
Since similar conversions exist for `Functor`s and `Monad`s.
1 parent 5207100 commit 5e62b58

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,6 +2616,7 @@ import Mathlib.CategoryTheory.Monoidal.ExternalProduct.KanExtension
26162616
import Mathlib.CategoryTheory.Monoidal.Free.Basic
26172617
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
26182618
import Mathlib.CategoryTheory.Monoidal.Functor
2619+
import Mathlib.CategoryTheory.Monoidal.Functor.Types
26192620
import Mathlib.CategoryTheory.Monoidal.FunctorCategory
26202621
import Mathlib.CategoryTheory.Monoidal.Grp_
26212622
import Mathlib.CategoryTheory.Monoidal.Hopf_
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/-
2+
Copyright (c) 2025 Vilim Lendvaj. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Vilim Lendvaj
5+
-/
6+
import Mathlib.CategoryTheory.Monoidal.Functor
7+
import Mathlib.CategoryTheory.Monoidal.Types.Basic
8+
import Mathlib.CategoryTheory.Types.Basic
9+
import Mathlib.Tactic.Simps.Basic
10+
11+
/-!
12+
# Convert from `Applicative` to `CategoryTheory.Functor.LaxMonoidal`
13+
14+
This allows us to use Lean's `Type`-based applicative functors in category theory.
15+
16+
-/
17+
18+
namespace CategoryTheory
19+
20+
section
21+
22+
variable (F : Type* → Type*) [Applicative F] [LawfulApplicative F]
23+
24+
attribute [local simp] map_seq seq_map_assoc
25+
LawfulApplicative.pure_seq LawfulApplicative.seq_assoc in
26+
/-- A lawful `Applicative` gives a category theory `LaxMonoidal` functor
27+
between categories of types. -/
28+
@[simps]
29+
instance : (ofTypeFunctor F).LaxMonoidal where
30+
ε _ : F _ := pure PUnit.unit
31+
μ _ _ p : F _ := Prod.mk <$> p.1 <*> p.2
32+
33+
end
34+
35+
end CategoryTheory

0 commit comments

Comments
 (0)