CSE 3341.03 Winter 2008 Introduction to Program Verification January 8 Boolean operators.

Slides:



Advertisements
Similar presentations
Boolean Algebra and Logic Gates
Advertisements

CSE Winter 2008 Introduction to Program Verification January 24 tautology checking, take 2.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 19: Minding Ps & Qs: Axiomatic.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
Lecture 2 Dr Richard Reilly Dept. of Electronic & Electrical Engineering Room 153, Engineering Building To insert your company logo on this slide From.
1 Digital Logic
BOOLEAN LOGIC CSC 171 FALL 2004 LECTURE 7. ASSIGNMENT Review Quiz # 2 Start reading Chapter 5.
1 Boolean Algebra & Logic Design. 2 Developed by George Boole in the 1850s Mathematical theory of logic. Shannon was the first to use Boolean Algebra.
Describing Syntax and Semantics
Propositional Calculus Math Foundations of Computer Science.
Logic Gates Circuits to manipulate 0’s and 1’s. 0’s and 1’s used for numbers Also to make decisions within the computer. In that context, 1 corresponds.
The Laws of Logic: Boolean Algebra A State High Math Club Presentation START==TRUE.
Computer Science 101 Boolean Algebra. What’s next? A new type of algebra – Helps us A new type of algebra – Helps us With logical reasoningWith logical.
22C:19 Discrete Math Boolean Algebra & Digital Logic Fall 2010 Sukumar Ghosh.
Intro to Discrete Structures
Digital Logic Circuits – Chapter 1 Section 1-3, 1-2.
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
1 Fundamentals of Computer Science Propositional Logic (Boolean Algebra)
Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.
A Brief Summary for Exam 1 Subject Topics Propositional Logic (sections 1.1, 1.2) –Propositions Statement, Truth value, Proposition, Propositional symbol,
CSC Intro. to Computing Lecture 5: Boolean Logic, Gates, & Circuits.
CSE Winter 2008 Introduction to Program Verification January 29 how wang works.
1 10/13/2015 MATH 224 – Discrete Mathematics Why Study Discrete Math  Determination of the efficiency of algorithms, e.g., insertion sort versus selection.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
CS1Q Computer Systems Lecture 6 Simon Gay. Lecture 6CS1Q Computer Systems - Simon Gay2 Algebraic Notation Writing AND, OR, NOT etc. is long-winded and.
CSC Intro. to Computing Lecture 5: Boolean Logic, Gates, & Circuits.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Copyright © Curt Hill Mathematical Logic An Introduction.
MATH 224 – Discrete Mathematics
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Introduction to Python and programming Ruth Anderson UW CSE 140 Winter
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Semantics In Text: Chapter 3.
CSE Winter 2008 Introduction to Program Verification January 31 proofs through simplification.
Discrete Mathematics CS 285. Lecture 12 Quick Overview The conceptual center of computer science is the ALGORITHM.
Extra slides for Chapter 3: Propositional Calculus & Normal Forms Based on Prof. Lila Kari’s slides For CS2209A, 2009 By Dr. Charles Ling;
CSE Winter 2008 Introduction to Program Verification January 15 tautology checking.
Logic UNIT 1.
CS1Q Computer Systems Lecture 6 Simon Gay. Lecture 6CS1Q Computer Systems - Simon Gay2 Algebraic Notation Writing AND, OR, NOT etc. is long-winded and.
Laws of Boolean Algebra Commutative Law Associative Law Distributive Law Identity Law De Morgan's Theorem.
Boolean Algebra Computer Architecture. Digital Representation Digital is an abstraction of analog voltage –Voltage is a continuous, physical unit Typically.
ECE DIGITAL LOGIC LECTURE 6: BOOLEAN ALGEBRA Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 02/01/2016.
Logic Simplification-Using Boolean Laws Logic Design Laboratory EE 2121 Lectures By Manesh T EE2121-In Charge
DIGITAL ELECTRONICS. Everything in digital world is based on binary system. Numerically it involves only two symbols 0 or 1. –0 = False = No –1 = True.
CSE Winter 2008 Introduction to Program Verification February 5 calculating with simplify.
Logic Gates and Boolean Algebra Introduction to Logic II.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
Dr. ClincyLecture Slide 1 CS6020- Chapter 3 (3A and ) Dr. Clincy Professor of CS First Exam - Tuesday, September 6th Coverage: All subjects up to.
CENG 424-Logic for CS Introduction Based on the Lecture Notes of Konstantin Korovin, Valentin Goranko, Russel and Norvig, and Michael Genesereth.
Hoda Roodaki Boolean Algebra Hoda Roodaki
Boolean Algebra & Logic Gates
CPS120 Introduction to Computer Science
Morgan Kaufmann Publishers
Computer Science 210 Computer Organization
tautology checking continued
CS Chapter 3 (3A and ) Part 1 of 8
Logic Gates and Boolean Algebra
CS Chapter 3 (3A and ) Part 1 of 8
Basic Logical Operations (Fascinating)
4-1 LOGIC OPERATIONS In Chapter 3 we discussed the fact that data inside a computer is stored as patterns of bits. Logic operations refer to those operations.
CHAPTER 2 Boolean Algebra
Dr. Clincy Professor of CS
Propositional Calculus: Boolean Algebra and Simplification
Computer Science 210 Computer Organization
Dr. Clincy Professor of CS
ECB2212-Digital Electronics Boolean algebra
Lab Instructors will overview the MSP430
Boolean Expressions to Make Comparisons
Presentation transcript:

CSE Winter 2008 Introduction to Program Verification January 8 Boolean operators

January 3 lecture notes available as a PDF file see link from the table of contents panel on the course home page or notes/ slides.pdf

what does verification give you? a top-down understanding of a piece of software: general and rigorous, not based on specific examples the more perspectives, the better for catching errors. that's the idea behind the argument that open- source will be more reliable than proprietary code.

two main approaches to verification build a model of a machine that abstractly executes the program check zillions of cases for key desired properties works well for hardware, communication protocols construct and prove a theorem

our approach construct a logical proof based on the mathematical meaning assigned to the program text (i. e. a theorem) this has been considered to be controversial from a theoretical/philosophical perspective it’s been argued that verification, for a variety of reasons, is only conditional, not absolute (some truth to this) but having a proof is still better than claiming a program is correct without one

"verification is a pain" another knock on verification, from a practical perspective, is that even simple proofs are too hard to do, and even when “easy” are very tedious we’ll deal with this objection head on: use tools to do the “heavy lifting”

treat logic as computation since our tools are computational and concerned with proofs, we will need to develop an understanding of the basics of computational logic a very different perspective on logic and mathematics than you have been given in your math courses but inevitable in a computer-based technological society.

contrast with "semantic" approach logic is about truth? so logic is about distinguishing correct from incorrect arguments? in the computational approach, these issues essentially disappear!

the view from 10,000 ft. verification occupies only a very small part of the field of software development:

logical operators chapter 1 start with a table of logical operators operator vs operation ? an operator is a syntactic entity associated operation is a function cf. x f y with f(x, y) is the table of operators complete?

multiple notations

additional operators two more logic operators: NAND (sometimes NAN) and NOR we won’t use them NAND is a basic building block of digital logical circuits we could replace not,and,or expressions involving only the single operator NAND not A = A NAND A how do we get OR?

it gets worse! (Theorem of Principia Mathematics)

standardizing our notation important to be able to recognize various notations not much pressure on a mathematician to adopt a standard notation; that’s why we get so many. but we are required by the software we want to use to standardize on specific English words.

examples of logical operators in use Find results of search for strings with all of the words A,B, C = A and B and C.. with at least one of the words = A or B or C.. without the words A or B or C = not A and not B and not C...

propositions propositions are expressions constructed from Boolean operators, the special names true and false, and other names which are assumed to have a fixed truth value this is a recursive datatype - why? hint: function composition?

Boolean operators our approach to logic derives from the work of George Boole Boolean operators are syntactically analogous to +, x, etc. Boolean operations are functions of truth- valued Boolean variables truth-valued = true or false

arithmetic analogue example: represent true by 1, false by 0 x and y = x*y where * is ordinary multiplication how about or? what's the arithmetic analogue to not ?

who was George Boole? - 19th cent. English mathematician after whom Boolean algebras, operators, variables are named The Mathematical Analysis of Logic (1847)

most famous work An Investigation of the Laws of Thought, on Which Are Founded the Mathematical Theories of Logic and Probabilities based on a binary approach, processing only two objects: the now famous 1-0, yes-no, true-false, on-off

logic as rules for correct argument which arguments yield TRUTHS? Greeks discovered that one could have correct arguments about incorrect or nonsensical things; or imagined, idealized objects such as points or lines what made the argument correct was independent of what it was about; it depended on relationships (patterns) between propositions

logic as a calculus some 1500 years after the Greeks, Boole invents a radical new perspective: the arithmetic analogy means that logic can be interpreted as a calculus like arithmetic propositions can be interpreted as arithmetic expressions

a calculus doesn't require meaning in mathematics, functions evaluate the values of their arguments they are blind to what's inside those arguments (3401 survivors: compare with macros) so the truth-value of "... " and ".... " must depend only on the truth-values of the arguments, as far as propositional logic is concerned. blind to what the names or non-logical expressions may mean.

in ordinary/natural language this isn't always true: some language use a double negative for emphasis: not not p = not p

operations as binary functions operator = binary function = 2x2 table you should be able to construct the 2x2 table for all the binary operators we are concerned with note: only one non-trivial unary function more generally, lists of argument -value pairs if the function has arity n, 2^n entries in the table

operator grammar operators are syntactic, require grammatical properties operators involve precedence issues and associativity to avoid writing ( ) the choices: left-associativity: x + y + z = (x+y) + z right-associativity ? I don't have an example: x op y op z = x op (y op z) no associativity: x xor y xor z is an error: have to use parentheses because the function xor is not associative

operator precedence logic operations compared with arithmetic: and has the precedence of * or has the precedence of + iff has the precedence of =

are the boolean values arbitrary? does it matter what the boolean values are just as long as there are 2?

Boolean values SVT 1.1 assumes that the range of Boolean functions is {true, false} is this important? see

can logic tells us which is which? "we can tell which value functions as true and which as false by looking at and/or" true and false = false true or false = true but look at the "logic tables" page

Boolean algebra is self-dual if we swap the names of Boolean values and the names of and/or? we get exactly the same structure! you actually knew that, in the form of "De Morgan’s Law" not(P and Q) = not P or not Q not(P or Q) = not P and not Q