Re: Relational lattice completeness

From: Jan Hidders <hidders_at_gmail.com>
Date: 18 Apr 2006 05:32:02 -0700
Message-ID: <1145363522.523846.208340_at_u72g2000cwu.googlegroups.com>


Marshall Spight wrote:

>
> So, how would one go about proving that any boolean expression
> with the grammar
>
> E ::= V
>       | E && E
>       | E || E
>
> could be transformed into any equivalent expression, using only
> some fixed set of transformations. (That is the basic idea,
> right?) What is the smallest set of transformations necessary?

Often it is shown that you can use the rewrite rules to rewrite the expression to some normal form and then it is shown that for this normal form it holds that expressions are sementically equivalent iff they are syntactically equivalent. I'll give the example for the boolean case you presented.

You need to show that if you have two equivalent expressions you can rewrite one to the other. What is often a good idea for showing equivalence is to rewrite them to some normal form. For the disjunctive normal form you need:

(1) (v1 || v2) && v3 == (v1 && v3) || (v2 && v3)
(1') v1 && (v2 || v3) == (v1 && v2) || (v1 && v3)

Note that this is enough to get you into DNF, which means here an expresssion of the following syntax:

 E1 ::= E2 | E1 || E1
 E2 ::= V | E2 && E2

We have the usual idempotency, commutativity and associativity rules:

(2) (v1 || v1) == v1
(3) (v1 && v1) == v1
(4) (v1 || v2) == (v2 || v1)
(5) (v1 && v2) == (v2 && v1)
(6) (v1 || v2) || v3 == v1 || (v2 || v3)
(7) (v1 && v2) && v3 == v1 && (v2 && v3)

Which essentially means that we can view the expression as a set of sets of variables, e.g., (v1 || (v2 && v3)) || ((v2 && v4) && v5) can be thought of as { {v1}, {v2, v3}, {v2, v4, v5} }. I will call this a set representation of a DNF expression.

Note that we can now also drop rule (1') because it follows from (1),
(4) and (5).

If we add the following rule

(8) (v1 && v2) || v2 == v1 && v2

then we can always rewrite to a DNF such that it holds for its set version {C1, ..., Cn} that there are no Ci and Cj such that Ci is a subset of Cj. I will call set-representations with that property subset-free.

We now set out to show that if two expressions e1 and e2 are rewritten to DNF expressions with subset-free set-representions s1 and s2, respectively, and e1 and e2 are semantically equivalent then s1 = s2. We proof this by contradiction:

We begin with assuming that two expressions e1 and e2 are rewritten to DNF expressions with subset-free set-representations s1 and s2, respectively, and e1 and e2 are semantically equivalent. Let us now also assume that s1 <> s2. Let s1 = {B1, ..., Bn} and s2 = {C1, ..., Cm}. Now there is some Bi that is not a superset of any of C1, ..., Cm or there is a Cj that is not a superset of any of B1, ..., Bn. Note that this is true because s1 and s2 are different, finite and subset-free. (Proof of that is left to the reader as an exercise.) Let us assume that such a Bi exists. (The case for Cj is symmetric.) Let M(Bi) be the model that assigns all variables in Bi to TRUE and all other variables to FALSE. Then clearly M(B_i) is a model for which e1 evaluates to TRUE, but e2 evaluates to FALSE, since none of C1, ..., Cm is a subset of Bi. It follows that e1 and e2 are semantically different, which contradicts the assumption that e1 and e2 are semantically equivalent.

So we know that if two expressions e1 and e2 are semantically equivalent then there is a a subset-free set-representation s' such that both e1 and e2 can be rewritten to e1' and e2' with s' as their set-version. Clearly since e1' and e2' have the same set-representation they can be rewritten to each other, and so we can rewrite e1 to e1' to e2' to e2.

QED So the conclusion is that the set of rules (1), ..., (8) are indeed complete in the sense that we talked about. Note that the dual of (1), i.e.,

   (v1 && v2) || v3 == (v1 || v3) && (v2 || v3)

is missing but that indeed we can prove it from the other rules by algebraic rewriting. That's also left to the reader as an exercise. :-)

Hope this helps,

  • Jan Hidders
Received on Tue Apr 18 2006 - 14:32:02 CEST

Original text of this message