Introduction to Isabelle/HOL

Similar documents
Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Automated Reasoning Lecture 5: First-Order Logic

Isabelle/FOL First-Order Logic

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

Isabelle/FOL Proof Assistant

Manual of Logical Style

Deduction by Daniel Bonevac. Chapter 3 Truth Trees

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Predicate Logic. Andreas Klappenecker

What is the decimal (base 10) representation of the binary number ? Show your work and place your final answer in the box.

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54

First order Logic ( Predicate Logic) and Methods of Proof

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Learning Goals of CS245 Logic and Computation

First-Order Logic. Chapter Overview Syntax

02 Propositional Logic

Logic, Sets, and Proofs

Deductive Systems. Lecture - 3

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Adam Blank Spring 2017 CSE 311. Foundations of Computing I

CITS2211 Discrete Structures Proofs

Steinhardt School of Culture, Education, and Human Development Department of Teaching and Learning. Mathematical Proof and Proving (MPP)

Proofs. Introduction II. Notes. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

2-4: The Use of Quantifiers

Proofs. Example of an axiom in this system: Given two distinct points, there is exactly one line that contains them.

Manual of Logical Style (fresh version 2018)

Logic Overview, I. and T T T T F F F T F F F F

A. Propositional Logic

Propositional natural deduction

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Intermediate Logic. Natural Deduction for TFL

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

KE/Tableaux. What is it for?

Chapter 3. The Logic of Quantified Statements

Today s Lecture 2/25/10. Truth Tables Continued Introduction to Proofs (the implicational rules of inference)

Lecture 5 : Proofs DRAFT

Discrete Mathematics. Instructor: Sourav Chakraborty. Lecture 4: Propositional Logic and Predicate Lo

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19.

Advanced Topics in LP and FP

COMP3702/7702 Artificial Intelligence Week 5: Search in Continuous Space with an Application in Motion Planning " Hanna Kurniawati"

Section 1.1 Propositions

Propositional Logic: Part II - Syntax & Proofs 0-0

Introduction to Metalogic

It rains now. (true) The followings are not propositions.

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/33

Negation introduction

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!!

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

MAT 243 Test 1 SOLUTIONS, FORM A

Proofs: A General How To II. Rules of Inference. Rules of Inference Modus Ponens. Rules of Inference Addition. Rules of Inference Conjunction

Mat 243 Exam 1 Review

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe:

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.

Supplementary Logic Notes CSE 321 Winter 2009

Knowledge Representation and Reasoning

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Natural Deduction for Propositional Logic

Foundations of Logic Programming

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Warm-Up Problem. Write a Resolution Proof for. Res 1/32

1.1 Statements and Compound Statements

Discrete Mathematics

Logik für Informatiker Logic for computer scientists

Propositional logic (revision) & semantic entailment. p. 1/34

Inductive Predicates

CS 380: ARTIFICIAL INTELLIGENCE

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

CSCE 222 Discrete Structures for Computing. Predicate Logic. Dr. Hyunyoung Lee. !!!!! Based on slides by Andreas Klappenecker

CPSC 121: Models of Computation

Class 29 - November 3 Semantics for Predicate Logic

Logic and Proofs. (A brief summary)

Propositional Logic: Review

Chapter 1: The Logic of Compound Statements. January 7, 2008

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 5 p. 1/60

MAI0203 Lecture 7: Inference and Predicate Calculus

Proof strategies, or, a manual of logical style

Lecture 3 : Predicates and Sets DRAFT

Intelligent Agents. Pınar Yolum Utrecht University

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Predicate Logic - Deductive Systems

Logik für Informatiker Proofs in propositional logic

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements

Logic and Inferences

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

ECOM Discrete Mathematics

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Inference in first-order logic

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

In this chapter, we specify a deductive apparatus for PL.

Review. Propositions, propositional operators, truth tables. Logical Equivalences. Tautologies & contradictions

Chapter 2: The Logic of Quantified Statements

Artificial Intelligence

Section 1.2: Propositional Logic

AI Programming CS S-09 Knowledge Representation

CSE 20 DISCRETE MATH. Winter

Transcription:

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 be expressed as P x y or (P x) y - recall that in higher order logic: functions, sets and predicates can be identified with each other Jacques Fleuriot x P, x P are quantified sentences (where P may or may not contain x) If and only if is expressed using = eg (P ) = ( P ) Has decision procedures eg linear arithmetic Simplifier does rewriting Has its own connectives and uantifiers: eg Isabelle Isabelle Isabelle/HOL sets Other logic egpropositional, FOL etc 2 Meta-logic has Universal quantifier Implication Conjunction ; Proof tools: blast, auto, etc Forward and backward proofs Natural Deduction - Introduction ules - Elimination ules Isabelle tactics/methods 4 easoning in Isabelle eg rule, drule, auto, We will look at procedural proofs ie proofs will have sequences of Has reasoning methods (based on natural deduction for example) Hierarchy of theories eg sets, natural numbers, real numbers, security protocols apply (methodtheorem_name) 1

The ules of the Game So far, we have seen (automatic) refutation proofs mainly Isabelle uses mostly natural deduction Natural deduction aims to capture human reasoning patterns when doing formal logic Each logical connective has two kinds of rules: Introduction ules: allow connective to be inferred Elimination ules: allow consequences from connective to be deduced In general, rules will involve other logical symbols eg user defined ones 5 Conjunction Introduction rule:?p,?: schematic variables can be substituted for 7 Natural Deduction (Cont) Isabelle syntax: premises [?P;? ]?P "? (conji) conjunction fat brackets group premises In procedural style: mainly reason backwards conclusion Natural Deduction Example: Conjunction Introduction enables us to introduce the 6 premises connective A Simple Proof Given that P is true and that is true prove P!$#! P% 8 introduced in conclusion P P! conji conclusion Isabelle name for rule branch is closed P assumption assumption (! P) P! (! P) P assumption conji conji Forward proof: If we have P and we have then we have P Backward proof: To prove P, prove that P is true and prove that is true Assumptions: P 2

A Simple Backward Proof in Isabelle Given that P is true and that is true prove P!$#! P% Isabelle keyword Isabelle commands! lemmaa_conj_theorem: [ P ; ] P! ( P) apply (rule conji) apply (rule conji) qed The method/tactic called rule applies its argument (a theorem) backwards 9 name given to resulting theorem P P 11 Other Introduction ules (II) disji1 [P] [] P iffi P= P disji2 [P] false P noti Intuition: P = (P false) Isabelle: [?P?;??P ] P= Common notation: 10 Other Introduction ules (I) [P] P impi Isabelle: (?P & % & P & #impi% or as Note: [P]: assumption local to sub-proof P P impi Forward: If on the the assumption that P is true, can be shown to hold, then we can conclude P Backward: To prove P, assume P is true and prove that follows More rules to come Substitution In Isabelle literature:p[t/x] is result of replacing x by t in P s =t P[t /x] s =t s =s t =s P[s /x] ssubst 12 Note: this is same as P {t / x} that we saw before only positions designated by variable substituted by this rule Substitution rule in Isabelle:[?t =?s ;?P?s ]?P?t (ssubst) Example: prove symmetry of equality predicate ie s = t t = s: Justification: s =t (x =s )[s /x] t =s 3

' ) ) uantifiers, : need substitution and notion of arbitrary variable Universal uantifier: 13 Other Introduction ules (III) P x 0 alli x P x x 0 is arbitrary ie we make no assumptions about it provided x 0 does not occur in P x or any premise on P x 0 which may depend In Isabelle: use underlying formalism of Isabelle, the meta-logic, to express the proviso logically Isabelle s meta-logical universal quantifier enables notion of arbitrary value ( ( x?px) x?px don t confuse this with conjunction Elimination ules Work in opposite direction from introduction rules Conjunction rules: P * P * conjunct1 P 15 conjunct2 In Isabelle:?P +??P?P +?? [P], []local to their subproofs Disjunction rule: P [P] [] haveto prove twice under different assumptions disje [?P? ;?P? ;?? ]? (disje) Existential uantifier: In Isabelle: Example: P a x Px?P?a x?px 14 Other Introduction ules (IV) even 2 x evenx If we can exhibit some a such that P(a) is true then x P(x) is also true 16 Elimination ules (II) Using an elimination rule backwards produces a case-split Example: Assume A B prove B A erule enables this subgoal to be proved immediately from premise of goal A, B B, [A] A A B, assum disji2 A [B] assum B disji2 B, A disje Note: can use erule method, designed to work with elimination rules 4

Example: Elimination ules (III) II) A possible Isabelle proof: 17 Assume A B prove B A lemmadisj_swap: A BB A apply (erule disje) apply (rule disji2) could have used apply (rule disje) This need extra step though apply (rule disji1) Try it in Isabelle! qed Isabelle/HOL A Special Elimination ule for Conjunction Isabelle provides an alternative conjunction elimination rule [P][] P conje 19 In Isabelle: [?P? ;[?P ;? ]? ]? (conje) Isabelle/HOL: A Special Elimination ule Isabelle elimination rules for are: P * conjunct1: P * conjunct2: P rules simply return 1 st /2 nd half of conjunct - these are called destruction rules in Isabelle - they break and destroy a premise (we lose info when we apply them) 18 Implication: Elimination ules (IV) Modus Ponens P P Example: mp ProveP ( ) P P * assum 20 In Isabelle: [?P? ;?P ]? 1 P ( ) 2 [P ] 3 [P] 4 [] P ( ) assum P assum assum mp mp conje impi P * 5

Negation: 21 More Elimination ules (V) elimination rule deduces any formula in the presence of both P and P P P note Isabelle:[?P;?P ]? (note) In Isabelle, there are many useful proved theorems about negation that can be used in proofs Proof by contradiction often uses theorems involving contrapositives such as: P and P [ P] Example theorem: P Isabelle: [? ;?P? ]?P Elimination ules for uantifiers Existential uantifier: x P x [P x 0 ] exe 23 Provided x 0 does not occur in P x or or any other premises other than P x 0 on which derivation of from P x depends 0 - In Isabelle: [ x?p x ; x?p x? ]? This proviso is part of the rule definition and cannot be omitted (exe) This is (once again) universal quantification in the Isabelle meta-logic (cf alli) It ensures that the proviso is enforced 22 Elimination ules for uantifiers Summary 24 Universal Elimination: x Px Pt Isabelle: ( x?p x )?P?x spec Note: In Isabelle terminology, this is a destruction rule Can provide an alternative non-destructive rule [P x] x P x alle Isabelle: unknown variable can be freely instantiated to any term [ x?p x ;?P?x ] (alle) A first look at theorem proving in Isabelle/HOL Natural Deduction - introduction and elimination rules in Isabelle - some rules have provisos Proofs can be given as a tree for natural deduction ead Chapter 5 of tutorial on Isabelle/HOL - available via A web page More to come 6