Relational Interfaces Relational Interfaces
Stavros Tripakis
UC Berkeley
Joint work with Ben Lickly, Joint work with Ben Lickly, Tom Henzinger and Edward Lee
UC Berkeley, Feb 2010
Relational Interfaces Relational Interfaces Stavros Tripakis UC - - PowerPoint PPT Presentation
Relational Interfaces Relational Interfaces Stavros Tripakis UC Berkeley Joint work with Ben Lickly, Joint work with Ben Lickly, Tom Henzinger and Edward Lee UC Berkeley, Feb 2010 Component Based Design Component Based Design How can we
Joint work with Ben Lickly, Joint work with Ben Lickly, Tom Henzinger and Edward Lee
UC Berkeley, Feb 2010
2
3
B A
A’ B’ B’
4
B A A’ B’ B’
5
y , , j , , , , , p /p , p refinement, …
Liskov, 1980s: Modular program construction using abstractions
(inheritance)
independent circuits
1990s, 2000s, …: compositional verification, assume‐guarantee, … B 1990 FOCUS
6
Assumption about inputs Guarantee
7
deterministic (function)
1 2
(f )
2 2
non‐deterministic (relation)
1 2
8
2
9
10
Set of input variables S t f t t i bl
Set of input variables Set of output variables
Contract
11
Set of all assignments
Set of all assignments
A(X) A(Y)
1
12
2 1 2
13
1
2 2 1 2
2 1 2
14
*
*
15
1 2 3 4 5 x y 0 1 2 3 4 5 ... v0 0 1 2 3 4 ... x: y:
unit‐delay
x y
ud ud
d ud
ud
16
data in data out
data_in write full read data_out empty
Global contract: (holds at all states)
State‐dependent contracts:
17
18
19
20
Environment
Interface
21
22
23
24
more deterministic
2 1 2 2 1 2
more legal inputs
25
26
27
28
29
2 1
2 1
2 1
30
x y1 x y2
1
2
31
32
φ1 φ2 φ3 φ1 φ2 φ3
x1 y1
x2 y2
x2 y2 2 1
33
2 1
1
34
E ( 2 ) fi ( d 2 0) – E.g., (y = 2x) refines (y mod 2 = 0)
35
x y
x y
x y
x y
x y x y
36
37
vs.
Input‐complete Non‐input‐complete
38
2 1
true in z y z y ≡ → = ∧ ∀ = Φ ) ( ) ( : , :
2 1
φ φ
39
to handle this output during composition => comes to the same thing
40
41
42
(and (= x in) (and (= z y) (and (>= z 0) (== (* w w) z)) (or (/= x 1 ) (= y 1 ) ) (forall ( ( ) )) ( (/ ) ( y ) ) ( ( y::int z::int) (=> (and (or (/= x 1 ) (= y 1 )) (= z y)) (exists (w::int ) (and (>= z 0) (== (* w w) z)))))) (= y out1) (= w out2) (= z
46
x1 y1
x2 y2
2 1
47
x1 y1
x2 y2
x1 y1
x2 y2
48
49