Logique approchée
description
Transcript of Logique approchée
![Page 1: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/1.jpg)
Logique approchée
Michel de Rougemont
Université Paris II
VERA: http://www.lri.fr/~mdr/vera.htm
CORRECT: http://www.lri.fr/~mdr/xml/
![Page 2: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/2.jpg)
1. Classical approximation for a function f:
• Knapsack
• Maxcut
2. Decision problem (boolean function)
Complexity and Approximation
: is farf(x)
1 then 1 If A(x)f(x)
1)]1).(()()1).(([Pr xfxAxfob
1]0 Prob[ then is If A(x)farf(x)
U'U ]0[ then if and ]0[ f(x))dist(U, U'f(x)
![Page 3: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/3.jpg)
1. Satisfiability : Tree |= F
2. Approximate satisfiability
Tree |= F
Image on a class K of trees
Approximate satisfiability
F FF
F fromfar -
![Page 4: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/4.jpg)
1. Kripke structure, Execution Tree, Specification F
Tree |= F
2. Approximate verification (LICS 2002)
Tree |= F is much easier than Tree |= F
3. 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
Approximate verification
![Page 5: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/5.jpg)
VERA: Vérification approchée
1. Logique, Testeurs et Correcteurs• Testeurs et Correcteurs• Arbres réguliers
2. Abstraction probabiliste de programmes
• Bornes inférieures sur OBDDs et automates
• Abstraction en Model Checking
3. Mécanismes et Jeux • Calcul d’équilibre
![Page 6: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/6.jpg)
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.
![Page 7: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/7.jpg)
• Programme P
• Spécification F (X,Y)
• Structure de donnée OBDDO = O
• Problème : taille des structures explose
• Complexité en Communication montre des bornes inférieures exponentielles.
P F
Vérification par Modèle
![Page 8: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/8.jpg)
• La spécification admet un testeurP (A) =1 ssi A est 3 coloriable
• Problème : comment appliquer le test à un programme?
A est 3-coloriable  est 3-coloriable
Testeurs et Vérification
![Page 9: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/9.jpg)
P(A). Enumerate C:
While (x <= n){
While (y <= n){
If A(x,y) check C(x)=C(y)}}
• Define an abstraction
Abstraction probabiliste
)3,2,1( Dn
DnP(A). Enumerate C:
While (x <= m){
While (y <= m){
If A(x,y) check C(x)=C(y)}}
)3,2,1(
![Page 10: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/10.jpg)
Peut-on trouver une abstraction?
• Toute propriété
Admet un testeur.
• Comment trouver une abstraction à partir d’un programme P?
• Difficulté algorithmique.
)),,(( zyxPzyx
![Page 11: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/11.jpg)
Programmes probabilistes
? 5.0] [Pr pUqob
a
b
c
d
0
1 (0.6)1 (0.4)
a
ppp
p
q
Random sampling may approximate this probability. (Peyronnet’s thesis)
? 5.0] [Pr pUqobT
![Page 12: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/12.jpg)
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
![Page 13: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/13.jpg)
Let K be a class of finite structures and
Examples:1. Words
– Edit distance– Edit distance with moves– Edit distance with moves, Cut, Paste
2. Trees
3. Graphs
Distances on structures
K of structureson distance a )Dist(U, U'
)U',UMax(nn
)Dist(U, U')dist(U, U' a if
)dist(U, U'Mindist(U, K) KU '
![Page 14: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/14.jpg)
1. Classical Edit Distance:
Insertions, Deletions, Modifications
2. Edit Distance with moves
0111000011110011001
0111011110000011001
Edit distance on Words
![Page 15: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/15.jpg)
Tree-Edit-Distance
a
e
b
c d
a
e
b
c
a
e
b
c
df
e
DeletionEdge
InsertionNode andLabel
Tree Edit distance with moves:
a
e
b
c d
a
e
b
c d
1 move
![Page 16: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/16.jpg)
Binary trees : Distance with moves allows permutations
Tree-Edit-Distance on binary trees
Distance(T1,T2) =4 p-Distance (T1,T2) =2
![Page 17: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/17.jpg)
1. Words • P algorithm• for small distances• Efficent algorithms for Edit Distance
with moves
2. Trees• P algorithm • NP complete, non-approximable for
Edit Distance with moves.• Efficient solution for small distances
Estimating distances
)( nO
![Page 18: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/18.jpg)
CORRECT: XML files
XML file= Tree automaton (DTD) + Colored Tree
1. 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)!!!
kMM ....1
![Page 19: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/19.jpg)
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/
![Page 20: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/20.jpg)
• (q0, q0) q1• (q0,q1) q1
Tree automata
q0 q0
q0
q0
q0
q0
q1
q1
q1
q1
q1
q0 q0
q0q1
q2
(q1,q1)q2
(q1,q0)q2
(q2,-) q2
(-,q2) q2)1,,0,( qqQA
![Page 21: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/21.jpg)
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 and infeasible subtrees
feasible
infeasible
![Page 22: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/22.jpg)
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
Infeasible subtrees
nLT .),(Distance
![Page 23: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/23.jpg)
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
Structure of the correctorTree-Edit Distance
q0
q1
![Page 24: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/24.jpg)
Structure of the corrector Tree-Edit Distance with moves
q0
q1
1 move
![Page 25: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/25.jpg)
Phase 1 : bottom-up marking
Definitions: 1. A terminal *-node is the first sink node of a run2. A * subtree of a node v is the subtree whose root is v reaching leaves or *-node 3. 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 withall possible reachable states (q,q’) reach a sink.
*
O(n) procedure.
![Page 26: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/26.jpg)
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
Lemma 1: If Dist(T,L)<k, there are at most k *-nodes.
*
q1 q2
q’’ instead of *
![Page 27: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/27.jpg)
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
General Correction
q1 q2
q’’
q q’
q’’
q1q2
t2t1
![Page 28: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/28.jpg)
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.
Case 2: b and c
q1 q2
q’’ q’
q’’
q2
t2
q1 q2
q’’ q’’
![Page 29: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/29.jpg)
1. Tree-Edit Distance
Fact 1: finitely many insertionsFact 2: deletions unpredictableConsequences: 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.
Analysis of the corrector
n.
![Page 30: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/30.jpg)
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.
General result
![Page 31: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/31.jpg)
Recall:
Which games characterize ?
Game 1: two players I and II.
Game 2: one player II against “nature” (player I)
Approximate structures
VUVU k and
if :Definition U',V'VU
' ' , , VU)dist(V, V')dist(U, U'
VU
![Page 32: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/32.jpg)
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
Game 1
U
U’
V
V’
' ' VU k
![Page 33: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/33.jpg)
Two players and nature on U, V
Phase 1: nature plays p points in U or V Phase 2 : II answers with p points in V
Phase 3 : I and II play EF(q)
II wins if
Game 2 (p,q)
U V
3/2)],..,( ),..,(Prob[ 11 qpqp vvVuuU
![Page 34: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/34.jpg)
Game 1 Game 2 for p(k, ε), q(k, ε)
Comparisons of Games 1 and 2
3/1)],..,( ),..,(Prob[ 11 qpqpk vvVuuUVU
strategy. winninga has II iff VU 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.
![Page 35: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/35.jpg)
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.
Comparisons of Games 1 and 2
3/1] Prob[ winsIIVU k
![Page 36: Logique approchée](https://reader035.fdocuments.in/reader035/viewer/2022062422/56813c0e550346895da58109/html5/thumbnails/36.jpg)
Conclusion
• Vérifier exactement peut être trop difficile.
• Vérifier approximativement peut être réalisable.
1. Testeurs et Correcteurs
2. Vérification probabiliste de programmes.
• Abstraction probabiliste
• Vérification de programmes probabilistes
• Validité de fichiers XML
3. Vérification approchée d’équilibres de protocole.