From 517764f549b001b995e32120d3225ca4d7170c31 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 22 Apr 2024 01:25:56 +0000 Subject: [PATCH] auto gitdoc commit --- src/HottBook/Chapter1.lagda.md | 91 ++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 11 deletions(-) diff --git a/src/HottBook/Chapter1.lagda.md b/src/HottBook/Chapter1.lagda.md index 60ecffd..e81ce45 100644 --- a/src/HottBook/Chapter1.lagda.md +++ b/src/HottBook/Chapter1.lagda.md @@ -1,32 +1,101 @@ ``` module HottBook.Chapter1 where -open import Relation.Binary.PropositionalEquality -open import Data.Empty -open import Data.Sum - -open import HottBook.Common +open import Agda.Primitive ``` +## 1.1 Type theory versus set theory + +## 1.2 Function types + +## 1.3 Universes and families + +## 1.4 Dependent function types (Ī -types) + +## 1.5 Product types + +``` +data šŸ™ : Set where + tt : šŸ™ + +``` + +## 1.6 Dependent pair types (Ī£-types) + +``` +record Ī£ {lā‚ lā‚‚} (A : Set lā‚) (B : A ā†’ Set lā‚‚) : Set (lā‚ āŠ” lā‚‚) where + constructor _,_ + field + fst : A + snd : B fst +open Ī£ +infixr 4 _,_ +{-# BUILTIN SIGMA Ī£ #-} +syntax Ī£ A (Ī» x ā†’ B) = Ī£[ x āˆˆ A ] B + +_Ɨ_ : {l : Level} (A B : Set l) ā†’ Set l +_Ɨ_ A B = Ī£ A (Ī» _ ā†’ B) +``` + + ## 1.7 Coproduct types ``` -infixl 6 _+_ -_+_ : (A B : Type) ā†’ Type -A + B = A āŠŽ B +-- infixl 6 _+_ +-- _+_ : (A B : Set) ā†’ Set +-- A + B = A āŠŽ B +``` + +## 1.8 The type of booleans + +``` +data šŸš : Set where + true : šŸš + false : šŸš +``` + +## 1.9 The natural numbers + +``` +data ā„• : Set where + zero : ā„• + suc : ā„• ā†’ ā„• +{-# BUILTIN NATURAL ā„• #-} + +rec-ā„• : (C : Set) ā†’ C ā†’ (ā„• ā†’ C ā†’ C) ā†’ ā„• ā†’ C +rec-ā„• C z s zero = z +rec-ā„• C z s (suc n) = s n (rec-ā„• C z s n) ``` ## 1.11 Propositions as types ``` -Ā¬_ : (A : Type) ā†’ Type +Ā¬_ : (A : Set) ā†’ Set Ā¬ A = A ā†’ āŠ„ ``` -## 1.12.1 Path Induction +## 1.12 Identity types ``` -J : {A : Type} ā†’ (C : (x y : A) ā†’ x ā‰” y ā†’ Type) +data _ā‰”_ {l} {A : Set l} : (a b : A) ā†’ Set l where + instance refl : {x : A} ā†’ x ā‰” x +infix 4 _ā‰”_ + +data āŠ„ : Set where +``` + +### 1.12.3 Disequality + +``` +_ā‰¢_ : {A : Set} (x y : A) ā†’ Set +_ā‰¢_ x y = (p : x ā‰” y) ā†’ āŠ„ +``` + +### 1.12.1 Path induction + +``` +J : {lā‚ lā‚‚ : Level} {A : Set lā‚} + ā†’ (C : (x y : A) ā†’ x ā‰” y ā†’ Set lā‚‚) ā†’ (c : (x : A) ā†’ C x x refl) ā†’ (x y : A) ā†’ (p : x ā‰” y) ā†’ C x y p J C c x x refl = c x