key_type(white).
key_type(black).
key_color(c, white).
next_white_key(c, d).
next_white_key(d, e).
next_white_key(e, f).
next_white_key(f, g).
next_white_key(g, a).
next_white_key(a, b).
next_white_key(b, c).
semitone_gap(e, f, 1).
semitone_gap(b, c, 1).
semitone_gap(X, Y, 2) :-
next_white_key(X, Y),
X \= e,
X \= b.
has_black_key_between(X, Y) :-
next_white_key(X, Y),
semitone_gap(X, Y, 2).
octave_size(12).
total_keys(88).
style(jazz) :-
wrong_notes > 0,
write('All wrong notes are now intentional').
what are piano axioms? online searching only leads me to https://en.wikipedia.org/wiki/Peano_axioms?wprov=sfti1#
They’re being defined right in this post. 🙃
Prolog is a language that allows you to specify a whole bunch of rules/axioms and then you can query logical conclusions that can be made from these.
If you go to https://swish.swi-prolog.org/ and click on “Create a [Program]”, then paste the post text on the left side (without the Theorem 1, as that one doesn’t compile), then you can query it in the bottom right.
For example, if you ask it between which keys there’s a gap of just 1 semitone:
?- semitone_gap(X, Y, 1)
Then it will first tell you that X=e & Y=f, as the first possible solution. Then you can click “Next” and it’ll tell you another solution is X=b & Y=c.
Just a joke on what makes a piano, i suppose the pun is intended but Peano’s axiom are famous mathematical axioms.