Beruflich Dokumente
Kultur Dokumente
Andreas Sander
16.06.2010
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Motivation
Intuition
A recursive data structure is (partially) composed of smaller or
simpler instances of the same structure.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Motivation
Intuition
A recursive data structure is (partially) composed of smaller or
simpler instances of the same structure.
Example: cons(1,cons(2,cons(3,nil)))
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Motivation
Intuition
A recursive data structure is (partially) composed of smaller or
simpler instances of the same structure.
Example: cons(1,cons(2,cons(3,nil)))
Main Goal
The main goal is to define decision procedures for recursive data
structures.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Motivation
Intuition
A recursive data structure is (partially) composed of smaller or
simpler instances of the same structure.
Example: cons(1,cons(2,cons(3,nil)))
Main Goal
The main goal is to define decision procedures for recursive data
structures.
Whats about:
|cons(1,cons(2,cons(3,nil)))| > 3 ?
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
What we have and what we want
Problem-Outline
What we have and what we want
Problem-Outline
What we have and what we want
Length Function
|.| : Z
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
What we have and what we want
Length Function
|.| : Z
Goal
Get a decision procedure for the combination of Th( A ), Th(AZ )
and |.| : Z
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
Applicability of Nelson & Oppen
Problem-Outline
Applicability of Nelson & Oppen
Length Function
|.| : Z
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
Applicability of Nelson & Oppen
We want can not combine this with Nelsons and Oppens method:
Length Function
|.| : Z
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
The Solution
Solution
Extension of Nelsons and Oppens original method!
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
The Solution
Solution
Extension of Nelsons and Oppens original method!
Problem-Outline
The Solution
Solution
Extension of Nelsons and Oppens original method!
Presburger Arithmetic
Decision Procedure
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
The Solution
Solution
Extension of Nelsons and Oppens original method!
Presburger Arithmetic
Decision Procedure
Theory of recursive data structure
Decision Procedure
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Problem-Outline
The Solution
Solution
Extension of Nelsons and Oppens original method!
Presburger Arithmetic
Decision Procedure
Theory of recursive data structure
Decision Procedure
Extension of Nelsons and Oppens method in the presence of
length |.|
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Z : Integer domain
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Z : Integer domain
0 : a constant
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Z : Integer domain
0 : a constant
s : a successor function
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Z : Integer domain
0 : a constant
s : a successor function
+ : binary function addition
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Z : Integer domain
0 : a constant
s : a successor function
+ : binary function addition
: binary function subtraction
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Z : Integer domain
0 : a constant
s : a successor function
+ : binary function addition
: binary function subtraction
< : predicate smaller relation
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Presburger Arithmetic
first-order theory
corresponding structure AZ : hZ; 0, s, +, , <i
Z : Integer domain
0 : a constant
s : a successor function
+ : binary function addition
: binary function subtraction
< : predicate smaller relation
A : h; A, C, S, T i consists of
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
A : h; A, C, S, T i consists of
a data domain
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
A : h; A, C, S, T i consists of
a data domain
A : h; A, C, S, T i consists of
a data domain
A : h; A, C, S, T i consists of
a data domain
A : h; A, C, S, T i consists of
a data domain
A Example AList
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
A Example AList
t(x) 6= x cons(x, y ) 6= x
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
A Example AList
A Example AList
A Example AList
V
IsA (x) C Is (x) IsA (x) Iscons (x)
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
A Example AList
si (x) = y
z ((z ) = x y = zi ) cdr (cons(x, y )) = y
(z ((z ) 6= x) x = y ) IsA (x) {car , cdr }+ (x) = x
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Goal
Check satisfiability of
q1 = r1 ... qk = rk s1 6= t1 ... sl 6= tl
in Th(A ).
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Goal
Check satisfiability of
q1 = r1 ... qk = rk s1 6= t1 ... sl 6= tl
in Th(A ).
Idea
Use a Directed Acyclic Graph (DAG) for those formulae.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Term-Representation
Term-Representation
Term-Representation
Term-Representation
Goal
Check satisfiability of
q1 = r1 ... qk = rk s1 6= t1 ... sl 6= tl
in Th(A ).
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Goal
Check satisfiability of
q1 = r1 ... qk = rk s1 6= t1 ... sl 6= tl
in Th(A ).
Idea
Use a Directed Acyclic Graph (DAG) for those formulae.
1 Add (qi , ri )(i {1, ...k}) to an equivalence relation R on
vertices
2 Close R under congruences and unification.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Groundwork
Groundwork
Let be u V
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Groundwork
Let be u V
outdegree (u)
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Groundwork
Let be u V
outdegree (u)
the ith successor u[i] (i [0; (u)])
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Groundwork
Let be u V
outdegree (u)
the ith successor u[i] (i [0; (u)])
Idea
cons(x, y ) = cons(z, t) x = z y = t
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
R is an equivalence relation
(u, v ) R
(u[i], v [i]) R i [1; (u)]
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
R is an equivalence relation
(u, v ) R
(u[i], v [i]) R i [1; (u)]
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Rl is an equivalence relation
(u, v ) Rl
m
(u[i], v [i]) Rl i [1; (u)]
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 1
1 Step 1: Construct the DAG G of
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 1
1 Step 1: Construct the DAG G of
2 Step 2: Compute Rl of R = {(qi , ri )|1 i k}.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 1
1 Step 1: Construct the DAG G of
2 Step 2: Compute Rl of R = {(qi , ri )|1 i k}.
3 Return UNSATISFIABLE if i(si , ti ) Rl;
Return SATISFIABLE otherwise.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
In our setting
In our setting
Complication
We dont know a priori wether s(x) is a proper subterm of x.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
In our setting
Complication
We dont know a priori wether s(x) is a proper subterm of x.
Algorithm 2
0
1 Step 1:Guess a type completion of and simplify selector
terms accordingly.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 2
0
1 Step 1:Guess a type completion of and simplify selector
terms accordingly.
0
2 Step 2: Call Algorithm 1 on
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Example
cons(y,z) = cons(cdr(x),z) cons(car(x),y) 6= x
Unification Closure
(u, v ) R
(u[i], v [i]) Ri [1; (u)]
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
The Structure B
The Structure B
The Structure B
The Structure B
The Structure B
The Structure B
Why?
We want can not combine this with Nelsons and Oppens method
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Why?
We want can not combine this with Nelsons and Oppens method
Consider BList ,
: x = cons(car(y),y) and Z :|x|<2|car(x)|
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Why?
We want can not combine this with Nelsons and Oppens method
Consider BList ,
: x = cons(car(y),y) and Z :|x|<2|car(x)|
Observation
Constraints of data structures impose hidden constraints on the
lenghts of those structures.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Idea
Explicitly compute the hidden constraints!
Length constraint :
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Idea
Explicitly compute the hidden constraints!
Length constraint :
Idea
Explicitly compute the hidden constraints!
Length constraint :
Idea
Explicitly compute the hidden constraints!
Length constraint :
Satisfiability of B
Main Theorem
Let be in the form Z . Let be the induced length
constraint with respect to .
is satisfiable in B
Z is satisfiable in AZ and is satisfiable in A
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
P()
Node (t, t ) : |t| = i=1 |ti |
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
P()
Node (t, t ) : |t| = i=1 |ti |
V()
Tree (t) : t (Node (t, t ) i=1 Tree(ti ))
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 3 (Construction of in B )
Let be (type-complete) data constraint. G the DAG of and
Rl bidirectional closure.
From initial state = add the following
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 3 (Construction of in B )
Let be (type-complete) data constraint. G the DAG of and
Rl bidirectional closure.
From initial state = add the following
|t| = 1 if t is an atom
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 3 (Construction of in B )
Let be (type-complete) data constraint. G the DAG of and
Rl bidirectional closure.
From initial state = add the following
|t| = 1 if t is an atom
|t| = |s|, if (t, s) Rl
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 3 (Construction of in B )
Let be (type-complete) data constraint. G the DAG of and
Rl bidirectional closure.
From initial state = add the following
|t| = 1 if t is an atom
|t| = |s|, if (t, s) Rl
Tree(t) if t is an untyped leaf vertex.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 3 (Construction of in B )
Let be (type-complete) data constraint. G the DAG of and
Rl bidirectional closure.
From initial state = add the following
|t| = 1 if t is an atom
|t| = |s|, if (t, s) Rl
Tree(t) if t is an untyped leaf vertex.
Node (t, t ) if t is an -typed vertex with children t
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Algorithm 3 (Construction of in B )
Let be (type-complete) data constraint. G the DAG of and
Rl bidirectional closure.
From initial state = add the following
|t| = 1 if t is an atom
|t| = |s|, if (t, s) Rl
Tree(t) if t is an untyped leaf vertex.
Node (t, t ) if t is an -typed vertex with children t
Tree (t) if t is an -typed leaf vertex.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Some Deductions
Proposition 2
obtained by Algorithm 3 is expressible in a quantifier-free
Presburger formula linear in the size of .
Theorem 1
obtained by Algorithm 3 is the induced length constraint of .
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Input: Z .
0
1 Guess a type completion of .
0
2 Call Algorithm 1 on .
0
Return FAIL if is unsatisfiable; continue otherwise.
0
3 Construct from G using Algorithm 3.
Return SUCCESS if is satisfiable and Z is satisifiable.
Return FAIL otherwise.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Example
x = cons(car(y),y) |cons(car(y),y)| < 2|car(x)|.
Motivation Problem-Outline The structures Recursive Data Structures The Integrated Theory
Literature