Automated Reasoning. Natural Deduction in First-Order Logic

Similar documents
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

Lecture 5: Predicate Calculus. ffl Predicate Logic ffl The Language ffl Semantics: Structures

Basic Foundations of Isabelle/HOL

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

SOFTWARE ENGINEERING DESIGN I

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

Inference rule for Induction

CITS2211 Discrete Structures Logic

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

Introduction to dependent types in Coq

CSE 311: Foundations of Computing. Lecture 8: Predicate Logic Proofs

First-Order Logic PREDICATE LOGIC. Syntax. Terms

Inductive Definitions, continued

15-819M: Data, Code, Decisions

Going beyond propositional logic

Analysis of dependent types in Coq through the deletion of the largest node of a binary search tree

Warm-Up Problem. Let L be the language consisting of as constant symbols, as a function symbol and as a predicate symbol. Give an interpretation where

Typed First-order Logic

First Order Predicate Logic CIS 32

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

Part I Logic programming paradigm

Chapter 1.3 Quantifiers, Predicates, and Validity. Reading: 1.3 Next Class: 1.4. Motivation

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 :=

Higher-Order Logic. Specification and Verification with Higher-Order Logic

CSC Discrete Math I, Spring Sets

Programming Languages Third Edition

Lecture 1: Conjunctive Queries

Introduction to Axiomatic Semantics

Lee Pike. June 3, 2005

CMSC 330: Organization of Programming Languages

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

(Refer Slide Time: 4:00)

Computation Club: Gödel s theorem

Programming Language Concepts, cs2104 Lecture 04 ( )

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

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers.

Fall Lecture 3 September 4. Stephen Brookes

Formal Methods in Software Engineering 1

Induction and Semantics in Dafny

Semantics and Pragmatics of NLP Propositional Logic, Predicates and Functions

On Academic Dishonesty. Declarative Computation Model. Single assignment store. Single assignment store (2) Single assignment store (3)

Propositional Calculus: Boolean Functions and Expressions. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

The discussion of Chapter 1 will be split into two sessions; the first will cover 1.1 and 1.2; the second will cover 1.3, 1.4, and 1.5.

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Introductory logic and sets for Computer scientists

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

Coq projects for type theory 2018

Variables. Substitution

Lecture 4: January 12, 2015

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Proofs are Programs. Prof. Clarkson Fall Today s music: Proof by Paul Simon

Propositional Logic. Part I

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

CMSC 330: Organization of Programming Languages. Operational Semantics

CSC 501 Semantics of Programming Languages

Lecture Notes on Induction and Recursion

Chapter 3: Propositional Languages

Infinite Objects and Proofs 1

Flang typechecker Due: February 27, 2015

CSE Discrete Structures

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS

Sets. Sets. Subset, universe. Specifying sets, membership. Examples: Specifying a set using a predicate. Examples

Bootcamp. Christoph Thiele. Summer An example of a primitive universe

Lecture 5 - Axiomatic semantics

Software Engineering Lecture Notes

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

Lambda Calculi With Polymorphism

Z Notation. June 21, 2018

The Metalanguage λprolog and Its Implementation

An Introduction to Programming and Proving in Agda (incomplete draft)

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

Logical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam

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

a brief introduction to (dependent) type theory

Introduction to Logic Programming

The Substitution Model

CIS 500 Software Foundations. Midterm I. (Standard and advanced versions together) October 1, 2013 Answer key

LASER 2011 Summerschool Elba Island, Italy Basics of COQ

Discrete Mathematics Lecture 4. Harper Langston New York University

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

Formal Specifications

Exercises on Semantics of Programming Languages

Safe Stratified Datalog With Integer Order Does not Have Syntax

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

Propositional Logic. Andreas Klappenecker

CSI30. Chapter 1. The Foundations: Logic and Proofs Rules of inference with quantifiers Logic and bit operations Specification consistency

Chapter 9: Constraint Logic Programming

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

CIS 500: Software Foundations

An Athena tutorial. Konstantine Arkoudas

Preuves Interactives et Applications

Towards a Logical Reconstruction of Relational Database Theory

Lectures 20, 21: Axiomatic Semantics

Review. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals

CS3110 Spring 2017 Lecture 9 Inductive proofs of specifications

Lambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,

Software Paradigms (Lesson 6) Logic Programming

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

Transcription:

Automated Reasoning Natural Deduction in First-Order Logic Jacques Fleuriot Automated Reasoning Lecture 4, page 1

Problem Consider the following problem: Every person has a heart. George Bush is a person. Does George Bush have a heart? Is Propositional logic rich enough to formally represent and reason about this problem? The finer logical structure of this problem would not be captured by the constructs we have so far encountered. We need a richer language! Automated Reasoning Lecture 4, page 2

A Richer Language First order logic () extends propositional logic: Reasons about individuals in a universe of discourse and their properties Have predicates and functions to denote properties A variable stands for an element of the universe Variables range over individuals but not over functions and predicates Propositional connectives used to build up statements Quantifiers (for all) and (there exists) used also known as Predicate logic Automated Reasoning Lecture 4, page 3

First order language is characterized by giving a finite collection of functions F and predicates P as well as a set of variables. Often call (F, P ) a signature 2 syntactic categories: terms and formulae terms stand for individuals while formulae stand for truth values Automated Reasoning Lecture 4, page 4

Terms of Terms of a first-order language are defined as: Any variable is a term If c F is a nullary function (i.e. a constant), then c is a term If t 1,..., t n are terms and function f F has arity n > 0, then f(t 1,..., t n ) is a term Nothing else is a term Automated Reasoning Lecture 4, page 5

Formulae of A well-formed formula in is defined as: If P P is a predicate symbol of arity n 0, and if t 1,..., t n are terms over F, then P(t 1,..., t n ) is a formula. If is a formula, then so is ( ). If and are formulas, then so are ( ), ( ), ( ) and ( ). If is a formula and x is a variable, then ( x. ) and ( x. ) are formulas. Nothing else is a formula. Automated Reasoning Lecture 4, page 6

Example: Problem Revisited We can now formally represent our problem in : Every person has a heart: x. person(x) hasheart(x) George Bush is a person: person(bush) To answer the question Does George Bush have a heart? we need to prove: (( x. person(x) hasheart(x)) person(bush)) hasheart(bush) How do we prove if this is a valid statement? - more on this later Automated Reasoning Lecture 4, page 7

Variables In, variables can be in one of two states: bound: x. x=x or x. x=x, etc... free: x=x For example, in the proposition: x. y. x * y = z x and y are bound variables and z is a free variable. Automated Reasoning Lecture 4, page 8

Substitution Rule If P is a formula, s is a term, and x is a free variable, then P [s/x] is the formula obtained by substituting s for x throughout P. Such a substitution rule can be defined as: s=t P [s/ x ] P [t / x ] subst Example: x. P(x,y) [3/y] = x. P(x,3) x. P(x,y) [2/x] = x. P(x,y) Automated Reasoning Lecture 4, page 9

Semantics of Formulae Informal view: An interpretation of a formula maps its function symbols, including constants, to actual functions, and its predicate symbols to actual relations. The interpretation also specifies some domain D (a non-empty set or universe) on which the functions and relations are defined. Automated Reasoning Lecture 4, page 10

Definition of Interpretation An interpretation for a wff consists of a nonempty set D, called the domain of the interpretation, together with an assignment of meanings to the symbols of the wff. 1. Each predicate symbol is assigned to a relation over D. A nullary predicate is assigned a truth value. 2. Each function symbol is assigned to a function over D. Each nullary function (constant) is assigned to a value in D. 3. Each free variable is assigned to a value in D. All free occurrences of a free variable x are assigned to the same value in D. Automated Reasoning Lecture 4, page 11

Example of Interpretation Consider the formula P(a) x. Q(a,x) (*) formula does not mean anything on its own A possible interpretation is: Domain is the set of natural numbers (e.g. 0, 1, 2, 3,...) Assign 2 to a, assign the property of being even to P, and the relation of being greater than to Q, i.e Q(x,y) means x is greater than y Under this interpretation: (*) affirms that 2 is even and there exists a natural number that 2 is greater than. Is (*) satisfied under this interpretation? -Yes Such a satisfying interpretation is known as a model Automated Reasoning Lecture 4, page 12

Semantics of Formulae The semantics (meaning) of a wff in with respect to an interpretation with domain D is the truth value obtained by applying the following rules: 1. If the wff has no quantifiers then its meaning is the truth value of the proposition obtained by applying the interpretation to the wff. 2. If the wff contains x. W then x. W is true if W [d/x] is true for every d D. Otherwise, x. W is false. 3. If the wff contains x. W then x. W is true if W [d/x] is true for some d D. Otherwise, x. W is false. Automated Reasoning Lecture 4, page 13

More Introduction Rules Our natural deduction rules for Propositional logic need to be extended to deal with. Quantifiers, need substitution and notion of arbitrary variable: x 0 is an arbitrary free variable i.e. we make no assumptions about it P x 0 x. P x alli provided x 0 is fresh P a x. P x exi Automated Reasoning Lecture 4, page 14

Existential Elimination The proviso is part of the rule definition and cannot be omitted u.p u Q [P x ] Q exe Provided x does not occur in P u or Q or any other premise other than P x on which derivation of Q from P x depends Automated Reasoning Lecture 4, page 15

Universal Elimination specialization rule u. P u P x spec An alternative universal elimination rule is alle: u. P u R [P x] R alle Note: This rule is mostly useful when doing a mechanical proof Automated Reasoning Lecture 4, page 16

Example proof Prove that y. P y is true, given that x. P x holds. x. P x assum P a y. P y spec exi Automated Reasoning Lecture 4, page 17

Example proof (II) Prove that x. Q x is true, given that x. P x and ( x. P x Q x) both hold. red assumptions hold x. P x Q x assum alle introduces (1) [P a Q a] alle introduces (2) [P a] x.p x assum Q a x.q x P a Q a by1 P a by2 Q a by3 Q a Q a (3) [Q a] impe alle alle alli impe introduces (3) [Q a] Exercise: Redo this proof using spec instead of alle Automated Reasoning Lecture 4, page 18

Problem (III) Prove that hasheart(bush) given that x. person(x) hasheart(x) and person(bush) hold. red assumptions hold alle introduces assumption (1) [per(b) heart(b)] impe introduces (2)[heart(b)] x. per x heart x assum per b heart b heart b by1 per b assum heart b by 2 heart b impe alle abbrevs: heart(x) for hasheart(x) and per(x) for person(x) Exercise: Redo this proof using spec instead of alle Automated Reasoning Lecture 4, page 19

in Coq In Coq, is a typed logic with types such as nat (for natural numbers), bool (for boolean values) and list (for lists) type constructors such as O and S for constructing nat terms: e.g. O represents zero, S O represents one and S (S O))represents two. function types written using, e.g. nat nat nat is the type of a function that takes two nat term arguments and returns a nat term. parameterized types that allow us to define types parameterized by other types e.g. nat list for lists of nat terms and bool list for lists of bool terms. Automated Reasoning Lecture 4, page 20

in Coq (II) Consider the mathematical predicate mod. In Coq, we could formalize this as: Definition mod (a:nat) (b:nat) (c:nat) : Prop := exists k, a = b * k + c. We can use this definition to write propositions like: forall (a b c d:nat), a = d > mod d b c = mod a b c. Coq performs type inference. The definition above could have been written as: Definition mod a b c := exists k, a = b * k + c. The proposition could have been written as: forall a b c d, a = d > mod d b c = mod a b c. Automated Reasoning Lecture 4, page 21

Coq Demo Can be found on course webpage... Automated Reasoning Lecture 4, page 22

Summary Introduction to Syntax and Semantics Substitution Intro and elim rules for quantifiers Coq Declaring predicates Brief look at types Next time: matters of representation Automated Reasoning Lecture 4, page 23