...@...:~/Desktop/cog366/sets/v3$ swipl Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.0-rc2) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit http://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- consult('crypto.pro'). true. ?- crypto(1,2,3,X). X = ex(1, +, 2) ; false. ?- crypto(1,2,3,4,X). X = ex(3, -, ex(1, -, 2)) ; X = ex(3, +, ex(1, -, 2)) ; X = ex(1, -, ex(2, +, 3)) ; X = ex(2, -, ex(1, -, 3)) ; X = ex(ex(1, -, 3), +, 2) ; X = ex(2, +, ex(1, -, 3)) ; X = ex(ex(1, -, 3), *, 2) ; X = ex(2, *, ex(1, -, 3)) ; false. ?- crypto(1,3,3,5,4,X). X = ex(ex(1, +, 3), -, ex(3, +, 5)) ; X = ex(3, +, ex(5, -, ex(1, +, 3))) ; X = ex(3, -, ex(5, -, ex(1, +, 3))) ; X = ex(5, +, ex(3, -, ex(1, +, 3))) ; X = ex(5, -, ex(3, -, ex(1, +, 3))) ; X = ex(5, -, ex(ex(1, *, 3), *, 3)) ; X = ex(5, -, ex(3, *, ex(1, *, 3))) ; X = ex(5, -, ex(ex(1, *, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, *, 3))) ; X = ex(5, -, ex(ex(1, *, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, *, 3))) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(ex(1, -, 3), -, ex(3, -, 5)) ; X = ex(3, -, ex(5, -, ex(1, -, 3))) ; X = ex(5, -, ex(3, +, ex(1, -, 3))) ; X = ex(ex(1, -, 3), /, ex(3, +, 5)) ; X = ex(ex(1, -, 3), -, ex(3, -, 5)) ; X = ex(ex(3, -, 5), +, ex(1, -, 3)) ; X = ex(ex(1, -, 3), +, ex(3, -, 5)) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(3, -, ex(5, +, ex(1, -, 3))) ; X = ex(5, -, ex(3, -, ex(1, -, 3))) ; X = ex(5, +, ex(3, -, ex(1, -, 3))) ; X = ex(5, -, ex(ex(1, /, 3), *, 3)) ; X = ex(5, -, ex(3, *, ex(1, /, 3))) ; X = ex(5, -, ex(ex(1, /, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, /, 3))) ; X = ex(5, -, ex(ex(1, /, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, /, 3))) ; X = ex(ex(1, +, 3), -, ex(3, +, 5)) ; X = ex(3, +, ex(5, -, ex(1, +, 3))) ; X = ex(3, -, ex(5, -, ex(1, +, 3))) ; X = ex(5, +, ex(3, -, ex(1, +, 3))) ; X = ex(5, -, ex(3, -, ex(1, +, 3))) ; X = ex(5, -, ex(ex(1, *, 3), *, 3)) ; X = ex(5, -, ex(3, *, ex(1, *, 3))) ; X = ex(5, -, ex(ex(1, *, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, *, 3))) ; X = ex(5, -, ex(ex(1, *, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, *, 3))) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(ex(1, -, 3), -, ex(3, -, 5)) ; X = ex(3, -, ex(5, -, ex(1, -, 3))) ; X = ex(5, -, ex(3, +, ex(1, -, 3))) ; X = ex(ex(1, -, 3), /, ex(3, +, 5)) ; X = ex(ex(1, -, 3), -, ex(3, -, 5)) ; X = ex(ex(3, -, 5), +, ex(1, -, 3)) ; X = ex(ex(1, -, 3), +, ex(3, -, 5)) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(3, -, ex(5, +, ex(1, -, 3))) ; X = ex(5, -, ex(3, -, ex(1, -, 3))) ; X = ex(5, +, ex(3, -, ex(1, -, 3))) ; X = ex(5, -, ex(ex(1, /, 3), *, 3)) ; X = ex(5, -, ex(3, *, ex(1, /, 3))) ; X = ex(5, -, ex(ex(1, /, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, /, 3))) ; X = ex(5, -, ex(ex(1, /, 3), /, 3)) ; X = ex(5, -, ex(3, /, ex(1, /, 3))) ; X = ex(ex(1, *, 5), -, ex(3, *, 3)) ; X = ex(ex(1, *, 5), -, ex(3, /, 3)) ; X = ex(ex(1, *, 5), -, ex(3, /, 3)) ; X = ex(ex(1, -, 5), -, ex(3, -, 3)) ; X = ex(ex(1, -, 5), -, ex(3, -, 3)) ; X = ex(3, -, ex(3, +, ex(1, -, 5))) ; X = ex(3, -, ex(3, -, ex(1, -, 5))) ; X = ex(3, -, ex(3, +, ex(1, -, 5))) ; X = ex(3, -, ex(3, -, ex(1, -, 5))) ; X = ex(ex(1, -, 5), +, ex(3, -, 3)) ; X = ex(ex(1, -, 5), -, ex(3, -, 3)) ; X = ex(ex(1, -, 5), +, ex(3, -, 3)) ; X = ex(ex(1, -, 5), -, ex(3, -, 3)) ; X = ex(ex(1, -, 5), *, ex(3, /, 3)) ; X = ex(ex(1, -, 5), /, ex(3, /, 3)) ; X = ex(ex(1, -, 5), *, ex(3, /, 3)) ; X = ex(ex(1, -, 5), /, ex(3, /, 3)) ; X = ex(3, -, ex(3, +, ex(1, -, 5))) ; X = ex(3, /, ex(3, *, ex(1, -, 5))) ; X = ex(3, -, ex(3, -, ex(1, -, 5))) ; X = ex(3, +, ex(3, -, ex(1, -, 5))) ; X = ex(3, -, ex(3, +, ex(1, -, 5))) ; X = ex(3, /, ex(3, *, ex(1, -, 5))) ; X = ex(3, -, ex(3, -, ex(1, -, 5))) ; X = ex(3, +, ex(3, -, ex(1, -, 5))) ; X = ex(ex(1, /, 5), -, ex(3, *, 3)) ; X = ex(ex(1, /, 5), -, ex(3, /, 3)) ; X = ex(ex(1, /, 5), -, ex(3, /, 3)) ; X = ex(ex(3, *, 3), -, ex(1, *, 5)) ; X = ex(ex(3, *, 3), -, ex(1, /, 5)) ; X = ex(1, *, ex(5, -, ex(3, *, 3))) ; X = ex(1, /, ex(5, -, ex(3, *, 3))) ; X = ex(5, -, ex(1, *, ex(3, *, 3))) ; X = ex(5, -, ex(1, /, ex(3, *, 3))) ; X = ex(ex(3, -, 3), -, ex(1, -, 5)) ; X = ex(ex(3, -, 3), +, ex(1, -, 5)) ; X = ex(ex(3, -, 3), -, ex(1, -, 5)) ; X = ex(1, -, ex(5, +, ex(3, -, 3))) ; X = ex(1, -, ex(5, -, ex(3, -, 3))) ; X = ex(5, -, ex(1, +, ex(3, -, 3))) ; X = ex(5, -, ex(1, -, ex(3, -, 3))) ; X = ex(5, +, ex(1, -, ex(3, -, 3))) ; X = ex(ex(3, -, 3), -, ex(1, -, 5)) ; X = ex(ex(3, -, 3), +, ex(1, -, 5)) ; X = ex(ex(3, -, 3), -, ex(1, -, 5)) ; X = ex(1, -, ex(5, +, ex(3, -, 3))) ; X = ex(1, -, ex(5, -, ex(3, -, 3))) ; X = ex(5, -, ex(1, +, ex(3, -, 3))) ; X = ex(5, -, ex(1, -, ex(3, -, 3))) ; X = ex(5, +, ex(1, -, ex(3, -, 3))) ; X = ex(ex(3, /, 3), -, ex(1, *, 5)) ; X = ex(1, -, ex(ex(3, /, 3), *, 5)) ; X = ex(ex(3, /, 3), *, ex(1, -, 5)) ; X = ex(1, *, ex(ex(3, /, 3), -, 5)) ; X = ex(ex(3, /, 3), /, ex(1, -, 5)) ; X = ex(1, /, ex(ex(3, /, 3), -, 5)) ; X = ex(ex(3, /, 3), -, ex(1, /, 5)) ; X = ex(1, -, ex(ex(3, /, 3), /, 5)) ; X = ex(ex(3, /, 3), -, ex(5, *, 1)) ; X = ex(1, -, ex(5, *, ex(3, /, 3))) ; X = ex(ex(3, /, 3), *, ex(5, -, 1)) ; X = ex(1, *, ex(5, -, ex(3, /, 3))) ; X = ex(ex(3, /, 3), /, ex(5, -, 1)) ; X = ex(1, /, ex(5, -, ex(3, /, 3))) ; X = ex(ex(3, /, 3), -, ex(5, /, 1)) ; X = ex(1, -, ex(5, /, ex(3, /, 3))) ; X = ex(5, -, ex(ex(3, /, 3), *, 1)) ; X = ex(5, -, ex(1, *, ex(3, /, 3))) ; X = ex(5, -, ex(ex(3, /, 3), /, 1)) ; X = ex(5, -, ex(1, /, ex(3, /, 3))) ; X = ex(5, -, ex(ex(3, /, 3), /, 1)) ; X = ex(5, -, ex(1, /, ex(3, /, 3))) ; X = ex(ex(3, /, 3), -, ex(1, *, 5)) ; X = ex(1, -, ex(ex(3, /, 3), *, 5)) ; X = ex(ex(3, /, 3), *, ex(1, -, 5)) ; X = ex(1, *, ex(ex(3, /, 3), -, 5)) ; X = ex(ex(3, /, 3), /, ex(1, -, 5)) ; X = ex(1, /, ex(ex(3, /, 3), -, 5)) ; X = ex(ex(3, /, 3), -, ex(1, /, 5)) ; X = ex(1, -, ex(ex(3, /, 3), /, 5)) ; X = ex(ex(3, /, 3), -, ex(5, *, 1)) ; X = ex(1, -, ex(5, *, ex(3, /, 3))) ; X = ex(ex(3, /, 3), *, ex(5, -, 1)) ; X = ex(1, *, ex(5, -, ex(3, /, 3))) ; X = ex(ex(3, /, 3), /, ex(5, -, 1)) ; X = ex(1, /, ex(5, -, ex(3, /, 3))) ; X = ex(ex(3, /, 3), -, ex(5, /, 1)) ; X = ex(1, -, ex(5, /, ex(3, /, 3))) ; X = ex(5, -, ex(ex(3, /, 3), *, 1)) ; X = ex(5, -, ex(1, *, ex(3, /, 3))) ; X = ex(5, -, ex(ex(3, /, 3), /, 1)) ; X = ex(5, -, ex(1, /, ex(3, /, 3))) ; X = ex(5, -, ex(ex(3, /, 3), /, 1)) ; X = ex(5, -, ex(1, /, ex(3, /, 3))) ; X = ex(ex(3, +, 5), -, ex(1, +, 3)) ; X = ex(ex(3, +, 5), /, ex(1, -, 3)) ; X = ex(1, -, ex(3, -, ex(3, +, 5))) ; X = ex(3, -, ex(1, -, ex(3, +, 5))) ; X = ex(1, -, ex(3, /, ex(3, *, 5))) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(ex(3, -, 5), -, ex(1, -, 3)) ; X = ex(1, -, ex(3, -, ex(3, -, 5))) ; X = ex(3, -, ex(1, +, ex(3, -, 5))) ; X = ex(ex(3, -, 5), -, ex(1, -, 3)) ; X = ex(ex(1, -, 3), +, ex(3, -, 5)) ; X = ex(ex(3, -, 5), +, ex(1, -, 3)) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(1, -, ex(3, +, ex(3, -, 5))) ; X = ex(3, -, ex(1, -, ex(3, -, 5))) ; X = ex(3, +, ex(1, -, ex(3, -, 5))) ; X = ex(ex(3, +, 5), -, ex(1, +, 3)) ; X = ex(ex(3, +, 5), /, ex(1, -, 3)) ; X = ex(1, -, ex(3, -, ex(3, +, 5))) ; X = ex(3, -, ex(1, -, ex(3, +, 5))) ; X = ex(1, -, ex(3, /, ex(3, *, 5))) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(ex(3, -, 5), -, ex(1, -, 3)) ; X = ex(1, -, ex(3, -, ex(3, -, 5))) ; X = ex(3, -, ex(1, +, ex(3, -, 5))) ; X = ex(ex(3, -, 5), -, ex(1, -, 3)) ; X = ex(ex(1, -, 3), +, ex(3, -, 5)) ; X = ex(ex(3, -, 5), +, ex(1, -, 3)) ; X = ex(ex(1, -, 3), *, ex(3, -, 5)) ; X = ex(ex(3, -, 5), *, ex(1, -, 3)) ; X = ex(1, -, ex(3, +, ex(3, -, 5))) ; X = ex(3, -, ex(1, -, ex(3, -, 5))) ; X = ex(3, +, ex(1, -, ex(3, -, 5))) ; false. ?- crypto(10,14,15,3,5,6,X). X = ex(3, /, ex(6, -, ex(ex(15, -, 5), +, 14))) ; X = ex(3, *, ex(6, +, ex(ex(15, -, 5), -, 14))) ; X = ex(3, *, ex(6, -, ex(ex(15, -, 5), -, 14))) ; X = ex(3, *, ex(ex(15, -, 5), /, ex(14, +, 6))) ; X = ex(3, /, ex(ex(15, -, 5), +, ex(14, -, 6))) ; X = ex(3, *, ex(ex(15, -, 5), -, ex(14, -, 6))) ; X = ex(3, *, ex(ex(15, -, 5), +, ex(14, -, 6))) ; X = ex(3, /, ex(ex(15, -, 5), -, ex(14, -, 6))) ; X = ex(3, *, ex(14, -, ex(ex(15, -, 5), +, 6))) ; X = ex(3, /, ex(14, +, ex(ex(15, -, 5), -, 6))) ; X = ex(3, /, ex(14, -, ex(ex(15, -, 5), -, 6))) ; false. ?-