Chapter 1. Computation theory



Similar documents
Notes on Complexity Theory Last updated: August, Lecture 1

Primes. Name Period Number Theory

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

Introduction to computer science

CS 3719 (Theory of Computation and Algorithms) Lecture 4

3515ICT Theory of Computation Turing Machines

Why? A central concept in Computer Science. Algorithms are ubiquitous.

BOOLEAN ALGEBRA & LOGIC GATES

Gates, Circuits, and Boolean Algebra

Turing Machines, Part I

Quantum Computing. Robert Sizemore

CHAPTER 3 Boolean Algebra and Digital Logic

Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

Boolean Algebra Part 1

The Classes P and NP

Digital circuits make up all computers and computer systems. The operation of digital circuits is based on

ENGI 241 Experiment 5 Basic Logic Gates

Introduction to Theory of Computation

Today s Topics. Primes & Greatest Common Divisors

Computational Models Lecture 8, Spring 2009

Lecture 7: NP-Complete Problems

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Binary Adders: Half Adders and Full Adders

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

2 Elements of classical computer science

Factoring & Primality

New trend in Russian informatics curricula: integration of math and informatics

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, Notes on Algebra

United States Naval Academy Electrical and Computer Engineering Department. EC262 Exam 1

Cryptography and Network Security Number Theory

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Complexity Classes P and NP

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

Theory of Computation Chapter 2: Turing Machines

Basic Logic Gates Richard E. Haskell

Factoring Polynomials

Logic in Computer Science: Logic Gates

47 Numerator Denominator

Universality in the theory of algorithms and computer science

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

6.080/6.089 GITCS Feb 12, Lecture 3

CAs and Turing Machines. The Basis for Universal Computation

8 Primes and Modular Arithmetic

An Innocent Investigation

Understanding Logic Design

WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?

Lecture 2: Universality

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

Ian Stewart on Minesweeper

The P versus NP Solution

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Faster deterministic integer factorisation

NP-Completeness and Cook s Theorem

Unit 3 Boolean Algebra (Continued)

CS 103X: Discrete Structures Homework Assignment 3 Solutions

Chapter 7 Uncomputability

Chapter 2: Boolean Algebra and Logic Gates. Boolean Algebra

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

EVALUATING ACADEMIC READINESS FOR APPRENTICESHIP TRAINING Revised For ACCESS TO APPRENTICESHIP

Upon completion of unit 1.1, students will be able to

RAM & ROM Based Digital Design. ECE 152A Winter 2012

Turing Machines: An Introduction

Introduction to Logic in Computer Science: Autumn 2006

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur

Algebraic Computation Models. Algebraic Computation Models

CSE140: Components and Design Techniques for Digital Systems. Introduction. Prof. Tajana Simunic Rosing

Lecture Notes in Discrete Mathematics. Marcel B. Finan Arkansas Tech University c All Rights Reserved

The program also provides supplemental modules on topics in geometry and probability and statistics.

2.0 Chapter Overview. 2.1 Boolean Algebra

Notes on NP Completeness

THE BINARY NUMBER SYSTEM

Some Minesweeper Configurations

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

9.2 Summation Notation

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

NUMBER SYSTEMS. William Stallings

Lecture 13 - Basic Number Theory.

Hilberts Entscheidungsproblem, the 10th Problem and Turing Machines

Chapter 11 Number Theory

Vocabulary Words and Definitions for Algebra

Monday January 19th 2015 Title: "Transmathematics - a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK

SOLUTIONS FOR PROBLEM SET 2

The string of digits in the binary number system represents the quantity

Grade 7/8 Math Circles Fall 2012 Factors and Primes

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Computational complexity theory

Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

MACM 101 Discrete Mathematics I

Transcription:

Chapter 1. Computation theory In this chapter we will describe computation logic for the machines. This topic is a wide interdisciplinary field, so that the students can work in an interdisciplinary context. The field of computational logic include all kind of computational logic for machines or computers that is use of logic in computer science. Outline Introduction Turing Machine Binary System Boolean Algebra and Logic Gates Circuit Model of Computation Algorithm Models of computation P and NP Problems Motivations and ideas underlying quantum computation Introduction Let us briefly summarize developments of the computational logic. At 17th century Leibniz introduced an idea about the computational logic to determine the truth-value by using an algebraic logic and building a special language of alphabets. 1846-1854George Boole proposed a (boolean) logic. This logic based on logical calculus of truth values. This algebra is the algebra of two values (0,1).... The search for algorithm to determine the truth-value of sentences was appeared mid 1920's. The algorithm answer the problem as Yes or No. This algorithm is known as decision algorithm. A complete decision algorithm gives answer of the problem in a finite time. An incomplete decision algorithm never finishes the computation if the answer is No, or may or may not finishes the computation if the answer is Yes. For significantly large problems the incomplete algorithm is important. In 1935 Alan Turing proposed a theoretical model of a device that can execute and possible algorithm. This device is known as Turing Machine. John von Neumann and his collaborators was designed first multipurpose programmable computer based on principles of the Turing Machine. Computation theory is very important because computers were first proposed and devised theoretically. Turing Machine Turing machine is a theoretical model of a device that can execute any possible algorithm. Turing machine has the following abilities: It can read and write on a tape It can move right or left on a tape

It halt (stop running) when it reach special accept state or special reject state, otherwise the machine never halt and continue loops. It has infinity memory! Example: Determine for the following statement Turing machine HALT or continue to LOOPS. for i=1 to infinity if 2*i is not some of two primes then HALT (STOP) It is obvious that this is an infinite LOOPS statement. Unfortunately, such an infinite LOOPS detector cannot exist. (There is no algorithm that detect an infinite loop). This problem is known as HALTING problem. Turing machine has the following components: {Q,,,, q 0, q accept, q reject, t} Q is finite set of state (s 0, s 1, s 2,...) is input alphabet ( ) is tape alphapet q 0 is the start state q accept is the accept state q reject is the reject state is transition function from one stateto another by a given condition. # is blank symbol(not in, #2 ) For each transition, the tape begins in a state s, then read a symbol a, then change to a state q(p q) and write a symbol b, moves left or right (L or R). If we are dealing Turing Machine as computers then our input alphabet will be ={0,1} (The input will be binary). a 0 a 1 a 2 a 3... a n # # # CONTROL Turing machine can be used as; function evaluator( Read w then write f(w)), language accepters (Reads w then write 1 if w is accepted otherwise write 0 or continue to read new value), problem deciders (read a decision problem coded in binary and it halts by writing 1 on tape if the answer YES otherwise if the answer NO it writes 0) etc. Example. Design a Turing Machine, erase input and write blank. Solution: ERASE Turing machine

Example: Design a Turing machine that will decide whether the binary input represent an EVEN number. Solution: EVEN Turing machine Basic principles: Move right to the first blank then move left one cell. If the current cell is 0, the number is even. If the current cell is 1, the number is odd. Erase the tape and write 0 or 1, accordingly. Binary System and Boolean Algebra Classical computers use binary digits. Information is represented electronically in a computer using voltages of different levels. For instance, a 0 could be represented by a 0 voltage and a 1 could be represented by a voltage of 3 volts. Human have 10 fingers which has led to adaptation of decimal (base 10) number system. Decimal number system consists of 10 digits (0-9). Binary number system (base 2) the digit takes values 0 or 1. Converting binary to decimal: Using power of 2 we can convert any binary number to the decimal number. For example: Converting decimal to binary Dividing given decimal number by 2 and writing the remainder in each division one can convert the number from decimal to binary. As an example convert the number 83 to the binary. Divided Divisior Remainder 83 83/2 1 41 41/2 1 20 20/2 0 10 10/2 0 5 5/2 1 2 2/2 0 1 1 Remove 1 last cell then the number can be written as:(from bottom to up): 1010011

Divided Divisior Remainder Then the number 10000000. 128 128/2 0 64 64/2 0 32 32/2 0 16 16/2 0 8 8/2 0 4 4/2 0 2 2/2 0 1 1 Remove 1 last cell Conversion of Decimal Fractions to Binary There are various methods to convert a decimal fraction to the binary. One of them is based on multiplication of decimal fraction by 2. As an example consider conversion of 0.125: Number 2xNumber Integer Part 0.125 0.250 0 0.250 0.5 0 0.5 1 1 Result 0.001 Sometimes decimal fractions produce infinite binary fraction. Example: Convert decimal fraction 0.1 to binary: 2xNumber 0.1x2 0.2x2 0.4x2 0.8x2 0.6x2 0.2x2 0.4x2 0.8x2 0.6x2 Integer part 0 0 0 1 1 0 0 1 1 Then 0.1=0.000110011... Conversion of Binary Fractions to the Decimal A binary fraction of a number can be converted to a decimal number using powers of (-2). For example Boolean Algebra

Logic circuits are basis of the classical computer system. To appreciate operation of the computer system you have to understand digital logic and Boolean algebra. Boolean Algebra is both a formalization of the algebraic aspects of logic. A Boolean variable can take two values 1(or T or ON) or 0 (F or OFF). Basic Boolean operations are AND, OR and NOT. We can make more complicated functions from the basic Boolean operations. AND operation is function of two variable (A, B). Boolean function representation F(A,B)=A.B. Table shows result of the AND operation. Truth Table AND Gate A B F 1 1 1 1 0 0 0 1 0 0 0 0 OR operation is function of two variable (A,B). Boolean function representation F(A,B)=A+B Truth Table OR Gate A B F 1 1 1 1 0 1 0 1 1 0 0 0 NOT operation replace a Boolean function with its compliment F(A)=A'. Complement 1=1'=0, Complement 0=0'=1. A' is read as NOT A ot Compliment A. Truth Table NOT Gate or inverter A F 1 0 0 0 Basic theorems: Boolean operations have the following properties:

Algebra X+0=X X+1=1 X+X=X (X')'=X X+X'=1 Dual of the operation X*0=0 X*1=1 X*X=X (X')'=X X*X'=0 Dual of a Boolean expression can be obtained by replacing ANDs with ORs, ORs with ANDs, 1s with 0s, 0s with 1s. Theorems of the Boolean operations: Commutative X+Y=Y+X Associative (X+Y)+Z=X+(Y+Z) Distributive A(B+C)=AB+AC DeMorgan's Law (X+Y)'=X'Y' Dual Laws X*Y=Y*X (X*Y)*Z=X*(Y*Z) A+BC=(A+B)(A+C) (XY)'=X'+Y' Dual of Distributive law only valid for Boolean Algebra! Circuit Model of Computation As we mentioned before we can construct more complicated Boolean functions from the basic Boolean functions. The followings include some examples. Three input AND function Example: Factorize the Boolean expression A+B'CD, then implement the circuit. A+B'CD=(A+B')(A+CD) =(A+B')(A+C)(A+D) Its logic gate is:

We can construct the NAND and NOR gates from the combinations of the basic gates. A NAD gate can be thought as AND gate followed by and inverter and NOR gate can be thought as OR gate followed by an inverter. The last gate type is XOR gate. Its function is: Algorithm An algorithm is defined as a specific set of instructions for solving a problem. The word "algorithm" is a distortion of al-khwārizmī, a Persian mathematician who wrote an influential treatise about algebraic methods. The process of applying an algorithm to an input to obtain an output is called a computation. Some examples Everyday algorithm An algorithm is a step by step representation of a program. An algorithm can be presented for solving a mathematical problem by using a computer as well as to plan our daily life. In order to make an algorithm our plan include INPUT PROCESS ASSUMPTIONS (if any) OUTPUT Example: Calling a friend on phone

Pick up the phone Code friend s number (INPUT) Press Call buton (PROCESS) If busy hang up phone then call again after 5 min. (ASSUMPTION) If no answering, then hang up and aster 2 hour call again (ASSUMPTION) Talk to friend (OUTPUT) Example: Find the greatest common divisor (GCD) of two integers, m and n. Euclid's Algorithm: while m is greater than zero: If n is greater than m, swap m and n. Subtract n from m. n is the GCD Let us apply this algorithm for the numbers m=6 and n=21 m>0. n>m then m=21, n=6 21-6=15 15-6=9 9-6=3 Then m=6; n=3 6-3=3 3-3=0 therefore n=3 is GCD HW. Write an algorithm to Determine prime numbers. How many prime numbers between 1 and 3000. For more algorithm visit: http://www.csse.monash.edu.au/~lloyd/tildealgds/ For factoring algorithms read the notes: http://www.connellybarnes.com/documents/factoring.pdf We will compare factoring algorithms have been presented quantum computers and classical computers. Models of computation In this section we treat concept of computation and algorithm. Mechanical machines compute some output from some input. Everyday we use our computer to solve some typical problems. For example, given a list of numbers {8,12,98,1,52}, sort them in a order from smallest number to bigger... The output becomes {1,8,12,52,98}. Below some models of the computation are briefly summarized. At the beginning of this chapter we have discussed Turing Machine. Note that all computations that could ever be carried out on any other mathematical machine-models can also be carried out by Turing machines We also discussed Boolean (logical) circuits provide a model of computation that is not equivalent with the Turing machine. We have introduce some models of the computation which

a) Random Access Machines b) Straight Line Programs and Circuits (Boolean logical circuits) c) Turing Machines d) Decision Trees e) Machines That Make Random Choices P and NP Problems (Polynomial and Non-Deterministic Polynomial problems) When you run a program one of the important question is: How long does it take to execute the program. Suppose that you have a set of number. In order to sort the numbers you can write an algorithm. The executing time probably will be proportional to N 2 or Nlog(N) or similar expressions. If the executing time proportional to N, N 2 or any power of N then the problem is called Polynomial (P) problem. For a given problem if the executing time proportional to the Nth power of a number i.e e N, or x N then the problem is known as NP (Non-Deterministic Polynomial problems). Note that A Major application is in the cryptography area, Sipser says, where the security of cryptographic codes is often ensured by the complexity of a computational task. Example. Factorization of a number as product of the prime numbers is the problem between P and NP. Solution: You can write a simple division algorithm. Example. A traveling salesman has to travel a bunch of cities, in a such way that using the shrtest distance. This problem is between NP and NP hard. Solution: We have to calculate all alternative paths to find shortest distance. Table shows number of operations. The average time to determine shortest optimum path, with a computer operating 1 000 000 per second can be calculated as: #path/1000000. #cities Alternatives #path Timing 2 (12) 1(2-1)! 1 microsec 3 (123)(132) 2 (3-1)! 0.5 microsec 4 (1234) (1342) (1423) (1324) (1243) (1432) 6 (4-1)! 6 microsec 5... 24 (5-1)! 24 microsec 6... 120 (6-1)! 0.12 msec 10... 362880 (10-1)! 0.36 sec 15... 87178291200 (15-1)! 1 year 20... 121645100408832000 Motivations and ideas underlying quantum computation Please read the articles given in the pages

http://michaelnielsen.org/blog/quantum-computing-for-everyone/ http://gizmodo.com/5335901/giz-explains-why-quantum-computing-is-the-future-but-a-distant-one