Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Finite Model Theory Lecture 12 Regular Expressions, FO k.

Similar presentations


Presentation on theme: "1 Finite Model Theory Lecture 12 Regular Expressions, FO k."— Presentation transcript:

1 1 Finite Model Theory Lecture 12 Regular Expressions, FO k

2 2 Outline The paper FO k

3 3 Background XML = unranked trees XML Schema = wants to be a regular language of unranked trees Several official proposals: –DTD, XSchema - baroque and bad Several counter proposals –Relax NG Often arbtrary restrictions are imposed on the RE’s, claiming “efficiency”

4 4 The Problems Containment: E 1 µ E 2 Equivalence: E 1 = E 2 Intersection: E 1 Å E 2 = ; In class: What is their complexity for all regular expressions ?

5 5 Complexities E 1 µ E 2 : PSPACE complete E 1 = E 2 : PSPACE complete E 1 Å E 2 = ; : PTIME

6 6 Restricted REs Paper claims (and is right) that in practice the DTDs or XSchema use “simple” regular expressions What is “simple” ? Open to debate, but paper makes the following proposals

7 7 Restricted RE’s Symbol s = a letter or a word Notation a or w Possibly followed by ? or *. Notation: a?, a*, w?, w* Factor f = s | s |... | s Notation: s or +s (e.g. (+w*) or (+a*)? or (w*)? ) Possibly followed by ? or * Simple RE = f.f….f Notation: RE(f 1, f 2, …, f k ) where f 1, …, f k are the kinds of factors allowed

8 8 Simple RE Examples RE(a,a*): –Name.Address.Phone*.Email RE(a,a?,a*): –Name.Email?.Address?.Email*.Phone?.Email RE((+a),a*) –Name.(Email | Phone).Address*.Email*

9 9 Containment RE(a?, (+a)*) in PTIME [1] RE(a, ,  *) in PTIME [17] RE(a, a*) or RE(a, a?) coNP hard –WOW ! Others in the paper

10 10 Regular Ranked Tree Languages Background: Given two ranked-tree automata A 1, A 2, checking L(A 1 ) µ L(A 2 ) is EXPTIME complete Note: if A_2 is deterministic, then one can check containment in time |A_1| |A_2|

11 11 Regular Un-Ranked Tree Languages DTDs and XML Schemas are unranked tree languages No big deal: easy to encode unraked trees into ranked trees [show in class] Still, lots of papers out there that re-invent regular languages for unranked trees

12 12 DTD’s Given alphabet  A DTD is a set of expressions:  := E where E is a “regular expression” Example: root := person* person := name,project?,email*,(address|contact) project := name, project* A tree T satisfies the DTD iff it is a derivation tree

13 13 DTDs Strictly weaker than regular tree languages on unranked trees [why ?] Lots of ways to extend them; most popular in the theory community: specialized DTDs

14 14 “Specialized” DTDs Given two alphabets  ’ A specialized DTD is a set of expressions:  ‘ := E’ where E’ is a “regular expression” and a mapping  :  ’ !  Example: root := (person|project)* person := name 1,phone project := name 2,cost name 1 := firstName, lastName name 2 := internalName, publicName

15 15 Single Type SDTDs One more restriction: if E’ contains two occurrences of  2 , then they have the same “type”. –Formally: there are no two occurrences of  1 ’ and  2 ’ in any regular expression E’ s.t.  (  1 ’) =  (  2 ’) The XML Schema standard has such a requirement

16 16 The Paper The main result is that the following have the same complexities: Inclusion for a class R of RE’s Inclusion for a class of DTD’s restricted to R Inclusion for a class of single-type SDTDs restricted to R BUT not for SDTD’s over R

17 17 FO k Is FO restricted to only k variables: x 1, …, x k What can we express here ? Try this in FO 3 : –There exists a path of length 10 from u to v [in class]

18 18 Why we care: 1 The combined complexity of query evaluation: Given A, , decide whether A ²  What is the complexity of: {(A,  ) | A 2 STRUCT[  ],  2 FO} {(A,  ) | A 2 STRUCT[  ],  2 FO k }

19 19 Why we care: 2 Satsfiability Given , decide if 9 A s.t. A ²  Undecidable for FO (Trakhtenbrot) Decidable for FO 2 (WOW !) Undecidable for FO 3 (Hmm….)

20 20 Why we care: 3 Extensions of FO: LFP, IFP, PFP, TC, you-name-it, … All are expressible in infinitary FO, L 1,  : –Allowed to take infinite conjuctions/disjunctions: Ç i 2 I  i or Æ i 2 I  i [why ?] –But L 1,  is boring… All are expressible in [ k ¸ 0 L k 1,  = L  1, 


Download ppt "1 Finite Model Theory Lecture 12 Regular Expressions, FO k."

Similar presentations


Ads by Google