Todd Waugh Ambridge, January 2024 # Finite types \begin{code} {-# OPTIONS --without-K --safe #-} open import MLTT.Spartan open import UF.DiscreteAndSeparated open import UF.Sets open import UF.Sets-Properties open import UF.Equiv open import UF.EquivalenceExamples open import Fin.Type open import Fin.Bishop open import Fin.ArithmeticViaEquivalence open import MLTT.SpartanList module TWA.Thesis.Chapter2.Finite where Fin-is-discrete : (n : β) β is-discrete (Fin n) Fin-is-discrete 0 = π-is-discrete Fin-is-discrete (succ n) = +-is-discrete (Fin-is-discrete n) π-is-discrete Fin-is-set : (n : β) β is-set (Fin n) Fin-is-set (succ n) = +-is-set (Fin n) π (Fin-is-set n) π-is-set finite-is-discrete : {F : π€ Μ } β (f : finite-linear-order F) β is-discrete F finite-is-discrete (n , f) = equiv-to-discrete (β-sym f) (Fin-is-discrete n) finite-is-set : {F : π€ Μ } β (f : finite-linear-order F) β is-set F finite-is-set (n , f) = equiv-to-set f (Fin-is-set n) π-is-finite : finite-linear-order (π {π¦}) π-is-finite = 1 , qinveq g (h , Ξ· , ΞΌ) where g : π β Fin 1 g β = π h : Fin 1 β π h π = β Ξ· : h β g βΌ id Ξ· β = refl ΞΌ : g β h βΌ id ΞΌ π = refl ΞΌ (suc ()) π-is-finite : finite-linear-order π π-is-finite = 2 , qinveq g (h , Ξ· , ΞΌ) where g : π β Fin 2 g β = π g β = π h : Fin 2 β π h π = β h π = β Ξ· : h β g βΌ id Ξ· β = refl Ξ· β = refl ΞΌ : g β h βΌ id ΞΌ π = refl ΞΌ π = refl +-is-finite : {X : π€ Μ } {Y : π₯ Μ } β finite-linear-order X β finite-linear-order Y β finite-linear-order (X + Y) +-is-finite (n , e) (m , f) = n +' m , (+-cong e f β β-sym (Fin+homo n m)) Γ-is-finite : {X : π€ Μ } {Y : π₯ Μ } β finite-linear-order X β finite-linear-order Y β finite-linear-order (X Γ Y) Γ-is-finite (n , e) (m , f) = n Γ' m , (Γ-cong e f β β-sym (FinΓhomo n m)) vec-is-finite : (Ο΅ : β) {F : Fin Ο΅ β π€ Μ } β (f : (n : Fin Ο΅) β finite-linear-order (F n)) β finite-linear-order (vec Ο΅ F) vec-is-finite 0 f = π-is-finite vec-is-finite (succ Ο΅) f = Γ-is-finite (f π) (vec-is-finite Ο΅ (f β suc)) pointed : π€ Μ β π€ Μ pointed X = X \end{code}