↑ Top


Varieties, Model Theory, and Equational Logic

This is the Varieties.EquationalLogic module of the Agda Universal Algebra Library where the binary β€œmodels” relation ⊧, relating algebras (or classes of algebras) to the identities that they satisfy, is defined.

Let 𝑆 be a signature. By an identity or equation in 𝑆 we mean an ordered pair of terms, written 𝑝 β‰ˆ π‘ž, from the term algebra 𝑻 X. If 𝑨 is an 𝑆-algebra we say that 𝑨 satisfies 𝑝 β‰ˆ π‘ž provided 𝑝 Μ‡ 𝑨 ≑ π‘ž Μ‡ 𝑨 holds. In this situation, we write 𝑨 ⊧ 𝑝 β‰ˆ π‘ž and say that 𝑨 models the identity 𝑝 β‰ˆ q. If 𝒦 is a class of algebras, all of the same signature, we write 𝒦 ⊧ p β‰ˆ q if, for every 𝑨 ∈ 𝒦, 𝑨 ⊧ 𝑝 β‰ˆ π‘ž.

Because a class of structures has a different type than a single structure, we must use a slightly different syntax to avoid overloading the relations ⊧ and β‰ˆ. As a reasonable alternative to what we would normally express informally as 𝒦 ⊧ 𝑝 β‰ˆ π‘ž, we have settled on 𝒦 ⊫ p β‰ˆ q to denote this relation. To reiterate, if 𝒦 is a class of 𝑆-algebras, we write 𝒦 ⊫ 𝑝 β‰ˆ π‘ž if every 𝑨 ∈ 𝒦 satisfies 𝑨 ⊧ 𝑝 β‰ˆ π‘ž.

{-# OPTIONS --without-K --exact-split --safe #-}

open import Algebras.Basic using ( π“ž ; π“₯ ; Signature )

module Varieties.EquationalLogic {𝑆 : Signature π“ž π“₯} where

-- Imports from Agda and the Agda Standard Library ----------------
open import Agda.Primitive using    ( _βŠ”_ ;  lsuc ; Level )
                           renaming ( Set to Type )
open import Data.Product   using    ( _Γ—_ ; _,_ ; Ξ£-syntax)
                           renaming ( proj₁ to fst ; projβ‚‚ to snd )
open import Relation.Unary using    ( Pred ; _∈_ )

-- Imports from the Agda Universal Algebra Library ----------------
open import Overture.Preliminaries    using ( _β‰ˆ_ )
open import Algebras.Basic            using ( Algebra )
open import Algebras.Products {𝑆 = 𝑆} using ( ov )
open import Terms.Basic       {𝑆 = 𝑆} using ( Term ; 𝑻 )
open import Terms.Operations  {𝑆 = 𝑆} using ( _⟦_⟧ )
private variable
 Ο‡ Ξ± ρ ΞΉ : Level
 X : Type Ο‡

The models relation

We define the binary β€œmodels” relation ⊧ using infix syntax so that we may write, e.g., 𝑨 ⊧ p β‰ˆ q or 𝒦 ⊫ p β‰ˆ q, relating algebras (or classes of algebras) to the identities that they satisfy. We also prove a couple of useful facts about ⊧. More will be proved about ⊧ in the next module, Varieties.EquationalLogic.

_⊧_β‰ˆ_ : Algebra Ξ± 𝑆 β†’ Term X β†’ Term X β†’ Type _
𝑨 ⊧ p β‰ˆ q = 𝑨 ⟦ p ⟧ β‰ˆ 𝑨 ⟦ q ⟧

_⊫_β‰ˆ_ : Pred(Algebra Ξ± 𝑆) ρ β†’ Term X β†’ Term X β†’ Type _
𝒦 ⊫ p β‰ˆ q = {𝑨 : Algebra _ 𝑆} β†’ 𝒦 𝑨 β†’ 𝑨 ⊧ p β‰ˆ q

(Unicode tip. Type \models to get ⊧ ; type | = to get ⊫.)

The expression 𝑨 ⊧ p β‰ˆ q represents the assertion that the identity p β‰ˆ q holds when interpreted in the algebra 𝑨; syntactically, 𝑨 ⟦ p ⟧ β‰ˆ 𝑨 ⟦ q ⟧.

The expression 𝑨 ⟦ p ⟧ β‰ˆ 𝑨 ⟦ q ⟧ denotes extensional equality; that is, for each β€œenvironment” Ξ· : X β†’ ∣ 𝑨 ∣ (assigning values in the domain of 𝑨 to the variable symbols in X) the (intensional) equality 𝑨 ⟦ p ⟧ Ξ· ≑ 𝑨 ⟦ q ⟧ Ξ· holds.

Equational theories and models

If 𝒦 denotes a class of structures, then Th 𝒦 represents the set of identities modeled by the members of 𝒦.

Th : Pred (Algebra Ξ± 𝑆) (ov Ξ±) β†’ Pred(Term X Γ— Term X) _
Th 𝒦 = Ξ» (p , q) β†’ 𝒦 ⊫ p β‰ˆ q

Perhaps we want to represent Th 𝒦 as an indexed collection. We do so essentially by taking Th 𝒦 itself to be the index set, as follows.

module _ {X : Type Ο‡}{𝒦 : Pred (Algebra Ξ± 𝑆) (ov Ξ±)} where

 ℐ : Type (ov(Ξ± βŠ” Ο‡))
 ℐ = Ξ£[ (p , q) ∈ (Term X Γ— Term X) ] 𝒦 ⊫ p β‰ˆ q

 β„° : ℐ β†’ Term X Γ— Term X
 β„° ((p , q) , _) = (p , q)

If β„° denotes a set of identities, then Mod β„° is the class of structures satisfying the identities in β„°.

Mod : Pred(Term X Γ— Term X) (ov Ξ±) β†’ Pred(Algebra Ξ± 𝑆) _
Mod β„° = Ξ» 𝑨 β†’ βˆ€ p q β†’ (p , q) ∈ β„° β†’ 𝑨 ⊧ p β‰ˆ q
-- (tupled version)
Modα΅— : {I : Type ΞΉ} β†’ (I β†’ Term X Γ— Term X) β†’ {Ξ± : Level} β†’ Pred(Algebra Ξ± 𝑆) _
Modα΅— β„° = Ξ» 𝑨 β†’ βˆ€ i β†’ 𝑨 ⊧ (fst (β„° i)) β‰ˆ (snd (β„° i))


↑ Varieties Varieties.Closure β†’