The Piano Axioms in Prolog
The Piano Axioms in Prolog
prolog
% Piano Axioms % Axiom 1: Law of Excluded Gray key_type(white). key_type(black). % Axiom 2: The C Postulate key_color(c, white). % Axiom 3: The Diatonic Scale 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). % Axiom 4: The Semitone Anomaly semitone_gap(e, f, 1). semitone_gap(b, c, 1). semitone_gap(X, Y, 2) :- next_white_key(X, Y), X \= e, X \= b. % Axiom 5: Black Key Entropy has_black_key_between(X, Y) :- next_white_key(X, Y), semitone_gap(X, Y, 2). % Axiom 6: The "8 is 12" Principle. octave_size(12). % Axiom 7: Out of Bounds Exception total_keys(88). % Theorem 1: Conservation of "Wrong Notes" style(jazz) :- wrong_notes > 0, write('All wrong notes are now intentional').