Lecture10Predicates - CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 1 Lecture 10 — CS 2603 Applied Logic for

Info iconThis preview shows pages 1–6. 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

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

View Full DocumentRight 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: CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 1 Lecture 10 — CS 2603 Applied Logic for Hardware and Software Predicate Calculus Propositions Plus Plus CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 2 What is a Predicate? ¡ Predicate ¢ Parameterized collection of propositions ¢ P(x) 9 Typically a different proposition for each x 9 Universe of discourse – Values that x may take ¡ Universe of discourse ¢ Must be specified 9 Otherwise, all bets off — muchas contradicciónes ¢ Non-empty 9 Empty universe calls for special handling 9 Default assumption: non-empty universe Predicate about a Program for Sums sum :: [Rational] −> Rational ¡ Input (argument) 9 Sequence of Rational values (ratios of whole numbers) 9 Type formula: [Rational] — square brackets indicate sequence-type ¡ Output (value delivered): Rational — not a sequence (so, no brackets) ¢ Predicate: S(n) ≡ sum[x 1 , x 2 , …, x n ] = x 1 + x 2 + … + x n 9 S is a predicate — each equation S(n) is a different proposition 9 Each S(n) is either True or False 9 S(3) is this equation: sum[x 1 , x 2 , x 3 ] = x 1 + x 2 + x 3 • The equation is either True or False, so S(3) is a proposition ¡ Universe of discourse (collection of values that parameterize S) 9 Natural numbers N = {0, 1, 2, … } — a collection of infinite size ¡ Why not T([x 1 , x 2 , … x n ]) instead of S(n)? 9 Nothing wrong with T([x 1 , x 2 , … x n ]) 9 Universe of discourse for T: finite sequences of numbers 9 Universe of discourse for S: counting numbers {0, 1, 2, …} type of argument type of value delivered arrow: part of “type” formula (not implication) CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 3 CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 4 Predicate about a Program for Maximums maximum :: [String] −> String ¡ Argument 9 Sequence of strings (String means sequence of characters) 9 Type: [String] — square brackets indicate sequence-type ¡ Value: String — not a sequence of strings (so, no brackets) ¢ Predicate: B(n, k) ≡ maximum[s 1 , s 2 , …, s n ] ≥ s k 9 B is a predicate — each B(n, k) is a proposition (True or False) 9 B(4,2) is the proposition: maximum[s 1 , s 2 , s 3 , s 4 ] ≥ s 2 ¡ Universe of discourse (collection of values that parameterize B) 9 Pairs of non-zero natural numbers {(1,1), (2,1), (2,2), (3,1), … } where second number in pair does not exceed first ¡ Why not C([s 1 , s 2 , … s n ], s k ) instead of B(n, k)? 9 C is ok, but depends on the strings s i — not just on n and k – Proofs involving B must take care to encompass arbitrary s i ’s 9 What is the universe of discourse for C([s 1 , s 2 , … s n ], s k )? CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 5 Another Predicate about Maximums...
View Full Document

This note was uploaded on 04/08/2008 for the course CS 2603 taught by Professor Rexpage during the Spring '08 term at The University of Oklahoma.

Page1 / 15

Lecture10Predicates - CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 1 Lecture 10 — CS 2603 Applied Logic for

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

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