Download presentation
Presentation is loading. Please wait.
1
tautology checking continued
CSE Winter 2008 Introduction to Program Verification January 17 tautology checking continued
2
Extras > Propositional Logic Questions
translating formal logic notations into tautology input examples of problems we can work with using tautology try question 4: r -> (p ^ ~r) translates to what? how could you use tautology to assist with question 6?
3
translation issues exercise 2.10.
how to get started? failure to show that a translation is a tautology may just mean incomplete or faulty analysis of the English e. g. “Either a rose is red or it isn’t. analysis into P or Q, with P = “Either a rose is red” ?? Q = “it isn’t” ??
4
general vs specific propositions
"If the above formulae are true, and the car has gas, and I have money and an umbrella, can I go on a picnic?" Notice how the propositions can be divided into general background statements and facts about a specific situation, which generate an implication check: background and facts implies hypothesis Apply this idea to Exercise 2.12
5
Ch. 3. descriptive statements
using propositional functions with only Boolean variables makes it difficult to construct descriptive statements we always have to set up equations that identify the variables p = “he will come by the 8:15 train” q = “he will come by the 9:15 train”, etc.
6
terms it would be nice if we could use English phrases or mathematical expressions as the names of variables English examples: 'the car has gas', 'I have money', etc. mathematical expressions: f(x) > 0, . . for this we need a new datatype: a very useful one called a term used in programming languages that support symbolic computation: Lisp, Prolog
7
terms in mark-up languages
recently this datatype has become very important through the development of mark-up languages, particularly HTML & XML. HTML example: <html> <head> <title> </title> </head> <body> page content </body> </html>
8
term structure a term is a labelled ordered tree
every sub-tree has a labelled root the sub-trees of a term are ordered the structure of a term is described in terms of: the functor = label of the root the arity = number of subtrees the list of subtrees = arguments (or just args)
9
notation for terms general notation for terms uses the form of a function applied to arguments fun(a1, t(a2)) what’s the functor? arity? args? what’s a term of arity 0? numbers, constants like a1, x, 'I have money', etc. what's html's arity in the HTML example?
10
operators for terms of arity 1 or 2, we can use operators (if defined)
arity matters: in - a, - is not the same functor as in b - a my first definition of a functor as the label of the root of a term wasn’t precise. The functor is characterized by both the label and the arity. -/1= negation -/2 = subtraction
11
terms as propositional functions
replace arguments in logical terms by variables and you have a propositional function 0=0 or not 0=0. (a tautology) equal(0, 0) or unequal(0, 0). not a tautology same as P or Q: contingent!
12
distinction between logical and non-logical terms
functor = true/0 or false/0 or logical operation example: f(true(0)) and w('1a',y)
13
non-logical vs logical terms
meaning of a logical term is defined by the logical computations we do with it meanings for non-logical terms will have to be determined by some other computation coming up in Ch. 4
14
terms vs. functions terms need not be evaluated
can be processed purely as symbolic expressions not associated with a value the expression a+a denotes a function, call it twice/1 a+a = twice(a) the function has one argument, but the term has two
15
wang to handle logical statements involving terms, we use another tautology checker: wang uses a very different algorithm than tautology in computer science, a profusion of equivalent but different algorithms is interesting and important -- definitely not a nuisance to be avoided
16
terms instead of variables
tautology program required logical variables to be actual Prolog variables which are assigned truth-values in the testing for falsity. variable name begins with upper-case letter wang requires logical variables to be terms functor begins with lower-case letter
17
semantics vs syntax the tautology algorithm (checking the truth table) operates on the semantics of Boolean logic what the Boolean functions evaluate to wang operates syntactically no evaluation, just syntactic operations such as comparison greater expressivity!
18
using the wang program 3.3 tells you what you can input to wang
terms interpreted as variables begin with lower-case p implies (q implies p). there are other alternatives: ‘It is Monday’ implies ‘It is Monday’. implies(p, implies(q, p)).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.