Lec02_Pred_Logic_and_States

# Lec02_Pred_Logic_and_States - Illinois Institute of...

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

CS 536 Notes: Predicate Logic and States Lecture 2, Mon Aug 30, 2010 A. Why We’ll be using predicates to write speci fi cations for programs. Predicates and programs have meaning relative to states. B. Outcomes After this lecture, you should Understand what a predicate is, how to write them, and see a basic set of logical rules for transforming them. See the connection between formal and informal descriptions of some simple predicates. Understand what a state is, how we’re representing them, and how they connect to programs, expressions, predicates, and proofs. C. No Class Next Week! Monday September 6 is a holiday, Labor Day: No class. D. Last Time: Science of Programming; Propositional Logic Science of Programming is about program veri fi cation. We look at program execution from a logical standpoint, using logical statements to describe states our programs might be in; we’ll connect program execution to changes in logical statements. So in the meantime we need to review/study logic, programs, states, and execution. We looked at propositional logic. Proposition letters (boolean variables), the connectives , , , , and ¬. Truth tables, logical tautologies, contradictions, equivalence, entailment Basic and derived proof rules for propositional logic. Today we’ll extend this to the predicate calculus, look at states, expressions, and values of expressions. E. Predicate Logic In propositional logic, we assert truths about boolean values; in predicate logic, we assert truths about values from one or more “domains of discourse” like the integers. We extend propositional logic with domains (sets of values), variables whose values range over these domains, and operations on values (e.g. addition). E.g., with the integers we add the set , operations like +, –, *, /, % (mod), and the relations =, , <, >, , and . •A predicate is a logical assertion that describes some property of values. Illinois Institute of Technology Notes for Lecture 2 CS 536: Science of Programming - 1 of 7 - © James Sasaki, 2010

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

View Full Document
To describe properties involving values, we add basic relations on values (e.g., less- than), and we add quanti fi ed predicates so that we can talk about properties relative to sets of values. E.g., “for all integers x , either x is negative or nonnegative”. •A universally quanti fi ed predicate (or just “ universal ” for short) has the form ( x S . P ) where S is a set and P (the body of the universal) is a predicate involving x . E.g., every natural number > 1 is is < its own square: ( x . x > 1 x < x ² ). Often we leave out the set if it is understood. E.g., ( x . x > 1 x < x ² ). We may abbreviate further this using a “bounded” quanti fi er: ( x > 1 . x < x ² ). In general, P . Q means x . P Q where x appears in P and is understood to be the variable we are quantifying over.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern