Return Quiz 4, Quiz 3, two parts of HW8 Quiz4 Quiz3 HW8.1 HW8.2 Maximum 9.5 5 5 5 Median 6 4 5 4 Minimum 3.5 2.5 5 2 Comments: A few students have not turned in the parse trees for the 2 expressions. Discuss the solution for the interpreter. Discussion of Ken Thompson article. Stage I: The main() subroutine of the self-reproducing program prints out the preamble and then prints the string "s". The string s stores all the characters of the program source after a preamble. Stage II: Note that there is a difference between the source code of the C compiler and its binary. At some point they are the same. At this point, the binary does not recognize the '\t' character. So the compiler is written so that '\t' is translated to the ASCII 11. Now, the binary recognizes the '\t' character. So we can change the source code to return '\t', which makes the code portable. Stage III: We can tamper with the C compiler to compile particular programs differently, without leaving a trace in the compiler source code. Unsolvability of the halting problem ==================================== Halting Problem: Given a program P and input I, does the program P, when run on input I, halt? We will see that there is no program that can solve the halting problem. Suppose there is -- let us call the program H. The program H takes as input a program P and an input I for program P and, allegedly, returns "YES" if P halts on input I and "NO" otherwise. We write the output of H on P and I as H(P,I). Consider program H': J() = if H(J,null) = YES, then infinite loop, else return; Question: Does J() halt? If yes, then H(J,null) does not return YES, which implies that H is incorrect. If no, then either H(J,null) goes into an infinite loop or returns YES, which again implies that H is incorrect. Implications: Cannot provide a general-purpose program correctness method. Distributed Coordinated Attack Problem ====================================== Suppose we have two generals G1 and G2 belonging to Army A that are fighting a battle with Army B. G1 and G2 are in different locations and they can only communicate through messengers who may have to cross B territory and may get killed if so. G1 and G2 want to coordinate their attacks. If they do coordinate, then they will win. Otherwise, they will lose. Is it possible for them to guarantee victory? Importance in a distributed database system. Review of term ============== Introduction (Algorithms & Data Structures) -- Usefulness of different representations: o Summation o Anagram listing Graph algorithms (Algorithms) -- Graph traversals -- Web as a graph -- Searching through states of a game Information retrieval (Databases/AI) -- Google search engine -- Web as a graph Artificial intelligence (AI) -- Computer chess Recursion & induction (Discrete Structures/Algorithms) -- Fibonacci numbers Efficiency of programs/algorithms (Algorithms) -- Comparisons -- Importance of input size Cryptography (Security/Crypto) -- Private- and public-key cryptography -- RSA cryptosystem -- Digital signatures -- Factoring and primality testing Programming Languages and Compilers (PPL/Compiler Design) -- Notion of an interpreter -- Notion of a virtual machine -- Parse trees -- Garbage collection and memory management Self-reproducing programs (Automata Theory) -- Introducing traps -- Unsolvability of the halting problem