# Bonus Challenge: Integer Arithmetics in Prolog

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

Bonus Challenge: Integer Arithmetics in Prolog
In the SWISH-notebook https://swish.swi-prolog.org/p/Tutorial%201%20FAU%20AI%201.swinb you can find an implementation of the integers suggested by a student.

Challenge: Fix the implementation so that ?int(p(s(zero)) returns true (10 Bonus Bonus Points). Define addition and multiplication for both naturals and integers (10 Bonus Bonus Points). Hint: part of the problem is that Prolog interprets p in the argument of neg as a function as opposed to the predicate p defined above (note that p is marked red for “not called”). To remedy this you may have to look into how to define higher-order predicates or meta-predicates in Prolog.

Rules:

You may work on the challenges alone or in a group. Groups of up to 3 may work on the challenges. Every member of a group gets the full amount of points. Maximally 3 submitted solutions can get points. First come, first serve.

Bonus Bonus Points are added to your Bonus Points but do not count towards the total of achievable bonus points:

ratio of bonus points = min((bonus points+bonus bonus points)/bonus points,1)

In other words you can make up for missed bonus points but not get more than 100% of the bonus points.

Be warned, I don’t usually know the solution to a challenge so their difficulty may range from trivial to impossible or the question may not even be well-defined. In that case, if you provide a good explanation why the problem is hard/impossible, I may still give you the bonus points.

Unfortunately is the Website: https://swish.swi-prolog.org not available since a week.
Maybe you could reupload the Challange again.

Edit: its working again.

Yes, unfortunately it has been offline intermittently. In light of this in my tutorial I have already retracted my recommendation to use it for homework.

I didnt see this thread until now. I guess there are more than three submissions by now or is it still possible to submit this bonus challenge? (How can one know if its still possible? Will it be written here?)

I also can not find a note on where to submit bonus challenges.

So far I have received zero submissions. I will update the thread when I get one. Submission is through email to me.