Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.5 KiB

  1. This a very high level review post that I am making for myself and other people taking CS Theory.
  2. If you want to lean about the theory behind the content in this blog post I recommed looking else where.
  3. This post will cover how to solve typical problems relating to topics covered by my second CS Theory exam.
  4. ## Myhill-Nerode Theorem
  5. ### Definition
  6. L is regular if and only if it has a finite index. The index is the maximum number of elements thar are pairwise distibguishable.
  7. Two strings are said to be pairwise distinguishable if you can append something to both of the strings and it makes one string
  8. accepted by the language and the other string non-accepting.
  9. The size of an index set X equals the number of equivalence classes it has. Each element in the language is accepted by only
  10. one equivalence class.
  11. ### Problem Approach
  12. Prove that language L is regular.
  13. 1) Define a set X which is infinite in size - this doesn;t necesarrily need to be in the language.
  14. 2) Make a general argument that show that each element in X is pairwise distinguishable.
  15. Pick any two elements x, y in X and show that if you append z to them one is accepted by the language and
  16. the other is not in the language.
  17. ### Example
  18. Prove the following language is non-regular:
  19. $$
  20. L={ww^r | w \in {0,1}^*}
  21. $$
  22. answer:
  23. 1)
  24. $$
  25. X = {(01)^i | i \geq 0}
  26. $$
  27. Pick any 2 elements of X and show pairwise distinguishable
  28. $$
  29. x = (01)^i, y = (01)^j | i \neq j
  30. $$
  31. suppose we pick
  32. $$
  33. z = (10)^i\\
  34. xz \in L\\
  35. yz \notin L
  36. $$
  37. ## DFA minimization algorithm
  38. Types of Problems:
  39. - Prove DFA is minimal
  40. - Minimize the DFA
  41. The argument for DFA minimization comes from the Myhill-Nerode theorem. Given
  42. a DFA, if you can form a set of strings which represent each state and they are all
  43. pairwise distinguishable, then the DFA is minimal with that many states.
  44. ### Prove DFA is minimal
  45. For these types of problems you simply construct a table and show that each state is pairwise distinguishable.
  46. To show pairwise distinguishability you have to show that there exists a string where if appened to one element
  47. makes it accepted by the language but pushes the other string out of the language.
  48. ex: Prove the following DFA is minimal.
  49. ![DFA Example](media/CSTHEORY/DFAMinimalProof.png)
  50. $$
  51. X = {\epsilon, b, bb, ba}
  52. $$
  53. ![DFA Example](media/CSTHEORY/Table.png)
  54. ### Minimize the DFA
  55. ## Pumping lemma for regular languages
  56. ## Context-free grammars, closure properties for CFLs
  57. ## Parse trees, ambiguity
  58. ## Chomsky Normal Form
  59. ## Pushdown automata
  60. ## Construction to convert CFG to a PDA