Type Checking in COOL (II)
Lecture 10
Prof. Aiken CS 143 Lecture 10
1
Lecture Outline
Type systems and their expressiveness
Type checking with SELF_TYPE in COOL
Error recovery in semantic analysis
Prof. Aiken CS 143 Lecture 10
2
Expressiveness of Stati
2/11/2013
CS 154
Self-Reference,
Computability,
and Logic
Wednesday (2/13)
Midterm in class
Well allow one double-sided page of notes
Midterm will cover everything up to and including last
Wednesdays lecture
If you are an SCPD student, contact SCPD for de
2/6/2013
CS 154
Rices Theorem,
the Recursion Theorem,
and the Fixed-Point Theorem
Next Wednesday (2/13)
Midterm in class
Today: instead of a new homework,
youll get a practice midterm
Midterm will cover everything up to this lecture
You are allowed one do
2/5/2013
CS 154
Reductions, Undecidability,
and the Post Correspondence
Problem
A Concrete Undecidable Problem
ATM = cfw_ (M, w) | M is a TM that accepts string w
Theorem: ATM is recognizable but NOT decidable
Corollary: ATM is not recognizable
Corollary
Pick up homeworks
At the entrance of Gates 4th floor B Wing
1
Definition: A Turing Machine is a 7-tuple
T = (Q, , , , q0, qaccept, qreject), where:
Q is a finite set of states
is the input alphabet, where
is the tape alphabet, where
and
: Q Q cfw_L,
CS 154
A Universal Theory of Data
Compression:
Kolmogorov Complexity
KOLMOGOROV DIRECTIONS
1
No homework
coming out today!
The Church-Turing Thesis:
Everyones
Intuitive Notion = Turing Machines
of Algorithms
This is not a theorem
it is a falsifiable scie
CS 154
Time Complexity,
P and NP
Complexity Theory
What can and cant be computed with limited
resources on computation,
such as time, space, and so on
Captures many of the significant issues in
practical problem solving
The field is rich with important op
CS 154
NP-Completeness
Cook-Levin Theorem:
Every A in NP has a polynomial time reduction to 3SAT
For every A in NP, A is decided by some
nondeterministic nk time Turing machine N
We gave a generic way to reduce (N, w) to a 3CNF
formula of O(|w|2k) clauses
3/6/2013
CS 154
coNP and Friends
Definition: coNP = cfw_ L | L NP
What does a coNP computation look like?
A co-nondeterministic machine
has multiple computation paths,
and has the following behavior:
- the machine accepts
if all paths reach accept state
CS 154
NP-Completeness
and the Cook-Levin Theorem
Computer scientist wins Canada's top science prize
Stephen Cook wins $1M Gerhard Herzberg Medal
1
New homework out today
Where to pick up midterms?
P = TIME(nk)
kN
2
NP =
NNTIME(nk)
k
Theorem: L NP There i
Definitions
Program analysis
Discovering facts about programs.
Introduction to Static Analysis
Dynamic analysis
Program analysis using program executions.
CS295
Lecture 10
Static analysis
Program analysis without running the program.
Prof. Aiken CS295
The Question
Most software is buggy
Some of it is extremely buggy
Type Qualifiers
But tools dont find most bugs
CS295
Lecture 13
Prof. Aiken CS295 Lecture 13
Why?
Prof. Aiken CS295 Lecture 13
1
The Answer
Redundancy
Because tools dont check correctne
CSci 243 Lab
Weilin Wang
September 1, 2012
1
Table Environment:
PROBLEM. Give the truth table for F (p q ) p.
SOLUTION:
p
T
T
F
F
2
Table
q
T
F
T
F
1: Truth table
p p q F
F
T
T
F
F
F
T
T
F
T
T
F
Array Environment:
1. We can have display math array:
123
45
5/23/2011
Recall
We looked at dynamic race detection
Static Race Detection
Lecture 17
CS 295
Prof. Aiken
CS 295
Now well look at static race detection
Historically much less popular
Probably because static tools havent worked as well
Why? A much hard
8 Turing Machines
The question of what computers can do/solve, or equivalently, what languages can be dened/recognized by any
computational device whatsoever.
8.1 Problems that computers cannot solve
Two types of problems: Solve this and decide this.
De
Saturn
Lecture 4
CS357
Profs. Aiken, Barrett & Dill CS357 Lecture 4
1
Goals
Scale to the largest programs
Be precise
path-sensitive & context-sensitive
model most operations exactly
Back in 2004, this hadnt been done.
Profs. Aiken, Barrett & Dill CS3
Outline
Runtime monitoring of code
Runtime Monitoring
Three examples:
Purify
Detecting data races
Detecting memory leaks
Lecture 4
CS295
Prof. Aiken CS 295 Lecture 4
Prof. Aiken CS 295 Lecture 4
1
2
The Problem
C/C+ are not type safe
Neither the co
Top-Down Parsing
and
Intro to Bottom-Up Parsing
Lecture 7
Prof. Aiken CS 143 Lecture 7
1
Predictive Parsers
Like recursive-descent but parser can
predict which production to use
By looking at the next few tokens
No backtracking
Predictive parsers acce
Overview of Semantic Analysis
Lecture 9
Prof. Aiken CS 143 Lecture 9
1
Midterm Thursday
In class
SCPD students come to campus for the exam
Material through lecture 8
Open note
Laptops OK, but no internet or computation
Prof. Aiken CS 143 Lecture 9
2
Run-time Environments
Lecture 11
Profs. Aiken CS 143 Lecture 11
1
Status
We have covered the front-end phases
Lexical analysis
Parsing
Semantic analysis
Next are the back-end phases
Optimization
Code generation
Well do code generation first . . .
CS 154
PSPACE
VOTE VOTE VOTE
On piazza, for your favorite
number of cheat sheets
Poll closes on Tuesday
1
Its a close race
VOTE VOTE VOTE
For your favorite course on
automata and complexity
Please complete the online course
evaluation
2
MEASURING SPACE CO