CPSC 121: Models of Computation Instructor: Bob Woodham - - PowerPoint PPT Presentation

cpsc 121 models of computation
SMART_READER_LITE
LIVE PREVIEW

CPSC 121: Models of Computation Instructor: Bob Woodham - - PowerPoint PPT Presentation

CPSC 121: Models of Computation Instructor: Bob Woodham woodham@cs.ubc.ca Department of Computer Science University of British Columbia Lecture Notes 2009/2010, Section 203 CPSC 121: Models of Computation Menu April 14, 2010 Topics: Final


slide-1
SLIDE 1

CPSC 121: Models of Computation

Instructor: Bob Woodham woodham@cs.ubc.ca

Department of Computer Science University of British Columbia

Lecture Notes 2009/2010, Section 203

CPSC 121: Models of Computation

slide-2
SLIDE 2

Menu April 14, 2010

Topics: Final Reading List Learning Goals Summary What Next? The End! Reminders: READ the WebCT Vista course announcements board — pickup of marked Assignments 3 and 4 — extended office hours — pre-final exam review session(s) On-line teaching evaluation (until 11:00pm April 17) Final exam Thursday, Apr 29, noon, OSBO A www: http://www.ugrad.cs.ubc.ca/~cs121/ WebCT Vista: http://www.vista.ubc.ca

CPSC 121: Models of Computation

slide-3
SLIDE 3

Final Exam Coverage

1

Section 203 Lectures 1–35 — cumulative [slides] and [with notes] versions provided — supplementary handouts (see Section 203 Handouts)

2

Epp: Chapter 1 Chapter 2 Sections 3.1, 3.6, and 3.7 plus Theorem 3.4.1 and pages 159–163 Section 4.1 (purely as background reading) Sections 4.2–4.4 Sections 5.1–5.3 Section 7.1 and Section 7.2 (excluding “Application: Hash Functions” and “Properties of Exponential and Logarithmic Functions”) Section 12.1–12.2

3

Labs 0–10

CPSC 121: Models of Computation

slide-4
SLIDE 4

Learning Goals

1

Evaluate the truth of simple propositional logic statements using truth tables

2

Translate back and forth between simple natural language statements and propositional logic

3

Translate back and forth between propositional logic statements and combinational circuits built using standard logic gates (NOT, AND, OR, XOR, NAND, NOR)

4

Design combinational circuits based on propositional logic expressions and their equivalent logic circuits to solve real problems (e.g., a 7 segment LED numerical display)

5

Evaluate propositional logic as a model of computation for combinational circuits, identifying at least one explicit shortfall (e.g., timing based on gate delays, fan-out, wire length, instabilities, shared sub-circuits, etc.)

CPSC 121: Models of Computation

slide-5
SLIDE 5

Learning Goals (cont’d)

6

Translate back and forth between simple natural language statements and propositional logic, including conditionals and biconditionals

7

Evaluate the truth of simple propositional logic statements using truth tables, including conditionals and biconditionals

8

Given a propositional logic statement and a logical equivalence rule, apply the rule to create the equivalent statement

9

Transform propositional logic statements by application of logical equivalence rules in order to: — simplify complex statements — prove the logical equivalence of two statements — represent statements in a standard canonical form

CPSC 121: Models of Computation

slide-6
SLIDE 6

Learning Goals (cont’d)

10 Convert integers from octal or hexadecimal to binary and

back

11 Convert positive integers from decimal to binary

— by “repeated division” (octal/hex as intermediary)

12 Convert positive integers from binary to decimal 13 Take the 2’s complement of a fixed width binary number 14 Convert signed (either positive or negative) integers to

binary and back

15 Add and subtract fixed width, 2’s complement (signed)

binary integers

16 Convert decimal fractions (in positional notation) to binary

fractions (in positional notation) — by “repeated multiplication” (octal/hex as intermediary)

CPSC 121: Models of Computation

slide-7
SLIDE 7

Learning Goals (cont’d)

17 Critique different number representations describing their

strengths and weaknesses (finite representation, overflow, etc.). Representations include: positional notation (binary,

  • ctal, decimal, hexadecimal); binary coded decimal (BCD);

fixed-width, 2’s complement (signed) binary; IEEE 754 floating point (single and double precision)

18 Use truth tables to establish or refute the validity of a

proposed rule of inference

19 Given a rule of inference and propositional logic statements

that correspond to the rule’s premises, apply the rule to infer a new statement implied by the original statements

20 Explore the logical consequences of a set of propositional

statements by application of both equivalence and inference rules, especially in order to transform statements into a desired canonical form

CPSC 121: Models of Computation

slide-8
SLIDE 8

Learning Goals

1

Understand the definition of a predicate and its associated domain of discourse

2

Evaluate the truth of predicates applied to particular values

3

Understand what it means for a predicate to be universally quantified or existentially quantified

4

Show predicate logic statements are true by enumerating examples (i.e., all examples in the domain of discourse for a universally quantified statement or at least one example for an existentially quantified statement)

5

Show predicate logic statements are false by enumerating counterexamples (i.e., one counterexample for a universally quantified statement or all for an existentially quantified statement)

CPSC 121: Models of Computation

slide-9
SLIDE 9

Learning Goals (cont’d)

6

Translate between statements in formal predicate logic notation and equivalent statements in closely matching informal language (i.e., informal statements with clear and explicitly stated quantifiers)

7

Construct predicate logic statements to capture the relationships between properties of various objects both real-world like and computing related

8

Determine the negation of any quantified statement, including multiply quantified statements, using generalized De Morgan

9

Given a quantified statement and a logical equivalence rule, apply the rule to create an equivalent statement

CPSC 121: Models of Computation

slide-10
SLIDE 10

Learning Goals (cont’d)

10 Apply additional rules of inference for quantified

statements including universal instantiation, universal generalizarion, existential instantiation, existential generalization, universal modus ponens, universal modus tollens, and universal transitivity

11 Prove (or disprove) conjectures involving quantified

statements using basic proof techniques, both direct and indirect, including proof by contradiction and proof by contrapositive

CPSC 121: Models of Computation

slide-11
SLIDE 11

Learning Goals

1

Understand the following basic proof strategies: constructive/nonconstructive proofs of existence (“witness”) disproof by counterexample exhaustive proof generalizing from the generic particular (“WLOG”) direct proof (“antecedent assumption”) proof by contradiction proof by contrapositive proof by cases well enough to identify the strategy when it is encountered in a given proof and well enough to apply it as a strategy in a novel proof

CPSC 121: Models of Computation

slide-12
SLIDE 12

Learning Goals (cont’d)

2

Devise and attempt multiple different, appropriate proof strategies for a given theorem – including all those listed above – that use definitions, premises, logical equivalences, rules of inference and rules of inference for quantified variables

3

Prove theorems requiring only simple insights beyond choice of proof strategy or for which the necessary insight is given as a hint/suggestion

CPSC 121: Models of Computation

slide-13
SLIDE 13

Learning Goals

1

Recognize mathematical induction as a proof technique for statements universally quantified over the positive integers, Z+

2

Given a theorem to prove expressed in terms of a variable, n, universally quantified over Z+, write out the template for an inductive proof including: the induction hypothesis, the base case(s) that need to be proved„ and the inductive step that needs to be proved

3

Complete all the steps of a formal proof by induction using either regular (weak) or strong induction, as needed

4

Critique formal inductive proofs to determine whether they are valid or where the error(s) lie if they are invalid

CPSC 121: Models of Computation

slide-14
SLIDE 14

Learning Goals

1

Specify a DFA formally as a 5-tuple defined using set and function notation

2

Define regular expressions and their associated regular language

3

Identify the regular language recognized by a particular DFA

4

Build a DFA to recognize a particular regular language

5

Connect the graphical (state transition diagram) and formal (5-tuple) representations of DFAs and illustrate how each part works

CPSC 121: Models of Computation

slide-15
SLIDE 15

Learning Goals

1

To design and analyze simple sequential circuits: circuits that perform sequences of steps and remember information from previous steps

2

To define a Deterministic Finite State Automaton (DFA) (aka a finite state machine (FSM)) both in terms of a state transition diagram and a state transition table

3

To implement any specific DFA (of modest complexity) as a sequential circuit

4

To specify the overall architecture of a (Von Neumann) stored program computer – an architecture that instantiates the principle that both program and data are bits (i.e., state) loaded and stored in (common) memory

5

To interpret the (Von Neumann) stored program computer as a “universal” FSM (i.e., as a FSM that can implement any other FSM via changes to the program and data)

CPSC 121: Models of Computation

slide-16
SLIDE 16

Learning Goals (cont’d)

6

To analyze the (TKGate simulated) operation of a specific simple computer design. This includes understanding the basic fetch-decode-execute instruction cycle and the data flow to/from the arithmetic logic unit (ALU), the main memory, the Instruction Register (IR) and the Program Counter (PC) under control of the microController

7

To run a provided program on the (TKGate simulated) simple computer. To test the behaviour of the program by monitoring values displayed in key registers during program execution. To modify the provided program to achieve other specified functionality

CPSC 121: Models of Computation

slide-17
SLIDE 17

Learning Goals (cont’d)

8

To complete CPSC 121’s “bottom up” treatment of circuits: switch→logic gate→combinational circuit →sequential circuit →FSM→ simple computer demonstrating that:

1

We can specify each one of these stages completely, both formally (i.e., as theory) and practically (i.e., as a constructive implementation)

2

There are no significant gaps between stages (i.e., we can build each successive stage using elements from the previous stage)

CPSC 121: Models of Computation

slide-18
SLIDE 18

Learning Goals

1

Define basic set operations: union, intersection, complement, and set difference

2

Define logical operations on sets: subset, proper subset and set equality (in terms of predicate logic and set membership, e.g., x ∈ X)

3

Translate between sets represented explicitly, possibly using ellipses “. . . ”, e.g., {4, 6, 8, . . . }, and using “set builder” notation, e.g., {x ∈ Z+ | x2 > 10 ∧ x is even}

4

Compute union, intersection, complement, set difference, subset and set equality operations on sets expressed explicitly, expressed using set builder notation, or expressed as a combination of these and set operations

5

Interpret the empty set (symbol { } or ∅), including the fact that the empty set has no members and that it is a subset

  • f any set

CPSC 121: Models of Computation

slide-19
SLIDE 19

Learning Goals (cont’d)

6

Define an n-tuple

7

Define the power set and Cartesian product operations on sets in terms of predicate logic and set membership/subset relations

8

Compute the power set, Cartesian product, and cardinality

  • perations on sets expressed in any of the set notations

considered

9

Apply proof techniques learned earlier to proofs involving sets

CPSC 121: Models of Computation

slide-20
SLIDE 20

Learning Goals

1

Define the terms domain, codomain, range, image, and pre-image

2

Use appropriate function syntax to relate these terms, e.g., f : A → B indicates that f is a function mapping domain A to codomain B

3

Determine whether f : A → B is a function given a definition of f as an equation or as a bipartite graph (i.e., arrow diagram)

4

Define the terms injective (one-to-one), surjective (onto), bijective (one-to-one correspondence) and inverse

5

Determine whether a given function is injective, surjective, and/or bijective

6

Apply proof techniques learned earlier to proofs about the properties (e.g., injectiveness, surjectiveness, bijectiveness, and function-ness) of functions and their inverses

CPSC 121: Models of Computation

slide-21
SLIDE 21

What Next?

CPSC 210 Software Construction (replaces CPSC 211) CPSC 211 Introduction to Software Development CPSC 213 Introduction to Computer Systems CPSC 221 Basic Algorithms and Data Structures

CPSC 121: Models of Computation

slide-22
SLIDE 22

Think Big!

I have encouraged you to “think big”: Be curious Be academically adventurous (explore new ideas/topics/areas) Be tolerant/resilient to failure (but learn from your mistakes and the mistakes of others) develop your discernment (i.e., noticing) skills

CPSC 121: Models of Computation

slide-23
SLIDE 23

Four “Big Ideas” of Computer Science

Big Idea #1: Finite State Machines (FSMs) Big Idea #2: Turing Machines Big Idea #3: Computability Big Idea #4: Universality

CPSC 121: Models of Computation

slide-24
SLIDE 24

Models of Computation: Summary

Formal models (computability, Turing Machines, Universality) provide the basis for modern computer science: Fundamental limits (on what can not be done, even given plenty of memory and time) Fundamental equivalence of computation models Representation of algorithms as data, rather than as machinery Programs, Software, Interpreters, Compilers, ... There remain many practical issues to deal with: Cost: memory size, time performance, power consumption Programmability

CPSC 121: Models of Computation

slide-25
SLIDE 25

Final Words!

You have learned a lot! Be proud of what you have, and can, accomplish I had fun (and I hope most of you did too)! Feedback always is very welcome. I particularly like to hear from students 3–5 years down the road (after graduation) Special thanks to: My (few) after class, email and office hour “regulars”

CPSC 121: Models of Computation