Formal specification of Haskell smash library in Agda.
From programming point of view provided data types Smash, Wedge and Can can treated as different possiblities how to combine two types same as: Product, Sum and These:
Product, Sum and These show how to combine types in sets, where Smash, Wedge and Can do the same for pointed ses:
| description | sets | algebra in sets | pointed sets | algebra in pointed sets |
|---|---|---|---|---|
| both | Product | A * B | Smash product | 1 + (A * B) |
| on of them | Sum | A + B | Wedge sum | 1 + A + B |
| both or one of them | These | A + B + (A * B) | Can | 1 + A + B + (A * B) |
Smash product is canonical tensor product of pointed sets in a category, given by taking product of underlying objects and indentifying with new basepoint - basepoints from ingredients.
data Smash (A : Set) (B : Set) : Set where
nada : Smash A B
smash : A -> B -> Smash A BWedge sum of two pointed sets A and B is the quotient set of the disjoint union A + B where both copies of the basepoint are identified.
data Wedge (A : Set)(B : Set) : Set where
nowhere : Wedge A B
here : A -> Wedge A B
there : B -> Wedge A BCan combines smash product with wedge sum:
data Can (A : Set)(B : Set) : Set where
non : Can A B
one : A -> Can A B
eno : B -> Can A B
two : A -> B -> Can A BProject can be build using make:
makeor nix:
nix buildUpdate nix flakes:
nix flake update