Page 1

A Comparison of Constraint Handling Rules with

Equivalent Transformation Rules

Yoshinori Shigeta

SoC Research and Development Center

Toshiba Corporation

Kawasaki, Japan

Kiyoshi Akama

Information Initiative Center

Hokkaido University

Sapporo, Japan

Pongtawat Chippimolchai

Computer Science and Information

Management Program

Asian Institute of Technology

Pathumthani, Thailand

Takahiko Ishikawa

Information Initiative Center

Hokkaido University

Sapporo, Japan

Abstract

We have proposed a novel computation framework

called Equivalent Transformation (ET). The ET frame-

work is a rewriting system in which computation is exe-

cuted by rewriting rules. Rewriting rules of the ET frame-

work are called Equivalent Transformation Rules (ETRs).

The theory of ET guarantees the correctness of the com-

putation by ETRs. Multi-head ETRs which have multiple

atoms in their head part are valid ETRs.

Constraint Handling Rules (CHR) are declarative lan-

guage extension designed for writing user-defined con-

straints. CHR allows to use multi-head guarded rules for

its computation.

This paper compares the rewriting rules of ET and CHR,

especially multi-head rules. We show that all CHR rules can

be simply transformed into correct ETRs preserving their

logical meanings. Examples of the correct ETRs which can

not be represented as CHR rules are also given. Therefore

CHR rules can be regarded as proper subclass of ETRs.

Keywords: CHR, Equivalent Transformation, ETRs.

1. Introduction

Many computation models have been proposed, e.g.

Logic Programming (LP)[5], Constraint Logic Program-

ming (CLP)[6], Functional Programming (FP)[7], Func-

tional Logic Programming (FLP)[8] and Equivalent Trans-

formation (ET)[1, 2].

It is considered that almost of these computation mod-

els are in a same class of functions based on the theory of

computable functions. Although they are equivalent to each

other in view of computable functions, they have their own

theoretical basis of declarative semantics. We have been re-

searching the differences between their declarative seman-

tics and have compared the elements of the computation

models with those of the ET framework[3, 4].

The ET framework is a rewriting system in which com-

putation is executed by rewriting rules. Rewriting rules of

the ET framework are called Equivalent Transformation

Rules (ETRs). The theory of ET guarantees the correct-

ness of computation by ETRs. Multi-head ETRs which have

multiple atoms in their head part are valid ETRs.

Constraint Handling Rules (CHR)[9] is a high-level lan-

guage designed to write user-defined constraint solvers.

CHR is a committed-choice language consisting of multi-

head guarded rules. In the rest of this paper, we use the

terms CHR and CHRs for the CHR framework and for the

rewriting rules of the CHR framework respectively.

In this paper we compare multi-head rewriting rules of

CHR with those of ET in term of their syntax, seman-

tics, correctness and expressive power. It is also shown that

CHRs can be regarded as a proper subset of ETRs.

Section 2 briefly reviews the syntax and semantics of

CHRs. Section 3 reviews the ET framework showing the

syntax of ETRs and how they rewrite clauses. Section 4

discusses the semantics and correctness of ETRs. Section

5 compares the Logic Programming and CHR with the

ET framework. Section 6 compares CHRs with ETRs. A

method to correctly transform CHRs into equivalent ETRs

is given. It is shown that CHRs are ETRs and some ETRs

are not CHRs. Section 7 concludes this paper.

Page 2

2. Constraint Handling Rules (CHR)

2.1. Syntax of CHRs

There are three kinds of CHRs. A simplification rule, a

propagation rule and a simpagation rule. These CHRs are

of the form

Simplification:

X1,...,Xi<=> Z1,...,Zj | Y1,...,Yk

Propagation:

X1,...,Xi==> Z1,...,Zj | Y1,...,Yk

Simpagation:

X1,...,Xl\ Xl+1,...,Xi<=> Z1,...,Zj | Y1,...,Yk

where i > 0,j ≥ 0, k ≥ 0, 0 < l < i.

The multi-head X1,...,Xiis a non-empty sequence of CHR

(user-defined)constraints,theguardZ1,...,Zjisasequence

of built-in (pre-defined) constraints and the body Y1,...,Yk

is a sequence of built-in and CHR constraints.

A propagation rule is an abbreviation of a simplification

rule :

X1,...,Xi<=> Z1,...,Zj | X1,...,Xi,Y1,...,Yk

A simpagation rule is a combination of a simplification

and a propagation rule. A simpagation rule is equivalent to

a simplification rule :

X1,...,Xl,Xl+1,...,Xi

<=> Z1,...,Zj | X1,...,Xl,Y1,...,Yk

2.2. Applying CHRs

A CHR rule is applicable if its guard(Z1,...,Zj) is satis-

fied. A simplification rule replaces constraints (X1,...,Xi)

with simpler constraints (Y1,...,Yk) which are logically

equivalent (preserving logical meaning), while a propaga-

tion rule introduces new constraints (Y1,...,Yk) that are

logically redundant.

2.3. Correctness of CHRs

Define Var(S) to be a set of all variables appearing in the

atoms in a set of atoms S. Let x be a set of variables in the

head X1,...,Xi, z a set of variables in the guard Z1,...,Zj

that does not occurs in x, and y a set of variables in the body

Y1,...,Ykwhich occurs in neither x nor z. That is,

x=Var({X1,...,Xi})

z=Var({Z1,...,Zj}) - x

y=Var({Y1,...,Yk}) - x - z

A simplification rules is correct iff its head and its body

are equivalent when the guard is true. More precisely,

∀x∀z(Z1∧...∧Zj→(X1∧...∧Xi↔∃y(Y1∧...∧Yk))).

3. Equivalent Transformation Framework

3.1. Problem-Solving in ET Framework

In the Equivalent Transformation framework (ET frame-

work), a problem or a program specification is formulated

as a declarative description[1](or just a description when it

is unambiguous). A declarative description is a set of defi-

nite clauses. A declarative description consists of two parts:

a definition part and a query part. A definition part provides

general and common knowledge about the problem domain.

A query part contains the queries to the definition part.

From the definition part, a set of ETRs for transform-

ing a declarative descriptions is prepared. This set of ETRs

is called an ET program. The problem is then solved by

transforming the query part successively, using the prepared

ETRs, into another description. The answer of the problem

can be obtained from the transformed query part.

An ETR is correct if its application always results in a

correct computation step, that is, if a description D ∪ Q0is

transformed by an ETR into D ∪ Q1, the logical meaning of

D ∪ Q0and D ∪ Q1must be equivalent. If an ET program

consists of only correct ETRs, its correctness is guaranteed.

A computation in the ET framework is done by succes-

sively rewriting a query part of a description, using ETRs

prepared from a definition part, into a simpler but equiva-

lent form in which answer to the query can be readily ob-

tained.

A process to solve a problem in the ET framework (Fig-

ure 1) is as follows:

1. A problem is given.

2. A declarative description (a set of definite clauses) is

formulated to represent the problem.

3. A ET program (a set of ETRs) are generated automati-

cally and/or manually from the declarative description.

4. A query part is transformed equivalently and repeat-

edly using the ET program.

5. The answer is obtained from the query part which is

transformed.

3.2. Syntax of ETRs

An Equivalent Transformation Rule (ETR) is of the

form:

Hs ?Gs?

→?Es1? Bs1;

...

→?Esn? Bsn.

where n ≥0.

Page 3

Description?

D + Q? 0?

Program?

(ETRs)?

Description?

D + Q? 1?

Description?

D + Q? n?

Problem?

Formulation?

Generation?

Equivarent Transformation?

Equivarent Transformation?

Equivarent Transformation?

Rewriting?

Rewriting?

Answer?

Extraction from Qn?

Figure 1. Problem-solving in ET framework

A set of atoms Hs and Gs are called a head part and a condi-

tion part of a ETR, respectively. A set of deterministic pro-

cedures Esiand atoms Bsi(where 0 ≤i ≤n) are called an

execution part and a replacement part, respectively. A pair

of an execution part and a replacement part is called a body

part. Gs and Esican be omitted if they are unnecessary.

If Hs is a singleton set (contains exactly one element)

the ETR is called a single-head ETR, otherwise it is called

a multi-head ETR.

An ETR may have zero or more body parts. A ETR with

more than one body parts (n ≥ 2) is called a multi-body

ETR. A multi-body ETR is one of the most important dif-

ferences between ETRs and CHRs.

Example 1. (single-head ETRs)

Single-head ETRs for finding a greatest common divisor

(GCD) of two numbers using the Euclidean algorithm are

as follows:

(r1) gcd(A,0,X) →?X=A?.

(r2) gcg(A,B,X) ?B>0? →?C := A mod B? gcd(B,C,X).

These two ETRs clearly describe the algorithm. The rule r1

means that a GCD of any number A and 0 is the number it-

self (A). The rule r2says that a GCD of two numbers A and

B, when B is positive, equals to a GCD of B and a remain-

der C of A divided by B.

Example 2. (multi-head ETR)

A multi-head ETR for the rule of anti-symmetry is as fol-

lows:

lte(X,Y), lte(Y,X) →eq(X,Y).

where lte(X,Y) means that X is less than or equal to Y,

eq(X,Y) means that X equals to Y.

Example 3. (multi-body ETR)

Thefollowing multi-body ETR appends twolist X and Y.The

result will be in Z. [H | T] denotes a non-empty list with a

head element H and a tail list T. This ETR has two body

parts.

append(X,Y,Z)

→?X=[], Y=Z?;

→?Z=[H | T], X=[H | X1]? append(X1,Y,T).

3.3. Applying ETRs

An ETR is said to be applicable to a clause C at a set of

body atoms Bs if its head part is matched (can be unified)

with Bs and all conditions in the condition part of the ETR

is evaluated to true. When a ETR is applied, it rewrites the

clause C into a (possibly empty) set of clauses Cs. For each

body of the ETR, the deterministic procedures in the execu-

tion part are executed first. If they succeed then a new clause

is created from C by replacing Bs with the replacement part

of the body. If the execution part fails, no new clause is cre-

ated from the body. In case of a multi-body ETR, multiple

new clauses are created.

Formally, let R be an ETR of the following form (shown

in Section3.2):

(R) Hs ?Gs?

→?Es1? Bs1;

...

→?Esn? Bsn.

Let C be a clause as follows:

(C) A ←B1 ∪ B2

Let S be a set of all possible substitutions, the ETR R is

applicable to C at B1if there exists a substitution θ∈S such

that Hsθ= B1and all conditions in Gsθare evaluated to true

with a substitution δ∈S . The result of applying R to C is a

set of clauses consisting of the following clauses, for each

i-th body of R,

Aσ←Bsiθδσ ∪ B2σ

3.4. Computation by ETRs

A computation in the ET framework is done by succes-

sively rewriting a query part of a declarative description

which corresponds to a specification of a problem, using

ETRs prepared from a definition part, into a simpler but

equivalent form in which the answer to the query can be

readily obtained.

Page 4

Example 4. Refer to the ETR r1and r2for finding GCD in

the previous section. Let C1be a clause:

(C1)ans(X) ←gcd(18,15,X).

r1is not applicable to C1while r2is applicable and results

in the following clause C2:

(C2)ans(X) ←gcd(15,3,X).

C2is rewritten again by r2into C3:

(C3) ans(X) ←gcd(3,0,X).

r1is applicable to C3while r2is not (the condition part is

false). Applying r1results C4which is the answer:

(C4) ans(3) ←.

Example 5. Consider a problem to find A, B and C which

satisfy C ≤A, A ≤B and B ≤C. This problem can be formu-

lated as a description with a definition part D and a query

part Q as follows:

D = {m ≤n ← | m ∈N , n ∈N , m ≤n} ∪

{m = m ← | m ∈N }

where N is a set of natural numbers.

Q = {ans(A,B,C)←C≤A, A≤B, B ≤C}

In order to solve this problem, the following three rules

describing reflexivity, anti-symmetry and transitivity, re-

spectively, are introduced.

(r5) reflexivity

X≤X→.

(r6) anti-symmetry

X≤Y,Y≤X →X=Y.

(r7) transitivity

X≤Y,Y≤Z →X≤Y,Y≤Z,X≤Z.

The reflexivity rule means that an atom X ≤X can be

eliminated from any clause without changing its semantic

meaning. The anti-symmetry rule is a multi-head rule which

means a set of the atoms {X ≤Y, Y ≤X} can be simplified

into an equality of X and Y. The transitivity rule is also a

multi-head rule. It means that a set of the atoms {X ≤Y, Y

≤Z} causes an introduction of a new atom X ≤Z.

In addition, the following rules are generated from the

description part D:

(r8) X≤Y →?X≤Y?.

(r9) X=Y →?X=Y?.

The query part is transformed by the above ETRs as fol-

lows:

ans(A,B,C)←C≤A,A≤B,B≤C.

ans(A,B,C)←C≤A,A≤B, C≤B,B≤C. by(r7)

ans(A,B,C)←B≤A,A≤B,C=B.

ans(A,B,B)←B≤A,A≤B.

ans(A,B,B)←B=A.

ans(A,A,A)←.

by(r6)

by(r9)

by(r6)

by(r9)

This result means that only A = B = C satisfies C ≤A, A ≤B

and B ≤C.

4. Program and Specification

4.1. Problem-Solving in Logic Programming and

CHR

In the logic programming[5], a program specification

and a program itself are not distinguished. A program spec-

ification is written using logical formulas which are also

used as a program. Thus writing a program specification

and writing a program is done simultaneously and become

the same task. For example a CHR specification written us-

ing logical formulas also become a CHR program.

Althoughregardingaprogramspecificationasaprogram

may look promising, it has many disadvantages. For ex-

ample, multiple programs cannot be written to solve the

same problem specified by a program specification. Mak-

ing change to a program means making change to a pro-

gram specification (Figure 2).

Moreover, its expressive power can be limited because a

program is limited to contain only logical formulas. For ex-

ample, cut or variable which are extra-logical cannot be

used in a program. Otherwise correctness of a program is

hard to be guaranteed.

In the ET framework, it is possible (and desirable) to im-

prove a program without changing its program specifica-

tion, because a program and its specification are clearly sep-

arated. A program can be improved by simply adding more

efficient but correct ETRs to the program (Figure 3).

4.2. Program and Specification

The concept of a program specification should be defi-

nitely separated from that of a program, because a program

specification is associated with declarative semantics, while

a program is associated with operational semantics. A pro-

gram specification should provide an enough detailed de-

scription of a problem from which a program can be con-

structed.

Separating programs and program specifications has two

significant advantages as well as multiple programs for sin-

gle program specification. One is that extra-logical proce-

dures which make programs efficient can be used in pro-

grams. Correctness of programs is verified by their program

specifications, even if extra-logical procedures are used in

the programs. Another is that various control strategies of

program execution can be employed because they are in-

dependent from correctness of programs. Proper control

strategies can improve execution of programs.

Page 5

Formulation?

Specification 0?

Problem?

Program 0?

Program 1?

Program N?

Specification 1?

Specification N?

Improvement?

Improvement?

Modification?

Identical to?

Modification?

Improvement?Modification?

Figure 2. Program Improvement in Logic Pro-

gramming

5. Correctness of ETRs

5.1. Meaning of Declarative Descriptions

Let G be a set of all ground atoms. Let head(C) denotes

the head atoms and body(C) denotes a set of body atoms

of a clause C. Let Gclause(P) denote a set of all ground in-

stances of the clauses in a declarative description P. Define

a mapping TP: 2G→ 2Gfor any set x of ground atoms as

follows:

TP(x)

def

= {head(C) | body(C)⊆ x, C ∈Gclause(P)}.

The meaning of a declarative description P, denoted by

M(P), is defined as follows:

M(P)

where ∅

[TP]n(∅) = TP([TP]n−1(∅)) for each n > 1.

Informally speaking, let S be a set of all possible substi-

tutions, the meaning M(P) of a description P can be com-

puted by:

def

=

?∞

is the empty set, [TP]1(∅)

n=1[TP]n(∅).

=

TP(∅) and

• For a unit clause(A←) in P and a substitution θ∈S ,

Aθ∈M(P) if Aθ is ground.

• For a non-unit clause(A←B) in P and a substitution

θ∈S, Aθ∈M(P) if Aθ is ground and Bθ⊆M(P).

5.2. Correctness of ETRs

The ET framework enables a development of a solid the-

oretical basis for determining the correctness of rewriting

Specification?

(Description)?

Problem?

Program 0?

(ETRs 0)?

Program 1?

(ETRs 1)?

Program N?

(ETRs N)?

Formulation?

Improvement?

Improvement?

Generation?

Improvement?

Figure 3. Program Improvement in ET frame-

work

rules of various kinds. As long as correct rewriting rules are

used throughout a transformation process, a correct compu-

tation is always obtained.

A rewriting rule is correct, if and only if its application

always results in a correct transformation step. Let D and Q

∪ {C} be a definition part and a query part of a declarative

description P. A rewriting rule R which rewrites C into a set

of clauses {C1,..., Cn} is correct iff M(D ∪ Q ∪ {C}) =

M(D ∪ Q ∪ {C1,..., Cn}).

A correct rewriting rule will be referred to as an ETR. If

all rules employed in computation are ETRs, it can be eas-

ily seen that the answers obtained by the ETRs are guaran-

teed to be correct.

6. Comparison of CHRs with ETRs

6.1. Translating CHRs into ETRs

The three kinds of CHRs can be translated into three

ETRs using the following method.

Let CHR1, CHR2and CHR3be a simplification CHR, a

propagation CHR and a simpagation CHR which are of the

forms:

Simplification:

(CHR1) X1,...,Xi<=> Z1,...,Zj| Y1,...,Yk

Propagation:

(CHR2) X1,...,Xi==> Z1,...,Zj| Y1,...,Yk

Simpagation:

(CHR3) X1,...,Xl\ Xl+1,...,Xi

<=>Z1,...,Zj| Y1,...,Yk

Page 6

where i > 0,j ≥ 0, k ≥ 0, 0 < l < i.

CHR1, CHR2and CHR3can be translated into the fol-

lowing ETR1, ETR2and ETR3:

(ETR1) X1,...,Xi?Z1,...,Zj?

→Y1,...,Yk.

(ETR2) X1,...,Xi?Z1,...,Zj?

→X1,...,Xi,Y1,...,Yk.

(ETR3) X1,...,Xl, Xl+1,...,Xi?Z1,...,Zj?

→Xl+1,...,Xi,Y1,...,Yk.

where ?Z1,...,Zj? is a procedure that applies a substitution

θ on Z1,...,Zjsuch that Z1θ,...,Zjθare all true. More pre-

cisely, for any CHR an equivalent ETR can be created by

the following steps:

1. If a CHR rule is a propagation rule or a simpagation

rule, transform it into a simplification rule according to

its abbreviation

2. The head of the CHR rule will be the head of the ETR

3. The guard of the CHR rule will be the condition part

of the ETR

4. The body of the CHR rule will be the replacement part

of the ETR

6.2. Correctness of Translated ETRs

It will be proved that if a given CHR is correct, then an

ETR which is translated from the CHR is also correct. Only

a proof for simplification CHRs is sufficient, because prop-

agation CHRs and simpagation CHRs are abbreviations of

simplification CHRs.

Let ETR1be a ETR which is translated from a CHR sim-

plification rule CHR1in Section6.1. CHR1has the follow-

ing logical meaning F1:

(F1) ∀x∀z(Z1,...,Zj)→(X1,...,Xj↔∃y(Y1,...,Yk)).

where x = Var(X1,...,Xj)

z = Var(Z1,...,Zj) - x

y = Var(Y1,...,Yk) - x - z

Let set R1and R2be a partition of a set of all predicates

R, i.e. R1∪ R2= R and R1∩R2= ∅. Let A1and A2be a

set of all atoms over R1and R2respectively. A clause C is

said to be from Axto Ayif its head atom is in Ayand all its

body atoms are in Ay.

Let P be a description P = D ∪ Q ∪ {C1} where D is a

set of clauses from A1to A1, and Q ∪ {C1,C2} is a set of

clauses form A1to A2.

When ETR1transforms a clause C1into a clause C2,

ETR1is correct if and only if

M(D ∪ Q ∪ {C1}) = M(D ∪ Q ∪ {C2}).

Definition 1. Let C be a clause from (A1 ∪ A2) to A2.

Let head(C) and const(C) denote the head atom of C and

the constant (ground) body atoms of C respectively. Let

Gclause(P) denote a set of all ground instances of clauses

in P. Let S be a set of all substitutions. Let D and M(D) be

a declarative description and its logical meaning[1]. The

meaning of the clause C, denoted by M(C), is defined by1

M(C)def

Cσ∈Gclause({C}),

const(Cσ) ⊆M(D)}.

Theorem 1. If M(C1) = M(C2) then M(D ∪ Q ∪ {C1})

= M(D ∪ Q ∪ {C2}).

Proof: See [1].

= {head(Cσ) | σ∈S,

Theorem 1 means that to prove the correctness of ETR1

is to prove that the meaning of C1and C2is equal. That is

M(C1)=M(C2) if ETR1rewrites C1into C2.

In order to prove that M(C1)=M(C2), it is sufficient to

prove that M(C1) ⊆M(C2) and M(C1)⊇M(C2).

Assume that C1has the following form:

(C1)

where (B11 ∪ B12) ⊆A1, H ∈A2.

H ←B11∪ B12

Let rep(t) be a set of all ground instances of a term t.

Let X, Y and Z be a set {X1,...,Xi}, {Y1,...,Yk}, and

{Z1,...,Zj} respectively. Assume that ETR1is applicable

to C1at B11by a substitution δ∈S , δ is on x ∪ z, Xδ= B11

and rep(Zδ) ⊆M(D), yielding the following clause C2:

(C2) H←Yδ ∪ B12

Proposition 1. M(C1)⊆M(C2)

Proof: Assume h∈M(C1). There exists a ground substitu-

tion σ∈S such that head(C1σ) = h, C1σ∈Gclause({C1})

and const(C1σ) ⊆M(D).

From the definition of C1, Hσ= h, B11σ⊆M(D) and

B12σ⊆M(D). There exists a substitution δ∈S such that

Xδ= B11, then Xδσ⊆M(D). Since rep(Zδ) ∈M(D),

rep(Zδσ) ⊆M(D).

Let ρ1 ∈S be a substitution that grounds Zδσ. Then

Zδσρ1⊆M(D) and Xδσρ1⊆M(D). It can be safely as-

sumed that C1does not include a variable in y, hence the

substitution δσρ1does not change y.

From the definition of F1, there is a substitution ρ2such

that Yδσρ1ρ2⊆M(D). Let ρ be ρ1ρ2, then Yδσρ⊆M(D).

Since σρ∈S, Hσρ= h, Yδσρ⊆M(D) and B12σρ⊆M(D), h

∈M(C2) is obtained. This means that M(C1) ⊆M(C2). 2

Proposition 2. M(C1)⊇M(C2)

Proof:

Assume h∈M(C2).Then,thereexitsa

1

M(C) is a meaning of a clause C. M(D) is a meaning of a declarative

description D.

Page 7

ground substitution σ∈S such that head(C2σ) = h,

C2σ∈Gclause({C2}) and const(C2σ)⊆M(D). Since Hσ=

h, Yδσ⊆M(D) and rep(Zδσ) ⊆M(D).

Let ρ1 ∈S be a substitution that grounds Zδσ. Then

Zδσρ1⊆M(D) and Yδσρ1⊆M(D).

From the definition of F1, there is a substitution

ρ2 such that Xδσρ1ρ2 ⊆M(D). Let ρ

Xδσρ⊆M(D). Since B11 = Xδ, B11σρ⊆M(D). Since

Hσρ= h, B12σρ⊆M(D), it follows that Hσ= h and

B12σ⊆M(C1). Finally h ∈M(C1) is obtained. This means

that M(C1) ⊇M(C2).

Proposition 3. M(C1) = M(C2)

Proof: Proposition1 and Proposition2.

be ρ1ρ2, then

2

2

The fact “M(C1) = M(C2)” means that the rule ETR1

is correct and that ETRs which are translated from CHR

simplification rules are correct. Since propagation rules and

simpagation rules are special cases of simplification rules,

all ETRs which are translated from CHRs are correct. It

can be concluded that CHRs can be regarded as a subset

of ETRs :

CHR ⊆ETR

6.3. ETRs with Extra-Logical Procedures

Aswementionedpreviously,CHRs donotsupportextra-

logical features as well as multi-body rules. Both of these

are supported by ETRs. Thus it is obvious that there exist

some ETRs which are not CHRs.

Example 6. extra-logical

Consider a unification used in logic programming. It can be

expressed by the following ETR rule:

unify(X,Y)?var(X),not occurs in(X,Y)?

→bind(X,Y).

This rule says that a unification of X and Y can be ex-

ecuted when an atom matches unify(X,Y) and satisfy the

condition part, i.e. X is a variable and X does not occur in

Y. This ETR can be translated into the following CHR by

reversing the translation process described in the previous

section.

unify(X,Y)<==>var(X), not occurs in(X,Y)

| bind(X,Y).

This is not a correct CHR because it is not a logical for-

mula. The reasons are followings:

1. The guard contains “var” and “not occurs in” which

are not predicates but extra-logical predicates,

2. The body atom bind(X,Y) is not a logical formula, but

a procedure that binds X to Y.

A multi-body ETR also can not be expressed as a CHR.

Since there are correct ETRs which correspond to no CHRs,

it can be conclude that:

CHR ?= ETR

7. Conclusion

A method for translation of CHRs into ETRs is pre-

sented. It has been proved that the resulting ETRs are in-

deed correct with respect to the logical formula satisfied by

CHRs. An example of a correct ETR which is not CHR has

also been presented.

Hence, the set of all CHRs can be regarded as a proper

subset of the set of all ETRs, which is expressed as:

CHR ⊂

It can be concluded that the equivalent transformation

framework has higher expressive power than one of CHR

which still having the same advantage of guaranteed cor-

rect computation.

?=ETR

References

[1] Akama, K. et al., Solving Problems by Equivalent Transfor-

mation of Declarative Programs, J. Japanese Society for Arti-

ficial Intelligence, 13: 944–952, 1998.

[2] Akama, K. et al., A Theoretical Foundation of Program Syn-

thesis by Equivalent Transformation, Lecture Notes in Com-

puter Science, 2244: 131–139, Springer Verlag, 2001.

[3] Akama,K.etal.,EquivalentTransformationforMemberCon-

straints on Term Domain, J. Japanese Society for Artificial In-

telligence, 13-2: 274–282, 1998.

[4] Akama, K. et al., Semantics for Declarative Descriptions with

Referential Constraints, Proc. of International Conference on

Computing and Information Technologies, 405–410, 2001.

[5] Loyd,J.W., Foundations of Logic Programming, Springer-

Verlag, 1987.

[6] Jaffar, J. et al., The semantics of Constraint Logic Programs,

J. of Logic Programming, 37: 1–46, 1998.

[7] Hudak, P., Conception, Evolution and Application of Func-

tional Programming Languages, ACM Computing Surveys,

21(3):359–411, 1989.

[8] Hanus, M., The Integration of Functions into Logic Program-

ming: From Theory to Practice, J. of Logic Programming,

19,20: 583–628, 1994.

[9] Fruhwirsh, T., Theory and Practice of Constraint Handling

Rules, J. of Logic Programming, 37: 95–138, 1998.