COM2003 Automata, Logic & Computation Logical Analysis & Inference: Introduction Mark Stevenson Department of Computer Science University of Sheffield

Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

1 / 14

Course Details — Semester 2 • Instructor:

Mark Stevenson (m.stevenson@dcs.shef.ac.uk)

• Module homepage: http://staffwww.dcs.shef.ac.uk/people/M.Stevenson/campus only/com2003/

 link from my personal homepage • Consult the homepage for:  all key course details  announcements  lecture slides  tutorial / lab exercises Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

2 / 14

Course Aims & Topics This module teaches the mathematical and logical tools for modelling and analysing computing systems: state machines, formal languages, logics, proof systems, and logic programming. Semester 2 heading:

Logic, Proof and Computation

• logical analysis and inference • propositional and predicate logic: syntax and semantics • translating from English to logic  both sentences, and whole arguments

• deduction and proof  both ‘natural’ and computational approaches

• computation through logic  look at Prolog as example of a logic programming language

Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

3 / 14

to uncovering such a situation, and metaheuristic search techniques are then employed to seek failures in the implementation. As a simple example, take the wrapping counter function of Figure 28. This function implements a counter, which takes an integer value between 0 and 10, and returns the increment. If the input is 10, the counter wraps round to 0. The pre-condition for this function is simply:

Relevance within Computer Science

n ≥ 0 ∧ n ≤ 10

• Required to understand research papers and background material The post-condition is:

(n < 10 → r = n + 1) ∨ (n = 10 → r = 0) where n is the input value and r is the return value.

• Leads to better understanding constructs A constraint system is then derivedoftoprogramming describe conditions of implementation

non-conformance by taking the pre-condition in conjunction with the negated

• post-condition: Used in many areas of CS, including Semantic Web and Natural Language Processing

n ≥ 0 ∧ n ≤ 10 ∧ ¬((n < 10 → r = n + 1) ∨ (n = 10 → r = 0))

(1)

obj(n ≥ 0) + obj(n ≤ 10)+ min((obj(n < 10) + obj(r &= n + 1)), (obj(n = 10) + obj(r &= 0)))

(2)

AnEncounter applications in some level 3 how and “close” 4 courses objective function is derived to indicate failure is .

This is constructed from the above constraint system using the rules in Tables 2 and 3:

It was(U. found that Mark Stevenson Sheffield)

the COM2003: landscapes of the objective functions derived from such Automata, Logic & Computation

4 / 14

Inference and Logical Form • Logic is the Science of Reasoning (one view, at least!) • Domain includes study of argumentation. • Argument — idealised to be:  Sequence of sentences (n), beginning with some premises (n − 1), and ending with a conclusion , i.e. is of form:

Premise1 , . . . Premisen−1 therefore Conclusion

• May be written:

Premise1 .. . Premisen−1 Conclusion

Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

5 / 14

Inference & Logical Form (contd)

â&#x20AC;˘ Sometimes, we can immediately see that an argument is correct or incorrect:

e.g. (1) All humans are mortal Socrates is a human Socrates is mortal e.g. (2) All humans are mortal Fido is mortal Fido is a human

Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

6 / 14

Inference & Logical Form (contd) e.g. (1) All humans are mortal Socrates is a human Socrates is mortal

â&#x20AC;˘ Argument (1) is logically valid. â&#x20AC;˘ Valid inference is truth-preserving i.e. if the premises are true, then the conclusion must also be true

â&#x20AC;˘ We say that . . .

conclusion follows from the premises conclusion is a logical consequence of the premises premises logically entail the conclusion

Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

7 / 14

Inference & Logical Form (contd) e.g. (2) All humans are mortal Fido is mortal Fido is a human

â&#x20AC;˘ Argument (2) is not logically valid.

 truth of its conclusion is uncertain, even if the premises are true  in this simple case, can even imagine situation where premises are true and conclusion false

â&#x20AC;˘ Logical validity does not depend on:  specific content

e.g. human vs. dog vs. politician vs. alien

 the factual truth of what is stated

â&#x20AC;˘ An argument is valid as a consequence of its logical form Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

8 / 14

Inference & Logical Form (contd) . . . an argument is valid as a consequence of its logical form.

â&#x20AC;˘ Following is of the same form as (1), and valid in same way: e.g. (3) All thargs are drekken Kretz is a tharg Kretz is drekken

â&#x20AC;˘ Likewise (4) has the same form, and is again valid: e.g. (4) All cats are reptiles Tiddles is a cat Tiddles is a reptile

 (4) shows a valid argument may have a false conclusion i.e. if any of the premises are false Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

9 / 14

Argument Schemata • Can represent common aspects of form of valid and invalid arguments by using argument schemata

• Argument (1) has schematic form:

All P are Q a is P a is Q

 always produces a valid argument • Likewise, (2) has schematic form:

All P are Q a is Q a is P

 always produces an invalid argument Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

10 / 14

Sentences & Propositions • A key term: PROPOSITION  used to designate what a sentence says about the world

• Synonymous sentences express the same proposition e.g. Paris is the capital of France France’s capital is Paris.

vs.

• Ambiguous sentences express more than one proposition e.g. Flying planes can be dangerous

• Proposition expressed may depend on context:

i.e. when, where, and by whom sentence is uttered e.g. I am hungry.

• For logic, it’s the proposition expressed by a sentence that matters Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

11 / 14

Levels of Logical Analysis • Logic addresses the logical form of sentences and arguments, and its role in determining logical validity and truth

• One approach is to find a manner of expression or notation which mirrors the relevant aspects of logical form

• Such a formal logic has three components:  a syntax:

• rules determining which strings of symbols count as formulas (‘sentences’) of the logic’s language

 a semantics:

• rules determining the meaning of formulas in the language

 a deductive system:

• rules for constructing proofs that some conclusion follows from given premises

Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

12 / 14

Levels of Logical Analysis (contd) • The analysis of logical form can be pursued at different levels or granularities

• Propositional logic studies inter -sentential relations i.e. relations between simple or compound sentences

 it ignores internal structure of simple sentences

• Example:

Either Charles is clever or Charles is rich Charles is not clever Charles is rich

Can be viewed as having underlying propositional form: (either) P or Q not P

where:

P = “Charles is clever” Q = “Charles is rich”

Q Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

13 / 14

Levels of Logical Analysis (contd) • Propositional logic is not fine-grained enough for all forms of reasoning

• Sometimes, need also to reason about entities and properties e.g.

All humans are mortal Socrates is a human Socrates is mortal

• For this we need predicate logic • More generally, there are a range of different logics  have different granularities  make different assumptions  are suited to different domains Mark Stevenson (U. Sheffield)

COM2003: Automata, Logic & Computation

14 / 14

moreto

LogicalAnalysis&amp;Inference:Introduction MarkStevenson DepartmentofComputerScience UniversityofSheﬃeld MarkStevenson (U.Sheﬃeld) COM2003:A...