| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Choosing between elements based on the result of applying a function |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Algebra.Lattice.Construct.LiftedChoice where |
| 10 |
|
| 11 |
open import Algebra |
| 12 |
using (Op₂; IsSelectiveMagma; Associative; Commutative) |
| 13 |
open import Algebra.Lattice.Structures using (IsSemilattice) |
| 14 |
open import Algebra.Construct.LiftedChoice using (Lift; isBand; comm) |
| 15 |
open import Relation.Binary.Core using (Rel; _Preserves_⟶_) |
| 16 |
open import Relation.Binary.Structures using (IsEquivalence) |
| 17 |
open import Level using (Level) |
| 18 |
|
| 19 |
private |
| 20 |
variable |
| 21 |
a b p ℓ : Level |
| 22 |
A : Set a |
| 23 |
B : Set b |
| 24 |
|
| 25 |
------------------------------------------------------------------------ |
| 26 |
-- Structures |
| 27 |
|
| 28 |
module _ {_≈_ : Rel B ℓ} {_∙_ : Op₂ B} |
| 29 |
(∙-isSelectiveMagma : IsSelectiveMagma _≈_ _∙_) |
| 30 |
{_≈′_ : Rel A ℓ} {f : A → B} |
| 31 |
(f-injective : ∀ {x y} → f x ≈ f y → x ≈′ y) |
| 32 |
(f-cong : f Preserves _≈′_ ⟶ _≈_) |
| 33 |
(≈′-isEquivalence : IsEquivalence _≈′_) |
| 34 |
where |
| 35 |
|
| 36 |
open IsSelectiveMagma ∙-isSelectiveMagma renaming (sel to ∙-sel) |
| 37 |
|
| 38 |
private |
| 39 |
_◦_ = Lift _≈_ _∙_ ∙-sel f |
| 40 |
|
| 41 |
isSemilattice : Associative _≈_ _∙_ → Commutative _≈_ _∙_ → |
| 42 |
IsSemilattice _≈′_ _◦_ |
| 43 |
isSemilattice ∙-assoc ∙-comm = record |
| 44 |
{ isBand = isBand ∙-isSelectiveMagma f-injective f-cong ≈′-isEquivalence ∙-assoc |
| 45 |
; comm = comm ∙-isSelectiveMagma (λ {x} → f-injective {x}) ∙-comm |
| 46 |
} |