ramseypltalk

# Ramseypltalk - An Application of Ramsey’s Theorem to Proving Programs Terminate An Exposition William Gasarch-U of MD William Gasarch-U of MD An

This preview shows pages 1–9. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: An Application of Ramsey’s Theorem to Proving Programs Terminate: An Exposition William Gasarch-U of MD William Gasarch-U of MD An Application of Ramsey’s Theorem to Proving Programs Term Credit Where Credit is Due 1. Jon Katz emailed me Proving Programs Terminate by Byron Cook, Andreas Podelski, Andrey Rybalchenko. 2. I emailed Byron Cook, Andreas Podelski, Andrey Rybalchenko for more references, which they provided. 3. Proofs of Termination are their work unless otherwise noted. 4. Ramsey’s Theorem is due to Ramsey (duh). William Gasarch-U of MD An Application of Ramsey’s Theorem to Proving Programs Term Overview I Problem: Given a program we want to prove it terminates. 1. Impossible in general- Halting Problem is Undecidable. 2. But can do this on some simple progs. (We will.) William Gasarch-U of MD An Application of Ramsey’s Theorem to Proving Programs Term Overview II In this talk I will: 1. Do example of traditional method to prove progs terminate. 2. Discuss traditional method. 3. Do harder example of traditional method. 4. DIGRESSION: A very short lecture on Ramsey Theory. 5. Do that same harder example using Ramsey Theory. 6. Do example with Ramsey Theory that is hard to do traditionally. William Gasarch-U of MD An Application of Ramsey’s Theorem to Proving Programs Term Notation 1. Will use psuedo-code progs. 2. KEY: If A is a set then the command x = input(A) means that x gets some value from A that the user decides. 3. Note: we will want to show that no matter what the user does the program will halt. 4. The code (x,y) = (f(x,y),g(x,y)) means that simultaneously x gets f(x,y) and y gets g(x,y). William Gasarch-U of MD An Application of Ramsey’s Theorem to Proving Programs Term Easy Example of Traditional Method (x,y,z) = (input(INT), input(INT), input(INT)) While x>0 and y>0 and z>0 control = input(1,2,3) if control = 1 then (x,y,z)=(x+1,y-1,z-1) else if control = 2 then (x,y,z)=(x-1,y+1,z-1) else (x,y,z)=(x-1,y-1,z+1) Sketch of Proof of termination: William Gasarch-U of MD An Application of Ramsey’s Theorem to Proving Programs Term Easy Example of Traditional Method (x,y,z) = (input(INT), input(INT), input(INT)) While x>0 and y>0 and z>0 control = input(1,2,3) if control = 1 then (x,y,z)=(x+1,y-1,z-1) else if control = 2 then (x,y,z)=(x-1,y+1,z-1) else (x,y,z)=(x-1,y-1,z+1) Sketch of Proof of termination: Whatever the user does x+y+z is decreasing. William Gasarch-U of MD An Application of Ramsey’s Theorem to Proving Programs Term Easy Example of Traditional Method (x,y,z) = (input(INT), input(INT), input(INT)) While x>0 and y>0 and z>0 control = input(1,2,3) if control = 1 then (x,y,z)=(x+1,y-1,z-1) else if control = 2 then (x,y,z)=(x-1,y+1,z-1) else (x,y,z)=(x-1,y-1,z+1) Sketch of Proof of termination: Whatever the user does x+y+z is decreasing....
View Full Document

## This note was uploaded on 01/13/2012 for the course CMSC 297 taught by Professor Staff during the Fall '11 term at Maryland.

### Page1 / 39

Ramseypltalk - An Application of Ramsey’s Theorem to Proving Programs Terminate An Exposition William Gasarch-U of MD William Gasarch-U of MD An

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online