Note, the prolog files that I refer to are in 3342mindmaps160204.tar unless otherwise noted. I assume people can download such a tar file by just clicking on it in their web browser. If not, email me and I can put a copy up on gaul as well.
Note also, you don't have to process these in order (usually it is obvious which ones don't build on what came before).
[readFileToList]. readFileToList('inputFile', List), writeListToFile(List, 'outputFile').
[readFileToList]. copyFileToFile('inputFile', 'outputFile').
[reduceV1]. [yourExample]. yourExample(Formula), formalize(Formula, Formal), reduction(Formal, Result).The idea is that the file youExample.pl would follow the approach taken in lambdaTask1.pl to define the predicate ex16d whose one argument is bound to the structure that you want to process.
[reduceV1]. [yourExample]. yourExample(Formula), formalize2(Formula, Formal), reduction(Formal, Result).Note that with these two rules together, we can work Exhibit 4.12 completely. Using the approach to handling = shown in ex4p16b.pl, one should be able to test the reductions discussed in Exhibit 4.17, 4.18, 4.19, and 4.20.
[yourcode]. phrase(expr, "(1+2)-3-4-5+6").should succeed, but invalid formula like "3--4" should fail.
[yourcode]. phrase(expr(X), "(1+2)-3-4-5+6").should bind -3 to X.
[yourcode]. X isFirstOf [3, 4, 9].and X becomes bound to the first element of the list (in this case, 3).
[yourcode]. X isFirstOf 3 and 4 and 9.and X becomes bound to the first element of the list (in this case, 3). Note: we want to handle lists of any length.
[yourcode]. firstOf 3 and 4 and 9 and 15 and 23 wouldBe X.and X becomes bound to the first element of the list (in this case, 3).
[yourcode]. firstOf of 3 and 4 and 9 and 15 would be X.and X becomes bound to the first element of the list (in this case, 3).
[yourcode]. the 2 nd of 3 and 4 and 9 and 23 and 15 and 17 would be X.and X becomes bound to the second element of the list (in this case, 4). We would also like this to work for 1 st, 3 rd, 4 th, 5 th, etc. by allowing nd, st, rd, and th to all behave the same (leaving it up to the user to pick the one that reads right)..