Rv-systems
Rv-systems / Stefanescu / Pisa, 2007 Slide 1/88
Interactive systems with registers and voices
Gheorghe Stefanescu
Faculty of Mathematics and Computer Science University of Bucharest Pisa, Italy, 4-th June, 2007
Interactive systems with registers and voices Gheorghe Stefanescu - - PowerPoint PPT Presentation
Rv-systems Interactive systems with registers and voices Gheorghe Stefanescu Faculty of Mathematics and Computer Science University of Bucharest Pisa, Italy, 4-th June, 2007 Slide 1/88 Rv-systems / Stefanescu / Pisa, 2007 Rv-systems
Rv-systems / Stefanescu / Pisa, 2007 Slide 1/88
Faculty of Mathematics and Computer Science University of Bucharest Pisa, Italy, 4-th June, 2007
Rv-systems / Stefanescu / Pisa, 2007 Slide 2/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 3/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 4/88
High level: x:Int, y:Array[1..10] of Int; tape space time High level: temporal data stream Software memory state job requirement new job new state component
Rv-systems / Stefanescu / Pisa, 2007 Slide 5/88
Proc 1 Proc 2 Proc 3 Trans 1 Trans 2 Trans 3
Rv-systems / Stefanescu / Pisa, 2007 Slide 6/88
sLinkedList 2001 2002 2003 2001 2003 2002 next week I will be
next week
I will be 5 3 7 3 1 tBool 1 3 3 7 5 sArray tArray sInt tInt tLinkedList sBool
Rv-systems / Stefanescu / Pisa, 2007 Slide 7/88
time : 910111213141516171819202122232425262728293031323334353637 .. I w i l l b e
M o o n n e x t w e e k .. ..1112131415161718192021222324252627282930313233343536⊥ ..
time : 910111213141516171819202122232425262728293031323334353637 .. n e x t w e e k I w i l l b e
M o o n .. ..1112131415161718⊥202122232425262728293031323334353610 ..
time : 910111213141516171819202122232425262728293031323334353637 .. b e e e e I i k l l M o o o n n n t w w x .. ..34162726323517123620231024⊥25112830293113141815221933 ..
Rv-systems / Stefanescu / Pisa, 2007 Slide 8/88
space−to−time time−to−space n x y − computed in space n x y − in time n y 2 y y ... n y ... ... ... ... y ... ... ... ... ... ... y ... ... ... n y 2 y
Rv-systems / Stefanescu / Pisa, 2007 Slide 9/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 10/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 11/88
x=6 X tx=6 Y tx=6 Z x=3 U y=6 tx=3 V z=6 tx=3W x=2 U y=6 tx=2 V z=3 tx=2W x=1 U x=0 y=6 tx=1 V y=6 z=1 tx=1W z=0 x=5 X tx=5 Y tx=5 Z x=2 U y=5 tx=2 V z=5 tx=0W x=1 U x=0 y=5 tx=1 V y=4 z=5 tx=1W z=4
Our (s)rv-scenarios are similar with the tiles of Bruni-Gadducci-Montanari, et.al.
Rv-systems / Stefanescu / Pisa, 2007 Slide 12/88
X:: module{listen nil;}{read x:sn;}
{tx:tn; tx=x; x=x/2;}{speak tx;}{write x;}
Y:: module{listen tx:tn;}{read nil;}
{y:sn; y=tx;}{speak tx;}{write y;}
Z:: module{listen tx:tn;}{read nil;}
{z:sn; z=tx;}{speak nil;}{write z;}
U:: module{listen nil;}{read x:sn;}
{tx:tn; tx=x; x=x-1;}{speak tx;}{write x;}
V:: module{listen tx:tn;}{read y:sn;}
{if(y%tx != 0) tx=0;}{speak tx;}{write y;}
W:: module{listen tx:tn;}{read z:sn}
{z=z-tx;}{speak nil;}{write z;}
Rv-systems / Stefanescu / Pisa, 2007 Slide 13/88
U1:: module{listen nil;}{read x:sn;}
{tx:tn; tx=-1;}{speak tx;}{write nil;}
V1:: module{listen tx:tn;}{read y:sn;}
{null;}{speak tx;}{write nil;}
W1:: module{listen tx:tn;}{read z:sn}
{null;}{speak nil;}{write z;}
Rv-systems / Stefanescu / Pisa, 2007 Slide 14/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 15/88
aabbabb abbcdbb bbabbca ccccaaa
aabb... ..bc..b bbabbca ..c...a
Notice: The requirement to have a rectangular area may be weakened, e.g., one may require to have a connected area, not a rectangular one.
Rv-systems / Stefanescu / Pisa, 2007 Slide 16/88
h g f e d c b a
Z Y X
X Y Z
Rv-systems / Stefanescu / Pisa, 2007 Slide 17/88
abcd efgh ; there is one minimal element a; after its
bcd efgh ;
cd efgh ; and so on;
abcd efgh ) =
{abcdefgh,abcedfgh,abcefdgh,abcefgdh,abecdfgh, abecfdgh,abecfgdh,abefcdgh,abefcgdh,aebcdfgh, aebcfdgh,aebcfgdh,aebfcdgh,aebfcgdh}
Rv-systems / Stefanescu / Pisa, 2007 Slide 18/88
. . .. w v v w
Rv-systems / Stefanescu / Pisa, 2007 Slide 19/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 20/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 21/88
❅ ❅ ❅
♥ ✒✑ ✓✏
✒✑ ✓✏
❅ ❅ ❅
♥ ✒✑ ✓✏
✒✑ ✓✏
❅ ❅ ❅
✲ ✛ ✛ ✲ ✻ ❄ ❄ ✻ ✲ ✲ ❄ ❄ ❄ ✲
A a B 2
2 A c A 2
1 B b B 1
Rv-systems / Stefanescu / Pisa, 2007 Slide 22/88
abb cab cca
1 1 1 Aa b b Ac a b Ac c a
1 1 1 AaBb b 2 Ac a b Ac c a
1 1 1 AaBbBb 2 1 Ac a b Ac c a
1 1 1 AaBbBb 2 1 AcAa b 2 Ac c a
1 1 1 AaBbBbB 2 1 1 AcAaBbB 2 2 1 AcAcAaB 2 2 2
L(S) = { a’s on the diagonal, top-right half of b’s, and bottom-left half of c’s}.
Rv-systems / Stefanescu / Pisa, 2007 Slide 23/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 24/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 25/88
a useful web-page is B.Borchert’s page at
http://math.uni-heidelberg.de/logic/bb/2dpapers.html
Notice: 2-dimensional languages are also known as “picture” languages.
Rv-systems / Stefanescu / Pisa, 2007 Slide 26/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 27/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 28/88
A B 1 a b c 2
abb cab cca
1 1 1 Aa b b Ac a b Ac c a 1 1 1 AaBb b 2 Ac a b Ac c a 1 1 1 AaBbBb 2 1 Ac a b Ac c a 1 1 1 AaBbBb 2 1 AcAa b 2 Ac c a
1 1 1 AaBbBbB 2 1 1 AcAaBbB 2 2 1 AcAcAaB 2 2 2
Rv-systems / Stefanescu / Pisa, 2007 Slide 29/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 30/88
in: A,1; out: D,2 X::
(A,1) x : sInt tx : tInt; tx = x; x = x/2; goto [B,3];
Y::
(B,1) y : sInt tx : tInt y = tx; goto [C,2];
Z::
(C,1) z : sInt tx : tInt z = tx; goto [D,2];
U::
(A,3) x : sInt tx : tInt; tx = x; x = x − 1; if (x > 0) goto [B,3] else goto [B,2];
V::
(B,2) y : sInt tx : tInt if(y%tx != 0) tx = 0; goto [C,2];
W::
(C,2) z : sInt tx : tInt z = z − tx; goto [D,2];
Rv-systems / Stefanescu / Pisa, 2007 Slide 31/88
1: x=4 A: X 1: y=nil B: tx=4 Y 1: z=nil C: Z D: 3: x=2 A: U 2: y=4 B: tx=2 V 2: z=4 C: W D: 3: x=1 A: U 2: x=0 2: B: tx=1 V 2: 2: z=2 C: W D: 2: z=1
Rv-systems / Stefanescu / Pisa, 2007 Slide 32/88
U2 V W B C D X Y Z 1 A 2 U1 3
1 A X B 3
1 B Y C 2
1 C Z D 2
3 A U1 B 3
3 A U2 B 2
2 B V C 2
2 C W D 2
Rv-systems / Stefanescu / Pisa, 2007 Slide 33/88
X Y Z U1 V W . . . U1 V W U2 V W
Rv-systems / Stefanescu / Pisa, 2007 Slide 34/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 35/88
a b c d p q a’ c’ b’ d’ q p a b p p d c q q
Rv-systems / Stefanescu / Pisa, 2007 Slide 36/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 37/88
Interfaces SST ::= nil | sn | sb | (SST ∪SST) | (SST,SST) | (SST)∗ ST ::= (SST) | (ST ∪ST) | (ST;ST) | (ST;)∗ STT ::= nil | tn | tb | (STT ∪STT) | (STT,STT) | (STT)∗ TT ::= (STT) | (TT ∪TT) | (TT;TT) | (TT;)∗ Expressions V ::= x : ST | x : TT | V(k) | V.k | V.[k] | V@k | V@[k] E ::= n | V | E +E | E ∗E | E −E | E/E B ::= b | V | B&&B | B||B | !B | E < E Programs W ::= null | new x : SST | new x : STT | x := E | i f (B){W}else{W} | W;W | while(B){W} M ::= module{listen x : STT}{read x : SST} { W }{speak x : STT}{write x : SST} P ::= null | M | i f (B){P}else{P} | P%P | P#P | P$P | while t(B){P} | while s(B){P} | while st(B){P}
Rv-systems / Stefanescu / Pisa, 2007 Slide 38/88
P= I1# for s(tid=0;tid<tm;tid++){I2}# $ while st(!(token.col==white && token.pos==0)){ for s(tid=0;tid<tm;tid++){R}}
I1= module{listen nil}{read m}{ tm=m; token.col=black; token.pos=0; }{speak tm,tid,msg[ ],token(col,pos)}{write nil} I2= module{listen tm,tid,msg[ ],token(col,pos)} {read nil}{ id=tid; c=white; active=true; msg[id]=null; }{speak tm,tid,msg[ ],token(col,pos)} {write id,c,active}
Rv-systems / Stefanescu / Pisa, 2007 Slide 39/88
R= module{listen tm,tid,msg[ ],token(col,pos)} {read id,c,active}{ if(msg[id]!=emptyset){ //take my jobs msg[id]=emptyset; active=true;} if(active){ //execute code, send jobs, update color delay(random time); r=random(tm-1); for(i=0;i<r;i++){ k=random(tm-1); if(k!=id){msg[k]=msg[k]∪{id}}; if(k<id){c=black};} active=random(true,false);} if(!active && token.pos==id){ //termination if(id==0)token.col=white; if(id!=0 && c==black){token.col=black;c=white}; token.pos=token.pos+1[mod tm];} }{speak tm,tid,msg[ ],token(col,pos)} {write id,c,active}
Rv-systems / Stefanescu / Pisa, 2007 Slide 40/88
P0 P1 Pk P3 P2
R R
I1 R R I2 I2 I1# for s(tid=0;tid<tm;tid++){I2}# $ while st(!(token.col==white && token.pos==0)){ for s(tid=0;tid<tm;tid++){R}}
Rv-systems / Stefanescu / Pisa, 2007 Slide 41/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 42/88
x: struc1[], where struc1 = ( a: Int[][], b: Bool, c: struc2[], where struc2 = (p:Int, q:Bool, r:Int) ), y: Bool or Int
Rv-systems / Stefanescu / Pisa, 2007 Slide 43/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 44/88
b1 b2 ... bn (b1,...,bn) a1 a2 ... am (a1,...,am)
a1 a1 a2 ... am b1 b2 ... bn a2 ... am ... (a1,...,am) (a1,...,am) Init_H Init_V X bn b2 b1 (b1,...,bn) (b1,...,bn) Test
Rv-systems / Stefanescu / Pisa, 2007 Slide 45/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 46/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 47/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 48/88
1 1 1 AaBbBbB 2 1 1 AcAaBbB 2 2 1 AcAcAaB 2 2 2
1: x=4 A: X 1: B: tx=4 Y 1: C: Z D: 3: x=2 A: U 3: x=1 2: y=4 B: tx=2 V 2: 2: z=4 C: W D: 2: z=2 x=4 X tx=4 Y tx=4 Z x=2 U x=1 y=4 tx=2 V y=4 z=4 tx=2W z=2
X Y X Y X Y (d) (f) (g) (e) (a) (b) (c)
Rv-systems / Stefanescu / Pisa, 2007 Slide 49/88
g h i B e d f a b c A nil V W Z U B X Y A nil X Y A a b c e d f Z U B V W g h i nil nil
Rv-systems / Stefanescu / Pisa, 2007 Slide 50/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 51/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 52/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 53/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 54/88
σ(S1%S2) = (st,wσ(S1);wσ(S2)|nσ(S1) → eσ(S1);eσ(S2)|sσ(S2)), where st = min(ok,stσ(S1),stσ(S2)) if sσ(S1) = nσ(S2) = singleton min(war0,stσ(S1),stσ(S2)) if sσ(S1) = nσ(S2) = ¬singleton min(war1,stσ(S1),stσ(S2)) if sσ(S1) ∩nσ(S2) = / err if sσ(S1) ∩nσ(S2) = /
w1 w2 n1 e1 e2 s2
Rv-systems / Stefanescu / Pisa, 2007 Slide 55/88
σ(if(B){S1}else{S2}) = (st,wσ(S1) ∪ wσ(S2)|nσ(S1) ∪ nσ(S2) → eσ(S1) ∪eσ(S2)|sσ(S1) ∪sσ(S2)) where st = min(ok,stB,stσ(S1),stσ(S2)) —if σ(B) ⊆ wσ(S1) ∪nσ(S1) ∪wσ(S2) ∪nσ(S2) = singleton min(war0,stB,stσ(S1),stσ(S2)) —if σ(B) ⊆ wσ(S1) ∪nσ(S1) ∪wσ(S2) ∪nσ(S2) = ¬singleton min(war1,stB,stσ(S1),stσ(S2)) —if σ(B)∩(wσ(S1) ∪nσ(S1) ∪wσ(S2) ∪nσ(S2)) = / err —if σ(B)∩(wσ(S1) ∪nσ(S1) ∪wσ(S2) ∪nσ(S2)) = /
n’ n" w’ w" e’ e" s" s’
Rv-systems / Stefanescu / Pisa, 2007 Slide 56/88
σ(while t(B){S}) = (st,(wσ(S);)∗|nσ(S) ∪ sσ(S) → (eσ(S);)∗|nσ(S) ∪ sσ(S)) where denoting P1 := σB ⊆ wσ(S) ∪nσ(S) = singleton, Q1 := sσ(S) = nσ(S) = singleton, P2 := σB ⊆ wσ(S) ∪nσ(S) = ¬singleton, Q2 := sσ(S) = nσ(S) = ¬singleton, P3 := σB ∩(wσ(S) ∪nσ(S)) = / 0, Q3 := sσ(S) ∩nσ(S) = / 0, P4 := σB ∩(wσ(S) ∪nσ(S)) = / 0, Q4 := sσ(S) ∩nσ(S) = / we have st = min(ok,stB,stσ(S)) if P1∧Q1 min(war0,stB,stσ(S)) if P2∧(Q1∨Q2)∨(P1∨P2)∧Q2 min(war1,stB,stσ(S)) if P3∧(Q1∨Q2∨Q3)∨(P1∨P2∨P3)∧Q3 err if P4∨Q4
Rv-systems / Stefanescu / Pisa, 2007 Slide 57/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 58/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 59/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 60/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 61/88
a1 a1 a2 ... am b1 b2 ... bn a2 ... am ... (a1,...,am) (a1,...,am) Init_H Init_V X bn b2 b1 (b1,...,bn) (b1,...,bn) Test
Rv-systems / Stefanescu / Pisa, 2007 Slide 62/88
Intermediary step: Add srv-programming features to certain mature programming languages as Eifel, Real Time Java, etc.
Rv-systems / Stefanescu / Pisa, 2007 Slide 63/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 64/88
x = 0? START z = z−x x = x−1 y%x=0? STOP C T B (x,y,z) = (n/2,n,n) A F T F E2 E1
Rv-systems / Stefanescu / Pisa, 2007 Slide 65/88
aabbabb abbcdbb bbabbca ccccaaa
a a a b a b b b c b b a b c b c
h g f e d c b a
Rv-systems / Stefanescu / Pisa, 2007 Slide 66/88
1 1 1 AaBbBbB 2 1 1 AcAaBbB 2 2 1 AcAcAaB 2 2 2
A 2 1 B
A 2 1 B
A 2 1 B
Rv-systems / Stefanescu / Pisa, 2007 Slide 67/88
Except for the guess of assertions, the proof is finite and fully automatic.
Rv-systems / Stefanescu / Pisa, 2007 Slide 68/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 69/88
D A D A D 2 2 A 3 2 U1 V W U1 V W U2 V W 2 X Y Z 1 1 1 D A 3 2 2 3 2 2 2 3 2 2
Rv-systems / Stefanescu / Pisa, 2007 Slide 70/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 71/88
(..Partial correctness, using a row partition)
Rv-systems / Stefanescu / Pisa, 2007 Slide 72/88
(..Partial correctness, using a row partition)
Rv-systems / Stefanescu / Pisa, 2007 Slide 73/88
(..Partial correctness, using a row partition)
Rv-systems / Stefanescu / Pisa, 2007 Slide 74/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 75/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 76/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 77/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 78/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 79/88
[Rules for time analysis: —each action may start as soon as possible; —if two actions are completed at the same time, then they may be put in the flattening sequence in any order.]
Rv-systems / Stefanescu / Pisa, 2007 Slide 80/88
m\n
2 5 14 42 132 429
42 462 6,006 87,516 1,385,670
24,024 1,662,804 140,229,804 13,672,405,890
701,149,020 396,499,770,810 278,607,172,289,160
1,671,643,033,734,960 9,490,348,077,234,178,440
475,073,684,264,389,879,228,560
Rv-systems / Stefanescu / Pisa, 2007 Slide 81/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 82/88
9! (1)·(2)·(3)·(1·5)·(1·2·4·8) = 189 1 2 3 1 5 1 2 4 8
Rv-systems / Stefanescu / Pisa, 2007 Slide 83/88
(m·n)! [1·2·...·n]·[2·3·...·(n+1)]·...·[m·(m+1)·...·(m+n−1)]
Rv-systems / Stefanescu / Pisa, 2007 Slide 84/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 85/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 86/88
Rv-systems / Stefanescu / Pisa, 2007 Slide 87/88
FIS’s over VMSC correspond to MSC’s.
Rv-systems / Stefanescu / Pisa, 2007 Slide 88/88