AA228V/CS238V
Validation of Safety-Critical Systems
Lecture 04: Property Specification
Sydney Katz (smkatz@stanford.edu)
Property specification allows us to formally specify what a system should do.
Properties of Systems
System Behavior
Real Number
Metrics
Boolean Value
Specifications
Properties of Systems
Sometimes we derive specifications from metrics.
metric:
miss distance between our
aircraft and intruder aircraft
Properties of Systems
Sometimes we derive specifications from metrics.
metric:
miss distance between our
aircraft and intruder aircraft
specification:
the miss distance must be
greater than 50 meters
Properties of Systems
Sometimes we derive specifications from metrics.
Sometimes we derive metrics from specifications.
metric:
miss distance between our
aircraft and intruder aircraft
specification:
the miss distance must be
greater than 50 meters
metric:
probability that the miss distance
is greater than 50 meters
Properties of Systems
single trajectory
multiple trajectories
Plan for Today
1
Properties of Systems
2
Metrics
3
Specifications
4
Reachability
Metricsfor Stochastic Systems
distribution over trajectories:
distribution over trajectories:
distribution over miss distances
expected miss
distance
Note: if is a binary metric, the
expectation will be a probability.
Note: more on this in chapter 7!
Expected value often is not enough to summarize a distribution.
expected miss
distance
expected miss
distance
expected miss
distance
These distributions have the same expected value but differ in their variance.
In safety-critical settings, we often want more conservative metrics that focus on worst-case outcomes.
In safety-critical settings, we often want more conservative metrics that focus on worst-case outcomes.
Risk metric: metric in which higher values indicate worse outcomes.
In safety-critical settings, we often want more conservative metrics that focus on worst-case outcomes.
Risk metric: metric in which higher values indicate worse outcomes.
e.g. loss of separation:
In safety-critical settings, we often want more conservative metrics that focus on worst-case outcomes.
Risk metric: metric in which higher values indicate worse outcomes.
e.g. loss of separation:
expected value
most risky
least risky
value at risk (VaR)
high VaR
low VaR
The value at risk (VaR) is the highest value that the risk is guaranteed not to exceed with probability .
i.e. the -quantile of the distribution over the risk metric
In safety-critical settings, we often want more conservative metrics that focus on worst-case outcomes.
Risk metric: metric in which higher values indicate worse outcomes.
e.g. loss of separation:
expected value
most risky
least risky
value at risk (VaR)
high VaR
low VaR
conditional value at risk (CVaR)
i.e. the mean of the top -quantile risks
high CVaR
low CVaR
Some intuition for VaR and CVaR
value at risk (VaR)
conditional value at risk (CVaR)
“What is the value that the risk is guaranteed
not to exceed with probability 0.7?”

The higher this value is, the worse the situation.
“I don’t just want the expected value - I want the
expected value of the worst-case outcomes.”

The higher this value is, the worse the situation.
Some intuition for VaR and CVaR
α0.700
Expected value1600 m
VaR— m
CVaR— m
CompositeMetrics
Metrics are often at odds with one another.
A system design is Pareto optimal if we cannot improve one metric without worsening another.
Pareto optimal?
Metrics are often at odds with one another.
A system design is Pareto optimal if we cannot improve one metric without worsening another.
Pareto optimal?
Metrics are often at odds with one another.
A system design is Pareto optimal if we cannot improve one metric without worsening another.
The Pareto frontier is the subset of all designs that are Pareto optimal.
Metrics are often at odds with one another.
Composite metrics allow us to create a single metric to select a point on the Pareto frontier.
A system design is Pareto optimal if we cannot improve one metric without worsening another.
The Pareto frontier is the subset of all designs that are Pareto optimal.
Metrics are often at odds with one another.
Composite metrics allow us to create a single metric to select a point on the Pareto frontier.
Metrics are often at odds with one another.
Composite metrics allow us to create a single metric to select a point on the Pareto frontier.
Weighted Sum Method:
Metrics are often at odds with one another.
Composite metrics allow us to create a single metric to select a point on the Pareto frontier.
Weighted Sum Method:
Metrics are often at odds with one another.
Composite metrics allow us to create a single metric to select a point on the Pareto frontier.
Goal Distance Metric:
Metrics are often at odds with one another.
Composite metrics allow us to create a single metric to select a point on the Pareto frontier.
Goal Distance Metric:
Why not combine the two?
Weighted Exponential Sum Metric:
How do we pick the weights?
How do we pick the weights?
One option is preference elicitation.
Candy Example
We want to learn a weight vector over the following three candies:
1.  M&Ms
2.  Sour Patch Kids
3.  Skittles
We will do so using pairwise queries.
Candy Example
Since , we can plot the set of possible weights using only and .
ruled out
Query 1: Which do you prefer?
M&MsSour Patch KidsSkittles 136 712
Candy Example
Vectors list
You prefer Query 1 Query 2 Query 3 Query 4
ruled out
Candy Example
Pick a weight estimate consistent with your answers:
0.33
0.33
0.33
You can also drag the point on the plot.
Query 5:
We infer that you prefer:a
This estimate is inconsistent with your answers.
Candy Example
In this case, we preselected the queries. We would probably do better if we selected the queries as we went to maximize the amount of information they provide! (lots of research on preference-based learning, beyond the scope of this class)
We also assumed that the expert was perfectly rational. It is common to relax this assumption and instead compute a distribution over the weights. (beyond the scope of this class)
Plan for Today
1
Properties of Systems
2
Metrics
3
Specifications
4
Reachability
LogicalSpecifications
LogicalSpecifications
A logical specification formally defines an operating requirement for a system using a logical formula.
LogicalSpecifications
A logical specification formally defines an operating requirement for a system using a logical formula.
A logical formula is a precise expression that evaluates to either true or false.
Propositional Logic
Propositional Logic
A proposition is a statement that evaluates to either true or false.
An atomic proposition is a proposition that cannot be broken down further.
Propositional Logic
A proposition is a statement that evaluates to either true or false.
An atomic proposition is a proposition that cannot be broken down further.
proposition
Propositional Logic
A proposition is a statement that evaluates to either true or false.
An atomic proposition is a proposition that cannot be broken down further.
proposition
atomic proposition
atomic proposition
atomic proposition
“A and B and not C”
Propositional Logic
Negation (“not”)
true
false
false
true
Conjunction (“and”)
true
true
true
true
false
false
false
true
false
false
false
false
Disjunction (“or”)
true
true
true
true
false
true
false
true
true
false
false
false
Implication (“if-then”)
true
true
true
true
false
false
false
true
true
false
false
true
Biconditional (“if and only if”)
true
true
true
true
false
false
false
true
false
false
false
true
Propositional Logic
Example
Express the following statement using propositional logic:
“If the agent is in a safe state, then the agent is not in a collision state”
Atomic propositions:
: the agent is in a safe state
: the agent is in a collision state
Propositional Logic
Propositional Logic
First-Order Logic
First-Order Logic
First-order logic adds variables, predicates, and quantifiers to propositional logic.
First-Order Logic
First-order logic adds variables, predicates, and quantifiers to propositional logic.
variable: object in a domain
e.g. let the variable represent the state of an agent
First-Order Logic
First-order logic adds variables, predicates, and quantifiers to propositional logic.
variable: object in a domain
e.g. let the variable represent the state of an agent
predicate: function that evaluates propositions over variables
e.g. the predicate returns true if the agent is in a safe state,
and the predicate returns true if the agent is in a collision state.
Example
“If the agent is in a safe state, then the agent is not in a collision state”
First-Order Logic
First-order logic adds variables, predicates, and quantifiers to propositional logic.
quantifiers allow us to evaluate propositions over a collection of variables
Universal Quantifier (“for all”): all variables must satisfy the proposition.
e.g. “all states are safe states” is written as
Existential Quantifier (“there exists”): at least one variable in the domain satisfies the proposition.
e.g. “at least one state is a safe state” is written as
First-Order Logic
Example
“for all states in the trajectory, the
agent does not hit an obstacle”
: is an obstacle state
First-Order Logic
Example
“the agent must reach a goal state and
avoid the obstacle state.”
: is an obstacle state
: is a goal state
Propositional Logic
First-Order Logic
Propositional Logic
First-Order Logic
Temporal Logic
Temporal Logic
Temporal logic extends first-order logic to specify properties over time.
Linear
Temporal Logic
Properties over linear sequences of states:
“always ”
\square
“ is true at all time
steps in the future”
“eventually ”
\lozenge
“ is true at some time
step in the future”
“ until ”
“ is true at some time step in
the future and is true at least
until becomes true.”
Linear
Temporal Logic
Example
“eventually reach the goal after
passing through the checkpoint and
always avoid the obstacle”
the state at time contains an obstacle
the state at time is the goal
the state at time is the checkpoint
eventually
reach the goal
Linear
Temporal Logic
Example
“eventually reach the goal after
passing through the checkpoint and
always avoid the obstacle”
the state at time contains an obstacle
the state at time is the goal
the state at time is the checkpoint
don’t reach the
goal until you
have reached
the checkpoint
Linear
Temporal Logic
Example
“eventually reach the goal after
passing through the checkpoint and
always avoid the obstacle”
the state at time contains an obstacle
the state at time is the goal
the state at time is the checkpoint
always don’t be
in the obstacle
Linear
Temporal Logic
Example
“eventually reach the goal after
passing through the checkpoint and
always avoid the obstacle”
the state at time contains an obstacle
the state at time is the goal
the state at time is the checkpoint
A pink slide!
Just to wake you up.
Signal
Linear
Temporal Logic
Signal
Linear
Temporal Logic
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Time
Value
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Time
Value
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Time
Value
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Time
Value
1
2
allows us to specify properties over a time interval
e.g.
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Time
Value
1
2
allows us to specify properties over a time interval
e.g.
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Time
Value
1
2
allows us to specify properties over a time interval
allows us to map real-valued signals to truth values: is true if
Signal
Temporal Logic
extends linear temporal logic to real-valued signals
Time
Value
1
2
allows us to specify properties over a time interval
allows us to map real-valued signals to truth values: is true if
A white slide!
A white slide!
To wake you up and show you a table.
Important stuff we will use for the rest of the course about to happen!
i.e. is true if
i.e. is true if
i.e. is true if
This:
feels different from this:
This:
feels different from this:
i.e. is true if
Robustness
Failure
Success
feeling
pretty safe
😎
i.e. is true if
Robustness
Failure
Success
feeling
pretty safe
😎
i.e. is true if
Robustness
Failure
Success
almost
failing
😅
i.e. is true if
Robustness
Failure
Success
just barely
failed
😔
i.e. is true if
Robustness
Failure
Success
not even
close
😩
i.e. is true if
Robustness
Failure
Success
i.e. is true if
Robustness
Failure
Success
i.e. is true if
Robustness of propositional
logic operators:
i.e. is true if
Robustness of propositional
logic operators:
i.e. is true if
i.e. is true if
Robustness of propositional
logic operators:
i.e. is true if
i.e. is true if
Robustness of propositional
logic operators:
i.e. is true if
i.e. is true if
Robustness of propositional
logic operators:
i.e. is true if
i.e. is true if
Robustness of propositional
logic operators:
i.e. is true if
i.e. is true if
Robustness of propositional
logic operators:
Note: derive the last one
in book exercises!
Robustness of Temporal Operators
i.e. is true if
i.e. is true if
Robustness of Temporal Operators
i.e. is true if
i.e. is true if
Note: think about this
as an exercise.
Yay! But there is still one problem we need to solve:
Yay! But there is still one problem we need to solve:
Later in this course, we will want to take the gradient of the robustness with respect to the trajectory inputs.
Yay! But there is still one problem we need to solve:
Later in this course, we will want to take the gradient of the robustness with respect to the trajectory inputs.
But all those maxes and mins in the robustness formulas result in not-so-nice gradients.
Propositional Operators
Temporal Operators
i.e. is true if
i.e. is true if
This is not a very interesting or useful gradient.
The fix: smooth robustness
The fix: smooth robustness
smooth robustness replaces the min and max operators in softmin and softmax
mean
true min
or max
Smooth robustness
0.0
3.00
Plan for Today
1
Properties of Systems
2
Metrics
3
Specifications
4
Reachability
Reachability
Target Set
Reachability
true if and false otherwise
Target Set
Reachability
true if and false otherwise
Reachability
true if and false otherwise
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
This formulation fails to take into account that both the checkpoint and goal must be reached and that they must be reached in a particular order.
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
This formulation fails to take into account that both the checkpoint and goal must be reached and that they must be reached in a particular order.
augment the state of the system
grid cell
if , the checkpoint has not been reached yet
if , the checkpoint has been reached
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
augment the state of the system
grid cell
if , the checkpoint has not been reached yet
if , the checkpoint has been reached
There is a principled way to do this conversion
for LTL specifications!
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Reachability
true if and false otherwise
System
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Product System
State
Transitions
Reachability
true if and false otherwise
System
the robot reaches the goal
the robot reaches the checkpoint
Büchi Automaton
¬C ∧ GC ∧ ¬GC ∧ GG¬C ∧ ¬G⊤¬G⊤q1q2q3q4Accepting State
Product System
State
Transitions
Plan for Today
1
Properties of Systems
2
Metrics
3
Specifications
4
Reachability