Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
On Data-Structure Rewriting
Rachid EchahedLIG Lab, Grenoble
France
June, 2010
Rewriting (reminder)
I A rewrite relation R is a binary relation
R ⊆ A× A
I (u, v) ∈ R is read “u rewrites into v ” and written
u → v
Rewriting (reminder)
R ⊆ A× A
I A = set of strings over a vocabulary (V ∗)I A = set of states of the form (variables, valuation)I A = set of Turing Machine configurationsI A = set of lambda-termsI A = set of trees (or terms)I A = set of clausesI A = set of process termsI A = . . .
Rewriting
R ⊆ A× A
I How to define a rewrite relation R?I How to define a run or the execution of a program?
I A rewrite derivation : u0 is the initial “call”
u0 → u1 → . . .→ un
I A narrowing derivation :w0 is the initial goal (to solve):
w0 σ1 w1 . . . σn wn
Where
wi σ wi+1 iff σ(wi )→ wi+1
wi is an element of A with partial informationσ instantiates wi
Motivation : Extension of Term Rewriting ; sharingsubterms
Function definitions by means of term rewrite rules
0 + x → xsucc(x) + y → succ(x + y)double(x) → x + x
Very well established domain with several results : Confluence,Termination, Strategies, Proof methods (equational reasoning,induction) etc.
double(x) // +
x
doublet
//+
t
Sharing Subterms (information) and Term Rewriting
Consider the following rules:
f (a,b) → ca → b
Sharing does not preserve properties of tree (term) rewriting !
f (a,a)→ f (a,b)→ c
f a
// f b
6→
[Plump 99] survey on rewriting with “dags”.
Motivation (continued)
I Data-structure rewritingincluding cyclic data-structures with pointerssuch as circular lists, doubly-linked lists, etc.
I Data-structures are more complex than terms (Cycles,Sharing)
I Difficult to encode efficiently using termsI Usually described by pointers (⇒ pointer rewriting)I Formally described as term-graphs
term-graphs = terms with cycles and sharing
Term-graphs[Barendregt et al. 87][Plump 99, survey on acyclic term-graphs]
Let Ω be a set of operation symbols.A term-graph t over Ω is defined by:
I a set of nodes Nt ,I a subset of labeled nodes NΩ
t ⊆ Nt ,I a labeling function Lt : NΩ
t → Ω,I a successor function St : NΩ
t → N∗t ,
1 : f1
~~~~~~~~2
3
2 : b 3 : g
12
4 : • 5 : h
1
gg
Term-graphs
[Barendregt et al. 87][Plump 99, survey on acyclic term-graphs]
Let Ω be a set of operation symbols and F a set of featuresymbols.A term-graph t over Ω and F is defined by:
I a set of nodes Nt ,I a set of edges Et
I a subset of labeled nodes NΩt ⊆ Nt ,
I a node labeling function Lnt : NΩ
t → Ω,I an edge labeling function Le
t : Et → FI a source function St : Et → Nt ,I a target function Tt : Et → Nt ,
(Term-)Graph Rewriting
I Which graphs? (Term-Graphs)I Which rules?I Which rewrite relation?
Two main approachesI Algorithmic approachesI Algebraic approaches (DPO,SPO, . . .)
Graph Transformation
I Handbook of Graph Grammars and Computing by GraphTransformation (World Scientific)
I Vol 1: Foundations, ed. G. Rozenberg, 1997I Vol 2: Applications, Languages and Tools
eds. H. Ehrig, G. Engels, H.-J. Kreowski and G.Rozenberg, 1999
I Vol 3: Concurrency, Parallelism and Distributioneds. H. Ehrig, H.-J. Kreowski, U. Montanari and G.Rozenberg, 1999
I A Monograph in Theoretical Computer Science (An EATCSseries)H. Ehrig, K. Ehrig, U. Prange, G. Taentzer: Fundamentalsof Algebraic Graph Transformation. Springer-Verlag, 2006
Outline
Introduction
Motivations
Termgraph Rewrite Systems
Confluence and Rewrite Strategies
Narrowing
A Modal Logic for Graph Transformation
Conclusion
Algorithmic approach[Barendregt et al. 87]Shape of a rule:
L→ R
where L and R are rooted term-graphs.A rule can be defined as one graph together with two roots
(L + R, r1, r2)
where r1 and r2 are the roots of L and R respectivelyLet ρ be the rule (L + R, r1, r2)We say that G rewrites to H using the rule ρ if
I L matches a subgraph of G (h : L→ G |n)
I (build phase) Construct graph G1 = G + h(R)
I (redirection phase) G2 = [h(r1) h(r2)]G1
I (garbage collection phase) H = G2 |rootA cumbersome definition, hard to deal with in practice!
Rewrite Rules with actions
Shape of a rewrite rule :
[L | C]→ R
I L is a term-graph patternI C is a node constraint,
∧ni=1(αi 6≈ βi).
I R is a sequence of actions a1; a2; . . . ; an
Actions
We consider three kinds of actions :I Node definition α : f (α1, . . . , αn)
I Edge redirection αi β
I Global redirection α β
Application of actions
a[t ] denotes the application of action(s) a on the term-graph tI Let t = n : f (p,q :a)
n : f1
2
=======
p q :a
I Let t1 = p :h(p)[t ] = n : f (p :h(p),q : a)
n : f1
2
<<<<<<<
p :h
1
KKq :a
Application of actionsa[t ] denotes the application of action(s) a on the term-graph t
I Let t1 = p :h(p)[t ] = n : f (p :h(p),q : a)
n : f1
2
<<<<<<<
p :h
1
KKq :a
I Let t2 = n2 p[t1] = n : f (p :h(p),p); q : a
n : f1
2uup :h
1
KKq :a
Application of actions
a[t ] denotes the application of action(s) a on the term-graph tI Let t2 = n2 p[t1] = n : f (p :h(p),p); q : a
n : f1
2uup :h
1
KKq :a
I Let t3 = p q[t2] = n : f (q,q); p :h(q)
n : f
1 <<<<<<< 2
p :h 1 // q :a
Rewrite Step
Let t be a term-graph
Let ρ be a rewrite rule [L | C]→ R
t rewrite to s at node α, t →α s iff:
I ∃m : L→ t a homomorphism (ρ-matcher)I m(rootL) = α
I α is reachable from roottI m(C) holdsI s = m(R)[t ]
Term-Graph Rewrite Systems (tGRS)–Example–
Length of a circular list :
r : length(p)→ r : length′(p,p)
r : length′(p1 : cons(n,p2),p2)→ r : s(0)
[r : length′(p1 : cons(n,p2),p3) | p2 6≈ p3]→ r : s(q); q :length′(p2,p3)
Remark: term rewrite systems are tGRS’s.
Term-Graph Rewrite Systems–Example–
In-situ list reversal :
o : reverse(p)→ o : rev(p,nil)
o : rev(p1 : cons(n,nil),p2)→ p1 2 p2; o p1
o : rev(p1 : cons(n,p2 : cons(m,p3),p4)→ p1 2 p4; o 1p2; o 2 p1Visual Programming would help!
DPO approach of rewrite rules with actions
A categorical approach can be found in [TERMGRAPH 06,ENTCS07, RTA07]
L
m
Kloo
d
r // R
m′
G D
l ′oo r ′// H
Figure: Double pushout: a rewrite step (G→ H)
Redirections of edges (pointers) are handled byK = disconnection(L,E ,N) and the morphisms l and r .Remark: Morphisms l and r are not injective! D is not unique!
Confluence
f (x)→ xg(x)→ x
The following term-graph
n : f
q :g
aa
rewrites ton : f
q :g
Confluence
α : f (β : c)→ β : a;α β
α : g(β : c)→ β : b;α β
p : f
<<<<<<<q :g
q :c
The label of node q may end as q : a or q : b
Computing with non-confluentorthogonal Term-graph Rewrite Systems
How to evaluate the following term-graph ?I addlast(length(n : [1,2]),n)I Two normal forms
I [1,2,2] (evaluate addlast after length)I [1,2,3] (evaluate length after addlast)
Term-graphs with Priority
[PPDP06][RTA07][RTA08]I Endow Term-graphs with priorities (G, <G) to express
which node should be evaluated firstI m1 :addlast(m2 : length(n : [1,2]),n); m1 < m2
I Priorities should not be a total order (stay declarative)I Which nodes should be ordered?I Solution: Order only nodes producing a “side-effect”
Strategies and needed nodes
A strategy φ is a partial function which takes a rootedterm-graph t and returns a node (position) n and a rule R,
φ(t) = (n,R)
such that the term-graph t can be reduced at node n using therule R,
t →n t ′
Needed Nodes
Let φ be a rewrite strategy.Let φ(t) = (p,R).The node p is needed iff for all derivations
t →β1 t1 →β2 . . . tn−1 →βn tn
such that tn is a value, there exists i ∈ [1..n] s.t. βi = p
Inductively sequential Term Rewrite Systems
I Constitute a subclass of TRSs for which efficient rewritestrategies are available [Antoy 92]
I Are as expressive as Strongly Sequential TRSsI Are the basis of modern functional and logic programming
languages.I Are defined by means of data-structures called Definitional
trees
Definitional Trees -case of terms-
Let R be the following TRSf(k,nil) → R1f(0,cons(x,l)) → R2f(succ(n),cons(x,l)) → R3
A definitional tree of operator f is a hierarchical structure whoseleaves are the rules defining f .
f(k, l)f(k, nil)→ R1f(k, cons (x, u))
f(0, cons (x,u))→ R2f(succ(y), cons (x,u))→ R3
Definitional trees-case of term-graphs-
r : length′(p1 : nil ,p2 : •)→ rhs1r : length′(p1 : cons(n : •,p2 : •),p2)→ rhs2[r : length′(p1 : cons(n : •,p2 : •),p3 : •) | p2 6
.= p3]→ rhs3
A definitional tree T of the operation length′ is given bellow:
r : length′(p1 : •,p2 : •)r : length′(p1 : nil ,p2 : •)→ rhs1r : length′(p1 : cons(n : •,p3 : •),p2 : •)
r : length′(p1 : cons(n : •,p2 : •),p2)→ rhs2[r : length′(p1 : cons(n : •,p2 : •),p3 : •) | p2 6
.= p3]→ rhs3
A Rewrite strategy φ
Consider the following definitional tree T of the operation g :
r : g(p1 : •,p2 : •)r : g(p1 : nil ,p2 : •)→ rhs1r : g(p1 : cons(n : •,p3 : •),p2 : •)
r : g(p1 : cons(n : •,p2 : •),p2)→ rhs2[r : g(p1 : cons(n : •,p2 : •),p3 : •) | p2 6
.= p3]→ rhs3
φ(1 : g (2 : g(3 : g(nil ,p),q),4 : g(nil ,o)))= φ(2 : g(3 : g(nil ,p),q))= φ(3 : g(nil ,p))= (3,Rule1)
Naive extension of TRS’s
Contrary to term rewriting, Definitional trees are not enough toensure the neededness of positions computed by the strategyφ, in the context of term-graph rewriting.
Proposition: Let SP = 〈Ω,R〉 be tGRS such that Ω isconstructor-based and the rules of every defined operation arestored in a definitional tree. Let t be a rooted term-graph. Then,
1. if φ(t) = (p,R), the node p is not needed in general.2. if φ(t) is not defined, g can still have a constructor normal
form.
Counter-examples
r : f (p : 0)→ r p r : h(p : 0,q : succ(n : •))→ q pr : f (p : succ(p′ : •))→ r p
Let t = n : succ
r : succ
p : f
q : succ
s : h
__
u : 0
φ(t) = (p, r : f (p : succ(p′ : •))→ r p).However, the node p is not needed in t .
Counter-examples
r : g(p : 0)→ r p r : h(p : 0,q : succ(n : •))→ q p
Let t = n : succ
r : succ
p : g
q : succ
s : h
``
u : 0
φ(t) is not defined!.However, the term-graph t rewrites to n : succ(u : 0).
Inductively Sequential Term-Graph Rewrite Systems
Let SP = 〈Ω,R〉 be a tGRS.SP is called inductively sequential iff
I The rules of every defined operation can be stored in adefinitional tree and
I for all rules [L | C]→ r in R, for all global (respectively,local) redirections of the form p q (respectively, p i qfor some i), occurring in the right-hand side r , p = RootL.
Main Properties of Strategy Φ
In presence of Inductively Sequential Term-Graph RewriteSystems
I The positions computed by Φ are neededI Φ is c-normalizingI Φ is c-hyper-normalizingI Derivations computed by Φ have minimal length
Confluence
Inductively sequential tGRS are not confluent!
f (p : •,p)→ 0[f (p : •,q : •) | p 6= q]→ 1r : g(q : •)→ r q
Let t = n : fzzuuuuu
$$IIIII
p : g // q : 0
There are two different derivations starting from t :
t →n 1t →p f (q : 0,q)→n 0
Admissible term-graphs
[JICSLP98]Ω is contructor-based, i.e. Ω = D ∪ C and D ∩ C = ∅D is a set of defined operationsC is a set of constructors
A term-graph is admissible if none of its cycles includes adefined operation.
n :succ(n) is an admissible term-graphn :+(n,n) and n : tail(n) are not admissible
Admissible term-graphs
The set of admissible term-graphs is not closed under rewriting
n : f (m)→ q :g(n); n m
Let Ω = D ∪ C with C = 0, succ and D = f ,g
n1 : f (m1 :0)→ q1 :g(q1)
Admissible Inductively sequential Term-Graph RewriteSystems
Let SP = 〈Ω,R〉 be an inductively sequential tGRS. SP iscalled admissible iff for all rules [π | C]→ r in R the followingconditions are satisfied
I for all global (respectively, local) redirections of the formp q (respectively, p i q for some i), occurring in theright-hand side r , we have p = Rootπ and q 6= Rootπ.
I for all actions of the form α : f (β1, . . . , βn), for all i ∈ 1..n,βi 6= Rootπ
I the set of actions of the form α : f (β1, . . . , βn), appearing inr , do not construct a cycle including a defined operation.
I Constraint C includes disequations of the form p 6 .= qwhere p and q are labeled by constructor symbols.
Admissible Inductively sequential Term-Graph RewriteSystems
[ICGT08][JICSLP98]In presence of Admissible Inductively sequential Term-GraphRewrite Systems
I The set of admissible term-graphs is closed under therewrite relation defined by admissible rules.
I Φ computes needed positionsI Admissible term-graphs admit unique normal forms
Narrowing
wi σ wi+1 iff σ(wi)→ wi+1
I Rewriting = Matching + TransformationI Narrowing = Unification + Transformation
Narrowing–Motivation–
I Automated deduction [Slagle 74] [Fay 79][Hullot 80]I Functional and Logic Programming [Goguen and
Meseguer 84, ...]I Security verification [Meadows 89, ...]I Reachability Analysis [Meseguer and Thati 05, ...]I ...
Narrowing
Instantiate goal variables and apply a reduction step
0 + X → Xs(X ) + Y → s(X + Y )
U + s(0) = s(s(0)) U 7→s(V ) s(V + s(0)) = s(s(0)) V 7→0 s(s(0)) = s(s(0))
Computed answer: U 7→ s(0)
Some Results
Needed Term narrowing [POPL04][JACM2000](main operational semantics of current functionalogicprogramming languages)Needed Graph Narrowing [JICSLP98]Needed Collapsing Narrowing [Gratra 2000]Narrowing-based algorithm for data-structure rewriting[ICGT06]
I Goalo : equal(p : length(q), s(s(0))) = true
I Solution : a circular list of length two[q : cons(n1, r : cons(n2,q)) | q 6≈ r ]
Narrowing: What do we transform?
Rule
o : f (p : a,q, r) −→ p : b; o 3 q
Rewrite Stepso1,p1,q1 and r1 are constants (names or addresses)
o1 : f (p1 : a,q1 : a, r1) −→ o1 : f (p1 : b,q1 : a,q1)
o1 : f (p1 : a,p1, r1) −→ o1 : f (p1 : b,p1,p1)
Narrowing: What do we transform?
Rule
o : f (p : a,q, r) −→ p : b; o 3 q
Rewrite Steps (o1,p1,q1 and r1 are constants)o1 : f (p1 : a,q1 : a, r1) −→ o1 : f (p1 : b,q1 : a,q1)o1 : f (p1 : a,p1, r1) −→ o1 : f (p1 : b,p1,p1)
Narrowing steps (o2,p2,q2 and r2 are variables)
o2 : f (p2,q2 : a, r2) ?
σ labels node p2 with symbol a.o2 : f (p2,q2 : a, r2) σ o2 : f (p2 : b,q2 : a,q2) | p2 6≈ q2o2 : f (p2,q2 : a, r2) σ∪q2 7→p2 o2 : f (p2 : b,p2,p2)
Narrowing: What do we transform?
Rule
o : f (p : a,q, r) −→ p : b; o 3 q
Narrowing steps(o2,p2,q2 and r2 are variables)
o2 : f (p2,q2 : a, r2) σ [apply(o2 : f (p2 : a,q2 : a, r2),p2 : b; o2 3 q2)] [apply(o2 : f (p2 : a,q2 : a, r2),p2 : b; o2 3 q2) | p2 6≈ q2] [apply(o2 : f (p2 : b,q2 : a, r2),o2 3 q2) | p2 6≈ q2] [apply(o2 : f (p2 : a,q2 : a,q2), ε) | p2 6≈ q2] [o2 : f (p2 : a,q2 : a,q2) | p2 6≈ q2]
Narrowing: What do we transform?
Rule
o : f (p : a,q, r) −→ p : b; o 3 q
Narrowing stepso2,p2,q2 and r2 are variables
o2 : f (p2,q2 : a, r2) σ [apply(o2 : f (p2 : a,q2 : a, r2),p2 : b; o2 3 q2)] q2 7→p2 [apply(o2 : f (p2 : a,p2, r2),p2 : b; o2 3 q2)] [apply(o2 : f (p2 : b,p2, r2),o2 3 q2)] [apply(o2 : f (p2 : b,p2,p2), ε)] o2 : f (p2 : b,p2,p2)
g-terms
Symbolic handling of actionsG is a term-graphφ is a conjunction of disequationsτ is a sequence of actions
[G | φ]
[apply(G, τ) | φ]
Example:[o2 : f (p2 : a,q2 : a,q2) | p2 6≈ q2]
[apply(o2 : f (p2 : b,q2 : a, r2),o2 3 q2) | p2 6≈ q2]
Graph Narrowing Rules
Superposition rule (SUP)
[G | ψ]τ SUP,ρ,θ [H | ψ′]σ(τ)
If:I G is a term-graphI ρ is rewrite rule [L | φ]→ RI σ is a most general unifier of L and G such that:
I σ(L) and σ(G) are compatibleI The root of L unifies with a labeled node in G
(non-variable unification)I H = apply(σ(G) ∪ σ(L), σ(R))
I θ = (σ,K ) with K = σ(L)\σ(G)
I ψ′ = σ(ψ) ∧ σ(φ) ∧∧
p∈affected by(σ(τ)),q∈K Ω p 6 .= q.
Graph Narrowing Rules
Action rule: simplify (SIM)
[apply(G, ε) | ψ]τ SIM [G | ψ]τ
Graph Narrowing Rules
Action rule: execute (EXE)
[apply(G, α.u) | ψ]τ EXE [apply(α[G],u) | ψ′]τ.α
If:I action α is not a node creation andI [G | ψ] is ready for action α.
Graph Narrowing Rules
Action rule: new node (NEW)
[apply(G,n+.u) | ψ]τ NEW ,σ [apply(n+[G], σ(u)) | ψ′]τ.n+
If:I σ = n 7→ n′ where n′ is a fresh effective nodeI ψ′ = ψ ∧
∧p∈V∩NG
(p 6≈ n′)
Graph Narrowing Rules
Isolation rule with equality (EQU)
[apply(G, α.u) | ψ]τ EQU,σ [apply(σ(G), σ(α).σ(u)) | σ(ψ)]σ(τ)
If:I there exists a node n ∈ affected by(α),I m is not an α-isolated node in G andI σ is a substitution (compatible with G) such thatσ(n) = σ(m)
o2 : f (p2,q2 : a, r2) σ [apply(o2 : f (p2 : a,q2 : a, r2),p2 : b; o2 3 q2)] q2 7→p2 [apply(o2 : f (p2 : a,p2, r2),p2 : b; o2 3 q2)]
Graph Narrowing Rules
Isolation rule with disequality (DIS)
[apply(G, α.u) | ψ]τ DIS [apply(G, α.u) | ψ ∧ n 6 .= m]τ
If:I there exists a node n ∈ affected by(α),I m is not an α-isolated node in G
o2 : f (p2,q2 : a, r2) σ [apply(o2 : f (p2 : a,q2 : a, r2),p2 : b; o2 3 q2)] [apply(o2 : f (p2 : a,q2 : a, r2),p2 : b; o2 3 q2) | p2 6≈ q2]
Computed Solutions
[G0 | True] σ1 · · · σn [Gn | φ]
Computed Solution is : (σ1 · · ·σn, φ)
Example:
I Goalo : equal(p : length(q), s(s(0))) = true
I Solution[q : cons(n1, r : cons(n2,q)) | q 6≈ r ]
Graph Narrowing: Soundness and Completeness
Proposition 1: The proposed narrowing rules are sound.If [G | True] σ [H | φ]then there exists a ground substitution θ satisfying φ such that:Gσθ −→∗ Hθ
Proposition 2: The proposed narrowing rules are complete.If Gσ −→∗ H, σ being irreducible.Then, there exist two substitutions θ and γ and a term-graph G′
such that :
I [G | True] ∗θ[G′ | φ]
I γ satifies φI σ = θγ
I G′γ = H
Modal Logic and Graph Transformation– motivations–
I Specify graph shapes (data-structures)I Circular listI Balanced tree
Graph properties can be specified within several logics,such as :
I Separation Logic,I Monadic second order logic,I Modal logics (e.g., LTL, CTL, µ-calculus, etc).
I Verification of graph transformation:I InvariantI Reachability
I Need to define new logics able to specify rule applicationand graph transformation.
Dynamic Logic
I AgentsI KnowledgeI Actions
Evaluate a formula in a model⇒ Transform the consideredmodel
A Modal Logic for Graph Rewriting
I G |= φ
I G!R |= φ where G!R is the normal form of GI G!R |= φ iff G |= [R∗]φ
A Modal Logic for Graph Rewriting : Lgr
LanguageI Formulas :
φ ::= p |⊥| ¬φ | φ ∨ φ | [α]φ
I Actions :
α ::= a | α∗ | α;α | α ∨ α | modifiers.
[α]Φ :“After performing” actions α, formula Φ holds.
Modifiers
I Add a new nodeI Add a new label (to current node)I remove a label from the current nodeI Add the label “a” to the edges going from a Φ-node to a
Ψ-node.I . . .
I Graph modifiers :I UI nI ~nI φ?I (ω :=g φ)I (ω :=l φ)I (a + (φ, ψ))I (a− (φ, ψ))
Modifiers–Example–
[p :=g⊥][p :=l >](p ∧ [a](¬p ∧ q))
p
a
a // p,q
q
⇒ •
a
a // q
q
⇒ p
a
a // q
q
Modal Logic: Lgr
Semantics (informally)
I Gr |= piff p holds at node r
I Gr |= [a]ϕ
iff Gn |= ϕ for all nodes n such that the edge r a→ n ∈ G.
I Gr |= [ω :=g ⊥][ω :=l >] ϕiff H r |= ϕ, H is obtained from G by tagging the node r by ω(ω does not hold outside node r ).
Modal Logic: Lgr
Semantics
I Gr |= [a− (φ, ψ)]ϕiff H r |= ϕ, H is obtained from G by erasing the edgesn a→ m, such that Gn |= φ and Gm |= ψ.
I Gr |= [a + (φ, ψ)]ϕiff H r |= ϕ, H is obtained from G by adding the edgesn a→ m, such that Gn |= φ and Gm |= ψ.
I Gr |= [f ?]ϕiff Gr |= ϕ and f holds at node r .
I Gr |= [ ~nw ]ϕiff Hnw |= ϕ. H is obtained from G by adding a new nodenw .
Examples of Lgr Specified Properties
I Class of all a-cycle-free rooted termgraphs.[ω :=g >][U][ω :=l ⊥][a+]ω
I Class of all a-circular rooted termgraphs[ω :=g ⊥][U][ω :=l >]〈a+〉ω.
I Class of all (a,b)-binary rooted termgraphs[ω :=g ⊥][U][ω :=l >][a][π :=g >][(a ∪ b)?][π :=l⊥][U](ω → [b][(a ∪ b)?]π).
I Let RG(a) = (n1,n2): the edge n1a→ n2 ∈ G.
G |= [ω :=g ⊥][U][ω :=l >][a]¬ω iff RG(a) is irreflexive.I Classes of circular lists, balanced trees, . . .
Hamiltonian Graphs
The following formula expresses the existence of a Hamiltoniancycle.α stands for a1 ∪ . . . ∪ an, where the ai ’s are the possiblefeatures used in the graph (F = a1, . . . ,an):
〈ω :=g >;π :=g ⊥;ω :=l ⊥;π :=l >; (α;ω?;ω :=l ⊥)?〉(π ∧ [U]¬ω).
Decidability
I With * and without “nw” : the problem of “model checking”(G |= Φ) is decidable.
Modal Logic Lgr and Graph Rewriting
Expressing pattern-matching in LgrProposition: Let Gr be a term-graph with root r (adistinguished node). There exists a ?-free action αG and a?-free formula φG such that for all finite rooted termgraphs G′r
′,
G′r′ |= 〈αG〉φG iff there exists a graph homomorphism from G to
G′r′.
We define the action αG and the formula φG as follows:I βG = (π0 :=g ⊥); . . . ; (πN−1 :=g ⊥),
(N being the number of nodes in G)I for all non-negative integers i , if i < N then γ i
G =(¬π0 ∧ . . . ∧ ¬πi−1)?; (πi :=l >); U,
I αG = βG; γ0G; . . . ; γN−1
G ,
Modal Logic Lgr and Graph Rewriting
We define the formula φG as follows:I for all non-negative integers i , if i < N then ψi
G = if Ln(i) isdefined then 〈U〉(πi ∧ Ln(i)) else >,
I for all non-negative integers i , j , if i , j < N then χi,jG = if
there exists an edge e ∈ E such that S(e) = i and T (e) = jthen 〈U〉(πi ∧ 〈Le(e)〉πj) else >,
I φG = ψ0G ∧ . . . ∧ ψ
N−1G ∧ χ0,0
G ∧ . . . ∧ χN−1,N−1G .
Modal Logic Lgr and Graph Rewriting
Actions representing the right-hand sides can be expressed bythe following elementary formulas :
I Action n : f (a1 ⇒ n1, . . . ,ak ⇒ nk )U;πn?; (f :=l >); (a1 + (πn, πn1)); . . . ; (ak + (πn, πnk )).
I Action na m(a− (πn,>)); (a + (πn, πm)).
I Action n m) (for a-edges)(λa :=g ⊥); (λa :=g 〈a〉πn); (a− (>, πn)); (a + (λa, πm)).
Modal Logic Lgr and Graph Rewriting
I Firing a rule ρ = L→ R
βρ = αL;αR
I Normal form of graph Gr satisfies ϕ: Let R = (∨βρi )
Gr |= [R∗]([R]⊥ ⇒ ϕ)
I Rule ρ preserves the property ϕ:
|= (ϕ⇒ [βρ]ϕ)
Conclussion and perspectives
I Admissible termgraphs seem to be a good trade-off toensure confluence and efficient strategies
I Cloning and algebraic approaches (sesqui-pushout)I NarrowingI Visual Programming and Termgraph RewritingI Proof TechniquesI Applications