Skip to content

Commit d5c3bac

Browse files
authored
Add Algebra.Morphism.LatticeMonomorphism (#1376)
1 parent 3a1d216 commit d5c3bac

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ New modules
213213
System.Environment.Primitive
214214
```
215215

216+
* New morphisms
217+
```
218+
Algebra.Morphism.LatticeMonomorphism
219+
```
220+
216221
Other major changes
217222
-------------------
218223

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
------------------------------------------------------------------------
2+
-- The Agda standard library
3+
--
4+
-- Consequences of a monomorphism between lattice-like structures
5+
------------------------------------------------------------------------
6+
7+
-- See Data.Nat.Binary.Properties for examples of how this and similar
8+
-- modules can be used to easily translate properties between types.
9+
10+
{-# OPTIONS --without-K --safe #-}
11+
12+
open import Algebra.Structures
13+
open import Algebra.Definitions
14+
open import Algebra.Bundles
15+
open import Algebra.Morphism.Structures
16+
import Relation.Binary.Morphism.RelMonomorphism as RelMonomorphisms
17+
import Algebra.Morphism.MagmaMonomorphism as MagmaMonomorphisms
18+
import Algebra.Properties.Lattice as LatticeProperties
19+
open import Data.Product using (_,_)
20+
import Relation.Binary.Reasoning.Setoid as SetoidReasoning
21+
22+
module Algebra.Morphism.LatticeMonomorphism
23+
{a b ℓ₁ ℓ₂} {L₁ : RawLattice a ℓ₁} {L₂ : RawLattice b ℓ₂} {⟦_⟧}
24+
(isLatticeMonomorphism : IsLatticeMonomorphism L₁ L₂ ⟦_⟧)
25+
where
26+
27+
open IsLatticeMonomorphism isLatticeMonomorphism
28+
open RawLattice L₁ renaming (_≈_ to _≈₁_; _∨_ to _∨_; _∧_ to _∧_)
29+
open RawLattice L₂ renaming (_≈_ to _≈₂_; _∨_ to _⊔_; _∧_ to _⊓_)
30+
31+
------------------------------------------------------------------------
32+
-- Re-export all properties of magma monomorphisms
33+
34+
open MagmaMonomorphisms ∨-isMagmaMonomorphism public
35+
using () renaming
36+
( cong to ∨-cong
37+
; assoc to ∨-assoc
38+
; comm to ∨-comm
39+
; idem to ∨-idem
40+
; sel to ∨-sel
41+
; cancelˡ to ∨-cancelˡ
42+
; cancelʳ to ∨-cancelʳ
43+
; cancel to ∨-cancel
44+
)
45+
46+
open MagmaMonomorphisms ∧-isMagmaMonomorphism public
47+
using () renaming
48+
( cong to ∧-cong
49+
; assoc to ∧-assoc
50+
; comm to ∧-comm
51+
; idem to ∧-idem
52+
; sel to ∧-sel
53+
; cancelˡ to ∧-cancelˡ
54+
; cancelʳ to ∧-cancelʳ
55+
; cancel to ∧-cancel
56+
)
57+
58+
------------------------------------------------------------------------
59+
-- Lattice-specific properties
60+
61+
module _ (⊔-⊓-isLattice : IsLattice _≈₂_ _⊔_ _⊓_) where
62+
63+
open IsLattice ⊔-⊓-isLattice using (isEquivalence) renaming
64+
( ∨-congˡ to ⊔-congˡ
65+
; ∨-congʳ to ⊔-congʳ
66+
; ∧-cong to ⊓-cong
67+
; ∧-congˡ to ⊓-congˡ
68+
; ∨-absorbs-∧ to ⊔-absorbs-⊓
69+
; ∧-absorbs-∨ to ⊓-absorbs-⊔
70+
)
71+
open SetoidReasoning (record { isEquivalence = isEquivalence })
72+
73+
∨-absorbs-∧ : _Absorbs_ _≈₁_ _∨_ _∧_
74+
∨-absorbs-∧ x y = injective (begin
75+
⟦ x ∨ x ∧ y ⟧ ≈⟨ ∨-homo x (x ∧ y) ⟩
76+
⟦ x ⟧ ⊔ ⟦ x ∧ y ⟧ ≈⟨ ⊔-congˡ (∧-homo x y) ⟩
77+
⟦ x ⟧ ⊔ ⟦ x ⟧ ⊓ ⟦ y ⟧ ≈⟨ ⊔-absorbs-⊓ ⟦ x ⟧ ⟦ y ⟧ ⟩
78+
⟦ x ⟧ ∎)
79+
80+
∧-absorbs-∨ : _Absorbs_ _≈₁_ _∧_ _∨_
81+
∧-absorbs-∨ x y = injective (begin
82+
⟦ x ∧ (x ∨ y) ⟧ ≈⟨ ∧-homo x (x ∨ y) ⟩
83+
⟦ x ⟧ ⊓ ⟦ x ∨ y ⟧ ≈⟨ ⊓-congˡ (∨-homo x y) ⟩
84+
⟦ x ⟧ ⊓ (⟦ x ⟧ ⊔ ⟦ y ⟧) ≈⟨ ⊓-absorbs-⊔ ⟦ x ⟧ ⟦ y ⟧ ⟩
85+
⟦ x ⟧ ∎)
86+
87+
absorptive : Absorptive _≈₁_ _∨_ _∧_
88+
absorptive = ∨-absorbs-∧ , ∧-absorbs-∨
89+
90+
distribʳ : _DistributesOverʳ_ _≈₂_ _⊔_ _⊓_ _DistributesOverʳ_ _≈₁_ _∨_ _∧_
91+
distribʳ distribʳ x y z = injective (begin
92+
⟦ y ∧ z ∨ x ⟧ ≈⟨ ∨-homo (y ∧ z) x ⟩
93+
⟦ y ∧ z ⟧ ⊔ ⟦ x ⟧ ≈⟨ ⊔-congʳ (∧-homo y z) ⟩
94+
⟦ y ⟧ ⊓ ⟦ z ⟧ ⊔ ⟦ x ⟧ ≈⟨ distribʳ ⟦ x ⟧ ⟦ y ⟧ ⟦ z ⟧ ⟩
95+
(⟦ y ⟧ ⊔ ⟦ x ⟧) ⊓ (⟦ z ⟧ ⊔ ⟦ x ⟧) ≈˘⟨ ⊓-cong (∨-homo y x) (∨-homo z x) ⟩
96+
⟦ y ∨ x ⟧ ⊓ ⟦ z ∨ x ⟧ ≈˘⟨ ∧-homo (y ∨ x) (z ∨ x) ⟩
97+
⟦ (y ∨ x) ∧ (z ∨ x) ⟧ ∎)
98+
99+
isLattice : IsLattice _≈₂_ _⊔_ _⊓_ IsLattice _≈₁_ _∨_ _∧_
100+
isLattice isLattice = record
101+
{ isEquivalence = RelMonomorphisms.isEquivalence isRelMonomorphism L.isEquivalence
102+
; ∨-comm = ∨-comm LP.∨-isMagma L.∨-comm
103+
; ∨-assoc = ∨-assoc LP.∨-isMagma L.∨-assoc
104+
; ∨-cong = ∨-cong LP.∨-isMagma
105+
; ∧-comm = ∧-comm LP.∧-isMagma L.∧-comm
106+
; ∧-assoc = ∧-assoc LP.∧-isMagma L.∧-assoc
107+
; ∧-cong = ∧-cong LP.∧-isMagma
108+
; absorptive = absorptive isLattice
109+
} where
110+
module L = IsLattice isLattice
111+
module LP = LatticeProperties (record { isLattice = isLattice })
112+
113+
isDistributiveLattice : IsDistributiveLattice _≈₂_ _⊔_ _⊓_
114+
IsDistributiveLattice _≈₁_ _∨_ _∧_
115+
isDistributiveLattice isDL = record
116+
{ isLattice = isLattice L.isLattice
117+
; ∨-distribʳ-∧ = distribʳ L.isLattice L.∨-distribʳ-∧
118+
} where module L = IsDistributiveLattice isDL
119+

0 commit comments

Comments
 (0)