\documentclass[xcolor=pst,dvips]{beamer}
% replace top line by next three lines to get handouts
%\documentclass[handout,xcolor=pst,dvips]{beamer}
%\usepackage{pgfpages}
%\pgfpagesuselayout{4 on 1}[letterpaper,landscape,border shrink=5mm]
%\pgfpagesuselayout{2 on 1}[letterpaper,border shrink=5mm]

\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{slashed}
\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{multido}

\usepackage{beamerthemesplit}
\mode<presentation>{ \usetheme{Boadilla}\setbeamercovered{transparent} }

\title[Relation algebras and Kleene algebra]{Foundations of Relations 
and Kleene Algebra}
\author{Peter Jipsen}
\institute{Chapman University}
\date{\today}
%\date{August 20, 2006}

\parskip10pt

\newtheorem{pd}{Prove (and extend) or disprove (and fix)}
\newcommand{\cl}{\mathcal}
\newcommand{\m}{\mathbf}
\newcommand{\co}{\smallsmile}
\newcommand{\ua}{{\uparrow}}
\newcommand{\da}{{\downarrow}}
\newcommand{\epsi}{\varepsilon}
\newcommand{\cemph}[1]{\textcolor{red}{\emph{#1}}}
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
\newcommand{\gr}[1]{\textcolor{green}{#1}}
\declareslashed{}{/}{.08}{0}{R}  
\newcommand{\notR}{\hspace{-1pt}\slashed R}
\newcommand{\sqle}{\sqsubseteq}

\newcommand{\RAtop}{\boldsymbol{\top}}
\newcommand{\RAbot}{0}%{\bot}
\newcommand{\RAjoin}{+}
\newcommand{\RAmeet}{\cdot}
\newcommand{\RAcplOP}{^-}
\newcommand{\RAconverse}[1]{#1^\smallsmile}
\newcommand{\RAcomp}{{;}}
\newcommand{\RAid}{1}

\newcommand{\dom}{\mathsf{dom}}
\newcommand{\cod}{\mathsf{cod}}
\newcommand{\onto}{\twoheadrightarrow}
\newcommand{\into}{\hookrightarrow}
\newcommand{\Hom}{\mathsf{Hom}}
\newcommand{\HH}{\mathsf H}
\renewcommand{\SS}{\mathsf S}
\newcommand{\PP}{\mathsf P}
\newcommand{\Pu}{\mathsf P_u}
\newcommand{\Ps}{\mathsf P_s}
\newcommand{\T}{\mathbf T}
\newcommand{\U}{\mathbf U}
\newcommand{\V}{\mathbf V}
\newcommand{\Mod}{\mathsf{Mod}}
\newcommand{\Th}{\mathsf{Th}}
\newcommand{\Var}{\mathsf V}
\newcommand{\Con}{\mathsf{Con}}
\newcommand{\Cg}{\mathsf{Sg}}
\newcommand{\Sg}{\mathsf{Sg}}
\newcommand{\SI}{\mathsf{SI}}
\newcommand{\Cm}{\mathsf{Cm}}

\newcommand{\Or}{\ \mathsf{or}\ }
\renewcommand{\And}{\ \mathsf{and}\ }
\newcommand{\Imp}{\Rightarrow}
\newcommand{\Iff}{\Leftrightarrow}
\newcommand{\Fn}{\mathcal F_\tau}
\newcommand{\Rl}{\mathcal R_\tau}
\newcommand{\yes}{$\checkmark$}
\newcommand{\no}{$\boldsymbol{\times}$}

%\beamerdefaultoverlayspecification{<+->}

\begin{document}

\frame{\titlepage}

%\section[Outline]{}
%\frame{\tableofcontents}

\section{Introduction}
\subsection{Foundation}
\frame{
  \frametitle{Introduction}

  \begin{itemize}
  \item Aim: cover the basics about relations and Kleene algebras\\
        within the framework of universal algebra
  \item This is a \cemph{tutorial}
  \item Slides give precise \bl{definitions}, lots of statements
  \item Decide which statements are \bl{true} (can be improved)\\
which are \emph{false} (and perhaps how they can be fixed)
  \item $[$Hint: a list of pages with false statements is at the end$]$
  \end{itemize}
}

\frame{
  \frametitle{Prerequisites}

  \begin{itemize}
  \item Knowledge of \bl{sets, union, intersection, complementation}
  \item Some basic \bl{first-order} logic
  \item Basic discrete math (e.g. function notation)
  \item These notes take an \cemph{algebraic} perspective
  \end{itemize}

Conventions:
  \begin{itemize}
  \item Minimize distinction between concrete and abstract notation
  \item $x,y,z,x_1,\dots$ \bl{variables} (implicitly universally quantified)
  \item $X,Y,Z,X_1,\dots$ \bl{set variables} (implicitly universally quantified)
  \item $f,g,h,f_1,\dots$ \bl{function variables}
  \item $a,b,c,a_1,\dots$ \bl{constants}
  \item $i,j,k,i_1,\dots$ \bl{integer variables}, usually nonnegative
  \item $m,n,n_1,\dots$ nonnegative \bl{integer constants}
  \end{itemize}

}

\subsection{Algebraic properties of set operation}
\frame{
  \frametitle{Algebraic properties of set operation}

Let $U$ be a set, and $\cl P(U)=\{X:X\subseteq U\}$ the \cemph{powerset}
of $U$

$\cl P(U)$ is an algebra with operations \bl{union} $\cup$, 
\bl{intersection} $\cap$,
\bl{complementation} $X^-=U\setminus X$

Satisfies many \bl{identities}: e.g. $X\cup Y=Y\cup X$ for all $X,Y\in\cl P(U)$

How can we \bl{describe} the set of all identities that hold?

Can we \bl{decide} if a particular identity holds in all powerset algebras?

These are questions about the \bl{equational theory} of these algebras

We will consider \bl{similar} questions about several other types of 
algebras,\\
in particular relation algebras and Kleene algebras
}

\frame{
  \frametitle{Binary relations}
An \cemph{ordered pair}, written $(u,v)$, has the defining property
$$\text{$(u,v)=(x,y)$ iff $u=x$ and $v=y$}$$

The \cemph{direct product} of sets $U$, $V$ is 
$$U\times V=\{(u,v):u\in U,v\in V\}$$

A \cemph{binary relation} $R$ from $U$ to $V$ is a subset of $U\times V$

Write $uRv$ if $(u,v)\in R$, otherwise write $u\notR v$

Define $uR=\{v:uRv\}$ and $Rv=\{u:uRv\}$

}

\frame{
  \frametitle{Operations on binary relations}

\cemph{Composition} of relations: $R;S=\{(u,v):uR\cap Rv\ne\emptyset\}$
$$=\{(u,v):\exists x\ uRx\And xSv\}$$

\cemph{Converse} of $R$ is $R^\co=\{(v,u):(u,v)\in R\}$

\cemph{Identity relation} $I_U=\{(u,u):u\in U\}$

A binary relation \cemph{on} a set $U$ is a subset of $U\times U$ 

Define $R^0=I_U$ and $R^{n+1}=R;R^n$ for $n\ge0$

\cemph{Transitive closure} of $R$ is $\displaystyle R^+=\bigcup_{n\ge1}R^n$

\cemph{Reflexive transitive closure} of $R$ is 
$\displaystyle R^*=R^+\cup I_U=\bigcup_{n\ge0}R^n$
}

\frame{
  \frametitle{Properties of binary relations}
Let $R$ be a binary relation on $U$

$R$ is \cemph{reflexive} if $xRx$ for all $x\in U$

$R$ is \cemph{irreflexive} if $x\notR x$ for all $x\in U$

$R$ is \cemph{symmetric} if $xRy$ implies $yRx$ \quad (implicitly quantified)

$R$ is \cemph{antisymmetric} if $xRy$ and $yRx$ implies $x=y$

$R$ is \cemph{transitive} if $xRy$ and $yRz$ implies $xRz$

$R$ is \cemph{univalent} if $xRy$ and $xRz$ implies $y=z$

$R$ is \cemph{total} if $xR\ne\emptyset$ for all $x\in U$ 
(otherwise \cemph{partial})

}

\frame{
  \frametitle{Properties in relational form}

\begin{pd}\parskip10pt
$R$ is reflexive \ iff \ $I_U\subseteq R$

$R$ is irreflexive \ iff \ $I_U\nsubseteq R$

$R$ is symmetric \ iff \ $R\subseteq R^\smallsmile$ \ iff \ $R=R^\smallsmile$

$R$ is antisymmetric \ iff \ $R\cap R^\smallsmile=I_U$

$R$ is transitive \ iff \ $R;R=R$ \ iff \ $R=R^+$

$R$ is univalent \ iff \ $R;R^\smallsmile\subseteq I_U$

$R$ is total \ iff \ $I_U\subseteq R;R^\smallsmile$
\end{pd}
}

\frame{
  \frametitle{Binary operations and properties}

A \cemph{binary operation} $+$ on $U$ is a function from $U\times U$ to $U$

Write $+(x,y)$ as $x+y$

$+$ is \cemph{idempotent} if $x+x=x$ \qquad (all implicitly universally 
quantified)

$+$ is \cemph{commutative} if $x+y=y+x$

$+$ is \cemph{associative} if $(x+y)+z=x+(y+z)$

$+$ is \cemph{conservative} if $x+y=x$ or $x+y=y$

$+$ is \cemph{left cancellative} if $z+x=z+y$ implies $x=y$

$+$ is \cemph{right cancellative} if $x+z=y+z$ implies $x=y$

}

\frame{
  \frametitle{Connection with relations}

Define $R_+$ on $U$ by \qquad $xR_+y$ \ iff \ $x+z=y$ for some $z \in U$

\begin{pd}\parskip10pt
If $+$ is idempotent then $R_+$ is reflexive.

If $+$ is commutative then $R_+$ is antisymmetric.

If $+$ is associative then $R_+$ is transitive.
\end{pd}

A \cemph{semigroup} is a set with an \bl{associative} binary operation

A \cemph{band} is a semigroup $(U,+)$ such that $+$ is \bl{idempotent}

A \cemph{quasi-ordered set (qoset)} is a set with a \bl{reflexive transitive} 
relation

$\Rightarrow$ If $(U,+)$ is a \bl{band} then $(U,R_+)$ is a \bl{qoset}

}

\frame{
  \frametitle{More specific connection with relations}

Define $\le_+$ on $U$ by \qquad $x\le_+y$ \ iff \ $x+y=y$

\begin{pd}\parskip10pt
$+$ is idempotent \ iff \ $\le_+$ is reflexive.

$+$ is commutative \ iff \ $\le_+$ is antisymmetric.

$+$ is associative \ iff \ $\le_+$ is transitive.
\end{pd}

A \cemph{semilattice} is a \bl{band} $(U,+)$ such that $+$ is \bl{commutative}

A \cemph{partially ordered set} is a \bl{qoset} $(U,R)$ such that $R$ is 
\bl{antisymmetric}

$\Rightarrow$ If $(U,+)$ is a \bl{semilattice} then $(U,\le_+)$ is a 
\bl{partially ordered set}

}

\frame{
  \frametitle{}
A partially ordered set is called a \cemph{poset} for short

A \cemph{strict partial order} is an irreflexive transitive relation

\begin{pd}
If $<$ is a strict partial order on $U$, then $(U,{<}\cup I_U)$ is a poset.

If $(U,\le)$ is a poset, then ${<}={\le}\setminus I_U$ is a strict partial 
order.
\end{pd}

For $a,b\in U$ we say that $a$ is \cemph{covered} by $b$ (written $a\prec b$)\\
if $a<b$ and there is no $x$ such that $a<x<b$

To visualize a finite poset we can draw a \cemph{Hasse diagram}:

$a$ is connected with an \bl{upward sloping} line to $b$ if $a \prec b$

\begin{center}
\psset{unit=0.5cm}
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,0)
 \rput[l](0,2.9){\scriptsize Nonisomorphic connected posets with $\le 4$ elements}
\endpspicture
\quad
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,0)(0,1)
 \psline{o-o}(.5,0)(0,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,1)(0,0)
 \psline{o-o}(.5,1)(0,0)
\endpspicture
\quad
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(0,2)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,0)(0,1)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(.5,0)(0,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,1)(0,0)
 \psline{o-o}(0,1)(0,0)
 \psline{o-o}(.5,1)(0,0)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(1,0)
 \psline{o-o}(1,0)(1,1)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(1,0)
 \psline{o-o}(1,0)(1,1)
 \psline{o-o}(1,1)(0,0)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(.5,2)
 \psline{o-o}(1,1)(.5,2)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,2)(0,1)
 \psline{o-o}(0,1)(.5,0)
 \psline{o-o}(1,1)(.5,0)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(.5,1)
 \psline{o-o}(.5,1)(.5,2)
 \psline{o-o}(1,0)(.5,1)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,2)(.5,1)
 \psline{o-o}(.5,1)(.5,0)
 \psline{o-o}(1,2)(.5,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(0,0)(-.5,1)
 \psline{o-o}(0,0)(.5,1)
 \psline{o-o}(0,2)(-.5,1)
 \psline{o-o}(0,2)(.5,1)
\endpspicture
\quad
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(0,2)
 \psline{o-o}(0,2)(0,3)
\endpspicture
\end{center}

}

\frame{
  \frametitle{Equivalence relations}
An \cemph{equivalence relation} is a reflexive symmetric transitive relation

%$\Rightarrow$ If $R$ is an equivalence relation on $U$ then $(U,R)$ is a qoset

\begin{pd}
$R$ is an equivalence relation on $U$ \ iff \ $I_U\subseteq R=R^\co;R$
\end{pd}

Let $R$ be an equivalence relation on a set $U$, and $u\in U$

Then $uR=\{x: uRx\}$ is called an \cemph{equivalence class} of $R$

Usually written $[u]_R$ or simply $[u]$; $u$ is called a 
\cemph{representative} of $[u]$

The \cemph{set of all equivalence classes} of $R$ is $U/R=\{[u]:u\in U\}$

\begin{center}
\psset{unit=.4cm,arm=.8,linearc=.25}
\psset{arrows=->,arcangle=13,arrowsize=2pt 2,labelsep=2pt,radius=2pt}
\newcommand{\Common}{
 \pspolygon[linearc=0.8](-1.73,-1)(3.73,-1)(1,3.73)
 \Cnode[fillstyle=solid,fillcolor=yellow](0,0){a}
 \ncdiag[angleA=190,angleB=230]{a}{a}
 \Cnode[fillstyle=solid,fillcolor=yellow](2,0){b}
 \ncdiag[angleA=310,angleB=350]{b}{b}
 \Cnode[fillstyle=solid,fillcolor=yellow](1,1.73){c}
 \ncdiag[angleA=70,angleB=110]{c}{c}
}
\pspicture(-1,0)(3,2.73)
 \Common
 \rput[l](0,3.7){\scriptsize Equivalence relations on a 3-element set}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \Common
 \ncarc{a}{c}
 \ncarc{c}{a}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \Common
 \ncarc{a}{b}
 \ncarc{b}{a}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \Common
 \ncarc{c}{b}
 \ncarc{b}{c}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \Common
 \ncarc{a}{b}
 \ncarc{b}{a}
 \ncarc{a}{c}
 \ncarc{c}{a}
 \ncarc{c}{b}
 \ncarc{b}{c}
\endpspicture
\end{center}
}

\frame{
  \frametitle{Partitions}

A \cemph{partition} of $U$ is a subset $P$ of $\cl P(U)$ such that

\qquad $\bigcup P=U$, \ $\emptyset\notin P$, \ and 
$X=Y$ or $X\cap Y=\emptyset$ for all $X,Y\in P$

(where $\bigcup P=\{x:x\in X\text{ for some }X\in P\}$)

For a partition $P$ define a relation by $x\equiv_Py$ iff 
$x,y\in X$ for some $X\in P$

\begin{pd}
The map $f(R)=U/R$ is a bijection from the set of equivalence 
relations on $U$ to the set of partitions of $U$, with $f^{-1}(P)$ given by 
$\equiv_P$.
\end{pd}

\begin{center}
\psset{unit=.4cm,arm=.8,linearc=.25}
\psset{arrows=->,arcangle=13,arrowsize=2pt 2,labelsep=2pt,radius=2pt}
\newcommand{\Common}{
 \pspolygon[linearc=1](-1.73,-1)(3.73,-1)(1,3.73)
 \Cnode[fillstyle=solid,fillcolor=yellow](0,0){a}
 \Cnode[fillstyle=solid,fillcolor=yellow](2,0){b}
 \Cnode[fillstyle=solid,fillcolor=yellow](1,1.73){c}
}
\pspicture(-1,0)(3,2.73)
 \Common
 \pscircle(0,0){.8}
 \pscircle(2,0){.8}
 \pscircle(1,1.73){.8}
 \rput[l](0,3.6){\scriptsize Partitions of a 3-element set}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \psline[linewidth=1.6]{c-c}(0,0)(1,1.73)
 \psline[linewidth=1.45,linecolor=white]{c-c}(0,0)(1,1.73)
 \Common
 \pscircle(2,0){.8}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \psline[linewidth=1.6]{c-c}(0,0)(2,0)
 \psline[linewidth=1.45,linecolor=white]{c-c}(0,0)(2,0)
 \Common
 \pscircle(1,1.73){.8}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \psline[linewidth=1.6]{c-c}(2,0)(1,1.73)
 \psline[linewidth=1.45,linecolor=white]{c-c}(2,0)(1,1.73)
 \Common
 \pscircle(0,0){.8}
\endpspicture
\qquad
\pspicture(-1,0)(3,2.73)
 \Common
 \pspolygon[linearc=.8](-1.384,-.8)(3.384,-.8)(1,3.33)
\endpspicture
\end{center}
}

\frame{
  \frametitle{The poset induced by a quasi-order}
For a qoset $(U,\sqle)$, define a relation on $U$ by $x\equiv y$ iff 
$x\sqle y$ and $y\sqle x$

Now define $\le$ on $U/{\equiv}$ by $[x]\le [y]$ iff $x\sqle y$

$\le$ is said to be \cemph{well defined} if 
$[x']=[x]\le[y]=[y']$ implies $[x']\leq[y']$

\begin{pd}
The relation $\le$ is well defined and $(U/{\equiv},\le)$ is a poset.
\end{pd}

Factoring mathematical structures by appropriate equivalence relations is 
a powerful way of understanding and creating new structures.

\begin{center}
\scriptsize
\psset{unit=.4cm}%,arm=.8,linearc=.25}
\pspicture(0,0)(1,2)
\pscircle(0,1){1}
\rput[c](0,1){{$\begin{array}{c}\circ\ \circ\\ \circ\ \circ\end{array}$}}
\rput[l](0,4){Nonisomorphic connected qosets on 4 elements}
\endpspicture
\pspicture(-1,0)(1,2)
\rput(0,2){\ovalnode{b}{$\circ\circ$}}
\rput(0,0){\ovalnode{a}{$\circ\circ$}}
\ncline{a}{b}
\endpspicture
\quad
\pspicture(-1,0)(1,2)
\rput(0,2){\ovalnode{b}{$\circ\circ\circ$}}
\rput(0,0){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\endpspicture
\quad
\pspicture(-1,0)(1,2)
\rput(0,0){\ovalnode{b}{$\circ\circ\circ$}}
\rput(0,2){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\endpspicture
\pspicture(-1,0)(3,2)
\rput(0,2){\ovalnode{b}{$\circ\circ$}}
\rput(2,2){\circlenode{c}{$\circ$}}
\rput(1,0){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\ncline{a}{c}
\endpspicture
\pspicture(0,0)(3,2)
\rput(0,0){\ovalnode{b}{$\circ\circ$}}
\rput(2,0){\circlenode{c}{$\circ$}}
\rput(1,2){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\ncline{a}{c}
\endpspicture
\pspicture(0,0)(3,2)
\rput(1,0){\ovalnode{b}{$\circ\circ$}}
\rput(2,2){\circlenode{c}{$\circ$}}
\rput(0,2){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\ncline{c}{b}
\endpspicture
\pspicture(0,0)(3,2)
\rput(1,2){\ovalnode{b}{$\circ\circ$}}
\rput(2,0){\circlenode{c}{$\circ$}}
\rput(0,0){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\ncline{c}{b}
\endpspicture
\quad
\pspicture(0,0)(1,3)
\rput(0,4){\ovalnode{c}{$\circ\circ$}}
\rput(0,2){\circlenode{b}{$\circ$}}
\rput(0,0){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\ncline{c}{b}
\endpspicture
\quad
\pspicture(0,0)(1,3)
\rput(0,4){\circlenode{c}{$\circ$}}
\rput(0,2){\ovalnode{b}{$\circ\circ$}}
\rput(0,0){\circlenode{a}{$\circ$}}
\ncline{a}{b}
\ncline{c}{b}
\endpspicture
\quad
\pspicture(0,0)(1,3)
\rput(0,4){\circlenode{a}{$\circ$}}
\rput(0,2){\circlenode{b}{$\circ$}}
\rput(0,0){\ovalnode{c}{$\circ\circ$}}
\ncline{a}{b}
\ncline{c}{b}
\endpspicture
\end{center}

}

\begin{frame}
  \frametitle{Some classes of binary relations}
\begin{center}
\scriptsize
\psset{unit=1.3cm, nodesep=3pt}%,arm=.8,linearc=.25}
\pspicture(0,1)(5,5)
\rput[c](1,5){\rnode{15}{all rels}}
\rput[c](0,4){\rnode{04}{a}}
\rput[c](1,4){\rnode{14}{r}}
\rput[c](2,4){\rnode{24}{s}}
\rput[c](4,4){\rnode{44}{t}}
\rput[c](0,3){\rnode{03}{ar}}
%\rput[c](1,3){\rnode{13}{}}
\rput[c](2,3){\rnode{23}{rs}}
\rput[c](3,3){\rnode{33}{at}}
\rput[c](4,3){\rnode{43}{qosets}}
\rput[c](5,3){\rnode{53}{st}}
\rput[c](4,2){\rnode{12}{subid rels}}
\rput[c](3,2){\rnode{32}{posets}}
%\rput[c](4,2){\rnode{42}{}}
\rput[c](5,2){\rnode{52}{\ \ equiv rels}}
\rput[c](4,1){\rnode{41}{id rels}}
\ncline{-}{15}{04}
\ncline{-}{15}{14}
\ncline{-}{15}{24}
\ncline{-}{15}{44}
\ncline{-}{04}{03}
\ncline{-}{04}{33}
\ncline{-}{14}{03}
\ncline{-}{14}{23}
\ncline{-}{14}{43}
\ncline{-}{24}{23}
\ncline{-}{24}{53}
\ncline{-}{44}{33}
\ncline{-}{44}{43}
\ncline{-}{44}{53}
\ncline{-}{33}{12}
\ncline{-}{03}{32}
\ncline{-}{53}{12}
\ncline{-}{23}{52}
\ncline{-}{33}{32}
\ncline{-}{43}{32}
\ncline{-}{43}{52}
\ncline{-}{53}{52}
\ncline{-}{12}{41}
\ncline{-}{32}{41}
\ncline{-}{52}{41}
\endpspicture
\qquad\qquad
\pspicture(0,1)(2,5)
\rput[l](0,3){\begin{tabular}{l}
a = antisymmetric\\
r = reflexive\\
s = symmetric\\
t = transitive\\
a and s $\Imp$ t
\end{tabular}}
\endpspicture
\end{center}
\end{frame}

\begin{frame}
  \frametitle{Tuples and direct products}
We have seen several examples of algebras and relational structures:

$(U,+)$ an \bl{algebra} with one binary operation, e.g. $(\mathbb N,+)$, 
$(\cl P(U),\cup)$

$(U,R)$ a \bl{relational structure} with a binary relation, e.g. 
$(\mathbb N,\le)$, $(\cl P(U),\subseteq)$

Applications usually involve \bl{several} $n$-ary operations and relations

For a set $I$, an \cemph{$I$-tuple} $(u_i)_{i\in I}$ is a 
function mapping $i\in I$ to $u_i$. 

A \cemph{tuple over $(U_i)_{i\in I}$} is an $I$-tuple $(u_i)_{i\in I}$
such that $u_i\in U_i$ for all $i\in I$ 

The \cemph{direct product $\prod_{i\in I}U_i$} is the set of \bl{all tuples over 
$(U_i)_{i\in I}$}

In particular, $\prod_{i\in I}U$ is the set $U^I$ of \bl{all functions 
from $I$ to $U$}

If $I=\{1,\dots,n\}$ then we write $U^I=U^n$ and 
$\prod_{i\in I}U_i=U_1\times\dots\times U_n$

Note: $U^0=U^\emptyset=\{()\}$ has \bl{one} element, 
namely the \bl{empty function} $()=\emptyset$

\end{frame}
\begin{frame}
  \frametitle{Algebras and relational structures}

A (\cemph{unisorted first-order}) \cemph{structure} is a tuple
$\m U=(U,(f^\m U)_{f\in \cl F_\tau}, (R^\m U)_{R\in\cl R_\tau})$

\begin{itemize}
\item $U$ is the \cemph{underlying set}

\item $\cl F_\tau$ is a set of \cemph{operation symbols} and

\item $\cl R_\tau$ is a set of \cemph{relation symbols} (\bl{disjoint} from
$\cl F_\tau$)
\end{itemize}
The \cemph{type} $\tau:\cl F_\tau\cup\cl R_\tau\to\{0,1,2,\dots\}$ 
gives the \emph{arity} of each symbol

$f^\m U:U^{\tau(f)}\to U$ and $R^\m U\subseteq U^{\tau(R)}$ are the 
\cemph{interpretation} of symbol $f$ and $R$

$0$-ary operation symbols are called \cemph{constant symbols}

$\m U$ is a (universal) \cemph{algebra} if $\cl R_\tau=\emptyset$; use
$\m A,\m B,\m C$ for algebras

Convention: the string of symbols $f(x_1,\dots,x_n)$ implies that 
$f$ has arity $n$

The superscript $^\m U$ is often omitted
\end{frame}

\begin{frame}
  \frametitle{Monoids and involution}
Recall that $(A,\cdot)$ a semigroup if $\cdot$ is an associative operation

A \cemph{monoid} is a semigroup with an \cemph{identity element}

i.e. of the form $(A,\cdot,1)$ such that $x\cdot 1=x=1\cdot x$

An \cemph{involutive semigroup} is a semigroup with an \cemph{involution}

i.e. of the form $(A,\cdot,^\co)$ such that $^\co$ has \cemph{period two}: 
$x^{\co\co}=x$, and \\ \cemph{$^\co$ antidistributes over $\cdot$}: 
$(x\cdot y)^\co=y^\co\cdot x^\co$

\begin{pd}
If an involutive semigroup satisfies $x\cdot 1=x$ for some element $1$ and
all $x$ then it satisfies $1^\co=1$ and $1\cdot x=x$
\end{pd}

An \cemph{involutive monoid} is a monoid with an \bl{involution}

A \cemph{group} is an involutive monoid such that $x\cdot x^\co=1$
\end{frame}

\begin{frame}
  \frametitle{Join-semilattices}

A \cemph{semilattice} is a commutative idempotent semigroup

$(A,+,\le)$ is a \cemph{join-semilattice} if \\
\qquad\qquad$(A,+)$ is a semilattice and $x\le y\Leftrightarrow x+y=y$
\begin{pd}
$(A,+,\le)$ is a join-semilattice

iff $(A,\le)$ is a poset and $x+y=z\Iff\forall w(x\le w\And y\le w\Iff z\le w)$

iff $(A,\le)$ is a poset and $x+y\le z\Iff x\le z\And y\le z$
\end{pd}

$\Rightarrow$ any two elements $x,y$ have a \cemph{least upper bound} $x+y$

Which of the following are join-semilattices?

\begin{center}
\psset{unit=0.5cm}
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,0)
 \rput[l](0,2.9){\scriptsize Nonisomorphic connected posets with $\le 4$ elements}
\endpspicture
\quad
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,0)(0,1)
 \psline{o-o}(.5,0)(0,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,1)(0,0)
 \psline{o-o}(.5,1)(0,0)
\endpspicture
\quad
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(0,2)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,0)(0,1)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(.5,0)(0,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(-.5,1)(0,0)
 \psline{o-o}(0,1)(0,0)
 \psline{o-o}(.5,1)(0,0)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(1,0)
 \psline{o-o}(1,0)(1,1)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(1,0)
 \psline{o-o}(1,0)(1,1)
 \psline{o-o}(1,1)(0,0)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(.5,2)
 \psline{o-o}(1,1)(.5,2)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,2)(0,1)
 \psline{o-o}(0,1)(.5,0)
 \psline{o-o}(1,1)(.5,0)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,0)(.5,1)
 \psline{o-o}(.5,1)(.5,2)
 \psline{o-o}(1,0)(.5,1)
\endpspicture
\quad
\pspicture(0,0)(1,2)
 \psline{o-o}(0,2)(.5,1)
 \psline{o-o}(.5,1)(.5,0)
 \psline{o-o}(1,2)(.5,1)
\endpspicture
\quad
\pspicture(-.5,0)(.5,2)
 \psline{o-o}(0,0)(-.5,1)
 \psline{o-o}(0,0)(.5,1)
 \psline{o-o}(0,2)(-.5,1)
 \psline{o-o}(0,2)(.5,1)
\endpspicture
\quad
\pspicture(0,0)(0,2)
 \psline{o-o}(0,0)(0,1)
 \psline{o-o}(0,1)(0,2)
 \psline{o-o}(0,2)(0,3)
\endpspicture
\end{center}
\end{frame}

\begin{frame}
  \frametitle{Lattices and duals}
A \cemph{meet-semilattice} $(A,\cdot,\le)$ is a semilattice with 
$x\le y\Leftrightarrow x\cdot y=x$

$(A,+,\cdot)$ is a \cemph{lattice} if $+$, $\cdot$ are associative, commutative
operations that satisfy the absorption laws: $x+(y\cdot x)=x=(x+y)\cdot x$

\begin{pd}
$(A,+,\cdot)$ is a lattice iff
$(A,+,\le)$ is a join-semilattice and 
$(A,\cdot,\le)$ is a meet-semilattice where $x\le y\Leftrightarrow x+y=y$.
\end{pd}

Define $x\ge y\Leftrightarrow y\le x$. 
The \cemph{dual} $(A,+,\le)^d=(A,+,\ge)$\\ $(A,\cdot,\le)^d=(A,\cdot,\ge)$
\ and \ $(A,+,\cdot)^d=(A,\cdot,+)$

\begin{pd}
The dual of a join-semilattice is a meet-semilattice and vice versa.

The dual of a lattice is again a lattice.
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Distributivity and bounds}
A lattice is \cemph{distributive} if it satisfies 
$x\cdot(y+z)=(x\cdot y)+(x\cdot z)$
\begin{pd}
A lattice is distributive iff $x+(y\cdot z)=(x+y)\cdot(x+z)$
iff $(x+y)\cdot(x+z)\cdot(y+z)=(x\cdot y)+(x\cdot z)+(y\cdot z)$
\end{pd}
$\Rightarrow$ a lattice is distributive iff its dual is distributive

A \cemph{semilattice with identity} is a commutative idempotent monoid

$(A,+,0,\cdot,\top)$ is a \cemph{bounded lattice} if \\
$(A,+,\cdot)$ is a lattice and
$(A,+,0)$, $(A,\cdot,\top)$ are semilattices with identity

\begin{pd}
Suppose $(A,+,\cdot)$ is a lattice. Then $(A,+,0,\cdot,\top)$ is a bounded 
lattice\\ iff $0\le x\le \top$ iff $x\cdot 0=0$ and $x+\top=\top$
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Complementation and Boolean algebras}
%A bounded lattice is \cemph{complemented} if 
%$\forall x\exists y(x+y=\top\And x\cdot y=0$

$(A,+,0,\cdot,\top,^-)$ is a \cemph{lattice with complementation} if 
$(A,+,0,\cdot,\top)$ is a bounded lattice such that
$x+x^-=\top$ and $x\cdot x^-=0$

\begin{pd}
Lattices with complementation satisfy $x^{--}=x$ and DeMorgan's laws 
$(x+y)^-=x^-\cdot y^-$ and $(x\cdot y)^-=x^-+y^-$
\end{pd}

A \cemph{Boolean algebra} is a \bl{distributive} lattice with complementation

\begin{pd}
Boolean algebras satisfy $x^{--}=x$ and DeMorgan's laws 
$(x+y)^-=x^-\cdot y^-$ and $(x\cdot y)^-=x^-+y^-$
\end{pd}
{\scriptsize%\small
\begin{pd}
$(A,+,0,\cdot,\top,^-)$ is a Boolean algebra iff $+$ is commutative with
identity $0$, $\cdot$ is commutative with identity $1$,
$+$ distributes over $\cdot$, $\cdot$ distributes over $+$,
$x+x^-=\top$ and $x\cdot x^-=0$.
\end{pd}
}
\end{frame}

\begin{frame}
  \frametitle{Boolean algebras of sets}
$\boldsymbol{\cl P}(U)=(\cl P(U),\cup,\emptyset,\cap,U,^-)$ is the 
\cemph{Boolean algebra of all subsets of $U$}

A \cemph{concrete Boolean algebra} is any collection of subsets of a set $U$
that is closed under $\cup$, $\cap$, and $^-$

The \cemph{atoms} of a join-semilattice with $0$ are the \bl{covers of $0$}

%The \cemph{coatoms} are the elements covered by $1$

A join-semilattice with $0$ is \cemph{atomless} if it has no atoms, and

\emph{atomic} if for every $x\ne 0$ there is an atom $a\le x$

\begin{pd}\parskip10pt
$\boldsymbol{\cl P}(U)$ is atomic for every set $U$

$H=\{(a_1,b_1]\cup\dots\cup(a_n,b_n]:0\le a_i<b_i\le 1
\text{ are rationals}, n\in\mathbb N\}$ is an atomless 
concrete Boolean algebra with $U$ the set of positive rationals $\le 1$
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Relation algebras}

An \cemph{(abstract) relation algebra} is of the form
$(A,\RAjoin,\RAbot,\RAmeet,\RAtop,\RAcplOP,\RAcomp,\RAid,\RAconverse{})$
where 
\begin{itemize}
\item
$(A,\RAjoin,\RAbot,\RAmeet,\RAtop,\RAcplOP)$ is a Boolean algebra
\item
$(A,\RAcomp,\RAid)$ is a monoid
\item
$(x\RAcomp y)\RAmeet z=\RAbot\ \Leftrightarrow\  
(\RAconverse{x}\RAcomp z)\RAmeet y=\RAbot\ \Leftrightarrow\  
(z\RAcomp\RAconverse{y})\RAmeet x=\RAbot$
\end{itemize}
The last line states the \bl{Schr\"oder equivalences} (or 
\bl{DeMorgan's Thm K})
\begin{pd}
In a relation algebra $x^{\co\co}=x$ and $^\co$ is self-conjugated, i.e. 
$x^\co\cdot y=0\Leftrightarrow x\cdot y^\co=0$.
Hence $(x+y)^\co=x^\co+y^\co$, \ $x^{-\co}=x^{\co-}$, \ 
$(x\cdot y)^\co=x^\co\cdot y^\co$, \ $^\co$ is an involution and
$x{;}(y+z)=x{;}y+x{;}z$.

{\scriptsize Hint: In a Boolean algebra $u=v$ iff $\forall x(u\cdot x=0\Leftrightarrow v\cdot x=0)$}
\end{pd}
\begin{pd}
A Boolean algebra expanded with an involutive monoid
is a relation algebra iff $x{;}(y+z)=x{;}y+x{;}z$, \
 $(x+y)^\co=x^\co+y^\co$ and $(x^\co;(x;y)^-)\cdot y=0$
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Concrete relation algebras}
$\text{Rel}(U)=(\cl P(U^2),\cup,\cap,\emptyset,U^2,^-,{;},I_U,^\co)$
 the \cemph{square relation algebra} on $U$

A \cemph{concrete relation algebra} is of the form
$(\cl C,\cup,\cap,\emptyset,\top,^-,{;},I_U,^\co)$
where $\cl C$ is a set of binary relations on
a set $U$ that is closed under the operations $\cup$, $^-$, ${;}$, $^\co$, 
and contains $I_U$
\begin{pd}\parskip10pt
Every square relation algebra is concrete.

Every concrete relation algebra is a relation algebra, and the 
largest relation is an equivalence relation
\end{pd}

Relation algebras have applications in program semantics, specification,
derivation, databases, set theory, finite variable logic, combinatorics,
\dots
\end{frame}

\begin{frame}
  \frametitle{Idempotent semirings}
A \cemph{semiring} is an algebra $(A,+,0,{;},1)$ such that
\begin{itemize}
\item $(A,+,0)$ is a commutative monoid
\item $(A,{;},1)$ is a monoid
\item $x{;}(y+z)=(x{;}y)+(x{;}z)$,\ \qquad $(x+y){;}z=(x{;}z)+(y{;}z)$
\item $x;0=0=0;x$
\end{itemize}
A semiring is \cemph{idempotent} if $x+x=x$

$\Rightarrow$ an idempotent semiring is a join-semilattice with $x\le y\Iff
x+y=y$, a bottom element $0$, $;$ distributes over $+$ and $0$ is a zero for 
$;$
\parskip0pt
\begin{pd}
In an idempotent semiring $x\le y$ implies $x{;}z\le y{;}z$ and 
$z{;}x\le z{;}y$
\end{pd}
For any monoid $\m M=(M,\cdot,1)$, the \cemph{powerset idempotent semiring}
is $\boldsymbol{\cl P}(\m M)=(\cl P(M),\cup,\emptyset,{;},\{1\})$ 
where $X;Y=\{x\cdot y:x\in X,\ y\in Y\}$
\end{frame}

\begin{frame}
  \frametitle{Kleene algebras}

A \cemph{Kleene algebra} is of the form
$(A,\RAjoin,\RAbot,\RAcomp,\RAid,^*)$
where 
\begin{itemize}
\item
$(A,\RAjoin,\RAbot,\RAcomp,\RAid)$ is an idempotent semiring
\item
$1+x+x^*{;}x^*=x^*$ \quad 
\item
$x{;}y\le y\Imp x^*{;}y\le y$\qquad (where $x\le y\Iff x+y=y$)
\item
$y{;}x\le y\Imp y{;}x^*\le y$
\end{itemize}

%\begin{pd}
%
%\end{pd}

\begin{pd}
Let $\m M=(M,\cdot,1)$ be a monoid. 
Then $\boldsymbol{\cl P}(\m M)$ can be expanded to
a Kleene algebra if we define 
$X^*=\bigcup_{n\ge 0}X^n$ where $X^0=\{1\}$ and $X^{n+1}=X^n;X$
\end{pd}
\begin{pd}
For any set $U$, 
$\mathsf{KRel}(U)=(\cl P(U^2),\cup,\emptyset,{;},I_U,^*)$ is a Kleene algebra
\end{pd}

\end{frame}

\begin{frame}
  \frametitle{Kleene algebras continued}
Traditionally we write $x{;}y$ simply as $xy$

A Kleene expression has an \cemph{opposite} given by reversing the expression.

The opposite axioms of Kleene algebras again define Kleene algebras, so any 
proof of a result can be converted to a proof of 
the opposite result

\begin{pd}
In a Kleene algebra $x^n\le x^*$ for all $n\ge 0$ \quad $($where $x^0=1$, 
$x^{n+1}=x^nx)$

$x\le y\Imp x^*\le y^*$

$xx^*=x^*x$ \qquad $x^{**}=x^*$ \quad and \quad
$x^*=1+x^+$ where $x^+=xx^*$

$xy+z\le y\Imp x^*z\le y$ \qquad $($and its opposite$)$

$xy=yz\Imp x^*y=yz^*$

$(xy)^*x=x(yx)^*$ and $(x+y)^*=x^*(yx^*)^*$
\end{pd}

Kleene algebras have applications in automata theory, parsing, 
pattern matching, semantics and logic of programs, analysis of algorithms,\dots
\end{frame}

\begin{frame}
  \frametitle{Kleene algebras with tests}
Kleene algebras model concatenation, nondeterministic choice and iteration,
but to model programs need guarded choice and guarded iteration

A \cemph{Kleene algebra with tests} (KAT) is of the form 
$(A,\RAjoin,\RAbot,\RAcomp,\RAid,^*,^-,B)$ where 
$(A,\RAjoin,\RAbot,\RAcomp,\RAid,^*)$ is a Kleene algebra, $B$
is a unary relation ($\subseteq A$) and
$x,y\in B\Imp x+y,\ x{;}y,\ x^-,\ 0,1\in B,\ x{;}x=x,\ x{;}x^-=0,\ x+x^-=1$
\begin{pd}
In a KAT, $(B,+,0,{;},1,^-)$ is a Boolean algebra
\end{pd}
[Kozen 1996] defines KATs as two-sorted algebras, but here they are one-sorted
structures with $^-$ a partial operation defined only on $B$

The program construct \texttt{\gr{if $b$ then $p$ else $q$}} is expressed by
$b{;}p+b^-{;}q$

\texttt{\gr{while $b$ do $p$}} is expressed by $(b{;}p)^*{;}b^-$
\end{frame}

\begin{frame}
  \frametitle{Idempotent semirings with domain and range}
Every Kleene algebra is a KAT with $B=\{0,1\}$

In $\text{KRel}(U)$ the tests are a subalgebra of $\cl P(I_U)$

Can also define \cemph{idempotent semirings with tests} (just omit $^*$)

More expressive: add a domain operator [Desharnais M\"oller Struth 2006]

An \cemph{idempotent semiring with predomain} is of the form 
$(A,+,0,{;},1,^-,\delta)$ where $(A,+,0,{;},1,^-,\delta[A])$ is an 
idempotent semiring with tests,\\
\qquad\qquad $x\le\delta(x){;}x$ \quad and \quad 
$\delta(\delta(x){;}y)\le\delta(x)$

For \cemph{idempotent semirings with domain} add 
$\delta(x{;}\delta(y))\le\delta(x{;}y)$

In Rel$(U)$ the domain operator is definable by $\delta(R)=(R{;}R^\co)\cap I_U$

\cemph{Idempotent semirings with (pre)range operator} are opposite
\end{frame}

\begin{frame}
  \frametitle{Terms and formulas}
UA is a framework for studying and comparing all these algebras

Given a set $X$, the set of \emph{$\tau$-terms with variables
from $X$} is the smallest set $T=T_\tau(X)$ such that
\begin{itemize}
\item
$X\subseteq T$ and

\item
if $t_1,\dots,t_{n}\in T$ and $f\in\Fn$ then $f(t_1,\dots,t_{n})\in T$. 
\end{itemize}
The \cemph{term algebra over $X$} is 
$\T_\tau(X)=\T=(T_\tau(X),(f^\T)_{f\in\Fn})$ with
\[
f^\T(t_1,\dots,t_{n})=f(t_1,\dots,t_{n})\mbox{\quad for $t_1,\dots,t_n\in
T_\tau(X)$}
\]

A \cemph{$\tau$-equation} is a pair of $\tau$-terms $(s,t)$, 
usually written $s=t$

A \cemph{quasiequation} is an implication $(s_1=t_1\And
\dots\And s_n=t_n\Imp s_0=t_0)$
\end{frame}

\begin{frame}
  \frametitle{Models and theories}
An \cemph{atomic formula} is a $\tau$-equation or $R(x_1,\dots,x_n)$ 
for $R\in\cl R_\tau$

A \cemph{$\tau$-formula} $\phi::=\text{atomic frm.}|\phi\text{and}\phi|
\phi\text{or}\phi|
\neg\phi|\phi\Imp\phi|\phi\Iff\phi|\forall x\phi|\exists x\phi$

Write $\m U\models\phi$ if $\tau$-formula $\phi$ holds in 
$\tau$-structure $\U$ (standard defn)

Throughout $\cl K$ is a class of $\tau$-structures, $F$ a set of 
$\tau$-formulas

Write $\cl K\models F$ if $\m U\models \phi$ for all $\m U\in \cl K$ 
and $\phi\in F$

%Given a set $F$ of $\tau$-formulas, 
$\text{Mod}(F)=\{\m U:\m U\models F\}=$ class of all \cemph{models} of $F$

%Given a class $\cl K$ of $\tau$-structures, 
$\text{Th}(\cl K)=\{\phi:\cl K\models\phi\}=$ \cemph{first order theory} 
of $\cl K$

$\text{Th}_e(\cl K)=\text{Th}(\cl K)\cap\{\tau\text{-equations}\}=$ 
\cemph{equational theory} of $\cl K$

$\text{Th}_q(\cl K)=\text{Th}(\cl K)\cap\{\tau\text{-quasiequations}\}=$ 
\cemph{quasiequational theory} of $\cl K$

$\text{Th}_q(\cl K)$ is also called the \cemph{strict universal Horn theory} 
of $\cl K$
\end{frame}

\begin{frame}
  \frametitle{Substructures, homomorphisms and products}

Let $\U,\V,\V_i$ $(i\in I)$ be structures of type $\tau$ and let 
\bl{$f,R$ range over $\Fn,\Rl$}
\begin{itemize}\parskip4pt
\item
$\U$ is a \cemph{substructure} of $\V$ if $U\subseteq V$,
$f^\U(u_1,\dots,u_{n})= f^\V(u_1,\dots,u_{n})$ and 
$R^\U=R^\V\cap\U^n$ for all $u_1,\dots,u_n\in U$%, $f\in\Fn$, $R\in\Rl$

\item
$h:\U\to\V$ is a \cemph{homomorphism} if $h$ is a function from $U$ to
$V$, $h(f^\U(u_1,\dots,u_{n}))= f^\V(h(u_1),\dots,h(u_{n}))$ and
$(u_1,\dots,u_n)\in R^\U\Imp (h(u_1),\dots,h(u_n))\in R^\V$ for all 
$u_1,\dots,u_n\in U$%, $f\in\Fn$, $R\in\Rl$.

\item
$\V$ is a \cemph{homomorphic image} of $\U$ if there exists a surjective
homomorphism $h:\U\onto\V$.

\item
$\U$ is \cemph{isomorphic} to $\V$, in symbols $\U\cong\V$, 
if there exists a bijective homomorphism from $\U$ to $\V$.

\item
$\U=\prod_{i\in I}\V_i$, the \cemph{direct product} of structures $\V_i$,
if $U=\prod_{i\in I}V_i$,
$(f^\U(u_1,\dots,u_{n})_i)_{i\in I}=
(f^{\V_i}(u_{1i},\dots,u_{ni}))_{i\in I}$ and
$(u_1,\dots,u_{n})\in R^\U\Iff
\forall i(u_{1i},\dots,u_{ni})\in R^{\V_i}$
for all $u_1,\dots,u_n\in U$%, $f\in\Fn$, $R\in\Rl$.
\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{}
Substructures are \bl{closed under all operations}; give ``local information''

Homomorphisms are \bl{structure preserving maps}, and their images capture
\bl{global regularity} of the domain structure

Direct products are used to \bl{build or decompose} bigger structures 

A structure with one element is called \cemph{trivial}

A structure is \cemph{directly decomposable} if it is isomorphic to 
a direct product of nontrivial structures

A direct product has \cemph{projection maps}
$\pi_i:\prod_{i\in I}\V_i\onto\V_i$ where $\pi_i(u)=u_i$

\begin{pd}
For any direct product the projection maps are homomorphisms
\end{pd}

Isomorphisms preserve \bl{all} logically defined properties 
(not only first-order)

\end{frame}

\begin{frame}
  \frametitle{Varieties and HSP}
${\sf H}\cl K$ is the class of homomorphic images of members of $\cl K$

${\sf S}\cl K$ is the class of substructures of members of $\cl K$

${\sf P}\cl K$ is the class of direct products of members of $\cl K$

A \cemph{variety} is of the form $\text{Mod}(E)$ for
some set $E$ of equations

A \cemph{quasivariety} is of the form $\text{Mod}(Q)$ for
some set $Q$ of quasiequations 

\begin{pd}
If $\cl K$ is a quasivariety then ${\sf S}\cl K\subseteq \cl K$,
${\sf P}\cl K\subseteq \cl K$ and ${\sf H}\cl K\subseteq \cl K$
%If $\cl V$ is a variety then ${\sf H}\cl V\subseteq \cl V$
\end{pd}

The next characterization marks the beginning of universal algebra

\begin{theorem}[Birkhoff 1935] 
$\cl K$ is a variety iff ${\sf H}\cl K=\cl K$,
${\sf S}\cl K=\cl K$ and ${\sf P}\cl K=\cl K$
\end{theorem}

\end{frame}

\begin{frame}
  \frametitle{Varieties generated by classes}
$\Lambda_\tau=\{\text{Mod}(E):E\text{ is a set of $\tau$-equations}\}=$
set of all $\tau$-varieties

\begin{pd}\parskip5pt
For sets $F_i$ of $\tau$-formulas 
$\bigcap_{i\in I}\mathsf{Mod}(F_i)=\mathsf{Mod}(\bigcup_{i\in I}F_i)$

Hence $\Lambda_\tau$ is closed under arbitrary intersections
%$\text{Mod\,Th_e}(\cl K)$ is the smallest variety that includes $\cl K$

$\bigcap\Lambda_\tau=\mathsf{Mod}(\{x=y\})=$ the class $\cl O_\tau$ of trivial 
$\tau$-structures
\end{pd}

The \cemph{variety generated by $\cl K$} is 
${\sf V}\cl K=\bigcap\{\text{all varieties that contain $\cl K$}\}$

\begin{pd}
${\sf SH}\cl K={\sf HS}\cl K$, 
${\sf PH}\cl K={\sf HP}\cl K$ and
${\sf PS}\cl K={\sf SP}\cl K$
for any class $\cl K$ 
\end{pd}

\begin{theorem}[Tarski 1946]
${\sf V}\cl K={\sf HSP}\cl K$ for any class $\cl K$ of structures
\end{theorem}

\end{frame}

\begin{frame}
  \frametitle{Complete lattices}

For a subset $X$ of a poset $\m U$ write $X\le u$ if $x\le u$ for all $x\in X$ 
and\\define $z=\sum X$ if 
$X\le u\Leftrightarrow z\le u$ (so $\sum X$ is the 
\cemph{least upper bound} of $X$)

$u\le X$ and the \cemph{greatest lower bound} $\prod X$ are defined dually.
\begin{pd}
If $\sum X$ exists for every subset of a poset then $\prod
X=\sum\{u:u\le X\}$
\end{pd}
A structure $\m U$ with a partial order is \cemph{complete} if
$\sum X$ exists for all $X\subseteq U$

$\Rightarrow$ every complete join-semilattice is a complete lattice;
$x\cdot y=\prod\{x,y\}$

A complete lattice has a bottom $0=\sum\emptyset$ and a top 
$\top=\prod\emptyset$
\begin{pd}
$\m U$ with partial order $\le$ is complete iff $\prod X$ exists for all 
$X\subseteq U$

$\Lambda_\tau$ partially ordered by $\subseteq$ is a complete lattice 
\end{pd}

%Every concrete Boolean algebra is complete
%
%Every complete and atomic Boolean algebra is isomorphic to
%$\boldsymbol{\cl P}(U)$
%\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Congruences and quotient algebras}
A \cemph{congruence} on an algebra $\m A$ is an \bl{equivalence relation} 
$\theta$ on $A$ that is compatible with the operations of $\m A$, i.e. for all 
$f\in Fn$ $$x_1\theta y_1\And\dots\And x_n\theta y_n\Imp 
f^\m A(x_1,\dots,x_n)\theta f^\m A(y_1,\dots,y_n)
$$
$\text{Con}(\m A)$ is the set of all congruences on $\m A$
\begin{pd}
$\mathsf{Con}(\m A)$ is a complete lattice with $\prod=\bigcap$, 
bottom $I_A$ and top $A^2$
\end{pd}
For $\theta\in\text{Con}(\m A)$, the \cemph{quotient algebra} is
$\m A/\theta=(A/\theta,(f^{\m A/\theta})_{f\in\Fn})$ where
$$
f^{\m A/\theta}([x_1]_\theta,\dots,[x_n]_\theta)=f^\m A(x_1,\dots,x_n)
$$
\begin{pd}
The operations $f^{\m A/\theta}$ are well defined and $h_\theta:
A\to A/\theta$ given by $h_\theta(x)=[x]_\theta$ is a surjective homomorphism
from $\m A$ onto $\m A/\theta$
\end{pd}
\end{frame}

\begin{frame}
\frametitle{Images, kernels and isomorphism theorems}
For a function $f:A\to B$ the \cemph{image} of $f$ is $f[A]=\{f(x):x\in A\}$

The \cemph{kernel} of $f$ is $\text{ker}\,f=\{(x,y)\in A^2:f(x)=f(y)\}$ 
(an equivalence rel)
\begin{pd}\parskip10pt
If $h:\m A\to\m B$ is a homomorphism then $\mathsf{ker}\,h\in\mathsf{Con}(A)$

$h[A]$ is the underlying set of a subalgebra $h[\m A]$ of $\m B$

The first isomorphism theorem:
$f:\m A/\mathsf{ker}\,h\onto h[\m A]$ given by $f([x]_\theta)=h(x)$ is a
well defined isomorphism

The second isomorphism theorem:
For $\theta\in\mathsf{Con}(\m A)$, the subset 
$\ua\theta=\{\psi:\theta\subseteq\psi\}$ of Con$(\m A)$ is isomorphic to
Con$(\m A/\theta)$ via the map $\psi\mapsto\psi/\theta$ where $[x]\psi/\theta[y]\Iff x\psi y$
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{}\parskip8pt
In a join-semilattice, $u$ is \cemph{join irreducible} if 
$u=x+y\ \Imp\ u\in\{x,y\}$ 

$u$ is  \cemph{join prime} if 
$u\le x+y\ \Imp\ u\le x\text{ or }u\le y$ 

$u$ is \cemph{completely join irreducible} if there is a (unique) greatest 
element $<u$

$u$ is \cemph{completely join prime} if 
$u\le\sum X\ \Imp\ u\le x\text{ for some }x\in X$ 

\cemph{$($completely$)$ meet irreducible} and
\cemph{$($completely$)$ meet prime} are given dually
\begin{pd}\parskip5pt
In complete lattices, $u$ is completely join irreducible iff 
$u=\sum X\Imp u\in X$ 

Distributivity $\ \Imp\ ($completely$)$ join irreducible $=($completely$)$ 
join prime
\end{pd}
$u$ is \cemph{compact} if 
$u\le \sum X\Imp u\le x_1+\dots+x_n\text{ for some }x_1,\dots,x_n\in X$ 

A complete lattice is \cemph{algebraic} if all element are joins of 
compact elements
\begin{pd}
$\mathsf{Con}(\m A)$ is an algebraic lattice {\scriptsize 
(hint: compact = finitely generated)}
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Subdirect products and subdirectly irreducibles}
An \cemph{embedding} is an injective homomorphism

An embedding $h:\m A\into\prod_{i\in I}\m B_i$ is \cemph{subdirect} if
%$\pi_i\circ h$ is surjective 
$\pi_i[h[A]]=B_i$ for all $i\in I$

$\m A$ is a \cemph{subdirect product} of $(\m B_i)_{i\in I}$
if there is a subdirect $h:\m A\into\prod_{i\in I}\m B_i$
\begin{pd}\parskip5pt
Define $h:\m A\into\prod_{i\in I}\m A/\theta_i$ by 
$h(a)=([a]_{\theta_i})_{i\in I}$

Then $h$ is a subdirect embedding iff $\bigcap_{i\in I}\theta_i=I_A$
\end{pd}
$\m A$ is \cemph{subdirectly irreducible} if for any subdirect
$h:\m A\into\prod_{i\in I}\m B_i$ there is an $i\in I$ such that 
$\pi_i\circ h$ is an isomorphism
\begin{pd}
$\m A$ is subdirectly irreducible iff $I_A\in\mathsf{Con}(\m A)$ is
completely meet irreducible iff $\mathsf{Con}(\m A)$ has a smallest 
nonbottom element
\end{pd}

\end{frame}

\begin{frame}
  \frametitle{Meet irreducibles and subdirect representations}
\cemph{Zorn's Lemma} states that if every linearly ordered subposet of a poset
has an upper bound, then the poset itself has maximal elements
\begin{pd}
In an algebraic lattice all members are meets of completly meet irreducibles

%{\scriptsize Assume not, 
\end{pd}
The next result shows that subdirectly irreducibles are \bl{building blocks}
\begin{theorem}[Birkhoff 1944]
Every algebra is a subdirect product of its subdirectly irreducible images
\end{theorem}
$\cl K_\text{SI}$ is the \cemph{class of subdirectly irreducibles} of $\cl K$

$\Imp$ $\cl V={\sf SP}(\cl V_\text{SI})$ for any variety $\cl V$
\end{frame}

\begin{frame}\parskip8pt
  \frametitle{Filters and ideals}
For a poset $(U,\le)$ the \cemph{principal ideal} of $x\in U$ is 
$\da x=\{y:y\le x\}$

For $X\subseteq U$ define $\da X=\bigcup_{x\in X}\da x$; \quad $X$ is a 
\cemph{downset} if $X=\da X$

$X$ is \cemph{up-directed} if 
$x,y\in X\Imp\exists u\in X(x\le u\And y\le u)$

$X$ is an \cemph{ideal} if $X$ is an up-directed downset

\cemph{principal filter} $\ua x$, $\ua X$, \cemph{upset}, 
\cemph{down-directed} and \cemph{filter} are defined dually

An ideal or filter is \cemph{proper} if it is not the whole poset

An \cemph{ultrafilter} is a maximal (with respect to inclusion) proper filter

A filter $X$ in a join-semilattice is \cemph{prime} if 
$x+y\in X\Imp x\in X\Or y\in X$
\begin{pd}
The set $\mathsf{Fil}(\m U)$ of all filters on a poset $U$ is an 
algebraic lattice

In a join-semilattice every maximal filter is prime

In a distributive lattice every proper prime filter is maximal
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Ultraproducts}

$\cl F$ is a \cemph{filter over a set $I$} if $\cl F$ is a filter in 
$(\cl P(I),\subseteq)$

$\cl F$ defines a \bl{congruence} on $\m U=\prod_{i\in I}\m U_i$ via 
$x\theta_\cl Fy\ \Iff\ \{i\in I{:}x_i=y_i\}\in\cl F$

$\m U/\theta_\cl F$ is called a \cemph{reduced product}, 
denoted by $\prod_\cl F\m U_i$

If $\cl F$ is an ultrafilter then $\m U/\theta_\cl F$ is called an 
\cemph{ultraproduct}

${\sf P}_u\cl K$ is the class of all ultraproducts of members of $\cl K$

$\cl K$ is \cemph{finitely axiomatizable} if $\cl K=\text{Mod}(\phi)$ 
for a single formula $\phi$
\begin{pd}\parskip7pt
If $\cl K\models\phi$ then ${\sf P}_u\cl K\models\phi$ for any 
first order formula $\phi$

If $\cl K$ is finitely axiomatizable then the complement of $\cl K$ is closed
under ultraproducts

If $\cl K$ is a finite class of finite $\tau$-structures then 
${\sf P}_u\cl K=\cl K$
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Congruence distributivity and J\'onsson's Theorem}
$\m A$ is \cemph{congruence distributive} (CD) if $\text{Con}(\m A)$ 
is a distributive lattice

A class $\cl K$ of algebras is \cemph{CD} if every algebra in $\cl K$ is CD

\begin{theorem}[J\'onsson 1967]
If $\cl V={\sf V}\cl K$ is congruence distributive then 
$\cl V_\mathsf{SI}\subseteq {\sf HSP}_u\cl K$
\end{theorem}

\begin{pd}\parskip 8pt
If $\cl K$ is a finite class of finite algebras and ${\sf V}\cl K$ is CD then
$\cl V_\mathsf{SI}\subseteq {\sf HS}\cl K$

If $\m A,\m B\in\cl V_\mathsf{SI}$ are finite nonisomorphic and $\cl V$ is CD 
then ${\sf V}\m A\ne{\sf V}\m B$
\end{pd}

$\cl V$ is \cemph{finitely generated} if $\cl V={\sf V}\cl K$ 
for some finite class of finite algebras

\begin{pd}
A finitely generated CD variety has only finitely many subvarieties
\end{pd}
\end{frame}

\begin{frame}\parskip 4pt
  \frametitle{Lattices of subvarieties}

If $\cl F_{\sigma}\subset\cl F_\tau$ then the $\cl F_\sigma$-reduct of a 
$\tau$-algebra $\m A$ is $\m A'=(A,(f^\m A)_{f\in\cl F_\sigma})$
%, and $\m A$ is an expansion of $\m A'$

\begin{pd}\parskip 4pt
If $\m A'$ is a reduct of $\m A$ then $\mathsf{Con}(\m A)$ is a sublattice of $\mathsf{Con}(\m A')$

The variety of lattices is CD, so any variety of algebras with lattice reducts is CD
\end{pd}

For a variety $\cl V$ the lattice of subvarieties is denoted by $\Lambda_\cl V$

The meet is $\bigcap$ and the join is 
$\sum_{i\in I}\cl V_i={\sf V}(\bigcup_{i\in I}\cl V_i)$

\begin{pd}\parskip 4pt
For any variety $\cl V$, $\Lambda_\cl V$ is an algebraic lattice with
compact elements $=$ varieties that are finitely axiomatizable over $\cl V$

${\sf HSP}_u(\cl K\cup\cl L)={\sf HSP}_u\cl K\cup{\sf HSP}_u\cl L$ 
for any classes $\cl K,\cl L$

If $\cl V$ is CD then $\Lambda_\cl V$ is distributive and the map 
$\cl V\mapsto\cl V_\mathsf{SI}$ is a lattice embedding of $\Lambda_\cl V$ into
``$\cl P(\cl V_\mathsf{SI})$'' (unless $\cl V_\mathsf{SI}$ is a proper class)
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Simple algebras and the discriminator}

$\m A$ is \cemph{simple} if $\text{Con}(\m A)=\{I_A,A^2\}$ i.e. has as few 
congruences as possible

%$\cl K_\mathsf{S}$ is the class of simple members of $\cl K$
\begin{pd}
Any simple algebra is subdirectly irreducible
\end{pd}
%For a term $t$ the term operation induced on a $\tau$-algebra $\m A$ is 
%denoted $t^\m A$

$\m A$ is a \cemph{discriminator algebra} if for some ternary term $t$\\
$\m A\models x\ne y\Imp t(x,y,z)=x\And t(x,x,z)=z$
%$t^\m A(x,y,z)=\begin{cases}x&\text{if }x\ne y\\z&\text{if }x=y\end{cases}$
\begin{pd}
Any subdirectly irreducible discriminator algebra is simple
\end{pd}
$\cl V$ is a \cemph{discriminator variety} if $\cl V$ is generated by a class
of discriminator algebras (for a fixed term $t$)
\end{frame}

\begin{frame}
  \frametitle{Unary discriminator in algebras with Boolean reduct}
A \cemph{unary discriminator term} is a term 
$d$ in an algebra $\m A$ with a Boolean reduct 
such that $d(0)=0$ and $x\ne 0\Imp d(x)=\top$

\begin{pd}\parskip8pt
An algebra with a Boolean reduct is a discriminator algebra\\ iff 
it has a unary discriminator term\\
{\scriptsize
$[$Hint: 
let $d(x)=t(0,x,\top)^-$ and $t(x,y,z)=x\cdot d(x^-\cdot y+x\cdot y^-)+
z\cdot d(x^-\cdot y+x\cdot y^-)^-]$
}

In a concrete relation algebra the term $d(x)=\top{;}x{;}\top$ is a unary 
discriminator term
\end{pd}
For a \bl{quantifier free} formula $\phi$ we define a term $\phi^\mathsf t$ 
inductively by 
$(r=s)^\mathsf t=(r^-+s)\cdot(r+s^-)$,\quad 
$(\phi\,\text{and}\,\psi)^\mathsf t=\phi^\mathsf t\cdot\psi^\mathsf t$,\quad 
$(\neg\phi)^\mathsf t=d((\phi^\mathsf t)^-)$
\begin{pd}
In a discriminator algebra with Boolean reduct $\phi\Iff(\phi^\mathsf t=1)$ 
\end{pd}
\end{frame}

\section{Relation algebras are a discriminator variety}
\begin{frame}
  \frametitle{Relation algebras are a discriminator variety}
Let $\m Aa=(\da a,+,0,\cdot,a,^{-_a},{;_a},1{\cdot}a,^{\co_a})$ be
the \cemph{relative subalgebra} of relation algebra $\m A$ with $a\in A$
where
$x^{-_a}=x^-{\cdot}a$, $x{;_a}y=(x;y){\cdot}a$, and $x^{\co_a}=x^\co{\cdot}a$

An element $a$ in a relation algebra is an \cemph{ideal element}
if $a=\top{;}a{;}\top$
\begin{pd}\parskip10pt
$\m Aa$ is a relation algebra iff $a=a^\co=a{;}a$

For any ideal element $a$ the map $h(x)=(x{\cdot} a,x{\cdot} a^-)$ is an 
isomorphism from $\m A$ to $\m Aa\times\m Aa^-$

A relation algebra is simple iff it is subdirectly irreducible\\
iff it is not directly decomposable\\
iff $0,\top$ are the only ideal elements\\
iff $\top{;}x{;}\top$ is a unary discriminator term
\end{pd}
\end{frame}

\section{Representable relation algebras}
\begin{frame}
  \frametitle{Representable relation algebras}
The class ${\sf RRA}$ of \cemph{representable relation algebras} is 
${\sf SP}\{\mathsf{Rel}(X){:}X\text{ is a set}\}$
\begin{pd}\parskip8pt
An algebra is in $\sf RRA$ iff it is embeddable in a concrete relation algebra

The class $\cl K=\mathsf S\{\mathsf{Rel}(X):X\text{ is a set}\}$ is closed 
under $\sf H$, $\sf S$ and $\sf P_u$

{\scriptsize $[$Hint: 
$\sf P_uS\subseteq SP_u$ so if
$\m A=\prod_\cl U\mathsf{Rel}(X_i)$ for some ultrafilter $\cl U$ over $I$,
let $Y=\prod_\cl U X_i$, define $h:\m A\to\mathsf{Rel}(Y)$ by
$[x]h([R])[y]\Iff \{i\in I:x_iR_iy_i\}\in \cl U$ and show $h$ is a 
well defined embedding$]$
}

$\Imp ({\sf V}\cl K)_\mathsf{SI}\subseteq \cl K$ by J\'onsson's Theorem

$\Imp {\sf V}\cl K={\sf SP}\cl K=\mathsf{RRA}$ 
by Birkoff's subdirect representation theorem
\end{pd}
$\Imp$ [Tarski 1955] $\sf RRA$ is a variety 

\end{frame}

\begin{frame}
  \frametitle{}
\begin{theorem}\parskip8pt
$\sf[Lyndon\ 1950]$ 
There exist nonrepresentable relation algebras (i.e. $\notin\sf RRA$)

$\sf[Monk\ 1969]$ $\sf RRA$ is not finitely axiomatizable

$\sf[Jonsson\ 1991]$ $\sf RRA$ cannot be axiomatized with finitely 
many variables
\end{theorem}

%\end{frame}

%\begin{frame}
%  \frametitle{}
Outline of nonfinite axiomatizability: 
There is a sequence of finite relation algebras $A_n$ with $n$
atoms and the property that $A_n$ is representable iff 
there exists a projective plane of order $n$

By a result of [Bruck and Ryser 1949] projective planes 
do not exist for infinitely many orders

The ultraproduct of the corresponding sequence of nonrepresentable $A_n$ 
is representable, so the complement of RRA is not closed under ultraproducts

$\Imp$ RRA is not finitely axiomatizable
\end{frame}

\begin{frame}
  \frametitle{Checking if a finite relation algebra is representable}
\begin{theorem}
[Lyndon 1950, Maddux 1983] There is an algorithm that halts if a 
given finite relation algebra is \bl{not} representable
\end{theorem}
Lyndon gives a recursive axiomatization for $\sf RRA$

Maddux defines a sequence of varieties ${\sf RA}_n$ such that 
${\sf RA}={\sf RA}_4\supset{\sf RA}_5\supset\dots{\sf RRA}=
\bigcap_{n\ge 4}{\sf RA}_n$ and it is decidable if a finite algebra
is in ${\sf RA}_n$

Implemented as a GAP program [Jipsen 1993]

Comer's \bl{one-point extension method} often gives sufficient conditions for 
representability; also implemented as a GAP program [J 1993]
\begin{theorem}
[Hirsch Hodkinson 2001] Representability is undecidable for finite
relation algebras
\end{theorem}
\end{frame}

\section{Complex algebras}
\begin{frame}
  \frametitle{Complex algebras}

Let $\m U=(U,T,^\co,E)$ be a structure with $T\subseteq U^3$, \ 
$^\co:U\to U$, \ $E\subseteq U$

The \cemph{complex algebra} 
$\mathsf{Cm}(\m U)$ is $(\cl P(U),\cup,\emptyset,\cap,U,^-,{;},^\co,1)$ where
$X{;}Y=\{z:(x,y,z)\in T\text{ for some }x\in X,y\in Y\}$,\\
$X^\co=\{x^\co:x\in X\}$,
 \ and \ $1=E$
\begin{pd}
$\mathsf{Cm}(\m U)$ is a relation algebra
iff $x=y\Iff \exists z\in E\ (x,z,y)\in T$,
$(x,y,z)\in T\Iff(x^\co,z,y)\in T\Iff(z,y^\co,x)\in T$, and
$(x,y,z)\in T\ \mathsf{and}\ (z,u,v)\in T
\Imp\exists w((x,w,v)\in T\ \mathsf{and}\ (y,v,w)\in T)$
\end{pd}
An algebra $\m A=(A,\circ,^\co,e)$ can be viewed as a structure 
$(A,T,^\co,E)$ where $T=\{(x,y,z):x\circ y=z\}$ and $E=\{e\}$
\begin{pd}
$\mathsf{Cm}(\m A)$ is a relation algebra iff $\m A$ is a group
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Atom structures}
$J(\m A)$ denotes the set of completely join irreducible elements of $\m A$
\begin{pd}\parskip4pt
In a Boolean algebra $J(\m A)$ is the set of atoms of $\m A$

Every atomic BA is embeddable in $\cl P(J(\m A))$ via 
$x\mapsto J(\m A)\cap\da x$

Every complete and atomic Boolean algebra is isomorphic to $\cl P(J(\m A))$
\end{pd}
The \cemph{atom structure} of an atomic relation algebra $\m A$ is 
$(J(\m A),^\co,T,E)$ where
$T=\{(x,y,z)\in J(\m A):x{;}y\ge z\}$ and 
$E=J(\m A)\cap\da 1$
\begin{pd}\parskip5pt
$\m U=(U,^\co,T,E)$ is the atom structure of some atomic relation algebra
iff $\mathsf{Cm}(\m U)$ is a relation algebra

If $\m A$ is complete and atomic then $\mathsf{Cm}(J(\m A))\cong \m A$
\end{pd}
\end{frame}

\section{Computing finite nonisomorphic models}
\begin{frame}
  \frametitle{Integral and finite relation algebras}
A relation algebra is \cemph{integral} if $x{;}y=0\ \Imp\ x=0\Or y=0$
\begin{pd}
A relation algebra $\m A$ is integral iff $1$ is an atom of $\m A$
iff $x\ne 0\Imp x{;}\top=\top$
\end{pd}

$\mathsf{Rel}(2)$ has 4 atoms and is the smallest simple nonintegral 
relation algebra

Nonintegral RAs can often be decomposed into a ``semidirect product''
of integral algebras, so most work has been done on finite integral RAs

For finite relation algebras one usually works with the atom structure

$\mathsf{Rel}(\emptyset)$ is the one-element RA; generates the variety 
$\cl O=\mathsf{Mod}(0=\top)$

$\mathsf{Rel}(1)$ is the two-element RA, with $1=\top$, $x{;}y=x\cdot y$, 
$x^\co=x$ 

It generates the variety $\cl A_1=\mathsf{Mod}(1=\top)$ of 
\cemph{Boolean relation algebras}
\end{frame}

\begin{frame}
  \frametitle{Varieties of small relation algebras}

Define $x^s=x+x^\co$ and let $\m A^s$ have underlying set $A^s=\{x^s:x\in A\}$

A relation algebra $\m A$ is \cemph{symmetric} if $x=x^\co$ (iff $\m A^s=\m A$)
\begin{pd}
If $\m A$ is commutative, then $\m A^s$ is a subalgebra of $\m A$

There are two RAs with 4 elements: 
$\m A_2=\mathsf{Cm}(\mathbb Z_2)$ and $\m A_3=(\mathsf{Cm}(\mathbb Z_3))^s$
\end{pd}
The varieties generated by $\m A_2$ and $\m A_3$ are denoted $\cl A_2$ and
$\cl A_3$

By J\'onsson's Theorem $\cl A_1$, $\cl A_2$ and $\cl A_3$ are atoms of 
$\Lambda_\mathsf{RA}$
\begin{theorem}[J\'onsson]
Every nontrivial variety of relation algebras includes $\cl A_1$, 
$\cl A_2$ or $\cl A_3$
\end{theorem}
\end{frame}

\begin{frame}\parskip7pt
  \frametitle{Group RAs and integral RAs of size 8}
A complex algebra of a group is called a \cemph{group relation algebra}

$\sf GRA$ is the variety generated by all group relation algebras
\begin{pd}
If $\m U$ is a group then $\mathsf{Cm}(\m U)$ is embedded in
$\mathsf{Rel}(U)$ via Cayley's representation, given by
$h(X)=\{(u,u\circ x):u\in U,x\in X\}$
\end{pd}
$\Imp$ $\sf GRA$ is a subvariety of $\sf RRA$

For an algebra $\m A$ and $x\in A$, $\mathsf{Sg}^\m A(x)$ is the subalgebra
generated by $x$

There are 10 integral relation algebras with 8 elements, all 1-generated 
subalgebras of group relation algebras, hence representable

$\begin{array}{lll}
\m B_1=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_4}\{2\}&
\m B_5=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_5}\{1,4\}&
\m C_1=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_7}\{1,2,4\}\\
\m B_2=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_6}\{2,4\}&
\m B_6=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_8}\{1,4,7\}&
\m C_2=\mathsf{Sg}^{\mathsf{Cm}\mathbb Q}\{r:r>0\}\\
\m B_3=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_6}\{3\}&
\m B_7=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_{12}}\{3,4,6,8,9\}&
\m C_3=\mathsf{Cm}(\mathbb Z_3)\\
\m B_4=\mathsf{Sg}^{\mathsf{Cm}\mathbb Z_9}\{3,6\}&
\end{array}$
\end{frame}

\begin{frame}\parskip7pt
  \frametitle{Integral relation algebras with 4 atoms}
The 8-element integral RAs all have $\m A_3$ as the only proper subalgebra

$\Imp$ they generate join-irreducible varieties above $\cl A_3$

$\m B_1,\dots,\m B_7$ are symmetric, $\m C_1,\m C_2,\m C_3$ are nonsymmetric

%A set $\{x,y\}$ of atoms is a \cemph{converse pair} if $x\ne y=x^\co$

[Comer] There are 102 integral 16-element RAs, not all representable

(65 are symmetric, and 37 are not)

[Jipsen Hertzel Kramer Maddux] 31 nonrepresentable (20 are symmetric)
\begin{problem}
What is the smallest representable RA that is not in GRA?\\
Is there one with 16 elements?
\end{problem}
There are 34 candidates at 
{\scriptsize\texttt{www.chapman.edu/${\sim}$jipsen/gap/ramaddux.html}}
that are representable but not known to be group representable
\end{frame}

\begin{frame}
  \frametitle{Summary of basic classes of structures}
Qoset = \cemph{quasiordered sets} = sets with a reflexive and 
   transitive relation\\
Poset = \cemph{partially ordered sets} = antisymmetric quosets\\
Equiv = \cemph{equivalence relations} = symmetric quosets\\
Sgrp = \cemph{semigroups} = associative groupoids\\
Bnd = \cemph{bands} = idempotent ($x+x=x$) semigroups\\
Slat = \cemph{semilattices} = commutative bands\\
JSlat = \cemph{join-semilattices} = semilattices with $x\le y\Iff x+y=y$\\
Lat = \cemph{lattices} = two semilattices with absorption laws\\
Mon = \cemph{monoids} = semigroups with identity $x\cdot 1=x=1\cdot x$\\
Mon$^\co$ = \cemph{involutive monoids} = monoids with $x^{\co\co}=x$, 
   $(x{\cdot}y)^\co=y^\co{\cdot}x^\co$\\
Grp = \cemph{groups} = involutive monoids with $x^\co\cdot x=1$\\
JSLat$_0$ = \cemph{join-semilattices with identity} $x+0=x$\\
Lat$_{0\top}$ = \cemph{bounded lattices} = lattices with 
   $x+0=x$ and $x{\cdot}\top=\top$\\
Lat$^-$ = \cemph{complemented lattices} = Lat$_{0\top}$ with 
   $x+x^-=\top$ and $x{\cdot}x^-=0$\\
DLat = \cemph{distributive lattices} = lattices with
   $x{\cdot}(y+z)=x{\cdot}y+x{\cdot}z$\\
BA = \cemph{Boolean algebras} = complemented distributive lattices\\
\end{frame}

\begin{frame}
  \frametitle{Some prominent subclasses of semirings}
Srng = \cemph{semirings} = monoids distributing over commutative monoids 
  and 0\\
IS = \cemph{(additively) idempotent semirings} = semirings with $x+x=x$\\
$\ell$M = \cemph{lattice-ordered monoids} = idempotent semirings with meet\\
RL = \cemph{residuated lattices} = $\ell$-monoids with residuals\\
KA = \cemph{Kleene algebra} = idempotent semiring with $^*$, unfold 
  and induction\\
KA$^*$ = \cemph{$*$-continuous Kleene algebra} = KA with ...\\
KAT = \cemph{Kleene algebras with tests} = KA with Boolean subalgebra $\le 1$\\
KAD = \cemph{Kleene algebras with domain}\\
KL = \cemph{Kleene lattices} = Kleene algebras with meet\\
BM = \cemph{Boolean monoids} = distributive $\ell$-monoids with complements\\
KBM = \cemph{Kleene Boolean monoids} = Boolean monids with Kleene-$*$\\
RA = \cemph{relation algebras} = Boolean monoids with involution and 
  residuals\\
KRA = \cemph{Kleene relation algebras} = relation algebras with Kleene-$*$\\
RRA = \cemph{representable relation algebras} = concrete relation algebras\\
RKRA = \cemph{representable Kleene relation algebras} = RRA with Kleene-$*$
%(= RAT in [Tarski Ng])
\end{frame}

\begin{frame}
  \frametitle{Subclasses from combinations of $^*$, tests, meet, $^-$, $^\co$}
\begin{center}
\scriptsize
\psset{unit=1.3cm, nodesep=3pt}%,arm=.8,linearc=.25}
\pspicture(0,0)(5,5)
\rput[c](1,5){\rnode{IS}{IS}}
\rput[c](0,4){\rnode{KA}{\bl{KA}}}
\rput[c](1,4){\rnode{IST}{IST}}
\rput[c](2,4){\rnode{lM}{$\ell$M}}
\rput[c](4,4){\rnode{ISc}{IS$^\co$}}
\rput[c](0,3){\rnode{KAT}{KAT}}
\rput[c](1,3){\rnode{KL}{KL}}
\rput[c](2,3){\rnode{lMT}{$\ell$MT}}
\rput[c](3,3){\rnode{KAc}{KA$^\co$}}
\rput[c](4,3){\rnode{ISTc}{IST$^\co$}}
\rput[c](5,3){\rnode{lMc}{$\ell$M$^\co$}}
\rput[c](1,2){\rnode{KLT}{KLT}}
\rput[c](2,2){\rnode{BM}{BM}}
\rput[c](3,2){\rnode{KATc}{KAT$^\co$}}
\rput[c](4,2){\rnode{KLc}{KL$^\co$}}
\rput[c](5,2){\rnode{lMTc}{$\ell$MT$^\co$}}
\rput[c](1,1){\rnode{KBM}{KBM}}
\rput[c](4,1){\rnode{KLTc}{KLT$^\co$}}
\rput[c](5,1){\rnode{RA}{\bl{RA}}}
\rput[c](4,0){\rnode{KRA}{KRA}}
\ncline{-}{IS}{KA}
\ncline{-}{IS}{IST}
\ncline{-}{IS}{lM}
\ncline{-}{IS}{ISc}
\ncline{-}{KA}{KAT}
\ncline{-}{KA}{KL}
\ncline{-}{KA}{KAc}
\ncline{-}{IST}{KAT}
\ncline{-}{IST}{lMT}
\ncline{-}{IST}{ISTc}
\ncline{-}{lM}{KL}
\ncline{-}{lM}{lMT}
\ncline{-}{lM}{lMc}
\ncline{-}{ISc}{KAc}
\ncline{-}{ISc}{ISTc}
\ncline{-}{ISc}{lMc}
\ncline{-}{KAT}{KLT}
\ncline{-}{KAT}{KATc}
\ncline{-}{KL}{KLT}
\ncline{-}{KL}{KLc}
\ncline{-}{lMT}{KLT}
\ncline{-}{lMT}{BM}
\ncline{-}{lMT}{lMTc}
\ncline{-}{KAc}{KATc}
\ncline{-}{KAc}{KLc}
\ncline{-}{ISTc}{KATc}
\ncline{-}{ISTc}{lMTc}
\ncline{-}{lMc}{KLc}
\ncline{-}{lMc}{lMTc}
\ncline{-}{KLT}{KBM}
\ncline{-}{KLT}{KLTc}
\ncline{-}{BM}{KBM}
\ncline{-}{BM}{RA}
\ncline{-}{KATc}{KLTc}
\ncline{-}{KLc}{KLTc}
\ncline{-}{lMTc}{KLTc}
\ncline{-}{lMTc}{RA}
\ncline{-}{KBM}{KRA}
\ncline{-}{KLTc}{KRA}
\ncline{-}{RA}{KRA}
%\rput[c](2.5,-1){}
\endpspicture
\qquad\qquad
\pspicture(0,0)(2,5)
\rput[l](0,2.5){\begin{tabular}{l}
A = Algebra\\
B = Boolean\\
I = Idempotent\\
K = Kleene\\
L = Lattice\\
$\ell$ = lattice-ordered\\
M = Monoid\\
R = Relation\\
S = Semiring\\
T = with tests\\
$^\co$ = with converse\\
\end{tabular}}
\endpspicture
\end{center}
\end{frame}

\begin{frame}
  \frametitle{}
Many, but \bl{not all}, of these classes are varieties

Recall that quasivarietes are classes defined by \bl{implications} of equations

Most notably, \bl{Kleene algebras} and some of its subclasses are 
quasivarieties

In general, implications are not preserved by homomorphic images

To see that KA is not a variety, find an algebra in $\HH(\mathsf{KA})\setminus
\mathsf{KA}$
\begin{pd}
Let $\m A$ be the powerset Kleene algebra of $(\mathbb N,+,0)$ and 
let $\theta$ be the equivalence relation on $A$ with blocks $\{\emptyset\}$,
$\{\{0\}\}$, $\{$all finite sets $\ne\{0\},\emptyset\}$ and $\{$all infinite
subsets$\}$. Then $\theta$ is a congruence, but $\m A/\theta$ is not
a Kleene algebra.
\end{pd}
\begin{theorem}[Mal'cev]
A class $\cl K$ is a quasivariety iff it is closed under $\SS$, $\PP$ and $\Pu$

The smallest quasivariety containing $\cl K$ is $\mathsf Q\cl K=\SS\PP\Pu\cl K$
\end{theorem}
\end{frame}

\begin{frame}
  \frametitle{Free algebras}\parskip8pt
Let $\cl K$ be a class and let $\m F$ be an algebra that is 
\cemph{generated} by a set $X\subseteq F$ 
(i.e. $\m F$ has no proper subalgebra that contains $X$)

$\m F$ is \cemph{$\cl K$-freely generated}
by $X$ if any $f:X\to \m A\in\cl K$ extends to a homomorphism
$\hat f:\m F\to \m A$

If also $\m F\in\cl K$ then $\m F$ is the \cemph{$\cl K$-free
algebra on $X$} and is denoted by $\m F_{\cl K}(X)$.
\begin{pd}\parskip8pt
If $\cl K$ is the class of all $\tau$-algebras then the term algebra 
$\m T_\tau(X)$ is the $\cl K$-free algebra on $X$

If $\cl K$ is any class of $\tau$-algebras, let $\theta_\cl K=\bigcap
\{\ker h\mid h:\m T_\tau(X)\to\m A$ is a homomorphism, $\m A\in\cl K\}$.
Then $\m F=\m T_\tau(X)/\theta_\cl K$ is $\cl K$-freely generated and if $\cl K$ is
closed under subdirect products, then $\m F\in\cl K$
\end{pd}
$\Imp$ free algebras exist in all (quasi)varieties (since they are $\SS,\PP$ closed) 
\end{frame}

\begin{frame}
  \frametitle{Examples of free algebras}
A free algebra on $m$ generators satisfies only those equations
with $\le m$ variables that hold in all members of $\cl K$

$\m F_\mathsf{Sgrp}(X)\cong\bigcup_{n\ge 1}X^n$ \qquad
$\m F_\mathsf{Mon}(X)\cong\bigcup_{n\ge 0}X^n$ \qquad $x\mapsto(x)$

These sets of $n$-tuples are usually denoted by $X^+$ and $X^*$

$\m F_\mathsf{Slat}(X)\cong\cl P_\mathsf{fin}(X)\setminus\{\emptyset\}$\qquad
$\m F_\mathsf{Slat_0}(X)\cong\cl P_\mathsf{fin}(X)$ \qquad $x\mapsto\{x\}$

$\m F_\mathsf{Srng}(X)\cong\{$finite multisets of $X^*\}$ \quad
$\m F_\mathsf{IS}(X)\cong\cl P_\mathsf{fin}(X^*)$
\begin{pd}
If equality between elements of all finitely generated free algebras is
decidable, then the equational theory is decidable
\end{pd}
$\Imp$ the equational theories of Sgrp, Mon, Slat, Srng, IS are decidable
\end{frame}

\begin{frame}
  \frametitle{Free distributive lattices and Boolean algebras}
The free algebras for DLat and BA are also easy to describe

$\m F_\mathsf{DLat}(X)\cong\mathsf{Sg}_\mathsf{DLat}^{\boldsymbol{\cl 
P}(\cl P(X))}(h[X])$

$\m F_\mathsf{BA}(X)\cong\mathsf{Sg}_\mathsf{BA}^{\boldsymbol{\cl 
P}(\cl P(X))}(h[X])$ 

where in both cases $h(x)=\{Y\in\cl P(X):x\in Y\} \quad\And\quad 
x\mapsto h(x)$

For finite $X$, the free BA is actually isomorphic to $\boldsymbol{\cl 
P}(\cl P(X))$

For lattices, the free algebra on $>3$ generators is infinite
but the equational theory is still decidable [Skolem 1928] (in polynomial time)
\end{frame}

\begin{frame}\parskip8pt
  \frametitle{Kleene algebras and regular sets}
Deciding equations in KA is also possible, but takes a bit more work

Let $\Sigma$ be a finite set, called an \cemph{alphabet}

The \cemph{free monoid generated by $\Sigma$} is 
$\m\Sigma^*=(\Sigma^*,\cdot,\epsi)$

Here $\epsi$ is the empty sequence $()$, and $\cdot$ is concatenation

The \cemph{Kleene algebra of regular sets} is $\cl R_\Sigma=
\Sg_\mathsf{KA}^{\boldsymbol{\cl P}(\Sigma^*)}(\{\{(x)\}:x\in\Sigma\})$
\begin{theorem}[Kozen 1994] 
$\cl R_\Sigma$ is the free Kleene algebra on $\Sigma$
\end{theorem}
In particular, a \cemph{regular set} is the image of a KA term

So deciding if $(s=t)\in\mathsf{Th}_e(KA)$ is equivalent to
checking if two regular sets are equal

Membership in regular sets can be determined by finite automata
\end{frame}

\begin{frame}
  \frametitle{Automata}
A \cemph{$\Sigma$-automaton} is a structure 
$\m U=(U,(a^\m U)_{a\in\Sigma},S,T)$
such that $a^\U$ is a binary relation for each $a\in\Sigma$ and 
$S,T$ are unary relations.

Elements of $U,S,T$ are called \cemph{states}, \cemph{start states}
and \cemph{terminal states} respectively

For $w\in\Sigma^*$ define $w^\m U$ by $\epsi^\m U=I_U$ and 
$(a\cdot w)^\m U=a^\m U{;}w^\m U$

The \cemph{language recognized} by $\m U$ is 
$L(\m U)=\{w\in\Sigma^*:w^\m U\cap (S\times T)\ne\emptyset\}$

\cemph{$\mathsf{Rec}_\Sigma$} is the set of all languages recognized by 
some $\Sigma$-automaton
\begin{pd}
$\emptyset$, $\{\epsi\}$, $\{a\}\in\mathsf{Rec}_\Sigma$ for all $a\in\Sigma$
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Regular sets are recognizable}
A finite automaton can be viewed as a directed graph with states as nodes and
an arrow labelled $a$ from $u_i$ to $u_j$ iff $(u_i,u_j)\in a^\m U$

Given automata $\m U,\m V$, define $\m U+\m V$ to be the disjoint union
of $\m U, \m V$

$\m U;\m V=(U\uplus V,(a^\m U\uplus
a^\m V\uplus (a^\m UT^\m U\times S^\m V))_{a\in\Sigma},S', T^\m V)$ where

$S'=\begin{cases}S^\m U&\text{if}S^\m U\cap T^\m U=\emptyset\\
S^\m U\cup S^\m V&\text{otherwise}\end{cases}$ and 
$a^\m UT^\m U=\{u:\exists v(u,v)\in a^\m U,v\in T^\m U\}$

$\m U^+=(U,(a^\m U\uplus (a^\m UT^\m U\times S^\m U))_{a\in\Sigma},
S^\m U, T^\m U)$
\begin{pd}
$L(\m U+\m V)=L(\m U)\cup L(\m V)$,
$L(\m U;\m V)=L(\m U);L(\m V)$, and
$L(\m U^+)=L(\m U)^+$
\end{pd}
$\Imp$ every regular set is recognized by some finite automaton
\end{frame}

\begin{frame}
  \frametitle{Matrices in semirings and Kleene algebras}
For a semiring $\m A$, let $M_n(A)=A^{n\times n}$ be the set of
$n\times n$ matrices over $\m A$

$M_n(\m A)$ is again a semiring with usual matrix addition and 
multiplication

$\m 0$ is the zero matrix, and $I_n$ is the identity matrix 

If $A$ is a Kleene algebra and $M=\left[\begin{array}{c|c}
N&P\\\hline Q&R\end{array}\right]
\in M_n(A)$ define $M^*=\left[\begin{array}{c|c}
(N+PR^*Q)^*&N^*P(R+QN^*P)^*\\\hline 
R^*Q(N+PR^*Q)^*&(R+QN^*P)^*\end{array}\right]$

This is motivated by the diagram:
\begin{pd}\parskip7pt
The definition of $M^*$ is independent of the chosen decomposition

If $\m A$ is a Kleene algebra, so is $M_n(\m A)$
\end{pd}
\end{frame}

\begin{frame}\parskip6pt
  \frametitle{Finite automata as matrices}

Given $\m U=(U,(a^\m U)_{a\in\Sigma},S,T)$ with $U=\{u_1,\dots,u_n\}$ let
$(s,M,t)$ be a $0,1$-row $n$-vector, an $n\times n$ matrix and 
a $0,1$-column $n$-vector where

$s_i=1\Iff u_i\in S$, $M_{ij}=\sum\{a:(u_i,u_j)\in a^\U\}$, and 
$t_i=1\Iff u_i\in T$
\begin{pd}
$L(\m U)=h(s;M;t)$ where $h:\m T_\mathsf{KA}(\Sigma)\to \cl R_\Sigma$ is 
induced by $h(x)=\{(x)\}$
\end{pd}
$\Imp$ every recognizable language is a regular set [Kleene 1956]

But many different automata may correspond to the same regular set

$\m U$ is a \cemph{deterministic} automaton if each $a^\m U$ is a 
function on $U$ and $S$ is a singleton set
\begin{pd}
Any nondeterministic automaton $\m U$ can be converted
to a deterministic one $\m U'$ with $U'=\cl P(U)$,
$a'(X)=\{v:(u,v)\in a^\m U\text{ for some }u\in X\}$, $S'=\{S\}$ and
$T'=\{X:X\cap T\ne\emptyset\}$ such that $L(\m U')=L(\m U)$
\end{pd}
\end{frame}

\begin{frame}\parskip6pt
  \frametitle{Minimal automata}
A state $v$ is \cemph{accessible} if $(u,v)\in w^\U$ for some $u\in S$
and $w\in\Sigma^*$

In a deterministic automaton, the accessible states are the subalgebra
generated from the start state

\begin{theorem}[Myhill, Nerode 1958]
Given a deterministic automaton $\m U$ with no inaccessible states, the
relation $u\theta v$ iff $\forall w\in\Sigma^*\ w(u)\in T\Iff w(v)\in T$ 
is a congruence on the automaton and $L(\m U/\theta)=L(\m U)$
\end{theorem}
An automaton is minimal if all states are accessible and the
congruence $\theta$ defined in the preceding theorem is the identity relation
\begin{pd}
Let $\m U,\m V$ be minimal automata. Then $L(\m U)=L(\m V)$ iff 
$\m U\cong\m V$.
%Two minimal automata recognize the same language iff they are isomorphic
\end{pd}
$\Imp$ The equational theory of Kleene algebras is decidable

Try it in JFLAP: An Interactive Formal Languages and Automata Package

%Prover9/Mace4
%GAP
%SAGE
\end{frame}

\begin{frame}
  \frametitle{Th$_q$((idempotent)semirings) is undecidable}
\begin{theorem}[Post 1947, Markov 1949]
The quasiequational theory of semigroups is undecidable
\end{theorem}
For a semigroup $\m A$, let $\m A_1$ be the monoid obtained by adjoining $1$
\begin{pd}\parskip7pt
Any semigroup $\m A$ is a subalgebra of the $;$-reduct of 
$\boldsymbol{\cl P}(\m A)$

If $\cl K=\{;$-reducts of semirings$\}$ then $\SS\cl K=$ the class of semigroups

A quasiequation that uses only $;$ holds in $\cl K$ iff it holds in all 
semigroups
\end{pd}
$\Imp$ the quasiequational theory of (idempotent) semirings is undecidable

Since $\boldsymbol{\cl P}(\m A)$ is a reduct of KA, KAT, KAD, BM the 
same result holds
\end{frame}

\begin{frame}
  \frametitle{The equational theory of RA is undecidable}
\begin{pd}\parskip7pt
For any semigroup $\m A$, the monoid $\m A_1$ is embedded in 
the $;$-reduct of $\mathsf{Rel}(A_1)$ via the Cayley map 
$x\mapsto\{(x,xy):y\in A_1\}$

If $\cl K=\{;$-reducts of simple $\mathsf{RA}s\}$ then 
$\SS\cl K=$ the class of semigroups

The quasiequational theory of $\mathsf{RA}_{\SI}$, 
$\mathsf{RA}$ and $\mathsf{RRA}$ is undecidable
\end{pd}
RA is a discriminator variety, hence any quasiequation 
(in fact any quantifier free formula) $\phi$ can
be translated into an equation $\phi^\mathsf t=1$ which holds in RA iff $\phi$
holds in RA$_{\SI}$

$\Imp$ Th$_e$(RA) is undecidable
\end{frame}

\begin{frame}
  \frametitle{Undecidability is pervasive in $\Lambda_\mathsf{RA}$}

\begin{theorem}[Andr\'eka Givant Nemeti 1997]\parskip7pt
If $\cl K\subseteq$RA such that for each $n\ge1$ there
is an algebra in $\cl K_{\SI}$ with at least $n$ elements below the identity
then $\Th_e\cl K$ is undecidable

If $\cl K\subseteq$RA such that for each $n\ge1$ there
is an algebra in $\cl K$ with a subset of at least $n$ pairwise 
disjoint elements that form a group under $;$ and $^\co$
then $\Th_e\cl K$ is undecidable
\end{theorem}
\begin{pd}
The varieties of integral RAs, symmetric RAs and group relation algebras
are undecidable
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Summary of decidability and other properties}
\begin{tabular}{|l|c|c|c|c|c|c|}\hline
&Th$_e$ dec&Th$_q$ dec&Th dec&\ Var$\ $&\ \,CD\,$\ $&loc 
fin\\\hline
Sgrp, Mon  &\yes&\no &\no &\yes&\no &\no \\
%CSgrp, CMon&\yes&    &    &\yes&\no &\no \\
%Bands      &\yes&    &    &\yes&\no &\yes\\
Slat       &\yes&\yes&\no &\yes&\no &\yes\\
Lat        &\yes&\yes&\no &\yes&\yes&\no \\
DLat       &\yes&\yes&\no &\yes&\yes&\yes\\
BA         &\yes&\yes&\yes&\yes&\yes&\yes\\
Grp        &\yes&\no &\no &\yes&\no &\no \\
Srng       &\yes&\no &\no &\yes&\no &\no \\
IS         &\yes&\no &\no &\yes&\no &\no \\
KA, KAT    &\yes&\no &\no &\no &\no &\no \\
KAD        &    &\no &\no &\no &\no &\no \\
RsKA       &    &\no &\no &\yes&\yes&\no \\
RsL        &\yes&\no &\no &\yes&\yes&\no \\
BM         &\no &\no &\no &\yes&\yes&\no \\
RA         &\no &\no &\no &\yes&\yes&\no \\
RRA        &\no &\no &\no &\yes&\yes&\no \\
KRA        &\no &\no &\no &\yes&\yes&\no \\\hline
\end{tabular}
\end{frame}

\begin{frame}
  \frametitle{Categories}
A \cemph{category} is a structure $\m C=(C,O,\circ,1,\dom,\cod)$ such that

\begin{itemize}
\item
$C$ is a class of \cemph{morphisms}, $O$ is a class of \cemph{objects},\\
$\dom,\cod:C\to O$ give the \cemph{domain} and \cemph{codomain},\\
$1:O\to C$ gives an \cemph{identity morphism}, and\\
\cemph{composition} $\circ$ is a partial binary operation on $C$
\item
$1(X)$ is denoted $1_X$, \ $f:X\to Y$ means $\dom f=X$ and $\cod f=Y$
\item 
$g\circ f$ exists iff $\dom g=\cod f$, in which case
$\dom(g\circ f)=\dom f$,\quad $\cod(g\circ f)=\cod g$ and
if $\dom g=\cod h$ then $(f\circ g)\circ h=f\circ (g\circ h)$
\item 
$\dom 1_X=X=\cod 1_X$, \quad $1_{\dom f}\circ f=f$ \ and \ 
$f\circ 1_{\cod f}=f$
\item
The class $\mathsf{Hom}(X,Y)=\{f:\dom f=X\And\cod f=Y\}$ is a \bl{set}
\end{itemize}
% the class of all morphisms from $X$ to $Y$

$\m{Set}$ is a category with sets as objects and functions as morphisms

$\m{Rel}$ is a category with sets as objects and binary relations as morphisms
\end{frame}

\begin{frame}
  \frametitle{Functors}
Category theory is well suited for relating areas of mathematics

Functors are structure preserving maps (homomorphisms) of categories

For categories $\m C,\m D$ a \cemph{covariant functor} $\m F:\m C\to\m D$ maps
$C\to D$ and $O^\m C\to O^\m D$ such that
\begin{itemize}
\item 
$\m F(1_X)=1_{\m FX}$ and if $f:X \to Y$ then $\m Ff:\m FX\to\m FY$
\item
if $f:X\to Y$, $g:Y\to Z$ then $\m F(g\circ f)=\m Fg\circ\m Ff$
\end{itemize}

For a \cemph{contravariant functor} $\m F:\m C\to\m D$ the definition becomes
\begin{itemize}
\item
$\m F(1_X)=1_{\m FX}$ and if $f:X \to Y$ then $\m Ff:\m FY\to\m FX$
\item
if $f:X\to Y$, $g:Y\to Z$ then $\m F(g\circ f)=\m Ff\circ\m Fg$
\end{itemize}
\begin{pd}
A category with one object is (equivalent to) a monoid, and covariant
functors between such categories are monoid homomorphisms
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Heterogeneous relation algebras}
The category $\m{Rel}$ of typed binary relations is usually enriched by adding
converse and Boolean operation on the sets $\Hom(X,Y)$

In this setting it is also natural to write composition $S\circ R$ as $R{;}S$

A \cemph{heterogeneous relation algebra} (HRA) is a structure 
$\m C=(C,O,{;},1,\dom,\cod,^\co,+,\top,\cdot,0,^-)$ such that 
\begin{itemize}
\item
$(C,O,{;},1,\dom,\cod)$ is a category
\item
$^\co:\Hom(x,y)\to \Hom(y,x)$ satisfies $r^{\co\co}=r$, \ $1_x^\co=1_x$, \ 
$(r{;}s)^\co=s^\co{;}r^\co$
\item
for all objects $x,y$, $(\Hom(x,y),+,\top,\cdot,0,^-)$ is a Boolean algebra and
\item
for all $r{;}s,t\in\Hom(x,y)$, $(r{;}s){\cdot} t=0 \Iff (r^\co{;}t){\cdot} s=0
 \Iff (t;s^\co){\cdot} r=0$
\end{itemize}
\begin{pd}
Relation algebras are (equivalent to) HRAs with one object
\end{pd}
\end{frame}

\begin{frame}
  \frametitle{Other enriched categories}
Suitably weakening the axioms of HRAs (see e.g. [Kahl 2004]) gives\\
\emph{ordered categories (with converse)}\\
\emph{(join/meet)-semilattice categories}\\
\emph{(idempotent) semiring categories}\\
\emph{Kleene categories (with tests)}\\ 
\emph{(distributive/division) allegories}

Given a semiring $(A,+,\cdot)$, the set $\mathsf{Mat}(A)=\{A^{m\times n}:
m,n\ge 1\}$ of all matrices over $A$ is an important example
of a semiring category, with matrix multiplication as composition
%(and transposition as converse).

The categorical approach is helpful in applications since it matches well with
typed specification languages
\end{frame}

\begin{frame}
  \frametitle{Conclusion}
The foundations of relation algebras and Kleene algebras span
a substantial part of algebra, logic and computer science

Here we have only been able to mention some of the basics, with an
emphasis on concepts from universal algebra

Participants are encouraged to read further in some of the primary 
sources and excellent expository works, some of which are listed below

{\scriptsize
[The following pages have at least one (intensionally) false statement in the 
``Prove or disprove'' box(es): 8, 10, 11, 23, 36, 37, 49]

The ``Prove (and extend) or disprove (and fix)'' format is from Ed Burger's
book ``Extending the Frontiers of Mathematics: Inquiries into argumentation 
and proof'', Key College Press, 2006
}
\end{frame}

\begin{frame}[allowframebreaks]
  \frametitle{References and further reading}
\parskip5pt
{\scriptsize
[Andreka Givant Nemeti 1994] \emph{The lattice of varieties of representable
relation algebras}, J. Symbolic Logic

[Andreka Givant Nemeti 1997] \emph{Decision problems for equational theories
of relation algebras}, Memoirs AMS

[Berghammer M\"oller Struth (Eds) 2004] \emph{Relational and Kleene-algebraic 
Methods in Computer Science}, LNCS 3051, Springer

[Birkhoff 1935] \emph{On the structure of abstract algebras}, 
Proc. Camb. Phil. Soc.

[Birkhoff 1944] \emph{Subdirect unions in universal algebra}, Bull. AMS

[Brink Kahl Schmidt (Eds) 1997] \emph{Relational Methods in Computer Science}, 
Springer

[Burris Sankappanavar 1981] \emph{A course in universal algebra}, 
Springer, online

[Conway 1971] \emph{Regular algebra and finite machines}, Chapman and Hall

[Desharnais M\"oller Struth 2003] \emph{Kleene algebras with domain}, online

[Desharnais M\"oller Struth 2004] \emph{Modal Kleene algebras and 
applications}, JoRMiCS, online

[Hirsch Hodkinson 2001] \emph{Representability is not decidable for finite 
relation algebras}, Trans. AMS

[Hirsch Hodkinson 2002] \emph{Relation algebras by games}, North-Holland

[Hodkinson Mikulas Venema 2001] \emph{Axiomatizing complex algebras by games},
Algebra Universalis

[Jipsen 1993] \emph{Discriminator varieties of Boolean algebras with 
residuated operators}, in ``Algebraic Logic'', Banach Center Publ., online

[Jipsen 2004] \emph{From semirings to residuated Kleene lattices},
Studia Logica, online

[Jipsen Luk\'acs 1994] \emph{Minimal relation algebras}, Algebra Universalis

[Jipsen Maddux 1997] \emph{Nonrepresentable sequential algebras}, J. IGPL, 
online

[Jipsen Tsinakis 2002] \emph{A survey of residuated lattices}, in ``Ordered
algebraic structures'', Kluwer, online

[J\'onsson 1967] \emph{Algebras whose congruence lattices are distributive}, 
Math Scand.

[J\'onsson 1982] \emph{Varieties of relation algebras}, Algebra Universalis

[J\'onsson 1991] \emph{The theory of binary relations}, 
in ``Algebraic Logic'', North-Holland

[Jonsson Tarski 1951/2] \emph{Boolean algebras with operators I, II}, 
Amer. J. Math.

[Kahl 2004] \emph{Refactoring heterogeneous relation algebras around ordered
categories and converse}, JoRMiCS, online

[Kozen 1994] \emph{A completeness theorem for Kleene algebras and the algebra
of regular events}, Infor. and Comput., online

[Kozen 1994] \emph{On action algebras}, in ``Logic and Information Flow'',
MIT Press, online

[Kozen 1997] \emph{Automata and computability}, Springer

[Kozen 2003] \emph{Automata on guarded strings and applications}, 
Mat\'emat. Contemp., online

[Kozen and Smith 1996] \emph{Kleene algebras with test: Completeness and 
decidability}, in LNCS 1258, Springer, online

[Maddux 1982] \emph{Some varieties containing relation algebras}, Trans. AMS

[Maddux 1983] \emph{A sequent calculus for relation algebras}, Ann. Pure 
and Appl. Logic

[Maddux 1985] \emph{Finite integral relation algebras}, in LNM 1149, Springer

[Maddux 2006] \emph{Relation algebras}, Elsevier

[Markov 1949] \emph{The impossibility of certain algorithms in the theory 
of associative systems. II.} Doklady Akad. Nauk SSSR

[Post 1947] \emph{Recursive unsolvability of a problem of Thue},
J. Symbolic Logic

[Pratt 1990] \emph{Dynamic algebras as a well-behaved fragment of relation 
algebras}, in LNCS 425, Springer, online

[Pratt 1990] \emph{Action logic and pure induction}, in LNCS 478, Springer,
online

[Tarski 1946] \emph{A remark on functionally free algebras}, Ann. Math.

[Tarski 1955] \emph{Contributions to the theory of models III}, 
Konin. Nederl. Akad. Weten. Proc.
}
\end{frame}
\end{document}

\section{A primer on algebraic logic and proof theoretic methods}
\begin{frame}
  \frametitle{A primer on algebraic logic and proof theoretic methods}

\end{frame}

\section{Introduction to some generalizations}
\begin{frame}
  \frametitle{Introduction to some generalizations}

\end{frame}

\subsection{nonassociative relation algebras}
\begin{frame}
  \frametitle{}

\end{frame}

\subsection{Sequential algebras}
\begin{frame}
  \frametitle{Sequential algebras}

\end{frame}

\subsection{Action algebras and lattices}
\begin{frame}
  \frametitle{Action algebras and lattices}

\end{frame}
