multiplication - Prolog, check divisibility in Peano arithmetic -


i need check if first given term (for example s(s(nul)) (or 2)) dividable second term, (for example s(nul) (or 1)).

what want multiply given term 2 , check if term smaller or equal other term (if equal - problem solved).

so far got this:

checkingifdividable(x,x). checkingifdividable(x,y) :-     x > y,     multiplication(x,y).  /* multiplication 2 should occur here.     can't figure out. solution not work!*/ multiplication(y):-     yy y * 2,     checkingifdividable(x,yy). 

i can't seem figure out how multiply term 2. ideas?

if a = n*b, n > 0, a = n*b = (1+m)*b = b + m*b, m >= 0.

so if a dividable b, , a = b+x, x dividable b.

in peano encoding, n = 1+m written n = s(m).

take here.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -