type-theory/src/CircleFundamentalGroup.agda

224 lines
6.2 KiB
Agda
Raw Normal View History

2023-03-24 21:51:16 +00:00
{-# OPTIONS --without-K #-}
module CircleFundamentalGroup where
2023-04-02 20:38:51 +00:00
open import Agda.Builtin.Equality
2023-04-10 18:39:17 +00:00
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) renaming (Set to Type)
open import Data.Nat renaming (_+_ to _N+_)
open import Data.Nat.Properties
import Data.Integer
import Data.Integer.Properties
2023-04-02 20:38:51 +00:00
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; trans; sym; cong; cong-app; subst)
open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; step-≡; _∎)
2023-03-24 21:51:16 +00:00
-- Path
2023-04-02 20:38:51 +00:00
-- data _≡_ {l : Level} {A : Type l} : A → A → Type l where
-- refl : (x : A) → x ≡ x
2023-03-24 21:51:16 +00:00
path-ind : { : Level} {A : Type}
-- Motive
(C : (x y : A) x y Type )
-- What happens in the case of refl
2023-04-02 20:38:51 +00:00
(c : (x : A) C x x refl)
2023-03-24 21:51:16 +00:00
-- Actual path to eliminate
{x y : A} (p : x y)
-- Result
C x y p
2023-04-02 20:38:51 +00:00
path-ind C c {x} refl = c x
2023-03-24 21:51:16 +00:00
-- Id
id : { : Level} {A : Set } A A
id x = x
-- Transport
transport : {X : Set} (P : X Set) {x y : X}
x y
P x P y
2023-04-02 20:38:51 +00:00
transport P refl = id
2023-03-24 21:51:16 +00:00
2023-04-10 18:39:17 +00:00
-- Univalence
-- ua : { : Level} {A B : Set } → (equiv A B) → (A ≡ B)
2023-03-24 21:51:16 +00:00
-- apd
-- Lemma 2.3.4 of HoTT book
apd : {A : Type} {B : A Type}
-- The function that we want to apply
(f : (a : A) B a)
-- The path to apply it over
{x y : A} (p : x y)
-- Result
(transport B p) (f x) f y
apd {A} {B} f p = path-ind D d p
where
D : (x y : A) (p : x y) Type
D x y p = (transport B p) (f x) f y
2023-04-02 20:38:51 +00:00
d : (x : A) D x x refl
d x = refl
2023-03-24 21:51:16 +00:00
-- Circle (S¹)
postulate
: Set
base :
loop : base base
S¹-ind : (C : Type)
(c-base : C base)
2023-04-10 18:39:17 +00:00
(c-loop : (transport C loop c-base) c-base)
2023-03-24 21:51:16 +00:00
(s : ) C s
2023-04-02 20:38:51 +00:00
-- Groups
record Group { : Level} : Set (lsuc ) where
constructor group
field
set : Set
2023-04-10 18:39:17 +00:00
_∘_ : set set set
2023-04-02 20:38:51 +00:00
ident : set
2023-04-10 18:39:17 +00:00
G-_ : set set
assoc-prop : (a b c : set) (a b) c a (b c)
inverse-prop-l : (a : set) a (G- a) ident
inverse-prop-r : (a : set) (G- a) a ident
2023-04-02 20:38:51 +00:00
open Group
2023-04-10 18:39:17 +00:00
-- Integers
-- Not using the Agda type cus it uses with!!
data Z : Set where
pos : Z
zero : Z
neg : Z
_+_ : Z Z Z
pos x + pos y = pos (suc (x N+ y))
pos x + zero = pos x
pos zero + neg zero = zero
pos zero + neg (suc y) = neg y
pos (suc x) + neg zero = pos x
pos (suc x) + neg (suc y) = pos x + neg y
zero + b = b
neg x + zero = neg x
neg x + neg y = neg (suc (x N+ y))
neg zero + pos zero = zero
neg zero + pos (suc y) = pos y
neg (suc x) + pos zero = neg x
neg (suc x) + pos (suc y) = neg x + pos y
-_ : Z Z
- pos x = neg x
- zero = zero
- neg x = pos x
_-_ : Z Z Z
a - b = a + (- b)
Z-comm : (a b : Z) a + b b + a
Z-comm (pos a) (pos b) = cong (λ x pos (suc x)) (+-comm a b)
Z-comm (pos a) zero = refl
Z-comm (pos zero) (neg zero) = refl
Z-comm (pos zero) (neg (suc b)) = refl
Z-comm (pos (suc a)) (neg zero) = refl
Z-comm (pos (suc a)) (neg (suc b)) = Z-comm (pos a) (neg b)
Z-comm zero (pos b) = refl
Z-comm zero zero = refl
Z-comm zero (neg b) = refl
Z-comm (neg a) zero = refl
Z-comm (neg a) (neg b) = cong (λ x neg (suc x)) (+-comm a b)
Z-comm (neg zero) (pos zero) = refl
Z-comm (neg zero) (pos (suc b)) = refl
Z-comm (neg (suc a)) (pos zero) = refl
Z-comm (neg (suc a)) (pos (suc b)) = Z-comm (neg a) (pos b)
-- _+_ : Nat → Nat → Nat
-- zero + m = m
-- suc n + m = suc (n + m)
lemma-1 : (a b : ) suc (a N+ b) a N+ suc b
lemma-1 zero zero = refl
lemma-1 zero (suc b) = refl
lemma-1 (suc a) zero =
suc (suc a N+ zero)
≡⟨ cong suc (+-comm (suc a) zero)
suc (suc a)
2023-04-02 20:38:51 +00:00
≡⟨ refl
2023-04-10 18:39:17 +00:00
suc (zero N+ suc a)
2023-04-02 20:38:51 +00:00
≡⟨ refl
2023-04-10 18:39:17 +00:00
suc zero N+ suc a
≡⟨ +-comm 1 (suc a)
suc a N+ suc zero
2023-04-02 20:38:51 +00:00
2023-04-10 18:39:17 +00:00
lemma-1 (suc a) (suc b) = cong suc (lemma-1 a (suc b))
2023-04-02 20:38:51 +00:00
2023-04-10 18:39:17 +00:00
postulate
Z-assoc : (a b c : Z) (a + b) + c a + (b + c)
-- TODO: Actually formalize this (it's definitely true tho)
-- Z-assoc (pos zero) (pos zero) (pos c) = refl
-- Z-assoc (pos zero) (pos (suc b)) (pos c) = refl
-- Z-assoc (pos (suc a)) (pos zero) (pos c) =
-- (pos (suc a) + pos zero) + pos c
-- ≡⟨ refl ⟩
-- pos (suc (suc a N+ zero)) + pos c
-- ≡⟨ cong (λ x → pos (suc (suc x)) + pos c) (+-comm a zero) ⟩
-- pos (suc (zero N+ suc a)) + pos c
-- ≡⟨ refl ⟩
-- pos (suc (suc (zero N+ suc a)) N+ c)
-- ≡⟨ cong (λ x → pos (suc (suc x))) (lemma-1 a c) ⟩
-- pos (suc (suc a N+ suc c))
-- ≡⟨ refl ⟩
-- pos (suc a) + pos (suc c)
2023-04-02 20:38:51 +00:00
-- ≡⟨ refl ⟩
2023-04-10 18:39:17 +00:00
-- pos (suc a) + (pos (suc (zero N+ c)))
2023-04-02 20:38:51 +00:00
-- ≡⟨ refl ⟩
2023-04-10 18:39:17 +00:00
-- pos (suc a) + (pos zero + pos c)
2023-04-02 20:38:51 +00:00
-- ∎
2023-04-10 18:39:17 +00:00
-- Z-assoc (pos (suc a)) (pos (suc b)) (pos c) = ?
-- Z-assoc (pos a) (pos b) zero = refl
-- Z-assoc (pos a) (pos b) (neg c) = {! !}
-- Z-assoc (pos a) zero c = refl
-- Z-assoc (pos a) (neg b) (pos c) = {! !}
-- Z-assoc (pos a) (neg b) zero = {! !}
-- Z-assoc (pos a) (neg b) (neg c) = {! !}
-- Z-assoc zero b c = refl
-- Z-assoc (neg a) (pos b) (pos c) = {! !}
-- Z-assoc (neg a) (pos b) zero = {! !}
-- Z-assoc (neg a) (pos b) (neg c) = {! !}
-- Z-assoc (neg a) zero c = refl
-- Z-assoc (neg a) (neg b) (pos c) = {! !}
-- Z-assoc (neg a) (neg b) zero = {! !}
-- Z-assoc (neg a) (neg b) (neg c) = {! !}
double-neg : (a : Z) - (- a) a
double-neg (pos x) = refl
double-neg zero = refl
double-neg (neg x) = refl
Z-inverse-l : (a : Z) a + (- a) zero
Z-inverse-l (pos zero) = refl
Z-inverse-l (pos (suc a)) = Z-inverse-l (pos a)
Z-inverse-l zero = refl
Z-inverse-l (neg zero) = refl
Z-inverse-l (neg (suc a)) = Z-inverse-l (neg a)
Z-inverse-r : (a : Z) (- a) + a zero
Z-inverse-r a = trans (Z-comm (- a) a) (Z-inverse-l a)
Z-group : Group
Z-group .set = Z
Z-group ._∘_ = _+_
Z-group .ident = zero
Z-group .G-_ = -_
Z-group .assoc-prop = Z-assoc
Z-group .inverse-prop-l = Z-inverse-l
Z-group .inverse-prop-r = Z-inverse-r
_∙_ = trans
asdf : (z : Z) base base
asdf (pos zero) = loop
asdf (pos (suc x)) = loop asdf (pos x)
asdf zero = refl
asdf (neg zero) = sym loop
asdf (neg (suc x)) = (sym loop) asdf (neg x)
uiop : base base Z
uiop = path-ind (λ x y p Z) ?
transported-function : base base