Term algebra

From HandWiki
Revision as of 15:00, 6 February 2024 by Rtextdoc (talk | contribs) (simplify)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Freely generated algebraic structure over a given signature

In universal algebra and mathematical logic, a term algebra is a freely generated algebraic structure over a given signature.[1][2] For example, in a signature consisting of a single binary operation, the term algebra over a set X of variables is exactly the free magma generated by X. Other synonyms for the notion include absolutely free algebra and anarchic algebra.[3]

From a category theory perspective, a term algebra is the initial object for the category of all X-generated algebras of the same signature, and this object, unique up to isomorphism, is called an initial algebra; it generates by homomorphic projection all algebras in the category.[4][5]

A similar notion is that of a Herbrand universe in logic, usually used under this name in logic programming,[6] which is (absolutely freely) defined starting from the set of constants and function symbols in a set of clauses. That is, the Herbrand universe consists of all ground terms: terms that have no variables in them.

An atomic formula or atom is commonly defined as a predicate applied to a tuple of terms; a ground atom is then a predicate in which only ground terms appear. The Herbrand base is the set of all ground atoms that can be formed from predicate symbols in the original set of clauses and terms in its Herbrand universe.[7][8] These two concepts are named after Jacques Herbrand.

Term algebras also play a role in the semantics of abstract data types, where an abstract data type declaration provides the signature of a multi-sorted algebraic structure and the term algebra is a concrete model of the abstract declaration.

Universal algebra

A type [math]\displaystyle{ \tau }[/math] is a set of function symbols, with each having an associated arity (i.e. number of inputs). For any non-negative integer [math]\displaystyle{ n }[/math], let [math]\displaystyle{ \tau_n }[/math] denote the function symbols in [math]\displaystyle{ \tau }[/math] of arity [math]\displaystyle{ n }[/math]. A constant is a function symbol of arity 0.

Let [math]\displaystyle{ \tau }[/math] be a type, and let [math]\displaystyle{ X }[/math] be a non-empty set of symbols, representing the variable symbols. (For simplicity, assume [math]\displaystyle{ X }[/math] and [math]\displaystyle{ \tau }[/math] are disjoint.) Then the set of terms [math]\displaystyle{ T(X) }[/math] of type [math]\displaystyle{ \tau }[/math] over [math]\displaystyle{ X }[/math] is the set of all well-formed strings that can be constructed using the variable symbols of [math]\displaystyle{ X }[/math] and the constants and operations of [math]\displaystyle{ \tau }[/math]. Formally, [math]\displaystyle{ T(X) }[/math] is the smallest set such that:

  • [math]\displaystyle{ X \cup \tau_0 \subseteq T(X) }[/math]   — each variable symbol from [math]\displaystyle{ X }[/math] is a term in [math]\displaystyle{ T(X) }[/math], and so is each constant symbol from [math]\displaystyle{ \tau_0 }[/math].
  • For all [math]\displaystyle{ n \geq 1 }[/math] and for all function symbols [math]\displaystyle{ f \in \tau_n }[/math] and terms [math]\displaystyle{ t_1, ..., t_n \in T(X) }[/math], we have the string [math]\displaystyle{ f(t_1, ..., t_n) \in T(X) }[/math]   — given [math]\displaystyle{ n }[/math] terms [math]\displaystyle{ t_1, ..., t_n }[/math], the application of an [math]\displaystyle{ n }[/math]-ary function symbol [math]\displaystyle{ f }[/math] to them represents again a term.

The term algebra [math]\displaystyle{ \mathcal{T}(X) }[/math] of type [math]\displaystyle{ \tau }[/math] over [math]\displaystyle{ X }[/math] is, in summary, the algebra of type [math]\displaystyle{ \tau }[/math] that maps each expression to its string representation. Formally, [math]\displaystyle{ \mathcal{T}(X) }[/math] is defined as follows:[9]

  • The domain of [math]\displaystyle{ \mathcal{T}(X) }[/math] is [math]\displaystyle{ T(X) }[/math].
  • For each nullary function [math]\displaystyle{ f }[/math] in [math]\displaystyle{ \tau_0 }[/math], [math]\displaystyle{ f^{\mathcal{T}(X)}() }[/math] is defined as the string [math]\displaystyle{ f }[/math].
  • For all [math]\displaystyle{ n \geq 1 }[/math] and for each n-ary function [math]\displaystyle{ f }[/math] in [math]\displaystyle{ \tau }[/math] and elements [math]\displaystyle{ t_1, ..., t_n }[/math] in the domain, [math]\displaystyle{ f^{\mathcal{T}(X)}(t_1, ..., t_n) }[/math] is defined as the string [math]\displaystyle{ f(t_1, ..., t_n) }[/math].

A term algebra is called absolutely free because for any algebra [math]\displaystyle{ \mathcal{A} }[/math] of type [math]\displaystyle{ \tau }[/math], and for any function [math]\displaystyle{ g : X \to \mathcal{A} }[/math], [math]\displaystyle{ g }[/math] extends to a unique homomorphism [math]\displaystyle{ g^\ast : \mathcal{T}(X) \to \mathcal{A} }[/math], which simply evaluates each term [math]\displaystyle{ t \in \mathcal{T}(X) }[/math] to its corresponding value [math]\displaystyle{ g^\ast(t) \in \mathcal{A} }[/math]. Formally, for each [math]\displaystyle{ t \in \mathcal{T}(X) }[/math]:

  • If [math]\displaystyle{ t \in X }[/math], then [math]\displaystyle{ g^\ast(t) = g(t) }[/math].
  • If [math]\displaystyle{ t = f \in \tau_0 }[/math], then [math]\displaystyle{ g^\ast(t) = f^\mathcal{A}() }[/math].
  • If [math]\displaystyle{ t = f(t_1, ..., t_n) }[/math] where [math]\displaystyle{ f \in \tau_n }[/math] and [math]\displaystyle{ n \geq 1 }[/math], then [math]\displaystyle{ g^\ast(t) = f^\mathcal{A}(g^\ast(t_1), ..., g^\ast(t_n)) }[/math].

Example

As an example type inspired from integer arithmetic can be defined by [math]\displaystyle{ \tau_0 = \{ 0,1 \} }[/math], [math]\displaystyle{ \tau_1=\{\} }[/math], [math]\displaystyle{ \tau_2=\{ +,* \} }[/math], and [math]\displaystyle{ \tau_i=\{\} }[/math] for each [math]\displaystyle{ i \gt 2 }[/math].

The best-known algebra of type [math]\displaystyle{ \tau }[/math] has the natural numbers as its domain and interprets [math]\displaystyle{ 0 }[/math], [math]\displaystyle{ 1 }[/math], [math]\displaystyle{ + }[/math], and [math]\displaystyle{ * }[/math] in the usual way; we refer to it as [math]\displaystyle{ \mathcal{A}_{nat} }[/math].

For the example variable set [math]\displaystyle{ X = \{ x,y \} }[/math], we are going to investigate the term algebra [math]\displaystyle{ \mathcal{T}(X) }[/math] of type [math]\displaystyle{ \tau }[/math] over [math]\displaystyle{ X }[/math].

First, the set [math]\displaystyle{ T(X) }[/math] of terms of type [math]\displaystyle{ \tau }[/math] over [math]\displaystyle{ X }[/math] is considered. We use red color to flag its members, which otherwise may be hard to recognize due to their uncommon syntactic form. We have e.g.

  • [math]\displaystyle{ {\color{red}x} \in T(X) }[/math], since [math]\displaystyle{ x \in X }[/math] is a variable symbol;
  • [math]\displaystyle{ {\color{red}1} \in T(X) }[/math], since [math]\displaystyle{ 1 \in \tau_0 }[/math] is a constant symbol; hence
  • [math]\displaystyle{ {\color{red}+x1} \in T(X) }[/math], since [math]\displaystyle{ + }[/math] is a 2-ary function symbol; hence, in turn,
  • [math]\displaystyle{ {\color{red}*+x1x} \in T(X) }[/math] since [math]\displaystyle{ * }[/math] is a 2-ary function symbol.

More generally, each string in [math]\displaystyle{ T(X) }[/math] corresponds to a mathematical expression built from the admitted symbols and written in Polish prefix notation; for example, the term [math]\displaystyle{ {\color{red}*+x1x} }[/math] corresponds to the expression [math]\displaystyle{ (x+1)*x }[/math] in usual infix notation. No parentheses are needed to avoid ambiguities in Polish notation; e.g. the infix expression [math]\displaystyle{ x+(1*x) }[/math] corresponds to the term [math]\displaystyle{ {\color{red}+x*1x} }[/math].

To give some counter-examples, we have e.g.

  • [math]\displaystyle{ {\color{red}z} \not\in T(X) }[/math], since [math]\displaystyle{ z }[/math] is neither an admitted variable symbol nor an admitted constant symbol;
  • [math]\displaystyle{ {\color{red}3} \not\in T(X) }[/math], for the same reason,
  • [math]\displaystyle{ {\color{red}+1} \not\in T(X) }[/math], since [math]\displaystyle{ + }[/math] is a 2-ary function symbol, but is used here with only one argument term (viz. [math]\displaystyle{ {\color{red}1} }[/math]).

Now that the term set [math]\displaystyle{ T(X) }[/math] is established, we consider the term algebra [math]\displaystyle{ \mathcal{T}(X) }[/math] of type [math]\displaystyle{ \tau }[/math] over [math]\displaystyle{ X }[/math]. This algebra uses [math]\displaystyle{ T(X) }[/math] as its domain, on which addition and multiplication need to be defined. The addition function [math]\displaystyle{ +^{\mathcal{T}(X)} }[/math] takes two terms [math]\displaystyle{ p }[/math] and [math]\displaystyle{ q }[/math] and returns the term [math]\displaystyle{ {\color{red}+}pq }[/math]; similarly, the multiplication function [math]\displaystyle{ *^{\mathcal{T}(X)} }[/math] maps given terms [math]\displaystyle{ p }[/math] and [math]\displaystyle{ q }[/math] to the term [math]\displaystyle{ {\color{red}*}pq }[/math]. For example, [math]\displaystyle{ *^{\mathcal{T}(X)}( {\color{red}+x1} , {\color{red}x} ) }[/math] evaluates to the term [math]\displaystyle{ {\color{red}*+x1x} }[/math]. Informally, the operations [math]\displaystyle{ +^{\mathcal{T}(X)} }[/math] and [math]\displaystyle{ *^{\mathcal{T}(X)} }[/math] are both "sluggards" in that they just record what computation should be done, rather than doing it.

As an example for unique extendability of a homomorphism consider [math]\displaystyle{ g: X \to \mathcal{A}_{nat} }[/math] defined by [math]\displaystyle{ g(x) = 7 }[/math] and [math]\displaystyle{ g(y) = 3 }[/math]. Informally, [math]\displaystyle{ g }[/math] defines an assignment of values to variable symbols, and once this is done, every term from [math]\displaystyle{ T(X) }[/math] can be evaluated in a unique way in [math]\displaystyle{ \mathcal{A}_{nat} }[/math]. For example,

[math]\displaystyle{ \begin{array}{lll} & g^*({\color{red}+x1}) \\ = & g^*({\color{red}x}) + g^*({\color{red}1}) & \text{ since } g^* \text{ is a homomorphism } \\ = & g({\color{red}x}) + g^*({\color{red}1}) & \text{ since } g^* \text{ coincides on } X \text{ with } g \\ = & 7 + g^*({\color{red}1}) & \text{ by definition of } g \\ = & 7 + 1 & \text{ since } g^* \text{ is a homomorphism } \\ = & 8 & \text{ according to the well-known arithmetical rules in } \mathcal{A}_{nat} \\ \end{array} }[/math]

In a similar way, one obtains [math]\displaystyle{ g^*({\color{red}*+x1x}) = ... = 8 * g({\color{red}x}) = ... = 56 }[/math].

Herbrand base

Main pages: Herbrand interpretation  and Herbrand structure

The signature σ of a language is a triple <O, F, P> consisting of the alphabet of constants O, function symbols F, and predicates P. The Herbrand base[10] of a signature σ consists of all ground atoms of σ: of all formulas of the form R(t1, ..., tn), where t1, ..., tn are terms containing no variables (i.e. elements of the Herbrand universe) and R is an n-ary relation symbol (i.e. predicate). In the case of logic with equality, it also contains all equations of the form t1 = t2, where t1 and t2 contain no variables.

Decidability

Term algebras can be shown decidable using quantifier elimination. The complexity of the decision problem is in NONELEMENTARY because binary constructors are injective and thus pairing functions.[11]

See also

References

  1. Wilfrid Hodges (1997). A Shorter Model Theory. Cambridge University Press. pp. 14. ISBN 0-521-58713-1. https://archive.org/details/shortermodeltheo00hodg. 
  2. Franz Baader; Tobias Nipkow (1998). Term Rewriting and All That. Cambridge University Press. pp. 49. ISBN 0-521-77920-0. https://books.google.com/books?id=N7BvXVUCQk8C&q=%22Term+algebra%22. 
  3. Klaus Denecke; Shelly L. Wismath (2009). Universal Algebra and Coalgebra. World Scientific. pp. 21–23. ISBN 978-981-283-745-5. https://books.google.com/books?id=NgTAzhC8jVAC&pg=PA21. 
  4. T.H. Tse (2010). A Unifying Framework for Structured Analysis and Design Models: An Approach Using Initial Algebra Semantics and Category Theory. Cambridge University Press. pp. 46–47. doi:10.1017/CBO9780511569890. ISBN 978-0-511-56989-0. 
  5. Jean-Yves Béziau (1999). "The mathematical structure of logical syntax". in Carnielli, Walter Alexandre; D'Ottaviano, Itala M. L.. Advances in Contemporary Logic and Computer Science: Proceedings of the Eleventh Brazilian Conference on Mathematical Logic, May 6-10, 1996, Salvador, Bahia, Brazil. American Mathematical Society. p. 9. ISBN 978-0-8218-1364-5. https://books.google.com/books?id=tEU9OcjwhXUC&pg=PA9. Retrieved 18 April 2011. 
  6. Dirk van Dalen (2004). Logic and Structure. Springer. p. 108. ISBN 978-3-540-20879-2. https://books.google.com/books?id=4u9gQ6pctuIC&pg=PA108. 
  7. M. Ben-Ari (2001). Mathematical Logic for Computer Science. Springer. pp. 148–150. ISBN 978-1-85233-319-5. https://books.google.com/books?id=hzWlEy1qqR8C&pg=PA148. 
  8. Monroe Newborn (2001). Automated Theorem Proving: Theory and Practice. Springer. p. 43. ISBN 978-0-387-95075-4. https://books.google.com/books?id=Kwv1_UXYE8QC&pg=PA43. 
  9. Stanley Burris; H. P. Sankappanavar (1981). A Course in Universal Algebra. Springer. pp. 68–69, 71. ISBN 978-1-4613-8132-7. https://link.springer.com/book/9781461381327. 
  10. Rogelio Davila. Answer Set Programming Overview.
  11. Jeanne Ferrante; Charles W. Rackoff (1979). The Computational Complexity of Logical Theories. Springer, Chapter 8, Theorem 1.2.

Further reading

  • Joel Berman (2005). "The structure of free algebras". In Structural Theory of Automata, Semigroups, and Universal Algebra. Springer. pp. 47–76. MR2210125.

External links