Question: DLV Logic Programming; doing math in rules Pravanox Pharmaceuticals has spent decades scouring the world's rainforests for new sources of medical drugs, and this year
DLV Logic Programming; doing math in rules
Pravanox Pharmaceuticals has spent decades scouring the world's rainforests for new sources of medical drugs, and this year a number of these new drugs have been officially approved by the FDA. Using only the clues below, match each drug Bizolam Damasol, Favolin, Hamzell, Minitrell, Zednisen to the condition it treats arthritis asthma, diabetes, heart disease, influenza, meningitis the month it was approved JanuaryJune inclusive and the source beetle bromeliad, frog, fig orchid, palm tree, wasp from which its main ingredient is derived.
a The pharmaceutical sourced from a specific type of beetle was approved months after Bizolam.
b The medicine sourced from a specific type of wasp treats influenza.
c The medicine that treats meningitis was approved sometime before Favolin.
d Zednisen isn't used to combat heart disease.
e Hamzell isn't used to combat arthritis.
f The pharmaceutical approved in January isn't sourced from a bromeliad.
g The drug that treats meningitis was approved sometime before Bizolam.
h Hamzell isn't used to combat heart disease.
i The six drugs are Favolin, the medicine that treats heart disease, the pharmaceutical approved in June, the pharmaceutical approved in May, the drug that treats diabetes and the medicine approved in January.
j Of Minitrell and the medicine sourced from a specific type of palm tree, one was
approved in June and the other treats asthma.
k The drug sourced from a specific type of bromeliad was approved sometime before the drug that treats heart disease.
l The pharmaceutical sourced from a specific type of fig orchid was approved month after the medicine that treats influenza.
Hints: I find these problems easier to debug with a rule like
SolutionDCMS : drugD conditionDC monthDM sourceDS
Here name is the base predicate essentially the relational table key if you know relational databases and a dlv invocation like
dlv nofacts filterSolution taxi.txt
gives the solutions you have so far. The choice of base predicate primary key: drug, condition, etc. is something you should think about how easily to encode the facts you have
You may need to do math in a rule. Math can only occur in the premisebody You also need to set an upper bound of integers.
#maxint
agebill
agegary
next line says The total of Bill & Garys ages must be over
: agebillBA agegaryGA TOTALBAGA TOTAL
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
