SC/MATH Boolean Formulae. Ref: G. Tourlakis, Mathematical Logic, John Wiley & Sons, York University

Similar documents
Introduction & Review

Introduction to Logic Programming

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

Recursively Defined Functions

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters

1. [5 points each] True or False. If the question is currently open, write O or Open.

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Chapter 3: Propositional Languages

Formulas and Functions

CSC Discrete Math I, Spring Sets

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End

This book is licensed under a Creative Commons Attribution 3.0 License

Inference rule for Induction

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages. Context Free Grammars

Computer Science 236 Fall Nov. 11, 2010

Warmup Problem. Translate the following sentence from English into Propositional Logic. I want to eat ice cream even though I am on a diet.

CMSC 330: Organization of Programming Languages

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars

Propositional Calculus: Boolean Functions and Expressions. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Shell CSCE 314 TAMU. Haskell Functions

announcements CSE 311: Foundations of Computing review: regular expressions review: languages---sets of strings

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

Introduction to Logic Programming

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

Regular Languages and Regular Expressions

1.3 Functions and Equivalence Relations 1.4 Languages

What is a Logic Program. Introduction to Logic Programming. Introductory Examples. Introductory Examples. Foundations, First-Order Language

1 Elementary number theory

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

1.1 - Introduction to Sets

PROGRAMMING IN HASKELL. Chapter 5 - List Comprehensions

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 04. Boolean Expression Simplification and Implementation

Regular Expressions. A Language for Specifying Languages. Thursday, September 20, 2007 Reading: Stoughton 3.1

Math Introduction to Advanced Mathematics

Introduction. Problem Solving on Computer. Data Structures (collection of data and relationships) Algorithms

Propositional Logic. Part I

CMSC 330: Organization of Programming Languages. Context Free Grammars

Lecture 6,

Lamé s Theorem. Strings. Recursively Defined Sets and Structures. Recursively Defined Sets and Structures

2/18/14. Uses for Discrete Math in Computer Science. What is discrete? Why Study Discrete Math? Sets and Functions (Rosen, Sections 2.1,2.2, 2.

CSE 311 Lecture 21: Context-Free Grammars. Emina Torlak and Kevin Zatloukal

Notes for Comp 454 Week 2

Some Applications of Stack. Spring Semester 2007 Programming and Data Structure 1

Syntactic Analysis. CS345H: Programming Languages. Lecture 3: Lexical Analysis. Outline. Lexical Analysis. What is a Token? Tokens

Lecture 5. Logic I. Statement Logic

CMSC 330: Organization of Programming Languages

CSE 401 Midterm Exam 11/5/10

5.3 Recursive definitions and structural induction

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

Python I. Some material adapted from Upenn cmpe391 slides and other sources

Specifying logic functions

CMSC 330: Organization of Programming Languages. Context Free Grammars

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Functions

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

Software Paradigms (Lesson 6) Logic Programming

LECTURE 2 An Introduction to Boolean Algebra

Programming Languages Third Edition

Language Reference Manual simplicity

The Absolute Value Symbol

Context-Free Grammars

Decision Properties of RLs & Automaton Minimization

Discrete Mathematics. Kruskal, order, sorting, induction

Automating Construction of Lexers

Garrett Hall CSC 173 C Programming Weeks 3-4

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012

SET DEFINITION 1 elements members

Ordered structures. Dr. C. Constantinides. Department of Computer Science and Software Engineering Concordia University Montreal, Canada

Theoretical Part. Chapter one:- - What are the Phases of compiler? Answer:

Lexical Analysis. Chapter 2

Propositional Logic Formal Syntax and Semantics. Computability and Logic

CSE 401 Midterm Exam Sample Solution 2/11/15

Principles of Programming Languages COMP251: Syntax and Grammars

Overview. Discrete Event Systems - Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

Introduction to Lexical Analysis

Defining Functions. CSc 372. Comparative Programming Languages. 5 : Haskell Function Definitions. Department of Computer Science University of Arizona

Set and Set Operations

Stacks, Queues and Hierarchical Collections

Synthesis 1. 1 Figures in this chapter taken from S. H. Gerez, Algorithms for VLSI Design Automation, Wiley, Typeset by FoilTEX 1

Lecture 5: Predicate Calculus. ffl Predicate Logic ffl The Language ffl Semantics: Structures

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

Chapter Seven: Regular Expressions

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

Related Course Objec6ves

Dr. D.M. Akbar Hussain

Semantics and Pragmatics of NLP Propositional Logic, Predicates and Functions

Mathematical Induction

Syntax. In Text: Chapter 3

Test #2 October 8, 2015

CSCE 314 Programming Languages. Functional Parsers

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:

Compiler Construction LECTURE # 3

Transcription:

SC/MATH 1090 1- Boolean Formulae Ref: G. Tourlakis, Mathematical Logic, John Wiley & Sons, 2008. York University Department of Computer Science and Engineering York University- MATH 1090 01-Boolean 1

Overview Boolean syntax Boolean Alphabet Strings Formula Calculation; well-formed-formula (WFF) Parsing (top-down and bottom-up) Removing redundant brackets Complexity of formulae York University- MATH 1090 01-Boolean 2

Boolean Alphabet 1. Symbols for Boolean or propositional variables p, q, r with or without primes or subscripts Examples: p, p, p 123, q 45 2. Symbols for Boolean constants called top, verum, or symbol true called bottom, falsum, or symbol false 3. Brackets, ( and ) 4. Boolean connectives,,,, York University- MATH 1090 01-Boolean 3

Strings or Expressions Definition: A string (or word, or expression) over a given alphabet is any ordered sequence of the alphabet s symbols, written adjacent to each other without any visible separators (no commas or spaces, etc). Examples: (p ) is a string given Boolean alphabet. (p~q) is not a string given Boolean alphabet. (p q) and p)q( are two different strings given the Boolean alphabet. Note only the ordering is different. York University- MATH 1090 01-Boolean 4

Strings (cont.) String variables Denoted by A, B, C, etc with or without primes or subscripts Concatenation Example: if A is abc and B is de (given the English alphabet), then AB is abcde Empty string Denoted by A = A = A Substring B is a substring of A means that for some string C and D we have A= CBD If B is a substring of A and B A, then B is a proper substring of A. York University- MATH 1090 01-Boolean 5

Formula calculation Procedural definition Formula calculation is any finite (ordered) sequence of strings that we may write respecting the following requirements: 1. At any step, we may write a Boolean variable or a Boolean constant 2. At any step, we may write ( A), provided we have already written string A in a previous step. 3. At any step, we may write any of the strings (A B), (A B), (A B), (A B) provided we have already written strings A and B in a previous step. York University- MATH 1090 01-Boolean 6

Well-formed-formula (wff) A string A over the Boolean alphabet is called a Boolean Expression or a well-formed-formula iff it is a string written at some step of some formulacalculation. Examples: (p q) ((p r) ( q)) WFF: set of all well-formed-formulae (wffs) Bottom- up parsing of a wff is showing the procedural formula calculation steps. York University- MATH 1090 01-Boolean 7

Recursive definition of WFF The set of all well-formed-formulae is the smallest set of strings, WFF, that satisfies 1. All Boolean variables (p, q, r,...), and constants (, ) 2. If A and B are any strings in WFF, then so are the strings ( A), (A B), (A B), (A B), (A B) Top-down parsing of a wff is showing the recursive formula calculation steps. How do we know recursion terminates? The two definitions for WFF are equivalent. York University- MATH 1090 01-Boolean 8

Immediate Predecessors (i.p.) 1. Boolean variables or constants don t have any immediate predecessors 2. A is an immediate predecessor of ( A) 3. A and B are immediate predecessors of (A B), (A B), (A B), (A B) We will prove later that the i.p.s are unique for each formula. York University- MATH 1090 01-Boolean 9

Removing brackets Redundant brackets Outermost brackets are redundant Any pair of brackets is redundant if its presence can be understood from the priority of the connectives Priorities: The order of priorities (decreasing) is agreed to be,,,, For same connectives, the rightmost has the highest priority Least parenthesized notation (LPN): writing wff with all redundant brackets removed Note writing wff in LPN is just a short notation and is not a correctly written formula (by formula calculation) York University- MATH 1090 01-Boolean 10

Complexity The complexity of a formula is the number of connectives occurring in the formula The complexity of Boolean variables and constants is zero (they are also called atomic formulae) Example Complexity of ((p r) ( q)) is 3 York University- MATH 1090 01-Boolean 11