a formalised lower bound on undirected graph reachability
play

A Formalised Lower Bound on Undirected Graph Reachability Ulrich - PowerPoint PPT Presentation

A Formalised Lower Bound on Undirected Graph Reachability Ulrich Schpp University of Munich Computer Aided Formal Reasoning Computer assistance in our everyday work? correctness revalidation after changes bookkeeping for


  1. A Formalised Lower Bound on Undirected Graph Reachability Ulrich Schöpp University of Munich

  2. Computer Aided Formal Reasoning Computer assistance in our everyday work? correctness revalidation after changes • • bookkeeping for complicated technical details •

  3. Computer Aided Formal Reasoning Computer assistance in our everyday work? correctness revalidation after changes • • bookkeeping for complicated technical details • Theorem prover technology is getting to a point where it is useful in practice for proving theorems. programming language theory: POPLMark • four colour theorem • Today: case study from structural complexity theory

  4. Context Formalised proofs in my current work with Martin Hofmann Expressivity of Pointer Programs on Graphs graph as a structured, read-only input while-language with boolean variables and pointer variables various constructs for pointer manipulation (operations of the input structure succi , iteration, etc.) • • • s t

  5. Pointer Programs and Undirected s - t -Reachability iteration over all nodes (~ Java Iterator) counting registers (~ Java int ) pure pointer algoritms (only succ i ) + + +pointer arithmetic (~ C int )

  6. Pointer Programs and Undirected s - t -Reachability iteration over all nodes (~ Java Iterator) counting registers (~ Java int ) pure pointer algoritms (only succ i ) + + +pointer arithmetic (~ C int ) > Deterministic Transitive Closure (DTC) Logic = Jumping Automata on Graphs (JAGs) = LOGSPACE = RAM-JAG

  7. Pointer Programs and = Jumping Automata on Graphs (JAGs) Sch. & Hofmann Reingold 2005 1980 Cook & Rackoff = RAM-JAG = LOGSPACE Logic Undirected s - t -Reachability > Deterministic Transitive Closure (DTC) +pointer arithmetic (~ C int ) + + pure pointer algoritms (only succ i ) counting registers (~ Java int ) iteration over all nodes (~ Java Iterator) 2008

  8. Pointer Programs and = RAM-JAG which we have developed of Cook & Rackoff's result Proof uses a generalisation 2008 Sch. & Hofmann Reingold 2005 1980 Cook & Rackoff = LOGSPACE Undirected s - t -Reachability = Jumping Automata on Graphs (JAGs) Logic > Deterministic Transitive Closure (DTC) +pointer arithmetic (~ C int ) + + pure pointer algoritms (only succ i ) counting registers (~ Java int ) iteration over all nodes (~ Java Iterator) using Coq.

  9. Improving the Result of Cook & Rackoff

  10. Jumping Automata on Graphs move pebble along edge 3 2 1 • jump pebble to another one • • automaton can see whether or not can move one pebble per step • • • graph node two pebbles are on the same 4

  11. Improving Cook & Rackoff's Result

  12. Improving Cook & Rackoff's Result

  13. Outline of Cook & Rackoff's Proof If the actions of the JAG become periodic then a full configuration will be repeated not long after.

  14. When are Actions Repeated? behaviour = list of actions the JAG makes • JAG repeats actions after at most #behaviours steps • Estimate the number of different behaviours of a JA Analysis of Behaviour some pebble collisions give JAG information • only relative pebble positions relevant •

  15. Predicting Pebble Collisions Keep track of known relative pebble distances (difference vectors throughout the course of the computation. Some pebble collisions can be predicted from the computation history.

  16. Predicting Pebble Collisions Keep track of known relative pebble distances (difference vectors throughout the course of the computation. Some pebble collisions can be predicted from the computation history.

  17. Predicting Pebble Collisions Keep track of known relative pebble distances (difference vectors throughout the course of the computation. Some pebble collisions can be predicted from the computation history.

  18. Predicting Pebble Collisions Keep track of known relative pebble distances (difference vectors throughout the course of the computation. Some pebble collisions can be predicted from the computation history.

  19. Predicting Pebble Collisions Keep track of known relative pebble distances (difference vectors throughout the course of the computation. Some pebble collisions can be predicted from the computation history.

  20. Predicting Pebble Collisions Keep track of known relative pebble distances (difference vectors throughout the course of the computation. Some pebble collisions can be predicted from the computation history.

  21. Predicting Pebble Collisions Keep track of known relative pebble distances (difference vectors throughout the course of the computation. Some pebble collisions can be predicted from the computation history.

  22. Predictable Steps no collision of pebbles with unknown distance State and distance vectors after the step are uniquely determined from those before the step.

  23. Non-Predictable Steps collision of pebbles with unknown distance

  24. Extended State Extended State: Establish a bound on the number of extended behaviours. State of JAG + knowledge about relative distances Extended Behaviour: List of extended states the JAG assumes from a starting configuration

  25. Analysis Induction on the number of non-predictable steps

  26. Analysis

  27. Generalisation

  28. Action Graphs

  29. The Formalisation

  30. Formalisation in Coq Coq is a very good tool to formalise this kind of proofs. intensional equality • intuitionistic logic • dependent types, expressive programming language • Coq to formalise: counting arguments • proofs with classical logic •

  31. Proof by Programming How to to formalise the counting arguments? prove correctness of the program • data types often finite with decidable equalit (here: graphs, configurations write program that enumerates all objects with a certain property (as a list) • • Coq is perhaps the best currently available tool for combining programs and proofs. → proof by programming

  32. Reflection Combine logical inference with program evaluation ideally: f(M) evaluates to true • bool -valued functions instead of predicates combine f with logical property P • • to show P(M) it suffices to show f(M) = true • f : A -> bool f(x) = true -> P(x) f(x) = false -> ~P(x) to show P(M) it then suffices to show true = true •

  33. Reflection automatic simplification of expressions by computation • • Reflection can be seen as a mechanism of writing tactic within the logic

  34. Small Scale Reflection in Coq Reflection is useful on a small scale • Library for working with finite data type Concise tactic language SSReflect in Co Geoges Gonthier, proof of the four colour theorem Very well suited for proving by programming. Views (switch between predicates and functions) Implicit coercions (e.g. can use f like a logical predicate) Rewriting • • • • •

  35. Finite Data Types • quotients • • normal relations coercion to and from • choice function represented by finite equivalence relation normal functions Finite data types are easy to work with coercion to and from • represented by graph finite function • complicated types easy to integrate • typical example: • excellent existing library •

  36. Classical Logic, Extensionality by exists x; exists y. by rewrite ltnn in C. by rewrite -(leq_add2l 1) !add1n in W; apply: (leq_trans W I). have C: (card d1) < (card d1). have W: (card d1) <= (card d2) by apply: (injective_card V). by rewrite E eq_refl in H2 by apply/eqP; apply: negbE2. move: (e (x, y))=>/=; move/nandP=>[H1|H2]. move=>x y E. have V: (injective f). case: (pickP (fun xy => ((xy.1) != (xy.2)) && (f (xy.1) == f (xy.2))))=>[[x y] /=m|e]. Intuitionistic logic, intensional equality not an issue. move=>d1 d2 f I. Proof. (card d2 < card d1) -> (exists x:d1, exists y:d1, (x != y) && (f x == f y)). Lemma pigeon: forall (d1 d2:finType) (f:d1->d2) • quotients of finite equivalence relations • extensional, decidable equality for finite functions • classical reasoning for bool -valued predicates Qed.

  37. Formalising the Analysis Definition R (k n : nat): nat : card (quotient (equiv k n)). equiv (k n: nat): (conf ...) -> (conf ...) -> bool Definition A (k n : nat): nat : max (fun C=> card (evolution_to_coal k n C)).

  38. Formalisation ~5000 lines of code in SSReflect tactic language • reasonable amount of additional work for defining finite functions, quotients, ... • arithmetic calculations done by hand • SSReflect and libraries very well suited to task • reflection essential • quite close to the informal proof •

  39. Conclusion verification down to the last detail structuring proofs • • Formal proof in structural complexity theory encapsulation of technical details in abstractions • reflection works very well for this kind of proofs •

  40. Endliche Datentypen Typen mit entscheidbarer Gleichheit Endliche Typen Record eqType : Type := EqType { sort :> Type; eq : sort -> sort -> bool; _ : forall x y:sort, reflect (x=y) (eq x y) }. Record finType : Type := FinType sort :> eqType; enum : seq sort; enumP : forall x, count (pred1 x) enum = 1 }.

Recommend


More recommend