Docsity

Introduction to Logic Programming with Focus on Distributed Systems, Study notes of Logic

Partial preview of the text

Download Introduction to Logic Programming with Focus on Distributed Systems and more Study notes Logic in PDF only on Docsity!

Logic & Computation

Distributed Systems / Paradigms Sistemi Distribuiti / Paradigmi

Andrea Omicini [email protected]

Dipartimento di Informatica – Scienza e Ingegneria (DISI) Alma Mater Studiorum – Universit`a di Bologna a Cesena

Academic Year 2016/

Outline

(^1) Logic

(^2) Logic Programming

3 Distributed Logic Programming

What is Logic?

Logic

http://www.britannica.com/topic/logic Logic, the study of correct reasoning, especially as it involves the drawing of inferences.

logic studies the way we draw conclusions and express ourselves, and deals with how to formalise it [Metakides and Nerode, 1996a] it dates back to Aristotle, for whom logic is the instrument for human knowledge [Rijk, 2002]

Computational Logic

Logic in Computer Science

computational logic (CL) [Lloyd, 1990] is logic in computer science it concerns all uses of logic in computer science: to compute, to represent computation, to reason about computation it is rooted in logic, applied math, artificial intelligence, computer science

Logic & Math II

The rise of mathematical logic

starting form a paradox in Cantor’s theory of numbers, Russell’s paradox (the set of all sets that do not belong to themselves) exposed the logical inconsistencies at the foundations of mathematics this made clear that only a rigorous formalisation of mathematics could lead to well-founded mathematical reasoning and theories around 1920, David Hilbert’s program aimed at addressing the issue—to be soon undermined by G¨odel’s Incompleteness Theorems [G¨odel, 1931] the acme of those efforts resulted in the “Principia Mathematica” [Whitehead and Russell, 1927], a complete logic formalisation of all mathematics, finally treated as a whole axiomatic system

Truth I

Syntax vs. semantics: examples

“the sum of numbers two and one is three” is a true proposition in any formalisation of arithmetics, whatever symbols we use—the semantic side of truth if “the Snark was a Boojum” [Carroll, 1876] then “something is a Boojum” is a true proposition whatever the meaning of the sentence—the syntax side of truth

Truth III

Interpretation and logic entailment

Alfred Tarski [Tarski and Tarski, 1994] formalised the notion of logical interpretation as the relation between the symbols (syntax) and the elements of the domain of discourse (semantics) he defined logical entailment (or, logical consequence) precisely: when a conclusion is true in every interpretation making all premises true, then premises logically entail the conclusion—or, the conclusion is a logical consequence of the premises

Truth IV

Interpretation and logic entailment

after Tarski’s work, logic is typically discussed as a two-sided story [Levesque, 2012] a syntactic side involving axioms and rules of inference—sometimes called a proof theory a semantic side involving interpretations and truth—sometimes called a model theory with logical soundness and completeness theorems relating the two sides

Truth VI

logic axioms

no interpretation interpretation

syntax

(symbols)

semantics

(meanings)

theorem proof logic entailment

soundness

completeness

Computation vs. Deduction I

The difference between computation and deduction [Pfenning, 2007]

To compute we start from a given expression and, according to a fixed set of rules (the program) generate a result. For example, 15 + 26 → (1 + 2 + 1)1 → (3 + 1)1 → 41. To deduce we start from a conjecture and, according to a fixed set of rules (the axioms and inference rules), try to construct a proof of the conjecture. So computation is mechanical and requires no ingenuity, while deduction is a creative process. For example, an^ + bn^6 = cn^ for n > 2 ,... , 357 years of hard work... , QED.

Computation vs. Deduction III

Yet, somehow computation deduction [Pfenning, 2007]

(^1) computation can be seen as a limited form of deduction since it establishes theorems—e.g., 15 + 26 = 41 is both the result of a computation, and a theorem of arithmetic (^2) deduction can be considered a form of computation if we fix a strategy for proof search, removing the guesswork (and the possibility of employing ingenuity) from the deductive process

This latter idea is the foundation of logic programming. Logic program computation proceeds by proof search according to a fixed strategy. By knowing what this strategy is, we can implement particular algorithms in logic, and execute the algorithms by proof search.

Deduction I

Judgements [Martin-L¨of, 1996]

a judgement is an object of knowledge—knowing a judgement comes from the evidence we have for it the most common judgement is A true—that is, given a proposition A, A is true ! most of logic programming deals with truth of propositions other judgements are A false – that is, A is false – for true negation A true at t – that is, A is true at time t – the subject of temporal logic K knows A – that is, K knows that A is true – the subject of epistemic logic

Deduction III

Inference chain

if we know J 1 ,... Jn and J^1 ,..., J JnR then we can infer J how do we know, say, J 1? we may know J 1 , 1 ,... J 1 ,n and J^1 ,^1 ,..., J 1 J^1 ,nR 1 , then infer J 1 thus we may build an inference chain to prove J—if possible

Proof I

Proof tree

given the structure of a deduction, the data structure covering all the possible inference chains for a judgement J is a tree—a proof tree whose root is the conclusion J whose edges are deductions labelled by an inference rule where premises are child nodes, conclusions are parent nodes

... J 1 , 1

R 1 , 1 ,... ,

J 1 ,n 1

R 1 ,n 1

J 1

R 1...

Jn, 1

Rn, 1 ,... ,

Jn,nn

Rn,nn

Jn

Rn

J

R

J is the root of the tree J 1 ,... Jn are nodes of the tree