bsc-leon-vatthauer/thesis/agda/Setoids.agda

51 lines
1.5 KiB
Agda
Raw Normal View History

-- Agda code that is included in the thesis.
-- just for making sure that everything used in the thesis actually compiles ;)
2024-03-11 18:15:46 +01:00
module Setoids where
2024-02-15 21:52:47 +01:00
open import Level
record _×_ {a b} (A : Set a) (B : Set b) : Set (a b) where
constructor _,_
field
fst : A
snd : B
open _×_
<_,_> : {a b c} {A : Set a} {B : Set b} {C : Set c}
(A B) (A C) A (B × C)
< f , g > x = (f x , g x)
record {l} : Set l where
constructor tt
! : {l} {X : Set l} X {l}
! _ = tt
data _+_ {a b} (A : Set a) (B : Set b) : Set (a b) where
i₁ : A A + B
i₂ : B A + B
[_,_] : {a b c} {A : Set a} {B : Set b} {C : Set c}
(A C) (B C) (A + B) C
[ f , g ] (i₁ x) = f x
[ f , g ] (i₂ x) = g x
data {l} : Set l where
¡ : {l} {X : Set l} {l} X
¡ ()
distributeˡ⁻¹ : {a b c} {A : Set a} {B : Set b} {C : Set c} (A × B) + (A × C) A × (B + C)
distributeˡ⁻¹ (i₁ (x , y)) = (x , i₁ y)
distributeˡ⁻¹ (i₂ (x , y)) = (x , i₂ y)
distributeˡ : {a b c} {A : Set a} {B : Set b} {C : Set c} A × (B + C) (A × B) + (A × C)
distributeˡ (x , i₁ y) = i₁ (x , y)
distributeˡ (x , i₂ y) = i₂ (x , y)
curry : {a b c} {A : Set a} {B : Set b} {C : Set c} (C × A B) C A B
curry f x y = f (x , y)
eval : {a b} {A : Set a} {B : Set b} ((A B) × A) B
eval (f , x) = f x