5

  • Write a Prolog predicate, s_number(X), which is true when X is a valid number. For example:
    ?- s_number(s(s(0)).
    true.
    

    Answer:

    s_number(0).
    s_number(s(X)) :-
        s_number(X).