summaryrefslogtreecommitdiff
path: root/Nominal
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-10-23 22:32:44 +0200
committerHannes Schulze <haschu0103@outlook.de>2025-10-23 22:32:44 +0200
commit4cb79d58996f2601f886a7185e89fa6dd71579e1 (patch)
treec47f846649a2b9e7fddab12ecd3f30f1e79e64b8 /Nominal
parentf95c4f2bd8a88c4b4b35e77fc45f0f1036d10c9e (diff)
add forgetful functors
Diffstat (limited to 'Nominal')
-rw-r--r--Nominal/Category.lean41
-rw-r--r--Nominal/Equivariance.lean52
2 files changed, 82 insertions, 11 deletions
diff --git a/Nominal/Category.lean b/Nominal/Category.lean
index fc7e161..9ee4fe3 100644
--- a/Nominal/Category.lean
+++ b/Nominal/Category.lean
@@ -11,6 +11,8 @@ This file contains formalizations for this category-theoretical view.
variable (๐”ธ : Type) [Infinite ๐”ธ] [Countable ๐”ธ] [DecidableEq ๐”ธ]
+open CategoryTheory
+
/-!
## Category Definition
@@ -27,17 +29,40 @@ structure Nom where
attribute [instance] Nom.nom
+/-- Objects in Nom can be coerced to the underlying nominal set type. -/
+instance : CoeSort (Nom ๐”ธ) Type := โŸจNom.carrierโŸฉ
+
/-- A morphism in the category of nominal sets; i.e., an equivariant function. -/
-structure Nom.Hom (X Y : Nom ๐”ธ) where
- /-- The underlying function. -/
- toFun : X.carrier โ†’ Y.carrier
- /-- Equivariance of the function. -/
- equivariant : Equivariant ๐”ธ toFun
+def Nom.Hom (X Y : Nom ๐”ธ) := X โ†’โ‚‘[๐”ธ] Y
+
+/-- Coerce morphisms to functions between the underlying sets. -/
+instance (X Y : Nom ๐”ธ) : CoeFun (Nom.Hom ๐”ธ X Y) (fun _ => X.carrier โ†’ Y.carrier) where
+ coe f := f.toFun
/-- Nominal sets form a category with equivariant functions as morphisms. -/
-instance : CategoryTheory.Category (Nom ๐”ธ) where
+instance : Category (Nom ๐”ธ) where
Hom := Nom.Hom ๐”ธ
- id X := โŸจid, id_equivariant ๐”ธโŸฉ
- comp f g := โŸจg.toFun โˆ˜ f.toFun, comp_equivariant ๐”ธ f.equivariant g.equivariantโŸฉ
+ id X := EquivariantMap.id ๐”ธ
+ comp f g := EquivariantMap.comp ๐”ธ g f
end Definition
+
+/-!
+## Forgetful Functors
+
+Definitions of forgetful functors from the Nom category.
+-/
+section Forget
+
+/-- The Nom category is a ConcreteCategory where objects correspond to types. -/
+instance : ConcreteCategory (Nom ๐”ธ) (ยท โ†’โ‚‘[๐”ธ] ยท) where
+ hom := id
+ ofHom := id
+
+/-- There is a forgetful functor from Nom to the category of monoidal actions. -/
+instance : HasForgetโ‚‚ (Nom ๐”ธ) (Action Type (FPerm ๐”ธ)) where
+ forgetโ‚‚ :=
+ { obj X := Action.ofMulAction (FPerm ๐”ธ) X.carrier
+ map {X Y} f := โŸจf.toFun, by intro ฯ€; ext x; simp; apply f.equivariantโŸฉ }
+
+end Forget
diff --git a/Nominal/Equivariance.lean b/Nominal/Equivariance.lean
index c9a5261..ac50519 100644
--- a/Nominal/Equivariance.lean
+++ b/Nominal/Equivariance.lean
@@ -71,11 +71,11 @@ lemma id_equivariant : Equivariant ๐”ธ (id : X โ†’ X) := by
simp [Equivariant]
/-- The composition of two equivariant functions is equivariant. -/
-lemma comp_equivariant {f : X โ†’ Y} {g : Y โ†’ Z} : Equivariant ๐”ธ f โ†’ Equivariant ๐”ธ g โ†’ Equivariant ๐”ธ (g โˆ˜ f) := by
+lemma comp_equivariant {f : Y โ†’ Z} {g : X โ†’ Y} : Equivariant ๐”ธ f โ†’ Equivariant ๐”ธ g โ†’ Equivariant ๐”ธ (f โˆ˜ g) := by
intro hf hg x ฯ€
calc
- g (f (ฯ€ โ€ข x)) = g (ฯ€ โ€ข f x) := by rw [hf]
- _ = ฯ€ โ€ข (g (f x)) := by rw [hg]
+ f (g (ฯ€ โ€ข x)) = f (ฯ€ โ€ข g x) := by rw [hg]
+ _ = ฯ€ โ€ข (f (g x)) := by rw [hf]
/-- The subset relation is equivariant. -/
lemma subset_equivariant : EquivariantRelation ๐”ธ (Set.Subset : Set X โ†’ Set X โ†’ Prop) := by
@@ -183,3 +183,49 @@ lemma NominalSet.supp_equivariant : Equivariant ๐”ธ (supp ๐”ธ : X โ†’ Set ๐”ธ
exact hS.out.right
end Nominal
+
+/-!
+## Bundled Functions
+
+In the following, we also define a bundled function type for equivariant functions.
+-/
+section BundledFunction
+
+/-- A function carrying a proof of its equivariance. -/
+structure EquivariantMap (X Y : Type) [PermSet ๐”ธ X] [PermSet ๐”ธ Y] where
+ /-- The underlying function. -/
+ toFun : X โ†’ Y
+ /-- Proof of equivariance. -/
+ equivariant : Equivariant ๐”ธ toFun
+
+/-- We write `X โ†’โ‚‘ Y` or `X โ†’โ‚‘[๐”ธ] Y` for an equivariant map X โ†’ Y. -/
+infixr:25 " โ†’โ‚‘ " => EquivariantMap _
+
+/-- We write `X โ†’โ‚‘ Y` or `X โ†’โ‚‘[๐”ธ] Y` for an equivariant map X โ†’ Y. -/
+notation:25 X " โ†’โ‚‘[" A "] " Y => EquivariantMap A X Y
+
+variable {X Y Z : Type} [PermSet ๐”ธ X] [PermSet ๐”ธ Y] [PermSet ๐”ธ Z]
+
+instance : FunLike (X โ†’โ‚‘[๐”ธ] Y) X Y where
+ coe := EquivariantMap.toFun
+ coe_injective' f g h := by cases f; cases g; congr
+
+namespace EquivariantMap
+
+/-- The identity function. -/
+def id : X โ†’โ‚‘[๐”ธ] X := โŸจ_root_.id, id_equivariant ๐”ธโŸฉ
+
+/-- Function composition. -/
+def comp (f : Y โ†’โ‚‘[๐”ธ] Z) (g : X โ†’โ‚‘[๐”ธ] Y) : X โ†’โ‚‘[๐”ธ] Z := โŸจf โˆ˜ g, comp_equivariant ๐”ธ f.equivariant g.equivariantโŸฉ
+
+@[simp]
+lemma toFun_eq_coe {f : X โ†’โ‚‘[๐”ธ] Y} : f.toFun = (f : X โ†’ Y) :=
+ rfl
+
+@[ext]
+lemma ext {f g : X โ†’โ‚‘[๐”ธ] Y} (h : โˆ€ a, f a = g a) : f = g :=
+ DFunLike.ext _ _ h
+
+end EquivariantMap
+
+end BundledFunction