Artificial Intelligence
Homework #2
Exploring Prolog
Due: March 21
Please turn in a printed listing of your Prolog clauses and a sample run of the execution testing your program. No email is necessary.
A(m, n) | n + 1 | m == 0, |
A(m-1, 1) | m > 0, n == 0 | |
A(m-1, A(m, n-1)) | otherwise |
Constants: | ||
executive_arm | legislative_arm | judicial_arm |
president | congress | supreme_court |
vice_president | senate | house_of_representatives |
courts_of_appeal | dept_of_treasury | dept_of_state |
budget | bills | laws |
veto | suits | override |
sec_of_state | sec_of_treasury | |
Relations: | ||
head_of | has_veto_power_over | has_review_power_over |
can_override_veto_by | must_initiate | can_impeach |
can_invalidate | is_apart_of | reports_to |
Construct Prolog queries interpreting the following questions
Point(X, Y)
Seg( P1, P2 )
Vertical( Seg( P1, P2 ))
Horizontal( Seg( P1, P2 ))
Rectangle( P1, P2, P3, P4 )
Triangle( P1, P2, P3 )
Regular( R )