• Keine Ergebnisse gefunden

Theory of Computer Science B4. Predicate Logic I Gabriele R¨oger

N/A
N/A
Protected

Academic year: 2022

Aktie "Theory of Computer Science B4. Predicate Logic I Gabriele R¨oger"

Copied!
22
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

B4. Predicate Logic I

Gabriele R¨oger

University of Basel

March 4, 2019

(2)

Logic: Overview

Logic

Propositional Logic Predicate

Logic

(3)

Motivation

(4)

Limits of Propositional Logic

Cannot well be expressed in propositional logic:

“Everyone who does the exercises passes the exam.”

“If someone with administrator privileges presses ‘delete’, all data is gone.”

“Everyone has a mother.”

“If someone is the father of some person,

“the person is his child.”

.need more expressive logic . predicate logic

German: Pr¨adikatenlogik

(5)

Limits of Propositional Logic

Cannot well be expressed in propositional logic:

“Everyone who does the exercises passes the exam.”

“If someone with administrator privileges presses ‘delete’, all data is gone.”

“Everyone has a mother.”

“If someone is the father of some person,

“the person is his child.”

.need more expressive logic . predicate logic

German: Pr¨adikatenlogik

(6)

Syntax of Predicate Logic

(7)

Logic: Overview

Logic

Propositional Logic Predicate

Logic

Syntax Semantics Free Variables

Logical Consequence Further Topics

(8)

Syntax: Building Blocks

Signatures define allowed symbols.

analogy: variable setA in propositional logic

Terms are associated with objects by the semantics.

no analogy in propositional logic

Formulasare associated with truth values (true or false) by the semantics.

analogy: formulas in propositional logic

German: Signatur, Term, Formel

(9)

Signatures: Definition

Definition (Signature)

Asignature(of predicate logic) is a 4-tuple S=hV,C,F,Pi consisting of the following four disjoint sets:

a finite or countable setV of variable symbols a finite or countable setC of constant symbols a finite or countable setF of function symbols a finite or countable setP of predicate symbols (orrelation symbols)

Every function symbol f∈ F and predicate symbol P∈ P has an associatedarityar(f),ar(P)∈N0 (number of arguments).

German: Variablen-, Konstanten-, Funktions-, Pr¨adikat- und Relationssymbole; Stelligkeit

(10)

Signatures: Terminology and Conventions

terminology:

k-ary(function or predicate) symbol:

symbol s with arity ar(s) =k. also: unary,binary,ternary German: k-stellig, un¨ar, bin¨ar, tern¨ar conventions (in this lecture):

variable symbols written in italics, other symbols upright.

predicate symbols begin with capital letter, other symbols with lower-case letters

(11)

Signatures: Examples

Example: Arithmetic

V ={x,y,z,x1,x2,x3, . . .} C={zero,one}

F ={sum,product}

P ={Positive,SquareNumber}

ar(sum) =ar(product) = 2,ar(Positive) =ar(SquareNumber) = 1

(12)

Signatures: Examples

Example: Genealogy

V ={x,y,z,x1,x2,x3, . . .} C={roger-federer,lisa-simpson}

F =∅

P ={Female,Male,Parent}

ar(Female) =ar(Male) = 1,ar(Parent) = 2

(13)

Terms: Definition

Definition (Term)

LetS =hV,C,F,Pi be a signature.

Aterm(over S) is inductively constructed according to the following rules:

Every variable symbol v ∈ V is a term.

Every constant symbolc∈ C is a term.

Ift1, . . . ,tk are terms and f∈ F is a function symbol with arity k, thenf(t1, . . . ,tk) is a term.

German: Term

examples:

x4

lisa-simpson

sum(x3,product(one,x5))

(14)

Terms: Definition

Definition (Term)

LetS =hV,C,F,Pi be a signature.

Aterm(over S) is inductively constructed according to the following rules:

Every variable symbol v ∈ V is a term.

Every constant symbolc∈ C is a term.

Ift1, . . . ,tk are terms and f∈ F is a function symbol with arity k, thenf(t1, . . . ,tk) is a term.

German: Term

examples:

x4

lisa-simpson

sum(x3,product(one,x5))

(15)

Formulas: Definition

Definition (Formula)

For a signatureS =hV,C,F,Pithe set of predicate logic formulas (overS) is inductively defined as follows:

Ift1, . . . ,tk are terms (over S) and P∈ P is a k-ary predicate symbol, then the atomic formula(or the atom) P(t1, . . . ,tk) is a formula overS.

Ift1 andt2 are terms (over S), then theidentity (t1=t2) is a formula overS.

Ifx ∈ V is a variable symbol and ϕa formula over S, then the universal quantification∀xϕ

and the existential quantification∃xϕare formulas overS.

. . .

German: atomare Formel, Atom, Identit¨at, Allquantifizierung, Existenzquantifizierung

(16)

Formulas: Definition

Definition (Formula)

For a signatureS =hV,C,F,Pithe set of predicate logic formulas (overS) is inductively defined as follows:

. . .

Ifϕis a formula overS, then so is itsnegation ¬ϕ.

Ifϕand ψare formulas overS, then so are

theconjunction (ϕ∧ψ) and thedisjunction(ϕ∨ψ).

German: Negation, Konjunktion, Disjunktion

(17)

Formulas: Examples

Examples: Arithmetic and Genealogy Positive(x2)

∀x(¬SquareNumber(x)∨Positive(x))

∃x3(SquareNumber(x3)∧ ¬Positive(x3))

∀x(x =y)

∀x(sum(x,x) = product(x,one))

∀x∃y(sum(x,y) = zero)

∀x∃y(Parent(y,x)∧Female(y))

Terminology: The symbols ∀ and∃ are calledquantifiers.

German: Quantoren

(18)

Abbreviations and Placement of Parentheses by Convention

abbreviations:

(ϕ→ψ) is an abbreviation for (¬ϕ∨ψ).

(ϕ↔ψ) is an abbreviation for ((ϕ→ψ)∧(ψ→ϕ)).

Sequences of the same quantifier can be abbreviated.

For example:

∀x∀y∀zϕ ∀xyzϕ

∃x∃y∃zϕ ∃xyzϕ

∀w∃x∃y∀zϕ ∀w∃xy∀zϕ

placement of parentheses by convention:

analogous to propositional logic

quantifiers ∀and∃ bind more strongly than anything else.

example: ∀xP(x)→Q(x) corresponds to (∀xP(x)→Q(x)), example: not∀x(P(x)→Q(x)).

(19)

Abbreviations and Placement of Parentheses by Convention

abbreviations:

(ϕ→ψ) is an abbreviation for (¬ϕ∨ψ).

(ϕ↔ψ) is an abbreviation for ((ϕ→ψ)∧(ψ→ϕ)).

Sequences of the same quantifier can be abbreviated.

For example:

∀x∀y∀zϕ ∀xyzϕ

∃x∃y∃zϕ ∃xyzϕ

∀w∃x∃y∀zϕ ∀w∃xy∀zϕ

placement of parentheses by convention:

analogous to propositional logic

quantifiers ∀and∃ bind more strongly than anything else.

example: ∀xP(x)→Q(x) corresponds to(∀xP(x)→Q(x)), example: not∀x(P(x)→Q(x)).

(20)

Questions

Questions?

(21)

Summary

(22)

Summary

Predicate logic is more expressive than propositional logic and allows statements overobjects and theirproperties.

Objects are described by termsthat are built from variable, constant and function symbols.

Properties and relations are described by formulas that are built from predicates, quantifiers

and the usual logical operators.

Referenzen

ÄHNLICHE DOKUMENTE

I All usual decision problems (word problem, emptiness, finiteness, intersection, equivalence) are decidable for

propositional logic based on atomic propositions syntax defines what well-formed formulas are semantics defines when a formula is true interpretations are the basis of

Sch¨ oning: Logik f¨ ur Informatiker Picture courtesy of graur razvan ionut / FreeDigitalPhotos.net...

Simplified Notation Normal Forms Logical Consequences Summary..

I condition for reasonable normal form: every formula must have a logically equivalent formula in normal form..

solution: produce with syntactic inference rules formulas that are logical consequences of given formulas.. advantage: mechanical method can easily be implemented as

I Predicate logic is more expressive than propositional logic and allows statements over objects and their properties. I Objects are described by terms that are built from

B5.1 Semantics of Predicate Logic B5.2 Free and Bound Variables B5.3 Logical Consequences B5.4 Further Topics.. B5.5 Summary.. B5.1 Semantics of Predicate Logic..