Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to...

80
Reactive Synthesis Lecture 01 Swen Jacobs and Martin Zimmermann (Saarland University)

Transcript of Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to...

Page 1: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive SynthesisLecture 01

Swen Jacobs and Martin Zimmermann(Saarland University)

Page 2: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive Systems

Systems that react to environment inputs in potentially infiniteexecutions

Properties of reactive systems:

infinite (or unbounded) executions

reacting to antagonistic environment

usually discrete time steps and finite input range

often used as controllers of physical processes

Reactive Synthesis (2017/18) 1

Page 3: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive Systems

Systems that react to environment inputs in potentially infiniteexecutions

Properties of reactive systems:

infinite (or unbounded) executions

reacting to antagonistic environment

usually discrete time steps and finite input range

often used as controllers of physical processes

Reactive Synthesis (2017/18) 1

Page 4: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive Systems

Systems that react to environment inputs in potentially infiniteexecutions

Properties of reactive systems:

infinite (or unbounded) executions

reacting to antagonistic environment

usually discrete time steps and finite input range

often used as controllers of physical processes

Reactive Synthesis (2017/18) 1

Page 5: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

The Need for Provable Correctness

Reactive Systems are often safety-critical:

controllers in planes, trains, cars

power plants, electric grids

Under assumption of discrete time and finite input range, manyproperties can automatically be proved for a given reactive system.This is called model checking.

Model checking decides whether a given system is correct, butleaves significant effort for the human designer: develop the systemand fix bugs until it is correct.

Reactive Synthesis (2017/18) 2

Page 6: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

The Need for Provable Correctness

Reactive Systems are often safety-critical:

controllers in planes, trains, cars

power plants, electric grids

Under assumption of discrete time and finite input range, manyproperties can automatically be proved for a given reactive system.This is called model checking.

Model checking decides whether a given system is correct, butleaves significant effort for the human designer: develop the systemand fix bugs until it is correct.

Reactive Synthesis (2017/18) 2

Page 7: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

The Need for Provable Correctness

Reactive Systems are often safety-critical:

controllers in planes, trains, cars

power plants, electric grids

Under assumption of discrete time and finite input range, manyproperties can automatically be proved for a given reactive system.This is called model checking.

Model checking decides whether a given system is correct, butleaves significant effort for the human designer: develop the systemand fix bugs until it is correct.

Reactive Synthesis (2017/18) 2

Page 8: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Verification versus Synthesis

Verification Workflow:

Synthesis Workflow:

The synthesis problem is also known as Church’s problem, sinceAlonso Church first defined it in 1962.

Reactive Synthesis (2017/18) 3

Page 9: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Verification versus Synthesis

Verification Workflow:

Synthesis Workflow:

The synthesis problem is also known as Church’s problem, sinceAlonso Church first defined it in 1962.

Reactive Synthesis (2017/18) 3

Page 10: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Verification versus Synthesis

Verification Workflow: Synthesis Workflow:

The synthesis problem is also known as Church’s problem, sinceAlonso Church first defined it in 1962.

Reactive Synthesis (2017/18) 3

Page 11: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Verification versus Synthesis

Verification Workflow: Synthesis Workflow:

The synthesis problem is also known as Church’s problem, sinceAlonso Church first defined it in 1962.

Reactive Synthesis (2017/18) 3

Page 12: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: A Specification

Consider a very simple system with a singlebit of input and a single bit of output.

Our specification is the conjunction of thefollowing three requirements:

1. Whenever the input bit is 1, then the output bit is 1, too.

2. At least one out of every three consecutive output bits is a 1.

3. If there are infinitely many 0’s in the input stream, then thereare infinitely many 0’s in the output stream.

First two requirements can be satisfied by always outputting a 1,but not the third.

How to satisfy all three?

Correct behavior: Every 1 in the input stream is answered by a 1.If input bit is a 0, answer with a 0, unless the last two output bitswere 0: in this case output a 1.

Reactive Synthesis (2017/18) 4

Page 13: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: A Specification

Consider a very simple system with a singlebit of input and a single bit of output.

Our specification is the conjunction of thefollowing three requirements:

1. Whenever the input bit is 1, then the output bit is 1, too.

2. At least one out of every three consecutive output bits is a 1.

3. If there are infinitely many 0’s in the input stream, then thereare infinitely many 0’s in the output stream.

First two requirements can be satisfied by always outputting a 1,but not the third.

How to satisfy all three?

Correct behavior: Every 1 in the input stream is answered by a 1.If input bit is a 0, answer with a 0, unless the last two output bitswere 0: in this case output a 1.

Reactive Synthesis (2017/18) 4

Page 14: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: A Specification

Consider a very simple system with a singlebit of input and a single bit of output.

Our specification is the conjunction of thefollowing three requirements:

1. Whenever the input bit is 1, then the output bit is 1, too.

2. At least one out of every three consecutive output bits is a 1.

3. If there are infinitely many 0’s in the input stream, then thereare infinitely many 0’s in the output stream.

First two requirements can be satisfied by always outputting a 1,but not the third.

How to satisfy all three?

Correct behavior: Every 1 in the input stream is answered by a 1.If input bit is a 0, answer with a 0, unless the last two output bitswere 0: in this case output a 1.

Reactive Synthesis (2017/18) 4

Page 15: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Verification of a Transition System

Correct behavior is implemented by the following system, wherethe label 1/1 stands for “read input 1 and produce output 1”.

s0 s1 s2

1/1

0/0

1/1

0/0

1/1

0/1

Verification: relatively easy (individual transition labels for firstrequirement, analysis of loops for the other two)

However: if an error is found, designer has to fix the system byhand, and may introduce new errors in the process

Reactive Synthesis (2017/18) 5

Page 16: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Verification of a Transition System

Correct behavior is implemented by the following system, wherethe label 1/1 stands for “read input 1 and produce output 1”.

s0 s1 s2

1/1

0/0

1/1

0/0

1/1

0/1

Verification: relatively easy (individual transition labels for firstrequirement, analysis of loops for the other two)

However: if an error is found, designer has to fix the system byhand, and may introduce new errors in the process

Reactive Synthesis (2017/18) 5

Page 17: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Verification of a Transition System

Correct behavior is implemented by the following system, wherethe label 1/1 stands for “read input 1 and produce output 1”.

s0 s1 s2

1/1

0/0

1/1

0/0

1/1

0/1

Verification: relatively easy (individual transition labels for firstrequirement, analysis of loops for the other two)

However: if an error is found, designer has to fix the system byhand, and may introduce new errors in the process

Reactive Synthesis (2017/18) 5

Page 18: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive Synthesis is a Game

Idea: separate system behavior into choices of the environment(for inputs) and the system (for outputs). Encode requirements asa graph and let the two players play a turn-based infinite game.

A winning condition determines which player wins the game, i.e.,is a condition on infinite paths through the game graph.

A strategy of a player is a function that returns a legal next movefor the given player, based on what happened in the game so far.

A winning strategy is a strategy such that the given player willwin the game, regardless of the moves of their opponent.

Reactive Synthesis (2017/18) 6

Page 19: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive Synthesis is a Game

Idea: separate system behavior into choices of the environment(for inputs) and the system (for outputs). Encode requirements asa graph and let the two players play a turn-based infinite game.

A winning condition determines which player wins the game, i.e.,is a condition on infinite paths through the game graph.

A strategy of a player is a function that returns a legal next movefor the given player, based on what happened in the game so far.

A winning strategy is a strategy such that the given player willwin the game, regardless of the moves of their opponent.

Reactive Synthesis (2017/18) 6

Page 20: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive Synthesis is a Game

Idea: separate system behavior into choices of the environment(for inputs) and the system (for outputs). Encode requirements asa graph and let the two players play a turn-based infinite game.

A winning condition determines which player wins the game, i.e.,is a condition on infinite paths through the game graph.

A strategy of a player is a function that returns a legal next movefor the given player, based on what happened in the game so far.

A winning strategy is a strategy such that the given player willwin the game, regardless of the moves of their opponent.

Reactive Synthesis (2017/18) 6

Page 21: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reactive Synthesis is a Game

Idea: separate system behavior into choices of the environment(for inputs) and the system (for outputs). Encode requirements asa graph and let the two players play a turn-based infinite game.

A winning condition determines which player wins the game, i.e.,is a condition on infinite paths through the game graph.

A strategy of a player is a function that returns a legal next movefor the given player, based on what happened in the game so far.

A winning strategy is a strategy such that the given player willwin the game, regardless of the moves of their opponent.

Reactive Synthesis (2017/18) 6

Page 22: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Reactive Synthesis is a Game

Game graph that models the example specification (solid edges modelpicking a 1, dashed edges picking a 0):

b g b g b

r

Winning condition:

never visit red vertex(properties 1 & 2)

if infinitely many bluevertices are visited, theninf. many green verticesare visited (property 3).

Winning strategy for Player 0:

Never move to red vertex

From blue vertex, move to green ifpossible

Resulting input-output behavior:same as system seen before.

Reactive Synthesis (2017/18) 7

Page 23: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Reactive Synthesis is a Game

Game graph that models the example specification (solid edges modelpicking a 1, dashed edges picking a 0):

b g b g b

r

Winning condition:

never visit red vertex(properties 1 & 2)

if infinitely many bluevertices are visited, theninf. many green verticesare visited (property 3).

Winning strategy for Player 0:

Never move to red vertex

From blue vertex, move to green ifpossible

Resulting input-output behavior:same as system seen before.

Reactive Synthesis (2017/18) 7

Page 24: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Reactive Synthesis is a Game

Game graph that models the example specification (solid edges modelpicking a 1, dashed edges picking a 0):

b g b g b

r

Winning condition:

never visit red vertex(properties 1 & 2)

if infinitely many bluevertices are visited, theninf. many green verticesare visited (property 3).

Winning strategy for Player 0:

Never move to red vertex

From blue vertex, move to green ifpossible

Resulting input-output behavior:same as system seen before.

Reactive Synthesis (2017/18) 7

Page 25: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Reactive Synthesis is a Game

Game graph that models the example specification (solid edges modelpicking a 1, dashed edges picking a 0):

b g b g b

r

Winning condition:

never visit red vertex(properties 1 & 2)

if infinitely many bluevertices are visited, theninf. many green verticesare visited (property 3).

Winning strategy for Player 0:

Never move to red vertex

From blue vertex, move to green ifpossible

Resulting input-output behavior:same as system seen before.

Reactive Synthesis (2017/18) 7

Page 26: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Reactive Synthesis is a Game

Game graph that models the example specification (solid edges modelpicking a 1, dashed edges picking a 0):

b g b g b

r

Winning condition:

never visit red vertex(properties 1 & 2)

if infinitely many bluevertices are visited, theninf. many green verticesare visited (property 3).

Winning strategy for Player 0:

Never move to red vertex

From blue vertex, move to green ifpossible

Resulting input-output behavior:same as system seen before.

Reactive Synthesis (2017/18) 7

Page 27: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Reactive Synthesis is a Game

Game graph that models the example specification (solid edges modelpicking a 1, dashed edges picking a 0):

b g b g b

r

Winning condition:

never visit red vertex(properties 1 & 2)

if infinitely many bluevertices are visited, theninf. many green verticesare visited (property 3).

Winning strategy for Player 0:

Never move to red vertex

From blue vertex, move to green ifpossible

Resulting input-output behavior:same as system seen before.

Reactive Synthesis (2017/18) 7

Page 28: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Example: Reactive Synthesis is a Game

Game graph that models the example specification (solid edges modelpicking a 1, dashed edges picking a 0):

b g b g b

r

Winning condition:

never visit red vertex(properties 1 & 2)

if infinitely many bluevertices are visited, theninf. many green verticesare visited (property 3).

Winning strategy for Player 0:

Never move to red vertex

From blue vertex, move to green ifpossible

Resulting input-output behavior:same as system seen before.

Reactive Synthesis (2017/18) 7

Page 29: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

The Buchi-Landweber Theorem

Theorem [BL69]: Every infinite game in a finite graph withω-regular winning condition is determined. Finite-state strategiesare sufficient to win these games, and can be computed effectively.

In particular, this means we can solve Church’s problem:

1. model the specification as

a finite game graph that describes the interactionbetween system and environment, anda winning condition on this graph

2. find a winning strategy for the system player

3. generate a system that implements this strategy

Reactive Synthesis (2017/18) 8

Page 30: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

The Buchi-Landweber Theorem

Theorem [BL69]: Every infinite game in a finite graph withω-regular winning condition is determined. Finite-state strategiesare sufficient to win these games, and can be computed effectively.

In particular, this means we can solve Church’s problem:

1. model the specification as

a finite game graph that describes the interactionbetween system and environment, anda winning condition on this graph

2. find a winning strategy for the system player

3. generate a system that implements this strategy

Reactive Synthesis (2017/18) 8

Page 31: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Overview of Course

Basic Games

Algorithms & Data Structures

Project KickoffProject Submission

Advanced Games

Temporal Logic Synthesis

Project Evaluation

Reactive Synthesis (2017/18) 9

Page 32: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Basic Games

Formalization of basic game-theoretic notions: arena (gamegraph), play, winning condition, strategy, winning strategy

Solving reachability and safety games

Properties of basic games: decidability, determinacy, existence ofpositional (memoryless) strategies

Reactive Synthesis (2017/18) 10

Page 33: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Algorithms & Data Structures

Definition of

algorithms to find winning strategies for a given game,

data structures that allow us to symbolically representproperties of the game that are computed in these algorithms,and

optimizations and heuristics that allow us to find winningstrategies more efficiently.

Reactive Synthesis (2017/18) 11

Page 34: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Project

After second block, students will start their project in which theyimplement their own synthesis tool based on the contents of thecourse so far. This should be done in groups of two students.

In January, first an initial version of the implementation will besubmitted and checked for correctness. After that, we willallow a short time period for bug fixes.

Until the end of January, final versions will be run on a largebenchmark set in a competition. Results of the competition willbe announced in the final lecture.

Reactive Synthesis (2017/18) 12

Page 35: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Advanced Games

More expressive winning conditions: Buchi, Co-Buchi, Parity,LTL

Solving such games

Reactive Synthesis (2017/18) 13

Page 36: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Temporal Logic Synthesis

State-of-the-art algorithms for solving LTL Synthesis:Bounded Synthesis

Reactive Synthesis (2017/18) 14

Page 37: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Organization

Tutorials:

Place: Seminar Room 15 in Building E1.3

Time: Tue either 14:15-16:00 or 16:15-18:00

One problem set per week (except for project weeks), to be solvedin groups of two. Handed out during the lecture, collected beforethe next tutorial.

Exams, Grading:

The final grade will be composed of the project grade (1/3) andthe grade from an exam (2/3).

For admission to the exam, students must obtain 50% of theexercises points from the problem sets during the course.

(Dates for exams will be announced soon)

Reactive Synthesis (2017/18) 15

Page 38: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Registration

If you have not done so, please register onhttps://courses.react.uni-saarland.de/rs1718/

Reactive Synthesis (2017/18) 16

Page 39: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plan for (the Rest of) Today

Basic Games

Arenas, strategies, and gamesReachability and safety games

Algorithms & Data Structures

Advanced Games

Temporal Logic Synthesis

Reactive Synthesis (2017/18) 17

Page 40: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plan for (the Rest of) Today

Basic Games

Arenas, strategies, and gamesReachability and safety games

Algorithms & Data Structures

Advanced Games

Temporal Logic Synthesis

Reactive Synthesis (2017/18) 17

Page 41: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Arenas

DefinitionAn arena A = (V ,V0,V1,E ) consists of

a finite set V of vertices,

disjoint sets V0,V1 ⊆ V withV = V0 ∪ V1 denoting the vertices ofPlayer 0 and Player 1 respectively, and

a set E ⊆ V × V of (directed) edgeswithout terminal vertices, i.e.,{v ′ ∈ V | (v , v ′) ∈ E} is non-emptyfor every v ∈ V .

v4

v1

v3 v5

v7

v0 v2

v6 v8

RemarkThe size of A, denoted by |A|, is defined to be |V |.

Reactive Synthesis (2017/18) 18

Page 42: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Arenas

DefinitionAn arena A = (V ,V0,V1,E ) consists of

a finite set V of vertices,

disjoint sets V0,V1 ⊆ V withV = V0 ∪ V1 denoting the vertices ofPlayer 0 and Player 1 respectively, and

a set E ⊆ V × V of (directed) edgeswithout terminal vertices, i.e.,{v ′ ∈ V | (v , v ′) ∈ E} is non-emptyfor every v ∈ V .

v4

v1

v3 v5

v7

v0 v2

v6 v8

RemarkThe size of A, denoted by |A|, is defined to be |V |.

Reactive Synthesis (2017/18) 18

Page 43: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 44: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 45: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3

v4 v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 46: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3

v4 v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 47: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4

v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 48: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8

v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 49: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5

v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 50: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5 v7

v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 51: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5 v7 v6

· · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 52: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 53: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 54: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Plays

To start a play, a token is placed atsome initial vertex ρ0.

Assume the token is at some vertex ρnwith ρn ∈ Vi . Then, Player i movesthe token to a successor ρn+1 of ρn.

As the arena has no terminal vertices,the players can always make a move.

Hence, the outcome is an infinitesequence of vertices.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Example

v3 v4 v8 v5 v7 v6 · · ·

DefinitionA play in A is an infinite sequence ρ = ρ0ρ1ρ2 · · · ∈ V ω such that(ρn, ρn+1) ∈ E for every n ∈ N.

Reactive Synthesis (2017/18) 19

Page 55: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Strategies

DefinitionA strategy for Player i ∈ {0, 1} in an arena (V ,V0,V1,E ) is afunction σ : V ∗Vi → V such that σ(wv) = v ′ implies (v , v ′) ∈ Efor every w ∈ V ∗ and every v ∈ Vi .

A play ρ0ρ1ρ2 · · · is consistent with σ if ρn+1 = σ(ρ0 · · · ρn) forevery n ∈ N with ρn ∈ Vi .

Example

Consider the following strategy:

σ(wv1) = v0

σ(wv3) = v6

σ(wv7) = v6

σ(wv8) = v5

v0v1v0v1v0v3(v6v7)ω is consistent with σ.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Reactive Synthesis (2017/18) 20

Page 56: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Strategies

DefinitionA strategy for Player i ∈ {0, 1} in an arena (V ,V0,V1,E ) is afunction σ : V ∗Vi → V such that σ(wv) = v ′ implies (v , v ′) ∈ Efor every w ∈ V ∗ and every v ∈ Vi .

A play ρ0ρ1ρ2 · · · is consistent with σ if ρn+1 = σ(ρ0 · · · ρn) forevery n ∈ N with ρn ∈ Vi .

Example

Consider the following strategy:

σ(wv1) = v0

σ(wv3) = v6

σ(wv7) = v6

σ(wv8) = v5

v0v1v0v1v0v3(v6v7)ω is consistent with σ.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Reactive Synthesis (2017/18) 20

Page 57: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Strategies

DefinitionA strategy for Player i ∈ {0, 1} in an arena (V ,V0,V1,E ) is afunction σ : V ∗Vi → V such that σ(wv) = v ′ implies (v , v ′) ∈ Efor every w ∈ V ∗ and every v ∈ Vi .

A play ρ0ρ1ρ2 · · · is consistent with σ if ρn+1 = σ(ρ0 · · · ρn) forevery n ∈ N with ρn ∈ Vi .

Example

Consider the following strategy:

σ(wv1) = v0

σ(wv3) = v6

σ(wv7) = v6

σ(wv8) = v5

v0v1v0v1v0v3(v6v7)ω is consistent with σ.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Reactive Synthesis (2017/18) 20

Page 58: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Games

DefinitionA game G = (A,Win) consists of an arena A with vertex set Vand a winning condition Win ⊆ V ω.

Player 0 wins a play ρ if ρ ∈Win; otherwise, Player 1 wins ρ.

DefinitionA strategy σ for Player i is a winning strategy for G from avertex v if every play that is consistent with σ and starts in v iswinning for Player i .

Reactive Synthesis (2017/18) 21

Page 59: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Games

DefinitionA game G = (A,Win) consists of an arena A with vertex set Vand a winning condition Win ⊆ V ω.

Player 0 wins a play ρ if ρ ∈Win; otherwise, Player 1 wins ρ.

DefinitionA strategy σ for Player i is a winning strategy for G from avertex v if every play that is consistent with σ and starts in v iswinning for Player i .

Reactive Synthesis (2017/18) 21

Page 60: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

An Example

v4

v1

v3 v5

v7

v0 v2

v6 v8

Win = {ρ0ρ1ρ2 · · · ∈ V ω | ∃v ∈ V such that ρn 6= v for all n}

A winning strategy for Player 0 from every vertex:

σ(wv1) = v0

σ(wv3) = v4

σ(wv7) = v8

σ(wv8) = v5

Reactive Synthesis (2017/18) 22

Page 61: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

An Example

v4

v1

v3 v5

v7

v0 v2

v6 v8

Win = {ρ0ρ1ρ2 · · · ∈ V ω | ∃v ∈ V such that ρn 6= v for all n}

A winning strategy for Player 0 from every vertex:

σ(wv1) = v0

σ(wv3) = v4

σ(wv7) = v8

σ(wv8) = v5

Reactive Synthesis (2017/18) 22

Page 62: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

An Example

v4

v1

v3 v5

v7

v0 v2

v6 v8

Win = {ρ0ρ1ρ2 · · · ∈ V ω | ∃v ∈ V such that ρn 6= v for all n}

A winning strategy for Player 0 from every vertex:

σ(wv1) = v0

σ(wv3) = v4

σ(wv7) = v8

σ(wv8) = v5

Reactive Synthesis (2017/18) 22

Page 63: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Determinacy

NotationWi (G) = {v ∈ V | Player i has winning strategy for G from v}:the winning region of Player i in G.

LemmaWe have W0(G) ∩W1(G) = ∅ for every game G.

Proof.On the blackboard.

DefinitionA game G with vertex set V is determined if W0(G) ∪W1(G) = V .

Reactive Synthesis (2017/18) 23

Page 64: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Determinacy

NotationWi (G) = {v ∈ V | Player i has winning strategy for G from v}:the winning region of Player i in G.

LemmaWe have W0(G) ∩W1(G) = ∅ for every game G.

Proof.On the blackboard.

DefinitionA game G with vertex set V is determined if W0(G) ∪W1(G) = V .

Reactive Synthesis (2017/18) 23

Page 65: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Determinacy

NotationWi (G) = {v ∈ V | Player i has winning strategy for G from v}:the winning region of Player i in G.

LemmaWe have W0(G) ∩W1(G) = ∅ for every game G.

Proof.On the blackboard.

DefinitionA game G with vertex set V is determined if W0(G) ∪W1(G) = V .

Reactive Synthesis (2017/18) 23

Page 66: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Algorithmic Problems

Solving a gameGiven (a finite representation of) a game G = (A,Win), determinethe winning regions Wi (G) and (finite representations of) corres-ponding winning strategies.

Questions

1. How do we represent Win finitely?

2. How do we represent (winning) strategies finitely?

Reactive Synthesis (2017/18) 24

Page 67: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Algorithmic Problems

Solving a gameGiven (a finite representation of) a game G = (A,Win), determinethe winning regions Wi (G) and (finite representations of) corres-ponding winning strategies.

Questions

1. How do we represent Win finitely?

2. How do we represent (winning) strategies finitely?

Reactive Synthesis (2017/18) 24

Page 68: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Positional Strategies

A strategy σ : V ∗Vi → V is an infinite object.

Often strategies are finitely representable.

Recall the last example:

σ(wv1) = v0

σ(wv3) = v4

σ(wv7) = v8

σ(wv8) = v5

The output σ(wv) only depends on the input’s last vertex v .

DefinitionA strategy σ for Player i is positional (or memoryless) ifσ(wv) = σ(v) for all w ∈ V ∗ and all v ∈ Vi .

NotationWe write σ : Vi → V instead of σ : V ∗Vi → V , if σ is positional.

Reactive Synthesis (2017/18) 25

Page 69: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Positional Strategies

A strategy σ : V ∗Vi → V is an infinite object.

Often strategies are finitely representable.

Recall the last example:

σ(wv1) = v0

σ(wv3) = v4

σ(wv7) = v8

σ(wv8) = v5

The output σ(wv) only depends on the input’s last vertex v .

DefinitionA strategy σ for Player i is positional (or memoryless) ifσ(wv) = σ(v) for all w ∈ V ∗ and all v ∈ Vi .

NotationWe write σ : Vi → V instead of σ : V ∗Vi → V , if σ is positional.

Reactive Synthesis (2017/18) 25

Page 70: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Positional Strategies

A strategy σ : V ∗Vi → V is an infinite object.

Often strategies are finitely representable.

Recall the last example:

σ(wv1) = v0

σ(wv3) = v4

σ(wv7) = v8

σ(wv8) = v5

The output σ(wv) only depends on the input’s last vertex v .

DefinitionA strategy σ for Player i is positional (or memoryless) ifσ(wv) = σ(v) for all w ∈ V ∗ and all v ∈ Vi .

NotationWe write σ : Vi → V instead of σ : V ∗Vi → V , if σ is positional.

Reactive Synthesis (2017/18) 25

Page 71: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Positional Strategies

A strategy σ : V ∗Vi → V is an infinite object.

Often strategies are finitely representable.

Recall the last example:

σ(wv1) = v0

σ(wv3) = v4

σ(wv7) = v8

σ(wv8) = v5

The output σ(wv) only depends on the input’s last vertex v .

DefinitionA strategy σ for Player i is positional (or memoryless) ifσ(wv) = σ(v) for all w ∈ V ∗ and all v ∈ Vi .

NotationWe write σ : Vi → V instead of σ : V ∗Vi → V , if σ is positional.

Reactive Synthesis (2017/18) 25

Page 72: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Winning Conditions

Typically, winning conditions Win are obtained from acceptanceconditions for ω-automata or from specification logics, whichspecify Win by finite objects (sets of vertices, labelings of vertices,formulas, etc.)

Automata theoretic conditions:

Reachability and SafetyBuchi and co-BuchiParityRabin, Streett, and Muller

Specification Logics:

Linear Temporal Logic (LTL)several industrial logics based on LTL

Reactive Synthesis (2017/18) 26

Page 73: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Winning Conditions

Typically, winning conditions Win are obtained from acceptanceconditions for ω-automata or from specification logics, whichspecify Win by finite objects (sets of vertices, labelings of vertices,formulas, etc.)

Automata theoretic conditions:

Reachability and SafetyBuchi and co-BuchiParityRabin, Streett, and Muller

Specification Logics:

Linear Temporal Logic (LTL)several industrial logics based on LTL

Reactive Synthesis (2017/18) 26

Page 74: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Winning Conditions

Typically, winning conditions Win are obtained from acceptanceconditions for ω-automata or from specification logics, whichspecify Win by finite objects (sets of vertices, labelings of vertices,formulas, etc.)

Automata theoretic conditions:

Reachability and SafetyBuchi and co-BuchiParityRabin, Streett, and Muller

Specification Logics:

Linear Temporal Logic (LTL)several industrial logics based on LTL

Reactive Synthesis (2017/18) 26

Page 75: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Safety Games

A foundational winning condition: staying safe.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Player 0 wins a play, if only safe vertices (marked by double line)are visited.

Reactive Synthesis (2017/18) 27

Page 76: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Safety Games

A foundational winning condition: staying safe.

v4

v1

v3 v5

v7

v0 v2

v6 v8

v4

v1

v3 v5

v7

v0 v2

v6 v8

Player 0 wins a play, if only safe vertices (marked by double line)are visited.

Reactive Synthesis (2017/18) 27

Page 77: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Safety Games

NotationOcc(ρ) := {v ∈ V | ρn = v for some n}: the set of verticesoccurring in ρ.

DefinitionLet A = (V ,V0,V1,E ) be an arena and let S ⊆ V be a subset ofA’s vertices. Then, the safety condition Safety(S) is defined as

Safety(S) := {ρ ∈ V ω | Occ(ρ) ⊆ S}.

We call a game G = (A,Safety(S)) a safety game.

Reactive Synthesis (2017/18) 28

Page 78: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reachability Games

Another foundational winning condition: reaching a goal.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Player 0 wins a play, if at least one goal vertex (marked by doubleline) is visited.

Reactive Synthesis (2017/18) 29

Page 79: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reachability Games

Another foundational winning condition: reaching a goal.

v4

v1

v3 v5

v7

v0 v2

v6 v8

Player 0 wins a play, if at least one goal vertex (marked by doubleline) is visited.

Reactive Synthesis (2017/18) 29

Page 80: Reactive Synthesis - courses.react.uni-saarland.de · Reactive Systems Systems that react to environment inputs in potentially in nite executions Properties of reactive systems: in

Reachability Games

DefinitionLet A = (V ,V0,V1,E ) be an arena and let R ⊆ V be a subset ofA’s vertices. Then, the reachability condition Reach(R) isdefined as

Reach(R) := {ρ ∈ V ω | Occ(ρ) ∩ R 6= ∅}.

We call a game G = (A,Reach(R)) a reachability game.

Reactive Synthesis (2017/18) 30