Lecture 1: A Formal Model of Computation 虞台文 大同大學資工所 智慧型多媒體研究室.

Slides:



Advertisements
Similar presentations
1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
Advertisements

Primitive Recursive Functions (Chapter 3)
Control Structures Any mechanism that departs from straight-line execution: –Selection: if-statements –Multiway-selection: case statements –Unbounded iteration:
Give qualifications of instructors: DAP
Bayesian Networks Bucket Elimination Algorithm 主講人:虞台文 大同大學資工所 智慧型多媒體研究室.
October 13, 2009Theory of Computation Lecture 11: A Universal Program III 1 Coding Programs by Numbers Gödel numbers are usually very large, even for small.
زبانهای برنامه سازی برنامه سازی پیشرفته ارائه دهنده دکتر سيد امين حسيني E.mail: Home page:
Hidden Markov Model 主講人:虞台文 大同大學資工所 智慧型多媒體研究室. Contents Introduction – Markov Chain – Hidden Markov Model (HMM) Formal Definition of HMM & Problems Estimate.
Testing in the Small (aka Unit Testing, Class Testing)
Decision Tree Learning 主講人:虞台文 大同大學資工所 智慧型多媒體研究室.
Optimization Problems 虞台文 大同大學資工所 智慧型多媒體研究室. Content Introduction Definitions Local and Global Optima Convex Sets and Functions Convex Programming Problems.
ISBN Chapter 3 Describing Syntax and Semantics.
Dynamic semantics Precisely specify the meanings of programs. Why? –programmers need to understand the meanings of programs they read –programmers need.
主講人:虞台文 大同大學資工所 智慧型多媒體研究室
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Computability (Chapter 2) ICS 535 Design and Implementation.
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
September 17, 2009Theory of Computation Lecture 4: Programs and Computable Functions III 1 Macros Now we want to use macros of the form: W  f(V 1, …,
Describing Syntax and Semantics
Chapter 4: A Universal Program 1. Coding programs Example : For our programs P we have variables that are arranged in a certain order: Y 1 X 1 Z 1 X 2.
Algorithms: Selected Exercises Goals Introduce the concept & basic properties of an algorithm.
CSC141 Introduction to Computer Programming
Introduction For some compiler, the intermediate code is a pseudo code of a virtual machine. Interpreter of the virtual machine is invoked to execute the.
Lecture 4. RAM Model, Space and Time Complexity
Program Correctness. 2 Program Verification An object is a finite state machine: –Its attribute values are its state. –Its methods optionally: Transition.
Flowcharts.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15.
The Simplex Algorithm 虞台文 大同大學資工所 智慧型多媒體研究室. Content Basic Feasible Solutions The Geometry of Linear Programs Moving From Bfs to Bfs Organization of a.
Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 Service Behavior Consistency in the OSGi Platform Authors Y.Qin, H.Hao,L.Jun, G.Jidong and L.Jian Proceedings.
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.
Reinforcement Learning Eligibility Traces 主講人:虞台文 大同大學資工所 智慧型多媒體研究室.
Reinforcement Learning 主講人:虞台文 大同大學資工所 智慧型多媒體研究室.
國立台灣大學 資訊工程學系 薛智文 98 Spring Run Time Environments (textbook ch# 7.1–7.3 )
The Simplex Algorithm 虞台文 大同大學資工所 智慧型多媒體研究室. Content Basic Feasible Solutions The Geometry of Linear Programs Moving From Bfs to Bfs Organization of a.
Lecture 3: Count Programs, While Programs and Recursively Defined Functions 虞台文 大同大學資工所 智慧型多媒體研究室.
Lecture 5: Finite Automata 虞台文 大同大學資工所 智慧型多媒體研究室.
Hopfield Neural Networks for Optimization 虞台文 大同大學資工所 智慧型多媒體研究室.
1 Overview of Programming Principles of Computers.
Lecture 2: Limiting Models of Instruction Obeying Machine 虞台文 大同大學資工所 智慧型多媒體研究室.
Linear Programming 虞台文.
Introduction to Computer Programming using Fortran 77.
EM Algorithm 主講人:虞台文 大同大學資工所 智慧型多媒體研究室. Contents Introduction Example  Missing Data Example  Mixed Attributes Example  Mixture Main Body Mixture Model.
Lecture 6: Context-Free Languages
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
Lecture 14: Theory of Automata:2014 Finite Automata with Output.
2008/09/22: Lecture 6 CMSC 104, Section 0101 John Y. Park
Theory of Computation Lecture 12: A Universal Program III
Lecture 2 Introduction to Programming
Introduction to Computer Programming
Algorithm and Ambiguity
Assembler, Compiler, Interpreter
Copyright © Cengage Learning. All rights reserved.
Theory Of Computer Science
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Algorithm and Ambiguity
Assembler, Compiler, Interpreter
Hopfield Neural Networks for Optimization
Lecture 5: Turning Machine
Lecture 4: Unsolvable Problems
Theory of Computation Lecture 12: A Universal Program IV
Theory of Computation Lecture 11: A Universal Program III
Theory of Computation Lecture 23: Turing Machines III
Simulated Annealing & Boltzmann Machines
Lecture 2: Limiting Models of Instruction Obeying Machine
Lecture 6: Computational Complexity
Presentation transcript:

Lecture 1: A Formal Model of Computation 虞台文 大同大學資工所 智慧型多媒體研究室

Content Formalizing the Idea of Programmable Computer. Program Defined Machine Defined Computation Defined A Simple Machine

Lecture 1: A Formal Model of Computation Formalizing the Idea of Programmable Computer 大同大學資工所 智慧型多媒體研究室

A Simple Programmable Device  PC PC  Pocket Calculator What is inside?

Inside PC Memory Set – Two registers with unbounded capacity Machine Instructions – Operations & tests e.g.,

Inside PC Memory Set – Two registers with unbounded capacity Machine Instructions – Operations & tests e.g., How about if n = 0 ? Undefined if n = 0.

Inside PC Memory Set – Two registers with unbounded capacity Machine Instructions – Operations & tests e.g., Partial Functions Partial Predicates

Partial Functions Let A and B be two sets, and is a set of ordered pairs. We say that f is a partial function if Hence, (a, b)  f is written as : If, a  A, there is no b  B such that f(a) = b, then we say that f(a) is undefined, and denote this condition as:

Partial Functions   is reserved to denote undefined object. f(  ) = . There Cases: 1.Totally undefined 2.Partially defined 3.Totally defined

Operations for PC Each operation of PC would be defined by some partial function over M. Example: define the division operation of PC as a partial function as follows:

Partial Predicates which does not change the information environment. Example:

Computable Functions By a computable function, we mean a function that can be algorithmically specified. When a algorithm is applied to an element outside its domain, it may – not terminated; or – the result  B. Whenever an algorithm is such that it computation does not always terminate, then the algorithm defines a computable partial function.

Exercises Define “algorithm”. Show that, where f, g, and h are partial functions.

Lecture 1: A Formal Model of Computation Program Defined 大同大學資工所 智慧型多媒體研究室

Programs vs. Flowcharts Essentially, we take programs to be flowcharts constituting the following components. START HALT Operation Predicate (Test)

Flowchart START HALT F0 P1 F1 F2 truefalse

Labeled Statements START HALT F0 P1 F1 F2 truefalse L0 L1 L2 L3 L4 START: GOTO L3 L0: DO F2 GOTO L4 L1: IF P1 THEN GOTO L0 ELSE GOTO L3 L2: DO F1 GOTO L1 L3: DO F0 GOTO L2 L4: HALT

Instructions Instructions are made up from: L : a set of labels; F : a set of operations; P : a set of predicates. START: GOTO L3 L0: DO F2 GOTO L3 L1: IF P1 THEN GOTO L0 ELSE GOTO L3 L2: DO F1 GOTO L1 L3: DO F0 GOTO L2 L4: HALT

Four Types of Instructions 1. Start Instruction 2. Operation Instruction 3. Test Instruction 4. Halt Instruction START: GOTO L L: DO F GOTO L’ L: IF P1 THEN GOTO L’ ELSE GOTO L’’ L: HALT  -Loop: L: DO F GOTO L

Program Schema A program schema  is a set of instructions that contains: Exactly one start instruction; No repeat on label.

Exercise while P1 do begin W1; while P2 do W2; end. p1 := P1; p2 := false; while p1 or p2 do begin if p2 then W2 else W1; p2 := P2; p1 := P1; end. Translate the above two Pascal Programs into labeled statements and prove their equivalence, using computation sequence in any convenient way.

Lecture 1: A Formal Model of Computation Machine Defined 大同大學資工所 智慧型多媒體研究室

Machines

M-Machine A machine is a function, say, M defined on the instruction set F  P for which there exists a memory set M such that M F is a partial function over M for each F  F M P is a partial predicate over M for each P  P.

M-Program An M -program or a program for M is a program in which no instruction, except perhaps  -loops, makes use an operation or test name that is interpreted as the totally undefined function by M. Without Syntax Error

Lecture 1: A Formal Model of Computation Computation Defined 大同大學資工所 智慧型多媒體研究室

Complete Computation A completed computation by a program  on a machine M is a finite computation sequence: Label ofstart instruction Label of a halt instruction

Complete Computation A completed computation by a program  on a machine M is a finite computation sequence: Case 1: Case 2: Without ambiguity at each step.

Uncompletable Computation The reasons for a computation being uncompletable: – Never reach halt instruction; – Instruction L i : DO F GOTO L’ causes – Instruction L i : IF P THEN GOTO L’ ELSE GOTO L’’ causes – Reaches a  -loop.

Partial Function The (partial) function Computed by a program  on a machine M is such that is a completed computation. what a computer does.

Lecture 1: A Formal Model of Computation A Simple Machine 大同大學資工所 智慧型多媒體研究室

Definition of Machine PC Memory set: Instruction set: Operations & Predicates N  N FP

Operations of PC other 

Predicates of PC other 

A PC-Program  START HALT true false L0 L1 L2 L3 L4

Computation Sequence  START HALT true false L0 L1 L2 L3 L4

PC  =?  START HALT true false L0 L1 L2 L3 L4

Encoding/Decoding Encoding Decoding by k k!k! e d

Encoding/Decoding k k!k! e d

Man-Machine Interaction M  a machine   an M -program  an encoding function  a decoding function e d input output

What Computed? e d input output A partial function