Mihir Bellare, UCSD CSE 200: Computability and Complexity 1
Notation Boring! Mihir Bellare, UCSD 1 CSE 200: Computability and - - PowerPoint PPT Presentation
Notation Boring! Mihir Bellare, UCSD 1 CSE 200: Computability and - - PowerPoint PPT Presentation
Notation Boring! Mihir Bellare, UCSD 1 CSE 200: Computability and Complexity Notation Boring! Mathematical Language And Communication what it is and why it matters Interesting? Maybe? Mihir Bellare, UCSD 2 CSE 200: Computability and
Mihir Bellare, UCSD CSE 200: Computability and Complexity 2
Notation
Boring!
Mathematical Language And Communication
what it is and why it matters
Interesting? Maybe?
Mihir Bellare, UCSD CSE 200: Computability and Complexity 3
Mathematics is a LANGUAGE
- r a natural language
Like a programming language Mathematics has its syntax, grammar and semantics.
Learn to write grammatically-correct mathematics. Otherwise it is not meaningful. And you lose points. Writing and speaking grammatically-correct mathematics helps you get things right and sort
- ut your thoughts.
Mihir Bellare, UCSD CSE 200: Computability and Complexity 4
Mathematical objects have types
String Integer Set Function Algorithm
red ? have dog the {a,b} + 7
Makes as little sense as
Code is type-checked by a compiler Mathematical writing is type-checked by a grader
Type error found in code: no executable generated Type error found in writing: no points generated
Good mathematical grammar wins credit!
Mihir Bellare, UCSD CSE 200: Computability and Complexity 5
You are graded based on what you write and say, not on what you think you meant.
You are what you communicate Unproductive attitude
Mihir Bellare, UCSD CSE 200: Computability and Complexity 6
Notation is the lowest level building block of our mathematical language. It pays to get notation right. It makes thinking and writing easier. You can struggle to say in words what is easily and more precisely done in notation. Notations are like pawns in chess. It is said that the pawn is a piece neglected by the beginner but prized by the expert.
Mihir Bellare, UCSD CSE 200: Computability and Complexity 7
N = {1, 2, 3, . . .} Z = {. . . , −2, −1, 0, 1, 2, . . .} Zn = {0, 1, . . . , n − 1} for n ∈ N
Examples Basic notation and terminology
An alphabet is a finite, non-empty set. Its elements are called symbols. is the English alphabet
Σ = {A, B, …, Y, Z}
ASCII is an alphabet of byte-codes Let be an alphabet. A string over is a finite sequence of symbols from Then is the set of all strings over If is a string, then denotes its length, defined as the number of symbols in By we denote the empty string, which has length 0 It is always a member of
Σ Σ Σ Σ* Σ x ∈ Σ* |x| x ε Σ*
TURING is a string over the English alphabet It has length 6 010 is a string over the binary alphabet It has length 3 If is an integer then
n ≥ 0 [n] = {1,…, n} [3] = {1,2,3}
is the set of all binary strings
{0,1}* {0,1}* = {ε,0,1,00,01,10,11,000,…}
If is a finite set then denotes is size (cardinality)
S |S|
denotes the empty set, which has size 0
∅ |{a,0,4}| = 3
is the binary alphabet
Σ = {0,1}
Mihir Bellare, UCSD CSE 200: Computability and Complexity 8
Examples
is the language
- f binary representations of the even positive integers
L = { x ∈ {0,1}* : MSB(x) = 1 and LSB(x) = 0 }
Let be an alphabet. A language over is a subset of That is: is a language over if
Σ Σ Σ* L Σ* L ⊆ Σ*
is the language of the Reachability Problem.
L = { ⟨G⟩ : G = ([n], E) is a graph over vertex set [n] with a path from 1 to n}
is the language of the Halting Problem.
L = { ⟨M, x⟩ : M is a TM that halts on input x}
Above, denotes an encoding of Stuff as a string over an appropriate alphabet. The way the encoding is done can be context dependent.
⟨Stuff⟩
Input: Question: Is ?
x x ∈ L
Decision problem associated to language :
L
Languages are how we formalize decision problems. We will classify languages according to the solvability of the associated decision problem. A complexity class is a set of languages The set of all valid C-programs is a language over the ASCII alphabet A language can be finite or infinite By we denote the complement of language
L = Σ*∖L = Σ* − L L
If is the language of the first example above, then
L L = { x ∈ {0,1}* : MSB(x) = 0 or LSB(x) = 1 or x = ε }
Mihir Bellare, UCSD CSE200: Computability and Complexity
9
type: function type: set
f(x) = (x + 1) mod 3 y ← (x + 1) mod 3 Return y f(x1, x2) = (x1 + x2) mod 3 y ← (x1 + x2) mod 3 Return y 1 2 1 2 1 1 2 2 2 1 f : D1×· · ·×Dn → R represents an n-argument function. It can be specified by a formula, code, a table, ... Example: Let f : {1, 2, 4} → {0, 1, 2} be the 1-argument function defined by 1 1 2 4 2 Example: Let f : {0, 1, 2}×{0, 1, 2} → {0, 1, 2} be the 2-argument function defined by
Functions
If is a function and then
f : X → Y A ⊆ X f(A) = { f(a) : a ∈ A }
Mihir Bellare, UCSD CSE 200: Computability and Complexity
Expression Does the expression type check? Equivalently, does it make sense?
NO YES NO NO YES YES NO YES
10
Let be an alphabet. Let Let Let be a function
Σ x ∈ Σ* A, B ⊆ Σ* f : Σ* → Σ* x ⊆ A x ∉ A {x} ∈ A {x} ⊆ A A ∈ B A ⊆ B f(x) ⊆ A f(A) ⊆ A
We are not asking whether the expression is true or false. We are asking if it makes grammatical sense. The answer has to be YES before we can even consider whether it is true or false.
Mihir Bellare, UCSD CSE 200: Computability and Complexity 11