Chapter 2 Equational logic
3.1 Equational tree automata definitions
We treat tree automata as collections of Horn clauses of particular forms as in [138]. Given a Σ-theory E , a regular E -tree automaton A is a finite set of Horn clauses each with the form:
p(f (x1, . . . , xn)) ⇐ p1(x1), . . . , pn(xn) regular clause
where f ∈ Σ has arity n and p, p1, . . . , pn are elements of a finite set of unary
predicate symbols Q called the states of the automaton. In some definitions, tree automata may also contain -clauses of the form p(x) ⇐ q(x), but these can be eliminated without loss of expressive power [33]. We write A/E ` p(t) if p(t) is entailed by the axioms in A ∪ E . There are a variety of different inference systems for entailment with equivalent semantics. When it is necessary to refer
Equivalence t =E u A/E ` p(u) A/E ` p(t)
Membership A/E ` α1θ . . . A/E ` αnθ
A/E ` αθ if α ⇐ α1. . . αn ∈ A
Figure 3.1: Inference System for A/E
to a specific inference steps, we use the inference rules in Figure 3.1.
We keep the acceptance condition separate from the automaton itself, and since the automaton only recognizes languages that are closed modulo E , we define languages as subsets of TE rather than TΣ. For each state p belonging to
A, the language recognized by p in A, denoted Lp(A/E ) ⊆ TE, is defined by
Lp(A/E ) = { [t] ∈ TE | A/E ` p(t) }. (3.1)
For an equational theory E = ∅ with no equations, we write A ` p(t) for A/E ` p(t) and Lp(A) for Lp(A/E ).
One important result from [138] about regular E -tree automata is the fol- lowing:
Theorem 3.1.1. For each theory E and regular E -tree automaton A, A/E ` p(t) ⇐⇒ (∃u ∈ [t]E) A ` p(u).
This theorem implies that an equational tree language can be alternatively defined as the quotient of a regular tree language.
Corollary 3.1.2. For each theory E and regular E -tree automaton A, Lp(A/E ) = { [t] ∈ TE | (∃u ∈ Lp(A) t =E u }.
For an arbitrary theory E , the class of languages recognized by regular E -tree automata is closed under union, but not under intersection or complementa- tion [123]. Motivated by this fact, we introduced propositional tree automata in [76]. This framework is an extension to equational tree automata framework that is effectively closed under Boolean operations in all theories. The key idea is to use a propositional formula rather than a set of final states as the accep- tance condition for defining the language recognized by the automaton. We present a slightly simpler formalization that preserves the basic idea. Given a tree automaton A with states Q, we extend the definition (3.1) of a language
Lp(A/E ) recognized by a state p to languages Lφ(A/E ) recognized by a proposi-
tional formula φ constructed from atomic predicates Q and Boolean connectives ∧ and ¬:
Lφ1∧φ2(A/E ) = Lφ1(A/E ) ∩ Lφ2(A/E ) L¬φ1(A/E ) = TE− Lφ1(A/E ).
As we will later see in our discussion of decision problems, there is a drawback of using propositional tree automata — the emptiness problem is undecidable in general. However, propositional tree automata over the same theory do have trivial algorithms for performing Boolean operations. Given a propositional tree language Lφ(A/E ), the complement is just the language Lφ(A/E ). Given two
propositional tree languages Lφ1(A1/E ) and Lφ2(A2/E ), one can use renaming
to guarantee the states of A0 and φ0 are disjoint from those in A. It is then not difficult to show that the intersection of Lφ1(A1/E ) and Lφ2(A2/E ) is the
language Lφ1∧φ2(A1] A2/E ) where A1] A2 denotes the disjoint union of A1
and A2.
Example. One important relationship is that every order-sorted signature Σ = (S, F, ≤) can be viewed as a regular tree automaton AΣ whose states are the
sorts S. Specifically, we map each operator declaration f : s1. . . sn → s to a
regular clause
s(f (x1, . . . , xn)) ⇐ s1(x1), . . . , sn(xn),
and we map each subsort declaration s < s0 to an -clause s0(x) ⇐ s(x). It is not difficult to show then that for each sort s ∈ S, the set of terms with sort s, TΣ(X)s, is identical to the language Ls(AΣ). This mapping between order-
sorted signatures and regular tree automata can be done in the other direction by viewing the states of the automaton as sorts and the regular rules in the automaton as operator declarations.
As an example, consider the NAT-LIST module defined in Figure 2.3 of Sec- tion 2.4. In the automaton ANAT-LIST representing the signature of NAT-LIST,
the states are the sorts Nat, NeList and List. The subsort declarations Nat < NeList and NeList < List induce the -clauses:
The operator declarations induce the regular clauses: Nat(0)
Nat(s x) ⇐ Nat(x) List(nil)
NeList(xy) ⇐ NeList(x), NeList(y) List(xy) ⇐ List(x), List(y) Nat(head(x)) ⇐ NeList(x)
Nat(end(x)) ⇐ NeList(x) List(reverse(x)) ⇐ List(x)
For sort-independent order-sorted theories E , this connection can be ex- tended to equational tree automata. Let E denote the unsorted theory obtained by dropping the sort information from E , and recall Definition 2.4.1 which states that an order-sorted theory is sort-independent if for each pair of well sorted terms t, u ∈ TΣ(X),
t =E u ⇐⇒ t =E u.
For each sort s ∈ S, by Theorem 3.1.1, the language Ls(AΣ/E ) is the equivalence
classes modulo =E of terms in Ls(AΣ) As Ls(AΣ) = TΣ,s, our assumption that
E is sort-independent means that the set of well-sorted equivalence classes TE,s
is isomorphic to Ls(AΣ/E ) with the bijective mapping
h : [t]E ∈ TE,s7→ [t]E ∈ Ls(AΣ/E ).
This relationship between sort-independent order-sorted theories is fundamen- tal to our tree automata-based sufficient completeness checker (Chapter 5) and canonical completeness checker (Chapter 6). These chapters show how different decision problems can be cast as decision problems for propositional tree lan- guages. As a simple example, we could use tree automata techniques described later in this chapter to check that every list in NAT-LIST is equivalent modulo the axioms to either nil or a non-empty list. We first let ENAT-LIST denote the
unsorted theory containing the associativity and identity axioms in NAT-LIST, and then define the automaton B containing the rules in ANAT-LIST as well an
additional state Nil and rule Nil(nil). It is not difficult to see that the language LList∧¬Nil∧¬NeList(B/ENAT-LIST)
accepts the equivalence class of ground terms that are lists, but not equivalent to nil or NeList. For this simple example, it is easy to see that this language is empty by hand, however the results in this section can be used to automatically check emptiness of much more complicated examples.
have been studied in the context of tree automata and equational tree automata. The membership problem for E is the problem of deciding for an equivalence class [t] ∈ TE, E -tree automaton A and state p in A whether [t] ∈ Lp(A/E ).
Membership is undecidable for arbitrary theories since otherwise one could solve arbitrary equivalences t =E u. However, it is decidable in the case where each
equivalence class [t]E is finite. In this case, one can enumerate the elements of
[t]E and check each for membership in Lp(A).
The emptiness problem for E is the problem of deciding for an E -tree au- tomaton A and state p whether Lp(A/E ) = ∅. This problem is decidable in
linear time for an arbitrary theory E . Corollary 3.1.2 implies that Lp(A/E ) = ∅
iff Lp(A) = ∅ and the question of whether Lp(A) = ∅ is decidable in linear
time using standard tree automata techniques [33].
The intersection emptiness problem for E is the problem of deciding for an E -tree automaton A and states p1, . . . , pn of A whether Lp1(A/E ) ∩ · · · ∩
Lpn(A/E ) = ∅. Finally, the propositional emptiness problem for E is the prob-
lem of deciding for an E -tree automaton A with states Q and propositional formula φ over atomic predicates Q whether Lφ(A/E ) = ∅. Both the intersec-
tion emptiness and propositional emptiness problems are decidable for regular equational tree automata over a theory EAC with AC and free symbols [123].
In contrast, both intersection emptiness and propositional emptiness are unde- cidable for regular equational tree automata over a theory EA with associative
and free symbols [125]. As an example of a tree automata framework where intersection emptiness is decidable and propositional emptiness is undecidable, we refer the reader to the monotone AC tree automata framework of [127].