This is the Base.Structures.Graphs0 module of the Agda Universal Algebra Library.
N.B. This module differs from Graphs.lagda in that here we assume some universes are level zero (i.e., ββ). This simplifies some things; e.g., we avoid having to use lift and lower (cf. Base/Structures/Graphs.lagda)
Definition [Graph of a structure]. Let π¨
be an (π
,πΉ)
-structure (relations from π
and operations from πΉ
).
The graph of π¨
is the structure Gr π¨
with the same domain as π¨
with relations from π
and together with a (k+1)
-ary relation symbol G π
for each π β πΉ
of arity k
, which is interpreted in Gr π¨
as all tuples (t , y) β Aα΅βΊΒΉ
such that π t β‘ y
. (See also Definition 2 of https://arxiv.org/pdf/2010.04958v2.pdf)
{-# OPTIONS --without-K --exact-split --safe #-} module Base.Structures.Graphs0 where -- Imports from Agda and the Agda Standard Library ------------------------------------------- open import Agda.Primitive using () renaming ( Set to Type ; lzero to ββ ) open import Data.Product using ( _,_ ; _Γ_ ; Ξ£-syntax ) open import Data.Sum.Base using ( _β_ ) renaming ( injβ to inl ; injβ to inr ) open import Data.Fin.Base using ( Fin ) open import Data.Nat using ( β ) open import Data.Unit.Base using ( β€ ; tt ) open import Function.Base using ( _β_ ) open import Relation.Unary using ( Pred ; _β_ ) open import Relation.Binary.PropositionalEquality using ( _β‘_ ; module β‘-Reasoning ; cong ; sym ; refl ) -- Imports from the Agda Universal Algebra Library --------------------------------------------- open import Overture using ( β£_β£ ; β₯_β₯ ) open import Base.Relations using ( Rel ) open import Base.Structures.Basic using ( signature ; structure ) open import Base.Structures.Homs using ( hom ; is-hom-rel ; is-hom-op ) open import Examples.Structures.Signatures using ( Sβ ) open signature ; open structure ; open _β_ Gr-sig : signature ββ ββ β signature ββ ββ β signature ββ ββ Gr-sig πΉ π = record { symbol = symbol π β symbol πΉ ; arity = ar } where ar : symbol π β symbol πΉ β Type ββ ar (inl π) = (arity π ) π ar (inr π) = (arity πΉ) π β β€ private variable πΉ π : signature ββ ββ Gr : structure πΉ π {ββ} {ββ} β structure Sβ (Gr-sig πΉ π ) {ββ} {ββ} Gr {πΉ}{π } π¨ = record { carrier = carrier π¨ ; op = Ξ» () ; rel = split } where split : (s : symbol π β symbol πΉ) β Rel (carrier π¨) (arity (Gr-sig πΉ π ) s) {ββ} split (inl π) arg = rel π¨ π arg split (inr π) args = op π¨ π (args β inl) β‘ args (inr tt) open β‘-Reasoning module _ {π¨ π© : structure πΉ π {ββ}{ββ}} where homβGrhom : hom π¨ π© β hom (Gr π¨) (Gr π©) homβGrhom (h , hhom) = h , (i , ii) where i : is-hom-rel (Gr π¨) (Gr π©) h i (inl π) a x = β£ hhom β£ π a x i (inr π) a x = goal where homop : h (op π¨ π (a β inl)) β‘ op π© π (h β (a β inl)) homop = β₯ hhom β₯ π (a β inl) goal : op π© π (h β (a β inl)) β‘ h (a (inr tt)) goal = op π© π (h β (a β inl)) β‘β¨ sym homop β© h (op π¨ π (a β inl)) β‘β¨ cong h x β© h (a (inr tt)) β ii : is-hom-op (Gr π¨) (Gr π©) h ii = Ξ» () Grhomβhom : hom (Gr π¨) (Gr π©) β hom π¨ π© Grhomβhom (h , hhom) = h , (i , ii) where i : is-hom-rel π¨ π© h i R a x = β£ hhom β£ (inl R) a x ii : is-hom-op π¨ π© h ii f a = goal where split : arity πΉ f β β€ β carrier π¨ split (inl x) = a x split (inr y) = op π¨ f a goal : h (op π¨ f a) β‘ op π© f (Ξ» x β h (a x)) goal = sym (β£ hhom β£ (inr f) split refl)
Lemma III.1. Let π
be a signature and π¨
be an π
-structure.
Let β°
be a finite set of identities such that π¨ β§ β°
. For every
instance πΏ
of CSP(π¨
), one can compute in polynomial time an
instance π
of CSP(π¨
) such that π β§ β°
and | hom πΏ π¨ | = | hom π π¨ |
.
Proof. β s β t
in β°
and each tuple b
such that π© β¦ s β§ b β’ π© β¦ t β§ b
, one can compute
the congruence ΞΈ = Cg (π© β¦ s β§ b , π© β¦ t β§ b)
generated by π© β¦ s β§ b
and π© β¦ t β§ b
.
Let π©β := π© / ΞΈ
, and note that | π©β | < | π© |
.
We show there exists a bijection from hom π© π¨
to hom π©β π¨
.
Fix an h : hom π© π¨
. For all s β t
in β°
, we have
h (π© β¦ s β§ b) = π¨ β¦ s β§ (h b) = π¨ β¦ t β§ (h b) = h (π© β¦ t β§ b)
.
Therefore, ΞΈ β ker h
, so h
factors uniquely as h = h' β Ο : π© β (π© / ΞΈ) β π¨
,
where Ο
is the canonical projection onto π© / ΞΈ
.
Thus the mapping Ο : hom π© π¨ β hom π©β π¨
that takes each h
to h'
such that h = h' β Ο
is injective. It is also surjective since each g' : π© / ΞΈ β π¨
is mapped back to
a g : π© β π¨
such that g = g' β Ο
. Iterating over all identities in β°
, possibly
several times, at the final step we obtain a structure π©β
that satisfies β°
and is such that β£ hom π© π¨ β£ = β£ hom π©β π¨ β£
. Moreover, since the number of elements
in the intermediate structures decreases at each step, | π©α΅’ββ | < | π©α΅’ |
, the process
finishes in time that is bounded by a polynomial in the size of π©
.
record _β_β_ (π© π¨ πͺ : structure πΉ π ) : Type ββ where field to : hom π© π¨ β hom πͺ π¨ from : hom πͺ π¨ β hom π© π¨ toβΌfrom : β h β (to β from) h β‘ h fromβΌto : β h β (from β to) h β‘ h -- TODO: formalize Lemma III.1 -- module _ {Ο : Level}{X : Type Ο} -- {π¨ : structure πΉ π {ββ} {ββ}} where -- LEMMAIII1 : {n : β}(β° : Fin n β (Term X Γ Term X))(π¨ β fMod β°) -- β β(π© : structure πΉ π ) β Ξ£[ πͺ β structure πΉ π ] (πͺ β fMod β° Γ (π© β π¨ β πͺ)) -- LEMMAIII1 β° π¨β§β° π© = {!!} , {!!}