Switch product to using instances
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
70847d51db
commit
cf824dc744
@ -40,11 +40,11 @@ build a b (suc s) = (a , build a b s)
|
||||
private
|
||||
record RequiredForFixedHeight : Set (lsuc a) where
|
||||
field
|
||||
≈₁-Decidable : IsDecidable _≈₁_
|
||||
≈₂-Decidable : IsDecidable _≈₂_
|
||||
{{≈₁-Decidable}} : IsDecidable _≈₁_
|
||||
{{≈₂-Decidable}} : IsDecidable _≈₂_
|
||||
h₁ h₂ : ℕ
|
||||
fhA : FixedHeight₁ h₁
|
||||
fhB : FixedHeight₂ h₂
|
||||
{{fhA}} : FixedHeight₁ h₁
|
||||
{{fhB}} : FixedHeight₂ h₂
|
||||
|
||||
⊥₁ : A
|
||||
⊥₁ = Height.⊥ fhA
|
||||
@ -102,10 +102,9 @@ private
|
||||
{ height = (RequiredForFixedHeight.h₁ req) + IsFiniteHeightWithBotAndDecEq.height fhlRest
|
||||
; fixedHeight =
|
||||
P.fixedHeight
|
||||
(RequiredForFixedHeight.≈₁-Decidable req) (IsFiniteHeightWithBotAndDecEq.≈-Decidable fhlRest)
|
||||
(RequiredForFixedHeight.h₁ req) (IsFiniteHeightWithBotAndDecEq.height fhlRest)
|
||||
(RequiredForFixedHeight.fhA req) (IsFiniteHeightWithBotAndDecEq.fixedHeight fhlRest)
|
||||
; ≈-Decidable = P.≈-Decidable (RequiredForFixedHeight.≈₁-Decidable req) (IsFiniteHeightWithBotAndDecEq.≈-Decidable fhlRest)
|
||||
{{≈₂-Decidable = IsFiniteHeightWithBotAndDecEq.≈-Decidable fhlRest}}
|
||||
{{fhB = IsFiniteHeightWithBotAndDecEq.fixedHeight fhlRest}}
|
||||
; ≈-Decidable = P.≈-Decidable {{≈₂-Decidable = IsFiniteHeightWithBotAndDecEq.≈-Decidable fhlRest}}
|
||||
; ⊥-correct =
|
||||
cong ((Height.⊥ (RequiredForFixedHeight.fhA req)) ,_)
|
||||
(IsFiniteHeightWithBotAndDecEq.⊥-correct fhlRest)
|
||||
@ -113,12 +112,7 @@ private
|
||||
}
|
||||
where
|
||||
everythingRest = everything k'
|
||||
|
||||
import Lattice.Prod
|
||||
_≈₁_ (Everything._≈_ everythingRest)
|
||||
_⊔₁_ (Everything._⊔_ everythingRest)
|
||||
_⊓₁_ (Everything._⊓_ everythingRest)
|
||||
lA (Everything.isLattice everythingRest) as P
|
||||
import Lattice.Prod A (IterProd k') {{lB = Everything.isLattice everythingRest}} as P
|
||||
|
||||
module _ {k : ℕ} where
|
||||
open Everything (everything k) using (_≈_; _⊔_; _⊓_) public
|
||||
|
@ -1,10 +1,10 @@
|
||||
open import Lattice
|
||||
|
||||
module Lattice.Prod {a b} {A : Set a} {B : Set b}
|
||||
(_≈₁_ : A → A → Set a) (_≈₂_ : B → B → Set b)
|
||||
(_⊔₁_ : A → A → A) (_⊔₂_ : B → B → B)
|
||||
(_⊓₁_ : A → A → A) (_⊓₂_ : B → B → B)
|
||||
(lA : IsLattice A _≈₁_ _⊔₁_ _⊓₁_) (lB : IsLattice B _≈₂_ _⊔₂_ _⊓₂_) where
|
||||
module Lattice.Prod {a b} (A : Set a) (B : Set b)
|
||||
{_≈₁_ : A → A → Set a} {_≈₂_ : B → B → Set b}
|
||||
{_⊔₁_ : A → A → A} {_⊔₂_ : B → B → B}
|
||||
{_⊓₁_ : A → A → A} {_⊓₂_ : B → B → B}
|
||||
{{lA : IsLattice A _≈₁_ _⊔₁_ _⊓₁_}} {{lB : IsLattice B _≈₂_ _⊔₂_ _⊓₂_}} where
|
||||
|
||||
open import Agda.Primitive using (Level) renaming (_⊔_ to _⊔ℓ_)
|
||||
open import Data.Nat using (ℕ; _≤_; _+_; suc)
|
||||
@ -40,6 +40,7 @@ open IsLattice lB using () renaming
|
||||
_≈_ : A × B → A × B → Set (a ⊔ℓ b)
|
||||
(a₁ , b₁) ≈ (a₂ , b₂) = (a₁ ≈₁ a₂) × (b₁ ≈₂ b₂)
|
||||
|
||||
instance
|
||||
≈-equiv : IsEquivalence (A × B) _≈_
|
||||
≈-equiv = record
|
||||
{ ≈-refl = λ {p} → (≈₁-refl , ≈₂-refl)
|
||||
@ -76,6 +77,7 @@ private module ProdIsSemilattice (f₁ : A → A → A) (f₂ : B → B → B) (
|
||||
)
|
||||
}
|
||||
|
||||
instance
|
||||
isJoinSemilattice : IsSemilattice (A × B) _≈_ _⊔_
|
||||
isJoinSemilattice = ProdIsSemilattice.isSemilattice _⊔₁_ _⊔₂_ joinSemilattice₁ joinSemilattice₂
|
||||
|
||||
@ -104,7 +106,7 @@ lattice = record
|
||||
; isLattice = isLattice
|
||||
}
|
||||
|
||||
module _ (≈₁-Decidable : IsDecidable _≈₁_) (≈₂-Decidable : IsDecidable _≈₂_) where
|
||||
module _ {{≈₁-Decidable : IsDecidable _≈₁_}} {{≈₂-Decidable : IsDecidable _≈₂_}} where
|
||||
open IsDecidable ≈₁-Decidable using () renaming (R-dec to ≈₁-dec)
|
||||
open IsDecidable ≈₂-Decidable using () renaming (R-dec to ≈₂-dec)
|
||||
|
||||
@ -115,11 +117,12 @@ module _ (≈₁-Decidable : IsDecidable _≈₁_) (≈₂-Decidable : IsDecidab
|
||||
... | no a₁̷≈a₂ | _ = no (λ (a₁≈a₂ , _) → a₁̷≈a₂ a₁≈a₂)
|
||||
... | _ | no b₁̷≈b₂ = no (λ (_ , b₁≈b₂) → b₁̷≈b₂ b₁≈b₂)
|
||||
|
||||
instance
|
||||
≈-Decidable : IsDecidable _≈_
|
||||
≈-Decidable = record { R-dec = ≈-dec }
|
||||
|
||||
module _ (h₁ h₂ : ℕ)
|
||||
(fhA : FixedHeight₁ h₁) (fhB : FixedHeight₂ h₂) where
|
||||
module _ {h₁ h₂ : ℕ}
|
||||
{{fhA : FixedHeight₁ h₁}} {{fhB : FixedHeight₂ h₂}} where
|
||||
|
||||
open import Data.Nat.Properties
|
||||
open IsLattice isLattice using (_≼_; _≺_; ≺-cong)
|
||||
@ -167,6 +170,7 @@ module _ (≈₁-Decidable : IsDecidable _≈₁_) (≈₂-Decidable : IsDecidab
|
||||
, m≤n⇒m≤o+n 1 (subst (n ≤_) (sym (+-suc n₁ n₂)) (+-monoʳ-≤ 1 n≤n₁+n₂))
|
||||
))
|
||||
|
||||
instance
|
||||
fixedHeight : IsLattice.FixedHeight isLattice (h₁ + h₂)
|
||||
fixedHeight = record
|
||||
{ ⊥ = (⊥₁ , ⊥₂)
|
||||
|
Loading…
Reference in New Issue
Block a user