diff --git a/Trinitarianism/Preambles/P0.agda b/0Trinitarianism/Preambles/P0.agda similarity index 58% rename from Trinitarianism/Preambles/P0.agda rename to 0Trinitarianism/Preambles/P0.agda index b00cdb3..03442fb 100644 --- a/Trinitarianism/Preambles/P0.agda +++ b/0Trinitarianism/Preambles/P0.agda @@ -1,3 +1,3 @@ -module Trinitarianism.Preambles.P0 where +module 0Trinitarianism.Preambles.P0 where open import Cubical.Core.Everything hiding (_∨_) public diff --git a/Trinitarianism/Preambles/P1.agda b/0Trinitarianism/Preambles/P1.agda similarity index 83% rename from Trinitarianism/Preambles/P1.agda rename to 0Trinitarianism/Preambles/P1.agda index c80ca6f..80a6b1c 100644 --- a/Trinitarianism/Preambles/P1.agda +++ b/0Trinitarianism/Preambles/P1.agda @@ -1,4 +1,4 @@ -module Trinitarianism.Preambles.P1 where +module 0Trinitarianism.Preambles.P1 where open import Cubical.Core.Everything public open import Cubical.Data.Unit public renaming (Unit to ⊤) diff --git a/Trinitarianism/Preambles/P2.agda b/0Trinitarianism/Preambles/P2.agda similarity index 62% rename from Trinitarianism/Preambles/P2.agda rename to 0Trinitarianism/Preambles/P2.agda index 3a68b12..3a61436 100644 --- a/Trinitarianism/Preambles/P2.agda +++ b/0Trinitarianism/Preambles/P2.agda @@ -1,6 +1,6 @@ -module Trinitarianism.Preambles.P2 where +module 0Trinitarianism.Preambles.P2 where open import Cubical.Core.Everything public open import Cubical.Data.Nat public hiding (_+_ ; isEven) -open import Trinitarianism.Quest1Solutions public +open import 0Trinitarianism.Quest1Solutions public open import Cubical.Data.Empty public using (⊥) diff --git a/Trinitarianism/Quest0.agda b/0Trinitarianism/Quest0.agda similarity index 76% rename from Trinitarianism/Quest0.agda rename to 0Trinitarianism/Quest0.agda index c7a4575..61a80b8 100644 --- a/Trinitarianism/Quest0.agda +++ b/0Trinitarianism/Quest0.agda @@ -1,5 +1,5 @@ -module Trinitarianism.Quest0 where -open import Trinitarianism.Preambles.P0 +module 0Trinitarianism.Quest0 where +open import 0Trinitarianism.Preambles.P0 data ⊤ : Type where tt : ⊤ diff --git a/Trinitarianism/Quest0.md b/0Trinitarianism/Quest0.md similarity index 61% rename from Trinitarianism/Quest0.md rename to 0Trinitarianism/Quest0.md index 102f867..1f11794 100644 --- a/Trinitarianism/Quest0.md +++ b/0Trinitarianism/Quest0.md @@ -13,7 +13,8 @@ we have another type `A → B : Type` which can be seen as - internal hom of the category `Type` To give examples of this, let's make some types first! -Here is how we define 'true'. + +## True / Unit / Terminal object ```agda data ⊤ : Type where @@ -37,39 +38,60 @@ Let's see an example of _using_ a term of type `⊤`: ```agda TrueToTrue : ⊤ → ⊤ -TrueToTrue = {!!} +TrueToTrue = { } ``` - - enter `C-c C-l` (this means `Ctrl-c Ctrl-l`) to load the document, - and now you can fill the hole `{ }` - - navigate to the hole `{ }` using `C-c C-f` (forward) or `C-c C-b` (backward) - - enter `C-c C-r` and agda will try to help you (`r` stands for _refine_) - - you should see `λ x → { }`. This is agda's notation for `x ↦ { }` - and is called `λ` abstraction, `λ` for 'let'. - - navigate to the new hole - - enter `C-c C-,` to check the _goal_ (`C-c C-comma`) - - the Goal area ('agda information' window) should look like - - ```agda +- enter `C-c C-l` (this means `Ctrl-c Ctrl-l`). + Whenever you do this, Agda will check the document is written correctly. + This will open the `*Agda Information*` window looking like + + ``` + ?0 : ⊤ → ⊤ + ?1 : ⊤ + ?2 : ⊤ + ``` + + This says you have three unfilled holes. +- Now you can fill the hole `{ }0`. +- navigate to the hole `{ }` using `C-c C-f` (forward) or `C-c C-b` (backward) +- enter `C-c C-r`. The `r` stands for _refine_. + Whenever you do this whilst having your cursor in a hole, + Agda will try to help you. +- you should see `λ x → { }`. This is agda's notation for `x ↦ { }` + and is called `λ` abstraction, think `λ` for 'let'. +- navigate to the new hole +- enter `C-c C-,` (this means `Ctrl-c Ctrl-comma`). + Whenever you make this command whilst having your cursor in a hole, + Agda will check the _goal_. +- the goal (`*Agda information*` window) should look like + + ``` Goal: ⊤ ————————————————————————— x : ⊤ ``` + + you have a proof/recipe/generalized element `x : ⊤` + and you need to give a proof/recipe/generalized element of `⊤` +- write the proof/recipe/generalized element `x` of `⊤` in the hole +- press `C-c C-SPC` to fill the hole with `x`. + In general when you have some term (and your cursor) in a hole, + doing `C-c C-SPC` will tell Agda to replace the hole with that term. + Agda will give you an error if it can't make sense of your term. +- the `*Agda Information*` window should now only have two unfilled holes left, + this means Agda has accepted your proof. + + ``` + ?1 : ⊤ + ?2 : ⊤ + ``` - - you have a proof/recipe/generalized element `x : ⊤` - and you need to give a proof/recipe/generalized element of `⊤` - - you can give it a proof/recipe/generalized element of `⊤` - and press `C-c C-SPC` to fill the hole (`SPC` means the space button) - -There is more than one proof (see solutions) - -are they 'the same'? -What is 'the same'? - -Here is an important solution: +There is more than one proof (see solutions). +Here is an important one: ```agda TrueToTrue' : ⊤ → ⊤ -TrueToTrue' x = {!!} +TrueToTrue' x = { } ``` - Naviagate to the hole and check the goal. @@ -80,18 +102,30 @@ TrueToTrue' x = {!!} tells agda to 'do cases on `x`'. The only case is `tt`. +One proof says for any term `x : ⊤` give `x` again. +The other says it suffices to do the case of `tt`, +for which we just give `tt`. + +> Are these proofs 'the same'? What is 'the same'? + +(This question is deep and should be unsettling. +Sneak peek: they are _internally_ but +not _externally_ 'the same'.) + Built into the definition of `⊤` is agda's way of making a map out of ⊤ -into another type A, which we have just used. -It says 'to map out of ⊤ it suffices to do the case when `x` is `tt`', or +into another type `A`, which we have just used. +It says 'to map out of `⊤` it suffices to do the case when `x` is `tt`', or - the only proof of `⊤` is `tt` - the only recipe for `⊤` is `tt` - the only one generalized element `tt` in `⊤` Let's define another type. +## False / Empty / Initial object + ```agda -data ⊥ : Type u where +data ⊥ : Type where ``` @@ -105,7 +139,7 @@ Let's try mapping out of `⊥`. ```agda explosion : ⊥ → ⊤ -explosion x = {!!} +explosion x = { } ``` - Navigate to the hole and do cases on `x`. @@ -118,6 +152,8 @@ This has three interpretations: there are no recipes of `⊥`. - `⊥` is initial in the category `Type` +## The natural numbers + We can also encode "natural numbers" as a type. ```agda @@ -170,22 +206,13 @@ Type : Type₁, Type₁ : Type₂, Type₂ : Type₃, ⋯ ``` These are called _universes_. The numberings of universes are called _levels_. -We will start using universes in the next quest. +It will be crucial that types can be treated as terms. +This will allows us to + - reason about '_structures_' such as 'the structure of a group', + think 'for all groups' + - do category theory without stepping out of the theory + (no need for classes etc. For experts, we have Grothendieck universes.) + - reason about when two types are 'the same', + for example when are two definitions of + the natural numbers 'the same'? What is 'the same'? - diff --git a/Trinitarianism/Quest0Solutions.agda b/0Trinitarianism/Quest0Solutions.agda similarity index 80% rename from Trinitarianism/Quest0Solutions.agda rename to 0Trinitarianism/Quest0Solutions.agda index 45fddad..ab57760 100644 --- a/Trinitarianism/Quest0Solutions.agda +++ b/0Trinitarianism/Quest0Solutions.agda @@ -1,5 +1,5 @@ -module Trinitarianism.Quest0Solutions where -open import Trinitarianism.Preambles.P0 +module 0Trinitarianism.Quest0Solutions where +open import 0Trinitarianism.Preambles.P0 data ⊤ : Type where diff --git a/Trinitarianism/Quest1.agda b/0Trinitarianism/Quest1.agda similarity index 76% rename from Trinitarianism/Quest1.agda rename to 0Trinitarianism/Quest1.agda index 8c0d83d..9772d4c 100644 --- a/Trinitarianism/Quest1.agda +++ b/0Trinitarianism/Quest1.agda @@ -1,6 +1,6 @@ -module Trinitarianism.Quest1 where +module 0Trinitarianism.Quest1 where -open import Trinitarianism.Preambles.P1 +open import 0Trinitarianism.Preambles.P1 isEven : ℕ → Type isEven n = {!!} diff --git a/Trinitarianism/Quest1.md b/0Trinitarianism/Quest1.md similarity index 86% rename from Trinitarianism/Quest1.md rename to 0Trinitarianism/Quest1.md index 18b9d0c..024a228 100644 --- a/Trinitarianism/Quest1.md +++ b/0Trinitarianism/Quest1.md @@ -6,6 +6,8 @@ the statement > There exists a natural that is even. +## Predicates / Dependent Constructions / Bundles + This requires the notion of a _predicate_. In general a predicate on a type `A : Type` is a term of type `A → Type`. @@ -94,13 +96,21 @@ There are three interpretations of `isEven : ℕ → Type`. or singleton. In general given a type `A : Type`, -a _dependent type over `A`_ is a term of type `A → Type`. +a _dependent type `F` over `A`_ is a term `F : A → Type`. +This should be drawn as a collection of space parameterised +by the space `A`. + + Bundle You can check if `2` is even by asking agda to 'reduce' the term `isEven 2`: do `C-c C-n` (`n` for normalize) and type in `isEven 2`. (By the way you can write in numerals since we are now secretly using `ℕ` from the cubical agda library.) - + +## Sigma Types + Now that we have expressed `isEven` we need to be able write down "existence". In maths we might write ``` @@ -111,6 +121,7 @@ which in agda notation is Σ ℕ isEven ``` This is called a _sigma type_, which has three interpretations: + - the proposition 'there exists an even natural' - the construction 'keep a recipe `n` of naturals together with a recipe of `isEven n`' @@ -119,25 +130,28 @@ This is called a _sigma type_, which has three interpretations: Pictorially, it looks like SigmaTypeOfIsEven + alt="SigmaTypeOfIsEven" + width="500"/> which can also be viewed as the subset of even naturals, since the fibers are either empty or singleton. (It is a _subsingleton bundle_). +### Making terms in Sigma Types Making a term of this type has three interpretations: + - a natural `n : ℕ` together with a proof `hn : isEven n` that `n` is even. - a recipe `n : ℕ` together with a recipe `hn : isEven n`. - a point in the total space is a point `n : ℕ` downstairs together with a point `hn : isEven n` in its fiber. Now you can prove that there exists an even natural: + - Formulate the statement you need. Make sure you have it of the form -```agda -Name : Statement -Name = ? -``` + ```agda + Name : Statement + Name = ? + ``` - Load the file, go to the hole and refine the goal. - If you formulated the statement right it should split into `{!!} , {!!}` and you can check the types of terms the holes require. @@ -167,6 +181,8 @@ A × C = Σ A (λ a → C) Agda supports the notation `_×_` (without spaces) which means from now on you can write `A × C` (with spaces). +### Using Terms in Sigma Types + There are two ways of using a term in a sigma type. We can extract the first part using `fst` or the second part using `snd`. Given `x : Σ A B` there are three interpretations of `fst` and `snd`: @@ -220,6 +236,24 @@ the two proofs `2 , tt` and `36 , tt` of the statement 'there exists an even natural' are not 'the same' in any sense, since if they were `div2 (2 , tt)` would be 'the same' `div2 (36/2 , tt)`, and hence `1` would be 'the same' as `18`. -> Are they 'the same'? What is 'the same'? - +> Are they 'the same'? What is 'the same'? + +## Using the Trinitarianism + +We introduced new ideas through all three perspectives, +as each has their own advantage + +- Types as propositions is often the most familiar perspective, + and hence can offer guidance for the other two perspectives. + However the current mathematical paradigm uses proof irrelevance + (two proofs of the same proposition are always 'the same'), + which is _not_ compatible with HoTT. +- Types as constructions conveys the way in which 'data' is important, + and should be preserved. +- Types as objects allows us to draw pictures, + thus guiding us through the syntax with geometric intuition. + +For each new idea introduced, +make sure to justify it proof theoretically, type theoretically and +categorically. diff --git a/Trinitarianism/Quest1Solutions.agda b/0Trinitarianism/Quest1Solutions.agda similarity index 77% rename from Trinitarianism/Quest1Solutions.agda rename to 0Trinitarianism/Quest1Solutions.agda index 1c5a560..798234a 100644 --- a/Trinitarianism/Quest1Solutions.agda +++ b/0Trinitarianism/Quest1Solutions.agda @@ -1,6 +1,6 @@ -module Trinitarianism.Quest1Solutions where +module 0Trinitarianism.Quest1Solutions where -open import Trinitarianism.Preambles.P1 +open import 0Trinitarianism.Preambles.P1 isEven : ℕ → Type isEven zero = ⊤ diff --git a/Trinitarianism/Quest2.agda b/0Trinitarianism/Quest2.agda similarity index 65% rename from Trinitarianism/Quest2.agda rename to 0Trinitarianism/Quest2.agda index c2de761..8134556 100644 --- a/Trinitarianism/Quest2.agda +++ b/0Trinitarianism/Quest2.agda @@ -1,6 +1,6 @@ -module Trinitarianism.Quest2 where +module 0Trinitarianism.Quest2 where -open import Trinitarianism.Preambles.P2 +open import 0Trinitarianism.Preambles.P2 _+_ : ℕ → ℕ → ℕ n + m = {!!} diff --git a/Trinitarianism/Quest2.md b/0Trinitarianism/Quest2.md similarity index 100% rename from Trinitarianism/Quest2.md rename to 0Trinitarianism/Quest2.md diff --git a/Trinitarianism/Quest2Solutions.agda b/0Trinitarianism/Quest2Solutions.agda similarity index 94% rename from Trinitarianism/Quest2Solutions.agda rename to 0Trinitarianism/Quest2Solutions.agda index be2ecfc..2d9f39b 100644 --- a/Trinitarianism/Quest2Solutions.agda +++ b/0Trinitarianism/Quest2Solutions.agda @@ -1,6 +1,6 @@ -module Trinitarianism.Quest2Solutions where +module 0Trinitarianism.Quest2Solutions where -open import Trinitarianism.Preambles.P2 +open import 0Trinitarianism.Preambles.P2 _+_ : ℕ → ℕ → ℕ n + zero = n diff --git a/Trinitarianism/README.md b/0Trinitarianism/README.md similarity index 100% rename from Trinitarianism/README.md rename to 0Trinitarianism/README.md diff --git a/Trinitarianism/bin/AsProps/Quest0.agda b/0Trinitarianism/bin/AsProps/Quest0.agda similarity index 100% rename from Trinitarianism/bin/AsProps/Quest0.agda rename to 0Trinitarianism/bin/AsProps/Quest0.agda diff --git a/Trinitarianism/bin/AsProps/Quest0Preamble.agda b/0Trinitarianism/bin/AsProps/Quest0Preamble.agda similarity index 100% rename from Trinitarianism/bin/AsProps/Quest0Preamble.agda rename to 0Trinitarianism/bin/AsProps/Quest0Preamble.agda diff --git a/Trinitarianism/bin/AsProps/Quest0Solutions.agda b/0Trinitarianism/bin/AsProps/Quest0Solutions.agda similarity index 100% rename from Trinitarianism/bin/AsProps/Quest0Solutions.agda rename to 0Trinitarianism/bin/AsProps/Quest0Solutions.agda diff --git a/Trinitarianism/bin/AsProps/Quest0Solutions.lagda.md b/0Trinitarianism/bin/AsProps/Quest0Solutions.lagda.md similarity index 100% rename from Trinitarianism/bin/AsProps/Quest0Solutions.lagda.md rename to 0Trinitarianism/bin/AsProps/Quest0Solutions.lagda.md diff --git a/Trinitarianism/bin/AsProps/Quest1.agda b/0Trinitarianism/bin/AsProps/Quest1.agda similarity index 100% rename from Trinitarianism/bin/AsProps/Quest1.agda rename to 0Trinitarianism/bin/AsProps/Quest1.agda diff --git a/Trinitarianism/bin/AsTypes/Quest0.agda b/0Trinitarianism/bin/AsTypes/Quest0.agda similarity index 100% rename from Trinitarianism/bin/AsTypes/Quest0.agda rename to 0Trinitarianism/bin/AsTypes/Quest0.agda diff --git a/0Trinitarianism/images/generalBundle.png b/0Trinitarianism/images/generalBundle.png new file mode 100644 index 0000000..554e54b Binary files /dev/null and b/0Trinitarianism/images/generalBundle.png differ diff --git a/Trinitarianism/images/isEven.png b/0Trinitarianism/images/isEven.png similarity index 100% rename from Trinitarianism/images/isEven.png rename to 0Trinitarianism/images/isEven.png diff --git a/Trinitarianism/images/isEvenBundle.png b/0Trinitarianism/images/isEvenBundle.png similarity index 100% rename from Trinitarianism/images/isEvenBundle.png rename to 0Trinitarianism/images/isEvenBundle.png diff --git a/Trinitarianism/images/nno.png b/0Trinitarianism/images/nno.png similarity index 100% rename from Trinitarianism/images/nno.png rename to 0Trinitarianism/images/nno.png diff --git a/Trinitarianism/images/trinitarianism.png b/0Trinitarianism/images/trinitarianism.png similarity index 100% rename from Trinitarianism/images/trinitarianism.png rename to 0Trinitarianism/images/trinitarianism.png diff --git a/EmacsCommands.md b/EmacsCommands.md new file mode 100644 index 0000000..6646570 --- /dev/null +++ b/EmacsCommands.md @@ -0,0 +1,41 @@ +Useful Doom Emacs Commands +===================== + +## Notation + +- `SPC` means space bar +- `C-` means hold down `Ctrl` +- `M-` means hold down `Alt` for non-Macs and `Option` for Macs +- `S-` means hold down `Shift` +- `RET` means enter + +Example `C-c C-l` in Agda files is `Ctrl-c`, let go, `Ctrl-l` + +## General Doom Emacs usage + +- `SPC h b b` to look for bindings +- `SPC f f` to find files. can use `TAB` for auto-completing paths +- `h j k l` for left down up right +- `SPC b k` to kill 'buffers' +- `i` to go into 'insert' and `ESC` or `C-g` to escape 'insert'. +- `C-_` to undo + +For beta users, to get the latest patch + +- do `SPC g g` for "git status" +- then `F` for pull (whilst in "git status") + + +## Agda usage + + +- `C-c C-l` loads the file +- `C-c C-,` checks goal of the hole your cursor is in. +- `C-c C-SPC` fills hole your cursor is in. +- `C-c C-r` refines the hole your cursor is in. +- `C-c C-c` does cases on terms in the hole your cursor is in. +- `C-c C-d` used for checking types of terms +- `C-c C-n` used for 'reducing' terms to their 'simplest form' +- `C-c C-.` does `C-c C-,` and `C-c C-d` + + diff --git a/Installation/Windows.md b/Installation/Windows.md index a2a6db2..e05b63d 100644 --- a/Installation/Windows.md +++ b/Installation/Windows.md @@ -4,34 +4,37 @@ How to Install the HoTT Game on Windows ## Prerequisites MUST USE POWERSHELL AS ADMIN -- chocolatey (this shld be easy) -- Via chocolatey +- chocolatey: follow instructions on + [their page](https://chocolatey.org/install) +- In (admin) powershell do (via chocolatey, cabal) - `choco install ghc` - `choco install cabal` -- via cabal - `cabal install happy` - `cabal install alex` -## The Damned Paths + -Something something need to add new system environment variables, -need to ask Samuel again. + + ## Doom Emacs +Get doom emacs following instructions made [here]( +earvingad.github.io/posts/doom_emacs_windows/ +) -IN POWERSHELL LOCAL TO USER + -- Prerequisites - ``` - choco install git emacs ripgrep - choco install fd llvm - ``` -- Doom Emacs itself - ``` - git clone https://github.com/hlissner/doom-emacs ~/.emacs.d - ~/.emacs.d/bin/doom install - ``` - **Icons will be missing for windows sadly** + + + + + + + + + + + ## Development Version of Agda diff --git a/Plan.org b/Plan.org index 1e8cd13..a9289bc 100644 --- a/Plan.org +++ b/Plan.org @@ -78,11 +78,14 @@ + Easy to generalize situation to n-types being closed under Sigma (7.1.8 in HoTT book), we showed this assuming PathPIsoPath -** Minibosses -- _+_ unique on the naturals - + axiomatize addition on naturals - + naturals is a set - + fun extensionality - + contractability - + propositions - + propositions closed under sigma types +** SuperUltraMegaHyperLydianBosses +- natural number object unique and _+_ unique on any nat num obj + + nat num obj unique + + _+_ unique on a model of nat num obj + - axiomatize addition on naturals + - naturals is a set + - fun extensionality + - contractability + - propositions + - propositions closed under sigma types + + univalence diff --git a/README.md b/README.md index 7cc6e4d..d044ad5 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,9 @@ Each quest consists of three files, for example : solutions to the tasks in the quest. ## Emacs and Agda usage -We will have a file with a list of basic Emacs commands, +We have a file with a list of [basic Emacs commands]( +https://github.com/Jlh18/TheHoTTGame/blob/main/EmacsCommands.md +), but you _should_ be able to learn how to use Agda as you go along. ## Feedback diff --git a/_build/2.6.2/agda/0Trinitarianism/Preambles/P0.agdai b/_build/2.6.2/agda/0Trinitarianism/Preambles/P0.agdai new file mode 100644 index 0000000..83d041d Binary files /dev/null and b/_build/2.6.2/agda/0Trinitarianism/Preambles/P0.agdai differ diff --git a/_build/2.6.2/agda/0Trinitarianism/Preambles/P1.agdai b/_build/2.6.2/agda/0Trinitarianism/Preambles/P1.agdai new file mode 100644 index 0000000..d014a9f Binary files /dev/null and b/_build/2.6.2/agda/0Trinitarianism/Preambles/P1.agdai differ diff --git a/_build/2.6.2/agda/0Trinitarianism/Preambles/P2.agdai b/_build/2.6.2/agda/0Trinitarianism/Preambles/P2.agdai new file mode 100644 index 0000000..075f760 Binary files /dev/null and b/_build/2.6.2/agda/0Trinitarianism/Preambles/P2.agdai differ diff --git a/_build/2.6.2/agda/0Trinitarianism/Quest1Solutions.agdai b/_build/2.6.2/agda/0Trinitarianism/Quest1Solutions.agdai new file mode 100644 index 0000000..b23d728 Binary files /dev/null and b/_build/2.6.2/agda/0Trinitarianism/Quest1Solutions.agdai differ diff --git a/_build/2.6.2/agda/0Trinitarianism/Quest2Solutions.agdai b/_build/2.6.2/agda/0Trinitarianism/Quest2Solutions.agdai new file mode 100644 index 0000000..dbff92f Binary files /dev/null and b/_build/2.6.2/agda/0Trinitarianism/Quest2Solutions.agdai differ