-
Notifications
You must be signed in to change notification settings - Fork 251
/
Functor.lean
44 lines (31 loc) · 1023 Bytes
/
Functor.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/-
Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Simon Hudon, Scott Morrison
-/
import Mathlib.Control.Basic
import Mathlib.Logic.Equiv.Defs
/-!
# Functors can be applied to `Equiv`s.
```
def Functor.mapEquiv (f : Type u → Type v) [functor f] [LawfulFunctor f] :
α ≃ β → f α ≃ f β
```
-/
open Equiv
namespace Functor
universe u v
variable (f : Type u → Type v) [Functor f] [LawfulFunctor f]
/-- Apply a functor to an `Equiv`. -/
def map_equiv {α β : Type u} (h : α ≃ β) : f α ≃ f β where
toFun := map h
invFun := map h.symm
left_inv x := by simp [map_map]
right_inv x := by simp [map_map]
variable {α β : Type u}
@[simp]
lemma map_equiv_apply (h : α ≃ β) (x : f α) : (map_equiv f h : f α ≃ f β) x = map h x := rfl
@[simp]
lemma map_equiv_symm_apply (h : α ≃ β) (y : f β) :
(map_equiv f h : f α ≃ f β).symm y = map h.symm y := rfl
end Functor