:- module(lists_g,['lists_g.append.p3.0'/3,'lists_g.append.p3'/3,'lists_g.deleteFirst.p3'/3,'lists_g.deleteFirst.p3.0'/3]).  % converted djd
:- style_check(-singleton). % added djd
%% :- module('lists', []).

:- discontiguous 'lists_g.member.p2.0'/2. %% added djd
:- discontiguous '~lists_g.member.p2.0'/2. %% added djd
:- discontiguous 'lists_g.delete.p3.0'/3. %% added djd
:- discontiguous '~lists_g.delete.p3.0'/3. %% added djd
:- discontiguous 'lists_g.append.p3.0'/3. %% added djd
:- discontiguous '~lists_g.append.p3.0'/3. %% added djd
:- discontiguous 'lists_g.deleteFirst.p3.0'/3. %% added djd
:- discontiguous '~lists_g.deleteFirst.p3.0'/3. %% added djd
:- discontiguous 'lists_g.length.p2.0'/2. %% added djd
:- discontiguous '~lists_g.length.p2.0'/2. %% added djd
:- discontiguous 'lists_g.permutation.p2.0'/2. %% added djd
:- discontiguous '~lists_g.permutation.p2.0'/2. %% added djd
:- discontiguous 'lists_g.merge.p3.0'/3. %% added djd
:- discontiguous '~lists_g.merge.p3.0'/3. %% added djd
:- discontiguous 'lists_g.memberCheck.p2.1'/2. %% added djd
:- discontiguous '~lists_g.memberCheck.p2.1'/2. %% added djd
:- discontiguous 'lists_g.memberCheck.p2.0'/2. %% added djd
:- discontiguous '~lists_g.memberCheck.p2.0'/2. %% added djd
:- discontiguous 'lists_g.partition.p4'/4. %% added djd
:- discontiguous '~lists_g.partition.p4'/4. %% added djd
:- discontiguous 'lists_g.sorted.p1.1'/1. %% added djd
:- discontiguous '~lists_g.sorted.p1.1'/1. %% added djd
:- discontiguous 'lists_g.sorted.p1.0'/1. %% added djd
:- discontiguous '~lists_g.sorted.p1.0'/1. %% added djd
:- discontiguous 'lists_g.sort.p2.0'/2. %% added djd
:- discontiguous '~lists_g.sort.p2.0'/2. %% added djd
:- discontiguous 'lists_g.reverse3.p3'/3. %% added djd
:- discontiguous '~lists_g.reverse3.p3'/3. %% added djd
:- discontiguous 'lists_g.split.p4'/4. %% added djd
:- discontiguous '~lists_g.split.p4'/4. %% added djd




:- op(500, yfx, and).
:- op(400, yfx, or).

'lists_g.member.p2'(A, B) :-
        user:goedel_freeze(nonvar(B), 'lists_g':'lists_g.member.p2.0'(A,B)).
'~lists_g.member.p2'(A, B) :-
        user:goedel_freeze(nonvar(B), 'lists':'~lists_g.member.p2.0'(A,B)).
'lists_g.member.p2.0'(A, [A|_]).
'~lists_g.member.p2.0'(A, [A|_]).
'lists_g.member.p2.0'(A, [_|B]) :-
        'lists_g.member.p2'(A, B).
'~lists_g.member.p2.0'(A, [_|B]) :-
        '~lists_g.member.p2'(A, B).
'lists_g.delete.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(B)or nonvar(C), 'lists_g':'lists_g.delete.p3.0'(A,B,C)).
'~lists_g.delete.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(B)or nonvar(C), 'lists':'~lists_g.delete.p3.0'(A,B,C)).
'lists_g.delete.p3.0'(A, [A|B], B).
'~lists_g.delete.p3.0'(A, [A|B], B).
'lists_g.delete.p3.0'(A, [B|C], [B|D]) :-
        'lists_g.delete.p3'(A, C, D).
'~lists_g.delete.p3.0'(A, [B|C], [B|D]) :-
        '~lists_g.delete.p3'(A, C, D).
'lists_g.append.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)or nonvar(C), 'lists_g':'lists_g.append.p3.0'(A,B,C)).
'~lists_g.append.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)or nonvar(C), 'lists':'~lists_g.append.p3.0'(A,B,C)).
'lists_g.append.p3.0'([], A, A).
'~lists_g.append.p3.0'([], A, A).
'lists_g.append.p3.0'([A|B], C, [A|D]) :-
        'lists_g.append.p3'(B, C, D).
'~lists_g.append.p3.0'([A|B], C, [A|D]) :-
        '~lists_g.append.p3'(B, C, D).
'lists_g.deleteFirst.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)and nonvar(B)or nonvar(C), 'lists_g':'lists_g.deleteFirst.p3.0'(A,B,C)).
'~lists_g.deleteFirst.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)and nonvar(B)or nonvar(C), 'lists':'~lists_g.deleteFirst.p3.0'(A,B,C)).
'lists_g.deleteFirst.p3.0'(A, [A|B], B) :- !.
'~lists_g.deleteFirst.p3.0'(A, [A|B], B).
'lists_g.deleteFirst.p3.0'(A, [B|C], [B|D]) :-
        call_residue(user:not_equal([],[A,B],A,B), E),
        (   E=[] ->
            !
        ;   user:release_suspended(E)
        ),
        'lists_g.deleteFirst.p3'(A, C, D).
'~lists_g.deleteFirst.p3.0'(A, [B|C], [B|D]) :-
        user:not_equal([], [A,B], A, B),
        '~lists_g.deleteFirst.p3'(A, C, D).
'lists_g.length.p2'(A, B) :-
        user:goedel_freeze(nonvar(A)or nonvar(B), 'lists_g':'lists_g.length.p2.0'(A,B)).
'~lists_g.length.p2'(A, B) :-
        user:goedel_freeze(nonvar(A)or nonvar(B), 'lists':'~lists_g.length.p2.0'(A,B)).
'lists_g.length.p2.0'([], 0).
'~lists_g.length.p2.0'([], 0).
'lists_g.length.p2.0'([_|A], B) :-
        'integers':plus(C, 1, B),
        'integers':'integers.>=.p2'(C, 0),
        'lists_g.length.p2'(A, C).
'~lists_g.length.p2.0'([_|A], B) :-
        'integers':plus(C, 1, B),
        'integers':'~integers.>=.p2'(C, 0),
        '~lists_g.length.p2'(A, C).
'lists_g.reverse.p2'(A, B) :-
        user:goedel_freeze(nonvar(A)or nonvar(B), 'lists_g':'lists_g.reverse.p2.0'(A,B)).
'~lists_g.reverse.p2'(A, B) :-
        user:goedel_freeze(nonvar(A)or nonvar(B), 'lists':'~lists_g.reverse.p2.0'(A,B)).
'lists_g.reverse.p2.0'(A, B) :-
        'lists_g.reverse3.p3'(A, [], B).
'~lists_g.reverse.p2.0'(A, B) :-
        '~lists_g.reverse3.p3'(A, [], B).
'lists_g.permutation.p2'(A, B) :-
        user:goedel_freeze(nonvar(A)or nonvar(B), 'lists_g':'lists_g.permutation.p2.0'(A,B)).
'~lists_g.permutation.p2'(A, B) :-
        user:goedel_freeze(nonvar(A)or nonvar(B), 'lists':'~lists_g.permutation.p2.0'(A,B)).
'lists_g.permutation.p2.0'([], []).
'~lists_g.permutation.p2.0'([], []).
'lists_g.permutation.p2.0'([A|B], [C|D]) :-
        'lists_g.delete.p3'(C, [A|B], E),
        'lists_g.permutation.p2'(E, D).
'~lists_g.permutation.p2.0'([A|B], [C|D]) :-
        '~lists_g.delete.p3'(C, [A|B], E),
        '~lists_g.permutation.p2'(E, D).
'lists_g.merge.p3'(A, B, C) :-
        user:goedel_freeze((nonvar(A)and nonvar(B))or nonvar(C), 'lists_g':'lists_g.merge.p3.0'(A,B,C)).
'~lists_g.merge.p3'(A, B, C) :-
        user:goedel_freeze((nonvar(A)and nonvar(B))or nonvar(C), 'lists':'~lists_g.merge.p3.0'(A,B,C)).
'lists_g.merge.p3.0'([], A, A).
'~lists_g.merge.p3.0'([], A, A).
'lists_g.merge.p3.0'(A, [], A).
'~lists_g.merge.p3.0'(A, [], A).
'lists_g.merge.p3.0'([A|B], [C|D], [A|E]) :-
        'integers':'integers.<.p2'(A, C),
        'lists_g.merge.p3'(B, [C|D], E).
'~lists_g.merge.p3.0'([A|B], [C|D], [A|E]) :-
        'integers':'~integers.<.p2'(A, C),
        '~lists_g.merge.p3'(B, [C|D], E).
'lists_g.merge.p3.0'([A|B], [C|D], [C|E]) :-
        'integers':'integers.>=.p2'(A, C),
        'lists_g.merge.p3'([A|B], D, E).
'~lists_g.merge.p3.0'([A|B], [C|D], [C|E]) :-
        'integers':'~integers.>=.p2'(A, C),
        '~lists_g.merge.p3'([A|B], D, E).
'lists_g.memberCheck.p2'(A, B) :-
        user:goedel_freeze(nonvar(B), 'lists_g':'lists_g.memberCheck.p2.1'(A,B)).
'~lists_g.memberCheck.p2'(A, B) :-
        user:goedel_freeze(nonvar(B), 'lists':'~lists_g.memberCheck.p2.1'(A,B)).
'lists_g.memberCheck.p2.1'(A, [B|C]) :- !,
        user:goedel_freeze(nonvar(A)and nonvar(B), 'lists_g':'lists_g.memberCheck.p2.0'(A,[B|C])).
'~lists_g.memberCheck.p2.1'(A, [B|C]) :- !,
        user:goedel_freeze(nonvar(A)and nonvar(B), 'lists':'~lists_g.memberCheck.p2.0'(A,[B|C])).
'lists_g.memberCheck.p2.1'(A, []) :- !,
        'lists_g.memberCheck.p2.0'(A, []).
'~lists_g.memberCheck.p2.1'(A, []) :- !,
        '~lists_g.memberCheck.p2.0'(A, []).
'lists_g.memberCheck.p2.1'(A, B) :-
        'lists_g.memberCheck.p2.0'(A, B).
'~lists_g.memberCheck.p2.1'(A, B) :-
        '~lists_g.memberCheck.p2.0'(A, B).
'lists_g.memberCheck.p2.0'(A, [A|_]) :- !.
'~lists_g.memberCheck.p2.0'(A, [A|_]).
'lists_g.memberCheck.p2.0'(A, [B|C]) :-
        call_residue(user:not_equal([],[A,B],A,B), D),
        (   D=[] ->
            !
        ;   user:release_suspended(D)
        ),
        'lists_g.memberCheck.p2'(A, C).
'~lists_g.memberCheck.p2.0'(A, [B|C]) :-
        user:not_equal([], [A,B], A, B),
        '~lists_g.memberCheck.p2'(A, C).
'lists_g.partition.p4'([], _, [], []).
'~lists_g.partition.p4'([], _, [], []).
'lists_g.partition.p4'([A|B], C, [A|D], E) :-
        'integers':'integers.=<.p2'(A, C),
        'lists_g.partition.p4'(B, C, D, E).
'~lists_g.partition.p4'([A|B], C, [A|D], E) :-
        'integers':'~integers.=<.p2'(A, C),
        '~lists_g.partition.p4'(B, C, D, E).
'lists_g.partition.p4'([A|B], C, D, [A|E]) :-
        'integers':'integers.>.p2'(A, C),
        'lists_g.partition.p4'(B, C, D, E).
'~lists_g.partition.p4'([A|B], C, D, [A|E]) :-
        'integers':'~integers.>.p2'(A, C),
        '~lists_g.partition.p4'(B, C, D, E).
'lists_g.prefix.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)and nonvar(B)or nonvar(C), 'lists_g':'lists_g.prefix.p3.0'(A,B,C)).
'~lists_g.prefix.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)and nonvar(B)or nonvar(C), 'lists':'~lists_g.prefix.p3.0'(A,B,C)).
'lists_g.prefix.p3.0'(A, B, C) :-
        'integers':'integers.>=.p2'(B, 0),
        'lists_g.length.p2'(A, D),
        'integers':'integers.=<.p2'(B, D),
        'lists_g.split.p4'(B, A, C, _).
'~lists_g.prefix.p3.0'(A, B, C) :-
        'integers':'~integers.>=.p2'(B, 0),
        '~lists_g.length.p2'(A, D),
        'integers':'~integers.=<.p2'(B, D),
        '~lists_g.split.p4'(B, A, C, _).
'lists_g.sorted.p1'(A) :-
        user:goedel_freeze(nonvar(A), 'lists_g':'lists_g.sorted.p1.1'(A)).
'~lists_g.sorted.p1'(A) :-
        user:goedel_freeze(nonvar(A), 'lists':'~lists_g.sorted.p1.1'(A)).
'lists_g.sorted.p1.1'([A|B]) :- !,
        user:goedel_freeze(nonvar(B), 'lists_g':'lists_g.sorted.p1.0'([A|B])).
'~lists_g.sorted.p1.1'([A|B]) :- !,
        user:goedel_freeze(nonvar(B), 'lists':'~lists_g.sorted.p1.0'([A|B])).
'lists_g.sorted.p1.1'([]) :- !,
        'lists_g.sorted.p1.0'([]).
'~lists_g.sorted.p1.1'([]) :- !,
        '~lists_g.sorted.p1.0'([]).
'lists_g.sorted.p1.1'(A) :-
        'lists_g.sorted.p1.0'(A).
'~lists_g.sorted.p1.1'(A) :-
        '~lists_g.sorted.p1.0'(A).
'lists_g.sorted.p1.0'([]).
'~lists_g.sorted.p1.0'([]).
'lists_g.sorted.p1.0'([_]).
'~lists_g.sorted.p1.0'([_]).
'lists_g.sorted.p1.0'([A,B|C]) :-
        'integers':'integers.=<.p2'(A, B),
        'lists_g.sorted.p1'([B|C]).
'~lists_g.sorted.p1.0'([A,B|C]) :-
        'integers':'~integers.=<.p2'(A, B),
        '~lists_g.sorted.p1'([B|C]).
'lists_g.sort.p2'(A, B) :-
        user:goedel_freeze(nonvar(A), 'lists_g':'lists_g.sort.p2.0'(A,B)).
'~lists_g.sort.p2'(A, B) :-
        user:goedel_freeze(nonvar(A), 'lists':'~lists_g.sort.p2.0'(A,B)).
'lists_g.sort.p2.0'([], []).
'~lists_g.sort.p2.0'([], []).
'lists_g.sort.p2.0'([A|B], C) :-
        'lists_g.partition.p4'(B, A, D, E),
        'lists_g.sort.p2'(D, F),
        'lists_g.sort.p2'(E, G),
        'lists_g.append.p3'(F, [A|G], C).
'~lists_g.sort.p2.0'([A|B], C) :-
        '~lists_g.partition.p4'(B, A, D, E),
        '~lists_g.sort.p2'(D, F),
        '~lists_g.sort.p2'(E, G),
        '~lists_g.append.p3'(F, [A|G], C).
'lists_g.reverse3.p3'([], A, A).
'~lists_g.reverse3.p3'([], A, A).
'lists_g.reverse3.p3'([A|B], C, D) :-
        'lists_g.reverse3.p3'(B, [A|C], D).
'~lists_g.reverse3.p3'([A|B], C, D) :-
        '~lists_g.reverse3.p3'(B, [A|C], D).
'lists_g.suffix.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)and nonvar(B)or nonvar(C), 'lists_g':'lists_g.suffix.p3.0'(A,B,C)).
'~lists_g.suffix.p3'(A, B, C) :-
        user:goedel_freeze(nonvar(A)and nonvar(B)or nonvar(C), 'lists':'~lists_g.suffix.p3.0'(A,B,C)).
'lists_g.suffix.p3.0'(A, B, C) :-
        'integers':'integers.>=.p2'(B, 0),
        'lists_g.length.p2'(A, D),
        'integers':'integers.=<.p2'(B, D),
        'integers':minus(D, B, F),
        E=F,
        'lists_g.split.p4'(E, A, _, C).
'~lists_g.suffix.p3.0'(A, B, C) :-
        'integers':'~integers.>=.p2'(B, 0),
        '~lists_g.length.p2'(A, D),
        'integers':'~integers.=<.p2'(B, D),
        'integers':minus(D, B, F),
        E=F,
        '~lists_g.split.p4'(E, A, _, C).
'lists_g.split.p4'(0, A, [], A).
'~lists_g.split.p4'(0, A, [], A).
'lists_g.split.p4'(A, [B|C], [B|D], E) :-
        'integers':'integers.>.p2'(A, 0),
        'integers':minus(A, 1, F),
        'lists_g.split.p4'(F, C, D, E).
'~lists_g.split.p4'(A, [B|C], [B|D], E) :-
        'integers':'~integers.>.p2'(A, 0),
        'integers':minus(A, 1, F),
        '~lists_g.split.p4'(F, C, D, E).
