/*** SAMPLE QUERIES for the Prolog program in Listing 2 accompanying ******/ /* "Logic-Programming Models of Music: A Semiotic Evaluation" */ /* John Roeder, Perspectives of New Music 57/1-2 (2019): 375-402. */ /* After loading Listing 2 into SWISH, each of the queries below may be posed */ /* by copying it from this file and entering it in the lower right SWISH pane. */ /*****************************************************************************/ /* To test Rahn's definition VC for the events of his Ex. 5 and the cyclic ordering c_major_scale = [0,2,4,5,7,9,11,0], enter the query: neighbors_with_respect_to(X, Y, Type). */ /*****************************************************************************/ /* To test Rahn's definition VIC for the events of his Ex. 5 and the cyclic ordering c_major_scale = [0,2,4,5,7,9,11,0], enter the query: nc_prolong(X, Y, Z, _). The answers will list all pairs of neighbors X and Y, and the note Z that those X and Y prolong. */ /*****************************************************************************/ /* To test Rahn's definition VII for the events of his Ex. 5 enter the query: arp_prolongs(A,B). The answers will list pairs of note-sets A and B such that A arp-prolongs B */ /*****************************************************************************/ /* Definition VIII, next_background, is the key definition in Rahn's system. /* It relies on a predicate one_to_one_correspondence that relates each element of a partition of a more foreground level to an element of a more background level */ /* BIG TEST 1: The following query finds such a more background partition for a given foreground partition (corresponding to Rahn's Ex. 5a). Enter the entire construction below into the SWISH query pane: Foreground_partition = [[note(36,[0,3]), note(35,[3,4])], [note(36,[4,8])], [note(s,[0,1]), note(48,[1,2]), note(43,[1,2]), note(40,[2,3]), note(s,[3,4])], [note(43,[4,5]), note(48,[5,6]), note(52,[6,7]), note(s,[7,8])]], one_to_one_correspondence(Middleground_partition, Foreground_partition). See the accompanying article for commentary.*/ /***** BIG TEST 2: For a preliminary test of Rahn's Definition VIII, we provide the same foreground partition as just above. We then invoke the predicate one_to_one_correspondence TWICE to generate two more background levels. Enter the entire 7-line construction below into the SWISH query pane: Example_5a = [[note(36,[0,3]), note(35,[3,4])], [note(36,[4,8])], [note(s,[0,1]), note(48,[1,2]), note(43,[1,2]), note(40,[2,3]), note(s,[3,4])], [note(43,[4,5]), note(48,[5,6]), note(52,[6,7]), note(s,[7,8])]], one_to_one_correspondence(Example_5b, Example_5a), partition(Example_5b, S), one_to_one_correspondence(Example_5c,[S]). See the accompanying article for commentary; the query proves that Rahn's examples satisfy his definitions. */ /**** BIG TEST 3 directly invokes Definition VIII. ************ We provide the query with a list of events Rahn shows in Ex. 5b and with the list of events in Ex. 5a. The former should be a valid background of the latter. To test that, paste these 7 lines into the query pane: next_background( [note(36, [0, 4]), note(36, [4, 8]), note(48, [0, 4]), note(43, [0, 4]), note(40, [0, 4]), note(43, [4, 8]), note(48, [4, 8]), note(52, [4, 8])], [note(36,[0,3]), note(35,[3,4]), note(36,[4,8]), note(s,[0,1]), note(48,[1,2]), note(43,[1,2]), note(40,[2,3]), note(s,[3,4]), note(43,[4,5]), note(48,[5,6]), note(52,[6,7]), note(s,[7,8])]). **** The interpreter will take a while to respond, since it needs to try out a multitude of partitions of the given Foreground and Background. But eventually it answers: true (!) *************************************/ /***** BIG TEST 4: The same as BIG TEST 2, above, but now showing (with reference to Example 8 in the article) that other, less intuitive level analyses of Example 5a are equally valid. Paste these 7 lines into the query pane: Example_8a = [[note(36,[0,3]), note(s,[0,1]), note(43,[1,2]),note(40,[2,3]), note(48,[5,6])], [note(48,[1,2]), note(s,[3,4]), note(43,[4,5]), note(52,[6,7]), note(s,[7,8])], [note(35,[3,4]), note(36,[4,8])]], one_to_one_correspondence(Example_8b, Example_8a), partition(Example_8b, S), one_to_one_correspondence(Example_8c,[S]). The answer to the query will display lists of events that correspond to the staves of Example 8. ******************************************************************************************************/