Lecture10.6 - 1 11/21/06 Copyright N. Ramsey &...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 11/21/06 Copyright N. Ramsey & others. DPL-10: Logic Programming How to use Logic as a Programming Language Example Languages: Prolog Goedel (adds types) Mercury (adds functional programming) another variant adds constraints, another objects, etc It was supposed to be the language for the 5th generation project in Japan in the 1980s. It is (often) used to implement rule-based systems. 11/21/06 Copyright N. Ramsey & others. DPL-10: Logic Programming How to use Logic as a Programming Language It is based on ideas from Propositional Logic (where we can only determine truth and falsity, and which is thus not very interesting) Predicate Calculus also known as First Order Logic, which can be used as the basis for programming languages. Material in the lectures is, variously, from Ruth E. Davis "Truth Deduction and Computation", from lecture notes by Stuart Shieber, and from lectures by Gerald Sachs, and other sources. 11/21/06 Copyright N. Ramsey & others. DPL-10: Logic Programming Semantics of Propositional Calculus Grammar : P ::= V | P | P P | ( P ) V ::= p | q | r | s Valuation Function : [[*]] relative to the interpretation , where : variables {truth, falsity}. More specically: {truth, falsity} {truth, falsity} Variables V Propositions P Semantic Domains Syntactic Domains 11/21/06 Copyright N. Ramsey & others. DPL-10: Logic Programming Semantics of Propositional Calculus V ranges over variables, P , P 1 , P 2 , Q range over propositions V [[ V ]] = ( V ) P [[ V ]] = V [[ V ]] P [[ P ]] "not" P [[ P 1 P 2 ]] "implies" P [[( P )]] = P [[ P ]] = " # $ truth if P [[ P ]] = falsity falsity if P [[ P ]] = truth = " # $ % $ truth if P [[ P 2 ]] = truth truth if P [[ P 1 ]] = falsity falsity otherwise 11/21/06 Copyright N. Ramsey & others. DPL-10: Logic Programming Semantics of Propositional Calculus Syntactic Sugar: ( P Q ) ( Q P ) "equivalent to" P Q (( P ) Q ) "or" P Q ( P ( Q )) "and" P Q Expansion Called Abbreviation 11/21/06 Copyright N. Ramsey & others. DPL-10: Logic Programming More Semantics of Propositional Calculus We add some abbreviations to the language, and we give denotational denitions. Claim : really means "and". P [[ P Q ]] P [[ ( P ( Q ))]] by by by = " # $ falsity if P [[ P ( Q )]] = truth truth if P [[ P ( Q )]] = falsity = " # $ % $ falsity if P [[ Q ]] = truth falsity if P [[ P ]] = falsity truth otherwise ( P [[ P ]] = truth and P [[ Q ]] = falsity) = " # $ % $ falsity if P [[ Q ]] = falsity falsity if P [[ P ]] = falsity truth otherwise ( P [[ P ]] = truth and P [[ Q ]] = truth) 2 11/21/06 Copyright N. Ramsey & others....
View Full Document

This note was uploaded on 02/13/2012 for the course CS 91.531 taught by Professor Giam during the Fall '09 term at UMass Lowell.

Page1 / 12

Lecture10.6 - 1 11/21/06 Copyright N. Ramsey &...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online