Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic.

Similar presentations


Presentation on theme: "CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic."— Presentation transcript:

1 CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic

2 Module 8CMPF144 Fundamentals of Computing TheorySlide 2 Objectives To understand what is the meaning of Logic and Classical Logic. To understand what is informal and formal language To understand principles of developing a formal language

3 Module 8CMPF144 Fundamentals of Computing TheorySlide 3 Introduction Logic : - is a study of valid reasoning Logic tries to establish criteria to decide some piece of reasoning is valid (TRUE) or invalid (FALSE) Reasoning consist of statements some of which are claimed to follow from previous ones. For example: “If I win the lottery, then I’m happy. However, I did not win the lottery. Therefore, I am not happy.” claimed to be inferred from others. For example: “Either the housemaid or the butler killed Mr X. However, if the housemaid would have done it, the alarm would have gone off, and the alarm did not go off. Therefore, the butler did it.”

4 Module 8CMPF144 Fundamentals of Computing TheorySlide 4 Definitions A logic consists of a formal or informal language together with a deductive system and/or a model- theoretic semantics Language is, or corresponds to, a part of a natural language Deductive System is to capture, codify, or simply record, which inferences are correct for the given language Semantics is to capture, codify, or record the meanings, or truth-conditions, or possible truth conditions, for at least part of the language

5 Module 8CMPF144 Fundamentals of Computing TheorySlide 5 Formal & Informal Languages The formal language is a recursively defined collection of strings on a fixed alphabet. is a set of finite-length words (i.e. character strings) drawn from some finite alphabets Example: {a,b} :- possible strings ababab, ab, ba, baba {a,m,n,t} :- possible strings man, ant, tan, amn, empty word is possible (zero-length string) and is often denoted by e, ε or Λ

6 Module 8CMPF144 Fundamentals of Computing TheorySlide 6 Examples (more) the set of all words over a,b the set {a n }, n is a prime number and a n means a repeated n times the set of syntactically correct programs in a given programming language; or the set of inputs upon which a certain Turing machine halts

7 Module 8CMPF144 Fundamentals of Computing TheorySlide 7 Formal & Informal Languages Without some information on this language, it may look like it doesn’t have a meaning Sometimes, it has no meaning (refer to examples) Sometimes, is has better meaning where the meaning of the formulas is given by the deductive system and the semantics

8 Module 8CMPF144 Fundamentals of Computing TheorySlide 8 Formal vs Informal (Natural) Languages Formal languages accurately exhibit actual features of certain fragments of a natural language Natural languages are vague and ambiguous, they should be replaced by formal languages Example: John is married, and Mary is single, or Joe is crazy It can mean that John is married and either Mary is single or Joe is crazy, or else it can mean that either both John is married and Mary is single, or else Joe is crazy

9 Module 8CMPF144 Fundamentals of Computing TheorySlide 9 Formal vs Informal (Natural) Languages The formula for the above sentence in Formal Language could be A & B V C Is this supposed to be ((A & B) V C), or is it (A & (B V C)) ? Parentheses solves this ambiguity

10 Module 8CMPF144 Fundamentals of Computing TheorySlide 10 Developing Formal Language Building block of Formal Language  Singular Terms - linguistic items whose function is to denote a person or object or subject individual constants - These are lower-case letters, near the beginning of the Roman alphabet, with or without numerical subscripts: a, a1, b23, c, d22, etc individual variables - These are lower-case letters, near the end of the alphabet, with or without numerical subscripts: w, x, y12, z, z4, etc

11 Module 8CMPF144 Fundamentals of Computing TheorySlide 11 Developing Formal Language (cont.) Variables serve a dual function  used as a singular term to denote a specific, but unspecified (or arbitrary) object. For example, a mathematician might start a derivation: "Let x be a natural number".  used to express generality, as in the mathematical assertion that for any natural number x, there is a natural number y, such that y>x and y is prime. Some logicians employ different symbols for unspecified objects (sometimes called "individual parameters") and variables used to express generality

12 Module 8CMPF144 Fundamentals of Computing TheorySlide 12 Developing Formal Language (cont.) For each natural number n, n-place predicate letters - These are upper-case letters at the beginning or middle of the alphabet. A superscript indicates the number of places, and there may or may not be a subscript. For example : A 3, B 3 2, P 3, etc

13 Module 8CMPF144 Fundamentals of Computing TheorySlide 13 Developing Formal Language (cont.) Compound Formula The symbols (operator) used in Formal Language are: ¬, &, Ѵ, , ∀, ∃,(, ) That is, all formulas are constructed in accordance with these rules

14 Module 8CMPF144 Fundamentals of Computing TheorySlide 14 Developing Formal Language (cont.) Negation (¬ θ) ¬ is equivalent to denying the sentence corresponding to θ AND (&) "and" is used to connect sentences. So (Φ &Ψ ) can be read " and ". The formula (Φ &Ψ ) is called the "conjunction" of Φ and Ψ.

15 Module 8CMPF144 Fundamentals of Computing TheorySlide 15 Developing Formal Language (cont.) OR ( Ѵ ) corresponds to "either... or... or both", so (Φ Ѵ Ψ ) can be read " or ". The formula (Φ Ѵ Ψ ) is called the "disjunction" of Φ and Ψ If.. Then (  ) The arrow “  " corresponds to "if... then... ", so (Φ  Ψ ) can be read "if Φ then Ψ " or " Ψ only if Φ ". The symbols "&", " Ѵ ", and “  " are called "binary connectives", since they serve to "connect" two sentences into one. Some authors introduce (  ) as an abbreviation of ((Φ  Ψ ) & (Ψ  Φ )). The symbol “  " is an analogue of the locution "if and only if".

16 Module 8CMPF144 Fundamentals of Computing TheorySlide 16 Developing Formal Language (cont.) For All ( ∀ ) The symbol " ∀ " is called a universal quantifier, and is an analogue of "for all"; so ∀ v θ can be read "for all v, θ ". There is ( ∃ ) The symbol " ∃ " is called an existential quantifier, and is an analogue of "there exists" or "there is"; so ∃ v θ can be read "there is a v such that θ ".

17 Module 8CMPF144 Fundamentals of Computing TheorySlide 17 Conclusion Logic is a study of a valid reasoning – how we determined or conclude whether a statement is valid or invalid To study logic, we need to study the language used to describe a statement, the deductive system and as well as the semantic aspect of a formal language. Formal language is used to avoid ambiguity in natural language. There are guidelines to write formal language such as a formula.

18 Module 8CMPF144 Fundamentals of Computing TheorySlide 18 Example (RAISE Language) ∀ x: Nat ● (x = 0) V (x >0) Reads: for all numbers x, either x is equal to 0 or x is greater than 0 ∀ p: Person, db: Database ● check (p,db)  p Є db Reads: for all people p and for all database db, if the predicate check (p,db) holds, then p Є db (A person is registered if that person belongs to the set representing the database) ∀ x, y : Nat ● ∃ !z: Nat ● x + y = z (note: ∃ ! = ‘there exists exactly one’) ∃ x, y: Nat, b: Bool ● b = (x = y)

19 Module 8CMPF144 Fundamentals of Computing TheorySlide 19 Example of Formal Language Z Language B Language RAISE (Rigorous Approach to Industrial Software Engineering ) Language COLD (Common Object-oriented Language for Design )Language Many more… (search the Internet for more informations)


Download ppt "CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic."

Similar presentations


Ads by Google