| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties for distributive lattice |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Relation.Binary.Lattice |
| 10 |
|
| 11 |
module Relation.Binary.Lattice.Properties.DistributiveLattice |
| 12 |
{c ℓ₁ ℓ₂} (L : DistributiveLattice c ℓ₁ ℓ₂) where |
| 13 |
|
| 14 |
open import Data.Product.Base using (_,_) |
| 15 |
open import Relation.Binary.Bundles using (Setoid) |
| 16 |
|
| 17 |
open DistributiveLattice L hiding (refl) |
| 18 |
|
| 19 |
open import Algebra.Definitions _≈_ |
| 20 |
using (Zero; RightZero; LeftZero |
| 21 |
; _DistributesOverʳ_; _DistributesOverˡ_; _DistributesOver_) |
| 22 |
open import Relation.Binary.Reasoning.Setoid setoid |
| 23 |
open import Relation.Binary.Lattice.Properties.Lattice lattice |
| 24 |
using (∧-absorbs-∨; ∨-absorbs-∧ ) |
| 25 |
open import Relation.Binary.Lattice.Properties.MeetSemilattice meetSemilattice |
| 26 |
using (∧-comm; ∧-cong) |
| 27 |
open import Relation.Binary.Lattice.Properties.JoinSemilattice joinSemilattice |
| 28 |
using (∨-comm; ∨-cong; ∨-assoc) |
| 29 |
|
| 30 |
open Setoid setoid |
| 31 |
|
| 32 |
∧-distribʳ-∨ : _∧_ DistributesOverʳ _∨_ |
| 33 |
∧-distribʳ-∨ x y z = begin |
| 34 |
(y ∨ z) ∧ x ≈⟨ ∧-comm _ _ ⟩ |
| 35 |
x ∧ (y ∨ z) ≈⟨ ∧-distribˡ-∨ x y z ⟩ |
| 36 |
x ∧ y ∨ x ∧ z ≈⟨ ∨-cong (∧-comm _ _) (∧-comm _ _) ⟩ |
| 37 |
y ∧ x ∨ z ∧ x ∎ |
| 38 |
|
| 39 |
∧-distrib-∨ : _∧_ DistributesOver _∨_ |
| 40 |
∧-distrib-∨ = ∧-distribˡ-∨ , ∧-distribʳ-∨ |
| 41 |
|
| 42 |
∨-distribˡ-∧ : _∨_ DistributesOverˡ _∧_ |
| 43 |
∨-distribˡ-∧ x y z = begin |
| 44 |
x ∨ y ∧ z ≈⟨ ∨-cong (sym (∨-absorbs-∧ x y)) refl ⟩ |
| 45 |
(x ∨ x ∧ y) ∨ y ∧ z ≈⟨ ∨-cong (∨-cong refl (∧-comm _ _)) refl ⟩ |
| 46 |
(x ∨ y ∧ x) ∨ y ∧ z ≈⟨ ∨-assoc x (y ∧ x) (y ∧ z) ⟩ |
| 47 |
x ∨ y ∧ x ∨ y ∧ z ≈⟨ ∨-cong refl (sym (∧-distribˡ-∨ y x z)) ⟩ |
| 48 |
x ∨ y ∧ (x ∨ z) ≈⟨ ∨-cong (sym (∧-absorbs-∨ _ _)) refl ⟩ |
| 49 |
x ∧ (x ∨ z) ∨ y ∧ (x ∨ z) ≈⟨ sym (∧-distribʳ-∨ (x ∨ z) x y) ⟩ |
| 50 |
(x ∨ y) ∧ (x ∨ z) ∎ |
| 51 |
|
| 52 |
∨-distribʳ-∧ : _∨_ DistributesOverʳ _∧_ |
| 53 |
∨-distribʳ-∧ x y z = begin |
| 54 |
y ∧ z ∨ x ≈⟨ ∨-comm _ _ ⟩ |
| 55 |
x ∨ y ∧ z ≈⟨ ∨-distribˡ-∧ _ _ _ ⟩ |
| 56 |
(x ∨ y) ∧ (x ∨ z) ≈⟨ ∧-cong (∨-comm _ _) (∨-comm _ _) ⟩ |
| 57 |
(y ∨ x) ∧ (z ∨ x) ∎ |
| 58 |
|
| 59 |
∨-distrib-∧ : _∨_ DistributesOver _∧_ |
| 60 |
∨-distrib-∧ = ∨-distribˡ-∧ , ∨-distribʳ-∧ |
| 61 |
|