summaryrefslogtreecommitdiff
path: root/Nominal
diff options
context:
space:
mode:
Diffstat (limited to 'Nominal')
-rw-r--r--Nominal/Instances.lean91
-rw-r--r--Nominal/Permutations.lean40
-rw-r--r--Nominal/Support.lean (renamed from Nominal/Basic.lean)131
3 files changed, 139 insertions, 123 deletions
diff --git a/Nominal/Instances.lean b/Nominal/Instances.lean
new file mode 100644
index 0000000..793baa4
--- /dev/null
+++ b/Nominal/Instances.lean
@@ -0,0 +1,91 @@
+import Nominal.Permutations
+import Nominal.Support
+
+/-!
+# Instances
+
+This file contains common instances of (FPerm 𝔸)-sets and nominal sets.
+-/
+
+variable (𝔸 : Type)
+
+/-!
+## Atoms
+
+The set 𝔸 of atoms itself is a nominal set, where supp a = {a}.
+-/
+section Atoms
+
+private lemma NominalSet.supp_atoms' {a : 𝔸} : PermSet.HasSupport 𝔸 a {a} := by
+ simp [PermSet.HasSupport, PermSet.fix, PermSet.fix']
+
+instance : NominalSet 𝔸 𝔸 where
+ fin_supp := by
+ intro a
+ use {a}
+ constructor
+ · exact NominalSet.supp_atoms' 𝔸
+ · simp
+
+lemma NominalSet.supp_atoms [Infinite 𝔸] [DecidableEq 𝔸] {a : 𝔸} : supp 𝔸 a = {a} := by
+ ext b; constructor
+ · apply support_subset_supp
+ · apply NominalSet.supp_atoms'
+ · simp
+ · suffices : a ∈ supp 𝔸 a
+ · simp; intro h; rw [h]; assumption
+ · intro S ⟨hsuppS, hfinS⟩
+ by_contra ha
+ obtain ⟨c, hc⟩ := Infinite.exists_notMem_finset ({a} ∪ hfinS.toFinset)
+ simp at hc
+ have hfix : ⸨a, c⸩ ∈ PermSet.fix 𝔸 S := by
+ intro d hd
+ rw [show ⸨a,c⸩ • d = (Equiv.swap a c) d from rfl]
+ apply Equiv.Perm.supp_notin
+ simp [Equiv.Perm.supp_swap, Ne.symm hc.left]
+ exact ⟨ne_of_mem_of_not_mem hd ha, ne_of_mem_of_not_mem hd hc.right⟩
+ have ha₁ : ⸨a, c⸩ • a = c := by
+ simp [show ⸨a,c⸩ • a = (Equiv.swap a c) a from rfl]
+ have ha₂ : ⸨a, c⸩ • a = a := by
+ specialize hsuppS hfix
+ simpa [PermSet.fix']
+ rw [ha₁] at ha₂
+ exact hc.left ha₂
+
+end Atoms
+
+/-!
+## Discrete Nominal Sets
+
+Every set can be made into a discrete nominal set, where supp x = ∅.
+-/
+section Discrete
+
+def NominalSet.discrete (X : Type) : DiscreteNominalSet 𝔸 X where
+ smul π x := x
+ one_smul := by intro; rfl
+ mul_smul := by intro _ _ _; rfl
+ is_discrete := by intro _ _; rfl
+ fin_supp := by
+ intro x
+ use {}
+ constructor
+ · intro π hπ; simp [PermSet.fix']; rfl
+ · simp
+
+lemma NominalSet.supp_discrete {X : Type} [DiscreteNominalSet 𝔸 X] {x : X} : supp 𝔸 x = ∅ := by
+ rw [← Set.subset_empty_iff]
+ apply Set.sInter_subset_of_mem
+ constructor
+ · intro π hπ
+ simp [PermSet.fix']
+ exact DiscreteNominalSet.is_discrete x π
+ · exact Set.finite_empty
+
+/-- We consider Unit a discrete nominal set. -/
+instance : DiscreteNominalSet 𝔸 Unit := NominalSet.discrete 𝔸 Unit
+
+/-- We consider Bool a discrete nominal set. -/
+instance : DiscreteNominalSet 𝔸 Bool := NominalSet.discrete 𝔸 Bool
+
+end Discrete
diff --git a/Nominal/Permutations.lean b/Nominal/Permutations.lean
index 5f62ec0..6819c67 100644
--- a/Nominal/Permutations.lean
+++ b/Nominal/Permutations.lean
@@ -103,15 +103,14 @@ namespace Equiv.Perm
/-- The support of a transposition (x y). -/
lemma supp_swap {x y : X} : (Equiv.swap x y).supp = if x ≠ y then {x, y} else ∅ := by
- if h : (x ≠ y) then
- ext z
+ by_cases h : x = y
+ · simp [h, supp]
+ · simp [h]; ext z
by_cases hx : z = x
- · aesop
+ · simp [hx, Ne.symm h]
· by_cases hy : z = y
- · simp [hy]
+ · simp [hy, h]
· simp [Equiv.swap_apply_of_ne_of_ne, hx, hy]
- else
- aesop
end Equiv.Perm
@@ -120,8 +119,7 @@ namespace FPerm
def swap (x y : X) : FPerm X := ⟨Equiv.swap x y, by
apply Set.Finite.subset
· apply ({x, y} : Finset X).finite_toSet
- · simp [Equiv.Perm.supp_swap]
- aesop⟩
+ · by_cases h : x = y <;> all_goals simp [Equiv.Perm.supp_swap, h]⟩
notation "⸨" a "," b "⸩" => FPerm.swap a b
@@ -130,3 +128,29 @@ end FPerm
example : FPerm ℕ := ⸨1, 2⸩ * ⸨3, 4⸩ * ⸨2, 3⸩
end Transposition
+
+/-!
+## (FPerm 𝔸)-Sets
+
+Sets equipped with a permutation operation.
+-/
+section PermSet
+
+variable (𝔸 : Type) [Infinite 𝔸] [Countable 𝔸] [DecidableEq 𝔸]
+
+/-- A set X equipped with a group action •: (FPerm 𝔸) × X → X. -/
+class PermSet (X : Type) extends MulAction (FPerm 𝔸) X
+
+/-- The set of atoms itself forms a (FPerm 𝔸)-Set. -/
+instance : PermSet 𝔸 𝔸 where
+ smul π a := π a
+ one_smul := by intro; rfl
+ mul_smul := by intro _ _ _; rfl
+
+/-- The set of finite permutations forms a (FPerm 𝔸)-Set. -/
+instance : PermSet 𝔸 (FPerm 𝔸) where
+ smul π τ := π * τ
+ one_smul := by intro; rfl
+ mul_smul := by intro _ _ _; rfl
+
+end PermSet
diff --git a/Nominal/Basic.lean b/Nominal/Support.lean
index 66f43b1..7875ad3 100644
--- a/Nominal/Basic.lean
+++ b/Nominal/Support.lean
@@ -1,53 +1,14 @@
import Mathlib.Tactic
import Nominal.Permutations
import Nominal.Helpers.Finset
-/-!
-# Basic Definitions
-
-This file provides basic definitions for nominal sets.
--/
/-!
-## (FPerm 𝔸)-Sets
+# Support
-Sets equipped with a permutation operation.
+This file provides basic definitions for support of (FPerm 𝔸)-sets and nominal sets.
-/
-section PermSet
-
-variable (𝔸 : Type) [Infinite 𝔸] [Countable 𝔸] [DecidableEq 𝔸]
-/-- A set X equipped with a group action •: (FPerm 𝔸) × X → X. -/
-class PermSet (X : Type) extends MulAction (FPerm 𝔸) X
-
-/-- The set of atoms itself forms a (FPerm 𝔸)-Set. -/
-instance : PermSet 𝔸 𝔸 where
- smul π a := π a
- one_smul := by intro; rfl
- mul_smul := by intro _ _ _; rfl
-
-/-- The set of finite permutations forms a (FPerm 𝔸)-Set. -/
-instance : PermSet 𝔸 (FPerm 𝔸) where
- smul π τ := π * τ
- one_smul := by intro; rfl
- mul_smul := by intro _ _ _; rfl
-
-class DiscretePermSet (X : Type) extends PermSet 𝔸 X where
- is_discrete : ∀ (x : X) (π : FPerm 𝔸), π • x = x
-
-/-- A discrete (FPerm 𝔸)-Set where permutations do not change anything. -/
-def PermSet.discrete (X : Type) : DiscretePermSet 𝔸 X where
- smul π x := x
- one_smul := by intro; rfl
- mul_smul := by intro _ _ _; rfl
- is_discrete := by intro _ _; rfl
-
-/-- We consider Unit a discrete (FPerm 𝔸)-Set. -/
-instance : DiscretePermSet 𝔸 Unit := PermSet.discrete 𝔸 Unit
-
-/-- We consider Bool a discrete (FPerm 𝔸)-Set. -/
-instance : DiscretePermSet 𝔸 Bool := PermSet.discrete 𝔸 Bool
-
-end PermSet
+variable (𝔸 : Type)
/-!
## Support Definitions
@@ -56,7 +17,7 @@ We can define the notion of "supports" on elements of (FPerm 𝔸)-Sets as the a
-/
section Support
-variable (𝔸 : Type) {X : Type} [PermSet 𝔸 X]
+variable {X : Type} [PermSet 𝔸 X]
namespace PermSet
@@ -72,7 +33,7 @@ def fix (A : Set X) : Set (FPerm 𝔸) :=
def HasSupport (x : X) (S : Set 𝔸) : Prop :=
fix 𝔸 S ⊆ fix' 𝔸 x
-@[simp]
+/-- Alternative definition with fix 𝔸 S unfolded. -/
lemma support_iff {x : X} {S : Set 𝔸} : HasSupport 𝔸 x S ↔ ∀ (π : FPerm 𝔸), (∀ x ∈ S, π x = x) → π ∈ fix' 𝔸 x := by
constructor
· intro hsupp π hπ
@@ -80,7 +41,8 @@ lemma support_iff {x : X} {S : Set 𝔸} : HasSupport 𝔸 x S ↔ ∀ (π : FPe
· intro hsupp π hπ
exact hsupp π hπ
-lemma support_subset {x : X} {S T : Set 𝔸} : HasSupport 𝔸 x S → S ⊆ T → HasSupport 𝔸 x T := by
+/-- If a support is a subset of another set, that set is also a support. -/
+lemma support_superset {x : X} {S T : Set 𝔸} : HasSupport 𝔸 x S → S ⊆ T → HasSupport 𝔸 x T := by
intro hS hsub π hπ
apply hS
intro a ha
@@ -229,7 +191,7 @@ end PermSet
end Support
/-!
-## Basic Nominal Set Definition
+## Nominal Sets
Nominal sets are then just (FPerm 𝔸)-Sets where all elements are finitely supported.
-/
@@ -239,7 +201,11 @@ variable (𝔸 : Type)
/-- An (FPerm 𝔸)-Set X is nominal if every x ∈ X is finitely supported. -/
class NominalSet (X : Type) extends PermSet 𝔸 X where
- finsupp : ∀ (x : X), ∃ (S : Set 𝔸), PermSet.HasSupport 𝔸 x S ∧ S.Finite
+ fin_supp : ∀ (x : X), ∃ (S : Set 𝔸), PermSet.HasSupport 𝔸 x S ∧ S.Finite
+
+/-- A discrete nominal set where permutations do not change anything. -/
+class DiscreteNominalSet (X : Type) extends NominalSet 𝔸 X where
+ is_discrete : ∀ (x : X) (π : FPerm 𝔸), π • x = x
namespace NominalSet
@@ -252,14 +218,14 @@ def supp (x : X) : Set 𝔸 :=
/-- The least finite support in a nominal set is always finite. -/
lemma supp_finite {x : X} : (supp 𝔸 x).Finite := by
unfold supp
- obtain ⟨S, ⟨hsuppS, hfinS⟩⟩ := nom.finsupp x
+ obtain ⟨S, ⟨hsuppS, hfinS⟩⟩ := nom.fin_supp x
apply Set.Finite.subset
· exact hfinS
· grind
/-- The least finite support is itself a support. -/
lemma supp_is_support [Infinite 𝔸] {x : X} : PermSet.HasSupport 𝔸 x (supp 𝔸 x) := by
- obtain ⟨S, ⟨hsuppS, hfinS⟩⟩ := nom.finsupp x
+ obtain ⟨S, ⟨hsuppS, hfinS⟩⟩ := nom.fin_supp x
have suppf : (supp 𝔸 x = ⋂₀ { T : Set 𝔸 | T ⊆ S ∧ PermSet.HasSupport 𝔸 x T ∧ T.Finite }) := by
unfold supp; ext a
constructor
@@ -287,6 +253,7 @@ lemma supp_is_support [Infinite 𝔸] {x : X} : PermSet.HasSupport 𝔸 x (supp
· intro T hT
exact hT.right
+/-- If S is a finite support for x, then supp x is a subset of it. -/
lemma support_subset_supp {x : X} {S : Set 𝔸} : PermSet.HasSupport 𝔸 x S → S.Finite → supp 𝔸 x ⊆ S := by
intro hsupp hfin
apply Set.sInter_subset_of_mem
@@ -294,70 +261,4 @@ lemma support_subset_supp {x : X} {S : Set 𝔸} : PermSet.HasSupport 𝔸 x S â
end NominalSet
-private lemma NominalSet.supp_atoms' {a : 𝔸} : PermSet.HasSupport 𝔸 a {a} := by
- simp [PermSet.fix']
-
-/-- The set of atoms is a nominal set, where supp a = {a}. -/
-instance : NominalSet 𝔸 𝔸 where
- finsupp := by
- intro a
- use {a}
- constructor
- · exact NominalSet.supp_atoms' 𝔸
- · simp
-
-lemma NominalSet.supp_atoms [Infinite 𝔸] [DecidableEq 𝔸] {a : 𝔸} : supp 𝔸 a = {a} := by
- ext b; constructor
- · apply support_subset_supp
- · apply NominalSet.supp_atoms'
- · simp
- · suffices : a ∈ supp 𝔸 a
- · simp; intro h; rw [h]; assumption
- · intro S ⟨hsuppS, hfinS⟩
- by_contra ha
- obtain ⟨c, hc⟩ := Infinite.exists_notMem_finset ({a} ∪ hfinS.toFinset)
- simp at hc
- have hfix : ⸨a, c⸩ ∈ PermSet.fix 𝔸 S := by
- intro d hd
- rw [show ⸨a,c⸩ • d = (Equiv.swap a c) d from rfl]
- apply Equiv.Perm.supp_notin
- simp [Equiv.Perm.supp_swap, Ne.symm hc.left]
- exact ⟨ne_of_mem_of_not_mem hd ha, ne_of_mem_of_not_mem hd hc.right⟩
- have ha₁ : ⸨a, c⸩ • a = c := by
- simp [show ⸨a,c⸩ • a = (Equiv.swap a c) a from rfl]
- have ha₂ : ⸨a, c⸩ • a = a := by
- specialize hsuppS hfix
- simpa [PermSet.fix']
- rw [ha₁] at ha₂
- exact hc.left ha₂
-
-class DiscreteNominalSet (X : Type) extends NominalSet 𝔸 X, DiscretePermSet 𝔸 X
-
-private lemma NominalSet.supp_discrete' {X : Type} [disc : DiscretePermSet 𝔸 X] {x : X} : PermSet.HasSupport 𝔸 x ∅ := by
- intro π hπ
- simp [PermSet.fix']
- exact DiscretePermSet.is_discrete x π
-
-/-- Every set can be made into a discrete nominal set where every element has empty support. -/
-def NominalSet.discrete (X : Type) : DiscreteNominalSet 𝔸 X :=
-{ PermSet.discrete 𝔸 X with
- finsupp := by
- intro x
- use {}
- constructor
- · intro π hπ; simp [PermSet.fix']; rfl
- · simp
-}
-
-lemma NominalSet.supp_discrete {X : Type} [DiscreteNominalSet 𝔸 X] {x : X} : supp 𝔸 x = ∅ := by
- rw [← Set.subset_empty_iff]
- apply Set.sInter_subset_of_mem
- exact ⟨NominalSet.supp_discrete' 𝔸, Set.finite_empty⟩
-
-/-- We consider Unit a discrete nominal set. -/
-instance : DiscreteNominalSet 𝔸 Unit := NominalSet.discrete 𝔸 Unit
-
-/-- We consider Bool a discrete nominal set. -/
-instance : DiscreteNominalSet 𝔸 Bool := NominalSet.discrete 𝔸 Bool
-
end NominalSet