Make 'isLattice' for simple types be an instance
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
4da9b6d3cd
commit
8abf6f8670
@ -18,6 +18,7 @@ private
|
|||||||
≡-⊓-cong : ∀ {a₁ a₂ a₃ a₄} → a₁ ≡ a₂ → a₃ ≡ a₄ → (a₁ ⊓ a₃) ≡ (a₂ ⊓ a₄)
|
≡-⊓-cong : ∀ {a₁ a₂ a₃ a₄} → a₁ ≡ a₂ → a₃ ≡ a₄ → (a₁ ⊓ a₃) ≡ (a₂ ⊓ a₄)
|
||||||
≡-⊓-cong a₁≡a₂ a₃≡a₄ rewrite a₁≡a₂ rewrite a₃≡a₄ = refl
|
≡-⊓-cong a₁≡a₂ a₃≡a₄ rewrite a₁≡a₂ rewrite a₃≡a₄ = refl
|
||||||
|
|
||||||
|
instance
|
||||||
isMaxSemilattice : IsSemilattice ℕ _≡_ _⊔_
|
isMaxSemilattice : IsSemilattice ℕ _≡_ _⊔_
|
||||||
isMaxSemilattice = record
|
isMaxSemilattice = record
|
||||||
{ ≈-equiv = record
|
{ ≈-equiv = record
|
||||||
@ -74,6 +75,7 @@ private
|
|||||||
helper : x ⊔ (x ⊓ y) ≤ x ⊔ x → x ⊔ x ≡ x → x ⊔ (x ⊓ y) ≤ x
|
helper : x ⊔ (x ⊓ y) ≤ x ⊔ x → x ⊔ x ≡ x → x ⊔ (x ⊓ y) ≤ x
|
||||||
helper x⊔x⊓y≤x⊔x x⊔x≡x rewrite x⊔x≡x = x⊔x⊓y≤x⊔x
|
helper x⊔x⊓y≤x⊔x x⊔x≡x rewrite x⊔x≡x = x⊔x⊓y≤x⊔x
|
||||||
|
|
||||||
|
instance
|
||||||
isLattice : IsLattice ℕ _≡_ _⊔_ _⊓_
|
isLattice : IsLattice ℕ _≡_ _⊔_ _⊓_
|
||||||
isLattice = record
|
isLattice = record
|
||||||
{ joinSemilattice = isMaxSemilattice
|
{ joinSemilattice = isMaxSemilattice
|
||||||
|
@ -45,6 +45,7 @@ tt ⊓ tt = tt
|
|||||||
⊔-idemp : (x : ⊤) → (x ⊔ x) ≈ x
|
⊔-idemp : (x : ⊤) → (x ⊔ x) ≈ x
|
||||||
⊔-idemp tt = Eq.refl
|
⊔-idemp tt = Eq.refl
|
||||||
|
|
||||||
|
instance
|
||||||
isJoinSemilattice : IsSemilattice ⊤ _≈_ _⊔_
|
isJoinSemilattice : IsSemilattice ⊤ _≈_ _⊔_
|
||||||
isJoinSemilattice = record
|
isJoinSemilattice = record
|
||||||
{ ≈-equiv = ≈-equiv
|
{ ≈-equiv = ≈-equiv
|
||||||
@ -66,6 +67,7 @@ isJoinSemilattice = record
|
|||||||
⊓-idemp : (x : ⊤) → (x ⊓ x) ≈ x
|
⊓-idemp : (x : ⊤) → (x ⊓ x) ≈ x
|
||||||
⊓-idemp tt = Eq.refl
|
⊓-idemp tt = Eq.refl
|
||||||
|
|
||||||
|
instance
|
||||||
isMeetSemilattice : IsSemilattice ⊤ _≈_ _⊓_
|
isMeetSemilattice : IsSemilattice ⊤ _≈_ _⊓_
|
||||||
isMeetSemilattice = record
|
isMeetSemilattice = record
|
||||||
{ ≈-equiv = ≈-equiv
|
{ ≈-equiv = ≈-equiv
|
||||||
@ -75,18 +77,13 @@ isMeetSemilattice = record
|
|||||||
; ⊔-idemp = ⊓-idemp
|
; ⊔-idemp = ⊓-idemp
|
||||||
}
|
}
|
||||||
|
|
||||||
absorb-⊔-⊓ : (x y : ⊤) → (x ⊔ (x ⊓ y)) ≈ x
|
instance
|
||||||
absorb-⊔-⊓ tt tt = Eq.refl
|
|
||||||
|
|
||||||
absorb-⊓-⊔ : (x y : ⊤) → (x ⊓ (x ⊔ y)) ≈ x
|
|
||||||
absorb-⊓-⊔ tt tt = Eq.refl
|
|
||||||
|
|
||||||
isLattice : IsLattice ⊤ _≈_ _⊔_ _⊓_
|
isLattice : IsLattice ⊤ _≈_ _⊔_ _⊓_
|
||||||
isLattice = record
|
isLattice = record
|
||||||
{ joinSemilattice = isJoinSemilattice
|
{ joinSemilattice = isJoinSemilattice
|
||||||
; meetSemilattice = isMeetSemilattice
|
; meetSemilattice = isMeetSemilattice
|
||||||
; absorb-⊔-⊓ = absorb-⊔-⊓
|
; absorb-⊔-⊓ = λ { tt tt → Eq.refl }
|
||||||
; absorb-⊓-⊔ = absorb-⊓-⊔
|
; absorb-⊓-⊔ = λ { tt tt → Eq.refl }
|
||||||
}
|
}
|
||||||
|
|
||||||
lattice : Lattice ⊤
|
lattice : Lattice ⊤
|
||||||
@ -107,6 +104,7 @@ private
|
|||||||
isLongest {tt} {tt} (step (tt⊔tt≈tt , tt̷≈tt) _ _) = ⊥-elim (tt̷≈tt refl)
|
isLongest {tt} {tt} (step (tt⊔tt≈tt , tt̷≈tt) _ _) = ⊥-elim (tt̷≈tt refl)
|
||||||
isLongest (done _) = z≤n
|
isLongest (done _) = z≤n
|
||||||
|
|
||||||
|
instance
|
||||||
fixedHeight : IsLattice.FixedHeight isLattice 0
|
fixedHeight : IsLattice.FixedHeight isLattice 0
|
||||||
fixedHeight = record
|
fixedHeight = record
|
||||||
{ ⊥ = tt
|
{ ⊥ = tt
|
||||||
|
Loading…
Reference in New Issue
Block a user