Term rewriting in partial algebras Norbert Dojer 20.06.2014 Term - - PowerPoint PPT Presentation

term rewriting in partial algebras
SMART_READER_LITE
LIVE PREVIEW

Term rewriting in partial algebras Norbert Dojer 20.06.2014 Term - - PowerPoint PPT Presentation

Term rewriting in partial algebras Norbert Dojer 20.06.2014 Term rewriting motivating example How to check whether two polynomial expressions are equal? ? ( x + 1) 2 x ( x + 2)( x 1) + 3 = = x 2 + 2 x


slide-1
SLIDE 1

Term rewriting in partial algebras

Norbert Dojer 20.06.2014

slide-2
SLIDE 2

Term rewriting – motivating example

How to check whether two polynomial expressions are equal? (x + 2)(x − 1) + 3

?

= = (x + 1)2 − x  

  • x(x − 1) + 2(x − 1) + 3

x2 + 2x + 1 − x  

  • x2 − x + 2x − 2 + 3

− − − − → x2 + x − 1 Generally:

◮ each class of equivalent expressions contains a unique normal

form

◮ normal form is calculated by reducing expressions (rewriting) ◮ rewriting rules are derived from equational axioms

slide-3
SLIDE 3

Abstract reduction system (ARS)

ARS is a pair (X, − →), where − →⊆ X 2

◮ ∗

← → is an equivalence relation defined by − →, i.e. symmetric-reflexive-transitive closure of − →

◮ ∗

− → is a reflexive-transitive closure of − →

◮ x is reducible iff ∃yx−

→y

◮ y is a normal form of x (y = x↓) iff x ∗

− → y and y is irreducible

◮ x and y are joinable (x ↓ y) iff ∃zx ∗

− → z

← − y

slide-4
SLIDE 4

ARS – properties

ARS is:

◮ terminating iff there is no infinite reduction sequence

x1− →x2− →x3− → . . .

◮ confluent iff ∀x,y,zx ∗

← − z

− → y = ⇒ x ↓ y

◮ locally confluent iff ∀x,y,zx←

−z− →y = ⇒ x ↓ y

Theorem

Let (X, − →) be an ARS. Then:

  • 1. If (X, −

→) is terminating, each x ∈ X contains a normal form that is computable with a finite number of reductions.

  • 2. If (X, −

→) is confluent, each equivalence class of

← → contains at most one normal form.

  • 3. If (X, −

→) is terminating, it is confluent iff it is locally confluent.

slide-5
SLIDE 5

Term rewriting system (TRS)

TRS is a set R of rewriting rules l → r for l, r ∈ TF(X) TRS R defines an ARS (TF(X), − →R), where − →R is a closure of R under substitutions and operation compatibility. TRS R is terminating, (locally) confluent iff (TF(X), − →R) does, respectively.

Theorem

Let R be a (locally) confluent and terminating TRS. Then:

  • 1. Every term t ∈ TF(X) has a unique normal form t↓R that is

computable with a finite number of reductions.

  • 2. For all t, s ∈ TF(X)

(t ≈ s) ∈ Th(Eq(R)) ⇐ ⇒ t↓R= s↓R where Eq(R) = { (l ≈ r) | (l → r) ∈ R }.

slide-6
SLIDE 6

TRS – criteria for termination

Definition A well-founded order on the set of terms, closed under substitutions and compatible with operations is called reduction order.

Theorem

A TRS R is terminating iff R ⊆> for some reduction order .

slide-7
SLIDE 7

TRS – criteria for confluence

Definition Assume that two rules l → r and l′ → r′ have overlapping left-hand sides, i.e. terms l|ω and l′ are unifiable for some non-variable position ω in l. The term σ(l), where σ is a most general unifier of l|ω and l′, may be reduced to:

◮ σ(r) with rule l → r ◮ σ(l[ω ←

֓ r′]) with rule l′ → r′ The pair of terms (σ(r), σ(l[ω ← ֓ r′])) is called critical pair of rules l → r and l′ → r′.

Critical Pair Lemma

TRS is locally confluent iff all its critical pairs are joinable.

slide-8
SLIDE 8

Equations in partial algebras

Does an equation hold in an algebra when one or both sides are undefined for some valuations? existence equation: for all valuations both sides must be defined and equal Existential equational theories are

◮ partial equivalence relations on the set of terms, ◮ closed under substitutions of terms from their domains, ◮ compatible with operations (on their domains).

slide-9
SLIDE 9

Existential equational theories

Theorem (Burmeister ’86)

A set of equations forms an existential equational theory if and

  • nly if it is closed under the following inference rules:

⊢ x ≈ x if x is a variable t ≈ t′ ⊢ t ≈ t t ≈ t′ ⊢ t′ ≈ t t ≈ t′ , t′ ≈ t′′ ⊢ t ≈ t′′ f (t1, . . . , tn) ≈ f (t1, . . . , tn) ⊢ ti ≈ ti if i ∈ {1, . . . , n}

  • ti ≈ t′

i

  • 1in , f (t1, . . . , tn) ≈ f (t1, . . . , tn)

⊢ f (t1, . . . , tn) ≈ f (t′

1, . . . , t′ n)

t ≈ t′ ,

  • σ(x) ≈ σ(x)
  • x∈Var(t,t′)

⊢ σ(t) ≈ σ(t′)

slide-10
SLIDE 10

Partial reduction system (PRedS)

PRedS is a triple (X, − →, N), where (X, − →) is an ARS and N ⊆ X. XN =

  • x∈N

[x]

← →

– subset of X indicated by N

N

← → =

← → ∩ (XN)2 – partial equivalence relation defined by PRedS (X, − →, N) PRedS (X, − →, N) is:

◮ terminating iff (X, −

→) is terminating

◮ (locally) confluent iff (XN, −

→) is (locally) confluent

◮ reduced iff for all x ∈ N if x ∗

− → x′ then x′

− → x′′ for some x′′ ∈ N

slide-11
SLIDE 11

Partial reduction systems

Definition PRedS (X, − →, N) presents partial equivalence relation

N

← → iff the following conditions are satisfied:

  • 1. Every x ∈ X has a normal form that is computable with a

finite number of reductions.

  • 2. Every x ∈ XN has a unique normal form.
  • 3. For all x, y ∈ X

x

N

← → y ⇐ ⇒ x↓= y↓∈ N

Theorem

Let (X, − →, N) be a terminating, (locally) confluent and reduced

  • PRedS. Then it presents

N

← →.

slide-12
SLIDE 12

Partial rewriting system (PRS)

PRS is a pair (R, D), where R is a set of rewriting rules and D is a set of terms. PRS (R, D) defines PRedS (TF(X), − →(R,D), ND), where:

◮ ND is a set of all terms ,,composed” of D-terms and variables ◮ −

→(R,D) is the closure of R-rules under substitutions of ND-terms and compatibility with operations PRS (R, D) is terminating, (locally) confluent, reduced iff (TF(X), − →(R,D), ND) does, respectively. PRS (R, D) presents

ND

← →(R,D) iff (TF(X), − →(R,D), ND) does.

slide-13
SLIDE 13

PRSs and existential equational theories

Definition PRS (R, D) is subterm-closed iff a subset of TF(X) indicated by ND is subterm-closed.

Theorem

A PRS (R, D) is subterm-closed iff

ND

← →(R,D) is existential equational theory.

slide-14
SLIDE 14

PRSs and existential equational theories

Definition PRS (R, D) is existential iff a subset of TF(X) indicated by ND contains all terms from R-rules.

Theorem

A PRS (R, D) is subterm-closed and existential iff

ND

← →(R,D) = ThE(Eq(R, D)), where Eq(R, D) = { (l ≈ r) | (l → r) ∈ R } ∪ { (d ≈ d) | d ∈ D }

slide-15
SLIDE 15

PRS – presenting equational theories

Definition PRS (R, D) presents existential equational theory E iff the corresponding PRedS does.

Corollary

If PRS (R, D) is terminating, (locally) confluent, reduced, subterm-closed and existential, then it presents the existential equational theory ThE(Eq(R, D)).

slide-16
SLIDE 16

PRS – criteria for presenting equational theory

Definition Assume that a term d overlaps with a left-hand side of a rule l → r, i.e. terms d|ω and l are unifiable for some non-variable position ω in d. Then the term σ(d[ω ← ֓ r]), where σ is a most general unifier of d|ω and l, is called critical term of d and (l → r).

Theorem

A terminating (R, D) presents ThE(Eq(R, D)) iff the following conditions are satisfied:

  • 1. ∀(p,q)∈CP(R) p↓(R,D)= q↓(R,D)
  • 2. ∀(l→r)∈R r↓(R,D)∈ ND
  • 3. ∀(f (l1,...,ln)→r)∈R∀i∈{1,...,n} li↓(R,D)∈ ND
  • 4. ∀f (d1,...,dn)∈D∀i∈{1,...,n} di↓(R,D)∈ ND
  • 5. ∀t∈CT(R,D) t↓(R,D)∈ ND