From 674aae49cde490bb1486f06d9bc6128c5ed476f2 Mon Sep 17 00:00:00 2001 From: Patrick Stevens Date: Tue, 19 Feb 2019 08:24:38 +0000 Subject: [PATCH] Groups lectures (#25) --- DecidableSet.agda | 10 ++ Groups/FreeGroups.agda | 221 +++++++++++++++++++++++++++++++++---- Groups/GeneratedGroup.agda | 116 +++++++++++++++++++ Groups/GroupActions.agda | 220 ++++++++++++++++++++++++++++++++---- Groups/Groups.agda | 8 -- Groups/GroupsLemmas.agda | 8 ++ Groups/SymmetryGroups.agda | 22 ---- Setoids/Lists.agda | 59 ++++++++++ 8 files changed, 593 insertions(+), 71 deletions(-) create mode 100644 DecidableSet.agda create mode 100644 Groups/GeneratedGroup.agda create mode 100644 Setoids/Lists.agda diff --git a/DecidableSet.agda b/DecidableSet.agda new file mode 100644 index 0000000..37a7407 --- /dev/null +++ b/DecidableSet.agda @@ -0,0 +1,10 @@ +{-# OPTIONS --safe --warning=error #-} + +open import LogicalFormulae +open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) + +module DecidableSet where + + record DecidableSet {a : _} (A : Set a) : Set a where + field + eq : (a b : A) → ((a ≡ b) || ((a ≡ b) → False)) diff --git a/Groups/FreeGroups.agda b/Groups/FreeGroups.agda index 491d0be..64444be 100644 --- a/Groups/FreeGroups.agda +++ b/Groups/FreeGroups.agda @@ -1,32 +1,211 @@ {-# OPTIONS --safe --warning=error #-} open import LogicalFormulae -open import Setoids +open import Setoids.Setoids open import Functions open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) -open import Naturals -open import FinSet -open import Groups +open import Numbers.Naturals +open import Sets.FinSet +open import Groups.GroupDefinition +open import Groups.SymmetryGroups +open import DecidableSet -module FreeGroups where +module Groups.FreeGroups where data FreeCompletion {a : _} (A : Set a) : Set a where - letter : A → FreeCompletion A - inv : A → FreeCompletion A + ofLetter : A → FreeCompletion A + ofInv : A → FreeCompletion A - data FreeGroup {a : _} (A : Set a) : Set a where - emptyWord : FreeGroup A - append : FreeCompletion A → FreeGroup A → FreeGroup A + freeInverse : {a : _} {A : Set a} (l : FreeCompletion A) → FreeCompletion A + freeInverse (ofLetter x) = ofInv x + freeInverse (ofInv x) = ofLetter x - reduceWord : {a : _} {A : Set a} → (FreeGroup {a} A) → FreeGroup A - reduceWord emptyWord = emptyWord - reduceWord (append (letter x) emptyWord) = append (letter x) emptyWord - reduceWord (append (letter x) (append (letter x1) w)) = append (letter x) (reduceWord (append (letter x1) w)) - reduceWord (append (letter x) (append (inv x₁) w)) = {!!} - reduceWord (append (inv x) w) = {!!} + ofLetterInjective : {a : _} {A : Set a} {x y : A} → (ofLetter x ≡ ofLetter y) → x ≡ y + ofLetterInjective refl = refl - freeGroupSetoid : {a : _} (A : Set a) → Setoid A - Setoid._∼_ (freeGroupSetoid A) = {!!} - Setoid.eq (freeGroupSetoid A) = {!!} + ofInvInjective : {a : _} {A : Set a} {x y : A} → (ofInv x ≡ ofInv y) → x ≡ y + ofInvInjective refl = refl - freeGroup : {a : _} (A : Set a) → Group (freeGroupSetoid A) {!!} - freeGroup A = {!!} + decidableFreeCompletion : {a : _} {A : Set a} → DecidableSet A → DecidableSet (FreeCompletion A) + decidableFreeCompletion {A = A} record { eq = eq } = record { eq = pr } + where + pr : (a b : FreeCompletion A) → (a ≡ b) || (a ≡ b → False) + pr (ofLetter x) (ofLetter y) with eq x y + ... | inl refl = inl refl + ... | inr x!=y = inr λ p → x!=y (ofLetterInjective p) + pr (ofLetter x) (ofInv y) = inr λ () + pr (ofInv x) (ofLetter y) = inr λ () + pr (ofInv x) (ofInv y) with eq x y + ... | inl refl = inl refl + ... | inr x!=y = inr λ p → x!=y (ofInvInjective p) + + freeCompletionEqual : {a : _} {A : Set a} (dec : DecidableSet A) (x y : FreeCompletion A) → Bool + freeCompletionEqual dec x y with DecidableSet.eq (decidableFreeCompletion dec) x y + freeCompletionEqual dec x y | inl x₁ = BoolTrue + freeCompletionEqual dec x y | inr x₁ = BoolFalse + + freeCompletionEqualFalse : {a : _} {A : Set a} (dec : DecidableSet A) {x y : FreeCompletion A} → ((x ≡ y) → False) → (freeCompletionEqual dec x y) ≡ BoolFalse + freeCompletionEqualFalse dec {x = x} {y} x!=y with DecidableSet.eq (decidableFreeCompletion dec) x y + freeCompletionEqualFalse dec {x} {y} x!=y | inl x=y = exFalso (x!=y x=y) + freeCompletionEqualFalse dec {x} {y} x!=y | inr _ = refl + + freeCompletionEqualFalse' : {a : _} {A : Set a} (dec : DecidableSet A) {x y : FreeCompletion A} → (freeCompletionEqual dec x y) ≡ BoolFalse → (x ≡ y) → False + freeCompletionEqualFalse' dec {x} {y} pr with DecidableSet.eq (decidableFreeCompletion dec) x y + freeCompletionEqualFalse' dec {x} {y} () | inl x₁ + freeCompletionEqualFalse' dec {x} {y} pr | inr ans = ans + + data ReducedWord {a : _} {A : Set a} (decA : DecidableSet A) : Set a + wordLength : {a : _} {A : Set a} {decA : DecidableSet A} → ReducedWord decA → ℕ + firstLetter : {a : _} {A : Set a} {decA : DecidableSet A} → (w : ReducedWord decA) → (0