• 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!
19
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Theory of Computer Science

B4. Predicate Logic I

Gabriele R¨oger

University of Basel

March 4, 2019

(2)

Theory of Computer Science

March 4, 2019 — B4. Predicate Logic I

B4.1 Motivation

B4.2 Syntax of Predicate Logic

B4.3 Summary

(3)

Logic: Overview

Logic

Propositional Logic Predicate

Logic

(4)

B4. Predicate Logic I Motivation

B4.1 Motivation

(5)

B4. Predicate Logic I Motivation

Limits of Propositional Logic

Cannot well be expressed in propositional logic:

I “Everyone who does the exercises passes the exam.”

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

I “Everyone has a mother.”

I “If someone is the father of some person,

“the person is his child.”

.need more expressive logic . predicate logic

German: Pr¨adikatenlogik

(6)

B4. Predicate Logic I Syntax of Predicate Logic

B4.2 Syntax of Predicate Logic

(7)

B4. Predicate Logic I Syntax of Predicate Logic

Logic: Overview

Logic

Propositional Logic Predicate

Logic

Syntax Semantics Free Variables

Logical Consequence Further Topics

(8)

B4. Predicate Logic I Syntax of Predicate Logic

Syntax: Building Blocks

I Signatures define allowed symbols.

analogy: variable setA in propositional logic

I Terms are associated with objects by the semantics.

no analogy in propositional logic

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

analogy: formulas in propositional logic

German: Signatur, Term, Formel

(9)

B4. Predicate Logic I Syntax of Predicate Logic

Signatures: Definition

Definition (Signature)

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

I a finite or countable setV of variable symbols

I a finite or countable setC of constant symbols

I a finite or countable setF of function symbols

I 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)

B4. Predicate Logic I Syntax of Predicate Logic

Signatures: Terminology and Conventions

terminology:

I k-ary(function or predicate) symbol:

symbol s with arity ar(s) =k.

I also: unary,binary,ternary German: k-stellig, un¨ar, bin¨ar, tern¨ar

conventions (in this lecture):

I variable symbols written in italics, other symbols upright.

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

(11)

B4. Predicate Logic I Syntax of Predicate Logic

Signatures: Examples

Example: Arithmetic

I V ={x,y,z,x1,x2,x3, . . .}

I C={zero,one}

I F ={sum,product}

I P ={Positive,SquareNumber}

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

(12)

B4. Predicate Logic I Syntax of Predicate Logic

Signatures: Examples

Example: Genealogy

I V ={x,y,z,x1,x2,x3, . . .}

I C={roger-federer,lisa-simpson}

I F =∅

I P ={Female,Male,Parent}

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

(13)

B4. Predicate Logic I Syntax of Predicate Logic

Terms: Definition

Definition (Term)

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

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

I Every variable symbol v ∈ V is a term.

I Every constant symbolc∈ C is a term.

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

German: Term

examples:

I x4

I lisa-simpson

I sum(x3,product(one,x5))

(14)

B4. Predicate Logic I Syntax of Predicate Logic

Formulas: Definition

Definition (Formula)

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

I 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.

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

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

and the existential quantification∃xϕare formulas overS.

. . .

(15)

B4. Predicate Logic I Syntax of Predicate Logic

Formulas: Definition

Definition (Formula)

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

. . .

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

I Ifϕand ψare formulas overS, then so are

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

German: Negation, Konjunktion, Disjunktion

(16)

B4. Predicate Logic I Syntax of Predicate Logic

Formulas: Examples

Examples: Arithmetic and Genealogy

I Positive(x2)

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

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

I ∀x(x =y)

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

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

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

Terminology: The symbols ∀ and∃ are calledquantifiers.

(17)

B4. Predicate Logic I Syntax of Predicate Logic

Abbreviations and Placement of Parentheses by Convention

abbreviations:

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

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

I Sequences of the same quantifier can be abbreviated.

For example:

I ∀x∀y∀zϕ ∀xyzϕ

I ∃x∃y∃zϕ ∃xyzϕ

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

placement of parentheses by convention:

I analogous to propositional logic

I quantifiers ∀and∃ bind more strongly than anything else.

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

(18)

B4. Predicate Logic I Summary

B4.3 Summary

(19)

B4. Predicate Logic I Summary

Summary

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

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

I 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

I A Turing machine either fails to accept an input I because it rejects it (entering q reject ) or. I because it loops (= does

I Propositional formulas combine atomic formulas with ¬, ∧, ∨, → to more complex statements. I Interpretations determine which atomic formulas are true and which ones

Helmert (University of Basel) Foundations of Artificial Intelligence April 26, 2021 2 / 19.. Propositional

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

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

Objects are described by terms that are built from variable, constant and function symbols. Properties and relations are described by formulas 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..