Logic March 28, 2005 Propositional Logic Information definition: a - - PowerPoint PPT Presentation

logic
SMART_READER_LITE
LIVE PREVIEW

Logic March 28, 2005 Propositional Logic Information definition: a - - PowerPoint PPT Presentation

Logic March 28, 2005 Propositional Logic Information definition: a proposition is a statement of fact It is raining (english) Raining Connectives: operators on propositions And, or, not, implies, if and only if


slide-1
SLIDE 1

Logic

March 28, 2005

slide-2
SLIDE 2

Propositional Logic

Information definition: a proposition is a statement of fact

“It is raining” (english)

Connectives: operators on propositions

And, or, not, implies, if and only if

Raining

↔ → ¬ ∨ ∧ , , , ,

slide-3
SLIDE 3

Syntax

Symbols: p, q, r, s, t (variables) Constants: T, F Functions: f,g,h (n-ary) and connectives Relations: R, S (n-ary) Parentheses: ),( Equality ≡

↔ → ¬ ∨ ∧ , , , ,

slide-4
SLIDE 4

Examples

≡ ∧ ∨ ∨ ¬ ∧ → )) ) ( r p p q p

slide-5
SLIDE 5

Formulas and Terms

Rules:

All symbols are formulas All constants are formulas If t0,t1 are formulas then so are If t0,t1 are formulas then so are Formulas composed from symbols,

constants and functions are called terms

) ( , , , , ,

1 1 1 1

t t t t t t t t t t ¬ ↔ → ∨ ∧

1 1 0 ,

t t t Rt ≡

slide-6
SLIDE 6

Semantics T T F F T F F F T T F T T F F F T F F F T T T T T F T T q p q p q p q p p q p ↔ → ∨ ∧ ¬

slide-7
SLIDE 7

Semantics II

Semantics of any formula is given by an evaluation function Φ from formulas to {T,F} To define the semantics, it suffices to define evaluation of symbols and functions (and use the previous slide)

slide-8
SLIDE 8

Examples II

A tautology is always true A contradiction is always false One way to derive truth of a formula is to use a truth table.

p p ¬ ∨ p p ¬ ∧ ) ( ) ( q p q p ∨ ¬ ≡ →

slide-9
SLIDE 9

Laws of Propositional Logic

Commutativity Associativity Distributivity DeMorgan

slide-10
SLIDE 10

Rules of Inference

Modus Ponens Modus Tollens Syllogism Disjunctive Syllogism Specialization Conjuction

slide-11
SLIDE 11

Theories

A Theory in propositional logic is a set of constants, functions, relations and axioms. Example: (theory of ordered integers)

  • Constants: non-negative integers
  • Function: +, Relation: <
  • Axioms:

y x y x + < → < ) ( x x < ¬ ) ( ) ( x y y x < ¬ → <

slide-12
SLIDE 12

Why?

Why do computer scientists care? Because theories are specifications of a collection of structures To reason about code correctness To enable code transformations

Must preserve invariants