Refactoring, Refinement, and Reasoning A Logical Characterization - - PowerPoint PPT Presentation

refactoring refinement and reasoning
SMART_READER_LITE
LIVE PREVIEW

Refactoring, Refinement, and Reasoning A Logical Characterization - - PowerPoint PPT Presentation

Introduction Refactoring Refactoring Operations Conclusion Refactoring, Refinement, and Reasoning A Logical Characterization for Hybrid Systems Stefan Mitsch 1 , 2 Jan-David Quesel 1 e Platzer 1 Andr 1 Computer Science Department, Carnegie


slide-1
SLIDE 1

Introduction Refactoring Refactoring Operations Conclusion

Refactoring, Refinement, and Reasoning

A Logical Characterization for Hybrid Systems Stefan Mitsch1,2 Jan-David Quesel1 Andr´ e Platzer1

1Computer Science Department, Carnegie Mellon University 2Cooperative Information Systems, Johannes Kepler University

May 14, 2014

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 1 of 14

slide-2
SLIDE 2

Introduction Refactoring Refactoring Operations Conclusion

Hybrid Systems

Hybrid Systems are Challenging

◮ Computation + Physical behavior ◮ Sensor uncertainty ◮ Disturbance ◮ Computation delay ◮ Many components

1 2 3 4 5 6 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5

2 4 6 8 10 t 0.8 0.6 0.4 0.2 0.2

a

2 4 6 8 10 t 0.2 0.4 0.6 0.8 1.0v 2 4 6 8 10 t 2 4 6 8

p

px py

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 2 of 14

slide-3
SLIDE 3

Introduction Refactoring Refactoring Operations Conclusion

Hybrid Systems

Hybrid Systems are Challenging

◮ Computation + Physical behavior ◮ Sensor uncertainty ◮ Disturbance ◮ Computation delay ◮ Many components

1 2 3 4 5 6 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5

2 4 6 8 10 t 0.8 0.6 0.4 0.2 0.2

a

2 4 6 8 10 t 0.2 0.4 0.6 0.8 1.0v 2 4 6 8 10 t 2 4 6 8

p

px py

Challenge Hybrid systems are almost impossible to get right without proper analysis Formal verification

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 2 of 14

slide-4
SLIDE 4

Introduction Refactoring Refactoring Operations Conclusion

Formal Verification

Hybrid System Theorem Proving

◮ Symbolic execution of model ◮ Model structure reflected in proof ◮ Correctness properties

Safety Always stay safe Liveness Ultimately complete a task

Our Tools

KeYmaera Hybrid systems theorem prover Sϕnx Hybrid systems modeling proof α β model α β proof α β γ β model α β γ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 3 of 14

slide-5
SLIDE 5

Introduction Refactoring Refactoring Operations Conclusion

Iterative Development

Hybrid Systems Theorem Proving is Challenging

◮ Differential equations ◮ Complicated arithmetic

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 4 of 14

slide-6
SLIDE 6

Introduction Refactoring Refactoring Operations Conclusion

Iterative Development

Hybrid Systems Theorem Proving is Challenging

◮ Differential equations ◮ Complicated arithmetic

Manage complexity

◮ Start simple — verify

proof α β model α β

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 4 of 14

slide-7
SLIDE 7

Introduction Refactoring Refactoring Operations Conclusion

Iterative Development

Hybrid Systems Theorem Proving is Challenging

◮ Differential equations ◮ Complicated arithmetic

Manage complexity

◮ Start simple — verify ◮ Improve — verify — repeat

proof α β model α β proof α β γ β model α β γ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 4 of 14

slide-8
SLIDE 8

Introduction Refactoring Refactoring Operations Conclusion

Iterative Development

Hybrid Systems Theorem Proving is Challenging

◮ Differential equations ◮ Complicated arithmetic

Manage complexity

◮ Start simple — verify ◮ Improve — verify — repeat

proof α β model α β proof α β γ β model α β γ Challenge Proof-aware refactoring instead of reverification on every change (retain soundness without redoing the proof)

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 4 of 14

slide-9
SLIDE 9

Introduction Refactoring Refactoring Operations Conclusion

Proof-aware Refactoring

Refactoring Operation

◮ Transforms a source model into a refactored model ◮ Syntactic rewriting rule

For example conditions α; β (α ∪ γ); β source α β refactored α β γ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 5 of 14

slide-10
SLIDE 10

Introduction Refactoring Refactoring Operations Conclusion

How to Retain Soundness

Structural Refactoring

Always retains soundness proof α β γ β model α γ β β ≡ proof α β γ β model α β γ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 6 of 14

slide-11
SLIDE 11

Introduction Refactoring Refactoring Operations Conclusion

How to Retain Soundness

Structural Refactoring

Always retains soundness proof α β γ β model α γ β β ≡ proof α β γ β model α β γ

Behavioral Refactoring

Proof patch retains soundness proof α β model α β patch proof α β γ β model α β γ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 6 of 14

slide-12
SLIDE 12

Introduction Refactoring Refactoring Operations Conclusion

Patching Necessity by Correctness Property

Add Behavior

liveness safety model α β reuse patch ⊑V liveness safety model α β γ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 7 of 14

slide-13
SLIDE 13

Introduction Refactoring Refactoring Operations Conclusion

Patching Necessity by Correctness Property

Add Behavior Remove Behavior

liveness safety model α β reuse patch ⊑V liveness safety model α β γ liveness safety model α β patch reuse ⊒V liveness safety model α β γ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 7 of 14

slide-14
SLIDE 14

Introduction Refactoring Refactoring Operations Conclusion

Patching Necessity by Correctness Property

Add Behavior Remove Behavior

liveness safety model α β reuse patch ⊑V liveness safety model α β γ liveness safety model α β patch reuse ⊒V liveness safety model α β γ Projective Relational Refinement α ⊑V γ iff ρ(α)|V ⊆ ρ(γ)|V ρ(α) reachability relation of α α, γ hybrid systems models V ⊆ Σ relevant set of variables |V projection of relations or states to the variables in V

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 7 of 14

slide-15
SLIDE 15

Introduction Refactoring Refactoring Operations Conclusion

Sound Refactoring Catalog

Structural Refactorings

◮ Extract Common Program ◮ Extract Continuous

Dynamics

◮ Drop Implied Evolution

Domain Constraint

Behavioral Refactorings

◮ Introduce Control Path ◮ Introduce Complementary

Continuous Dynamics

◮ Event- to Time-Triggered

Architecture

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 8 of 14

slide-16
SLIDE 16

Introduction Refactoring Refactoring Operations Conclusion

Extract Common Program

Motivation Reduce model duplication Mechanics (R1)

(α; γ) ∪ (β; γ) (α ∪ β); γ

α β γ γ extract (R1) α β γ

Variation Inline program (R2)

(α ∪ β); γ (α; γ) ∪ (β; γ)

Proof patch

Safety None Liveness None

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 9 of 14

slide-17
SLIDE 17

Introduction Refactoring Refactoring Operations Conclusion

Introduce Control Path

Motivation Add control decisions Mechanics (R3)

α; β (α ∪ γ); β

α β introduce (R3) α γ β

Variation Remove Control Path (R4)

(α ∪ γ); β α; β

Proof patch

Safety Prove safety of the added branch Liveness None

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 10 of 14

slide-18
SLIDE 18

Event Clock

Introduction Refactoring Refactoring Operations Conclusion

Event- to Time-Triggered Architecture

Motivation Derive a time-triggered controller Mechanics (R5)

α; (x′ = θ & F ∧ ψ) (?[α; c := 0; η]ψ; α); c := 0; η

α γ ≡ (x′

1 = θ1, . . . , x′ n = θn & F ∧ ψ)

β ∗ event- to time-triggered (R5) ?

  • [α; c := 0; η]ψ
  • α

?

  • [β; c := 0; η]ψ
  • β

c := 0 η ≡ (x′

1 = θ1, . . . , x′ n = θn,

c′ = 1 & F ∧ c ≤ ε) ∗

Proof Patch

Safety Composes several refactorings + prove safety of derived tests

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 11 of 14

slide-19
SLIDE 19

Introduction Refactoring Refactoring Operations Conclusion

Summary

Benefits of Proof-aware Refactorings

◮ easier to evolve correct systems ◮ easier to get simple systems correct ◮ still want to handle complex systems, but not pay the price of

reverification

◮ co-evolve model and proof

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 12 of 14

slide-20
SLIDE 20

Introduction Refactoring Refactoring Operations Conclusion

Future Work

Refactoring Catalog

◮ Pull and merge tests ◮ Weaken/strengthen test ◮ Switch sequence ◮ Introduce computation delay ◮ Introduce uncertainty ◮ Introduce disturbance ◮ Change norm (2/∞ norm) ◮ . . .

Theory

◮ Liveness proof patches ◮ Distance measurement ◮ Refinement based on games

Implementation

◮ Sϕnx and KeYmaera ◮ Background proving

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 13 of 14

slide-21
SLIDE 21

Introduction Refactoring Refactoring Operations Conclusion

Thank you!

Stefan Mitsch smitsch@cs.cmu.edu http://www.cs.cmu.edu/∼smitsch

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 14 of 14

slide-22
SLIDE 22

Proofs Examples

Extract Continuous Dynamics

(R6) ∀v ∈ V (θ) ∪

i∈I V (ϑi). v ∈ BV (D(θ)) ∪ i∈I BV (D(ϑi))

  • i∈I
  • αi; (v ′ = θ, w ′ = ϑi)
  • i∈I(αi; x := ϑi)
  • ; (v ′ = θ, w ′ = x)
  • (R7)
  • i∈I(αi; x := ϑi)
  • ; (v ′ = θ, w ′ = x)
  • i∈I
  • αi; (v ′ = θ, w ′ = ϑi)
  • α

v′ = θ, w′ = ϑ1 β v′ = θ, w′ = ϑ2 extract (R6) inline (R7) α x := ϑ1 β x := ϑ2 v′ = θ, w′ = x

Proof obligations

None, because the original program and the refactored program are

  • bservationally equivalent.

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 1 of 6

slide-23
SLIDE 23

Proofs Examples

Drop Implied Evolution Domain Constraint

(R8) F → H F → [x′ = θ & G]H ?F; x′ = θ & G ∧ H ?F; x′ = θ & G (R9) ?F; x′ = θ & G ?F; x′ = θ & G ∧ H (R10) ?F; x′ = θ & G ∧ H ?F; x′ = θ & G (R11) F → H F → [x′ = θ & G]H ?F; x′ = θ & G ?F; x′ = θ & G ∧ H

?F x′ = θ & G ∧ H | = F → H θ preserves H drop (R8)/(R10) introduce (R9)/(R11) ?F x′ = θ & G

Proof obligations

Liveness None, because projective partial refinement, i. e.,

  • ?F; x′ = θ & G ∧ H
  • ⊑V

F

  • ?F; x′ = θ & G
  • holds.

Safety Show that H is a differential invariant

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 2 of 6

slide-24
SLIDE 24

Proofs Examples

Introduce Complementary Continuous Dynamics

(R12) α; x′ = θ & F α; (x′ = θ & F ∪ x′ = θ & ∼F)

α x′ = θ & F

  • compl. (R12)

α x′ = θ & F x′ = θ & ∼F

Proof obligations

Liveness None Safety Show that the controller with subsequent complementary dynamics only reaches states that are already reachable with the original dynamics, i. e., show

  • α; x′ = θ & ∼FΥV
  • α; x′ = θ & FΥV
  • Stefan Mitsch, Jan-David Quesel, Andr´

e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 3 of 6

slide-25
SLIDE 25

Proofs Examples

Example: Introduce Moderate Braking

ctrl ?Safe a := Amax ?v = 0 a := 0 a := −Bmax t := 0 x′ = v, v′ = a, t′ = 1 & v ≥ 0 ∧ t ≤ ε ∗ introduce control path ctrl . . . ?x +

v2 Bmax ≤ S

a := − Bmax

2

t := 0 x′ = v, v′ = a, t′ = 1 & v ≥ 0 ∧ t ≤ ε ∗

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 4 of 6

slide-26
SLIDE 26

Proofs Examples

Introduce Moderate Braking: Auxiliary Safety Proof

axφ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ

prove new branch φ ⊢ [Br ][P]φ

Wlφ, [A ∪ C ∪ B][P]φ ⊢ [Br ][P]φ ∧r

φ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;]

φ, [(A ∪ C ∪ B); P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

∀l,∀l

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;],[∪]

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [(A ∪ C ∪ B ∪ Br ); P]φ

expand

φ, ∀x∀v (φ → [car]φ) ⊢ [ car]φ

. . . ∗

axφ, ∀x∀v(φ → [car]φ) ⊢ φ ∧ ∀x∀v(φ → [car]φ) [] gen

φ, ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

∧l φ ∧ ∀x∀v(φ → [car]φ) ⊢ [

car](φ ∧ ∀x∀v(φ → [car]φ))

expand

I(φ) ⊢ [ car]I(φ) ∗

axI(φ) ⊢ I(φ)

. . . ∗ φ ⊢ ψ

∧l,Wl φ ∧ ∀x∀v (φ → [car]φ) ⊢ ψ expand

I(φ) ⊢ ψ

[∗]

I(φ) ⊢ [ car∗]ψ

Base case

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 5 of 6

slide-27
SLIDE 27

Proofs Examples

Introduce Moderate Braking: Auxiliary Safety Proof

axφ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ

prove new branch φ ⊢ [Br ][P]φ

Wlφ, [A ∪ C ∪ B][P]φ ⊢ [Br ][P]φ ∧r

φ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;]

φ, [(A ∪ C ∪ B); P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

∀l,∀l

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;],[∪]

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [(A ∪ C ∪ B ∪ Br ); P]φ

expand

φ, ∀x∀v (φ → [car]φ) ⊢ [ car]φ

. . . ∗

axφ, ∀x∀v(φ → [car]φ) ⊢ φ ∧ ∀x∀v(φ → [car]φ) [] gen

φ, ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

∧l φ ∧ ∀x∀v(φ → [car]φ) ⊢ [

car](φ ∧ ∀x∀v(φ → [car]φ))

expand

I(φ) ⊢ [ car]I(φ) ∗

axI(φ) ⊢ I(φ)

. . . ∗ φ ⊢ ψ

∧l,Wl φ ∧ ∀x∀v (φ → [car]φ) ⊢ ψ expand

I(φ) ⊢ ψ

[∗]

I(φ) ⊢ [ car∗]ψ

Hypothesis strong enough

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 5 of 6

slide-28
SLIDE 28

Proofs Examples

Introduce Moderate Braking: Auxiliary Safety Proof

axφ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ

prove new branch φ ⊢ [Br ][P]φ

Wlφ, [A ∪ C ∪ B][P]φ ⊢ [Br ][P]φ ∧r

φ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;]

φ, [(A ∪ C ∪ B); P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

∀l,∀l

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;],[∪]

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [(A ∪ C ∪ B ∪ Br ); P]φ

expand

φ, ∀x∀v (φ → [car]φ) ⊢ [ car]φ

. . . ∗

axφ, ∀x∀v(φ → [car]φ) ⊢ φ ∧ ∀x∀v(φ → [car]φ) [] gen

φ, ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

∧l φ ∧ ∀x∀v(φ → [car]φ) ⊢ [

car](φ ∧ ∀x∀v(φ → [car]φ))

expand

I(φ) ⊢ [ car]I(φ) ∗

axI(φ) ⊢ I(φ)

. . . ∗ φ ⊢ ψ

∧l,Wl φ ∧ ∀x∀v (φ → [car]φ) ⊢ ψ expand

I(φ) ⊢ ψ

[∗]

I(φ) ⊢ [ car∗]ψ

Induction step

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 5 of 6

slide-29
SLIDE 29

Proofs Examples

Introduce Moderate Braking: Auxiliary Safety Proof

axφ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ

prove new branch φ ⊢ [Br ][P]φ

Wlφ, [A ∪ C ∪ B][P]φ ⊢ [Br ][P]φ ∧r

φ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;]

φ, [(A ∪ C ∪ B); P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

∀l,∀l

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [A ∪ C ∪ B][P]φ ∧ [Br ][P]φ

[;],[∪]

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [(A ∪ C ∪ B ∪ Br ); P]φ

expand

φ, ∀x∀v (φ → [car]φ) ⊢ [ car]φ

. . . ∗

axφ, ∀x∀v(φ → [car]φ) ⊢ φ ∧ ∀x∀v(φ → [car]φ) [] gen

φ, ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

∧l φ ∧ ∀x∀v(φ → [car]φ) ⊢ [

car](φ ∧ ∀x∀v(φ → [car]φ))

expand

I(φ) ⊢ [ car]I(φ) ∗

axI(φ) ⊢ I(φ)

. . . ∗ φ ⊢ ψ

∧l,Wl φ ∧ ∀x∀v (φ → [car]φ) ⊢ ψ expand

I(φ) ⊢ ψ

[∗]

I(φ) ⊢ [ car∗]ψ

Generalize I(φ) ⊢ [ car]I(φ) to I(φ) ⊢ [ car]φ

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 5 of 6

slide-30
SLIDE 30

Proofs Examples

Introduce Moderate Braking: Auxiliary Safety Proof

axφ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ

prove new branch φ ⊢ [Br][P]φ

Wlφ, [A ∪ C ∪ B][P]φ ⊢ [Br][P]φ ∧r

φ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

[;]

φ, [(A ∪ C ∪ B); P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

∀l,∀l

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

[;],[∪]

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [(A ∪ C ∪ B ∪ Br); P]φ

expand

φ, ∀x∀v (φ → [car]φ) ⊢ [ car]φ

. . . ∗

axφ, ∀x∀v(φ → [car]φ) ⊢ φ ∧ ∀x∀v(φ → [car]φ) [] gen

φ, ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

∧l

φ ∧ ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

expand

I(φ) ⊢ [ car]I(φ) ∗

axI(φ) ⊢ I(φ)

. . . ∗ φ ⊢ ψ

∧l,Wl φ ∧ ∀x∀v (φ → [car]φ) ⊢ ψ expand

I(φ) ⊢ ψ

[∗]

I(φ) ⊢ [ car∗]ψ

Standard rules for programs ∪ and ;

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 6 of 6

slide-31
SLIDE 31

Proofs Examples

Introduce Moderate Braking: Auxiliary Safety Proof

axφ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ

prove new branch φ ⊢ [Br][P]φ

Wlφ, [A ∪ C ∪ B][P]φ ⊢ [Br][P]φ ∧r

φ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

[;]

φ, [(A ∪ C ∪ B); P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

∀l,∀l

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

[;],[∪]

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [(A ∪ C ∪ B ∪ Br); P]φ

expand

φ, ∀x∀v (φ → [car]φ) ⊢ [ car]φ

. . . ∗

axφ, ∀x∀v(φ → [car]φ) ⊢ φ ∧ ∀x∀v(φ → [car]φ) [] gen

φ, ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

∧l

φ ∧ ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

expand

I(φ) ⊢ [ car]I(φ) ∗

axI(φ) ⊢ I(φ)

. . . ∗ φ ⊢ ψ

∧l,Wl φ ∧ ∀x∀v (φ → [car]φ) ⊢ ψ expand

I(φ) ⊢ ψ

[∗]

I(φ) ⊢ [ car∗]ψ

Exploit φ → [car]φ already proven

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 6 of 6

slide-32
SLIDE 32

Proofs Examples

Introduce Moderate Braking: Auxiliary Safety Proof

axφ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ

prove new branch φ ⊢ [Br][P]φ

Wlφ, [A ∪ C ∪ B][P]φ ⊢ [Br][P]φ ∧r

φ, [A ∪ C ∪ B][P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

[;]

φ, [(A ∪ C ∪ B); P]φ ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

∀l,∀l

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [A ∪ C ∪ B][P]φ ∧ [Br][P]φ

[;],[∪]

φ, ∀x∀v (φ → [(A ∪ C ∪ B); P]φ) ⊢ [(A ∪ C ∪ B ∪ Br); P]φ

expand

φ, ∀x∀v (φ → [car]φ) ⊢ [ car]φ

. . . ∗

axφ, ∀x∀v(φ → [car]φ) ⊢ φ ∧ ∀x∀v(φ → [car]φ) [] gen

φ, ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

∧l

φ ∧ ∀x∀v(φ → [car]φ) ⊢ [ car](φ ∧ ∀x∀v(φ → [car]φ))

expand

I(φ) ⊢ [ car]I(φ) ∗

axI(φ) ⊢ I(φ)

. . . ∗ φ ⊢ ψ

∧l,Wl φ ∧ ∀x∀v (φ → [car]φ) ⊢ ψ expand

I(φ) ⊢ ψ

[∗]

I(φ) ⊢ [ car∗]ψ

Prove new branch

Stefan Mitsch, Jan-David Quesel, Andr´ e Platzer CMU,JKU Refactoring, Refinement, and Reasoning 6 of 6