01 introduction to cs3234; propositional calculushenz/cs3234/slides/slides_01.color.pdf · 1 the...

27
Introduction to Logic and Formal Systems Brief Introduction to CS3234 Administrative Matters 01—Introduction to CS3234; Propositional Calculus CS 3234: Logic and Formal Systems Martin Henz and Aquinas Hobor August 12, 2010 Generated on Wednesday 18 CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Upload: lephuc

Post on 01-Jul-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

01—Introduction to CS3234; PropositionalCalculus

CS 3234: Logic and Formal Systems

Martin Henz and Aquinas Hobor

August 12, 2010

Generated on Wednesday 18th August, 2010, 23:11CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 2: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

1 Introduction to Logic and Formal Systems

2 Brief Introduction to CS3234

3 Administrative Matters

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 3: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

1 Introduction to Logic and Formal SystemsOrigins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

2 Brief Introduction to CS3234

3 Administrative Matters

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 4: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

What is logic?

1 the branch of philosophy dealing with forms and processesof thinking, especially those of inference and scientificmethod,

2 a particular system or theory of logic [according to 1].

(from “The World Book Dictionary”)

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 5: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Origins of Mathematical Logic

Greek origins

The ancient Greek formulated rules of logic as syllogisms,which can be seen as precursors of formal logic frameworks.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 6: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Example of Syllogism

PremiseAll men are mortal.

PremiseSocrates is a man.

ConclusionTherefore, Socrates is mortal.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 7: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Historical Notes

Logic traditions in Ancient Greece

Stoic logic: Centers on propositional logic; can be traced backto Euclid of Megara (400 BCE)

Peripatetic logic: Precursor of predicate logic; founded byArtistotle (384–322 BCE), focus on syllogisms

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 8: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Logic Throughout the World

Indian logic: Nyaya school of Hindu philosophy, culminatingwith Dharmakirti (7th century CE), and GangeaUpdhyya of Mithila (13th century CE), formalizedinference

Chinese logic: Gongsun Long (325–250 BCE) wrote on logicalarguments and concepts; most famous is the“White Horse Dialogue”; logic typically rejected astrivial by later Chinese philosophers

Islamic logic: Further development of Aristotelian logic,culminating with Algazel (1058–1111 CE)

Medieval logic: Aristotelian; culminating with William ofOckham (1288–1348 CE)

Traditional logic: Port-Royal Logic, influential logic textbook firstpublished in 1665

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 9: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Remarks on Ockham

Ockham’s razor (in his own words)For nothing ought to be posited without a reason given, unlessit is self-evident or known by experience or proved by theauthority of Sacred Scripture.

Ockham’s razor (popular version, not found in his writings)Entia non sunt multiplicanda sine necessitate.English: Entities should not be multiplied without necessity.

Built-in SkepticismAs a result of this ontological parsimony, Ockham states thathuman reason cannot prove the immortality of the soul nor theexistence, unity, and infinity of God.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 10: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Remarks on Ockham

Ockham’s razor (in his own words)For nothing ought to be posited without a reason given, unlessit is self-evident or known by experience or proved by theauthority of Sacred Scripture.

Ockham’s razor (popular version, not found in his writings)Entia non sunt multiplicanda sine necessitate.

English: Entities should not be multiplied without necessity.

Built-in SkepticismAs a result of this ontological parsimony, Ockham states thathuman reason cannot prove the immortality of the soul nor theexistence, unity, and infinity of God.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 11: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Remarks on Ockham

Ockham’s razor (in his own words)For nothing ought to be posited without a reason given, unlessit is self-evident or known by experience or proved by theauthority of Sacred Scripture.

Ockham’s razor (popular version, not found in his writings)Entia non sunt multiplicanda sine necessitate.English: Entities should not be multiplied without necessity.

Built-in SkepticismAs a result of this ontological parsimony, Ockham states thathuman reason cannot prove the immortality of the soul nor theexistence, unity, and infinity of God.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 12: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Remarks on Ockham

Ockham’s razor (in his own words)For nothing ought to be posited without a reason given, unlessit is self-evident or known by experience or proved by theauthority of Sacred Scripture.

Ockham’s razor (popular version, not found in his writings)Entia non sunt multiplicanda sine necessitate.English: Entities should not be multiplied without necessity.

Built-in SkepticismAs a result of this ontological parsimony, Ockham states thathuman reason cannot prove the immortality of the soul nor theexistence, unity, and infinity of God.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 13: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Propositional Calculus

Study of atomic propositionsPropositions are built from sentences whose internal structureis not of concern.

Building propositionsBoolean operators are used to construct propositions out ofsimpler propositions.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 14: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Example for Propositional Calculus

Atomic propositionOne plus one equals two.

Atomic propositionThe earth revolves around the sun.

Combined propositionOne plus one equals two and the earth revolves around thesun.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 15: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Goals and Main Result

Meaning of formulaAssociate meaning to a set of formulas by assigning a valuetrue or false to every formula in the set.

ProofsSymbol sequence that formally establishes whether a formulais always true.

Soundness and completenessThe set of provable formulas is the same as the set of formulaswhich are always true.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 16: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Uses of Propositional Calculus

Hardware designThe production of logic circuits uses propositional calculus at allphases; specification, design, testing.

VerificationVerification of hardware and software makes extensive use ofpropositional calculus.

Problem solvingDecision problems (scheduling, timetabling, etc) can beexpressed as satisfiability problems in propositional calculus.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 17: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Predicate Calculus: Central ideas

Richer languageInstead of dealing with atomic propositions, predicate calculusprovides the formulation of statements involving sets, functionsand relations on these sets.

QuantifiersPredicate calculus provides statements that all or someelements of a set have specified properties.

CompositionalitySimilar to propositional calculus, formulas can be built fromcomposites using logical connectives.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 18: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Progamming Language Semantics

The meaning of programs such as

if x >= 0 then y := sqrt(x) else y := abs(x)

can be captured with formulas of predicate calculus:

∀x∀y(x ′ = x ∧ (x ≥ 0→ y ′ =√

x) ∧ (¬(x ≥ 0)→ y ′ = |x |))

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 19: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Other Uses of Predicate Calculus

Specification: Formally specify the purpose of a program inorder to serve as input for software design,

Verification: Prove the correctness of a program with respect toits specification.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 20: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Example for Specification

Let P be a program of the form

while a <> b doif a > b then a := a - b else a:= b - a;

The specification of the program is given by the formula

{a ≥ 0 ∧ b ≥ 0} P {a = gcd(a,b)}

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 21: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Theorem Proving and Logic Programming

Theorem provingFormal logic has been used to design programs that canautomatically prove mathematical theorems.

Logic programmingResearch in theorem proving has led to an efficient way ofproving formulas in predicate calculus, called resolution, whichforms the basis for logic programming.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 22: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Origins of Mathematical LogicPropositional CalculusPredicate CalculusTheorem Proving and Logic ProgrammingSystems of Logic

Other Systems of Logic

Three-valued logicA third truth value (denoting “don’t know” or “undetermined”) isoften useful.

Intuitionistic logicA mathematical object is accepted only if a finite constructioncan be given for it.

Temporal logicIntegrates time-dependent constructs such as (“always” and“eventually”) explicitly into a logic framework; useful forreasoning about real-time systems.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 23: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Style: Broad, elementary, rigorousMethod: From Theory to PracticeOverview of Module Content

1 Introduction to Logic and Formal Systems

2 Brief Introduction to CS3234Style: Broad, elementary, rigorousMethod: From Theory to PracticeOverview of Module Content

3 Administrative Matters

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 24: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Style: Broad, elementary, rigorousMethod: From Theory to PracticeOverview of Module Content

Style: Broad, elementary, rigorous

Broad: Cover a good number of logical frameworksElementary: Focus on a minimal subset of each framework

Rigorous: Cover topics formally, preparing students foradvanced studies in logic in computer science

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 25: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Style: Broad, elementary, rigorousMethod: From Theory to PracticeOverview of Module Content

Method: From Theory to Practice

Cover theory and back it up with practical excercises that applythe theory and give new insights.

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 26: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Style: Broad, elementary, rigorousMethod: From Theory to PracticeOverview of Module Content

Overview of Module Content

1 Traditional logic (1 lectures, including today)2 Propositional calculus (2 lectures)3 Predicate calculus (3 lectures)4 Program Verification (2 lectures)5 Modal Logics (2 lectures)6 Typing (2 lectures; to be confirmed)

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus

Page 27: 01 Introduction to CS3234; Propositional Calculushenz/cs3234/slides/slides_01.color.pdf · 1 the branch of philosophy dealing with forms and ... Nyaya school of Hindu philosophy,

Introduction to Logic and Formal SystemsBrief Introduction to CS3234

Administrative Matters

Administrative Matters

Use www.comp.nus.edu.sg/˜cs3234 and IVLENo textbookAssignments (one per week, starting next week; marked)Coq homework (every 2 weeks)Coq quiz (every 2 weeks)Discussion forums, announcements, webcast (IVLE)Labs (one per week); register!Tutorials (one per week); register!

CS 3234: Logic and Formal Systems 01—Introduction to CS3234; Propositional Calculus