Anda di halaman 1dari 4

Logic

A formal system for describing states of affairs, consisting of:

Syntax: describes how to make sentences, and


Semantics: describes the relation between the sentences and the states of
affairs

Or

A proof theory: a set of rules for deducing the entailments of a set of sentences.

Or

A Science of reasoning

Or

In its first meaning, a logic is a collection of closely related artificial languages. There
are certain languages called first-order languages, and together they form first order
logic. (By : Dr Wilfrid Hodges)

Different types of logics are there, but here I have concentrated bit on first order
logic

First Order Logic

In first-order logic, variables refer to things in the world and you can quantify over
them. That is, you can talk about all or some of them without having to name them
explicitly.

What exists: Facts, Objects, and Relations


Belief set: True/False/Unknown
Syntax

•User defines these primitives:

1. Constant symbols (i.e., the "individuals" in the world)

E.g. monkey, 3

2. Function symbols (mapping individuals to individuals)

E.g., father-of (Mary) = John, color-of(Sky) = Blue

3. Predicate symbols (mapping from individuals to truth values)

E.g., greater (8,5), green (Grass), color (Grass, Green)

•FOL supplies these primitives:

1. Variable symbols. E.g. x, y

2. Connectives. Same as in PL: not (~), and (^), or (v), implies (=>), if and only if
(<=>)

3. Quantifiers: Universal (∀) and Existential (∃)

Quantifiers

• Universal quantification corresponds to conjunction ("and") in that (∀x)


P(x) means that P holds for all values of x in the domain associated with that
variable.
E.g. (∀x) monkey(x) => mammal(x)

• Existential quantification corresponds to disjunction ("or") in that (∃x)P(x)


means that P holds for some value of x in the domain associated with that
variable.
E.g. (∃x) mammal(x) ^ climb(x)
• Universal quantifiers are usually used with "implies" to form "if-then rules."

E.g. (∀x) masters-student(x) => smart(x) means "All masters students are
smart."
We rarely use universal quantification to make blanket statements about
every individual in the world: (∀x) masters-student(x) ^ smart(x) meaning
that everyone in the world is a masters student and is smart.

•Existential quantifiers are usually used with "and" to specify a list of


properties or facts about an individual.

E.g. (∃x) masters-student(x) ^ smart(x) means "there is a masters student


who is smart."

A common mistake is to represent this English sentence as the FOL sentence:


(∃x) masters-student(x) => smart(x)

•Switching the order of universal quantifiers does not change the meaning:
(∀x)(∀y)P(x,y) is logically equivalent to (∀y)(∀x)P(x,y). Similarly, you can
switch the order of existential quantifiers.

•Switching the order of universals and existentials does change meaning:


–Everyone likes someone: (∀x)(∃y)likes(x,y)
–Someone is liked by everyone: (∃y)(∀x)likes(x,y)
Translating English Into First Order Logic

Every master’s student attend logics


(∀x) master’s student(x) => attend(x, logics)

You can fool some of the people all of the time


(∃x)( ∀t) (person(x) ^ time(t)) => can-fool(x,t)

You can fool all of the people some of the time


(∀x)( ∃t) (person(x) ^ time(t) => can-fool(x,t)

All yellow bananas are small


(∀x) (banana(x) ^ yellow(x)) => small(x)

No yellow banana is big


(∀x) (banana(x) ^ yellow(x)) => ~big(x)
or
~(∃x)yellow(x) ^ banana(x) ^ big(x)

There are exactly two yellow bananas.

(∃x)(∃y) banana(x) ^ yellow(x) ^ banana(y) ^ yellow(y) ^ ~(x=y) ^ (∀z)


(banana(z) ^ yellow(z)) => ((x=z) v (y=z))

Monkey is not yellow


~yellow(money)

References:
Slides of our class and some other external sources
http://wilfridhodges.co.uk/

Anda mungkin juga menyukai