27 lines
1.0 KiB
Agda
27 lines
1.0 KiB
Agda
module distrib where
|
||
|
||
data _∨_ (A B : Set) : Set where
|
||
inl : A → A ∨ B
|
||
inr : B → A ∨ B
|
||
|
||
data _∧_ (A B : Set) : Set where
|
||
_and_ : A → B → A ∧ B
|
||
|
||
and_dist_over_or : {a b c : Set} → a ∧ (b ∨ c) → (a ∧ b) ∨ (a ∧ c)
|
||
and_dist_over_or (a₁ and (inl x)) = inl (a₁ and x)
|
||
and_dist_over_or (a₁ and (inr x)) = inr (a₁ and x)
|
||
|
||
and_dist_over_or′ : {a b c : Set} → (a ∧ b) ∨ (a ∧ c) → a ∧ (b ∨ c)
|
||
and_dist_over_or′ (inl (x and x′)) = x and (inl x′)
|
||
and_dist_over_or′ (inr (x and x′)) = x and (inr x′)
|
||
|
||
or_dist_over_and : {a b c : Set} → (a ∨ b) ∧ (a ∨ c) -> a ∨ (b ∧ c)
|
||
or_dist_over_and ((inl x) and (inl y)) = inl x
|
||
or_dist_over_and ((inl x) and (inr y)) = inl x
|
||
or_dist_over_and ((inr x) and (inl y)) = inl y
|
||
or_dist_over_and ((inr x) and (inr y)) = inr (x and y)
|
||
|
||
or_dist_over_and′ : {a b c : Set} → a ∨ (b ∧ c) → (a ∨ b) ∧ (a ∨ c)
|
||
or_dist_over_and′ (inl x) = (inl x) and (inl x)
|
||
or_dist_over_and′ (inr (x and y)) = (inr x) and (inr y)
|