Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
en:dydaktyka:problog:intro [2017/05/16 00:06] msl [First-Order Logic To The Rescue] |
en:dydaktyka:problog:intro [2019/06/27 15:49] (current) |
0.7::pass_exam(Student) :- handwriting(Student, partly_legible), knows_the_answer(student). | 0.7::pass_exam(Student) :- handwriting(Student, partly_legible), knows_the_answer(student). |
</code> | </code> |
| |
| |
Update rest of the rules accordingly and check if the model still works. What is the chance of passing the exam by Maxwell, who knows the answer but his handwriting is only partly legible? | Update rest of the rules accordingly and check if the model still works. What is the chance of passing the exam by Maxwell, who knows the answer but his handwriting is only partly legible? |
| |
| ==== Last Fixes ==== |
| |
| There is one problem with the approach we've used with ''handwriting'' predicate. Have you noticed? All three facts ''handwriting(Student, illegible), handwriting(Student, partly_legible), handwriting(Student, legible)'' can be true at the same time. In other words, our model has a flaw we need to fix! |
| |
| There are to ways to take care of that: |
| |
| - (not recommended) we add additional rules that say that only one value can be true. |
| - (recommended) use so called //annotated disjunctions//, which will be explained briefly. |
| |
| If we have three facts that only one of them can be true at the time, we can write them as: |
| |
| <code prolog> |
| fact1; fact2; fact3. |
| </code> |
| |
| The same we can due with a rule: |
| <code prolog> |
| fact1; fact2; fact3 :- rule_body. |
| </code> |
| |
| Which in our case translates to: |
| <code prolog> |
| 0.5::handwriting(Name, illegible); |
| 0.4::handwriting(Name, partly_legible); |
| 0.1::handwriting(Name, legible ):- student(Name). |
| </code> |
| |
| Try to use that instead of the previous notation. Is there any difference? |
| |
===== First Assignment ===== | ===== First Assignment ===== |