1 / 11

COSC 3340: Introduction to Theory of Computation

COSC 3340: Introduction to Theory of Computation. University of Houston Dr. Verma Lecture 23. Tree Automata. The automata concept is general and powerful ! (should be in every CS student toolkit)

quanda
Download Presentation

COSC 3340: Introduction to Theory of Computation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 23 UofH - COSC 3340 - Dr. Verma

  2. Tree Automata • The automata concept is general and powerful! (should be in every CS student toolkit) • Just as DFAs and NFAs work on strings, we can define automata that process trees, DAGs, graphs, matrices, etc. • We illustrate this generality thru tree automata UofH - COSC 3340 - Dr. Verma

  3. Tree Automata • Process trees instead of strings • Can be bottom-up (we consider) or top-down • The tree automata TA has: • a finite set of states • 0 or more special states - final states • input alphabet • transition table containing rules of two kinds: a -> q , f(q1,…,qn) -> q UofH - COSC 3340 - Dr. Verma

  4. Informally -- How does a TA work? • TA works from the leaves to the root of the tree. • TA goes into a loop until the entire tree is read. • In each step, TA consults its transition table and determines states for nodes higher up the tree based on (f,q1,…,qn) where • f – symbol at the node • q1, …, qn – states at the children of the node UofH - COSC 3340 - Dr. Verma

  5. How does a TA work? (contd.) • For deterministic TA, after reading input tree, • if TA state final, input accepted • if TA state notfinal, input rejected • For nondeterministic TA, as long as one accepting computation exits, input is accepted; if none, input is rejected. • Language of TA -- set of all trees accepted by TA. • TAs have applications in XML, Xpath, compilers, logic, and verification UofH - COSC 3340 - Dr. Verma

  6. Formal definition of NTA • NTA M = (Q, , Δ, F) • Where, • Q is a finite set of states •  is the input alphabet • FQ is set of final states • Δis a set of transition rules of two kinds • a -> q where a is in  and q is in Q • f(q1, …, qn) -> q where f is in  and q, qi’s in Q UofH - COSC 3340 - Dr. Verma

  7. Formal definition of L(M) • We can define the yields in one-step relation between two trees • Take its reflexive-transitive closure and define L(M) • Reference: Tree Automata and Applications book by Comon et al. (available on the web) UofH - COSC 3340 - Dr. Verma

  8. DFAs are special case of TA • The DFA symbols become unary functions • The TA has rules: • a(q0) -> q1 • b(q0) -> q0 • a(q1) -> q0 • b(q1) -> q1 • q0 is final state UofH - COSC 3340 - Dr. Verma

  9. Example of TA – boolean formula evaluation • 0 -> q0, 1 -> q1 • not(q0) -> q1, not(q1) -> q0 • and(q0, q0) -> q0, …, and(q1, q1) -> q1 • or(q0, q0) -> q0, …, or(q1, q1) -> q1 • q1 is final state • Evaluate: or(and(not(0), not(1)), and(0, 0)) UofH - COSC 3340 - Dr. Verma

  10. More generally … • We can have rules of the form: • expr1 -> expr2, where lhs and rhs are expressions containing variables x, y, z and function symbols f, g, h, a, … • Example: x + 0 -> x and x + -x -> 0 • These rules are applied using pattern matching • A derivation: (0 + -0) + 0 => 0 + 0 => 0 UofH - COSC 3340 - Dr. Verma

  11. How powerful are such rules? • As powerful as a Turing Machine! (Reference: TCS paper by Max Dauchet) • An interpreter, called LRR, for such rules has been implemented by me and my students • LRR saves every rule application in a compact data structure • Can be used for programming or verification • LRR Demo available for interested students (see me) UofH - COSC 3340 - Dr. Verma

More Related