Guarded Kleene Algebra with Tests Verification of Uninterpreted Programs in Nearly Linear Time Steffen Smolka 1 Nate Foster 1 Justin Hsu 2 e 3 Dexter Kozen 1 Alexandra Silva 3 Tobias Kapp´ 1 Cornell University 2 University of Wisconsin-Madison 3 University College London POPL 2020
Introduction while a and b do e ; end while a do f ; while a and b do e ; end end S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 1 19
Introduction while a and b do e ; while a do end if b then e ; while a do f ; else while a and b do f ; e ; end end end end S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 1 19
Introduction while a and b do e ; while a do end if b then e ; while a do f ; ? else ≡ while a and b do f ; e ; end end end end S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 1 19
Introduction KAT Composition choice, iteration [Kozen 1996] Complexity PSPACE-hard [Kozen and Smith 1996] Axiomatization Quasi-equational [Kozen and Smith 1996] Automata Automata on guarded strings [Kozen 2003; Kozen and Tseng 2008] See also Ashcroft and Manna 1972; B¨ ohm and Jacopini 1966; Kosaraju 1973; Oulsnam 1982; Peterson et al. 1973; Ramshaw 1988; Williams and Ossher 1978; Hendren et al. 1992; Morris et al. 1997 S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 2 19
Introduction KAT ⊇ GKAT Composition choice, iteration if - then - else , while - do [Kozen 1996] Complexity PSPACE-hard Nearly linear [Kozen and Smith 1996] Quasi-equational † Axiomatization Quasi-equational [Kozen and Smith 1996] Automata Automata on guarded strings Well-nested fragment [Kozen 2003; Kozen and Tseng 2008] See also Ashcroft and Manna 1972; B¨ ohm and Jacopini 1966; Kosaraju 1973; Oulsnam 1982; Peterson et al. 1973; Ramshaw 1988; Williams and Ossher 1978; Hendren et al. 1992; Morris et al. 1997 S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 2 19
Contributions Nearly linear decision procedure . S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 3 19
Contributions Nearly linear decision procedure . Quasi-equational axiomatization . S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 3 19
Contributions Nearly linear decision procedure . Quasi-equational axiomatization . Automata model with Kleene Theorem . S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 3 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 e , f ::= a | p ∈ Σ | ef | e + a f | e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 a or b e , f ::= a | p ∈ Σ | ef | e + a f | e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 a and b e , f ::= a | p ∈ Σ | ef | e + a f | e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 not a e , f ::= a | p ∈ Σ | ef | e + a f | e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 false e , f ::= a | p ∈ Σ | ef | e + a f | e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 true e , f ::= a | p ∈ Σ | ef | e + a f | e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 | p ∈ Σ | ef | e + a f | e ( a ) e , f ::= a assert a S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 | e + a f | e ( a ) e , f ::= a | p ∈ Σ | ef e ; f S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 | e ( a ) e , f ::= a | p ∈ Σ | ef | e + a f if a then e else f S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax a , b ::= t ∈ T | a + b | ab | a | 0 | 1 e , f ::= a | p ∈ Σ | ef | e + a f | e ( a ) while a do e S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 4 19
Syntax while a do if b then e ; ( e + b f ) ( a ) else f ; end end S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 5 19
Syntax while a do if b then e ; ( e + b f ) ( a ) else f ; end end S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 5 19
Syntax while a and b do e ; end while a do ( a ) e ( ab ) ( fe ( ab ) ) f ; while a and b do e ; end end S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 5 19
Syntax while a and b do e ; end while a do ( a ) e ( ab ) ( fe ( ab ) ) f ; while a and b do e ; end end S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 5 19
Semantics
Relational Semantics � sat : T → 2 States , eval : Σ → 2 States 2 � i = S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 6 19
Relational Semantics � sat : T → 2 States , eval : Σ → 2 States 2 � i = e R i � e � t ∈ T { ( s , s ) : s ∈ sat ( t ) } a + b R i � a � ∪ R i � b � R i � a � ∩ R i � b � ab a { ( s , s ) : s ∈ States } \ R i � a � p ∈ Σ eval ( p ) e + a f R i � a � ◦ R i � e � ∪ R i � a � ◦ R i � f � ef R i � e � ◦ R i � f � ( R i � a � ◦ R i � e � ) ∗ ◦ R i � a � e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 6 19
Relational Semantics Atoms = 2 T S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 7 19
Relational Semantics Atoms = 2 T α 0 p 0 α 1 p 1 · · · α n − 1 p n − 1 α n α i ∈ Atoms p i ∈ Σ S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 7 19
Relational Semantics Atoms = 2 T α 0 p 0 α 1 p 1 · · · α n − 1 p n − 1 α n α i ∈ Atoms p i ∈ Σ L ( n ) = L ⋄ · · · ⋄ L L ( ∗ ) = � L ( n ) L ⋄ K = { w α x : w α ∈ L , α x ∈ K } � �� � n ∈ N n times S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 7 19
Language semantics e � e � t ∈ T { α ∈ Atoms : t ∈ α } a + b � a � ∪ � b � � a � ∩ � b � ab a Atoms \ � a � p ∈ Σ { α p β : α , β ∈ Atoms } � a � ⋄ � e � ∪ � a � ⋄ � f � e + a f ef � e � ⋄ � f � ( � a � ⋄ � e � ) ( ∗ ) ⋄ � a � e ( a ) S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 8 19
Decision Procedure Theorem � e � = � f � ⇐ ⇒ ∀ i . R i � e � = R i � f � S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 9 19
Decision Procedure Theorem � e � = � f � ⇐ ⇒ ∀ i . R i � e � = R i � f � How to check � e � = � f � : 1 Create automata that accept � e � and � f � [Thompson 1968] 2 Check automata for bisimilarity [Hopcroft and Karp 1971; Tarjan 1975] S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 9 19
Decision Procedure Theorem � e � = � f � ⇐ ⇒ ∀ i . R i � e � = R i � f � How to check � e � = � f � : 1 Create automata that accept � e � and � f � [Thompson 1968] 2 Check automata for bisimilarity [Hopcroft and Karp 1971; Tarjan 1975] Decidability S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 9 19
Axiomatization
Axiomatization: if-then-else e + a e ≡ e e + a f ≡ f + a e e + a f ≡ ae + a f aa ≡ 0 0 e ≡ 0 S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 10 19
Axiomatization: if-then-else e + a e ≡ e e + a f ≡ f + a e e + a f ≡ ae + a f aa ≡ 0 0 e ≡ 0 Example if a then e else assert false = e + a 0 S. Smolka, N. Foster, J. Hsu, T. Kapp´ e, D. Kozen, A. Silva Guarded Kleene Algebra with Tests POPL 2020 10 19
Recommend
More recommend