Switch maps (and consequently most of the code) to using instances
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
open import Lattice
|
||||
open import Data.Unit using (⊤)
|
||||
|
||||
-- Due to universe levels, it becomes relatively annoying to handle the case
|
||||
-- where the levels of A and B are not the same. For the time being, constrain
|
||||
-- them to be the same.
|
||||
|
||||
module Lattice.IterProd {a} {A B : Set a}
|
||||
(_≈₁_ : A → A → Set a) (_≈₂_ : B → B → Set a)
|
||||
(_⊔₁_ : A → A → A) (_⊔₂_ : B → B → B)
|
||||
(_⊓₁_ : A → A → A) (_⊓₂_ : B → B → B)
|
||||
(lA : IsLattice A _≈₁_ _⊔₁_ _⊓₁_) (lB : IsLattice B _≈₂_ _⊔₂_ _⊓₂_) where
|
||||
module Lattice.IterProd {a} (A B : Set a)
|
||||
{_≈₁_ : A → A → Set a} {_≈₂_ : B → B → Set a}
|
||||
{_⊔₁_ : A → A → A} {_⊔₂_ : B → B → B}
|
||||
{_⊓₁_ : A → A → A} {_⊓₂_ : B → B → B}
|
||||
{{lA : IsLattice A _≈₁_ _⊔₁_ _⊓₁_}} {{lB : IsLattice B _≈₂_ _⊔₂_ _⊓₂_}} (dummy : ⊤) where
|
||||
|
||||
open import Agda.Primitive using (lsuc)
|
||||
open import Data.Nat using (ℕ; zero; suc; _+_)
|
||||
@@ -119,49 +120,55 @@ private
|
||||
_⊓₁_ (Everything._⊓_ everythingRest)
|
||||
lA (Everything.isLattice everythingRest) as P
|
||||
|
||||
module _ (k : ℕ) where
|
||||
open Everything (everything k) using (_≈_; _⊔_; _⊓_; isLattice) public
|
||||
open Lattice.IsLattice isLattice public
|
||||
module _ {k : ℕ} where
|
||||
open Everything (everything k) using (_≈_; _⊔_; _⊓_) public
|
||||
open Lattice.IsLattice (Everything.isLattice (everything k)) public
|
||||
|
||||
lattice : Lattice (IterProd k)
|
||||
lattice = record
|
||||
{ _≈_ = _≈_
|
||||
; _⊔_ = _⊔_
|
||||
; _⊓_ = _⊓_
|
||||
; isLattice = isLattice
|
||||
}
|
||||
instance
|
||||
isLattice = Everything.isLattice (everything k)
|
||||
|
||||
module _ (≈₁-Decidable : IsDecidable _≈₁_) (≈₂-Decidable : IsDecidable _≈₂_)
|
||||
(h₁ h₂ : ℕ)
|
||||
(fhA : FixedHeight₁ h₁) (fhB : FixedHeight₂ h₂) where
|
||||
|
||||
private
|
||||
required : RequiredForFixedHeight
|
||||
required = record
|
||||
{ ≈₁-Decidable = ≈₁-Decidable
|
||||
; ≈₂-Decidable = ≈₂-Decidable
|
||||
; h₁ = h₁
|
||||
; h₂ = h₂
|
||||
; fhA = fhA
|
||||
; fhB = fhB
|
||||
}
|
||||
|
||||
fixedHeight = IsFiniteHeightWithBotAndDecEq.fixedHeight (Everything.isFiniteHeightIfSupported (everything k) required)
|
||||
|
||||
isFiniteHeightLattice = record
|
||||
{ isLattice = isLattice
|
||||
; fixedHeight = fixedHeight
|
||||
}
|
||||
|
||||
finiteHeightLattice : FiniteHeightLattice (IterProd k)
|
||||
finiteHeightLattice = record
|
||||
{ height = IsFiniteHeightWithBotAndDecEq.height (Everything.isFiniteHeightIfSupported (everything k) required)
|
||||
; _≈_ = _≈_
|
||||
lattice : Lattice (IterProd k)
|
||||
lattice = record
|
||||
{ _≈_ = _≈_
|
||||
; _⊔_ = _⊔_
|
||||
; _⊓_ = _⊓_
|
||||
; isFiniteHeightLattice = isFiniteHeightLattice
|
||||
; isLattice = isLattice
|
||||
}
|
||||
|
||||
⊥-built : Height.⊥ fixedHeight ≡ (build (Height.⊥ fhA) (Height.⊥ fhB) k)
|
||||
⊥-built = IsFiniteHeightWithBotAndDecEq.⊥-correct (Everything.isFiniteHeightIfSupported (everything k) required)
|
||||
module _ {{≈₁-Decidable : IsDecidable _≈₁_}} {{≈₂-Decidable : IsDecidable _≈₂_}}
|
||||
{h₁ h₂ : ℕ}
|
||||
{{fhA : FixedHeight₁ h₁}} {{fhB : FixedHeight₂ h₂}} where
|
||||
|
||||
private
|
||||
isFiniteHeightWithBotAndDecEq =
|
||||
Everything.isFiniteHeightIfSupported (everything k)
|
||||
record
|
||||
{ ≈₁-Decidable = ≈₁-Decidable
|
||||
; ≈₂-Decidable = ≈₂-Decidable
|
||||
; h₁ = h₁
|
||||
; h₂ = h₂
|
||||
; fhA = fhA
|
||||
; fhB = fhB
|
||||
}
|
||||
open IsFiniteHeightWithBotAndDecEq isFiniteHeightWithBotAndDecEq using (height; ⊥-correct)
|
||||
|
||||
instance
|
||||
fixedHeight = IsFiniteHeightWithBotAndDecEq.fixedHeight isFiniteHeightWithBotAndDecEq
|
||||
|
||||
isFiniteHeightLattice = record
|
||||
{ isLattice = isLattice
|
||||
; fixedHeight = fixedHeight
|
||||
}
|
||||
|
||||
finiteHeightLattice : FiniteHeightLattice (IterProd k)
|
||||
finiteHeightLattice = record
|
||||
{ height = height
|
||||
; _≈_ = _≈_
|
||||
; _⊔_ = _⊔_
|
||||
; _⊓_ = _⊓_
|
||||
; isFiniteHeightLattice = isFiniteHeightLattice
|
||||
}
|
||||
|
||||
⊥-built : Height.⊥ fixedHeight ≡ (build (Height.⊥ fhA) (Height.⊥ fhB) k)
|
||||
⊥-built = ⊥-correct
|
||||
|
||||
|
||||
Reference in New Issue
Block a user