summaryrefslogtreecommitdiff
path: root/Nominal/Instances
diff options
context:
space:
mode:
Diffstat (limited to 'Nominal/Instances')
-rw-r--r--Nominal/Instances/Basic.lean60
1 files changed, 60 insertions, 0 deletions
diff --git a/Nominal/Instances/Basic.lean b/Nominal/Instances/Basic.lean
index 64b6425..b627c1b 100644
--- a/Nominal/Instances/Basic.lean
+++ b/Nominal/Instances/Basic.lean
@@ -238,6 +238,66 @@ end Sum
end Coproducts
/-!
+## Finitary Functions
+
+We can view functions with a finite domain as a finite product. As such, if the codomain is a
+nominal set, the set of such functions is itself a nominal set, where supp f = ⋃₀ {supp (f x) | x}.
+-/
+section FinitaryFunctions
+
+namespace Function
+
+instance {X Y : Type} [Fintype X] [PermSet 𝔸 Y] : PermSet 𝔸 (X → Y) where
+
+variable {X Y : Type} [Fintype X] [NominalSet 𝔸 Y]
+
+private lemma supp' {f : X → Y} : PermSet.HasSupport 𝔸 f (⋃₀ {NominalSet.supp 𝔸 (f x) | x : X}) := by
+ intro π hπ
+ ext x; rw [Pi.smul_apply]
+ show π ∈ PermSet.fix' 𝔸 (f x)
+ apply NominalSet.supp_is_support
+ apply PermSet.fix_antitone_mem 𝔸 hπ
+ apply Set.subset_sUnion_of_mem
+ use x
+
+private lemma fin {f : X → Y} : (⋃₀ {NominalSet.supp 𝔸 (f x) | x : X}).Finite := by
+ apply Set.Finite.sUnion
+ · simp only [Set.setOf_exists, Set.setOf_eq_eq_singleton', Set.iUnion_singleton_eq_range]
+ apply Set.finite_range
+ · intro S ⟨x, hS⟩
+ rw [← hS]
+ apply NominalSet.supp_finite
+
+instance : NominalSet 𝔸 (X → Y) where
+ fin_supp := by
+ intro f; use ⋃₀ {NominalSet.supp 𝔸 (f x) | x : X}
+ exact ⟨supp' 𝔸, fin 𝔸⟩
+
+@[simp] lemma supp {f : X → Y} : NominalSet.supp 𝔸 f = ⋃₀ {NominalSet.supp 𝔸 (f x) | x : X} := by
+ ext a; constructor
+ · apply NominalSet.support_subset_supp
+ · exact supp' 𝔸
+ · exact fin 𝔸
+ · intro hb
+ obtain ⟨S, ⟨x, hx⟩, ha⟩ := hb
+ subst hx
+ intro S hS
+ suffices PermSet.HasSupport 𝔸 (f x) S by
+ apply ha; exact ⟨this, hS.out.right⟩
+ intro π hπ
+ suffices π ∈ PermSet.fix' 𝔸 f by
+ rw [PermSet.fix', Set.mem_setOf_eq] at this
+ rw [PermSet.fix', Set.mem_setOf_eq, ← Pi.smul_apply, this]
+ exact (hS.out.left hπ).out
+
+@[simp] lemma fresh {a : 𝔸} {f : X → Y} : a # f ↔ ∀ x, a # (f x) := by
+ simp [NominalSet.IsFresh]
+
+end Function
+
+end FinitaryFunctions
+
+/-!
## Quotient Types
If ≈ is an equivariant relation on X × X, then X/≈ is a nominal set with `supp [x] = ⋂₀ {supp y | y ∈ [x]}`.