Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
laborator [2020/09/08 11:43]
pdmatei
laborator [2020/09/10 17:57] (current)
pdmatei
Line 1: Line 1:
 ====== Laborator AA ====== ====== Laborator AA ======
  
-==== Masina ​Turing ====+===== Part 1 - Decidability - 4 labs ===== 
 + 
 +==== 1. Turing ​Machine ​====
  
 Key concepts: Key concepts:
Line 48: Line 50:
  
    
-==== Turing Machines and Solvability ====+==== 2. Turing Machines and Solvability ====
  
 +Key concepts: ​
 +  * **acceptance** vs **decision**
 +  * complement of a problem.
  
 +  * Can the following problem be **accepted** by a TM? (f(x) = 0) 
 +    * What is the complement of this problem?
 +  * Can a problem be accepted by two different TMs? Can a TM accept two different problems?
 +  * If a problem is accepted by some TM, can its complement also be accepted?
 +  * If a problem is **decided** by some TM, can its complement also be decided? ​
 +  * Write a TM which accepts //is-odd// problem but which does not decide it.
 +  * Which of the following problems you **think** can be **accepted** and which can be **decided**?​ Use pseudocode instead of writing a TM.
 +      * a) V [[https://​arxiv.org/​pdf/​1902.10188.pdf | Undecidable example 1]]
 +      * b) V [[https://​en.wikipedia.org/​wiki/​Hilbert%27s_tenth_problem | Hilbert undecidable ]]
 +      * c) V [[https://​en.wikipedia.org/​wiki/​Wang_tile | Wang Tile]]
 +      * e) k-color
 +      * f) Linear Integer Programming
  
 +==== 3. The Universal Turing Machine ====
  
 +Key concepts: ​
 +  * simulation
  
 +Exercises:
 +  * The Von Newmann architecture - explained.
 +  * Which of the components of Von Newmann arch. corresponds best to the TM?
 +  * Write a TM pseudocode which verifies if a word is the proper encoding of a TM.
 +    Discussion on the pseudocode.
 +  * Write a TM pseudocode which accepts if **there exists** a word which is accepted by a given TM in **k steps**.
 +    Discussion on the pseudocode
 +  * Which of the following is a suitable pseudocode for a TM:
 +<​code>​
 +Algoritm(M,​w){
 +   if size(w) > 10
 +     then if M halts for w in k steps
 +          accept.
 +
 +</​code>​
 +<​code>​
 +Algoritm(M1,​M2,​w){
 +   k = 0
 +   while true
 +       if M1(w) has the same behaviour as M2(w) after k steps
 +          then accept
 +       else k = k + 1
 +
 +</​code>​
 +<​code>​
 +Algorithm(M,​A) {
 +   // A is a finite set of words
 +   for each w in A
 +       if M(w) halts  //​undecidable! Pseudocode is ok, but this machine may not terminate
 +          then accept
 +}
 +</​code>​
 +<​code>​
 +Algorithm(M,​w) {
 +   build the machine M' such that M(x) accepts iff M'(x) does not accept, for all words x
 +   if M'(w) in 1000 steps
 +      accept
 +}
 +</​code>​
 +<​code>​
 +Algorithm(M1,​M2) {
 +    if M1 always halts then     //we know of no procedure, terminating or not, which can achieve this. This is not a proper TM/​algorithm.
 +       if M2 always halts then 
 +          accept
 +}
 +</​code>​
 +
 +  * Write the problem which is accepted by each of the above machines.
 +  * Write a TM pseudocode which accepts if a **given** word is accepted by two given TMs. Explain the dovetailing technique.
 +
 +Homework:
 +  * Write a TM pseudocode which accepts if **there exists** a word which is accepted by two given TMs.
 +  * Write a TM pseudocode which accepts if **there exists** a TM which accepts a given word.
 +  * Write a TM pseudocode which accepts if a given TM accepts **some** word of a given finite set A.
 +  * Write a TM pseudocode which accepts if a given TM accepts **all** words of a given finite set A.
  
  
-  * Exercitii simple cu MT 
-  * Exercitii cu MTU si conceptul de simulare 
 [[https://​www.bbc.co.uk/​bitesize/​guides/​zhppfcw/​revision/​3#:​~:​text=Von%20Neumann%20architecture%20is%20the,​both%20stored%20in%20primary%20storage | Von Newmann Model]] [[https://​www.bbc.co.uk/​bitesize/​guides/​zhppfcw/​revision/​3#:​~:​text=Von%20Neumann%20architecture%20is%20the,​both%20stored%20in%20primary%20storage | Von Newmann Model]]
  
-  * Algoritmi+==== 4. Undecidable problems ====
  
-==== Decidabilitate ​====+Key concept: 
 +  * reduction 
 +  * proving a problem is not in R 
 +  * proving a problem is not in RE 
 + 
 +===== Part 2 - Measuring algorithm performance (3 labs) =====
  
-  * Ce este o problema de decizie? 
-  * Problema si rezolvare; 
-  * Lista de probleme care (pot/nu pot) fi rezolvate; 
-  * Reduceri 
-  * Further work: coRE, complement, dovetailing 
  
 ==== Notatii asimptotice ==== ==== Notatii asimptotice ====
-  * Implementari care sa ilustreze faptul ca constanta conteaza/​nuconteaza +  * (Homework) Implement mergesort and insertionsort ​in python. Use a large dataset (provided by usto test your implementation. Plot the execution times together with the functions $math[n^2] and $math[n\cdot \log{n}] using ''​gnuplot''​. What do you observe? Adjust the constants for the previous functions so that the rate of growth can be better observed.
-  * Implementari care sa ilustreze faptul ca log n >> n >> n2 >>>​ n3 +
-  * Grafice ​(in ?!)+
   * Exercitii clasice   * Exercitii clasice
  
 ==== Recurente ==== ==== Recurente ====
   * Cativa algoritmi si recurentele lor   * Cativa algoritmi si recurentele lor
 +    * Merge-sort,
 +    * Quick-sort (curs)
 +    * Exemplul cu sqrt(n) al lui Sebi.
   * Exercitii clasice   * Exercitii clasice
 +
 +==== Ammortised Analysis ====
 +  * Classical exercises
 +
 +===== Part 3 - Algorithm complexity (4 labs) =====
  
 ==== NP completitudine ==== ==== NP completitudine ====
-  * Implementare care sa ilustreze exponentiala (backtracking);​ legatura cu MTN+  * Implement a SAT solver which encodes formulae as matrices and iterates over interpretations treating them as binary counters. Plot execution times
-  * Reduceri pentru ​SAT solvere +  * Implement a better ​SAT solver which uses BDDs to encode a formula. The variable ordering is known in advance. Plot execution times. 
-  * Exercitii clasice cu reduceri+  * Implement a k-Vertex-Cover solver using a reduction from SAT, and any of the above solvers. 
 +  * Exercitii clasice cu choice si reduceri 
 + 
 +===== Part 4 - Abstract Datatypes (2 labs) =====
  
 ==== TDA-uri ==== ==== TDA-uri ====
   * Conceptul de operator vs cel de functie (exercitiu in C, exercitiu in Haskell, pe Liste)   * Conceptul de operator vs cel de functie (exercitiu in C, exercitiu in Haskell, pe Liste)
 +  * (Homework) Implementare LinkedList si ArrayList in Python, impreuna cu operatii. Implementare Haskell a operatiilor,​ dupa o discutie la curs despre acestea.
   * Exercitii clasice   * Exercitii clasice