an introduction to cyclic proof
play

An introduction to cyclic proof James Brotherston Imperial College, - PowerPoint PPT Presentation

An introduction to cyclic proof James Brotherston Imperial College, London London Theory Day 11 April, 2008 Tree proof vs. cyclic proof (1) Usually a proof is a finite tree of sequents ( ): (Axiom) (Axiom) (Axiom)


  1. An introduction to cyclic proof James Brotherston Imperial College, London London Theory Day 11 April, 2008

  2. Tree proof vs. cyclic proof (1) • Usually a proof is a finite tree of sequents ( • ): (Axiom) • (Axiom) (Axiom) • • • • · · · • (Inference) • • • Soundness of such proofs follows from the local soundness of each inference rule / axiom.

  3. Tree proof vs. cyclic proof (2) • A cyclic pre-proof is formed from a (partial) derivation by identifying each open subgoal (called a bud) with an identical interior sequent (called its companion): • • (Axiom) • • • · · · • (Inference) • • • Cyclic pre-proofs are not sound in general — we need some extra condition. • Cyclic proof = pre-proof P + soundness condition S ( P ).

  4. Example (cf. Stirling & Bradfield): cyclic proofs of µ -calculus properties of processes Consider a “clock” process Cl which repeatedly ticks: Cl = def tick.Cl The µ -calculus formula νX. � tick � X means “the action ‘tick’ can be performed infinitely often”. Cl ⊢ νX. � tick � X ( † ) ( �−� ) Cl ⊢ � tick � νX. � tick � X ( ν ) Cl ⊢ νX. � tick � X ( † ) This is a cyclic proof since the greatest fixed point ν is unfolded infinitely often on the cycle in the pre-proof.

  5. Inductive definitions in first-order logic • Consider these inductive definitions of predicates N, E, O : Nx Ex Ox N 0 E 0 Nsx Osx Esx • These definitions give rise to case-split rules, e.g., for N : Γ , t = 0 ⊢ ∆ Γ , t = sx, Nx ⊢ ∆ (Case N ) Γ , Nt ⊢ ∆ where x �∈ FV (Γ ∪ ∆ ∪ { Nt } ). • We call the formula Nx in the right-hand premise a case-descendant of Nt .

  6. Example (1), ` a la Fermat Nz ⊢ Oz, Ez ( † ) (Subst) Ny ⊢ Oy, Ey ( OR 1 ) Ny ⊢ Oy, Osy ( ER 1 ) ( ER 2 ) ⊢ E 0 , O 0 Ny ⊢ Esy, Osy (=L) (=L) z = 0 ⊢ Ez, Oz z = sy, Ny ⊢ Ez, Oz (Case N ) Nz ⊢ Ez, Oz ( † ) • We can view this as a proof by infinite descent. • If Nz ⊢ Ez, Oz was false then we would have: Nz > Ny = Nz ′ > Ny ′ = Nz ′′ > Ny ′′ . . .

  7. Example (2), generalised infinite descent Ox ⊢ Nx ( † 2) Ex ⊢ Nx ( † 1) (Subst) (Subst) Oy ⊢ Ny Ey ⊢ Ny ( NR 1 ) ( NR 2 ) ( NR 2 ) ⊢ N 0 Oy ⊢ Nsy Ey ⊢ Nsy (=L) (=L) (=L) x = 0 ⊢ Nx x = sy, Oy ⊢ Nx x = sy, Ey ⊢ Nx (Case E ) (Case O ) Ex ⊢ Nx ( † 1) Ox ⊢ Nx ( † 2) ( ∨ L) Ex ∨ Ox ⊢ Nx • Also a cyclic proof since Ox / Ex is unfolded infinitely often along the “figure-of-8” loop in the pre-proof. • General principle: on every infinite path some inductive definition must be unfolded infinitely often. • (Formal argument uses approximants of inductive predicates.)

  8. Separation logic • Separation logic uses extra connectives to reason about heap resource. • emp denotes the empty heap. • F 1 ∗ F 2 expresses a division of the heap into two parts in which F 1 resp. F 2 hold. • We can write inductive definitions as normal. E.g. we can define linked list segments ls x y by: x �→ x ′ ∗ ls x ′ y emp ls x x ls x y where �→ denotes a single-celled heap with domain x and contents x ′ .

  9. Example (3): list segment concatenation ( † ) ls x x ′ ∗ ls x ′ y ⊢ ls x y (Id) (Id) (Subst) ls z x ′ ∗ ls x ′ y ⊢ ls z y ls x y ⊢ ls x y x �→ z ⊢ x �→ z ( ≡ ) ( ∗ R) x �→ z ∗ ls z x ′ ∗ ls x ′ y ⊢ x �→ z ∗ ls z y emp ∗ ls x y ⊢ ls x y (=L) ( ls R 2 ) ( x ′ = x ∧ emp ) ∗ ls x ′ y ⊢ ls x y x �→ z ∗ ls z x ′ ∗ ls x ′ y ⊢ ls x y (Case ls ) ( † ) ls x x ′ ∗ ls x ′ y ⊢ ls x y Again this is a cyclic proof since ls x x ′ is unfolded infinitely often on the loop in the pre-proof.

  10. A Hoare proof system for termination • Fix some program (in a simple imperative language): 1 : C 1 , 2 : C 2 , . . . , n : C n • We write termination judgements F ⊢ i ↓ where i is a program label and F is a formula of separation logic. • Intuitively, F ⊢ i ↓ means “the program always terminates when started at line i in a state satisfying F ”. • As well as logical rules we have symbolic execution rules which capture program commands, e.g.: Cond ∧ F ⊢ j ↓ ¬ Cond ∧ F ⊢ i +1 ↓ C i ≡ if Cond goto j F ⊢ i ↓

  11. Reversing a “frying-pan” list • The classical list reverse algorithm is: 1 . y := nil 4 . x := [ x ] 7 . goto 2 2 . if x = nil goto 8 5 . [ z ] := y 8 . stop 3 . z := x 6 . y := z • The invariant for this algorithm given a cyclic list is: ∃ k 1 , k 2 , k 3 · ( ls x j ∗ ls y nil ∗ j �→ k 1 ∗ ls k 1 j ) ∨ ( ls k 2 nil ∗ j �→ k 2 ∗ ls x j ∗ ls y j ) ∨ ( ls x nil ∗ ls y j ∗ j �→ k 3 ∗ ls k 3 j ) rev P0 rev P j j j P rev H0 H1 rev H0 H1 rev H y y x x x y P1 • We want to prove that the invariant implies termination.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend