Informatics 1 - Computation & Logic: Tutorial 3

Similar documents
Informatics 1 - Computation & Logic: Tutorial 4

Logic Informatics 1 Functional Programming: Tutorial 6

Informatics 1 - Computation & Logic: Tutorial 5

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

CSE 20 DISCRETE MATH. Fall

Chapter 2 Exercises and Answers

Number Bases LESSON TWO. Computer Science. By John Owen

CSE 20 DISCRETE MATH. Winter

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

THE LOGIC OF COMPOUND STATEMENTS

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Logic Design: Part 2

Mixed Integer Linear Programming

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

CS40-S13: Functional Completeness

Binary, Hexadecimal and Octal number system

(QiuXin Hui) 7.2 Given the following, can you prove that the unicorn is mythical? How about magical? Horned? Decide what you think the right answer

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

Chapter 1 Preliminaries

2. BOOLEAN ALGEBRA 2.1 INTRODUCTION

GCSE Computer Science Booster Pack

Mastering Binary Math

Lesson Plan. Preparation

Summary of Course Coverage

Binary Representation. Jerry Cain CS 106AJ October 29, 2018 slides courtesy of Eric Roberts

Lecture 6: Arithmetic and Threshold Circuits

Bits, Words, and Integers

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B

2.6 BOOLEAN FUNCTIONS

Chapter 2: Universal Building Blocks. CS105: Great Insights in Computer Science

Comp 150 Final Exam Overview.

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

Lecture Notes on Ints

CS1800 Discrete Structures Final Version A

SOFTWARE TESTING UNIT-VI Logic Based Testing

EE292: Fundamentals of ECE

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

The Caesar Cipher Informatics 1 Functional Programming: Tutorial 3

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Chapter 3: Propositional Languages

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

Digital Logic Design Exercises. Assignment 1

CS & IT Conversions. Magnitude 10,000 1,

3. According to universal addressing, what is the address of vertex d? 4. According to universal addressing, what is the address of vertex f?

Thus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.

Chapter 3. Set Theory. 3.1 What is a Set?

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

2.1 Sets 2.2 Set Operations

Introduction. The Quine-McCluskey Method Handout 5 January 24, CSEE E6861y Prof. Steven Nowick

1.4 Normal Forms. We define conjunctions of formulas as follows: and analogously disjunctions: Literals and Clauses

Introduction to Boolean logic and Logical Gates

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

CDS Computing for Scientists. Midterm Exam Review. Midterm Exam on October 22, 2013

CS314: FORMAL LANGUAGES AND AUTOMATA THEORY L. NADA ALZABEN. Lecture 1: Introduction

CHAPTER-2 STRUCTURE OF BOOLEAN FUNCTION USING GATES, K-Map and Quine-McCluskey

Number Systems CHAPTER Positional Number Systems

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Informatics 1: Data & Analysis

LSN 4 Boolean Algebra & Logic Simplification. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Binary Adders: Half Adders and Full Adders

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Binary Values. CSE 410 Lecture 02

Digital Techniques. Lecture 1. 1 st Class

Outline. What Digit? => Number System. Decimal (base 10) Significant Digits. Lect 03 Number System, Gates, Boolean Algebra. CS221: Digital Design

Turtle Graphics and L-systems Informatics 1 Functional Programming: Tutorial 7

Boolean Analysis of Logic Circuits

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Mathematics for Computer Science Exercises from Week 4

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

Number systems and binary

4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)

Section A Arithmetic ( 5) Exercise A

LECTURE 2 An Introduction to Boolean Algebra

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

Bits. Binary Digits. 0 or 1

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).

Inf2C - Computer Systems Lecture 2 Data Representation

Review of Operations on the Set of Real Numbers

1.3 Systems of numeration: To represent quantities in the different systems of numeration, specific symbols are used, which are also called ciphers.

Propositional Calculus. Math Foundations of Computer Science

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

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

Number System. Introduction. Decimal Numbers

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

END-TERM EXAMINATION

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Hundred-thousands. Millions. Ten-thousands

Boolean Functions (Formulas) and Propositional Logic

Answer Key #1 Phil 414 JL Shaheen Fall 2010

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

MATH 104B OCTAL, BINARY, AND HEXADECIMALS NUMBERS

CSE 115. Introduction to Computer Science I

Transcription:

Informatics - Computation & Logic: Tutorial Counting Week 5: 6- October 7 Please attempt the entire worksheet in advance of the tutorial, and bring all work with you. Tutorials cannot function properly unless you study the material in advance. Attendance at tutorials is obligatory; please let the ITO know if you cannot attend. You may work with others, indeed you should do so; but you must develop your own understanding; you can t phone a friend during the exam. If you do not master the coursework you are unlikely to pass the exams. If we want to go beyond yes/no questions, it is natural to ask, How many...? We are interested in sets, so we will ask how many elements there are in a set. We will focus on finite sets. We write A or #A for the number of elements in A I Let A and B be disjoint finite sets, with at least one element, b B (A and B may have other elements). (a) Is b A? Use arithmetic operators to give expressions for the following numbers: (b) {} = (c) A [{b} = (d) {ha, bi a A} = (h) {f f : A! B} = (e) A [ B = (f) A B = (g) } A = (i) {R A A RisatotalorderingofA} = II Give rules, in the style of Tutorial, to generate the following sets: (a) the set F } N of finite subsets of the natural numbers, N. (b) the set N of natural numbers

The natural numbers N = {,,,,,...} correspond to the sizes of finite sets. For a finite set, the answer to the question, How many?, will be a number. Since ; = {} is a finte set, is a natural number. In most living languages it is possible to name an arbitrary natural number. so, we can use natural language to give the answer. However, these names soon become unwieldy. Tally marks are a unary numeral system. Each element of the set we are counting is represented by a separate mark, a stroke. Forexample, thenumbersone, two, three are represented by,,.tomakethisnotationmoreeasilylegible,forlarger numbers we use clusters. For example, four, five, six are represented by,, ; twelve is represented by ; In our everyday lives, we usually use decimal notation for natural numbers. A finite sequence of n digits x i {,...,9} represents a number. hx n,...,x i represents X i<n i x i Binary notation is similar. A finite sequence of n digits x i {, } represents a number. hx n,...,x i represents X i<n i x i In general, for k-ary notation (k >), a finite sequence of n digits x i {,...,n } represents a number. hx n,...,x i represents X i<n n i x i For n-ary notation with n apple we use the normal digits,...n. We then move on to use letters of the alphabet as digits >. So the hexadecimal (6-ary) digits are,,,,, 5, 6, 7, 8, 9, A, B, C, D, E, F.

III Each row of the table below should show the same number represented in the various bases. (a) Complete the table. Base 5 7 8 6 Name binary ternary octal decimal hexadecimal 7 5 F When we represent a number in base n, we use digits n. Just as the places in decimal notation count units, tens, hundreds, thousands, etc., the places in n-ary notation represent units, ns, n s, n s, etc. Just as with decimal arithmetic, when we add multiply, subtract, or take powers of numbers in base n, thevalueintheunitspositionoftheresultdependsonlyonthevalue(s)in the units position of the argument(s). The arithmetic of the units position is called arithmetic mod n, (arithmetic modulo n). We write x mod n for the value of the digit in the n-ary expansion of x. Itisjusttheremainderoftheintegerdivisionofx by n. Both (x mod n), andtheresult,(x div n), oftheintegerdivision,canbedefined by the following properties: 666 7 666 apple x mod n<n x= n (x div n)+(x mod n) AB

(b) Complete the addition and multiplication tables for arithmetic mod, 5, and 7. Remember, this is just the arithmetic of the units column, so each square should contain just one digit in the range n. + + + 5 6 5 6 5 6 5 6

IV This question concerns the 56 possible truth valuations of the following eight propositional letters A, B, C, D, E, F, G, H. For each of the following expressions, say how many of the 56 valuations satisfy the expression, and briefly explain your reasoning. For example, the expression D is satisfied by half of the valuations, that is 8 of the 56, since for each valuation that makes D true there is a matching valuation that make D false. (a) A ^ B (b) (A _ B) ^ C (c) (A! B)! C (d) (A! B)^(B! A)^(C! D)^(D! E)^(E! F )^(F! G)^(G! H) 5

(e) (A! B) ^ (B! A) ^ (C! D) ^ (D! C) ^ (E! F ) ^ (F! G) ^ (G! H) 6

(f) (H! A)^(A! B^C)^(B_C! D)^(A! E)^(E! F )^(F! G)^(G! H) Tutorial Activities. As usual, buddy-up and take the first minutes of the tutorial to check through your anwers to the homework exercises, I IV. Ask others in your group, or call on one of the tutors if you have unresolved questions. The main activity for this tutorial is on the next page. It introduces an idea that will be crucial to your understanding of the resolution procedure that is one of the key topics of this course. 7

Combining Constraints In this exercise we consider a formula in conjunctive normal form (a conjunction of disjunctions of literals) as a set of constraints each conjunction of literals is a constraint. You should already have observed, while doing the tutorial exercises, that when we have two sets of constraints that are independent, in the sense that they share no common propositional letters, then we can solve each set of constraints separately, and then combine the answers.. Consider two sets of constraints =(R _ B) ^ ( A _ G) = ( R _ A) ^ ( B _ G) (a) How many of the sixteen states of R, B, A, G satisfy? (b) How many satisfy? (c) Use the distributive law to write down the CNF for _. This gives a set of constraints that is satisfied by exactly those states that satisfy either or or both. Hints: In algebra (ab + cd)(wx + yz) =abwx + abyz + cdwx + cdyz. In logic any constraint that includes both an atom and its negation is trivially satisfied, and can be omitted. (d) How many states of RBAG satisfy _? (e) How many states satisfy ^?. Consider the following set of constraints: =(X _ R _ B) ^ (X _ A _ G) ^ ( X _ R _ A) ^ ( X _ B _ G) How many states of the five boolean variables XRBAG satisfy? Hint: Divide the states that satisfy into two disjoint subsets by considering separately the states where X is true and the states where X is true, then refer to the previous question. This tutorial exercise sheet was written by Michael Fourman and Dave Cochran. Send comments to Michael.Fourman@ed.ac.uk 8