This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
magik-demo:user:query_approximation:generalization [2013/07/23 15:19] alex |
magik-demo:user:query_approximation:generalization [2017/07/06 15:24] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{:magik-demo:magik_logo.png?nolink&500|}} | ||
+ | |||
====== Generalization ====== | ====== Generalization ====== | ||
Line 26: | Line 28: | ||
The idea is at each iteration remove all the incomplete atoms. The algorithm will stop if there is no other atoms that are incomplete (we said that it reaches a **fixed point**). | The idea is at each iteration remove all the incomplete atoms. The algorithm will stop if there is no other atoms that are incomplete (we said that it reaches a **fixed point**). | ||
- | ** 1st iteration ** | + | ** __1st iteration__ ** |
- | Looking the 3 tc-statements that we have, we see that there is no information about A4 (you have to look on the left side of the equal) so, the algorithm removes from the query the atom A4. | + | Looking the 3 tc-statements that we have, we see that there is no information about A4 (you have to look on the left side of the equal) so, the algorithm will remove from the query the atom A4. \\ |
New query is | New query is | ||
<code> | <code> | ||
- | Q1 = A1, A2, A3. | + | Q1 = A1, A2, A3 |
</code> | </code> | ||
- | Obviously Q1 is not equal to Q, so the algorithm will start another iteration. | + | Obviously Q1 is not equal to Q, so the algorithm will continue. |
+ | ** __2nd iteration__ ** | ||
- | ---- | + | Now we know that A4 is incomplete. From this we can inferred that also A3 is not complete because A3 in complete iff also A4 is complete (TC3), but this is not the case. So A3 will be removed from the query.\\ |
- | ** 2nd iteration ** | + | New query is |
+ | <code> | ||
+ | Q2 = A1, A2 | ||
+ | </code> | ||
+ | Obviously Q2 is not equal to Q1, so the algorithm will continue. | ||
+ | ** __3rd iteration__ ** | ||
- | Looking TC3 we have that the right part cannot be satisfied because we A4. Because of this, A3 will be removed from the query | + | Now we know that A4 and A3 are incomplete. From this we can inferred that also A2 is not complete because A2 is complete iff also A3 is complete (TC2), but this is not the case. For this reason A2 will be removed from the query.\\ |
+ | New query is | ||
+ | <code> | ||
+ | Q3 = A1 | ||
+ | </code> | ||
+ | Obviously Q3 is not equal to Q2, so the algorithm will start another iteration | ||
+ | |||
+ | ** __4th iteration__ ** | ||
+ | |||
+ | Now we have only A1. This atom is complete because there is no other atoms involved in its completeness (TC1). So A1 survived.\\ | ||
+ | New query is | ||
+ | <code> | ||
+ | Q4 = A1 | ||
+ | </code> | ||
+ | Now Q4 is **equal** to Q3, so we reach a **fix point** and the algorithm stops. | ||
+ | |||
+ | So the generalizated query Qgen is: | ||
+ | <code> | ||
+ | Qgen = A1 | ||
+ | </code> |