360 likes | 464 Views
Logique approchée. VERA: http://www.lri.fr/~mdr/vera.htm CORRECT: http://www.lri.fr/~mdr/xml/. Michel de Rougemont Université Paris II. Complexity and Approximation. Classical approximation for a function f: Knapsack Maxcut 2. Decision problem (boolean function).
E N D
Logique approchée VERA: http://www.lri.fr/~mdr/vera.htm CORRECT: http://www.lri.fr/~mdr/xml/ Michel de Rougemont Université Paris II
Complexity and Approximation • Classical approximation for a function f: • Knapsack • Maxcut 2. Decision problem (boolean function)
Approximate satisfiability • Satisfiability : Tree |= F • Approximate satisfiability Tree |= F Image on a class K of trees
Approximate verification • Kripke structure, Execution Tree, Specification F Tree |= F 2. Approximate verification (LICS 2002) Tree |= F is much easier than Tree |= F • XML data: (ICALP 2004) • Verify that a large XML file is valid. (Satisfies a DTD). • Estimate distance from a file to a DTD • Rank documents on the Web
VERA: Vérification approchée • Logique, Testeurs et Correcteurs • Testeurs et Correcteurs • Arbres réguliers • Abstraction probabiliste de programmes • Bornes inférieures sur OBDDs et automates • Abstraction en Model Checking • Mécanismes et Jeux • Calcul d’équilibre
Logique, testeurs, correcteurs Un Testeur decide |= pour une formule F. Un Correcteur prend une structure U proche de K en entrée et calcule U’ dans K, proche de U. Problème: Une classe K définissable dans une logique L admet-elle un testeur et un correcteur? Théorème. (Alon and al. FOCS2000) Les mots reguliers sont testables pour la distance d’Edition. Généralisation aux arbres réguliers. Application au test de fichiers XML et à la correction XML.
Vérification par Modèle • Programme P • Spécification F (X,Y) • Structure de donnée OBDD O = O • Problème : taille des structures explose • Complexité en Communication montre des bornes inférieures exponentielles. P F
Testeurs et Vérification • La spécification admet un testeur P (A) =1 ssi A est 3 coloriable • Problème : comment appliquer le test à un programme? Â est 3-coloriable A est 3-coloriable
Abstraction probabiliste P(A). Enumerate C: While (x <= n){ While (y <= n){ If A(x,y) check C(x)=C(y)}} • Define an abstraction • P(A). Enumerate C: • While (x <= m){ • While (y <= m){ • If A(x,y) check C(x)=C(y)}}
Peut-on trouver une abstraction? • Toute propriété • Admet un testeur. • Comment trouver une abstraction à partir d’un programme P? • Difficulté algorithmique.
Programmes probabilistes 1 (0.6) b 1 (0.4) d a 0 c a p p p p q Random sampling may approximate this probability. (Peyronnet’s thesis)
Protocoles et jeux Mécanismes et Jeux • Calcul d’équilibre • Comment vérifier qu’un programme distribué atteindra un équilibre satisfaisant une propriété P? • Agents interagissent selon un modèle économique. • Véracité du protocole (Truthfulness) • Nash est approximable (Lipton 2003) • Mécanismes de sécurité et de régulation
Distances on structures Let K be a class of finite structures and Examples: • Words • Edit distance • Edit distance with moves • Edit distance with moves, Cut, Paste • Trees • Graphs
Edit distance on Words • Classical Edit Distance: Insertions, Deletions, Modifications • Edit Distance with moves 0111000011110011001 0111011110000011001
Tree-Edit-Distance a b Deletion Edge a e c b a b e c d Insertion Node and Label f e e d c Tree Edit distance with moves: a a b b e e c d c d 1 move
Tree-Edit-Distance on binary trees Binary trees : Distance with moves allows permutations Distance(T1,T2) =4 p-Distance (T1,T2) =2
Estimating distances • Words • P algorithm • for small distances • Efficent algorithms for Edit Distance with moves • Trees • P algorithm • NP complete, non-approximable for Edit Distance with moves. • Efficient solution for small distances
CORRECT: XML files XML file= Tree automaton (DTD) + Colored Tree • Test if a large file is « valid ». Solution: O(1) !! 2. If the distance to a DTD is small, correct the file. Solution O(n). 3. Rank the Web: For DTDs find the distances. Solution: less than O(n)!!!
XML <?xml version="1.0"?> <!DOCTYPE a [ <!ELEMENT a (l,r)> <!ELEMENT r ((l,r)|q ) > <!ELEMENT l (#PCDATA) > <!ELEMENT q (#PCDATA) > ]> <a> <l></l> <r><l></l><r><l></l> <r>><l></l> <r>….. <l></l> <r> <q></q> </r> </r> </r>….. </r> </a> XML corrector : http://www.lri.fr/~mdr/xml/
Tree automata (q1,q1)q2 (q1,q0)q2 (q2,-) q2 (-,q2) q2 • (q0, q0) q1 • (q0,q1) q1 q1 q1 q0 q1 q0 q2 q1 q0 q1 q1 q0 q0 q0 q0 q0 q0
Feasible and infeasible subtrees Definition : a subtree t is feasible for L if there are subtrees (for its leaves) which reach states (q1...ql) such that the state of the root q=t(q1...ql) can reach an accepting state (in the automaton for L). A subtree is infeasible if it is not feasible feasible infeasible
Infeasible subtrees Fact . If then the number of unfeasible subtrees of length a is O(n). Fact. If the distance is small, there are few infeasibles trees. Intuition : make local corrections at the root of the infeasible trees
Structure of the correctorTree-Edit Distance Phase 1 : (Bottom-up) Marking of * nodes, roots of infeasible subtrees. Phase 2 : (Top-down) Recursive analysis of the * subtrees to make root accept. Phase 3 : (Bottom –up) Local corrections q0 q1
Structure of the correctorTree-Edit Distance with moves q0 q1 1 move
Phase 1 : bottom-up marking • Definitions: • A terminal *-node is the first sink node of a run • A * subtree of a node v is the subtree whose root • is v reaching leaves or *-node • A node v is a *-node if its state is a sink node • when all possible reachable states replace the • *-nodes of its *-subtree. • 4. Compute the size of the subtrees * Runs with all possible reachable states (q,q’) reach a sink. * * O(n) procedure.
Phase 2 : top-down possible states Let (q,q’) a possible choice at the top *-subtree. Let q’’ a possible state for the *-node of the left *-subtree * * * q’’ instead of * q2 q1 Lemma 1: If Dist(T,L)<k, there are at most k *-nodes.
General Correction Hypothesis : q1 in Ci q2 in Cj q’’ in Ck Case a: P such that Ci < Ck and Cj < Ck Find t1 and t2 as in case 1.a q’’ q’’ q2 q q1 q’ t1 t2 q1 q2
Case 2: b and c Case b,c : P such that Ci >Ck and Cj < Ck Find t2 and let Cp=inf(Ci,Ck). Cut the left branch until Cp. Case d: P such that Ci >Ck and Cj > Ck Let Cp=inf(Ci,Ck). Cut the left branch until Cp. Let Cq=inf(Cj,Ck). Cut the right branch until Cq. q’’ q’’ q’ q2 q1 t2 q2 q’’ q’’ q2 q1
Analysis of the corrector • Tree-Edit Distance Fact 1: finitely many insertions Fact 2: deletions unpredictable Consequences:no easy bound on the distance between T and T’. Correction up to a constant distance. 2. Tree-Edit Distance with moves. Correction up to . Estimate the distance, although the problem is NP-hard, non-approximable.
General result Theorem: If Dist(T,L) <k, the general corrector finds T’ such that Dist(T,T’) <c.k. Proof : # *-nodes < k Case 1: 0 *-node: easy correction Case 2: at least 1 *-node. Looking at all possible k-variations will correct the errors in the *-subtree and diminish the *-nodes.
Approximate structures Recall: Which games characterize ? Game 1: two players I and II. Game 2: one player II against “nature” (player I)
Game 1 Two players I and II on U, V Phase 1: II choose U’, V’ at distance ε Phase 2 : I and II play EF of order k on U’,V’ II wins if V U U’ V’
Game 2 (p,q) Two players and nature on U, V Phase 1: nature plays p points in Uor V Phase 2 : II answers with p points in V Phase 3 : I and II play EF(q) II wins if V U
Comparisons of Games 1 and 2 Game 1 Game 2 for p(k, ε), q(k, ε) If there is a FO (k) formula which distinguishes U and V, there is an automaton A which distinguishes U and V. A tester for A would distinguish U and V with high probability.
Comparisons of Games 1 and 2 Let A an automaton which distinguishes U and V. The tester accepts U and rejects V with high probability. There is an admissible path Z for which some sample of length at most q is feasible for U and infeasible for V In a game of order q, I would win with high probability.
Conclusion • Vérifier exactement peut être trop difficile. • Vérifier approximativement peut être réalisable. • Testeurs et Correcteurs • Vérification probabiliste de programmes. • Abstraction probabiliste • Vérification de programmes probabilistes • Validité de fichiers XML • Vérification approchée d’équilibres de protocole.