250 likes | 402 Views
Conjunctive Grammars and Alternating Automata. Tamar Aizikowitz and Michael Kaminski Technion – Israel Institute of Technology. WoLLIC 2008 Heriot-Watt University. Introduction: ND Computational Models. Non-deterministic computational models have existential acceptance conditions
E N D
Conjunctive Grammars and Alternating Automata Tamar Aizikowitz and Michael Kaminski Technion – Israel Institute of Technology WoLLIC 2008 Heriot-Watt University
Introduction:ND Computational Models • Non-deterministic computational models have existential acceptance conditions • At least one computation must accept • E.g., FSA, PDA, CFG, TM • Languages accepted have disjunctive quality • A word must meet one of many possible conditions (computations) • Language class closed under union
Introduction:Co-ND Computational Models • Dual computational models have universal acceptance conditions • All computations must accept • E.g., Universal TM; accepts class Co-NP • Languages accepted have conjunctive quality • A word must meet all conditions (computations) • Language class closed under intersection
Introduction:Combined Computational Models • Several models combining existential and universal computations have been explored. • We explore extensions of models for Context Free Languages. • Specifically: • Conjunctive Grammars • Alternating Pushdown Automata
Reminder: Context free languages are not closed under intersection… Introduction:Conjunctive Grammars (CG) • Introduced by Alexander Okhotin in 2001* • Extension of Context Free Grammars • Add power of explicit intersection • CG-s generate a larger class of languages * Okhotin A., Conjunctive Grammars, Journal of Automata, Languages and Combinatorics6(4) (2001) 519-535
Polynomial Time CG Languages Finite ∩ CF Context Free Introduction:Conjunctive Grammars (CG) • Conjunctive Grammars generate: • Context Free languages • Finite ∩ of CF languages • Some more languages • Generated languages are polynomial • No known non-trivial technique to prove a language cannot be generated by a CG Exact placing in the Chomsky Hierarchy not known
Introduction:Alternating Automata • Alternating Automata were introduced by Chandra et.al. in 1981* • Computations alternate between existential and universal acceptance modes • Well known examples: • Alternating Finite State Automata (Verification) • Alternating Turing Machines (Complexity Theory) • Both equivalent to non-alternating counterparts * Chandra, A.K., Kozen, D.C., Stockmeyer, L.J., Alternation. Journal of the ACM28(1) (1981) 114-133
Introduction: Alternating Pushdown Automata (APDA) • Further explored by Ladner et.al. in 1984* • Add conjunction to computations • Not equivalent to standard PDA model • Accept exactly the Exp. Time Languages • Not equivalent to the CG model * Ladner, R.E., Lipton, R.J., Stockmeyer, L.J., Alternating pushdown and stack automata. SIAM Journal on Computing13(1) (1984) 135-155
Introduction:Synchronized APDA (SAPDA) • We introduce a new model: Synchronized Alternating Pushdown Automata • Equivalent to Conjunctive Grammar model • In fact, this is the first class of automata suggested for Conjunctive Grammars
Outline • Conjunctive Grammars • Synchronized Alternating PDA • Equivalence Results: CG ~ SAPDA • Future Work
Conjunctive Grammars:Model Definition • G = (V,T,P,S) • V,T,S as in the standard CFG case • P contains rules X → (1 & & n) • n = 1 gives standard CFG rules • Conjunctive Formulas: • {}VT are formulas • If and are formulas then is a formula • If 1,…,n are formulas then (1 & & n) is a formula conjunct
Conjunctive Grammars:Model Definition • Derivation: • Application: s1 Xs2s1(1 & & n)s2 s.t. X → (1 & & n)P • Contraction: s1(w & & w)s2s1ws2 • Language: L(G) = {wT * | S* w} • Note:( &)*w iff *w and *w
S1S2*L1 S3S4*L2 L1L2 Conjunctive Grammars:Example 1 • L = {anbncn| n} • Note:L = L1 L2 where • L1= {anbnci| n,i} • L2= {aibncn| n,i} • G = ({S,S1,S2,S3,S4},{a,b,c},S,P) where P=: • S1 → aS1 b | ; S2 → cS2 | • S3→aS3| ; S4→bS4 c| • S → (S1 S2 & S3 S4)
S → (S1S2 & S3S4) S1 → aS1b S1 → aS1b S1 → S2 → cS2 contraction S2 → cS2 Conjunctive Grammars:Example 1 • Derivation of aaabbbccc: S (S1S2 & S3S4) (aS1bS2 & S3S4) … (aaaS1bbbS2 & S3S4) (aaabbbS2 & S3S4) (aaabbbcS2 & S3S4) … (aaabbbccc & S3S4) … (aaabbbccc & aaabbbccc) aaabbbccc
Conjunctive Grammars:Interesting Languages • CGs can generate some interesting languages: • Multiple agreement: {anbncn | n} • Cross agreement: {anbmcndm | n,m} • Reduplication:{w$w | w{a,b}*} all mildly context-sensitive languages (MCS) • CGs can also generate “stronger” languages such as: {ba2ba4ba2nb | n} not MCS because not semi-linear!
Non-deterministic model = many possible conjunctions Synchronized Alternating Pushdown Automata (SAPDA) • Extension of the standard PDA model • Transitions are to conjunctions of (state,stack-word) pairs • E.g. (q,, X) = {(p1 , XX) (p2 ,Y) , (p3 ,Z) } • If all conjunctions are of one pair then we have the standard PDA model
q p A B C D A Synchronized Alternating Pushdown Automata (SAPDA) • Stack memory is a tree • Each leaf has a separate processing head • A conjunctive transition to n pairs splits the current branch to n branches • Branches are processed independently • Sibling branches must empty synchronously.
Y Y Z X p1 p2 SAPDA:Model Definition • A = (Q,,,,q0 ,) • For every (q,, X) Q({})(q,, X) {(q1 ,1) (qn,n) | qiQ , i* , n } • Example:(q,, X) = {(p1 , Z) (p2 ,YY)} q
q p A B C D A SAPDA:Configurations • Configuration: a labeled tree T where • Internal nodes labeled αdenoting stack contents • Leaves labeled (q,w,α) denoting current state, remaining input and stack contents • Initial Configuration: the tree T0 which is the tree • Accepting Configuration: a tree Tes.t. it is the tree for some qQ (q,ba,A) ( p,a,DC ) abba BA abba (q0,w,) (q,,)
SAPDA:Computation • Computation: • Each computation step, a transition is applied to one stack-branch • If a stack-branch empties, it cannot be selected • If all siblings branches are empty and “synchronized” then they are collapsed • Synchronized Collapsing: All siblings… • Are empty • Have the same state • Have the same remaining input Are all labeled (q,w,ɛ)
SAPDA:Language • Accepting Computation: The final configuration is an accepting one, i.e. (q,,) for some qQ. • L(A) = {w* | Ahas an accepting computation onw} • Note: Acceptance by accepting states can also be defined. Both models of acceptance are equivalent.
SAPDA:Example • L = {w {a,b,c}* | #a(w) = #b(w) = #c(w)} a a b c c a b b c q0 q1 q2 q0 a δ (q0 , ε , ) = (q1 , 1) (q2 , 2) a b δ (q1 , a , 1) = (q1 , a1) δ (q2 , a , 2) = (q2 , 2) ε ε δ (q1 , a , a) = (q1 , aa) δ (q2 , a , 2) = (q2 , 2) 1 2 δ (q1 , b , a) = (q1 , ε) δ (q2 , b , 2) = (q2 , b2) ε δ (q1 , c , a) = (q1 , a) δ (q2 , c , b) = (q2 , ε) q0 δ (q1 , ε , 1) = (q0 , ε) δ (q2 , ε , 2) = (q0 , ε)
Equivalence Results • Theorem 1:SAPDA CG • Theorem 2: CG 1-state SAPDA(1SAPDA) • Corollary 1:SAPDA~ CG • Corollary 2:SAPDA~ 1SAPDA • Proofs: • Both are extensions of the classical ones • Surprisingly, the grammar-to-automaton translation is the more complicated one…
Future Directions • Linear CG and 1-turn SAPDA • It is well known that LCFG ~ 1-turn PDA • Linear CG: one non-terminal in each conjunct • 1-turn SAPDA: each stack-branch turns once • Initial results point towards: 1-turn SAPDA ~ LCG • Finite-turn SAPDA, Deterministic SAPDA… • Possibly, find a method to prove a language cannot be accepted by an SAPDA / CG…