Debian Codegraph @

src/Algebra/Lattice/Construct/Subst/Equality.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Substituting equalities for binary relations
5 ------------------------------------------------------------------------
6
7 -- For more general transformations between algebraic lattice structures
8 -- see `Algebra.Lattice.Morphisms`.
9
10 {-# OPTIONS --cubical-compatible --safe #-}
11
12 open import Data.Product.Base using (_,_)
13 open import Relation.Binary.Core using (Rel ; _⇔_)
14
15 module Algebra.Lattice.Construct.Subst.Equality
16 {a ℓ₁ ℓ₂} {A : Set a} {≈₁ : Rel A ℓ₁} {≈₂ : Rel A ℓ₂}
17 (equiv@(to , from) : ≈₁ ⇔ ≈₂)
18 where
19
20 open import Algebra.Core using (Op₂)
21 open import Algebra.Lattice.Structures
22 using (IsSemilattice ;IsLattice ;IsDistributiveLattice ;IsBooleanAlgebra )
23 open import Function.Base using (id)
24 open import Algebra.Construct.Subst.Equality equiv
25 open import Relation.Binary.Construct.Subst.Equality equiv
26
27 private
28 variable
29 ∧ ∨ : Op₂ A
30
31 ------------------------------------------------------------------------
32 -- Structures
33
34 isSemilattice : IsSemilattice ≈₁ ∧ → IsSemilattice ≈₂ ∧
35 isSemilattice S = record
36 { isBand = isBand S.isBand
37 ; comm = comm S.comm
38 } where module S = IsSemilattice ≈₁ S
39
40 isLattice : IsLattice ≈₁ ∨ ∧ → IsLattice ≈₂ ∨ ∧
41 isLattice {∨} {∧} S = record
42 { isEquivalence = isEquivalence S.isEquivalence
43 ; ∨-comm = comm S.∨-comm
44 ; ∨-assoc = assoc {∨} S.∨-assoc
45 ; ∨-cong = cong₂ S.∨-cong
46 ; ∧-comm = comm S.∧-comm
47 ; ∧-assoc = assoc {∧} S.∧-assoc
48 ; ∧-cong = cong₂ S.∧-cong
49 ; absorptive = absorptive {∨} {∧} S.absorptive
50 } where module S = IsLattice S
51
52 isDistributiveLattice : IsDistributiveLattice ≈₁ ∨ ∧ →
53 IsDistributiveLattice ≈₂ ∨ ∧
54 isDistributiveLattice {∨} {∧} S = record
55 { isLattice = isLattice S.isLattice
56 ; ∨-distrib-∧ = distrib {∨} {∧} S.∨-distrib-∧
57 ; ∧-distrib-∨ = distrib {∧} {∨} S.∧-distrib-∨
58 } where module S = IsDistributiveLattice S
59
60 isBooleanAlgebra : ∀ {¬ ⊤ ⊥} →
61 IsBooleanAlgebra ≈₁ ∨ ∧ ¬ ⊤ ⊥ →
62 IsBooleanAlgebra ≈₂ ∨ ∧ ¬ ⊤ ⊥
63 isBooleanAlgebra {∨} {∧} S = record
64 { isDistributiveLattice = isDistributiveLattice S.isDistributiveLattice
65 ; ∨-complement = inverse {_} {∨} S.∨-complement
66 ; ∧-complement = inverse {_} {∧} S.∧-complement
67 ; ¬-cong = cong₁ S.¬-cong
68 } where module S = IsBooleanAlgebra S