The Power of Parameterization in Coinductive Proof Chung-Kil Hur - - PowerPoint PPT Presentation

the power of parameterization in coinductive proof
SMART_READER_LITE
LIVE PREVIEW

The Power of Parameterization in Coinductive Proof Chung-Kil Hur - - PowerPoint PPT Presentation

The Power of Parameterization in Coinductive Proof Chung-Kil Hur Georg Neis Derek Dreyer Viktor Vafeiadis Max Planck Institute for Software Systems (MPI-SWS) Kaiserslautern and Saarbr ucken, Germany Contributions Parameterized


slide-1
SLIDE 1

The Power of Parameterization in Coinductive Proof

Chung-Kil Hur Georg Neis Derek Dreyer Viktor Vafeiadis

Max Planck Institute for Software Systems (MPI-SWS) Kaiserslautern and Saarbr¨ ucken, Germany

slide-2
SLIDE 2

Contributions Parameterized coinduction

Very simple construction Complete reasoning principle for coinduction Achieves incrementality and compositionality

Paco: Coq library for parameterized coinduction

No syntactic guardedness checks Replacement for Coq’s built-in coinduction

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-3
SLIDE 3

Induction Fundamental reasoning principle, e.g. over N: P(0) ∀n. P(n) = ⇒ P(n + 1) ∀n. P(n) Tarski’s fixed-point theorem Complete lattice, (C, ⊑, ⊔) Monotone function, f : C

mon

→ C Prove properties least fixed point, µf f (x) ⊑ x = ⇒ µf ⊑ x

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-4
SLIDE 4

Example of Tarski induction N

def

= µf where f

def

= λA. {0} ∪ {n + 1 | n ∈ A}. ∀n ∈ N. P(n) ⇐ ⇒ µf ⊆ P ⇐ = f (P) ⊆ P Tarski’s thm. ⇐ ⇒ 0 ∈ P ∧ {(n + 1) | n ∈ P} ⊆ P ⇐ ⇒ P(0) ∧ (∀n. P(n) = ⇒ P(n + 1))

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-5
SLIDE 5

Coinduction Dual to induction Construct infinite data structures Greatest fixed points, νf Important applications in computer science: Program refinement (simulation), Program equivalence (bisimulation), Properties of non-terminating executions Tarski’s fixed-point theorem x ⊑ f (x) = ⇒ x ⊑ νf

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-6
SLIDE 6

A trivial example: infinite paths Prove that there is an infinite path from a.

  • a
  • b
  • c
  • d
  • e
  • f

Formally, show a ∈ ν step, where: step(X)

def

= {x ∈ Node | ∃y ∈ X. x → y} How would you prove this?

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-7
SLIDE 7

A trivial example: infinite paths Prove it with Tarski’s theorem?

  • a
  • b
  • c
  • d
  • e
  • f

Must determine suitable postfixed point up front: x ⊑ νf ⇐ ⇒ ∃r. x ⊑ r ∧ r ⊑ f (r) Pick r := {a, b, d} up front.

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-8
SLIDE 8

Parameterized coinduction Parameterize the greatest fixed point with accumulated knowledge Gf (x)

def

= νy. f (x ⊔ y) Properties: νf ≡ Gf (⊥) (Initialize) Gf (x) ≡ f (x ⊔ Gf (x)) (Unfold) x ⊑ y = ⇒ Gf (x) ⊑ Gf (y) (Monotonicity) y ⊑ Gf (x) ⇐ ⇒ y ⊑ Gf (x ⊔ y) (Accumulate)

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-9
SLIDE 9

Proof of the accumulation theorem Goal: y ⊑ Gf (x) ⇐ ⇒ y ⊑ Gf (x ⊔ y) (= ⇒): Trivial by monotonicity. (⇐ =): Assume y ⊑ Gf (x ⊔ y) (*). Then, Gf (x ⊔ y) ≡ f (x ⊔ y ⊔ Gf (x ⊔ y)) fixed point eq. ⊑ f (x ⊔ Gf (x ⊔ y)) f mon. & (*) ≡ (λz. f (x ⊔ z)) (Gf (x ⊔ y)) From Tarski, Gf (x ⊔ y) ⊑ νz. f (x ⊔ z) ≡ Gf (x) . So, from (*) and ⊑-transitivity, y ⊑ Gf (x).

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-10
SLIDE 10

The trivial example, again

a ∈ inf = ν step ⇐ ⇒ a ∈ Gstep(∅) initialize ⇐ ⇒ ∃y ∈ Gstep(∅). a → y unfold ⇐ = b ∈ Gstep(∅) pick y := b ⇐ ⇒ b ∈ Gstep({b}) accumulate ⇐ ⇒ ∃y ∈ {b} ∪ Gstep({b}). b → y unfold ⇐ = d ∈ {b} ∪ Gstep({b}) pick y := d ⇐ ⇒ d ∈ Gstep({b}) since d = b ⇐ ⇒ ∃y ∈ {b} ∪ Gstep({b}). d → y unfold ⇐ = b ∈ {b} ∪ Gstep({b}) pick y := b

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-11
SLIDE 11

Compositionality G supports rely-guarantee proof rule: g1 ⊑ Gf (r1) r1 ⊑ r ⊔ g2 g2 ⊑ Gf (r2) r2 ⊑ r ⊔ g1 g1 ⊔ g2 ⊑ Gf (r) Interderivable with accumulation theorem

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-12
SLIDE 12

Coinduction in Coq For every coinductive data type A, Coq provides cofixA : (A → A) → A but checks that the argument to cofix is guarded

  • syntactically. (Otherwise, the rule is obviously unsound.)

Allows incremental proofs, but guardedness checks are restrictive are non-compositional are not user-friedly are very slow in large proofs

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-13
SLIDE 13

Paco: A Coq library for parameterized coinduction Implements parameterized greatest fixed points Provides pcofix tactic Replacement for Coq’s cofix Ensures proofs are semantically guarded No syntactic guardedness checks! Freely available: http://plv.mpi-sws.org/paco/

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof

slide-14
SLIDE 14

What else is in the paper... More examples, simulations Integration with “up to” techniques Implementing parameterized coinduction in Coq Paco internals

C.-K. Hur, G. Neis, D. Dreyer, V. Vafeiadis The Power of Parameterization in Coinductive Proof