Welcome to SWI-Prolog (threaded, 64 bits, version 8.4.2) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit https://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- ERROR: source_sink `'/home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro'' does not exist ERROR: In: ERROR: [23] throw(error(existence_error(source_sink,'/home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro'),_10868)) ERROR: [19] '$resolve_source_path'('/home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro',_10900,[expand(false),...]) at /usr/lib/swi-prolog/boot/init.pl:2428 ERROR: [18] '$load_file_e'('/home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro',user,[expand(false),...]) at /usr/lib/swi-prolog/boot/init.pl:2404 ERROR: [17] '$load_file'('/home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro',user,[expand(false),...]) at /usr/lib/swi-prolog/boot/init.pl:2373 ERROR: [9] toplevel_call(user:user: ...) at /usr/lib/swi-prolog/boot/toplevel.pl:1158 ERROR: ERROR: Note: some frames are missing due to last-call optimization. ERROR: Re-run your program in debug mode (:- debug.) to get more detail. ?- john = john. true. ?- john = mary. false. ?- X = john. X = john. ?- john = john, mary = mary. true. ?- john = john, peter = mary. false. ?- X = john, X = mary. false. ?- X = john, Y = mary. X = john, Y = mary. ?- X = Y, X = john. X = Y, Y = john. ?- X = Y, X = john, Y = Z, Z = T, T = mary. false. ?- Y = promote(X), X = john. Y = promote(john), X = john. ?- Y = promote(promote(X)), Z = promote(T), Y = Z. Y = Z, Z = promote(promote(X)), T = promote(X). ?- true. ?- man(john). true. ?- man(mary). false. ?- true. ?- woman(mary). true. ?- man(john). true. ?- woman(john). false. ?- X = man(john). X = man(john). ?- man(X). X = john. ?- true. ?- man(X). X = john ?- man(X). X = john ; X = peter. ?- man(X), man(Y), woman(Z) | . X = Y, Y = john, Z = mary ; X = john, Y = peter, Z = mary ; X = peter, Y = john, Z = mary ; X = Y, Y = peter, Z = mary. ?- man(X), man(Y), X /= Y, woman(Z). ERROR: Syntax error: Operator expected ERROR: man(X), man(Y), X ERROR: ** here ** ERROR: /= Y, woman(Z) . ?- man(X), man(Y), X \= Y, woman(Z). X = john, Y = peter, Z = mary ; X = peter, Y = john, Z = mary ; false. ?- X \= Y. false. ?- 4 = 1 + 3 | . false. ?- 4 = 1 + 3. false. ?- Warning: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:5: Warning: Singleton variables: [X] Warning: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:5: Warning: Clauses of man/1 are not together in the source-file Warning: Earlier definition at /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:1 Warning: Current predicate: woman/1 Warning: Use :- discontiguous man/1. to suppress this message true. ?- man(X). X = john ; X = peter ; true. ?- loves(john, mary). ERROR: Unknown procedure: loves/2 (DWIM could not correct goal) ?- true. ?- loves(john, mary). true. ?- loves(john, X). X = wine ; X = john ; X = mary ; false. ?- loves(X, mary). X = john. ?- loves(X, john). X = john ; false. ?- loves(X, Y). ?- loves(X, john). X = john ; X = john. ?- ?- loves(X, Y). ERROR: Unknown procedure: (?-)/1 ERROR: ?- is the Prolog prompt ERROR: See FAQ at https://www.swi-prolog.org/FAQ/ToplevelMode.txt ERROR: In: ERROR: [9] throw(error(existence_error(procedure,...),_7664)) ERROR: [6] correct_goal((?-loves(_7708,_7710)),user,['X'=_7722,...],_7700) at /usr/lib/swi-prolog/boot/dwim.pl:92 ERROR: ERROR: Note: some frames are missing due to last-call optimization. ERROR: Re-run your program in debug mode (:- debug.) to get more detail. ?- true. ?- loves(X, Y). ERROR: Unknown procedure: (?-)/1 ERROR: ?- is the Prolog prompt ERROR: See FAQ at https://www.swi-prolog.org/FAQ/ToplevelMode.txt ERROR: In: ERROR: [9] throw(error(existence_error(procedure,...),_4100)) ERROR: [6] correct_goal((?-loves(_4144,_4146)),user,['X'=_4158,...],_4136) at /usr/lib/swi-prolog/boot/dwim.pl:92 ERROR: ERROR: Note: some frames are missing due to last-call optimization. ERROR: Re-run your program in debug mode (:- debug.) to get more detail. ?- loves(X, Y). X = john, Y = wine ; X = mary, Y = wine ; X = Y, Y = john ; X = john, Y = mary ; false. ?- true. ?- loves(X, Y). X = john, Y = wine ; X = mary, Y = wine ; X = Y, Y = john ; X = john, Y = mary ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ; X = Y, Y = john ?- loves(john, beer). false. ?- not(loves(john, beer)). true. ?- true. ?- loves(X, Y). X = john, Y = wine ; X = mary, Y = wine ; ERROR: Stack limit (1.0Gb) exceeded ERROR: Stack sizes: local: 0.9Gb, global: 46.2Mb, trail: 46.2Mb ERROR: Stack depth: 6,053,017, last-call: 0%, Choice points: 6,053,010 ERROR: Possible non-terminating recursion: ERROR: [6,053,017] user:loves(_12113960, _12113962) ERROR: [6,053,016] user:loves(john, _12113982) Exception: (6,053,016) loves(_12113890, _12113892) ? x ERROR: Unknown option (h for help) Exception: (6,053,016) loves(_12113890, _12113892) ? a % Execution Aborted ?- C-c C-c Action (h for help) ? a abort % Execution Aborted ?- true. ?- nat(s(s(s(o)))). true. ?- nat(X). X = o ; X = s(o) ; X = s(s(o)) ; X = s(s(s(o))) ; X = s(s(s(s(o)))) ; X = s(s(s(s(s(o))))) ; X = s(s(s(s(s(s(o)))))) ?- nat(X), nat(Y), X = s(Y). C-c C-cAction (h for help) ? a abort % Execution Aborted ?- nat(X), nat(Y). X = Y, Y = o ; X = o, Y = s(o) ; X = o, Y = s(s(o)) ; X = o, Y = s(s(s(o))) ; X = o, Y = s(s(s(s(o)))) ; X = o, Y = s(s(s(s(s(o))))) ; X = o, Y = s(s(s(s(s(s(o)))))) ; X = o, Y = s(s(s(s(s(s(s(o))))))) ?- true. ?- add(s(o), s(o), s(s(o))). true. ?- add(s(o), s(o), s(s(s(o)))). false. ?- add(s(o), s(s(o)), X). X = s(s(s(o))). ?- add(s(o), X, s(s(s(o)))). X = s(s(o)). ?- add(X, s(o), s(s(s(o)))). X = s(s(o)) ; false. ?- add(X, Y, s(s(s(o)))). X = o, Y = s(s(s(o))) ; X = s(o), Y = s(s(o)) ; X = s(s(o)), Y = s(o) ; X = s(s(s(o))), Y = o ; false. ?- add(X, Y, Z). X = o, Y = Z ; X = s(o), Z = s(Y) ; X = s(s(o)), Z = s(s(Y)) ; X = s(s(s(o))), Z = s(s(s(Y))) ; X = s(s(s(s(o)))), Z = s(s(s(s(Y)))) ; X = s(s(s(s(s(o))))), Z = s(s(s(s(s(Y))))) ; X = s(s(s(s(s(s(o)))))), Z = s(s(s(s(s(s(Y)))))) ; X = s(s(s(s(s(s(s(o))))))), Z = s(s(s(s(s(s(s(Y))))))) ; X = s(s(s(s(s(s(s(s(o)))))))), Z = s(s(s(s(s(s(s(s(Y)))))))) ; X = s(s(s(s(s(s(s(s(s(o))))))))), Z = s(s(s(s(s(s(s(s(s(Y))))))))) ; X = s(s(s(s(s(s(s(s(s(s(...)))))))))), Z = s(s(s(s(s(s(s(s(s(s(...)))))))))) ; X = s(s(s(s(s(s(s(s(s(s(...)))))))))), Z = s(s(s(s(s(s(s(s(s(s(...)))))))))) ?- [1|[2|[3|[]]]] | C-c C-c Action (h for help) ? a abort % Execution Aborted ?- X = [1|[2|[3|[]]]]. X = [1, 2, 3]. ?- true. ?- Warning: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:21: Warning: Singleton variables: [X] true. ?- true. ?- member(1, [1,1,2]). true ; false. ?- member(1, [1,2]). false. ?- true. ?- member(1, [1,2]). true ; false. ?- member(X, [1, 2, 3]). X = 1 ; X = 2 ; X = 3 ; false. ?- member(1, X). X = [1|_] ; X = [_, 1|_] ; X = [_, _, 1|_] ; X = [_, _, _, 1|_] ; X = [_, _, _, _, 1|_] ; X = [_, _, _, _, _, 1|_] ; X = [_, _, _, _, _, _, 1|_] ; X = [_, _, _, _, _, _, _, 1|_] ; X = [_, _, _, _, _, _, _, _, 1|...] ; X = [_, _, _, _, _, _, _, _, _|...] ; X = [_, _, _, _, _, _, _, _, _|...] ?- member(1, [1,1,1]). true ; true ; true ; false. ?- true. ?- member(1, [1,1,1]). true ; false. ?- true. ?- member(1, [1,1,1]). true. ?- true. ?- true. ?- ERROR: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:24: ERROR: op/3: Type error: `atom' expected, found `130' (an integer) Warning: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:24: Warning: Goal (directive) failed: user:op(∈,130,xfx) true. ?- ERROR: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:24: ERROR: op/3: Type error: `integer' expected, found `∈' (an atom) Warning: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:24: Warning: Goal (directive) failed: user:op(∈,xfx,130) true. ?- ERROR: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:24: ERROR: op/3: Domain error: `operator_specifier' expected, found `∈' Warning: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:24: Warning: Goal (directive) failed: user:op(130,∈,xfx) true. ?- true. ?- true. ?- X ∈ [1, 2, 3]. X = 1 ; X = 2 ; X = 3 ; false. ?- Warning: /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/typeinf.pro:21: Warning: Redefined static procedure (∈)/2 Warning: Previously defined at /home/trifon/fmisync/Courses/2022_23/LCPT_2022_23/sandbox/primer.pro:26 true. ?- true. ?- true. ?- true. ?-