MP 5 Program Transition Systems and Linear Temporal Logic

Size: px
Start display at page:

Download "MP 5 Program Transition Systems and Linear Temporal Logic"

Transcription

1 MP 5 Program Transition Systems and Linear Temporal Logic CS 477 Spring 2018 Revision 1.0 Assigned April 10, 2018 Due April 17, 2018, 9:00 PM Extension extend48 hours (penalty 20% of total points possible) 1 Change Log 1.0 Initial Release. 2 Objectives and Background The purpose of this MP is to test the student s understanding of Program transition systems, proofs about linear temporal logic formulae, and proofs that linear temporal logic formulae hold of Program transition systems Another purpose of MPs in general is to provide a framework to study for the exam. Several of the questions on the exam will appear similar to the MP problems. 3 Turn-In Procedure A skeleton version of the file mp5.thy for this assignment should be found in the assignments/mp5/ subdirectory of your svn directory for this course. You should put code answering each of the problems below in the file mp5.thy. Your completed mp5.thy file should be put in the assignments/mp5/ subdirectory of your svn directory (where it was originally found) and committed as follows: svn commit -m "Turning in mp5" Please read the Instructions for Submitting Assignments in 4 Infinite Sequences An infinite sequence is a function from natural numbers to sequence elements. Looking up the i th element of in infinite sequence is just applying the function to i. Other operations we will need on include taking the first i elements as a list, dropping the first i elements to get the i th tail sequence, adding an element onto the front of an infinite sequence and appending an infinite sequence onto a finite list. 1

2 fun take :: (nat a) nat a list (infix 53 ) where (f 0 ) = [] (f (Suc i)) = (f 0 ) # (f i) definition drop :: (nat a) nat (nat a) (infix 53 ) where (f i) (λn. f (n + i)) lemma drop-0 [simp] : (f 0 ) = f proof (rule ext) fix x show (f 0 ) x = f x by (simp add: drop-def ) lemma drop-add[simp]: (f i) j = (f (i + j )) proof (rule ext) fix k show ((f i) j ) k = (f i + j ) k proof (simp add: drop-def ) have A1 : (k + j + i) = (k + (i + j )) by simp from A1 show f (k + j + i) = f (k + (i + j )) by arith lemma -drop[simp]: (f (Suc n)) m = (f n)(suc m) by (simp add: drop-def ) fun seq-cons (infixr ## 55 ) where (x ## f ) 0 = x (x ## f ) (Suc n) = f n lemma seq-cons: x ## f = (λ n. case n of 0 x Suc m f m) proof (rule ext) fix n show (x ## f ) n = (case n of 0 x Suc m f m) proof (cases n) case 0 then show?thesis by simp case (Suc nat) then show?thesis by simp fun seq-app 56 ) where f = f f = x ## f ) lemma app-seq-app: l2 f = f proof (induction l1 ) 2

3 case Nil then show?case by simp case (Cons a l1 ) then show?case by simp 5 Program Transition Semantics A program transition system is a set of guarded simultaneous assignment statements, where the guard is a boolean expression, and the simultaneous assignment associates a finite sequence of (distinct) variables with a finite sequence (of equal length) of (arithmetic) expressions. datatype data command = guarded-assign data bool-exp var-name list data exp list ( -/ -/ ::= -/ [0,0,0 ] 60 ) fun simultaneous-update where simultaneous-update [] [] m = m simultaneous-update (x # xs) (v # vs) m = simultaneous-update xs vs (m (x := v)) fun one-step-eval :: data command data state data state bool (infixl 55 ) where ((g vars ::= expressions), m) m = (g m m = simultaneous-update vars (List.map (λe. e m) expressions) m) definition is-run :: data command set data state (nat data state) bool where is-run commands m r = ((r 0 = m) ( n. ( c commands. (c, r n) r (Suc n)) (( c commands. m. ((c, r n) m )) r (Suc n) = r n))) lemma is-run-start: is-run commands m r = r 0 = m by (simp add: is-run-def ) lemma is-run-stop : [is-run commands m r; ( c commands. m. ((c, r n) m ))] = (r (n + i) = r n) proof (clarsimp simp add: is-run-def ) assume A1 : c commands. m. (c, r n) m and A2 : n. ( c commands. (c, r n) r (Suc n)) ( c commands. m. (c, r n) m ) r (Suc n) = r n and A3 : m = r 0 show r (n + i) = r n proof (induction i) case 0 then show r (n + 0 ) = r n by simp case (Suc i) assume A4 : r (n + i) = r n from A1 and A2 and A4 3

4 have F1 : r (Suc (n + i)) = r (n + i) r (n + Suc i) = r n by simp from A2 have F2 : ( c commands. (c, r (n + i)) r (Suc (n + i))) ( c commands. m. (c, r (n + i)) m ) r (Suc (n + i)) = r (n + i) by (erule-tac x = n + i in alle) from A1 and F2 and A4 have F3 : r (Suc (n + i)) = r (n + i) by (erule-tac disje, simp-all) from F1 and F3 show r (n + Suc i) = r n by simp lemma stopped-is-run: [( c commands. m. ((c, m) m )); n. (r n = m)] = is-run commands m r by (simp add: is-run-def ) lemma is-run-step-eq: [r 0 = m; c commands; ((c, r 0 ) r (Suc 0 ))] = is-run commands (r (Suc 0 )) (r (Suc 0 )) = is-run commands m r proof (clarsimp simp add: is-run-def ) assume A1 : m = r 0 and A2 : c commands and A3 : (c, r 0 ) r (Suc 0 ) from this show ( n. ( c commands. (c, r (Suc n)) r (Suc (Suc n))) ( c commands. m. (c, r (Suc n)) m ) r (Suc (Suc n)) = r (Suc n)) = ( n. ( c commands. (c, r n) r (Suc n)) ( c commands. m. (c, r n) m ) r (Suc n) = r n) proof (rule-tac iffi, simp-all) assume A4 : n. ( c commands. (c, r (Suc n)) r (Suc (Suc n))) ( c commands. m. (c, r (Suc n)) m ) r (Suc (Suc n)) = r (Suc n) show ( n. ( c commands. (c, r n) r (Suc n)) ( c commands. m. (c, r n) m ) r (Suc n) = r n) proof (rule-tac alli ) fix n show ( c commands. (c, r n) r (Suc n)) ( c commands. m. (c, r n) m ) r (Suc n) = r n proof (case-tac n, simp-all) assume A5 : n = 0 show ( c commands. (c, r 0 ) r (Suc 0 )) ( c commands. m. (c, r 0 ) m ) r (Suc 0 ) = r 0 proof (rule-tac disji1 ) from A2 and A3 show c commands. (c, r 0 ) r (Suc 0 ) by (rule-tac x = c in bexi, simp-all) fix j assume A6 : n = Suc j from A4 show ( c commands. (c, r (Suc j )) r (Suc (Suc j ))) ( c commands. m. (c, r (Suc j )) m ) r (Suc (Suc j )) = r (Suc j ) by simp 4

5 lemma is-run-step-backward : [r 0 = m; c commands; ((c, m) r (Suc 0 )); is-run commands (r (Suc 0 )) (r (Suc 0 ))] = is-run commands m r by (simp add: is-run-step-eq) lemma is-run-step-forward : [ is-run commands m r; r 0 = m; c commands; ((c, m) m )] = ( c commands. (c, m) r (Suc 0 )) is-run commands (r (Suc 0 )) (r (Suc 0 )) proof (clarsimp simp add: is-run-def ) assume A1 : n. ( c commands. (c, r n) r (Suc n)) ( c commands. m. (c, r n) m ) r (Suc n) = r n and A2 : c commands and A3 : (c, r 0 ) m and A4 : m = r 0 from A1 have F1 : ( c commands. (c, r 0 ) r (Suc 0 )) ( c commands. m. (c, r 0 ) m ) r (Suc 0 ) = r 0 by simp from A2 and A3 and F1 show c commands. (c, r 0 ) r (Suc 0 ) by blast 6 Linear Temporal Logic datatype state ltl-formula = ltl-prop state bool ltl-and state ltl-formula state ltl-formula (infixl 55 ) ltl-or state ltl-formula state ltl-formula (infixl 56 ) ltl-imp state ltl-formula state ltl-formula (infixr 54 ) ltl-not state ltl-formula ( ) ltl- state ltl-formula ( ) ltl-always state ltl-formula ( ) ltl-eventually state ltl-formula ( ) ltl-until state ltl-formula state ltl-formula (infixl U 60 ) definition ltl-releases :: state ltl-formula state ltl-formula state ltl-formula (infixl V 60 ) where ϕ V ψ (( ϕ) U ( ψ)) definition ltl-true :: state ltl-formula (True ) where True = ltl-prop (λ q. True) definition ltl-false :: state ltl-formula (False ) where False = ltl-prop (λ q. False) definition ltl-equiv 5

6 :: state ltl-formula state ltl-formula state ltl-formula (infix 52 ) where ϕ ψ ((ϕ ψ) (ψ ϕ)) fun models-ltl :: (nat state) state ltl-formula bool (infix = 50 ) where models-ltl-prop: σ = (ltl-prop p) = p(σ(0 )) models-ltl-and: σ = (ϕ ψ) = ((σ = ϕ) (σ = ψ)) models-ltl-or: σ = (ϕ ψ) = ((σ = ϕ) (σ = ψ)) models-ltl-imp: σ = (ϕ ψ) = ((σ = ϕ) (σ = ψ)) models-ltl-not: σ = ϕ = ( (σ = ϕ)) models-ltl-: σ = ϕ = ((σ 1 ) = ϕ) models-ltl-always: σ = ϕ = ( i. (σ i) = ϕ) models-ltl-eventually: σ = ϕ = ( i. (σ i) = ϕ) models-ltl-until: σ = (ϕ U ψ) = ( i.((σ i) = ψ) ( j. j < i ((σ j ) = ϕ))) lemma models-releases: σ = (ϕ V ψ) = (( i. ((σ i) = ψ)) ( i.((σ i) = ϕ) ( j. j i ((σ j ) = ψ)))) proof (simp add: ltl-releases-def ) show ( i. σ i = ψ ( j <i. σ j = ϕ)) = (( i. σ i = ψ) ( i. σ i = ϕ ( j i. σ j = ψ))) proof (rule iffi ) assume A1 : i. σ i = ψ ( j <i. σ j = ϕ) then show ( i. σ i = ψ) ( i. σ i = ϕ ( j i. σ j = ψ)) proof clarsimp fix i assume A2 : i. σ i = ϕ ( j i. σ j = ψ) from A1 and A2 show σ i = ψ proof (rule-tac Nat.nat-less-induct) fix n assume A3 : m<n. σ m = ψ from A1 and A2 and A3 show σ n = ψ proof (erule-tac x = n in alle) assume A4 : σ n = ψ ( j <n. σ j = ϕ) from A2 and A3 and A4 show?thesis proof (erule-tac disje, simp) assume A5 : j <n. σ j = ϕ from A5 obtain j where F1 : j < n and F2 : σ j = ϕ by auto from A2 and F2 have F3 : ( m j. σ m = ψ) by auto from F3 obtain m where F4 : m j and F5 : σ m = ψ by auto from A3 and F1 and F2 and F3 and F4 and F5 show?thesis by clarsimp 6

7 assume A6 : ( i. σ i = ψ) ( i. σ i = ϕ ( j i. σ j = ψ)) from A6 show i. σ i = ψ ( j <i. σ j = ϕ) proof (erule-tac disje) assume A7 : i. σ i = ψ from A7 show?thesis by clarsimp assume A8 : i. σ i = ϕ ( j i. σ j = ψ) from A8 obtain i where A9 : σ i = ϕ and A10 : j i. σ j = ψ by auto from A9 and A10 show?thesis proof clarsimp fix ia assume A11 : j <ia. σ j = ϕ from A9 and A10 and A11 show σ ia = ψ proof (case-tac ia i) assume A12 : ia i from A9 and A10 and A11 and A12 show?thesis by clarsimp assume A13 : ia i from A9 and A10 and A11 and A13 show?thesis by clarsimp lemma models-later: [(σ i) = ϕ; i = j ] = (σ j ) = ϕ by simp 7 Problems The problems below are designed to step you through some of the pieces of reasoning about Program Transition Systems evaluations, proofs of basic LTL formulae true in all models, and proofs of LTL properties of programs, where the proofs are done in Isabelle. We begin with the execution of a Program Transition System corresponding to a simple while program you worked with in MP4. The original program was 0 WHILE $ x [>] k 0 DO 1 ( y ::= $ y [+] k 1;; 2 x ::= $ x [-] k 1) OD 1. (68 pts) lemma promblem1 : is-run {(($ pc [=] k 0 ) [ ] $ x [>] k 0 [ pc ] ::= [k 1 ]), 7

8 (($ pc [=] k 1 ) [ pc, y ] ::= [k 2, $ y [+] k 1 ]), (($ pc [=] k 2 ) [ pc, x ] ::= [k 0, $ x [ ] k 1 ])} (m( pc := 0, x := 2, y := a)) ((λn. (m( pc := 0, x := 0, y := a + 2 ))) (0 := m( pc := 0, x := 2, y := a), 1 := m( pc := 1, x := 2, y := a), 2 := m( pc := 2, x := 2, y := a + 1 ), 3 := m( pc := 0, x := 1, y := a + 1 ), 4 := m( pc := 1, x := 1, y := a + 1 ), 5 := m( pc := 2, x := 1, y := a + 2 ), 6 := m( pc := 0, x := 0, y := a + 2 ))) It is worth reviewing the section on LTL. In the four problems you are asked to prove LTL formulae that are universally true, and in the case of Problem 4, that one universally true formula implies another, closely related formula is also universally true. You will need to use induction nat.induct on at least one of the four proofs. 2. (4 pts) lemma problem2 : σ = ϕ ϕ ( ϕ) 3. (3 pts) lemma problem3 : ( σ. σ = ϕ) = ( σ. σ = ( ϕ)) 4. (16 pts) lemma problem4 : σ = ( (ϕ ϕ)) (ϕ ( ϕ)) 5. (10 pts) lemma problem5 : σ = ( ( ϕ)) ( ( ϕ)) Finally, you are asked to prove that all runs of the program in Problem 1 satisfy the given LTL formula. 6. (80 pts) lemma problem6 : [is-run {(($ pc [=] k 0 ) [ ] $ x [>] k 0 [ pc ] ::= [k 1 ]), (($ pc [=] k 1 ) [ pc, y ] ::= [k 2, $ y [+] k 1 ]), (($ pc [=] k 2 ) [ pc, x ] ::= [k 0, $ x [ ] k 1 ])} m σ ] = σ = (ltl-prop($ pc [=] k 0 [ ] $ x [=] k 1 [ ] $ y [=] k a)) ( (ltl-prop($ pc [=] k 0 [ ] $ x [=] k 0 [ ] $ y [=] k (a + 1 )))) 8

Syntax and semantics of a GPU kernel programming language

Syntax and semantics of a GPU kernel programming language Syntax and semantics of a GPU kernel programming language John Wickerson April 17, 2016 Abstract This document accompanies the article The Design and Implementation of a Verification Technique for GPU

More information

Imperative Insertion Sort

Imperative Insertion Sort Imperative Insertion Sort Christian Sternagel October 11, 2017 Contents 1 Looping Constructs for Imperative HOL 1 1.1 While Loops............................ 1 1.2 For Loops.............................

More information

Gödel s Incompleteness Theorems. Lawrence C. Paulson

Gödel s Incompleteness Theorems. Lawrence C. Paulson Gödel s Incompleteness Theorems Lawrence C. Paulson October 10, 2017 Abstract Gödel s two incompleteness theorems [2] are formalised, following a careful presentation by Świerczkowski [3], in the theory

More information

Boolean Expression Checkers

Boolean Expression Checkers Boolean Expression Checkers Tobias Nipkow May 27, 2015 Abstract This entry provides executable checkers for the following properties of boolean expressions: satisfiability, tautology and equivalence. Internally,

More information

Miscellaneous Isabelle/Isar examples

Miscellaneous Isabelle/Isar examples Miscellaneous Isabelle/Isar examples Makarius Wenzel With contributions by Gertrud Bauer and Tobias Nipkow October 8, 2017 Abstract Isar offers a high-level (and theory) language for Isabelle. We give

More information

The Tortoise and the Hare Algorithm

The Tortoise and the Hare Algorithm The Tortoise and the Hare Algorithm Peter Gammie April 17, 2016 Abstract We formalize the Tortoise and Hare cycle-finding algorithm ascribed to Floyd by Knuth (1981, p7, exercise 6), and an improved version

More information

Much Ado about Two. By Sascha Böhme. February 22, 2013

Much Ado about Two. By Sascha Böhme. February 22, 2013 Much Ado about Two By Sascha Böhme February 22, 2013 Abstract This article is an Isabelle formalisation of a paper with the same. In a similar way as Knuth s 0-1-principle for sorting algorithms, that

More information

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications NICTA Advanced Course Theorem Proving Principles, Techniques, Applications λ 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural

More information

Isabelle/FOL First-Order Logic

Isabelle/FOL First-Order Logic Isabelle/FOL First-Order Logic Larry Paulson and Markus Wenzel August 15, 2018 Contents 1 Intuitionistic first-order logic 2 1.1 Syntax and axiomatic basis................... 2 1.1.1 Equality..........................

More information

Roy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK

Roy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK Midlands Graduate School, University of Birmingham, April 2008 1 Operational Semantics Abstract Machines and Correctness Roy L. Crole University of Leicester, UK Midlands Graduate School, University of

More information

Miscellaneous HOL Examples

Miscellaneous HOL Examples Miscellaneous HOL Examples June 8, 2008 Contents 1 Foundations of HOL 6 1.1 Pure Logic............................. 6 1.1.1 Basic logical connectives................. 6 1.1.2 Extensional equality...................

More information

Automated Reasoning. Lecture 9: Isar A Language for Structured Proofs

Automated Reasoning. Lecture 9: Isar A Language for Structured Proofs Automated Reasoning Lecture 9: Isar A Language for Structured Proofs Jacques Fleuriot jdf@inf.ed.ac.uk Acknowledgement: Tobias Nipkow kindly provided the slides for this lecture Apply scripts unreadable

More information

Ribbon Proofs for Separation Logic (Isabelle Formalisation)

Ribbon Proofs for Separation Logic (Isabelle Formalisation) Ribbon Proofs for Separation Logic (Isabelle Formalisation) John Wickerson April 17, 2016 Abstract This document concerns the theory of ribbon proofs: a diagrammatic proof system, based on separation logic,

More information

The Divergence of the Prime Harmonic Series

The Divergence of the Prime Harmonic Series The Divergence of the Prime Harmonic Series Manuel Eberl April 17, 2016 Abstract In this work, we prove the lower bound ln(h n ) ln( 5 3 ) for the partial sum of the Prime Harmonic series and, based on

More information

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle)

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Jacques Fleuriot jdf@inf.ed.ac.uk Recap Previously: Unification and Rewriting This time: Proof by Induction (in Isabelle) Proof by Mathematical

More information

Analyse et Conception Formelle. Lesson 4. Proofs with a proof assistant

Analyse et Conception Formelle. Lesson 4. Proofs with a proof assistant Analyse et Conception Formelle Lesson 4 Proofs with a proof assistant T. Genet (ISTIC/IRISA) ACF-4 1 / 26 Prove logic formulas... to prove programs fun nth:: "nat => a list => a" where "nth 0 (x#_)=x"

More information

A General Method for the Proof of Theorems on Tail-recursive Functions

A General Method for the Proof of Theorems on Tail-recursive Functions A General Method for the Proof of Theorems on Tail-recursive Functions Pasquale Noce Security Certification Specialist at Arjo Systems - Gep S.p.A. pasquale dot noce dot lavoro at gmail dot com pasquale

More information

Introduction to Isabelle/HOL

Introduction to Isabelle/HOL Introduction to Isabelle/HOL 1 Notes on Isabelle/HOL Notation In Isabelle/HOL: [ A 1 ;A 2 ; ;A n ]G can be read as if A 1 and A 2 and and A n then G 3 Note: -Px (P x) stands for P (x) (P(x)) -P(x, y) can

More information

Positional Determinacy of Parity Games

Positional Determinacy of Parity Games Positional Determinacy of Parity Games Christoph Dittmann christoph.dittmann@tu-berlin.de April 17, 2016 We present a formalization of parity games (a two-player game on directed graphs) and a proof of

More information

0.1 Random useful facts. 0.2 Language Definition

0.1 Random useful facts. 0.2 Language Definition 0.1 Random useful facts Lemma double neg : P : Prop, {P} + { P} P P. Lemma leq dec : n m, {n m} + {n > m}. Lemma lt dec : n m, {n < m} + {n m}. 0.2 Language Definition Definition var := nat. Definition

More information

Landau Symbols. Manuel Eberl. November 28, 2018

Landau Symbols. Manuel Eberl. November 28, 2018 Landau Symbols Manuel Eberl November 28, 2018 Contents 1 Sorting and grouping factors 1 2 Decision procedure for real functions 4 2.1 Eventual non-negativity/non-zeroness............. 4 2.2 Rewriting Landau

More information

CSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready.

CSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready. CSE 505, Fall 2005, Midterm Examination 8 November 2005 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.

More information

Miscellaneous Isabelle/Isar examples

Miscellaneous Isabelle/Isar examples Miscellaneous Isabelle/Isar examples Makarius Wenzel With contributions by Gertrud Bauer and Tobias Nipkow October 8, 2017 Abstract Isar offers a high-level proof (and theory) language for Isabelle. We

More information

M ::= x M M x = M M :: M x :: x

M ::= x M M x = M M :: M x :: x Mini-ML expressions M ::= x variable true boolean values false if M then M else M conditional lx (M) function abstraction MM function application let x = M in M local declaration nil nil list M :: M list

More information

This is a repository copy of Theory of Designs in Isabelle/UTP. White Rose Research Online URL for this paper:

This is a repository copy of Theory of Designs in Isabelle/UTP. White Rose Research Online URL for this paper: This is a repository copy of Theory of Designs in Isabelle/UTP. White Rose Research Online URL for this paper: http://eprints.whiterose.ac.uk/129380/ Monograph: Foster, Simon David orcid.org/0000-0002-9889-9514,

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Jeremy Siek Spring 2010 Jeremy Siek Discrete Mathematics 1 / 20 Outline of Lecture 4 1. Overview of First-Order Logic 2. Beyond Booleans: natural numbers, integers, etc. 3. Universal

More information

An Isabelle/HOL Formalization of the Textbook Proof of Huffman s Algorithm

An Isabelle/HOL Formalization of the Textbook Proof of Huffman s Algorithm An Isabelle/HOL Formalization of the Textbook Proof of Huffman s Algorithm Jasmin Christian Blanchette Institut für Informatik, Technische Universität München, Germany blanchette@in.tum.de March 12, 2013

More information

Imperative Insertion Sort

Imperative Insertion Sort Imperative Insertion Sort Christian Sternagel April 17, 2016 Contents 1 Looping Constructs for Imperative HOL 1 1.1 While Loops............................ 1 1.2 For Loops.............................

More information

Concrete Semantics. Tobias Nipkow & Gerwin Klein. October 16, 2017

Concrete Semantics. Tobias Nipkow & Gerwin Klein. October 16, 2017 Concrete Semantics Tobias Nipkow & Gerwin Klein October 16, 2017 Abstract This document presents formalizations of the semantics of a simple imperative programming language together with a number of applications:

More information

T Reactive Systems: Temporal Logic LTL

T Reactive Systems: Temporal Logic LTL Tik-79.186 Reactive Systems 1 T-79.186 Reactive Systems: Temporal Logic LTL Spring 2005, Lecture 4 January 31, 2005 Tik-79.186 Reactive Systems 2 Temporal Logics Temporal logics are currently the most

More information

Coursework Theorem Proving in Isabelle

Coursework Theorem Proving in Isabelle Automated Reasoning 2017/2018 Coursework Theorem Proving in Isabelle Imogen Morris Jacques Fleuriot 16th October 2017 Introduction The coursework for Automated Reasoning is designed to test and help develop

More information

The Tortoise and the Hare Algorithm

The Tortoise and the Hare Algorithm The Tortoise and the Hare Algorithm Peter Gammie October 11, 2017 Abstract We formalize the Tortoise and Hare cycle-finding algorithm ascribed to Floyd by Knuth (1981, p7, exercise 6), and an improved

More information

Free Groups. Joachim Breitner. April 17, 2016

Free Groups. Joachim Breitner. April 17, 2016 Free Groups Joachim Breitner April 17, 2016 Abstract Free Groups are, in a sense, the most generic kind of group. They are defined over a set of generators with no additional relations in between them.

More information

Denotational Semantics of Programs. : SimpleExp N.

Denotational Semantics of Programs. : SimpleExp N. Models of Computation, 2010 1 Denotational Semantics of Programs Denotational Semantics of SimpleExp We will define the denotational semantics of simple expressions using a function : SimpleExp N. Denotational

More information

Menger's Theorem. Christoph Dittmann August 16, Contents

Menger's Theorem. Christoph Dittmann August 16, Contents Menger's Theorem Christoph Dittmann isabelle@christoph-d.de August 16, 2018 We present a formalization of Menger's Theorem for directed and undirected graphs in Isabelle/HOL. This well-known result shows

More information

Typed Arithmetic Expressions

Typed Arithmetic Expressions Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide

More information

Interactive Theorem Provers

Interactive Theorem Provers Interactive Theorem Provers from the perspective of Isabelle/Isar Makarius Wenzel Univ. Paris-Sud, LRI July 2014 = Isabelle λ β Isar α 1 Introduction Notable ITP systems LISP based: ACL2 http://www.cs.utexas.edu/users/moore/acl2

More information

COMP4418, 2017 Assignment 1

COMP4418, 2017 Assignment 1 COMP4418, 2017 Assignment 1 Due: 14:59:59pm Wednesday 30 August (Week 6) Late penalty: 10 marks per day) Worth: 15%. This assignment consists of three questions. The first two questions require written

More information

Hall s Marriage Theorem

Hall s Marriage Theorem Hall s Marriage Theorem Dongchen Jiang and Tobias Nipkow February 16, 2013 Abstract A proof of Hall s Marriage Theorem due to Halmos and Vaughan [1]. theory Marriage imports Main begin theorem marriage-necessary:

More information

Fundamental Properties of Lambda-calculus

Fundamental Properties of Lambda-calculus Fundamental Properties of Lambda-calculus Tobias Nipkow Stefan Berghofer February 12, 2013 Contents 1 Basic definitions of Lambda-calculus 4 1.1 Lambda-terms in de Bruijn notation and substitution....

More information

CS477 Formal Software Dev Methods

CS477 Formal Software Dev Methods CS477 Formal Software Dev Methods Elsa L Gunter 2112 SC, UIUC egunter@illinois.edu http://courses.engr.illinois.edu/cs477 Slides based in part on previous lectures by Mahesh Vishwanathan, and by Gul Agha

More information

A Formally Verified Checker of the Safe Distance Traffic Rules for Autonomous Vehicles

A Formally Verified Checker of the Safe Distance Traffic Rules for Autonomous Vehicles A Formally Verified Checker of the Safe Distance Traffic Rules for Autonomous Vehicles Albert Rizaldi, Fabian Immler February 19, 2016 Abstract The Vienna Convention on Road Traffic defines the safe distance

More information

CIS 500: Software Foundations. November 8, Solutions

CIS 500: Software Foundations. November 8, Solutions CIS 500: Software Foundations Midterm II November 8, 2018 Solutions 1. (8 points) Put an X in the True or False box for each statement. (1) For every b : bexp and c1, c2 : com, either the command IFB b

More information

Examples for program extraction in Higher-Order Logic

Examples for program extraction in Higher-Order Logic Examples for program extraction in Higher-Order Logic Stefan Berghofer October 10, 2011 Contents 1 Auxiliary lemmas used in program extraction examples 1 2 Quotient and remainder 2 3 Greatest common divisor

More information

Code Generation for a Simple First-Order Prover

Code Generation for a Simple First-Order Prover Code Generation for a Simple First-Order Prover Jørgen Villadsen, Anders Schlichtkrull, and Andreas Halkjær From DTU Compute, Technical University of Denmark, 2800 Kongens Lyngby, Denmark Abstract. We

More information

Notes on Inductive Sets and Induction

Notes on Inductive Sets and Induction Notes on Inductive Sets and Induction Finite Automata Theory and Formal Languages TMV027/DIT21 Ana Bove, March 15th 2018 Contents 1 Induction over the Natural Numbers 2 1.1 Mathematical (Simple) Induction........................

More information

M a s t e r r e s e a rc h I n t e r n s h i p. Formalisation of Ground Inference Systems in a Proof Assistant

M a s t e r r e s e a rc h I n t e r n s h i p. Formalisation of Ground Inference Systems in a Proof Assistant M a s t e r r e s e a rc h I n t e r n s h i p Master Thesis Formalisation of Ground Inference Systems in a Proof Assistant Domain: Data Structures and Algorithms - Logic in Computer Science Author: Mathias

More information

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2016 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.

More information

Functional Big-step Semantics

Functional Big-step Semantics Functional Big-step Semantics FM talk, 11 Mar 2015 Magnus Myréen Books Big-step semantics are defined as inductively defined relation. Functions are better! me Context: CakeML verified compiler Old compiler:

More information

Stone Algebras. Walter Guttmann. September 6, 2016

Stone Algebras. Walter Guttmann. September 6, 2016 Stone Algebras Walter Guttmann September 6, 2016 Abstract A range of algebras between lattices and Boolean algebras generalise the notion of a complement. We develop a hierarchy of these pseudo-complemented

More information

A Formal Proof of Correctness of a Distributed Presentation Software System

A Formal Proof of Correctness of a Distributed Presentation Software System A Formal Proof of Correctness of a Distributed Presentation Software System Ievgen Ivanov, Taras Panchenko 1 Taras Shevchenko National University of Kyiv, 64/13, Volodymyrska st., Kyiv, 01601, Ukraine,

More information

Executable Transitive Closures of Finite Relations

Executable Transitive Closures of Finite Relations Executable Transitive Closures of Finite Relations Christian Sternagel and René Thiemann August 28, 2014 Abstract We provide a generic work-list algorithm to compute the transitive closure of finite relations

More information

CIS 500: Software Foundations

CIS 500: Software Foundations CIS 500: Software Foundations Midterm II November 8, 2016 Directions: This exam booklet contains both the standard and advanced track questions. Questions with no annotation are for both tracks. Other

More information

A Modular Rewriting Semantics for CML

A Modular Rewriting Semantics for CML A Modular Rewriting Semantics for CML Fabricio Chalub Barbosa do Rosário frosario@ic.uff.br 19 de março de 2004 0-0 Outline A closer look at MSOS Mapping MSOS to MRS Executing and model checking CML programs

More information

CSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready.

CSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready. CSE 505, Fall 2009, Midterm Examination 5 November 2009 Please do not turn the page until everyone is ready Rules: The exam is closed-book, closed-note, except for one side of one 85x11in piece of paper

More information

Structuring the verification of heap-manipulating programs

Structuring the verification of heap-manipulating programs Structuring the verification of heap-manipulating programs Aleksandar Nanevski (IMDEA Madrid) Viktor Vafeiadis (MSR / Univ. of Cambridge) Josh Berdine (MSR Cambridge) Hoare/Separation Logic Hoare logic

More information

Computing N-th Roots using the Babylonian Method

Computing N-th Roots using the Babylonian Method Computing N-th Roots using the Babylonian Method René Thiemann May 27, 2015 Abstract We implement the Babylonian method [1] to compute n-th roots of numbers. We provide precise algorithms for naturals,

More information

Trace Diagnostics using Temporal Implicants

Trace Diagnostics using Temporal Implicants Trace Diagnostics using Temporal Implicants ATVA 15 Thomas Ferrère 1 Dejan Nickovic 2 Oded Maler 1 1 VERIMAG, University of Grenoble / CNRS 2 Austrian Institute of Technology October 14, 2015 Motivation

More information

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007 CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation

More information

Depending on equations

Depending on equations Depending on equations A proof-relevant framework for unification in dependent type theory Jesper Cockx DistriNet KU Leuven 3 September 2017 Unification for dependent types Unification is used for many

More information

First Order Predicate Logic (FOL) Formulas

First Order Predicate Logic (FOL) Formulas 1 First Order Predicate Logic (FOL) Formulas Let Σ = (S, Ω) be a signature. P L(Σ) is the smallest set with (i) t = u P L(Σ), (ii) (iii) (iv) if X set of variables for Σ, s S, t, u T Σ(X),s (ϕ 1 ϕ 2 )

More information

Timo Latvala. February 4, 2004

Timo Latvala. February 4, 2004 Reactive Systems: Temporal Logic LT L Timo Latvala February 4, 2004 Reactive Systems: Temporal Logic LT L 8-1 Temporal Logics Temporal logics are currently the most widely used specification formalism

More information

Simply Typed Lambda Calculus

Simply Typed Lambda Calculus Simply Typed Lambda Calculus Language (ver1) Lambda calculus with boolean values t ::= x variable x : T.t abstraction tt application true false boolean values if ttt conditional expression Values v ::=

More information

Concrete Semantics. Tobias Nipkow & Gerwin Klein. October 8, 2017

Concrete Semantics. Tobias Nipkow & Gerwin Klein. October 8, 2017 Concrete Semantics Tobias Nipkow & Gerwin Klein October 8, 2017 Abstract This document presents formalizations of the semantics of a simple imperative programming language together with a number of applications:

More information

Cauchy s Mean Theorem and the Cauchy-Schwarz Inequality. Benjamin Porter

Cauchy s Mean Theorem and the Cauchy-Schwarz Inequality. Benjamin Porter Cauchy s Mean Theorem and the Cauchy-Schwarz Inequality Benjamin Porter March 12, 2013 Contents 1 Cauchy s Mean Theorem 3 1.1 Abstract.............................. 3 1.2 Formal proof...........................

More information

A Mechanised Proof of Gödel s Incompleteness Theorems using Nominal Isabelle

A Mechanised Proof of Gödel s Incompleteness Theorems using Nominal Isabelle A Mechanised Proof of Gödel s Incompleteness Theorems using Nominal Isabelle Lawrence C. Paulson Abstract An Isabelle/HOL formalisation of Gödel s two incompleteness theorems is presented. The work follows

More information

Computer-supported. Modeling and Reasoning. Computer-supported. Exercises and Solutions (Isabelle 2004)

Computer-supported. Modeling and Reasoning. Computer-supported. Exercises and Solutions (Isabelle 2004) Dipl.-Inf. Achim D. Brucker Dr. Burkhart Wolff Computer-supported Modeling and Reasoning http://www.infsec.ethz.ch/ education/permanent/csmr/ (rev. 16826) Computer-supported Modeling and Reasoning Exercises

More information

Kleene Algebra with Tests and Demonic Refinement Algebras

Kleene Algebra with Tests and Demonic Refinement Algebras Kleene Algebra with Tests and Demonic Refinement Algebras Alasdair Armstrong Victor B. F. Gomes Georg Struth August 28, 2014 Abstract We formalise Kleene algebra with tests (KAT) and demonic refinement

More information

SEMANTICS OF PROGRAMMING LANGUAGES Course Notes MC 308

SEMANTICS OF PROGRAMMING LANGUAGES Course Notes MC 308 University of Leicester SEMANTICS OF PROGRAMMING LANGUAGES Course Notes for MC 308 Dr. R. L. Crole Department of Mathematics and Computer Science Preface These notes are to accompany the module MC 308.

More information

2.7.1 Foundations of Proof Systems

2.7.1 Foundations of Proof Systems 2.7.1 Foundations of Proof Systems Exam 2017-2018 1 Warming up... Question 1 Give a proof in natural deduction of the following proposition : ( f = (g = h)) = (( f = g) = ( f = h)). Solution. f (g h);

More information

Program Construction and Verification Components Based on Kleene Algebra

Program Construction and Verification Components Based on Kleene Algebra Program Construction and Verification Components Based on Kleene Algebra Victor B. F. Gomes and Georg Struth October 11, 2017 Abstract Variants of Kleene algebra support program construction and verification

More information

CIS 500: Software Foundations

CIS 500: Software Foundations CIS 500: Software Foundations Midterm I October 3, 2017 Directions: This exam booklet contains both the standard and advanced track questions. Questions with no annotation are for both tracks. Other questions

More information

CIS 500 Software Foundations. Midterm II. March 28, 2012

CIS 500 Software Foundations. Midterm II. March 28, 2012 CIS 500 Software Foundations Midterm II March 28, 2012 Name: Pennkey: Scores: 1 2 3 4 5 6 Total (80 max) This exam concentrates on the material on the Imp programming language, program equivalence, and

More information

Write your own Theorem Prover

Write your own Theorem Prover Write your own Theorem Prover Phil Scott 27 October 2016 Phil Scott Write your own Theorem Prover 27 October 2016 1 / 31 Introduction We ll work through a toy LCF style theorem prover for classical propositional

More information

Rank-Nullity Theorem in Linear Algebra

Rank-Nullity Theorem in Linear Algebra Rank-Nullity Theorem in Linear Algebra By Jose Divasón and Jesús Aransay April 17, 2016 Abstract In this contribution, we present some formalizations based on the HOL-Multivariate-Analysis session of Isabelle.

More information

Solutions to Exercises. Solution to Exercise 2.4. Solution to Exercise 2.5. D. Sabel and M. Schmidt-Schauß 1

Solutions to Exercises. Solution to Exercise 2.4. Solution to Exercise 2.5. D. Sabel and M. Schmidt-Schauß 1 D. Sabel and M. Schmidt-Schauß 1 A Solutions to Exercises Solution to Exercise 2.4 We calculate the sets of free and bound variables: FV ((λy.(y x)) (λx.(x y)) (λz.(z x y))) = FV ((λy.(y x)) (λx.(x y)))

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Lecture 16: Abstract Interpretation VI (Counterexample-Guided Abstraction Refinement) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de

More information

Program Composition in Isabelle/UNITY

Program Composition in Isabelle/UNITY Program Composition in Isabelle/UNITY Sidi O. Ehmety and Lawrence C. Paulson Cambridge University Computer Laboratory J J Thomson Avenue Cambridge CB3 0FD England Tel. (44) 1223 763584 Fax. (44) 1223 334678

More information

Automated Reasoning Lecture 5: First-Order Logic

Automated Reasoning Lecture 5: First-Order Logic Automated Reasoning Lecture 5: First-Order Logic Jacques Fleuriot jdf@inf.ac.uk Recap Over the last three lectures, we have looked at: Propositional logic, semantics and proof systems Doing propositional

More information

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A CS1800 Discrete Structures Spring 2018 February 2018 CS1800 Discrete Structures Midterm Version A Instructions: 1. The exam is closed book and closed notes. You may not use a calculator or any other electronic

More information

Automata-Theoretic Model Checking of Reactive Systems

Automata-Theoretic Model Checking of Reactive Systems Automata-Theoretic Model Checking of Reactive Systems Radu Iosif Verimag/CNRS (Grenoble, France) Thanks to Tom Henzinger (IST, Austria), Barbara Jobstmann (CNRS, Grenoble) and Doron Peled (Bar-Ilan University,

More information

Programming with Dependent Types in Coq

Programming with Dependent Types in Coq Programming with Dependent Types in Coq Matthieu Sozeau LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project PPS Seminar February 26th 2009 Paris, France Coq A higher-order, polymorphic logic:

More information

Type Soundness for Path Polymorphism

Type Soundness for Path Polymorphism Type Soundness for Path Polymorphism Andrés Ezequiel Viso 1,2 joint work with Eduardo Bonelli 1,3 and Mauricio Ayala-Rincón 4 1 CONICET, Argentina 2 Departamento de Computación, FCEyN, UBA, Argentina 3

More information

SAT Solver verification

SAT Solver verification SAT Solver verification By Filip Marić April 17, 2016 Abstract This document contains formall correctness proofs of modern SAT solvers. Two different approaches are used state-transition systems shallow

More information

Nunchaku: Flexible Model Finding for Higher-Order Logic

Nunchaku: Flexible Model Finding for Higher-Order Logic Nunchaku: Flexible Model Finding for Higher-Order Logic Simon Cruanes, Jasmin Blanchette, Andrew Reynolds Veridis, Inria Nancy https://cedeela.fr/~simon/ April 7th, 2016 1 / 21 Summary Introduction Nunchaku

More information

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You: CS70 Discrete Mathematics and Probability Theory, Fall 2018 Midterm 1 8:00-10:00pm, 24 September Your First Name: SIGN Your Name: Your Last Name: Your Exam Room: Name of Person Sitting on Your Left: Name

More information

Extending the Lambda Calculus: An Eager Functional Language

Extending the Lambda Calculus: An Eager Functional Language Syntax of the basic constructs: Extending the Lambda Calculus: An Eager Functional Language canonical forms z cfm ::= intcfm boolcfm funcfm tuplecfm altcfm intcfm ::= 0 1-1... boolcfm ::= boolconst funcfm

More information

The Divergence of the Prime Harmonic Series

The Divergence of the Prime Harmonic Series The Divergence of the Prime Harmonic Series Manuel Eberl December 16, 2018 Abstract In this work, we prove the lower bound ln(h n ) ln( 5 3 ) for the partial sum of the Prime Harmonic series and, based

More information

arxiv: v1 [cs.lo] 31 Oct 2018

arxiv: v1 [cs.lo] 31 Oct 2018 Efficient LTL Decentralized Monitoring Framework Using Formula Simplification Table Omar Bataineh, David Rosenblum, and Mark Reynolds arxiv:1810.13129v1 [cs.lo] 31 Oct 2018 National University of Singapore

More information

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2014 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.

More information

Anselm s God in Isabelle/HOL

Anselm s God in Isabelle/HOL Anselm s God in Isabelle/HOL Ben Blumson September 12, 2017 Contents 1 Introduction 1 2 Free Logic 2 3 Definite Descriptions 3 4 Anselm s Argument 4 5 The Prover9 Argument 6 6 Soundness 7 7 Conclusion

More information

Semantics and Verification of Software

Semantics and Verification of Software Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ss-15/sv-sw/ The Denotational Approach Denotational

More information

Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction

Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction Jacques Fleuriot jdf@inf.ed.ac.uk Logic Puzzles 1. Tomorrow will be sunny or rainy. Tomorrow will not be sunny. What will the weather

More information

Induction; Operational Semantics. Fall Software Foundations CIS 500

Induction; Operational Semantics. Fall Software Foundations CIS 500 CIS 500 Software Foundations Fall 2005 Induction; Operational Semantics CIS 500, Induction; Operational Semantics 1 Announcements Review recitations start this week. You may go to any recitation section

More information

CIS 500 Software Foundations. Final Exam. May 9, Answer key. Hoare Logic

CIS 500 Software Foundations. Final Exam. May 9, Answer key. Hoare Logic CIS 500 Software Foundations Final Exam May 9, 2011 Answer key Hoare Logic 1. (7 points) What does it mean to say that the Hoare triple {{P}} c {{Q}} is valid? Answer: {{P}} c {{Q}} means that, for any

More information

CIS 500: Software Foundations

CIS 500: Software Foundations CIS 500: Software Foundations Solutions Final Exam December 15, 2017 1. Inductive relations (11 points) Complete the definition at the bottom of the page of an Inductive relation count that relates a list

More information

CSE 505, Fall 2008, Midterm Examination 29 October Please do not turn the page until everyone is ready.

CSE 505, Fall 2008, Midterm Examination 29 October Please do not turn the page until everyone is ready. CSE 505, Fall 2008, Midterm Examination 29 October 2008 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.

More information

Matrices, Jordan Normal Forms, and Spectral Radius Theory

Matrices, Jordan Normal Forms, and Spectral Radius Theory Matrices, Jordan Normal Forms, and Spectral Radius Theory René Thiemann and Akihisa Yamada October 10, 2017 Abstract Matrix interpretations are useful as measure functions in termination proving. In order

More information

Beyond First-Order Logic

Beyond First-Order Logic Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL

More information

The Isabelle/HOL Algebra Library

The Isabelle/HOL Algebra Library The Isabelle/HOL Algebra Library Clemens Ballarin (Editor) With contributions by Jesús Aransay, Clemens Ballarin, Stephan Hohe, Florian Kammüller and Lawrence C Paulson December 3, 2009 Contents 1 Objects

More information