Introduction to Logic & Set Theory Discrete Mathematics.

41
Introduction to Logic & Set Theory Discrete Mathematics

Transcript of Introduction to Logic & Set Theory Discrete Mathematics.

Page 1: Introduction to Logic & Set Theory Discrete Mathematics.

Introduction to Logic & Set Theory

Discrete Mathematics

Page 2: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 2

Outline of lecture 1 Introduction to course Textbooks What is formal logic? Propositional logic Propositions Propositional connectives Formalisation of arguments

Page 3: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 3

Propositional Logic Basic ideas: propositions, connectives Formalising statements in ‘natural language’ Formal proofs

Set theory Basic ideas: definitions of sets Relations, functions and equivalence relations Cardinality, finite, countable and uncountable sets

Predicate Logic Logic programming

Page 4: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 4

Tutorial sheets One tutorial sheet handed out each week To be handed in approx 1 week later Questions and model solutions will appear

on my web pages

Page 5: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 5

Recommended Books

John Truss, “Discrete Mathematics for Computer Scientists”, Addison-Wesley, Second Edition, 1999

 

Page 6: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 6

Recommended Books (cont.) Nimal Nissanke,

“Introductory Logic and Sets for Computer Scientists”, Addison-Wesley, 1999

Page 7: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 7

Recommended Books New this year: James A Anderson,

“Discrete Mathematics with Combinatorics (2nd edition)”, Prentice-Hall, 2004

Page 8: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 8

Recommended books (cont.) Rod Haggarty

“Discrete mathematics for computing”

Addison Wesley

A Chetwynd and P Diggle,

“Discrete Mathematics” Butterworth-Heinemann

Page 9: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 9

Other books

I have also made use of two other books:  Geoffrey Finch, “How to study

linguistics”, Macmillan, 1998 J N Crossley and others, “What is

mathematical logic?”, Oxford University Press, 1972

Page 10: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 10

Introduction to logic What is logic? Why is it useful? Types of logic

Propositional logic Predicate logic

Page 11: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 11

What is logic?

“Logic is the beginning of

wisdom, not the end”

Page 12: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 12

What is logic? Logic n.1. The branch of philosophy

concerned with analysing the patterns of reasoning by which a conclusion is drawn from a set of premises, without reference to meaning or context

(Collins English Dictionary)

Page 13: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 13

Why study logic? Logic is concerned with two key skills,

which any computer engineer or scientist should have: Abstraction Formalisation

Page 14: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 14

Why is logic important? Logic is a formalisation of reasoning. Logic is a formal language for deducing

knowledge from a small number of explicitly stated premises (or hypotheses, axioms, facts)

Logic provides a formal framework for representing knowledge

Logic differentiates between the structure and content of an argument

Page 15: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 15

Logic as formal language In this course, logic will be presented as a

formal language Within that formal language:

Knowledge can be stated concisely and precisely

The process of reasoning from that knowledge can be made rigorous

Page 16: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 16

What is an argument?

An argument is just a sequence of statements.

Some of these statements, the premises, are assumed to be true and serve as a basis for accepting another statement of the argument, called the conclusion

Page 17: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 17

Deduction and inference If the conclusion is justified, based solely on the

premises, the process of reasoning is called deduction

If the validity of the conclusion is based on generalisation from the premises, based on strong but inconclusive evidence, the process is called inference (sometimes called induction)

This course is concerned only with deduction

Page 18: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 18

Two examples Deductive argument:

“Alexandria is a port or a holiday resort. Alexandria is not a port. Therefore, Alexandria is a holiday resort”

Inductive argument“Most students who did not do the tutorial

questions will fail the exam. John did not do the tutorial questions. Therefore John will fail the exam”

Page 19: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 19

Some different types of logic

Historically, a number of types of logic have been proposed.

In this course we will studyPropositional logic (Boole, 1815-1864)

Predicate logic (Frege 1848-1925)

Page 20: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 20

Propositional logic

Simple types of statements, called propositions, are treated as atomic building blocks for more complex statements

Alexandria is a port or a holiday resort.

Alexandria is not a port.

Therefore, Alexandria is a holiday resort

Page 21: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 21

Propositional logic

Basic propositions in the argument are

p – Alexandria is a port

q – Alexandria is a holiday resort. In abstract form, the argument becomes

p or q

Not q

Therefore q

Page 22: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 22

Predicate logic Extension of propositional logic A ‘predicate’ is just a property Predicates define relationships between

any number of entities using qualifiers: “for all”, “for every” “there exists”

Page 23: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 23

Example Let P(x) be the property

‘if x is a triangle then the sum of its internal angles is 180o”

In predicate logic:

x P(x) “For every x such that x is a triangle, the

sum of the internal angles of x is 180o”

Page 24: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 24

Another example Let P(x) be the property

‘x is an integer and x2 = 4’ Then

x P(x) “There exists x such that x is an integer and

x2 = 4”

Page 25: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 25

Newton’s second law of motion

x: Object stationary(x) in-uniform-motion (x) f : Force x is-acted-upon-by f

In English: “for every x of a certain type referred to as an Object, x is stationary, x is in uniform motion, or there is an f of type Force such that x is acted upon by f”

“for every x” “of type called object” “or”

“there exists an f”

Page 26: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 26

and Remember:

x ‘for every x’, or ‘for All x’

x ‘there is an x’ or ‘there Exists an x’

Tip:

Think of as an upside down ‘A’ (‘for All’)

Think of as a backwards ‘E’ (‘there Exists’)

Page 27: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 27

Propositions A (atomic, elementary) proposition is the

underlying meaning of a simple declarative sentence, which is either true or false

The truth or falsehood of a proposition is indicated by assigning it one of the truth values T (for true) or F (for false)

Page 28: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 28

Example propositions

Mammals are warm blooded

The sun orbits the earth

The evergreen forests of Canada consist of spruce, pine and fir trees

John is taller than Joan

Joan is shorter than John

John is not shorter than Joan

Page 29: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 29

Sentences which are not propositions

Over millions of years they build up on top of one another to form a reef

Can the arctic hare change the colour of its coat to match its surroundings?

Put down that book!

Page 30: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 30

Which are propositions?

Can pigs fly?

Pigs can fly

Sparrows can fly

Joe runs faster than Patrick

Patrick runs slower than Joe

Pay your bills on time

The circumference of a circle is equal to four times its diameter

Page 31: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 31

Propositional connectives These are the words that we use to join

atomic propositions together to form compound propositions. E.G:

In 1938 Hitler seized Austria, (and) in 1939 he seized former Czechoslovakia and in 1941 he attacked the former USSR while still having a non-aggression pact with it

Page 32: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 32

Propositional connectives Propositional logic has four connectives

Name Read as Symbol

negation ‘not’

conjunction ‘and’

disjunction ‘or’

implication ‘if…then…’

Page 33: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 33

Connective Interpretation

negation p is true if and only if p is false

A conjunction pq is true if and only if both p and q are true

A disjunction pq is true if and only if p is true or q is true.

An implication p q is false if and only if p is true and q is false

Interpretation of connectives

Page 34: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 34

Some more terminology… Expressions either side of a conjunction are

called conjuncts (pq) Expressions either side of a disjunction are

called disjuncts (pq) In the implication p q, p is called the

antecedent and q is the consequence

Page 35: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 35

Precedence of connectives In complex propositions, brackets may be

used to remove ambiguity.

(p q) r versus p (q r) By convention, the order of precedence

Brackets, Negation, Conjunction, Disjunction, Implication

Page 36: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 36

Formalisation

StatementIn 1938 Hitler seized Austria, (and) in 1939 he seized former Czechoslovakia and in 1941 he attacked the former USSR while still having a non-aggression pact with it

Page 37: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 37

Formalisation (continued)

Atomic propositions:p – In 1938 Hitler seized Austriaq – In 1939 Hitler seized former Czechoslovakiar – In 1941 Hitler attacked the former USSRs – In 1941 Hitler had a non-aggression pact with the former USSR

Formalisation in Propositional Logic:p q r s

Page 38: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 38

Although both Stanley and Gordon are not young, Stanley has a better chance of winning the next bowling tournament, despite Gordon’s considerable experience

Formalisation

Page 39: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 39

Formalisation (continued)

Atomic propositions:p – Stanley is young

q – Gordon is young

r – Stanley has a better chance of winning the next bowling tournament

s – Gordon has considerable experience in bowling

Formalisation in Propositional Logic:(p) (q) r s

Page 40: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 40

Negation and atomic propositions

Note that for first atomic proposition I chose:

Stanley is young

and not

Stanley is not young

Page 41: Introduction to Logic & Set Theory Discrete Mathematics.

EE1J2 - Slide 41

Summary of Lecture 1 Introduction to course Textbooks What is formal logic? Propositional logic Propositions Propositional connectives Formalisation of arguments