1
snick snack
CPSC 121: Models of Computation 2016W2
Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes by Patrice Belleville and others
1
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
Outline
- Prereqs, Learning Goals, and Quiz Notes
- Problems and Discussion
– Logical equivalence practice – How to write a logical equivalence proof – A flaw in our model
- Next Lecture Notes
2
Learning Goals: Pre-Class
By the start of class, you should be able to:
– Translate back and forth between simple natural language statements and propositional logic, now with conditionals and biconditionals. – Evaluate the truth of propositional logical statements that include conditionals and biconditionals using truth tables. – Given a propositional logic statement and an equivalence rule, apply the rule to create an equivalent statement.
Example: given (u s) s, apply p q ~p q. Note: p maps to (u s) and q maps to s. Result: ~(u s) s
10
Learning Goals: In-Class
By the end of this unit, you should be able to:
– Explore alternate forms of propositional logic statements by application of equivalence rules, especially in order to simplify complex statements
- r massage statements into a desired form.
– Evaluate propositional logic as a “model of computation” for combinational circuits, including at least one explicit shortfall (e.g., referencing gate delays, fan-out, transistor count, wire length, instabilities, shared sub-circuits, etc.).
11
Where We Are in The Big Stories
Theory How do we model computational systems? Now: practicing our second technique for formally establishing the truth of a statement (logical equivalence proofs). (The first technique was truth tables.) Hardware How do we build devices to compute? Now: learning to modify circuit designs using our logical model, gaining more practice designing circuits, and identifying a flaw in our model for circuits.
12
Motivating Problem
Simplify this code, proving your simplification correct:
13
List version: ;; ListOfNatural -> Boolean ;; Produces true if all numbers in lon ;; are positive and false otherwise. (define (all-positive? lon) (cond [(empty? lon) true] [else (if (<= (first lon) 0) false (all-positive? (rest lon)))])) Image version: ;; Image -> Boolean ;; Produces true if image is too large to ;; fit on the HEIGHT-by-WIDTH screen. (define (too-large? image) (if (> (image-width image) WIDTH) true (if (> (image-height image) HEIGHT) true false)))