• Aucun résultat trouvé

Abstract Rewriting

N/A
N/A
Protected

Academic year: 2022

Partager "Abstract Rewriting"

Copied!
16
0
0

Texte intégral

(1)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Abstract Rewriting

(2)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Formal definition of rewriting

Given a set ofobjectsA, an (abstract) rewriting system is arelationR ⊆A×A.

Example

LetAbe the set of finite sequences over{◦,•,•}. LetRbe the rewriting system given by the three rules{◦•7→•◦,•• 7→••,•◦ 7→ ◦•}. We consider the rewriting predicate t→u(which reads“trewrites tou”), obtained by applying one of the rules ofRto some subsequence oft. Thus for example,

◦•• ◦ •• ◦ ••

• ◦ • ◦ •• ◦ ••

• ◦ •• ◦ • ◦ ••

• ◦ •• ◦ • ◦ ••

• • • ◦ ◦ ◦ • • •

(3)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Closure notions

s→+Rtis the transitive closure of→R:

s→+Rtiffs=s0R s1R . . .→R sn=tforn≥1.

=Ris the reflexive closure: s→=Rtiffs=tors→R t.

Ris the reflexive transitive closure of→R:

s→Rtiffs=s0R s1R . . .→R sn=tforn≥0.

nRmeansn-reductions steps:

s→nRtiffs=s0R s1R . . .→R sn=tforn≥0.

The objects=s0R s1R . . .→R sn=t(forn≥0) is called anR-rewrite sequence.

Ris the symmetrique closure:

s↔Rtiffs→R tort→R s.

Ris the reflexive, symetrique and transitive closure:

s↔Rtiffs=s0Rs1R. . .↔R sn=tforn≥0.

(4)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

More basic vocabulary

A termtisR-reducibleiff there existsss.t.t→R s. A termtisinR-normal formifftis noR-reducible.

A termsisaR-normal form oftifft→R sandsis inR-normal form.

The symbol7→is used to denote rewriting rules, while→denotes the rewriting predicate.

(5)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Different meaning for equivalent terms

Given

R=









f(x,x) 7→ c

a 7→ b

f(x,b) 7→ d

we can compute from the same termf(a,a)two different normal-formscandd.

(6)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Same meaning for equivalent terms

RisChurch-Rosser (CR)iff for allu,vsuch thatu↔Rv, there existsssuch that u→Rsandv→R s. Graphically,

u ↔

R

v

&

∗R ∗R

.

s

(7)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Confluence diagrams

A diagram like:

t R1 u

R2 R3

v R4 s

reads:

for allt,u,vsuch thattR1uandtR2v, there existssuch thatuR3sandvR4 s.

(8)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Confluence notions

Risconfluent (C)iff

t →R u

∗R∗R

v →R s

Rislocally confluent (LC)iff

t →R u

R∗R

v →R s

Risstrongly confluent (SC)iff

t →R u

R∗R

v →=R s

Rhas thediamond property (DP)iff

t →R u

RR

v →R s

This is a particular case of strongly confluence.

(9)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Equivalent notions

Theorem

RisChurch-RosseriffRisconfluent.

Proof.

On blackboard.

(10)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Sufficient conditions

Theorem

Rhas thediamond propertyimpliesRisconfluent.

Proof.

On blackboard.

(11)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Non-equivalent notions

The following system [Curry]:

R=













c 7→ a

c 7→ d

d 7→ c

d 7→ b

islocally confluentbut notconfluent:

a←c→b

(12)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Termination notions

TheelementsisR-weakly normalising (WN)iffshas at least one normal form.

TheelementsisR- strongly normalising (SN)iff there is no infinite sequence

s=s0R s1R . . .iff everyR-reduction sequence starting atsis finite. We note

s∈S NS.

ThesystemRis weakly normalising (WN)iff every element is WN.

ThesystemRterminatesor isstrongly normalising (SN)ornoetherienor well-founded (WF)iff every elementsis SN.

(13)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Weak vs strong normalisation

R=

( f(a) 7→ c f(x) 7→ f(a) The system is weakly normalising but not strongly normalising:

f(b)→ f(a)→c

f(b)→ f(a)→ f(a). . .

(14)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Convergent Systems

Definition

ThesystemRisconvergentiff it is confluent and strongly normalising.

Remark

IfRis confluent, then every element hasat most a normal form.

IfRis convergent, then every element hasone and only one normal form. In this case, we use thefunctionalnotationR(t)to denote theR-normal form oft.

(15)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Confluence from local confluence

Lemma

(Newmann)LetRbe aSNsystem. ThenRis locally confluent iffRis confluent.

Proof.

(By Huet) By well-founded induction ons∈S N.

s → t1 tn

↓ LC ↓

u1 v t1<s ↓

u1<s ↓

um w → p

(16)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Important remark

The following (infinite) system on natural numbers:

R=













2.n 7→ 2.n+1

2.n 7→ a

2.m+1 7→ 2.m+2 2.m+1 7→ b islocally confluentbut notconfluent:a←0→b In fact it is not SN

0→ 1→ 2→ 3→ . . .

Références

Documents relatifs

Delia Kesner (Université Paris Diderot) Logique 2016 1 / 6.. Modalités

Delia Kesner et Giovanni Bernardi IRIF, Université Paris-Diderot. Emails : [email protected]

dénitions inductives, principe d'induction bien fondée, preuves par induction, ordres bien fondés.. Calcul

dénitions inductives, principe d'induction bien fondée, preuves par induction, ordres bien fondés.. Calcul

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner.. S ´emantique des langages

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner.. The Untyped

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner.. Typed

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner.. Term Algebras and