Computer-supported Modeling and Reasoning. First-Order Logic. 1 More on Isabelle. 1.1 Isabelle System Architecture

Similar documents
1. M,M sequential composition: try tactic M; if it succeeds try tactic M. sequential composition (, )

HOL DEFINING HIGHER ORDER LOGIC LAST TIME ON HOL CONTENT. Slide 3. Slide 1. Slide 4. Slide 2 WHAT IS HIGHER ORDER LOGIC? 2 LAST TIME ON HOL 1

Isabelle Tutorial: System, HOL and Proofs

Overview. A Compact Introduction to Isabelle/HOL. Tobias Nipkow. System Architecture. Overview of Isabelle/HOL

Basic Foundations of Isabelle/HOL

The Eisbach User Manual

Programs and Proofs in Isabelle/HOL

Isabelle Tutorial: System, HOL and Proofs

Automated Reasoning. Natural Deduction in First-Order Logic

Computer Supported Modeling and Reasoning

Lee Pike. June 3, 2005

CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi

Isabelle/HOL:Selected Features and Recent Improvements

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Preuves Interactives et Applications

Logic as a framework for NL semantics. Outline. Syntax of FOL [1] Semantic Theory Type Theory

Computer Supported Modeling and Reasoning

An LCF-Style Interface between HOL and First-Order Logic

Introduction to dependent types in Coq

Interactive Theorem Proving (ITP) Course Parts VII, VIII

HOL-Z 2.0: A Proof Environment for Z-Specifications

Formal Systems and their Applications

1.3. Conditional expressions To express case distinctions like

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Theorem Proving Principles, Techniques, Applications Recursion

Algebraic Processors

Towards a Logical Reconstruction of Relational Database Theory

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

System Description: Twelf A Meta-Logical Framework for Deductive Systems

On Theorem Prover-based Testing

From Types to Sets in Isabelle/HOL

2 Introduction to operational semantics

An Introduction to ProofPower

Axiom 3 Z(pos(Z) X(X intersection of Z P(X)))

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

An Introduction to Isabelle/HOL 2008

Integration of SMT Solvers with ITPs There and Back Again

c constructor P, Q terms used as propositions G, H hypotheses scope identifier for a notation scope M, module identifiers t, u arbitrary terms

Coq quick reference. Category Example Description. Inductive type with instances defined by constructors, including y of type Y. Inductive X : Univ :=

COMP 4161 Data61 Advanced Course. Advanced Topics in Software Verification. Gerwin Klein, June Andronick, Christine Rizkallah, Miki Tanaka

1. Abstract syntax: deep structure and binding. 2. Static semantics: typing rules. 3. Dynamic semantics: execution rules.

The Isar Proof Language in 2016

(Refer Slide Time: 4:00)

Types and Programming Languages. Lecture 5. Extensions of simple types

Specifying and Implementing Theorem Provers in a Higher-Order Logic Programming Language

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description)

Organisatorials. About us. Binary Search (java.util.arrays) When Tue 9:00 10:30 Thu 9:00 10:30. COMP 4161 NICTA Advanced Course

λ calculus is inconsistent

An Annotated Language

COMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein

A Logic of Proofs for Differential Dynamic Logic

Verified Firewall Policy Transformations for Test Case Generation

Unifying Theories in Isabelle/HOL

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics

A Short Introduction to First-Order Theorem Proving with KeY

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

The Isabelle/Isar Reference Manual

CSE 341: Programming Languages

Isabelle Primer for Mathematicians

Logical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam

Inductive Definitions, continued

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

Verification of an LCF-Style First-Order Prover with Equality

Reasoning Using Higher-Order Abstract Syntax in a Higher-Order Logic Proof Environment: Improvements to Hybrid and a Case Study

Lexicografie computationala Feb., 2012

Programming and Proving in

Lambda Calculus and Type Inference

Proofs and Proof Certification in the TLA + Proof System

locales ISAR IS BASED ON CONTEXTS CONTENT Slide 3 Slide 1 proof - fix x assume Ass: A. x and Ass are visible Slide 2 Slide 4 inside this context

The Prototype Verification System PVS

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy

On Agda JAIST/AIST WS CVS/AIST Yoshiki Kinoshita, Yoriyuki Yamagata. Agenda

ALGEBRAIC PROCESSORS

Introduction to Mathematical Programming IE406. Lecture 4. Dr. Ted Ralphs

Logical reasoning systems

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics

Extracting the Range of cps from Affine Typing

Programming Languages Third Edition

X-KIF New Knowledge Modeling Language

Mechanized metatheory revisited

Induction for Data Types

Bliksem 1.10 User Manual

Today s Lecture 4/13/ WFFs/ Free and Bound Variables 9.3 Proofs for Pred. Logic (4 new implicational rules)!

CSE Discrete Structures

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

Typed Lambda Calculus for Syntacticians

Recursion. Tjark Weber. Functional Programming 1. Based on notes by Sven-Olof Nyström. Tjark Weber (UU) Recursion 1 / 37

ROUGH MEMBERSHIP FUNCTIONS: A TOOL FOR REASONING WITH UNCERTAINTY

PRocH: Proof Reconstruction for HOL Light

Citation 数理解析研究所講究録 (2011), 1769:

Case-Analysis for Rippling and Inductive Proof

A Case Study of Co-induction in Isabelle 1

Type Systems COMP 311 Rice University Houston, Texas

Isabelle: The Next 700 Theorem Provers

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

Range Restriction for General Formulas

The Typed λ Calculus and Type Inferencing in ML

Old Introduction to Isabelle

Introduction to Lambda Calculus. Lecture 5 CS 565 1/24/08

Transcription:

Dipl-Inf Achim D Brucker Dr Burkhart Wolff Computer-supported Modeling and easoning http://wwwinfsecethzch/ education/permanent/csmr/ (rev 16814) Submission date: First-Order Logic In this lecture you will deepen your knowledge about first-order logic (fol) Theorem proving in fol involves the issue of binding and substitution, which we treat at a fairly pragmatic level for the moment (The issue will be revisited in the subsequent exercises on meta-theory and λ-calculus) We will learn to manage premises in backward proofs and tactic methods that manipulate assumptions in backward proofs 1 More on Isabelle 11 Isabelle System Architecture For using Isabelle it is sometimes helpful if one has a broad overview of Isabelle s system architecture (see Fig 1) Isabelle is generic theorem prover providing a simple meta logic; it is implemented the functional language Standard ML (sml) On top of the Isabelle core, a variety of Isabelle instances are built, eg Isabelle/fol (for first-order logic), Isabelle/hol (for higher-order logic), or Isabelle/zf (for Zermelo-Fränkel set theory) Isabelle instances can be programmed directly via programs written in sml or via the isar-proof language, which also provides powerful documentation facilities On top of this, different sml 1

Proof General (X)Emacs based User Interface Isabelle/FOL Isabelle Instance for FOL SML based User Interface Isabelle Generic Theorem Prover Standard ML (SML) Implementation Language Figure 1: The System Architecture of Isabelle Proof General user interfaces are provided In this lecture, we use the most modern interface, called Proof General, which itself builds upon the (X)Emacs editor family 12 Assumptions in Backward Proof assumptions In backward proof, Isabelle allows two notions for introducing assumptions into a proof context For simple cases we can use lemma name: [ a 1 ; ; a n ]= C assumes and insert One can use the assumes or and to enumerate several assumptions Using this style, the assumptions are not automatically added to assumption list of the goals If needed, you can insert them with the command insert Assumptions, derived rules, rules, axioms, theorems are all the same in Isabelle and can be combined in arbitrary ways in forward and backward proof! emark: Internally, all these objects are represented as a particular abstract data type thm The Isabelle kernel is a collection of sml-modules that implethm The latter format introduces assumptions as named objects that can be referenced identically to rules: lemma name: assumes name 1 : a 1 assumes name n : a n shows C lemma name: assumes name 1 : a 1 and name n : a n shows C 2

ment this data type (provers of this system architecture are often referred as lcs-style-provers) lcs-style 13 New FOL ules The distinctive feature of fol compared to pl are the quantifiers and Note that quantifiers have low priority, eg, we have to write ( xp(x)) ( xp(x)) ecall the introduction and elimination quantifier rules from the lecture: [P (x)] P (x) x P (x) x P (x) -I1 P (t) -E P (t) x P (x) -I x P (x) -E 2 where the side conditions are: quantifier rules 1 x is not free in any assumption on which P (x) depends 2 x is not free in B or any assumption of the sub-derivation of B other than A(x) In Isabelle/fol, these rules are represented (including the side conditions) as follows: ( xp (x)) = ( xp (x)) alli ( xp (x)) = P (x) spec [ P (x) = ( xp (x)) exi xp (x); ] xp (x) = = exe spec alli exi exe Where is the meta-level universal quantification If a goal is preceded by the meta-quantor x, this means that Isabelle must be able to prove the subgoal in a way which is independent from x, ie, without instantiating x Another view on meta-level quantification is that they introduce fresh free variables on the fly (in fact, variables bound by outermost meta-level quantifiers were treated as free variables within substitutions) Whenever an application of a rule leads to the introduction of meta variables in a goal preceded by, these introduced meta variables will be made dependent on x You may also say that those meta-variables will be Skolem functions of x When experimenting with rule applications introducing s, you will notice that the order of these introductions is crucial meta-level universal quantifier 3

14 Substitutions in Backward Proof rule tac As mentioned in the lecture, Isabelle uses meta-variables?x,?y, These meta-variables are logically treated as free variables, but may be instantiated either interactively or automatically by Isabelle itself Sometimes the automatic instantiation is not appropriate for a proof; then the user must provide it interactively In forward proof, this can be done by the of command you have already got to know In backward proof, variants of proof commands were provided Instead of apply(rule name) we might give several substitution during rule application : apply( rule tac of x 1 = term 1 and and x n = term n in rule) Where rule tac may contain syntactic elements and free variables of the proof context Note that apply( rule tac of x = term in rule) is not the same as apply(rule [of term ]) Can you figure out why? 15 Manipulating Assumptions in Backward Proof So far, we never changed the assumptions a i of a goal [a 1 ; ; a n ] = C The command rule instantiates its argument rule such that its conclusion becomes equal to the conclusion C of the goal A collection of Isabelle tactic methods follows a different strategy: erule drule frule insert erule tac drule tac frule tac 1 erule rule constructs an instantiation such that the first assumption b 1 of rule becomes equal to an a i, and that the conclusion of rule becomes equal to an C a i is erased from the assumptions 2 drule rule constructs an instantiation such that the first assumption b 1 of rule becomes equal to an a i, and that the conclusion of rule becomes a new assumption a i is erased from the assumptions 3 drule rule works like drule rule but does not erase a i Moreover, with the command insert, an arbitrary theorem or assumption can be added to the assumption list Note that for some of these tactic methods are variants with explicit substitutions available: erule tac, drule tac, and frule tac 4

2 Exercises 21 Exercise 5 Derive the following rules in Isabelle: [P, Q] [Q] [P ] P Q 22 Exercise 6 conje P Q P impe P P P noti Prove the following theorems using erule and disje and conje wherever possible note conje, impe noti, note 1 (A B) C A B C 2 (A B) (C D) (B C) (D A) 3 (A B) (C D) (B C) (D A) Compare the first two proofs with the proofs without erule in Ex 1 23 Exercise 7 Derive the rule [A] [B] B A A B in Isabelle ecall that is defined by: P Q (P Q) (Q P ) iff def Use erule and drule wherever you can 24 Exercise 8 Prove the following theorems of first-order logic in Isabelle: 1 ( xp(x)) xp(x) 2 (( xp(x)) ( xq(x))) ( x(p(x) q(x))) 3 (( xp(x)) ( xq(x))) ( x(p(x) q(x))) 5

4 ( x yp(x, y)) ( y xp(x, y)) 5 ( xp(f(x))) ( xp(x)) What about: ( x(p(x) q(x))) (( xp(x)) ( xq(x)))? Can you prove it? 25 Exercise 9 Prove ( xa B(x)) (A xb(x)) all distr in Isabelle euse Exercise 7 In lecture 15 fol: Natural Deduction it was said that in the above theorem it is crucial that A does not contain x freely How does Isabelle take this into account? Try to prove: p(x) xp(x) 26 Exercise 10 Prove the following theorem of first-order logic in Isabelle: s (s (s (s (zero)))) = four p(zero) ( xp(x) p(s(s(x)))) p(four) 6