Advanced Formal Methods Lecture 7: Isabelle – Sets Mads Dam KTH/CSC Course 2D1453, 2006-07 Material from L. Paulson.

Slides:



Advertisements
Similar presentations
Functional Programming Lecture 13 - induction on lists.
Advertisements

Completeness and Expressiveness
First Order Logic Logic is a mathematical attempt to formalize the way we think. First-order predicate calculus was created in an attempt to mechanize.
Introduction to Proofs
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
CS344 : Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 9,10,11- Logic; Deduction Theorem 23/1/09 to 30/1/09.
Logic Concepts Lecture Module 11.
Chapter 3. Mathematical Reasoning 3.1 Methods of proof A theorem is a statement that can be shown to be true. A proof is to demonstrate that a theorem.
Induction and recursion
Math 3121 Abstract Algebra I
Advanced Formal Methods Lecture 6: Isabelle - HOL Mads Dam KTH/CSC Course 2D1453, Material from L. Paulson.
Induction Sections 41. and 4.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
Lecture 19 Exam: Tuesday June14 4-6pm Overview. Disclaimer The following is a only study guide. You need to know all the material treated in class.
Logic and Proof. Argument An argument is a sequence of statements. All statements but the first one are called assumptions or hypothesis. The final statement.
Discrete Mathematics Lecture 2 Alexander Bukharovich New York University.
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 12 Number theory Mathematical induction Proof by induction Examples.
Lecture ,3.3 Sequences & Summations Proof by Induction.
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Discrete Structures Lecture 11 Implication II 1.
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
CS621: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture–4: Fuzzy Inferencing 29 th July 2010.
Harper Langston New York University Summer 2015
Lecture 9. Arithmetic and geometric series and mathematical induction
CSCI 115 Chapter 2 Logic. CSCI 115 §2.1 Propositions and Logical Operations.
CAS- 734 (Presentation -1) By : Vasudha Kapil
Copyright © Peter Cappello Mathematical Induction Goals Explain & illustrate construction of proofs of a variety of theorems using mathematical induction.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
CSE 311 Foundations of Computing I Lecture 8 Proofs and Set Theory Spring
CSCI 2670 Introduction to Theory of Computing Instructor: Shelby Funk.
9.4 Mathematical Induction
CSE-321 Programming Languages Inductive Definitions POSTECH March 14, 2007 박성우.
CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.
Advanced Formal Methods Lecture 5: Isabelle – Proofs and Rewriting Mads Dam KTH/CSC Course 2D1453, Some slides from Paulson.
Chapter Mathematical Induction 4.2 Strong Induction and Well-Ordering 4.3 Recursive Definitions and Structural Induction 4.4 Recursive Algorithms.
Induction Proof. Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
CS6133 Software Specification and Verification
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Mathematical Preliminaries
CSE 311 Foundations of Computing I Lecture 9 Proofs and Set Theory Autumn 2012 CSE
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture–7: (a) Formal System;(b) How to read research papers 3 rd August, 2010.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
INM175 Topic 8 1 Module INM175 Discrete Mathematics Topic 8 Algebraic Theories.
1 Finite Model Theory Lecture 1: Overview and Background.
Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Course 2D1453, Some material from B. Pierce: TAPL + some from.
1 Course Summary CS 202 Aaron Bloomfield. 2 Outline A review of the proof methods gone over in class Interspersed with the most popular demotivators from.
Advanced Formal Methods Lecture 4: Isabelle – Types and Terms Mads Dam KTH/CSC Course 2D1453, Some material from Paulson.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
Inductive Definitions Kangwon National University 임현승 Programming Languages These slides were originally created by Prof. Sungwoo Park at POSTECH.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2012 CSE
The Logic of Conditionals Chapter 8 Language, Proof and Logic.
Mathematical Induction
Foundations of Computing I CSE 311 Fall Announcements Homework #2 due today – Solutions available (paper format) in front – HW #3 will be posted.
CS344 : Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 4- Logic.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
CSE 311 Foundations of Computing I
Advanced Algorithms Analysis and Design
Induction and recursion
PROGRAMMING IN HASKELL
PROGRAMMING IN HASKELL
CSE 311: Foundations of Computing
MA/CSSE 474 More Math Review Theory of Computation
Formal Methods in software development
Advanced Analysis of Algorithms
PROGRAMMING IN HASKELL
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

Advanced Formal Methods Lecture 7: Isabelle – Sets Mads Dam KTH/CSC Course 2D1453, Material from L. Paulson

Basic Constructions types ’  set = ’  ! bool Note that HOL sets are always typed Easy to define basic set constructions: ; :: ’  set = x. false {t} = x. x = t t 2 A = A t A µ B = 8x. A x ! B x A [ B = x. :(A x) ! B x 8x 2 A. P x = 8x. x 2 A ! P x 9 x 2 A. P x = 9x. x 2 A Æ P x

Exercises Exercise 1: Represent in Isabelle the following set operations: 1.A Å B 2. Å x2 A B x, [ x2 A B x 3.insert :: ’  ) ’  set ) ’  set

Proof Rules Prove lemmas following natural deduction-style introduction and elimination rules: subsetI: (Æ x. x 2 A ) x 2 B) ) A µ B subsetE: « A µ B; x 2 A ¬ ) x 2 B ballI: (Æ x. x 2 A ) P x) ) 8x 2 A. P x ballE: « 8x 2 A. P x ; x 2 A ¬ ) P x etc.

Finite Sets Inductive definition: The empty set is finite Adding an element to a finite set produces a finite set These are the only finite sets HOL encoding: consts Fin :: ’  set set inductive Fin Intros ; 2 Fin A 2 Fin ) insert a A 2 Fin

Example: Even Numbers Inductively: 0 is even If n is even then so is n + 2 These are the only even numbers In Isabelle HOL: consts Ev :: nat set inductive Ev intros 0 2 Ev n 2 Ev ) n Ev

Inductively Defined Sets Definition mechanism: Define carrier set Declare set to be inductively defined Declare introduction methods Declaration inductive tells Isabelle to produce a number of proof rules: Introduction rules Induction rules Elimination rules (case construction) Rule inversion rules

Example: Proof by Induction Definition of set Ev produces induction principle Goal: m 2 Ev ) m + m 2 Ev Proof: m = 0 ! Ev m = n + 2 and n 2 Ev and m 2 Ev and n + n 2 Ev ) m + m = (n + 2) + (n + 2) = ((n + n) + 2) Ev

Rule Induction for Ev To prove n 2 Ev ) P n by rule induction on n 2 Ev we must prove P 0 P n ) P (n + 2) Isabelle-generated induction principle: « n 2 Ev ; P 0 ; Æ n. P n ) P (n +2) ¬ ) P n An elimination rule for Ev!

Rule Inversion Isabelle proves this by induction: ev.cases: « n 2 Ev; n = 0 ) P ; Æ m. « n = Suc(Suc m); m 2 Ev¬ ) P ¬ ) P inductive cases : Suc(Suc n) 2 Ev Instantiates even.cases to produce: : « Suc(Suc n) 2 Ev ; n 2 Ev ) P ¬ ) P Equivalently: Suc(Suc n) 2 Ev ) n 2 Ev

Mutual Induction Even and odd numbers: consts Ev :: nat set Odd :: nat set inductive Ev Odd intros zero: 0 2 Ev evenI: n 2 Odd ) Suc n 2 Ev oddI: n 2 Ev ) Suc n 2 Odd

Exercise Exercise 2: Define a recursive datatype of implicational formulas containing constants tt and ff and binary constructor -> (infixed, probably, for readability). Define inductively the set of provable formulas as the least set containing, for all formulas F, G, H, the formulas F -> F F -> (G -> F) (F -> (G -> H)) -> (F -> G) -> (F -> H) and closed under modus ponens (F and F -> G in the set implies G in the set). Formulate a predicate ”valid” on formulas, and show, in Isabelle, that all provable formulas a valid.