Deciding Contextual Equivalence for IMJ* Andrzej Murawski Steven Ramsay Nikos Tzevelekos University of Warwick University of Oxford Queen Mary University of London
For all interface tables and IMJ contexts such that: it follows that: terminates iff terminates
2 * x 2 + x can be witnessed by let x = 1 in if □ == 2 then skip else (while 1 do skip) let x = 1 in diverges if 2 + x == 2 then skip else (while 1 do skip) let x = 1 in terminates if 2 * x == 2 then skip else (while 1 do skip) { [], [0,2], [1,3],… } { [], [0,0], [1,2],… } 3
new {_: I ; run : λ _. div} let z = new { _: IRef ;} in let f = new {_: I ; run : λ _. z.val.run() } in let x = new {_: IntRef ;} in z.val := □ new {_: I ; z.val.run() run : λ _. if x.val = 0 then x.val := 1; fobj f.run(); zobj if x.val = 2 then call zobj.run() skip call fobj.run() else call zobj.run() div ret zobj.run else if x.val = 1 then x.val := 2 ret fobj.run else ret zobj.run div } 4
let x = new {_: IntRef ;} in let c1 = new {_: ObjRef ;} in let c2 = new {_: ObjRef ;} in new {_: ObjCell ; get : λ _. if x.val then c1.val else c2.val, getprev : λ _. if x.val then c2.val else c1.val, set : λ o. if x.val then x.val := 0 else x.val := 1; if x.val then c1.val := o else c2.val := o } let last = new {_: ObjRef ;} in let current = new {_: ObjRef ;} in new {_: ObjCell ; get : λ _.current.val, getprev : λ _.last.val, set : λ o.last.val := current.val; current.val := o }
IMJ* [MRT ATVA’15] n x null skip exp = exp exp + exp ( I )exp exp.fld exp.fld := exp exp.m(exp 1 ,…, exp k ) exp ; exp let x = exp in exp if x = exp then exp else exp while exp do exp new { this : I ; m 1 : body 1 , …, m k : body k } 6
IMJ* [MRT ATVA’15] Only second-order objects Only finite types, ground fields returning ground data Only iteration Only first-order objects
Given a queue machine Qu, QuItem, QuItemId t ? 8
Given a queue machine Qu, QuItem, QuItemId t ? 9
Given a queue machine Qu, QuItem, enqd? : int = 0 QuItemId head: QuItemId = ? b qState: int = q I enq ( d : int) : QuItem = ……………….. b: Qu 10
Given a queue machine Qu, QuItem, enqd? : int = 0 QuItemId head: QuItemId = ? b qState: int = q I b.enq(3) enq ( d : int) : QuItem = ……………….. b: Qu 11
Given a queue machine Qu, QuItem, enqd? : int = 0 enqd? : int = 3 QuItemId prev: QuItemId = head: QuItemId = myId: QuItemId = ? b qState: int = q 1 deq () : void = ….. b.enq(3) enq ( d : int) : QuItem ret b.enq(d) d: QuItem = ……………….. b: Qu Assuming δ E (q I , 3) = q 1 12
Given a queue machine Qu, QuItem, enqd? : int = 0 enqd? : int = 3 QuItemId prev: QuItemId = head: QuItemId = myId: QuItemId = ? b qState: int = q 1 deq () : void = ….. b.enq(3) enq ( d : int) : QuItem ret b.enq(d) d: QuItem = ……………….. b.enq(6) b: Qu 13
Given a queue machine Qu, QuItem, enqd? : int = 0 enqd? : int = 3 enqd? : int = 6 QuItemId prev: QuItemId = prev: QuItemId = head: QuItemId = myId: QuItemId = myId: QuItemId = ? b qState: int = q 2 deq () : void = ….. deq () : void = ….. b.enq(3) enq ( d : int) : QuItem ret b.enq(d) f: QuItem d: QuItem = ……………….. b.enq(6) b: Qu ret b.enq(f) Assuming δ E (q 1 , 6) = q 2 14
Given a queue machine Qu, QuItem, enqd? : int = 0 enqd? : int = 3 enqd? : int = 6 QuItemId prev: QuItemId = prev: QuItemId = head: QuItemId = myId: QuItemId = myId: QuItemId = ? b qState: int = q 2 deq () : void = ….. deq () : void = ….. b.enq(3) enq ( d : int) : QuItem ret b.enq(d) f: QuItem d: QuItem = ……………….. b.enq(6) b: Qu ret b.enq(f) d.deq() 15
Given a queue machine Qu, QuItem, enqd? : int = 0 enqd? : int = 0 enqd? : int = 6 QuItemId prev: QuItemId = prev: QuItemId = head: QuItemId = myId: QuItemId = myId: QuItemId = ? b qState: int = q 3 deq () : void = ….. deq () : void = ….. b.enq(3) enq ( d : int) : QuItem ret b.enq(d) f: QuItem d: QuItem = ……………….. b.enq(6) b: Qu ret b.enq(f) d.deq() Assuming δ D (q 2 ) = q 3 and checking d.prev.enqd? = 0 ret d.deq 16 and d.myId.enqd? != 0
IMJ* [MRT ATVA’15] Only second-order objects Only finite types, ground fields returning ground data Only iteration Only first-order objects
CONEQCT [MRT ATVA’15 ( TOOL )] 1 2 3 Translate IMJ* terms Reduce the equivalence Solve the emptiness into their strategies in problem for IMJA to the problem for FPDRA using the game model, emptiness problem for saturation algorithm. represented as two Fresh Pushdown Register IMJ Automata (IMJA). Automata (FPDRA). [MT POPL’14] [MRT ATVA’15] [MT ICALP’12] [MRT ATVA’15] [MRT MFCS’14] 18
IMJA: A machine representation for strategies (sets of plays). Finite set of possible Object creation fobj moves modulo Fresh-name recognition zobj object names call zobj.run() Accepts words over call fobj.run() a nominal alphabet call zobj.run() Call stack discipline ret zobj.run Visible pushdown stack ret fobj.run (Representation of ret zobj.run stores not shown)
IMJA: A machine representation for strategies (sets of plays). ν 2. 2 q q’ ν 2. call 3.myMethod(2) / (k, {2,3}) q q’ ν 2. ret 3.myMethod(2) / (k, {2,3}, {2}) q q’ + Bookkeeping 20
f: I Ⱶ new {_: I ; run : λ _. div} : I ν 1. 1 fobj, zobj
ν 3. 3 ν 1. 1 f: I Ⱶ let x = new {_: IntRef ;} in new {_: I ; run : λ _. if x.val = 0 then x.val := 1; f.run(); if x.val = 2 then skip else div else if x.val = 1 then x.val := 2 else div }
SYNCHRONISATION Simulate two sets of registers using one set equipped with a representation of one of exponentially many correspondences. P LAYS OF SYSTEM 1 P LAYS OF SYSTEM 2 (IMJA) (IMJA) R EPRESENTATION OF S YMMETRIC D IFFERENCE (FPRDA)
C ONFIGURATIONS S YMMETRIC D IFFERENCE (FPRDA) L EADING TO A CCEPT (RA) A CCEPTING C ONFIGURATIONS (RA) 24
FUTURE WORK 25
Recommend
More recommend