today
	Turing machines [[review]]
	time
	time hierarchy
admin
	ps1 out, due 02-05
	sign up for piazza
what is computation
	Q. can we schedule all of UIUC's courses without conflict?
	A.
		decision	[[is there a solution]]
		verification	[[verify a potential solution]]
		search		[[find a solution]]
		optimization	[[find best solution]]
		counting	[[how many solutions]]
		[[we'll mostly focus on decision/verification
			captures most of the complexity of computation]]
	defn: a *language* is a subset L\subseteq{0,1}^*
	Q. given x\in\bits, x\in L?
		[[need model of computational device]]
	Turing machines
		[[draw picture
			state machine
			single-tape TM		[[we'll mostly do single tape TM]]
			tape head
			]]
		A TM M is a tuple
			Q	state space
			\Gamma	tape alphabet
			\sigma	transition alphabet
				(current symbol,state)->(head movement,new symbol,new state)
			q_acc	accepting state
			q_rej	rejecting state
		A TM computes by
			tape initialized to input x
			head placed at start of tape
			iterate transition function until q_acc or q_rej reached
		the language L accepted by a TM M:
			M on x reaches q_acc	=> x\in L
			M on x reaches q_rej	=> x\notin L
			M on x loops		=> x\notin L
		more generally:
			M on x reaches q_done	=> outputs contents of tape
	defn: a TM M runs in time t(n) if for all x\in\bits^* of length n, M takes \le t(n) steps on x.
		[[worse case notion of complexity, robust theory]]
		      "      space s(n)                        "            M uses \le s(n) tape cells on x
		      		\-> makes sense for s(n)\ge n, will refine next week
	defn: f(n):N\to N. TIME(f(n))={languages L decided by a TM in O(f(n)) time}  [[use Big-Oh notation]]
			   SPACE(f(n))={                       "              space
	Prop. TIME(f(n))\subseteq SPACE(f(n))
		[[in time t can only write to t cells]]
	some philosophy:
		Church-Turing Thesis: anything "computable" is computable by a Turing machine
			\-> backed up by empirical evidence [[all reasonable tweaks to model don't change computability]]
		Efficient "         :           ^efficiently   ^efficiently
			\-> possibly inconsistent w/ quantum computing
	defn: P:= \union_k TIME(n^k)
		[[theoretical model of efficient computation]]
	Q. what languages are in P? [[I have no idea]]
	defn: EXP:= \union_k TIME(2^{O(n^k)})
	Prop: P\subseteq EXP
	Q. = ?
	thm: P\subsetneq EXP [[today]]
simulation
	hardware: a TM M
	software: a description of a TM M, written <M>
			\-> this class: assume some way of encoding objects into binary
	Meta Fact: hardware = software
	Thm: there is a fixed universal TM U that can simulate any other
		if M accepts/rejects x in time t and space s
		=> U accepts/rejects <M,x> in time O(c_M t s), space O(c_M s)
			c_M is a constant depending only on M
	pf: [[intuition is from how coding is all software]]
		[[draw <M,x> on tape]]
		key points: 
			U is *fixed*
			tape alphabet \Gamma of M may be arbitrarily large
			state space Q may be arbitrarily large
		simulating single step
			currently reading \gamma\in \Gamma => <\gamma*> on tape, takes \le c_M cells
								 *=current head location
			compare <\gamma> to possible transitions
				\-> must move head back to encoding of M 
				\-> c_M*s steps
			update encoding of current state of M
		t overall steps
		=> c_M*s*t time
			c_M * s space
	rmk: O_M(t^2) in general, can get O_M(t\log t) [[see book]]
		\-> suppressing constant wrt M
		acc/rej iff M acc/rej
time hierarchy theorem
	thm: for any "nice" function f(n) and g(n) with f(n)^2=o(g(n))
		TIME(f(n))\subsetneq TIME(g(n))
	Thm[Gap theorem]: exist "not nice" functions f(n) where TIME(f(n))=TIME(2^{f(n)}).
	defn: a function f(n) is time constructible (aka "nice") if the map 1^n\to <f(n)> 
		is monotonically increasing
		is computable in time O(f(n)) [[computing a function]]
									\-> in binary
	pf:	
		[[time-travel is impossible, grandfather paradox]]
		recall: undecidability of halting problem, via diagonalization
			[[draw table of M on x]]
		D="on input <M,z>:
			1) run TM M on <M> for \sqrt{g(|<M,z>|)} many steps of "real" time
			2) accept <M,z> iff M on <M> rejected
			"
		claim: L(D)\in TIME(g(n))
		Pf.	do universal machine w/ clock
			O(\sqrt{g}^2)=O(g(n))
			note: need time constructibility of g(n)
		claim: L(D)\notin \TIME(o(\sqrt{g(n)}))
		pf
			suppose not, D\in \TIME(f(n))
			simulating one step of D on <D,z> takes O(c_D f) steps of "real" time
			f=o(g) => |z| large enough that f(|<M,z>|)<<g(|<M,z>|)
				=> O(c_D f(|<M,z>|))<\sqrt{g(|<M,z>|)}
				=> D successfully simulates D on <D,z>
					and does opposite!
				=><=
	rmk: notice the "constant" c_D! [[ie, it isn't a constant]]
	Q. what is L(D)?
		[[is pretty unnatural]]
	defn: 	f time constructible
		BOUNDED-HALTING_f={<M,x>: universal TM accepts <M,x> in f(|x|) steps}
		[[reasonably natural problem]]
	thm: BOUNDED-HALTING \in TIME(f(n)^2) 
				\notin TIME(o(\sqrt{f(tn)}))
	pf
		[[time travel is impossible]]
		\in \TIME(f^2)
			use universal simulation, with clock
		\notin\TIME(\sqrt{f})
			diagonalization
space hierarchy
	Cor: P\subsetneq TIME(n^{O(\log n)}\subsetneq EXP
	Thm[Space Hierarchy]: for any space-constructible g(n), and f(n)=o(g(n)), SPACE(f(n))\subsetneq SPACE(g(n))
	Pf:
		do the same, use more efficient space simulation
admin
	ps1 out
	sign up for piazza
next time
	nondeterminism
	NP
	reductions
	NP-completeness
	NP-intermediate problems