
:- style_check(-singleton). % added djd
:- op(500, yfx, and).
:- op(400, yfx, or).

% replaced 0'0 with 48 DJD

'sharedSyntax.sTermMaxVarIndex.p2'(A, B) :-
        plus(C, 1, B),
        negative(1, D),
        'sharedSyntax.maxVarIndexInTerms.p3'(A, D, C).
'sharedSyntax.maxVarIndexInTerms.p3'([], A, A).
'sharedSyntax.maxVarIndexInTerms.p3'([A|B], C, D) :-
        'sharedSyntax.maxVarIndexInTerm.p3'(A, C, E),
        'sharedSyntax.maxVarIndexInTerms.p3'(B, E, D).
'sharedSyntax.maxVarIndex.p3'([], A, A).
'sharedSyntax.maxVarIndex.p3'([A|B], C, D) :-
        'sharedSyntax.maxVarIndex1.p3'(A, C, E),
        'sharedSyntax.maxVarIndex.p3'(B, E, D).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.par.f1'(A), B, C, 'metaDefs.par.f2'(D,E)) :-
        'sharedSyntax.sNotNewBinding.p4'(B, C, 'metaDefs.par.f1'(A), 'metaDefs.par.f2'(D,E)).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.par.f1'(A), B, C, 'metaDefs.par.f1'(D)) :-
        'sharedSyntax.sNotNewBinding.p4'(B, C, 'metaDefs.par.f1'(A), 'metaDefs.par.f1'(D)).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.par.f2'(A,B), C, D, 'metaDefs.par.f1'(E)) :-
        'sharedSyntax.sNotNewBinding.p4'(C, D, 'metaDefs.par.f2'(A,B), 'metaDefs.par.f1'(E)).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.par.f2'(A,B), C, D, 'metaDefs.par.f2'(E,F)) :-
        'sharedSyntax.sNotNewBinding.p4'(C, D, 'metaDefs.par.f2'(A,B), 'metaDefs.par.f2'(E,F)).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.bType.f1'(A), B, B, 'metaDefs.bType.f1'(A)).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.type.f2'(A,B), C, D, 'metaDefs.type.f2'(A,E)) :-
        'sharedSyntax.sCheckVariantTypes.p4'(B, C, D, E).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.xBType.f1'(A), B, B, 'metaDefs.xBType.f1'(A)).
'sharedSyntax.checkVariantTypes1.p4'('metaDefs.xType.f2'(A,B), C, D, 'metaDefs.xType.f2'(A,E)) :-
        'sharedSyntax.sCheckVariantTypes.p4'(B, C, D, E).
'sharedSyntax.argFreeVars.p2'([], []).
'sharedSyntax.argFreeVars.p2'([A|B], C) :-
        'sharedSyntax.sTermFreeVars.p2'(A, D),
        'sharedSyntax.argFreeVars.p2'(B, E),
        'sharedSyntax.union.p3'(D, E, C).
'sharedSyntax.getVariable.p4'(A, B, C, D) :-
        (   user:not_equal([], [A,B], A, B) ->
            'sharedSyntax.termNotOccur.p2'(A, B),
            'substs.bindVariable.p4'(B, A, C, D)
        ;   D=C
        ).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.empty.c0', A, A).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.pAtom.f1'(_), A, A).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.atom.f2'(_,A), B, C) :-
        'sharedSyntax.maxVarIndexInTerms.p3'(A, B, C).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.&''.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndex1.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.\\/''.f2'(A,B), C, D) :- % added \ djd
        'sharedSyntax.maxVarIndex1.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.->''.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndex1.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.<-''.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndex1.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.<->''.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndex1.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.~''.f1'(A), B, C) :-
        'sharedSyntax.maxVarIndex1.p3'(A, B, C).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.some.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndexInTerms.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.all.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndexInTerms.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.iT.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndex1.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.iST.f3'(A,B,C), D, E) :-
        'sharedSyntax.maxVarIndexInTerms.p3'(A, D, F),
        'sharedSyntax.maxVarIndex1.p3'(B, F, G),
        'sharedSyntax.maxVarIndex1.p3'(C, G, E).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.iTE.f3'(A,B,C), D, E) :-
        'sharedSyntax.maxVarIndex1.p3'(A, D, F),
        'sharedSyntax.maxVarIndex1.p3'(B, F, G),
        'sharedSyntax.maxVarIndex1.p3'(C, G, E).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.iSTE.f4'(A,B,C,D), E, F) :-
        'sharedSyntax.maxVarIndexInTerms.p3'(A, E, G),
        'sharedSyntax.maxVarIndex1.p3'(B, G, H),
        'sharedSyntax.maxVarIndex1.p3'(C, H, I),
        'sharedSyntax.maxVarIndex1.p3'(D, I, F).
'sharedSyntax.maxVarIndex1.p3'('metaDefs.commit.f2'(_,A), B, C) :-
        'sharedSyntax.maxVarIndex1.p3'(A, B, C).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.var.f1'(A), B, C) :-
        (   'integers.>.p2'(A, B) ->
            C=A
        ;   C=B
        ).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.var.f2'(_,A), B, C) :-
        (   'integers.>.p2'(A, B) ->
            C=A
        ;   C=B
        ).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.cTerm.f1'(_), A, A).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.xCTerm.f2'(_,_), A, A).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.term.f2'(_,A), B, C) :-
        'sharedSyntax.maxVarIndexInTerms.p3'(A, B, C).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.xTerm.f3'(_,A,_), B, C) :-
        'sharedSyntax.maxVarIndexInTerms.p3'(A, B, C).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.int.f1'(_), A, A).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.str.f1'(_), A, A).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.prm.f1'(_), A, A).
'sharedSyntax.maxVarIndexInTerm.p3'('metaDefs.suchThat.f2'(A,B), C, D) :-
        'sharedSyntax.maxVarIndexInTerm.p3'(A, C, E),
        'sharedSyntax.maxVarIndex1.p3'(B, E, D).
'sharedSyntax.sFormulaMaxVarIndex.p2'(A, B) :-
        plus(C, 1, B),
        negative(1, D),
        'sharedSyntax.maxVarIndex.p3'(A, D, C).
'sharedSyntax.sEmptyTermSubst.p1'('substs.termSubst.f2'(A,[])) :-
        'substs.emptyHeap.p1'(A).
'sharedSyntax.sCheckVariantTypes.p4'([], A, A, []).
'sharedSyntax.sCheckVariantTypes.p4'([A|B], C, D, [E|F]) :-
        'sharedSyntax.checkVariantTypes1.p4'(A, C, G, E),
        'sharedSyntax.sCheckVariantTypes.p4'(B, G, D, F).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.empty.c0', []).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.pAtom.f1'(_), []).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.atom.f2'(_,A), B) :-
        'sharedSyntax.argFreeVars.p2'(A, B).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.xPAtom.f1'(_), []).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.xAtom.f2'(_,A), B) :-
        'sharedSyntax.argFreeVars.p2'(A, B).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.~''.f1'(A), B) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, B).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.&''.f2'(A,B), C) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.union.p3'(D, E, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.\\/''.f2'(A,B), C) :- % added \ djd
        'sharedSyntax.sFormulaFreeVars.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.union.p3'(D, E, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.->''.f2'(A,B), C) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.union.p3'(D, E, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.<-''.f2'(A,B), C) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.union.p3'(D, E, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.<->''.f2'(A,B), C) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.union.p3'(D, E, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.all.f2'(A,B), C) :-
        'sharedSyntax.order.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.difference.p3'(E, D, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.some.f2'(A,B), C) :-
        'sharedSyntax.order.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.difference.p3'(E, D, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.iSTE.f4'(A,B,C,D), E) :-
        'sharedSyntax.order.p2'(A, F),
        'sharedSyntax.sFormulaFreeVars.p2'(B, G),
        'sharedSyntax.sFormulaFreeVars.p2'(C, H),
        'sharedSyntax.sFormulaFreeVars.p2'(D, I),
        'sharedSyntax.union.p3'(G, H, J),
        'sharedSyntax.difference.p3'(J, F, K),
        'sharedSyntax.union.p3'(K, I, E).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.iTE.f3'(A,B,C), D) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, E),
        'sharedSyntax.sFormulaFreeVars.p2'(B, F),
        'sharedSyntax.sFormulaFreeVars.p2'(C, G),
        'sharedSyntax.union.p3'(E, F, H),
        'sharedSyntax.union.p3'(H, G, D).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.iST.f3'(A,B,C), D) :-
        'sharedSyntax.order.p2'(A, E),
        'sharedSyntax.sFormulaFreeVars.p2'(B, F),
        'sharedSyntax.sFormulaFreeVars.p2'(C, G),
        'sharedSyntax.union.p3'(F, G, H),
        'sharedSyntax.difference.p3'(H, E, D).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.iT.f2'(A,B), C) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.union.p3'(D, E, C).
'sharedSyntax.sFormulaFreeVars.p2'('metaDefs.commit.f2'(_,A), B) :-
        'sharedSyntax.sFormulaFreeVars.p2'(A, B).
'sharedSyntax.sNotNewBinding.p4'([], ['metaDefs.!.f2'(A,B)], A, B).
'sharedSyntax.sNotNewBinding.p4'(['metaDefs.!.f2'(B,C)|A], D, E, F) :-
        (   B=E ->
            C=F,
            D=G
        ;   user:not_equal([], [C,F], C, F),
            D=['metaDefs.!.f2'(B,C)|G]
        ),
        'sharedSyntax.sNotNewBinding.p4'(A, G, E, F).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.var.f2'(A,B), ['metaDefs.var.f2'(A,B)]).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.var.f1'(A), ['metaDefs.var.f1'(A)]).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.term.f2'(_,A), B) :-
        'sharedSyntax.argFreeVars.p2'(A, B).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.xTerm.f3'(_,A,_), B) :-
        'sharedSyntax.argFreeVars.p2'(A, B).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.cTerm.f1'(_), []).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.xCTerm.f2'(_,_), []).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.int.f1'(_), []).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.num.f1'(_), []).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.str.f1'(_), []).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.prm.f1'(_), []).
'sharedSyntax.sTermFreeVars.p2'('metaDefs.suchThat.f2'(A,B), C) :-
        'sharedSyntax.sTermFreeVars.p2'(A, D),
        'sharedSyntax.sFormulaFreeVars.p2'(B, E),
        'sharedSyntax.difference.p3'(E, D, C).
'sharedSyntax.unifyTermArgs.p5'([], [], _, A, A).
'sharedSyntax.unifyTermArgs.p5'([A|B], [C|D], E, F, G) :-
        'sharedSyntax.unifyTerms1.p5'(A, C, E, F, H),
        'sharedSyntax.unifyTermArgs.p5'(B, D, E, H, G).
'sharedSyntax.sVariableName.p3'('metaDefs.var.f2'(A,B), A, B) :-
        call_residue(user:not_equal([],[A],A,'"v'), C),
        (   C=[] ->
            true
        ;   user:flounder_commit(C)
        ), !.
'sharedSyntax.sVariableName.p3'('metaDefs.var.f1'(A), '"v', A) :- !.
'sharedSyntax.sUnifyTerms.p4'(A, B, C, D) :-
        'substs.substApplyToTerm.p3'(A, C, E),
        'sharedSyntax.unifyTerms0.p4'(E, B, C, D).
'sharedSyntax.sUnifyAtoms.p4'('metaDefs.pAtom.f1'(A), 'metaDefs.pAtom.f1'(A), B, B).
'sharedSyntax.sUnifyAtoms.p4'('metaDefs.xPAtom.f1'(A), 'metaDefs.xPAtom.f1'(A), B, B).
'sharedSyntax.sUnifyAtoms.p4'('metaDefs.atom.f2'(A,B), 'metaDefs.atom.f2'(A,C), D, E) :-
        'sharedSyntax.unifyingTermSubst.p4'(B, C, D, E).
'sharedSyntax.sUnifyAtoms.p4'('metaDefs.xAtom.f2'(A,B), 'metaDefs.xAtom.f2'(A,C), D, E) :-
        'sharedSyntax.unifyingTermSubst.p4'(B, C, D, E).
'sharedSyntax.termNotOccur1.p2'([], _).
'sharedSyntax.termNotOccur1.p2'([A|B], C) :-
        'sharedSyntax.termNotOccur.p2'(A, C),
        'sharedSyntax.termNotOccur1.p2'(B, C).
'sharedSyntax.termNotOccur.p2'('metaDefs.var.f2'(A,B), C) :-
        user:not_equal([], [C,A,B], C, 'metaDefs.var.f2'(A,B)).
'sharedSyntax.termNotOccur.p2'('metaDefs.var.f1'(A), B) :-
        user:not_equal([], [B,A], B, 'metaDefs.var.f1'(A)).
'sharedSyntax.termNotOccur.p2'('metaDefs.cTerm.f1'(_), _).
'sharedSyntax.termNotOccur.p2'('metaDefs.term.f2'(_,A), B) :-
        'sharedSyntax.termNotOccur1.p2'(A, B).
'sharedSyntax.termNotOccur.p2'('metaDefs.xCTerm.f2'(_,_), _).
'sharedSyntax.termNotOccur.p2'('metaDefs.int.f1'(_), _).
'sharedSyntax.termNotOccur.p2'('metaDefs.str.f1'(_), _).
'sharedSyntax.termNotOccur.p2'('metaDefs.prm.f1'(_), _).
'sharedSyntax.termNotOccur.p2'('metaDefs.xTerm.f3'(_,A,_), B) :-
        'sharedSyntax.termNotOccur1.p2'(A, B).
'sharedSyntax.termOccurCheck.p3'('substs.read.c0', A, B) :-
        'sharedSyntax.termNotOccur1.p2'(B, A).
'sharedSyntax.termOccurCheck.p3'('substs.write.c0', _, _).
'sharedSyntax.unifyTerms1.p5'('metaDefs.var.f2'(A,B), C, D, E, F) :-
        'substs.unifyKnownVariable.p5'(D, C, 'metaDefs.var.f2'(A,B), E, F).
'sharedSyntax.unifyTerms1.p5'('metaDefs.var.f1'(A), B, C, D, E) :-
        'substs.unifyKnownVariable.p5'(C, B, 'metaDefs.var.f1'(A), D, E).
'sharedSyntax.unifyTerms1.p5'('metaDefs.cTerm.f1'(A), B, C, D, E) :-
        'substs.unifyConstant.p5'(C, B, 'metaDefs.cTerm.f1'(A), D, E).
'sharedSyntax.unifyTerms1.p5'('metaDefs.term.f2'(A,B), C, D, E, F) :-
        'substs.unifyFunction.p6'(D, C, 'metaDefs.term.f2'(A,G), H, E, I),
        'sharedSyntax.termOccurCheck.p3'(H, C, B),
        'sharedSyntax.unifyTermArgs.p5'(B, G, H, I, F).
'sharedSyntax.unifyTerms1.p5'('metaDefs.xTerm.f3'(A,B,C), D, E, F, G) :-
        'substs.unifyFunction.p6'(E, D, 'metaDefs.xTerm.f3'(A,H,C), I, F, J),
        'sharedSyntax.termOccurCheck.p3'(I, D, B),
        'sharedSyntax.unifyTermArgs.p5'(B, H, I, J, G).
'sharedSyntax.unifyTerms1.p5'('metaDefs.xCTerm.f2'(A,B), C, D, E, F) :-
        'substs.unifyConstant.p5'(D, C, 'metaDefs.xCTerm.f2'(A,B), E, F).
'sharedSyntax.unifyTerms1.p5'('metaDefs.int.f1'(A), B, C, D, E) :-
        'substs.unifyConstant.p5'(C, B, 'metaDefs.int.f1'(A), D, E).
'sharedSyntax.unifyTerms1.p5'('metaDefs.str.f1'(A), B, C, D, E) :-
        'substs.unifyConstant.p5'(C, B, 'metaDefs.str.f1'(A), D, E).
'sharedSyntax.unifyTerms1.p5'('metaDefs.prm.f1'(A), B, C, D, E) :-
        'substs.unifyConstant.p5'(C, B, 'metaDefs.prm.f1'(A), D, E).
'sharedSyntax.unifyTerms0.p4'('metaDefs.var.f2'(A,B), C, D, E) :-
        'sharedSyntax.getVariable.p4'(C, 'metaDefs.var.f2'(A,B), D, E).
'sharedSyntax.unifyTerms0.p4'('metaDefs.var.f1'(A), B, C, D) :-
        'sharedSyntax.getVariable.p4'(B, 'metaDefs.var.f1'(A), C, D).
'sharedSyntax.unifyTerms0.p4'('metaDefs.cTerm.f1'(A), B, C, D) :-
        'substs.getConstant.p4'(B, 'metaDefs.cTerm.f1'(A), C, D).
'sharedSyntax.unifyTerms0.p4'('metaDefs.term.f2'(A,B), C, D, E) :-
        'substs.getFunction.p5'(C, 'metaDefs.term.f2'(A,F), G, D, H),
        'sharedSyntax.termOccurCheck.p3'(G, C, B),
        'sharedSyntax.unifyTermArgs.p5'(B, F, G, H, E).
'sharedSyntax.unifyTerms0.p4'('metaDefs.xTerm.f3'(A,B,C), D, E, F) :-
        'substs.getFunction.p5'(D, 'metaDefs.xTerm.f3'(A,G,C), H, E, I),
        'sharedSyntax.termOccurCheck.p3'(H, D, B),
        'sharedSyntax.unifyTermArgs.p5'(B, G, H, I, F).
'sharedSyntax.unifyTerms0.p4'('metaDefs.xCTerm.f2'(A,B), C, D, E) :-
        'substs.getConstant.p4'(C, 'metaDefs.xCTerm.f2'(A,B), D, E).
'sharedSyntax.unifyTerms0.p4'('metaDefs.int.f1'(A), B, C, D) :-
        'substs.getConstant.p4'(B, 'metaDefs.int.f1'(A), C, D).
'sharedSyntax.unifyTerms0.p4'('metaDefs.str.f1'(A), B, C, D) :-
        'substs.getConstant.p4'(B, 'metaDefs.str.f1'(A), C, D).
'sharedSyntax.unifyTerms0.p4'('metaDefs.prm.f1'(A), B, C, D) :-
        'substs.getConstant.p4'(B, 'metaDefs.prm.f1'(A), C, D).
'sharedSyntax.unifyingTermSubst.p4'([], [], A, A).
'sharedSyntax.unifyingTermSubst.p4'([A|B], [C|D], E, F) :-
        'sharedSyntax.sUnifyTerms.p4'(A, C, E, G),
        'sharedSyntax.unifyingTermSubst.p4'(B, D, G, F).
%------------------------------------------------------------------------------
% Supplementary Syntax routines shared by the parser
%------------------------------------------------------------------------------

%------------------------------------------------------------------------------
% Pseudo-set maniplation predicates
%------------------------------------------------------------------------------

'sharedSyntax.order.p2'(X, Y) :-
   sort(X, Y).

'~sharedSyntax.order.p2'(X, Y) :-
   sort(X, Y).
 
'sharedSyntax.union.p3'(X, Y, Z) :-
   user:union(X, Y, Z).

'~sharedSyntax.union.p3'(X, Y, Z) :-
   user:union(X, Y, Z).

'sharedSyntax.difference.p3'(X, Y, Z) :-
   user:difference(X, Y, Z).

'~sharedSyntax.difference.p3'(X, Y, Z) :-
   user:difference(X, Y, Z).

%------------------------------------------------------------------------------
% Integer to Character List conversion
%------------------------------------------------------------------------------
 
'sharedSyntax.integerToCharDL.p3'(Int, Chars, CharsT) :-
   ( Int = 0 ->
     Chars = [48|CharsT]
   ; Int < 0 ->
     Chars = [0'-|Chars1],
     Int1 is -Int,
     int_to_char_dl(Int1, Chars1, CharsT) 
   ; int_to_char_dl(Int, Chars, CharsT)
   ).

'~sharedSyntax.integerToCharDL.p3'(Int, Chars, CharsT) :-
   'sharedSyntax.integerToCharDL.p3'(Int, Chars, CharsT).

int_to_char_dl(Int, Chars, CharsT) :-
   ( Int = 0 ->
     Chars = CharsT
   ; C is 48 + Int mod 10,
     Int1 is Int // 10,
     int_to_char_dl(Int1, Chars, [C|CharsT])
   ).

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

'parserPrograms.parserCheckStatement.p4'(A, B, C, D) :-
        'parserPrograms.checkStatementAux.p6'(A, B, 0, [], E, F),
        (   E=[G] ->
            C=G,
            D=[]
        ;   E=[] ->
            C='metaDefs.empty.c0',
            D=F
        ;   'parserPrograms.ambiguityError.p2'(E, H),
            D=[H],
            C='metaDefs.empty.c0'
        ).
'parserPrograms.exportSymbolTable.p3'('progDefs.program.f4'(_,A,'progDefs.language.f1'(B),_), C, 'parserPrograms.symbTab.f4'(C,D,E,F)) :-
        (   'avlTrees.avlSearch.p3'(B, C, G) ->
            D=G,
            G='progDefs.module.f3'(_,_,H)
        ;   'sharedPrograms.emptyCategoryTable.p1'(I),
            D='progDefs.module.f3'('progDefs.hidden.c0',I,H),
            H=[]
        ),
        'avlTrees.avlSearch.p3'(A, C, 'progDefs.modDef.f4'(_,J,_,K)),
        'parserPrograms.initialImportedSymbols.p2'(B, L),
        'parserPrograms.addLiftedSymbols.p3'(H, L, M),
        'parserPrograms.importedSymbols.p5'(J, A, B, M, E),
        'parserPrograms.importedSymbols.p5'(K, A, B, [], F).
'parserPrograms.decompileImports.p2'([], _).
'parserPrograms.decompileImports.p2'([A|B], C) :-
        'iO.writeString.p2'(C, '"IMPORT '),
        'iO.writeString.p2'(C, A),
        'parserPrograms.writeRestOfStringList.p2'(B, C),
        'iO.writeString.p2'(C, '".'),
        'parserPrograms.newLines.p2'(C, 2).
'parserPrograms.checkStatementAux.p6'([], _, _, A, A, []).
'parserPrograms.checkStatementAux.p6'([A|B], C, D, E, F, G) :-
        'sharedPrograms.statementInLanguage.p5'(A, C, H, I, J),
        (   J=[],
            'integers.>=.p2'(I, D) ->
            K=I,
            (   I=D ->
                L=[H|E]
            ;   L=[H]
            )
        ;   L=E,
            K=D
        ),
        'lists_g.append.p3'(J, M, G),
        'parserPrograms.checkStatementAux.p6'(B, C, K, L, F, M).
'parserPrograms.candidateNames.p6'([], _, _, _, A, A).
'parserPrograms.candidateNames.p6'(['progDefs.symbol.f2'(B,C)|A], D, E, F, G, H) :-
        (   'sharedPrograms.accessible.p2'(F, B) ->
            'parserPrograms.makeCandidate.p4'(C, D, E, I),
            J=[I|G]
        ;   J=G
        ),
        'parserPrograms.candidateNames.p6'(A, D, E, F, J, H).
'parserPrograms.ambiguityError.p2'(_, 'sharedPrograms.ambiguity.c0').
'parserPrograms.addLiftedSymbols.p3'([], A, A).
'parserPrograms.addLiftedSymbols.p3'(['progDefs.lift.f2'(B,C)|A], D, E) :-
        (   'lists_g.member.p2'('parserPrograms.importItem.f3'(B,_,_), D) ->
            F=D
        ;   'lists_g.deleteFirst.p3'('parserPrograms.liftedItem.f2'(B,G), D, H) ->
            'avlTrees.avlJoin.p3'(C, G, I),
            F=['parserPrograms.liftedItem.f2'(B,I)|H]
        ;   F=['parserPrograms.liftedItem.f2'(B,C)|D]
        ),
        'parserPrograms.addLiftedSymbols.p3'(A, F, E).
'parserPrograms.binExportDelaysOnly.p3'('avlTrees.empty.c0', A, A).
'parserPrograms.binExportDelaysOnly.p3'('avlTrees.tree.f4'(A,B,C,D), E, F) :-
        'parserPrograms.listExportDelaysOnly.p2'(C, G),
        'avlTrees.avlInsert.p4'(E, B, G, H),
        'parserPrograms.binExportDelaysOnly.p3'(A, H, I),
        'parserPrograms.binExportDelaysOnly.p3'(D, I, F).
'parserPrograms.candidateDeclaration.p3'('parserPrograms.fCandidate.f2'(A,_), B, C) :-
        'sharedPrograms.symbolInLanguage.p3'(A, B, C).
'parserPrograms.candidateDeclaration.p3'('parserPrograms.pCandidate.f2'(A,_), B, C) :-
        'sharedPrograms.symbolInLanguage.p3'(A, B, C).
'parserPrograms.candidateTypes.p6'([], _, _, _, A, A).
'parserPrograms.candidateTypes.p6'([A|B], C, D, E, F, G) :-
        (   'sharedPrograms.matchingDescriptor.p5'(A, E, H, I, _) ->
            J=['metaDefs.name.f4'(C,D,H,I)|F]
        ;   J=F
        ),
        'parserPrograms.candidateTypes.p6'(B, C, D, E, J, G).
'parserPrograms.checkFormulaAux.p6'([], _, _, A, A, []).
'parserPrograms.checkFormulaAux.p6'([A|B], C, D, E, F, G) :-
        'sharedPrograms.meltedFormulaTyping.p8'(A, C, [], _, H, I, [], J),
        (   J=[] ->
            'sharedPrograms.fixRationals.p2'(I, K)
        ;   K=0
        ),
        (   J=[],
            'integers.>=.p2'(K, D) ->
            L=K,
            (   K=D ->
                M=[H|E]
            ;   M=[H]
            )
        ;   L=D,
            M=E
        ),
        'lists_g.append.p3'(J, N, G),
        'parserPrograms.checkFormulaAux.p6'(B, C, L, M, F, N).
'parserPrograms.decompileDomainType.p4'([A|B], C, D, E) :-
        'sharedPrograms.sProgramTypeToString.p4'(C, D, A, F),
        'iO.writeString.p2'(E, F),
        'parserPrograms.decompileRestTypes.p4'(B, C, D, E).
'parserPrograms.decompileConstants.p4'([], _, _, _).
'parserPrograms.decompileConstants.p4'([A|B], C, D, E) :-
        'iO.writeString.p2'(E, '"CONSTANT'),
        'parserPrograms.newLines.p2'(E, 1),
        'parserPrograms.decompileIdentifiers.p4'([A|B], C, D, E).
'parserPrograms.decompile.p2'(A, B) :-
        A='progDefs.program.f4'(_,C,_,_),
        'avlTrees.avlToBinary.p2'(C, D),
        'parserPrograms.decompileModuleTree.p3'(D, A, B).
'parserPrograms.checkTermAux.p6'([], _, _, A, A, []).
'parserPrograms.checkTermAux.p6'([A|B], C, D, E, F, G) :-
        'sharedPrograms.meltedTermType.p9'(A, _, C, [], _, H, I, [], J),
        (   J=[] ->
            'sharedPrograms.fixRationals.p2'(I, K)
        ;   K=0
        ),
        (   J=[],
            'integers.>=.p2'(K, D) ->
            L=K,
            (   K=D ->
                M=[H|E]
            ;   M=[H]
            )
        ;   L=D,
            M=E
        ),
        'lists_g.append.p3'(J, N, G),
        'parserPrograms.checkTermAux.p6'(B, C, L, M, F, N).
'parserPrograms.decompileBases.p2'([], _).
'parserPrograms.decompileBases.p2'(['parserPrograms.iD.f2'(B,_)|A], C) :-
        'iO.writeString.p2'(C, '"BASE '),
        'iO.writeString.p2'(C, B),
        'parserPrograms.writeRestOfIdentifiers.p2'(A, C),
        'iO.writeString.p2'(C, '".'),
        'parserPrograms.newLines.p2'(C, 2).
'parserPrograms.decompileDelay.p4'('progDefs.delay.f2'(A,B), C, D, E) :-
        'sharedPrograms.sProgramFormulaToString.p4'(C, D, A, F),
        'iO.writeString.p2'(E, F),
        'iO.writeString.p2'(E, '" UNTIL '),
        'sharedPrograms.sConditionToString.p2'(B, G),
        'iO.writeString.p2'(E, G).
'parserPrograms.decompileConstructors.p2'([], _).
'parserPrograms.decompileConstructors.p2'(['parserPrograms.iD.f2'(B,C)|A], D) :-
        'iO.writeString.p2'(D, '"CONSTRUCTOR '),
        'parserPrograms.writeConstructor.p3'(B, C, D),
        'parserPrograms.writeRestOfConstructors.p2'(A, D),
        'iO.writeString.p2'(D, '".'),
        'parserPrograms.newLines.p2'(D, 2).
'parserPrograms.decompileDelays.p4'([], _, _, _).
'parserPrograms.decompileDelays.p4'([A|B], C, D, E) :-
        'iO.writeString.p2'(E, '"DELAY '),
        'parserPrograms.decompileDelay.p4'(A, C, D, E),
        'parserPrograms.decompileRestDelays.p4'(B, C, D, E),
        'iO.writeString.p2'(E, '".'),
        'parserPrograms.newLines.p2'(E, 2).
'parserPrograms.decompileFunctions.p4'([], _, _, _).
'parserPrograms.decompileFunctions.p4'([A|B], C, D, E) :-
        'iO.writeString.p2'(E, '"FUNCTION'),
        'parserPrograms.newLines.p2'(E, 1),
        'parserPrograms.decompileIdentifiers.p4'([A|B], C, D, E).
'parserPrograms.decompileExportCode.p4'('avlTrees.empty.c0', _, _, _).
'parserPrograms.decompileExportCode.p4'('avlTrees.tree.f4'(A,_,B,C), D, E, F) :-
        'parserPrograms.decompileExportPredicates.p4'(B, D, E, F),
        'parserPrograms.decompileExportCode.p4'(A, D, E, F),
        'parserPrograms.decompileExportCode.p4'(C, D, E, F).
'parserPrograms.decompileExportPredicates.p4'([], _, _, _).
'parserPrograms.decompileExportPredicates.p4'(['progDefs.predDef.f4'(_,_,B,_)|A], C, D, E) :-
        'parserPrograms.decompileDelays.p4'(B, C, D, E),
        'parserPrograms.decompileExportPredicates.p4'(A, C, D, E).
'parserPrograms.decompileIdentifiers.p4'([A|B], C, D, E) :-
        'parserPrograms.decompileGroup.p6'(A, B, C, D, E, F),
        'parserPrograms.decompileRestIdentifiers.p4'(F, C, D, E),
        'iO.writeString.p2'(E, '".'),
        'parserPrograms.newLines.p2'(E, 2).
'parserPrograms.decompileGroup.p6'('parserPrograms.iD.f2'(A,B), C, D, E, F, G) :-
        'parserPrograms.indent.p1'(F),
        'iO.writeString.p2'(F, A),
        'parserPrograms.decompileRestGroup.p4'(C, B, F, G),
        'iO.writeString.p2'(F, '" : '),
        'parserPrograms.decompileIndicator.p2'(B, F),
        'parserPrograms.decompileType.p4'(B, D, E, F).
'parserPrograms.decompilePredicates.p4'([], _, _, _).
'parserPrograms.decompilePredicates.p4'([A|B], C, D, E) :-
        'iO.writeString.p2'(E, '"PREDICATE'),
        'parserPrograms.newLines.p2'(E, 1),
        'parserPrograms.decompileIdentifiers.p4'([A|B], C, D, E).
'parserPrograms.decompileLifts.p2'([], _).
'parserPrograms.decompileLifts.p2'([A|B], C) :-
        'iO.writeString.p2'(C, '"LIFT '),
        'iO.writeString.p2'(C, A),
        'parserPrograms.writeRestOfStringList.p2'(B, C),
        'iO.writeString.p2'(C, '".'),
        'parserPrograms.newLines.p2'(C, 2).
'parserPrograms.decompileLanguage.p5'(A, B, C, D, E) :-
        'parserPrograms.gatherDeclarations.p14'(A, B, _, _, _, _, F, [], G, [], H, [], I, []),
        'parserPrograms.decompileConstants.p4'(F, C, D, E),
        'parserPrograms.decompileFunctions.p4'(G, C, D, E),
        'parserPrograms.decompilePropositions.p2'(H, E),
        'parserPrograms.decompilePredicates.p4'(I, C, D, E).
'parserPrograms.decompileIndicator.p2'(A, B) :-
        (   A='progDefs.functionDecl.f4'(_,C,_,_),
            user:not_equal([], [C], C, 'syntax.noFunctInd.c0') ->
            'parserPrograms.functionIndicator.p3'(C, D, E),
            'iO.writeString.p2'(B, D),
            'iO.writeString.p2'(B, '"('),
            'sharedSyntax.integerToCharDL.p3'(E, F, []),
            'strings.stringInts.p2'(G, F),
            'iO.writeString.p2'(B, G),
            'iO.writeString.p2'(B, '") : ')
        ;   A='progDefs.predicateDecl.f3'(_,H,_),
            user:not_equal([], [H], H, 'syntax.noPredInd.c0') ->
            'parserPrograms.predicateIndicator.p2'(H, D),
            'iO.writeString.p2'(B, D),
            'iO.writeString.p2'(B, '" : ')
        ;   true
        ).
'parserPrograms.decompileModule.p7'(_, A, _, _, _, _, _) :-
        call_residue('sharedPrograms.systemModule.p1'(A), B),
        (   B=[] ->
            true
        ;   user:flounder_commit(B)
        ), !.
'parserPrograms.decompileModule.p7'('progDefs.closedKind.c0', _, _, _, _, _, _) :- !.
'parserPrograms.decompileModule.p7'('progDefs.normalKind.c0', A, B, C, D, E, F) :-
        call_residue(goedel_not('sharedPrograms.systemModule.p1'(A)), G),
        (   G=[] ->
            true
        ;   user:flounder_commit(G)
        ), !,
        (   F='parserPrograms.noisy.c0' ->
            'iO.writeString.p2'('iO.stdErr.c0', '"Decompiling module "'),
            'iO.writeString.p2'('iO.stdErr.c0', A),
            'iO.writeString.p2'('iO.stdErr.c0', '""'),
            'iO.newLine.p1'('iO.stdErr.c0')
        ;   true
        ),
        E='progDefs.program.f4'(_,_,'progDefs.language.f1'(H),I),
        'avlTrees.avlSearch.p3'(H, A, 'progDefs.module.f3'(_,'progDefs.categories.f2'(J,K),L)),
        'avlTrees.avlToBinary.p2'(J, M),
        'avlTrees.avlToBinary.p2'(K, N),
        'avlTrees.avlSearch.p3'(I, A, 'progDefs.code.f2'(_,O)),
        'avlTrees.avlToBinary.p2'(O, P),
        (   'parserPrograms.findModulePart.p3'(A, '".exp', Q) ->
            'parserPrograms.moduleDeclaration.p3'('"EXPORT', A, Q),
            'parserPrograms.decompileImports.p2'(B, Q),
            'parserPrograms.decompileTypeLanguage.p4'(M, 'progDefs.exported.c0', L, Q),
            'parserPrograms.decompileLanguage.p5'(N, 'progDefs.exported.c0', E, A, Q),
            'parserPrograms.decompileExportCode.p4'(P, E, A, Q),
            'iO.endOutput.p1'(Q)
        ;   true
        ),
        (   'parserPrograms.findModulePart.p3'(A, '".loc', R) ->
            'parserPrograms.moduleDeclaration.p3'('"LOCAL', A, R),
            'parserPrograms.decompileImports.p2'(C, R),
            'parserPrograms.decompileLifts.p2'(D, R),
            'parserPrograms.decompileTypeLanguage.p4'(M, 'progDefs.hidden.c0', [], R),
            'parserPrograms.decompileLanguage.p5'(N, 'progDefs.hidden.c0', E, A, R),
            'parserPrograms.decompileLocalCode.p4'(P, E, A, R),
            'iO.endOutput.p1'(R)
        ;   true
        ).
'parserPrograms.decompileModule.p7'('progDefs.moduleKind.c0', A, _, B, C, D, E) :-
        call_residue(goedel_not('sharedPrograms.systemModule.p1'(A)), F),
        (   F=[] ->
            true
        ;   user:flounder_commit(F)
        ), !,
        (   E='parserPrograms.noisy.c0' ->
            'iO.writeString.p2'('iO.stdErr.c0', '"Decompiling module "'),
            'iO.writeString.p2'('iO.stdErr.c0', A),
            'iO.writeString.p2'('iO.stdErr.c0', '""'),
            'iO.newLine.p1'('iO.stdErr.c0')
        ;   true
        ),
        (   'parserPrograms.findModulePart.p3'(A, '".loc', G) ->
            D='progDefs.program.f4'(_,_,'progDefs.language.f1'(H),I),
            'avlTrees.avlSearch.p3'(H, A, 'progDefs.module.f3'(_,'progDefs.categories.f2'(J,K),_)),
            'avlTrees.avlToBinary.p2'(J, L),
            'avlTrees.avlToBinary.p2'(K, M),
            'avlTrees.avlSearch.p3'(I, A, 'progDefs.code.f2'(_,N)),
            'avlTrees.avlToBinary.p2'(N, O),
            'parserPrograms.moduleDeclaration.p3'('"MODULE', A, G),
            'parserPrograms.decompileImports.p2'(B, G),
            'parserPrograms.decompileLifts.p2'(C, G),
            'parserPrograms.decompileTypeLanguage.p4'(L, 'progDefs.hidden.c0', [], G),
            'parserPrograms.decompileLanguage.p5'(M, 'progDefs.hidden.c0', D, A, G),
            'parserPrograms.decompileLocalCode.p4'(O, D, A, G),
            'iO.endOutput.p1'(G)
        ;   true
        ).
'parserPrograms.decompileLocalCode.p4'('avlTrees.empty.c0', _, _, _).
'parserPrograms.decompileLocalCode.p4'('avlTrees.tree.f4'(A,_,B,C), D, E, F) :-
        'parserPrograms.decompileLocalPredicates.p4'(B, D, E, F),
        'parserPrograms.decompileLocalCode.p4'(A, D, E, F),
        'parserPrograms.decompileLocalCode.p4'(C, D, E, F).
'parserPrograms.decompileLocalPredicates.p4'([], _, _, _).
'parserPrograms.decompileLocalPredicates.p4'(['progDefs.predDef.f4'(_,B,_,C)|A], D, E, F) :-
        'parserPrograms.decompileDelays.p4'(C, D, E, F),
        'parserPrograms.decompileStatements.p4'(B, D, E, F),
        'parserPrograms.newLines.p2'(F, 1),
        'parserPrograms.decompileLocalPredicates.p4'(A, D, E, F).
'parserPrograms.decompileModuleTree.p3'('avlTrees.empty.c0', _, _).
'parserPrograms.decompileModuleTree.p3'('avlTrees.tree.f4'(A,B,'progDefs.modDef.f4'(C,D,E,F),G), H, I) :-
        'parserPrograms.decompileModule.p7'(C, B, D, E, F, H, I),
        'parserPrograms.decompileModuleTree.p3'(A, H, I),
        'parserPrograms.decompileModuleTree.p3'(G, H, I).
'parserPrograms.decompileType.p4'('progDefs.constantDecl.f1'(A), B, C, D) :-
        'sharedPrograms.sProgramTypeToString.p4'(B, C, A, E),
        'iO.writeString.p2'(D, E).
'parserPrograms.decompileType.p4'('progDefs.functionDecl.f4'(_,_,A,B), C, D, E) :-
        'parserPrograms.decompileDomainType.p4'(A, C, D, E),
        'iO.writeString.p2'(E, '" -> '),
        'sharedPrograms.sProgramTypeToString.p4'(C, D, B, F),
        'iO.writeString.p2'(E, F).
'parserPrograms.decompileType.p4'('progDefs.predicateDecl.f3'(_,_,A), B, C, D) :-
        'parserPrograms.decompileDomainType.p4'(A, B, C, D).
'parserPrograms.decompileRestIdentifiers.p4'([], _, _, _).
'parserPrograms.decompileRestIdentifiers.p4'([A|B], C, D, E) :-
        'iO.writeString.p2'(E, '";'),
        'parserPrograms.newLines.p2'(E, 1),
        'parserPrograms.decompileGroup.p6'(A, B, C, D, E, F),
        'parserPrograms.decompileRestIdentifiers.p4'(F, C, D, E).
'parserPrograms.decompileRestDelays.p4'([], _, _, _).
'parserPrograms.decompileRestDelays.p4'([A|B], C, D, E) :-
        'iO.writeString.p2'(E, '";'),
        'parserPrograms.newLines.p2'(E, 1),
        'parserPrograms.decompileDelay.p4'(A, C, D, E),
        'parserPrograms.decompileRestDelays.p4'(B, C, D, E).
'parserPrograms.decompilePropositions.p2'([], _).
'parserPrograms.decompilePropositions.p2'(['parserPrograms.iD.f2'(B,_)|A], C) :-
        'iO.writeString.p2'(C, '"PROPOSITION '),
        'iO.writeString.p2'(C, B),
        'parserPrograms.writeRestOfIdentifiers.p2'(A, C),
        'iO.writeString.p2'(C, '".'),
        'parserPrograms.newLines.p2'(C, 2).
'parserPrograms.decompileRestGroup.p4'([], _, _, []).
'parserPrograms.decompileRestGroup.p4'(['parserPrograms.iD.f2'(B,C)|A], D, E, F) :-
        (   'parserPrograms.variantDeclarations.p2'(C, D) ->
            'iO.writeString.p2'(E, '", '),
            'iO.writeString.p2'(E, B),
            F=G
        ;   F=['parserPrograms.iD.f2'(B,C)|G]
        ),
        'parserPrograms.decompileRestGroup.p4'(A, D, E, G).
'parserPrograms.decompileRestTypes.p4'([], _, _, _).
'parserPrograms.decompileRestTypes.p4'([A|B], C, D, E) :-
        'iO.writeString.p2'(E, '" * '),
        'sharedPrograms.sProgramTypeToString.p4'(C, D, A, F),
        'iO.writeString.p2'(E, F),
        'parserPrograms.decompileRestTypes.p4'(B, C, D, E).
'parserPrograms.decompileStatements.p4'([], _, _, _).
'parserPrograms.decompileStatements.p4'(['metaDefs.<-''.f2'(B,C)|A], D, E, F) :-
        'sharedPrograms.formulaToIntList.p4'(D, E, B, G),
        'parserPrograms.writeCodes.p2'(G, F),
        (   user:not_equal([], [C], C, 'metaDefs.empty.c0') ->
            'sharedPrograms.formulaToIntList.p4'(D, E, C, H),
            'iO.writeString.p2'(F, '" <-'),
            'parserPrograms.newLines.p2'(F, 1),
            'iO.writeString.p2'(F, '"   '),
            'parserPrograms.writeCodes.p2'(H, F)
        ;   true
        ),
        'iO.writeString.p2'(F, '".'),
        'parserPrograms.newLines.p2'(F, 1),
        'parserPrograms.decompileStatements.p4'(A, D, E, F).
'parserPrograms.displayPossibleTypes.p2'(A, B) :-
        'sharedPrograms.sMainModuleInProgram.p2'(A, C),
        'parserPrograms.goalSymbolTable.p3'(A, C, D),
        'parserPrograms.parserSymbols.p3'(B, D, E),
        (   E=[] ->
            'iO.writeString.p2'('iO.stdErr.c0', '"No such symbol.'),
            'iO.newLine.p1'('iO.stdErr.c0')
        ;   'sharedPrograms.moduleLanguage.p3'(A, C, F),
            'parserPrograms.divideCandidates.p11'(E, F, B, G, [], H, [], I, [], J, []),
            'parserPrograms.decompileConstants.p4'(G, A, C, 'iO.stdErr.c0'),
            'parserPrograms.decompileFunctions.p4'(H, A, C, 'iO.stdErr.c0'),
            'parserPrograms.decompilePropositions.p2'(I, 'iO.stdErr.c0'),
            'parserPrograms.decompilePredicates.p4'(J, A, C, 'iO.stdErr.c0')
        ).
'parserPrograms.dictionaryCandidates.p6'(A, B, C, D, E, F) :-
        (   'avlTrees.avlSearch.p3'(A, C, G) ->
            'parserPrograms.candidateNames.p6'(G, B, C, D, E, F)
        ;   F=E
        ).
'parserPrograms.decompileTypeLanguage.p4'(A, B, C, D) :-
        'parserPrograms.gatherDeclarations.p14'(A, B, E, F, G, H, _, _, _, _, _, _, _, _),
        'parserPrograms.gatherLiftedDeclarations.p5'(C, F, [], H, []),
        'parserPrograms.decompileBases.p2'(E, D),
        'parserPrograms.decompileConstructors.p2'(G, D).
'parserPrograms.dictionaryTypeCandidates.p6'(A, B, C, D, E, F) :-
        (   'avlTrees.avlSearch.p3'(A, C, G) ->
            'parserPrograms.candidateTypes.p6'(G, B, C, D, E, F)
        ;   F=E
        ).
'parserPrograms.exportDelaysOnly.p2'(A, B) :-
        'avlTrees.avlToBinary.p2'(A, C),
        'avlTrees.avlIsEmpty.p1'(D),
        'parserPrograms.binExportDelaysOnly.p3'(C, D, B).
'parserPrograms.divideCandidates.p11'([], _, _, A, A, B, B, C, C, D, D).
'parserPrograms.divideCandidates.p11'([A|B], C, D, E, F, G, H, I, J, K, L) :-
        'parserPrograms.candidateDeclaration.p3'(A, C, M),
        'parserPrograms.gatherDeclaration.p14'(M, D, _, _, _, _, E, N, G, O, I, P, K, Q),
        'parserPrograms.divideCandidates.p11'(B, C, D, N, F, O, H, P, J, Q, L).
'parserPrograms.localSymbolTable.p3'('progDefs.program.f4'(_,A,'progDefs.language.f1'(B),_), C, 'parserPrograms.symbTab.f4'(C,D,E,[])) :-
        (   'avlTrees.avlSearch.p3'(B, C, F) ->
            D=F
        ;   'sharedPrograms.emptyCategoryTable.p1'(G),
            D='progDefs.module.f3'('progDefs.hidden.c0',G,[])
        ),
        'avlTrees.avlSearch.p3'(A, C, 'progDefs.modDef.f4'(_,H,I,J)),
        'lists_g.append.p3'(H, I, K),
        'lists_g.append.p3'(J, K, L),
        'parserPrograms.initialImportedSymbols.p2'(B, M),
        'parserPrograms.importedSymbols.p5'(L, A, B, M, E).
'parserPrograms.goalSymbolTable.p3'(A, B, C) :-
        (   'sharedPrograms.sOpenModule.p2'(A, B) ->
            'parserPrograms.localSymbolTable.p3'(A, B, C)
        ;   'parserPrograms.exportSymbolTable.p3'(A, B, C)
        ).
'parserPrograms.gatherDeclarations.p14'('avlTrees.empty.c0', _, A, A, B, B, C, C, D, D, E, E, F, F).
'parserPrograms.gatherDeclarations.p14'('avlTrees.tree.f4'(A,B,C,D), E, F, G, H, I, J, K, L, M, N, O, P, Q) :-
        'parserPrograms.gatherDeclarationsAux.p15'(C, B, E, F, R, H, S, J, T, L, U, N, V, P, W),
        'parserPrograms.gatherDeclarations.p14'(A, E, R, X, S, Y, T, Z, U, A1, V, B1, W, C1),
        'parserPrograms.gatherDeclarations.p14'(D, E, X, G, Y, I, Z, K, A1, M, B1, O, C1, Q).
'parserPrograms.functionIndicator.p3'('syntax.xFX.f1'(A), '"xFx', A).
'parserPrograms.functionIndicator.p3'('syntax.xFY.f1'(A), '"xFy', A).
'parserPrograms.functionIndicator.p3'('syntax.yFX.f1'(A), '"yFx', A).
'parserPrograms.functionIndicator.p3'('syntax.xF.f1'(A), '"xF', A).
'parserPrograms.functionIndicator.p3'('syntax.fX.f1'(A), '"Fx', A).
'parserPrograms.functionIndicator.p3'('syntax.yF.f1'(A), '"yF', A).
'parserPrograms.functionIndicator.p3'('syntax.fY.f1'(A), '"Fy', A).
'parserPrograms.findModulePart.p3'(A, B, C) :-
        (   'parserPrograms.moduleExists.p2'(A, B) ->
            'parserPrograms.renameModuleAsOld.p2'(A, B)
        ;   true
        ),
        (   concat(A, B, D),
            'iO.findOutput.p2'(D, 'iO.out.f1'(E)) ->
            C=E
        ;   'iO.writeString.p2'('iO.stdErr.c0', '"Error: couldn''t open file '),
            concat(A, B, F),
            'iO.writeString.p2'('iO.stdErr.c0', F),
            'iO.newLine.p1'('iO.stdErr.c0'),
            fail
        ).
'parserPrograms.gatherDeclaration.p14'('progDefs.baseDecl.c0', A, ['parserPrograms.iD.f2'(A,'progDefs.baseDecl.c0')|B], B, C, C, D, D, E, E, F, F, G, G).
'parserPrograms.gatherDeclaration.p14'('progDefs.constructorDecl.f1'(A), B, C, C, ['parserPrograms.iD.f2'(B,'progDefs.constructorDecl.f1'(A))|D], D, E, E, F, F, G, G, H, H).
'parserPrograms.gatherDeclaration.p14'('progDefs.constantDecl.f1'(A), B, C, C, D, D, ['parserPrograms.iD.f2'(B,'progDefs.constantDecl.f1'(A))|E], E, F, F, G, G, H, H).
'parserPrograms.gatherDeclaration.p14'('progDefs.functionDecl.f4'(A,B,C,D), E, F, F, G, G, H, H, ['parserPrograms.iD.f2'(E,'progDefs.functionDecl.f4'(A,B,C,D))|I], I, J, J, K, K).
'parserPrograms.gatherDeclaration.p14'('progDefs.propositionDecl.c0', A, B, B, C, C, D, D, E, E, ['parserPrograms.iD.f2'(A,'progDefs.propositionDecl.c0')|F], F, G, G).
'parserPrograms.gatherDeclaration.p14'('progDefs.predicateDecl.f3'(A,B,C), D, E, E, F, F, G, G, H, H, I, I, ['parserPrograms.iD.f2'(D,'progDefs.predicateDecl.f3'(A,B,C))|J], J).
'parserPrograms.gatherDeclarationsAux.p15'([], _, _, A, A, B, B, C, C, D, D, E, E, F, F).
'parserPrograms.gatherDeclarationsAux.p15'([A|B], C, D, E, F, G, H, I, J, K, L, M, N, O, P) :-
        (   A='progDefs.symbol.f2'(D,Q) ->
            'parserPrograms.gatherDeclaration.p14'(Q, C, E, R, G, S, I, T, K, U, M, V, O, W)
        ;   E=R,
            G=S,
            I=T,
            K=U,
            M=V,
            O=W
        ),
        'parserPrograms.gatherDeclarationsAux.p15'(B, C, D, R, F, S, H, T, J, U, L, V, N, W, P).
'parserPrograms.gatherLiftedDeclarations.p5'([], A, A, B, B).
'parserPrograms.gatherLiftedDeclarations.p5'(['progDefs.lift.f2'(_,B)|A], C, D, E, F) :-
        'avlTrees.avlToBinary.p2'(B, G),
        'parserPrograms.gatherDeclarations.p14'(G, 'progDefs.exported.c0', C, H, E, I, _, _, _, _, _, _, _, _),
        'parserPrograms.gatherLiftedDeclarations.p5'(A, H, D, I, F).
'parserPrograms.itemCandidates.p4'('parserPrograms.importItem.f3'(A,_,B), C, D, E) :-
        'parserPrograms.dictionaryCandidates.p6'(B, A, C, 'progDefs.exported.c0', D, E).
'parserPrograms.itemCandidates.p4'('parserPrograms.liftedItem.f2'(_,_), _, A, A).
'parserPrograms.indent.p1'(A) :-
        'iO.writeString.p2'(A, '"   ').
'parserPrograms.importedSymbols.p5'([], _, _, A, A).
'parserPrograms.importedSymbols.p5'([A|B], C, D, E, F) :-
        (   'lists_g.member.p2'('parserPrograms.importItem.f3'(A,_,_), E) ->
            G=E,
            H=B
        ;   (   'lists_g.deleteFirst.p3'('parserPrograms.liftedItem.f2'(A,_), E, I) ->
                J=I
            ;   J=E
            ),
            (   'avlTrees.avlSearch.p3'(D, A, 'progDefs.module.f3'(_,'progDefs.categories.f2'(K,L),M)) ->
                'parserPrograms.addLiftedSymbols.p3'(M, J, N),
                G=['parserPrograms.importItem.f3'(A,K,L)|N]
            ;   'avlTrees.avlIsEmpty.p1'(O),
                G=['parserPrograms.importItem.f3'(A,O,O)|J]
            ),
            'avlTrees.avlSearch.p3'(C, A, 'progDefs.modDef.f4'(_,P,_,_)),
            'lists_g.append.p3'(P, B, H)
        ),
        'parserPrograms.importedSymbols.p5'(H, C, D, G, F).
'parserPrograms.initialImportedSymbols.p2'(A, ['parserPrograms.importItem.f3'('"',B,C)]) :-
        'avlTrees.avlSearch.p3'(A, '"', 'progDefs.module.f3'(_,'progDefs.categories.f2'(B,C),_)).
'parserPrograms.itemTypeCandidates.p4'('parserPrograms.liftedItem.f2'(A,B), C, D, E) :-
        'parserPrograms.dictionaryTypeCandidates.p6'(B, A, C, 'progDefs.exported.c0', D, E).
'parserPrograms.itemTypeCandidates.p4'('parserPrograms.importItem.f3'(A,B,_), C, D, E) :-
        'parserPrograms.dictionaryTypeCandidates.p6'(B, A, C, 'progDefs.exported.c0', D, E).
'parserPrograms.listExportDelaysOnly.p2'([], []).
'parserPrograms.listExportDelaysOnly.p2'(['progDefs.predDef.f4'(B,_,C,_)|A], ['progDefs.predDef.f4'(B,[],C,[])|D]) :-
        'parserPrograms.listExportDelaysOnly.p2'(A, D).
'parserPrograms.moduleTypeCandidates.p5'('progDefs.module.f3'(A,'progDefs.categories.f2'(B,_),_), C, D, E, F) :-
        'parserPrograms.dictionaryTypeCandidates.p6'(B, C, D, A, E, F).
'parserPrograms.moduleCandidates.p5'('progDefs.module.f3'(A,'progDefs.categories.f2'(_,B),_), C, D, E, F) :-
        'parserPrograms.dictionaryCandidates.p6'(B, C, D, A, E, F).
'parserPrograms.makeCandidate.p4'('progDefs.constantDecl.f1'(_), A, B, 'parserPrograms.fCandidate.f2'('metaDefs.name.f4'(A,B,'metaDefs.constant.c0',0),'syntax.noFunctInd.c0')).
'parserPrograms.makeCandidate.p4'('progDefs.functionDecl.f4'(A,B,_,_), C, D, 'parserPrograms.fCandidate.f2'('metaDefs.name.f4'(C,D,'metaDefs.function.c0',A),B)).
'parserPrograms.makeCandidate.p4'('progDefs.propositionDecl.c0', A, B, 'parserPrograms.pCandidate.f2'('metaDefs.name.f4'(A,B,'metaDefs.proposition.c0',0),'syntax.noPredInd.c0')).
'parserPrograms.makeCandidate.p4'('progDefs.predicateDecl.f3'(A,B,_), C, D, 'parserPrograms.pCandidate.f2'('metaDefs.name.f4'(C,D,'metaDefs.predicate.c0',A),B)).
'parserPrograms.moduleDeclaration.p3'(A, B, C) :-
        'iO.writeString.p2'(C, A),
        'iO.writeString.p2'(C, '" '),
        'iO.writeString.p2'(C, B),
        'iO.writeString.p2'(C, '".'),
        'parserPrograms.newLines.p2'(C, 2).
'parserPrograms.parserCheckFormula.p4'(A, B, C, D) :-
        'parserPrograms.checkFormulaAux.p6'(A, B, 0, [], E, F),
        (   E=[G] ->
            C=G,
            D=[]
        ;   E=[] ->
            D=F,
            C='metaDefs.empty.c0'
        ;   'parserPrograms.ambiguityError.p2'(E, H),
            D=[H],
            C='metaDefs.empty.c0'
        ).
'parserPrograms.newLines.p2'(A, B) :-
        (   'integers.>.p2'(B, 0) ->
            'iO.newLine.p1'(A),
            minus(B, 1, C),
            'parserPrograms.newLines.p2'(A, C)
        ;   true
        ).
'parserPrograms.quickInsertModuleDescriptor.p4'('progDefs.language.f1'(A), B, C, 'progDefs.language.f1'(D)) :-
        'avlTrees.avlInsert.p4'(A, B, C, D).
'parserPrograms.parserTypeSymbols.p3'(A, 'parserPrograms.symbTab.f4'(B,C,D,_), E) :-
        'parserPrograms.moduleTypeCandidates.p5'(C, B, A, [], F),
        'parserPrograms.tableTypeCandidates.p4'(D, A, F, E).
'parserPrograms.parserSymbols.p3'(A, 'parserPrograms.symbTab.f4'(B,C,D,_), E) :-
        'parserPrograms.moduleCandidates.p5'(C, B, A, [], F),
        'parserPrograms.tableCandidates.p4'(D, A, F, E).
'parserPrograms.parserInsert.p5'('parserPrograms.symbTab.f4'(A,'progDefs.module.f3'(B,'progDefs.categories.f2'(C,D),E),F,G), 'metaDefs.name.f4'(A,H,_,_), I, J, 'parserPrograms.symbTab.f4'(A,'progDefs.module.f3'(B,'progDefs.categories.f2'(C,K),E),F,G)) :-
        'avlTrees.avlAmend.p6'(D, H, ['progDefs.symbol.f2'(I,J)|L], [], K, L).
'parserPrograms.parserTypeInsert.p5'('parserPrograms.symbTab.f4'(A,'progDefs.module.f3'(B,'progDefs.categories.f2'(C,D),E),F,G), 'metaDefs.name.f4'(A,H,I,J), K, L, 'parserPrograms.symbTab.f4'(A,'progDefs.module.f3'(B,'progDefs.categories.f2'(M,D),N),O,G)) :-
        (   K='progDefs.exported.c0',
            'parserPrograms.typeFoundInModules.p5'(G, H, I, J, P),
            user:not_equal([], [P], P, []) ->
            M=C,
            'parserPrograms.updateLiftedSymbols.p5'(P, H, L, E, N),
            'parserPrograms.updateImportedSymbols.p4'(P, N, F, O)
        ;   O=F,
            N=E,
            'avlTrees.avlAmend.p6'(C, H, ['progDefs.symbol.f2'(K,L)|Q], [], M, Q)
        ).
'parserPrograms.quickInsertImport.p5'('progDefs.program.f4'(A,B,'progDefs.language.f1'(C),D), E, F, G, 'progDefs.program.f4'(A,H,'progDefs.language.f1'(I),J)) :-
        'avlTrees.avlUpdate.p5'(B, E, 'progDefs.modDef.f4'(K,L,M,N), O, 'progDefs.modDef.f4'(K,P,Q,N)),
        'sharedPrograms.addImportToPart.p6'(F, G, P, Q, L, M),
        (   'avlTrees.avlSearch.p3'(O, G, _) ->
            H=O,
            I=C,
            J=D
        ;   'sharedPrograms.addModule.p7'(G, O, C, D, H, I, J)
        ).
'parserPrograms.quickInsertDelay.p7'('progDefs.program.f4'(A,B,C,D), E, F, G, H, I, 'progDefs.program.f4'(A,B,C,J)) :-
        'avlTrees.avlUpdate.p5'(D, E, 'progDefs.code.f2'(K,L), J, 'progDefs.code.f2'(K,M)),
        'avlTrees.avlAmend.p6'(M, F, N, [], L, O),
        (   'lists_g.deleteFirst.p3'('progDefs.predDef.f4'(G,P,Q,R), O, S) ->
            'sharedPrograms.updateDelays.p6'(H, I, Q, R, T, U),
            N=['progDefs.predDef.f4'(G,P,T,U)|S]
        ;   'sharedPrograms.updateDelays.p6'(H, I, [], [], T, U),
            N=['progDefs.predDef.f4'(G,[],T,U)|O]
        ).
'parserPrograms.predicateIndicator.p2'('syntax.zPZ.c0', '"zPz').
'parserPrograms.predicateIndicator.p2'('syntax.zP.c0', '"zP').
'parserPrograms.predicateIndicator.p2'('syntax.pZ.c0', '"Pz').
'parserPrograms.quickInsertModuleCode.p4'('progDefs.program.f4'(A,B,C,D), E, F, 'progDefs.program.f4'(A,B,C,G)) :-
        'sharedPrograms.systemModule.p1'(E),
        'avlTrees.avlInsert.p4'(D, E, 'progDefs.code.f2'(0,F), G).
'parserPrograms.quickInsertLift.p4'('progDefs.program.f4'(A,B,'progDefs.language.f1'(C),D), E, F, 'progDefs.program.f4'(A,G,'progDefs.language.f1'(H),I)) :-
        'avlTrees.avlUpdate.p5'(B, E, 'progDefs.modDef.f4'(J,K,L,[F|M]), N, 'progDefs.modDef.f4'(J,K,L,M)),
        (   'avlTrees.avlSearch.p3'(N, F, _) ->
            G=N,
            H=C,
            I=D
        ;   'sharedPrograms.addModule.p7'(F, N, C, D, G, H, I)
        ).
'parserPrograms.quickInsertModuleDef.p4'('progDefs.program.f4'(A,B,C,D), E, F, 'progDefs.program.f4'(A,G,C,D)) :-
        'avlTrees.avlAmend.p6'(B, E, F, _, G, _).
'parserPrograms.tableTypeCandidates.p4'([], _, A, A).
'parserPrograms.tableTypeCandidates.p4'([A|B], C, D, E) :-
        'parserPrograms.itemTypeCandidates.p4'(A, C, D, F),
        'parserPrograms.tableTypeCandidates.p4'(B, C, F, E).
'parserPrograms.quickNewProgram.p3'(A, B, C) :-
    write("DJD system quicknewprogram\n"),
    write("A = "),write(A),nl,
    write("B = "),write(B),nl,
    write("C = "),write(C),nl,
        'sharedPrograms.programSkeleton.p4'(A, B, 0, C),
    write("DJD BBB system quicknewprogram\n"),
    write("A = "),write(A),nl,
    write("B = "),write(B),nl,
    write("C = "),write(C),nl.
'parserPrograms.quickMakeModule.p3'(A, 'progDefs.program.f4'(B,C,'progDefs.language.f1'(D),E), 'progDefs.program.f4'(B,F,'progDefs.language.f1'(G),H)) :-
        (   'avlTrees.avlSearch.p3'(C, A, _) ->
            F=C,
            G=D,
            H=E
        ;   'sharedPrograms.addModule.p7'(A, C, D, E, F, G, H)
        ).
'parserPrograms.quickInsertStatement.p6'('progDefs.program.f4'(A,B,C,D), E, F, G, H, 'progDefs.program.f4'(A,B,C,I)) :-
        'avlTrees.avlUpdate.p5'(D, E, 'progDefs.code.f2'(J,K), I, 'progDefs.code.f2'(J,L)),
        'avlTrees.avlAmend.p6'(L, F, M, [], K, N),
        (   'lists_g.deleteFirst.p3'('progDefs.predDef.f4'(G,O,P,Q), N, R) ->
            M=['progDefs.predDef.f4'(G,[H|O],P,Q)|R]
        ;   M=['progDefs.predDef.f4'(G,[H],[],[])|N]
        ).
'parserPrograms.replaceProgramLanguage.p3'('progDefs.program.f4'(A,B,_,C), D, 'progDefs.program.f4'(A,B,D,C)).
'parserPrograms.renameModuleAsOld.p2'(A, B) :-
        (   goedel_not((((concat(A,B,E),concat(E,'".old',D)),concat(A,B,C)),'parserPrograms.renameFile.p2'(C,D))) ->
            'iO.writeString.p2'('iO.stdErr.c0', '"Error: couldn''t rename '),
            concat(A, B, F),
            'iO.writeString.p2'('iO.stdErr.c0', F),
            'iO.writeString.p2'('iO.stdErr.c0', '" as '),
            concat(A, B, H),
            concat(H, '".old', G),
            'iO.writeString.p2'('iO.stdErr.c0', G),
            'iO.newLine.p1'('iO.stdErr.c0'),
            fail
        ;   true
        ).
'parserPrograms.tableCandidates.p4'([], _, A, A).
'parserPrograms.tableCandidates.p4'([A|B], C, D, E) :-
        'parserPrograms.itemCandidates.p4'(A, C, D, F),
        'parserPrograms.tableCandidates.p4'(B, C, F, E).
'parserPrograms.updateProgramLanguage.p4'('progDefs.program.f4'(A,B,'progDefs.language.f1'(C),D), E, 'parserPrograms.symbTab.f4'(E,F,_,_), 'progDefs.program.f4'(A,B,'progDefs.language.f1'(G),D)) :-
        'avlTrees.avlAmend.p6'(C, E, F, _, G, _).
'parserPrograms.typeFoundInModules.p5'([], _, _, _, []).
'parserPrograms.typeFoundInModules.p5'([A|B], C, D, E, F) :-
        (   'parserPrograms.typeFoundInItem.p5'(A, C, D, E, G) ->
            F=[G|H]
        ;   F=H
        ),
        'parserPrograms.typeFoundInModules.p5'(B, C, D, E, H).
'parserPrograms.typeFoundInItem.p5'('parserPrograms.importItem.f3'(A,B,_), C, D, E, A) :-
        'parserPrograms.typeFoundInDictionary.p4'(B, C, D, E).
'parserPrograms.typeFoundInItem.p5'('parserPrograms.liftedItem.f2'(A,B), C, D, E, A) :-
        'parserPrograms.typeFoundInDictionary.p4'(B, C, D, E).
'parserPrograms.typeFoundInDictionary.p4'(A, B, C, D) :-
        'avlTrees.avlSearch.p3'(A, B, E),
        'sharedPrograms.findDescriptor.p5'(E, 'progDefs.exported.c0', C, D, _).
'parserPrograms.updateLiftedSymbols.p5'([], _, _, A, A).
'parserPrograms.updateLiftedSymbols.p5'([A|B], C, D, E, F) :-
        (   'lists_g.deleteFirst.p3'('progDefs.lift.f2'(A,G), E, H) ->
            I=G,
            J=H
        ;   J=E,
            'avlTrees.avlIsEmpty.p1'(I)
        ),
        'avlTrees.avlAmend.p6'(I, C, ['progDefs.symbol.f2'('progDefs.exported.c0',D)|K], [], L, K),
        'parserPrograms.updateLiftedSymbols.p5'(B, C, D, ['progDefs.lift.f2'(A,L)|J], F).
'parserPrograms.updateImportedSymbols.p4'([], _, A, A).
'parserPrograms.updateImportedSymbols.p4'([A|B], C, D, E) :-
        'lists_g.memberCheck.p2'('progDefs.lift.f2'(A,F), C),
        (   'lists_g.deleteFirst.p3'('parserPrograms.liftedItem.f2'(A,_), D, G) ->
            H=['parserPrograms.liftedItem.f2'(A,F)|G]
        ;   'lists_g.memberCheck.p2'('parserPrograms.importItem.f3'(A,_,_), D) ->
            H=D
        ;   H=['parserPrograms.liftedItem.f2'(A,F)|D]
        ),
        'parserPrograms.updateImportedSymbols.p4'(B, C, H, E).
'parserPrograms.writeRestOfConstructors.p2'([], _).
'parserPrograms.writeRestOfConstructors.p2'(['parserPrograms.iD.f2'(B,C)|A], D) :-
        'iO.writeString.p2'(D, '", '),
        'parserPrograms.writeConstructor.p3'(B, C, D),
        'parserPrograms.writeRestOfConstructors.p2'(A, D).
'parserPrograms.writeCodes.p2'([], _).
'parserPrograms.writeCodes.p2'([A|B], C) :-
        'iO.put.p2'(C, A),
        'parserPrograms.writeCodes.p2'(B, C).
'parserPrograms.variantDeclarations.p2'('progDefs.constantDecl.f1'(A), 'progDefs.constantDecl.f1'(B)) :-
        'parserPrograms.VariantTypelists_g.p2'([A], [B]).
'parserPrograms.variantDeclarations.p2'('progDefs.functionDecl.f4'(_,_,A,B), 'progDefs.functionDecl.f4'(_,_,C,D)) :-
        'parserPrograms.VariantTypelists_g.p2'([B|A], [D|C]).
'parserPrograms.variantDeclarations.p2'('progDefs.predicateDecl.f3'(_,_,A), 'progDefs.predicateDecl.f3'(_,_,B)) :-
        'parserPrograms.VariantTypelists_g.p2'(A, B).
'parserPrograms.writeConstructor.p3'(A, 'progDefs.constructorDecl.f1'(B), C) :-
        'iO.writeString.p2'(C, A),
        'iO.writeString.p2'(C, '"/'),
        'sharedSyntax.integerToCharDL.p3'(B, D, []),
        'strings.stringInts.p2'(E, D),
        'iO.writeString.p2'(C, E).
'parserPrograms.writeRestOfIdentifiers.p2'([], _).
'parserPrograms.writeRestOfIdentifiers.p2'(['parserPrograms.iD.f2'(B,_)|A], C) :-
        'iO.writeString.p2'(C, '", '),
        'iO.writeString.p2'(C, B),
        'parserPrograms.writeRestOfIdentifiers.p2'(A, C).
'parserPrograms.writeRestOfStringList.p2'([], _).
'parserPrograms.writeRestOfStringList.p2'([A|B], C) :-
        'iO.writeString.p2'(C, '", '),
        'iO.writeString.p2'(C, A),
        'parserPrograms.writeRestOfStringList.p2'(B, C).
%------------------------------------------------------------------------------
% Basic file manipulation, for decompiler
%------------------------------------------------------------------------------
 
'parserPrograms.moduleExists.p2'(GModule, GSuffix) :-
   gstring2string(GModule, Module),
   gstring2string(GSuffix, Suffix),
   file_exist(Module, Suffix).

'~parserPrograms.moduleExists.p2'(GModule, GSuffix) :- 
   'parserPrograms.moduleExists.p2'(GModule, GSuffix).

'parserPrograms.renameFile.p2'(GFrom, GTo) :-
   gstring2string(GFrom, From),
   gstring2string(GTo, To),
   sappend(To, ' 2>/dev/null', Cmnd1),
   sappend(' ', Cmnd1, Cmnd2),
   sappend(From, Cmnd2, Cmnd3),
   sappend('mv ', Cmnd3, Command),
   unix(system(Command, 0)).

'~parserPrograms.renameFile.p2'(GFrom, GTo) :-
   'parserPrograms.renameFile.p2'(GFrom, GTo).

%------------------------------------------------------------------------------
% Check for variant types, for decompiler
%------------------------------------------------------------------------------

'parserPrograms.VariantTypelists_g.p2'(ListA, ListB) :-
   'parserSyntax.pCheckVariantTypes.p4'(ListA, [], _, ListB).

'~parserPrograms.VariantTypelists_g.p2'(ListA, ListB) :-
   'parserPrograms.VariantTypelists_g.p2'(ListA, ListB).
:- op(500, yfx, and).
:- op(400, yfx, or).

'sharedPrograms.modulePartInProgram.p3'('progDefs.program.f4'(_,A,_,_), B, C) :-
        'sharedPrograms.avlFind.p3'(A, B, 'progDefs.modDef.f4'(D,_,_,_)),
        'sharedPrograms.kindHasPart.p2'(D, C).
'sharedPrograms.initialiseLanguage.p2'(A, B) :-
        'sharedPrograms.insertSymbol.p5'('metaDefs.name.f4'('"','"True','metaDefs.proposition.c0',0), A, 'progDefs.exported.c0', 'progDefs.propositionDecl.c0', C),
        'sharedPrograms.insertSymbol.p5'('metaDefs.name.f4'('"','"False','metaDefs.proposition.c0',0), C, 'progDefs.exported.c0', 'progDefs.propositionDecl.c0', D),
        'sharedPrograms.insertSymbol.p5'('metaDefs.name.f4'('"','"=','metaDefs.predicate.c0',2), D, 'progDefs.exported.c0', 'progDefs.predicateDecl.f3'(2,'syntax.zPZ.c0',['metaDefs.par.f1'(0),'metaDefs.par.f1'(0)]), E),
        'sharedPrograms.insertSymbol.p5'('metaDefs.name.f4'('"','"~=','metaDefs.predicate.c0',2), E, 'progDefs.exported.c0', 'progDefs.predicateDecl.f3'(2,'syntax.zPZ.c0',['metaDefs.par.f1'(0),'metaDefs.par.f1'(0)]), B).
'sharedPrograms.chainExprToIntDL.p6'('metaDefs.cTerm.f1'(_), _, _, _, A, A).
'sharedPrograms.chainExprToIntDL.p6'('metaDefs.var.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('"|', F, H),
        'sharedPrograms.termToIntDL.p9'('metaDefs.var.f2'(A,B), C, D, E, _, _, _, H, G).
'sharedPrograms.chainExprToIntDL.p6'('metaDefs.var.f1'(A), B, C, D, E, F) :-
        'sharedPrograms.charDL.p3'('"|', E, G),
        'sharedPrograms.termToIntDL.p9'('metaDefs.var.f1'(A), B, C, D, _, _, _, G, F).
'sharedPrograms.chainExprToIntDL.p6'('metaDefs.term.f2'(_,[A,B]), C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('",', F, H),
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, H, I),
        'sharedPrograms.chainExprToIntDL.p6'(B, C, D, E, I, G).
'sharedPrograms.addOtherModulesAux.p7'([], A, B, C, A, B, C).
'sharedPrograms.addOtherModulesAux.p7'([A|B], C, D, E, F, G, H) :-
        'sharedPrograms.addModule.p7'(A, C, D, E, I, J, K),
        'sharedPrograms.addOtherModulesAux.p7'(B, I, J, K, F, G, H).
'sharedPrograms.addModule.p7'(A, B, C, D, E, F, G) :-
        (   'sharedPrograms.systemModule.p1'(A) ->
            'sharedPrograms.systemModuleRep.p4'(A, H, I, J),
            'avlTrees.avlInsert.p4'(B, A, H, K),
            'avlTrees.avlInsert.p4'(C, A, I, L),
            'avlTrees.avlInsert.p4'(D, A, 'progDefs.code.f2'(0,J), M),
            'sharedPrograms.addOtherModules.p7'(H, K, L, M, E, F, G)
        ;   'avlTrees.avlInsert.p4'(B, A, 'progDefs.modDef.f4'('progDefs.normalKind.c0',[],[],[]), E),
            F=C,
            'avlTrees.avlIsEmpty.p1'(N),
            'sharedPrograms.nextModuleVersion.p2'(A, O),
            'avlTrees.avlInsert.p4'(D, A, 'progDefs.code.f2'(O,N), G)
        ).
'sharedPrograms.addImportToPart.p6'('progDefs.export.c0', A, B, C, [A|B], C).
'sharedPrograms.addImportToPart.p6'('progDefs.closed.c0', A, B, C, [A|B], C).
'sharedPrograms.addImportToPart.p6'('progDefs.local.c0', A, B, C, B, [A|C]).
'sharedPrograms.addImportToPart.p6'('progDefs.module.c0', A, B, C, B, [A|C]).
'sharedPrograms.accessible.p2'('progDefs.exported.c0', 'progDefs.exported.c0').
'sharedPrograms.accessible.p2'('progDefs.hidden.c0', _).
'sharedPrograms.addLiftedLanguage.p4'([], _, A, A).
'sharedPrograms.addLiftedLanguage.p4'(['progDefs.lift.f2'(B,C)|A], D, E, F) :-
        (   'lists_g.member.p2'(B, D) ->
            G=E
        ;   'avlTrees.avlIsEmpty.p1'(H),
            (   'avlTrees.avlUpdate.p5'(E, B, 'progDefs.module.f3'('progDefs.exported.c0','progDefs.categories.f2'(I,H),[]), J, 'progDefs.module.f3'(_,'progDefs.categories.f2'(K,_),_)) ->
                'avlTrees.avlJoin.p3'(C, K, I),
                G=J
            ;   'avlTrees.avlInsert.p4'(E, B, 'progDefs.module.f3'('progDefs.exported.c0','progDefs.categories.f2'(C,H),[]), G)
            )
        ),
        'sharedPrograms.addLiftedLanguage.p4'(A, D, G, F).
'sharedPrograms.addOtherModules.p7'('progDefs.modDef.f4'(_,A,B,C), D, E, F, G, H, I) :-
        'lists_g.append.p3'(C, A, J),
        'lists_g.append.p3'(B, J, K),
        'sharedPrograms.addOtherModulesAux.p7'(K, D, E, F, G, H, I).
'sharedPrograms.binaryConnective.p3'('metaDefs.&''.f2'(A,B), A, B).
'sharedPrograms.binaryConnective.p3'('metaDefs.\\/''.f2'(A,B), A, B). % added \ djd
'sharedPrograms.binaryConnective.p3'('metaDefs.->''.f2'(A,B), A, B).
'sharedPrograms.binaryConnective.p3'('metaDefs.<-''.f2'(A,B), A, B).
'sharedPrograms.binaryConnective.p3'('metaDefs.<->''.f2'(A,B), A, B).
'sharedPrograms.baseInLanguage.p2'(A, B) :-
        'sharedPrograms.typeSymbolInLanguage.p3'(A, B, 'progDefs.baseDecl.c0').
'sharedPrograms.atomToIntDL.p8'('syntax.noPredInd.c0', 'metaDefs.name.f4'(A,B,C,D), E, F, G, H, I, J) :-
        (   A='"Integers',
            B='"Interval',
            C='metaDefs.predicate.c0',
            D=3 ->
            E=[K,L,M],
            'sharedPrograms.classifyToken.p2'('"=<', N),
            'strings.stringInts.p2'('"=<', O),
            'sharedPrograms.termToIntDL.p9'(K, F, G, H, _, _, P, I, Q),
            'sharedPrograms.spaceIfNeeded.p4'(P, N, Q, R),
            'lists_g.append.p3'(O, S, R),
            'sharedPrograms.termToIntDL.p9'(L, F, G, H, _, T, U, V, W),
            'sharedPrograms.spaceIfNeeded.p4'(N, T, S, V),
            'sharedPrograms.spaceIfNeeded.p4'(U, N, W, X),
            'lists_g.append.p3'(O, Y, X),
            'sharedPrograms.termToIntDL.p9'(M, F, G, H, _, Z, _, A1, J),
            'sharedPrograms.spaceIfNeeded.p4'(N, Z, Y, A1)
        ;   'strings.stringInts.p2'(B, B1),
            'lists_g.append.p3'(B1, Q, I),
            'sharedPrograms.charDL.p3'('"(', Q, R),
            'sharedPrograms.termListToIntDL.p6'(E, F, G, H, R, S),
            'sharedPrograms.charDL.p3'('")', S, J)
        ).
'sharedPrograms.atomToIntDL.p8'('syntax.zPZ.c0', 'metaDefs.name.f4'(_,A,_,_), [B,C], D, E, F, G, H) :-
        'sharedPrograms.termToIntDL.p9'(B, D, E, F, _, _, I, G, J),
        'sharedPrograms.classifyToken.p2'(A, K),
        'sharedPrograms.spaceIfNeeded.p4'(I, K, J, L),
        'strings.stringInts.p2'(A, M),
        'lists_g.append.p3'(M, N, L),
        'sharedPrograms.termToIntDL.p9'(C, D, E, F, _, O, _, P, H),
        'sharedPrograms.spaceIfNeeded.p4'(O, K, N, P).
'sharedPrograms.atomToIntDL.p8'('syntax.zP.c0', 'metaDefs.name.f4'(_,A,_,_), [B], C, D, E, F, G) :-
        'sharedPrograms.termToIntDL.p9'(B, C, D, E, _, _, H, F, I),
        'sharedPrograms.classifyToken.p2'(A, J),
        'sharedPrograms.spaceIfNeeded.p4'(H, J, I, K),
        'strings.stringInts.p2'(A, L),
        'lists_g.append.p3'(L, G, K).
'sharedPrograms.atomToIntDL.p8'('syntax.pZ.c0', 'metaDefs.name.f4'(_,A,_,_), [B], C, D, E, F, G) :-
        'sharedPrograms.classifyToken.p2'(A, H),
        'strings.stringInts.p2'(A, I),
        'lists_g.append.p3'(I, J, F),
        'sharedPrograms.termToIntDL.p9'(B, C, D, E, _, K, _, L, G),
        'sharedPrograms.spaceIfNeeded.p4'(K, H, J, L).
'sharedPrograms.andSeqToIntDL.p3'('progDefs.and.f2'(A,B), C, D) :-
        'sharedPrograms.simpleCondToIntDL.p3'(A, C, E),
        'strings.stringInts.p2'('" & ', F),
        'lists_g.append.p3'(F, G, E),
        (   B='progDefs.and.f2'(_,_) ->
            'sharedPrograms.andSeqToIntDL.p3'(B, G, D)
        ;   'sharedPrograms.simpleCondToIntDL.p3'(B, G, D)
        ).
'sharedPrograms.binConnectiveChars.p3'('metaDefs.&''.f2'(_,_), A, B) :-
        'strings.stringInts.p2'('" & ', C),
        'lists_g.append.p3'(C, B, A).
'sharedPrograms.binConnectiveChars.p3'('metaDefs.\\/''.f2'(_,_), A, B) :- % added \ djd
        'strings.stringInts.p2'('" \\/ ', C), % added \ djd
        'lists_g.append.p3'(C, B, A).
'sharedPrograms.binConnectiveChars.p3'('metaDefs.->''.f2'(_,_), A, B) :-
        'strings.stringInts.p2'('" -> ', C),
        'lists_g.append.p3'(C, B, A).
'sharedPrograms.binConnectiveChars.p3'('metaDefs.<-''.f2'(_,_), A, B) :-
        'strings.stringInts.p2'('" <- ', C),
        'lists_g.append.p3'(C, B, A).
'sharedPrograms.binConnectiveChars.p3'('metaDefs.<->''.f2'(_,_), A, B) :-
        'strings.stringInts.p2'('" <-> ', C),
        'lists_g.append.p3'(C, B, A).
'sharedPrograms.binaryInfixToIntDL.p12'(A, 'metaDefs.name.f4'(B,C,_,_), D, E, F, G, H, I, J, K, L, M) :-
        (   B='"Rationals',
            C='"//',
            D='metaDefs.int.f1'(N),
            E='metaDefs.int.f1'(O) ->
            'sharedPrograms.rationalToIntDL.p9'(N, O, F, G, I, J, K, L, M)
        ;   I=A,
            'sharedPrograms.termToIntDL.p9'(D, F, G, H, P, Q, R, S, T),
            'sharedPrograms.termToIntDL.p9'(E, F, G, H, U, V, W, X, Y),
            'sharedPrograms.classifyToken.p2'(C, Z),
            (   'sharedPrograms.rPrec.p2'(P, A1),
                'sharedPrograms.lPrec.p2'(A, B1),
                'sharedPrograms.bindsTighter.p2'(A1, B1) ->
                J=Q,
                L=S,
                'sharedPrograms.spaceIfNeeded.p4'(R, Z, T, C1)
            ;   J='sharedPrograms.bounded.c0',
                'sharedPrograms.charDL.p3'('"(', L, S),
                'sharedPrograms.charDL.p3'('")', T, C1)
            ),
            'strings.stringInts.p2'(C, D1),
            'lists_g.append.p3'(D1, E1, C1),
            (   'sharedPrograms.lPrec.p2'(U, F1),
                'sharedPrograms.rPrec.p2'(A, G1),
                'sharedPrograms.bindsTighter.p2'(F1, G1) ->
                K=W,
                'sharedPrograms.spaceIfNeeded.p4'(Z, V, E1, X),
                M=Y
            ;   K='sharedPrograms.bounded.c0',
                'sharedPrograms.charDL.p3'('"(', E1, X),
                'sharedPrograms.charDL.p3'('")', Y, M)
            )
        ).
'sharedPrograms.binaryFormulaToIntDL.p6'(A, B, C, D, E, F) :-
        'sharedPrograms.binaryConnective.p3'(A, G, H),
        'sharedPrograms.formulaToIntDL.p6'(G, B, C, D, I, J),
        'sharedPrograms.formulaToIntDL.p6'(H, B, C, D, K, L),
        (   'sharedPrograms.cRPrec.p2'(G, M),
            'sharedPrograms.cLPrec.p2'(A, N),
            'sharedPrograms.bindsTighter.p2'(M, N) ->
            E=I,
            O=J
        ;   'sharedPrograms.charDL.p3'('"(', E, I),
            'sharedPrograms.charDL.p3'('")', J, O)
        ),
        'sharedPrograms.binConnectiveChars.p3'(A, O, P),
        (   'sharedPrograms.cLPrec.p2'(H, Q),
            'sharedPrograms.cRPrec.p2'(A, R),
            'sharedPrograms.bindsTighter.p2'(Q, R) ->
            P=K,
            F=L
        ;   'sharedPrograms.charDL.p3'('"(', P, K),
            'sharedPrograms.charDL.p3'('")', L, F)
        ).
'sharedPrograms.cLPrec.p2'('metaDefs.empty.c0', 'sharedPrograms.infinity.c0').
'sharedPrograms.cLPrec.p2'('metaDefs.pAtom.f1'(_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cLPrec.p2'('metaDefs.atom.f2'(_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cLPrec.p2'('metaDefs.~''.f1'(_), 'sharedPrograms.prec.f2'(120,'sharedPrograms.X.c0')).
'sharedPrograms.cLPrec.p2'('metaDefs.&''.f2'(_,_), 'sharedPrograms.prec.f2'(100,'sharedPrograms.X.c0')).
'sharedPrograms.cLPrec.p2'('metaDefs.\\/''.f2'(_,_), 'sharedPrograms.prec.f2'(90,'sharedPrograms.X.c0')). % added \ djd
'sharedPrograms.cLPrec.p2'('metaDefs.->''.f2'(_,_), 'sharedPrograms.prec.f2'(80,'sharedPrograms.X.c0')).
'sharedPrograms.cLPrec.p2'('metaDefs.<-''.f2'(_,_), 'sharedPrograms.prec.f2'(80,'sharedPrograms.X.c0')).
'sharedPrograms.cLPrec.p2'('metaDefs.<->''.f2'(_,_), 'sharedPrograms.prec.f2'(80,'sharedPrograms.X.c0')).
'sharedPrograms.cLPrec.p2'('metaDefs.some.f2'(_,_), 'sharedPrograms.prec.f2'(120,'sharedPrograms.X.c0')).
'sharedPrograms.cLPrec.p2'('metaDefs.all.f2'(_,_), 'sharedPrograms.prec.f2'(120,'sharedPrograms.X.c0')).
'sharedPrograms.cLPrec.p2'('metaDefs.commit.f2'(_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cLPrec.p2'('metaDefs.iSTE.f4'(_,_,_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cLPrec.p2'('metaDefs.iST.f3'(_,_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cLPrec.p2'('metaDefs.iTE.f3'(_,_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cLPrec.p2'('metaDefs.iT.f2'(_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.bindsTighter.p2'('sharedPrograms.infinity.c0', _).
'sharedPrograms.bindsTighter.p2'('sharedPrograms.prec.f2'(A,B), 'sharedPrograms.prec.f2'(C,D)) :-
        call_residue(A=C, E),
        (   E=[] ->
            true
        ;   user:flounder_commit(E)
        ), !,
        B='sharedPrograms.X.c0',
        D='sharedPrograms.Y.c0'.
'sharedPrograms.bindsTighter.p2'('sharedPrograms.prec.f2'(A,_), 'sharedPrograms.prec.f2'(B,_)) :-
        call_residue('integers.>.p2'(A,B), C),
        (   C=[] ->
            true
        ;   user:flounder_commit(C)
        ), !.
'sharedPrograms.cRPrec.p2'('metaDefs.empty.c0', 'sharedPrograms.infinity.c0').
'sharedPrograms.cRPrec.p2'('metaDefs.pAtom.f1'(_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cRPrec.p2'('metaDefs.atom.f2'(_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cRPrec.p2'('metaDefs.~''.f1'(_), 'sharedPrograms.prec.f2'(120,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.&''.f2'(_,_), 'sharedPrograms.prec.f2'(100,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.\\/''.f2'(_,_), 'sharedPrograms.prec.f2'(90,'sharedPrograms.Y.c0')).  % added \ djd
'sharedPrograms.cRPrec.p2'('metaDefs.->''.f2'(_,_), 'sharedPrograms.prec.f2'(80,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.<-''.f2'(_,_), 'sharedPrograms.prec.f2'(80,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.<->''.f2'(_,_), 'sharedPrograms.prec.f2'(80,'sharedPrograms.X.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.some.f2'(_,_), 'sharedPrograms.prec.f2'(120,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.all.f2'(_,_), 'sharedPrograms.prec.f2'(120,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.commit.f2'(_,_), 'sharedPrograms.infinity.c0').
'sharedPrograms.cRPrec.p2'('metaDefs.iSTE.f4'(_,_,_,_), 'sharedPrograms.prec.f2'(70,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.iST.f3'(_,_,_), 'sharedPrograms.prec.f2'(70,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.iTE.f3'(_,_,_), 'sharedPrograms.prec.f2'(70,'sharedPrograms.Y.c0')).
'sharedPrograms.cRPrec.p2'('metaDefs.iT.f2'(_,_), 'sharedPrograms.prec.f2'(70,'sharedPrograms.Y.c0')).
'sharedPrograms.emptyCategoryTable.p1'('progDefs.categories.f2'(A,A)) :-
        'avlTrees.avlIsEmpty.p1'(A).
'sharedPrograms.constantInLanguage.p3'(A, B, C) :-
        'sharedPrograms.symbolInLanguage.p3'(A, B, 'progDefs.constantDecl.f1'(C)).
'sharedPrograms.checkHeadArgs1.p4'([], _, _, []).
'sharedPrograms.checkHeadArgs1.p4'([A|B], [C|D], [E|F], G) :-
        'sharedPrograms.variantTypes.p4'(A, C, E, H),
        'lists_g.append.p3'(H, I, G),
        'sharedPrograms.checkHeadArgs1.p4'(B, D, F, I).
'sharedPrograms.checkHeadArgs.p4'('metaDefs.pAtom.f1'(_), _, _, []).
'sharedPrograms.checkHeadArgs.p4'('metaDefs.atom.f2'(A,B), C, D, E) :-
        'sharedPrograms.predicateInLanguage.p4'(A, D, _, F),
        'sharedPrograms.meltTypeList.p4'(F, [], _, G),
        'sharedPrograms.checkHeadArgs1.p4'(G, C, B, E).
'sharedPrograms.conditionToIntDL.p3'(A, B, C) :-
        (   A='progDefs.and.f2'(_,_) ->
            'sharedPrograms.andSeqToIntDL.p3'(A, B, C)
        ;   A='progDefs.or.f2'(_,_) ->
            'sharedPrograms.orSeqToIntDL.p3'(A, B, C)
        ;   'sharedPrograms.simpleCondToIntDL.p3'(A, B, C)
        ).
'sharedPrograms.cookRationalTerm.p2'(A, B) :-
        (   'integers.<.p2'(A, 0) ->
            negative(A, D),
            C=D,
            B='metaDefs.term.f2'('metaDefs.name.f4'('"Rationals','"-','metaDefs.function.c0',1),['metaDefs.int.f1'(C)])
        ;   B='metaDefs.int.f1'(A)
        ).
'sharedPrograms.constructorInLanguage.p3'(A, B, C) :-
        'sharedPrograms.typeSymbolInLanguage.p3'(A, B, 'progDefs.constructorDecl.f1'(C)).
'sharedPrograms.constantToIntDL.p4'('metaDefs.name.f4'(A,B,C,_), D, E, F) :-
        (   A='"lists_g',
            B='"Nil',
            C='metaDefs.constant.c0' ->
            D='sharedPrograms.bounded.c0',
            'sharedPrograms.charDL.p3'('"[', E, G),
            'sharedPrograms.charDL.p3'('"]', G, F)
        ;   A='"Sets',
            B='"Null',
            C='metaDefs.constant.c0' ->
            D='sharedPrograms.bounded.c0',
            'sharedPrograms.charDL.p3'('"{', E, G),
            'sharedPrograms.charDL.p3'('"}', G, F)
        ;   'sharedPrograms.classifyToken.p2'(B, D),
            'strings.stringInts.p2'(B, H),
            'lists_g.append.p3'(H, F, E)
        ).
'sharedPrograms.containsConditional.p1'('metaDefs.iSTE.f4'(_,_,_,_)).
'sharedPrograms.containsConditional.p1'('metaDefs.iST.f3'(_,_,_)).
'sharedPrograms.containsConditional.p1'('metaDefs.iTE.f3'(_,_,_)).
'sharedPrograms.containsConditional.p1'('metaDefs.iT.f2'(_,_)).
'sharedPrograms.containsConditional.p1'('metaDefs.&''.f2'(A,B)) :-
        user:one_solution(('sharedPrograms.containsConditional.p1'(A);'sharedPrograms.containsConditional.p1'(B))).
'sharedPrograms.divideBindings.p4'([], A, A, []).
'sharedPrograms.divideBindings.p4'([A|B], C, D, E) :-
        'sharedPrograms.isVariable.p1'(A),
        'sharedPrograms.divideBindingsAux.p5'(C, A, F, E, G),
        'sharedPrograms.divideBindings.p4'(B, F, D, G).
'sharedPrograms.deleteUnderscores.p2'([], []).
'sharedPrograms.deleteUnderscores.p2'([A|B], C) :-
        (   concat('"_', _, D),
            A='metaDefs.var.f2'(D,_) ->
            C=E
        ;   C=[A|E]
        ),
        'sharedPrograms.deleteUnderscores.p2'(B, E).
'sharedPrograms.divideBindingsAux.p5'([], _, [], A, A).
'sharedPrograms.divideBindingsAux.p5'(['metaDefs.@.f2'(B,C)|A], D, E, F, G) :-
        (   D=B ->
            F=['metaDefs.@.f2'(B,C)|G],
            E=A
        ;   E=['metaDefs.@.f2'(B,C)|H],
            'sharedPrograms.divideBindingsAux.p5'(A, D, H, F, G)
        ).
'sharedPrograms.formulaInLanguage.p4'(A, B, 'metaDefs.varTyping.f1'(C), 'metaDefs.varTyping.f1'(D)) :-
        'sharedPrograms.meltVariableTyping.p4'(C, B, [], E),
        'sharedPrograms.meltedFormulaTyping.p8'(A, B, E, D, _, [], [], []),
        'sharedPrograms.fixVariableTyping.p2'(D, 0).
'sharedPrograms.exportLanguage.p3'('progDefs.program.f4'(_,A,'progDefs.language.f1'(B),_), C, 'progDefs.language.f1'(D)) :-
        'sharedPrograms.emptyLanguage.p1'('progDefs.language.f1'(E)),
        'sharedPrograms.importedLanguage.p6'([C], A, B, [], E, D).
'sharedPrograms.expandString.p3'(A, B, C) :-
        'sharedPrograms.charDL.p3'('""', B, D),
        'sharedPrograms.expandStringAux.p3'(A, D, C).
'sharedPrograms.emptyLanguage.p1'(A) :-
        'avlTrees.avlIsEmpty.p1'(B),
        'sharedPrograms.initialiseLanguage.p2'('progDefs.language.f1'(B), A).
'sharedPrograms.expandStringAux.p3'([], A, B) :-
        'sharedPrograms.charDL.p3'('""', A, B).
'sharedPrograms.expandStringAux.p3'([A|B], C, D) :-
        (   A=34 ->
            'sharedPrograms.charDL.p3'('"\\', C, E),  % added \ djd
            'sharedPrograms.charDL.p3'('""', E, F)
        ;   A=92 ->
            'sharedPrograms.charDL.p3'('"\\', C, E),  % added \ djd
            'sharedPrograms.charDL.p3'('"\\', E, F)  % added \ djd
        ;   C=[A|F]
        ),
        'sharedPrograms.expandStringAux.p3'(B, F, D).
'sharedPrograms.fixVariableTyping.p2'([], _).
'sharedPrograms.fixVariableTyping.p2'(['metaDefs.@.f2'(_,B)|A], C) :-
        'sharedPrograms.fixType.p3'(B, C, D),
        'sharedPrograms.fixVariableTyping.p2'(A, D).
'sharedPrograms.functionInLanguage.p5'(A, B, C, D, E) :-
        'sharedPrograms.symbolInLanguage.p3'(A, B, 'progDefs.functionDecl.f4'(_,C,D,E)).
'sharedPrograms.formulaToIntList.p4'(A, B, C, D) :-
        'sharedPrograms.programLanguage.p2'(A, E),
        'sharedPrograms.moduleLanguage.p3'(A, B, F),
        'sharedPrograms.formulaInLanguage.p4'(C, E, 'metaDefs.varTyping.f1'([]), 'metaDefs.varTyping.f1'(G)),
        'sharedPrograms.formulaToIntDL.p6'(C, F, E, G, D, []).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.empty.c0', _, _, _, A, A).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.pAtom.f1'(A), B, _, _, C, D) :-
        'sharedPrograms.propositionInLanguage.p2'(A, B),
        A='metaDefs.name.f4'(_,E,_,_),
        'strings.stringInts.p2'(E, F),
        'lists_g.append.p3'(F, D, C).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.atom.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.predicateInLanguage.p4'(A, C, H, _),
        'sharedPrograms.atomToIntDL.p8'(H, A, B, C, D, E, F, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.~''.f1'(A), B, C, D, E, F) :-
        'sharedPrograms.charDL.p3'('"~', E, G),
        'sharedPrograms.formulaToIntDL.p6'(A, B, C, D, H, I),
        (   'sharedPrograms.cLPrec.p2'(A, J),
            'sharedPrograms.cRPrec.p2'('metaDefs.~''.f1'(_), K),
            'sharedPrograms.bindsTighter.p2'(J, K) ->
            G=H,
            F=I
        ;   'sharedPrograms.charDL.p3'('"(', G, H),
            'sharedPrograms.charDL.p3'('")', I, F)
        ).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.&''.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.binaryFormulaToIntDL.p6'('metaDefs.&''.f2'(A,B), C, D, E, F, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.\\/''.f2'(A,B), C, D, E, F, G) :-  % added \ djd
        'sharedPrograms.binaryFormulaToIntDL.p6'('metaDefs.\\/''.f2'(A,B), C, D, E, F, G).  % added \ djd
'sharedPrograms.formulaToIntDL.p6'('metaDefs.->''.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.binaryFormulaToIntDL.p6'('metaDefs.->''.f2'(A,B), C, D, E, F, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.<-''.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.binaryFormulaToIntDL.p6'('metaDefs.<-''.f2'(A,B), C, D, E, F, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.<->''.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.binaryFormulaToIntDL.p6'('metaDefs.<->''.f2'(A,B), C, D, E, F, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.all.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.quantifiedFormulaToIntDL.p6'('metaDefs.all.f2'(A,B), C, D, E, F, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.some.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.quantifiedFormulaToIntDL.p6'('metaDefs.some.f2'(A,B), C, D, E, F, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.iSTE.f4'(A,B,C,D), E, F, G, H, I) :-
        'strings.stringInts.p2'('"IF ', J),
        'lists_g.append.p3'(J, K, H),
        'sharedPrograms.formulaToIntDL.p6'('metaDefs.some.f2'(A,B), E, F, G, K, L),
        'strings.stringInts.p2'('" THEN ', M),
        'lists_g.append.p3'(M, N, L),
        'sharedPrograms.thenPartToIntDL.p6'(C, E, F, G, N, O),
        'strings.stringInts.p2'('" ELSE ', P),
        'lists_g.append.p3'(P, Q, O),
        'sharedPrograms.formulaToIntDL.p6'(D, E, F, G, Q, I).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.iTE.f3'(A,B,C), D, E, F, G, H) :-
        'strings.stringInts.p2'('"IF ', I),
        'lists_g.append.p3'(I, J, G),
        'sharedPrograms.formulaToIntDL.p6'(A, D, E, F, K, L),
        (   A='metaDefs.some.f2'(_,_) ->
            'sharedPrograms.charDL.p3'('"(', J, K),
            'sharedPrograms.charDL.p3'('")', L, M)
        ;   J=K,
            M=L
        ),
        'strings.stringInts.p2'('" THEN ', N),
        'lists_g.append.p3'(N, O, M),
        'sharedPrograms.thenPartToIntDL.p6'(B, D, E, F, O, P),
        'strings.stringInts.p2'('" ELSE ', Q),
        'lists_g.append.p3'(Q, R, P),
        'sharedPrograms.formulaToIntDL.p6'(C, D, E, F, R, H).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.iST.f3'(A,B,C), D, E, F, G, H) :-
        'strings.stringInts.p2'('"IF ', I),
        'lists_g.append.p3'(I, J, G),
        'sharedPrograms.formulaToIntDL.p6'('metaDefs.some.f2'(A,B), D, E, F, J, K),
        'strings.stringInts.p2'('" THEN ', L),
        'lists_g.append.p3'(L, M, K),
        'sharedPrograms.thenPartToIntDL.p6'(C, D, E, F, M, H).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.iT.f2'(A,B), C, D, E, F, G) :-
        'strings.stringInts.p2'('"IF ', H),
        'lists_g.append.p3'(H, I, F),
        'sharedPrograms.formulaToIntDL.p6'(A, C, D, E, J, K),
        (   A='metaDefs.some.f2'(_,_) ->
            'sharedPrograms.charDL.p3'('"(', I, J),
            'sharedPrograms.charDL.p3'('")', K, L)
        ;   I=J,
            L=K
        ),
        'strings.stringInts.p2'('" THEN ', M),
        'lists_g.append.p3'(M, N, L),
        'sharedPrograms.thenPartToIntDL.p6'(B, C, D, E, N, G).
'sharedPrograms.formulaToIntDL.p6'('metaDefs.commit.f2'(A,B), C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('"{', F, H),
        'sharedPrograms.formulaToIntDL.p6'(B, C, D, E, H, I),
        'sharedPrograms.charDL.p3'('"}', I, J),
        'sharedPrograms.charDL.p3'('"_', J, K),
        'sharedSyntax.integerToCharDL.p3'(A, K, G).
'sharedPrograms.importedLanguage.p6'([], _, _, _, A, A).
'sharedPrograms.importedLanguage.p6'([A|B], C, D, E, F, G) :-
        (   'lists_g.member.p2'(A, E) ->
            H=F,
            I=E,
            J=B
        ;   I=[A|E],
            (   'avlTrees.avlSearch.p3'(D, A, 'progDefs.module.f3'(_,K,L)) ->
                'avlTrees.avlAmend.p6'(F, A, 'progDefs.module.f3'('progDefs.exported.c0',K,[]), _, M, _),
                'sharedPrograms.addLiftedLanguage.p4'(L, I, M, H)
            ;   'sharedPrograms.emptyCategoryTable.p1'(N),
                'avlTrees.avlAmend.p6'(F, A, 'progDefs.module.f3'('progDefs.exported.c0',N,[]), _, H, _)
            ),
            'avlTrees.avlSearch.p3'(C, A, 'progDefs.modDef.f4'(_,O,_,_)),
            'lists_g.append.p3'(O, B, J)
        ),
        'sharedPrograms.importedLanguage.p6'(J, C, D, I, H, G).
'sharedPrograms.headAtom.p9'('metaDefs.pAtom.f1'(A), B, C, C, 'metaDefs.pAtom.f1'(A), D, D, [], []) :-
        'sharedPrograms.propositionInLanguage.p2'(A, B).
'sharedPrograms.headAtom.p9'('metaDefs.atom.f2'(A,B), C, D, E, 'metaDefs.atom.f2'(A,F), G, H, I, J) :-
        'sharedPrograms.predicateInLanguage.p4'(A, C, _, K),
        'sharedPrograms.meltTypeList.p4'(K, [], _, I),
        'sharedPrograms.meltedArgumentTyping.p9'(I, B, C, D, E, F, G, H, J).
'sharedPrograms.matchingDescriptor.p5'('progDefs.symbol.f2'(A,B), C, D, E, B) :-
        'sharedPrograms.accessible.p2'(C, A),
        'sharedPrograms.matchingName.p3'(B, D, E).
'sharedPrograms.kindHasPart.p2'('progDefs.moduleKind.c0', 'progDefs.module.c0').
'sharedPrograms.kindHasPart.p2'('progDefs.normalKind.c0', A) :-
        'sharedPrograms.findMember.p2'(A, ['progDefs.export.c0','progDefs.local.c0']).
'sharedPrograms.kindHasPart.p2'('progDefs.closedKind.c0', 'progDefs.closed.c0').
'sharedPrograms.insertTypeSymbol.p5'('metaDefs.name.f4'(A,B,C,D), 'progDefs.language.f1'(E), F, G, 'progDefs.language.f1'(H)) :-
        'avlTrees.avlIsEmpty.p1'(I),
        'avlTrees.avlIsEmpty.p1'(J),
        'avlTrees.avlAmend.p6'(E, A, 'progDefs.module.f3'(K,'progDefs.categories.f2'(L,M),N), 'progDefs.module.f3'('progDefs.hidden.c0','progDefs.categories.f2'(I,J),[]), H, 'progDefs.module.f3'(K,'progDefs.categories.f2'(O,M),N)),
        'avlTrees.avlAmend.p6'(O, B, P, [], L, Q),
        'sharedPrograms.matchingName.p3'(G, C, D),
        'sharedPrograms.addToDescriptorList.p6'(Q, K, C, D, 'progDefs.symbol.f2'(F,G), P).
'sharedPrograms.insertSymbol.p5'('metaDefs.name.f4'(A,B,C,D), 'progDefs.language.f1'(E), F, G, 'progDefs.language.f1'(H)) :-
        'avlTrees.avlIsEmpty.p1'(I),
        'avlTrees.avlIsEmpty.p1'(J),
        'avlTrees.avlAmend.p6'(E, A, 'progDefs.module.f3'(K,'progDefs.categories.f2'(L,M),N), 'progDefs.module.f3'('progDefs.hidden.c0','progDefs.categories.f2'(I,J),[]), H, 'progDefs.module.f3'(K,'progDefs.categories.f2'(L,O),N)),
        'avlTrees.avlAmend.p6'(O, B, P, [], M, Q),
        'sharedPrograms.matchingName.p3'(G, C, D),
        'sharedPrograms.addToDescriptorList.p6'(Q, K, C, D, 'progDefs.symbol.f2'(F,G), P).
'sharedPrograms.isVariable.p1'('metaDefs.var.f2'(_,_)).
'sharedPrograms.isVariable.p1'('metaDefs.var.f1'(_)).
'sharedPrograms.lookupParDict.p4'(A, B, C, D) :-
        'sharedPrograms.lookupParDictAux.p5'(A, B, A, C, D).
'sharedPrograms.listExprToIntDL.p6'([A,B], C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('"[', F, H),
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, H, I),
        'sharedPrograms.chainExprToIntDL.p6'(B, C, D, E, I, J),
        'sharedPrograms.charDL.p3'('"]', J, G).
'sharedPrograms.lPrec.p2'('syntax.noFunctInd.c0', 'sharedPrograms.infinity.c0').
'sharedPrograms.lPrec.p2'('syntax.xFX.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.lPrec.p2'('syntax.xFY.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.lPrec.p2'('syntax.yFX.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.Y.c0')).
'sharedPrograms.lPrec.p2'('syntax.fX.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.lPrec.p2'('syntax.fY.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.lPrec.p2'('syntax.xF.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.lPrec.p2'('syntax.yF.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.Y.c0')).
'sharedPrograms.listTypesInLanguage.p2'([], _).
'sharedPrograms.listTypesInLanguage.p2'([A|B], C) :-
        'sharedPrograms.typeInLanguage.p2'(A, C),
        'sharedPrograms.listTypesInLanguage.p2'(B, C).
'sharedPrograms.lookupVarTyping.p4'(A, B, C, D) :-
        'sharedPrograms.lookupVarTypingAux.p5'(A, B, A, C, D).
'sharedPrograms.lookupParDictAux.p5'([], A, B, ['metaDefs.!.f2'(A,C)|B], C).
'sharedPrograms.lookupParDictAux.p5'(['metaDefs.!.f2'(B,C)|A], D, E, F, G) :-
        (   D=B ->
            G=C,
            F=E
        ;   'sharedPrograms.lookupParDictAux.p5'(A, D, E, F, G)
        ).
'sharedPrograms.lookupVarTypingAux.p5'([], A, B, ['metaDefs.@.f2'(A,C)|B], C).
'sharedPrograms.lookupVarTypingAux.p5'(['metaDefs.@.f2'(B,C)|A], D, E, F, G) :-
        (   D=B ->
            G=C,
            F=E
        ;   'sharedPrograms.lookupVarTypingAux.p5'(A, D, E, F, G)
        ).
'sharedPrograms.meltedFormulaTyping.p8'(A, B, C, D, E, F, G, H) :-
        (   A='metaDefs.<-''.f2'(I,J) ->
            'sharedPrograms.meltedBodyTyping.p8'(I, B, C, K, L, F, M, N),
            (   N=[] ->
                'sharedPrograms.meltedBodyTyping.p8'(J, B, K, D, O, M, G, H),
                E='metaDefs.<-''.f2'(L,O)
            ;   H=N
            )
        ;   'sharedPrograms.meltedBodyTyping.p8'(A, B, C, D, E, F, G, H)
        ).
'sharedPrograms.meltVariableTyping.p4'([], _, _, []).
'sharedPrograms.meltVariableTyping.p4'(['metaDefs.@.f2'(B,C)|A], D, E, ['metaDefs.@.f2'(B,G)|F]) :-
        'sharedPrograms.isVariable.p1'(B),
        'sharedPrograms.typeInLanguage.p2'(C, D),
        'sharedPrograms.meltType.p4'(C, E, H, G),
        'sharedPrograms.meltVariableTyping.p4'(A, D, H, F).
'sharedPrograms.meltType.p4'('metaDefs.par.f2'(A,B), C, D, E) :-
        'sharedPrograms.lookupParDict.p4'(C, 'metaDefs.par.f2'(A,B), D, E).
'sharedPrograms.meltType.p4'('metaDefs.par.f1'(A), B, C, D) :-
        'sharedPrograms.lookupParDict.p4'(B, 'metaDefs.par.f1'(A), C, D).
'sharedPrograms.meltType.p4'('metaDefs.bType.f1'(A), B, B, 'metaDefs.bType.f1'(A)).
'sharedPrograms.meltType.p4'('metaDefs.xBType.f1'(A), B, B, 'metaDefs.xBType.f1'(A)).
'sharedPrograms.meltType.p4'('metaDefs.type.f2'(A,B), C, D, 'metaDefs.type.f2'(A,E)) :-
        'sharedPrograms.meltTypeList.p4'(B, C, D, E).
'sharedPrograms.meltType.p4'('metaDefs.xType.f2'(A,B), C, D, 'metaDefs.xType.f2'(A,E)) :-
        'sharedPrograms.meltTypeList.p4'(B, C, D, E).
'sharedPrograms.matchingName.p3'('progDefs.baseDecl.c0', 'metaDefs.base.c0', 0).
'sharedPrograms.matchingName.p3'('progDefs.constructorDecl.f1'(A), 'metaDefs.constructor.c0', A).
'sharedPrograms.matchingName.p3'('progDefs.constantDecl.f1'(_), 'metaDefs.constant.c0', 0).
'sharedPrograms.matchingName.p3'('progDefs.functionDecl.f4'(A,_,_,_), 'metaDefs.function.c0', A).
'sharedPrograms.matchingName.p3'('progDefs.propositionDecl.c0', 'metaDefs.proposition.c0', 0).
'sharedPrograms.matchingName.p3'('progDefs.predicateDecl.f3'(A,_,_), 'metaDefs.predicate.c0', A).
'sharedPrograms.meltTypeList.p4'([], A, A, []).
'sharedPrograms.meltTypeList.p4'([A|B], C, D, [E|F]) :-
        'sharedPrograms.meltType.p4'(A, C, G, E),
        'sharedPrograms.meltTypeList.p4'(B, G, D, F).
'sharedPrograms.meltedAtomTyping.p8'('metaDefs.pAtom.f1'(A), B, C, C, 'metaDefs.pAtom.f1'(A), D, D, []) :-
        'sharedPrograms.propositionInLanguage.p2'(A, B).
'sharedPrograms.meltedAtomTyping.p8'('metaDefs.xPAtom.f1'(A), B, C, C, 'metaDefs.xPAtom.f1'(A), D, D, []) :-
        'sharedPrograms.propositionInLanguage.p2'(A, B).
'sharedPrograms.meltedAtomTyping.p8'('metaDefs.atom.f2'(A,B), C, D, E, 'metaDefs.atom.f2'(A,F), G, H, I) :-
        'sharedPrograms.predicateInLanguage.p4'(A, C, _, J),
        'sharedPrograms.meltTypeList.p4'(J, [], _, K),
        'sharedPrograms.meltedArgumentTyping.p9'(K, B, C, D, E, F, G, H, I).
'sharedPrograms.meltedAtomTyping.p8'('metaDefs.xAtom.f2'(A,B), C, D, E, 'metaDefs.xAtom.f2'(A,F), G, H, I) :-
        'sharedPrograms.predicateInLanguage.p4'(A, C, _, J),
        'sharedPrograms.meltTypeList.p4'(J, [], _, K),
        'sharedPrograms.meltedArgumentTyping.p9'(K, B, C, D, E, F, G, H, I).
'sharedPrograms.meltedArgumentTyping.p9'([], [], _, A, A, [], B, B, []).
'sharedPrograms.meltedArgumentTyping.p9'([A|B], [C|D], E, F, G, [H|I], J, K, L) :-
        'sharedPrograms.meltedTermType.p9'(C, A, E, F, M, H, J, N, O),
        (   O=[] ->
            'sharedPrograms.meltedArgumentTyping.p9'(B, D, E, M, G, I, N, K, L)
        ;   L=O
        ).
'sharedPrograms.meltedBodyTyping.p8'(A, B, C, D, E, F, G, H) :-
        (   A='metaDefs.empty.c0' ->
            D=C,
            F=G,
            H=[],
            E='metaDefs.empty.c0'
        ;   A='metaDefs.&''.f2'(I,J) ->
            'sharedPrograms.meltedBodyTyping.p8'(I, B, C, K, L, F, M, N),
            (   N=[] ->
                'sharedPrograms.meltedBodyTyping.p8'(J, B, K, D, O, M, G, H),
                E='metaDefs.&''.f2'(L,O)
            ;   H=N
            )
        ;   A='metaDefs.commit.f2'(P,Q) ->
            'sharedPrograms.meltedBodyTyping.p8'(Q, B, C, D, L, F, G, H),
            E='metaDefs.commit.f2'(P,L)
        ;   'sharedPrograms.meltedStandardTyping.p8'(A, B, C, D, E, F, G, H)
        ).
'sharedPrograms.meltedTermType.p9'('metaDefs.var.f2'(A,B), C, _, D, E, 'metaDefs.var.f2'(A,B), F, F, G) :-
        'sharedPrograms.lookupVarTyping.p4'(D, 'metaDefs.var.f2'(A,B), E, H),
        'sharedPrograms.unifyMeltedTypes.p4'(C, H, 'metaDefs.var.f2'(A,B), G).
'sharedPrograms.meltedTermType.p9'('metaDefs.var.f1'(A), B, _, C, D, 'metaDefs.var.f1'(A), E, E, F) :-
        'sharedPrograms.lookupVarTyping.p4'(C, 'metaDefs.var.f1'(A), D, G),
        'sharedPrograms.unifyMeltedTypes.p4'(B, G, 'metaDefs.var.f1'(A), F).
'sharedPrograms.meltedTermType.p9'('metaDefs.cTerm.f1'(A), B, C, D, D, 'metaDefs.cTerm.f1'(A), E, E, F) :-
        'sharedPrograms.constantInLanguage.p3'(A, C, G),
        'sharedPrograms.meltType.p4'(G, [], _, H),
        'sharedPrograms.unifyMeltedTypes.p4'(B, H, 'metaDefs.cTerm.f1'(A), F).
'sharedPrograms.meltedTermType.p9'('metaDefs.xCTerm.f2'(A,_), B, C, D, D, 'metaDefs.xCTerm.f2'(A,E), F, F, G) :-
        'sharedPrograms.constantInLanguage.p3'(A, C, H),
        'sharedPrograms.meltType.p4'(H, [], _, E),
        'sharedPrograms.unifyMeltedTypes.p4'(B, E, 'metaDefs.cTerm.f1'(A), G).
'sharedPrograms.meltedTermType.p9'('metaDefs.term.f2'(A,B), C, D, E, F, 'metaDefs.term.f2'(A,G), H, I, J) :-
        'sharedPrograms.functionInLanguage.p5'(A, D, _, K, L),
        'sharedPrograms.meltType.p4'(L, [], M, N),
        'sharedPrograms.meltTypeList.p4'(K, M, _, O),
        'sharedPrograms.unifyMeltedTypes.p4'(C, N, 'metaDefs.term.f2'(A,B), P),
        (   P=[] ->
            'sharedPrograms.meltedArgumentTyping.p9'(O, B, D, E, F, G, H, I, J)
        ;   J=P
        ).
'sharedPrograms.meltedTermType.p9'('metaDefs.xTerm.f3'(A,B,_), C, D, E, F, 'metaDefs.xTerm.f3'(A,G,H), I, J, K) :-
        'sharedPrograms.functionInLanguage.p5'(A, D, _, L, M),
        'sharedPrograms.meltType.p4'(M, [], N, H),
        'sharedPrograms.meltTypeList.p4'(L, N, _, O),
        'sharedPrograms.unifyMeltedTypes.p4'(C, H, 'metaDefs.term.f2'(A,B), P),
        (   P=[] ->
            'sharedPrograms.meltedArgumentTyping.p9'(O, B, D, E, F, G, I, J, K)
        ;   K=P
        ).
'sharedPrograms.meltedTermType.p9'('metaDefs.int.f1'(A), B, C, D, D, 'metaDefs.int.f1'(A), E, E, F) :-
        G='metaDefs.name.f4'('"Integers','"Integer','metaDefs.base.c0',0),
        'sharedPrograms.baseInLanguage.p2'(G, C),
        'sharedPrograms.unifyMeltedTypes.p4'(B, 'metaDefs.bType.f1'(G), 'metaDefs.int.f1'(A), F).
'sharedPrograms.meltedTermType.p9'('metaDefs.str.f1'(A), B, C, D, D, 'metaDefs.str.f1'(A), E, E, F) :-
        G='metaDefs.name.f4'('"Strings','"String','metaDefs.base.c0',0),
        'sharedPrograms.baseInLanguage.p2'(G, C),
        'sharedPrograms.unifyMeltedTypes.p4'(B, 'metaDefs.bType.f1'(G), 'metaDefs.str.f1'(A), F).
'sharedPrograms.meltedTermType.p9'('metaDefs.prm.f1'(A), B, C, D, D, 'metaDefs.prm.f1'(A), E, E, F) :-
        G='metaDefs.name.f4'('"ProgDefs','"Program','metaDefs.base.c0',0),
        'sharedPrograms.baseInLanguage.p2'(G, C),
        'sharedPrograms.unifyMeltedTypes.p4'(B, 'metaDefs.bType.f1'(G), 'metaDefs.prm.f1'(A), F).
'sharedPrograms.meltedTermType.p9'('metaDefs.suchThat.f2'(A,B), C, D, E, F, 'metaDefs.suchThat.f2'(G,H), I, J, K) :-
        L='metaDefs.name.f4'('"Sets','"Set','metaDefs.constructor.c0',1),
        'sharedPrograms.constructorInLanguage.p3'(L, D, _),
        'sharedPrograms.unifyMeltedTypes.p4'(C, 'metaDefs.type.f2'(L,[M]), 'metaDefs.suchThat.f2'(A,B), N),
        (   N=[] ->
            'sharedSyntax.sTermFreeVars.p2'(A, O),
            'sharedPrograms.divideBindings.p4'(O, E, P, Q),
            'sharedPrograms.meltedStandardTyping.p8'(B, D, P, R, H, I, S, T),
            (   T=[] ->
                'sharedPrograms.meltedTermType.p9'(A, M, D, R, U, G, S, J, K),
                (   K=[] ->
                    'sharedPrograms.divideBindings.p4'(O, U, V, _),
                    'lists_g.append.p3'(Q, V, F)
                ;   true
                )
            ;   K=T
            )
        ;   K=N
        ).
'sharedPrograms.meltedTermType.p9'('metaDefs.num.f1'(A), B, C, D, D, E, F, G, H) :-
        (   'sharedPrograms.baseInLanguage.p2'('metaDefs.name.f4'('"Rationals','"Rational','metaDefs.base.c0',0), C) ->
            F=['sharedPrograms.numType.f3'(A,'metaDefs.bType.f1'(I),E)|G],
            'sharedPrograms.unifyMeltedTypes.p4'(B, 'metaDefs.bType.f1'(I), 'metaDefs.num.f1'(A), H)
        ;   'sharedPrograms.meltedTermType.p9'('metaDefs.int.f1'(A), B, C, D, _, E, F, G, H)
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.iSTE.f4'(A,B,C,D), E, F, G, 'metaDefs.iSTE.f4'(A,H,I,J), K, L, M) :-
        'sharedPrograms.divideBindings.p4'(A, F, N, O),
        'sharedPrograms.meltedStandardTyping.p8'(B, E, N, P, H, K, Q, R),
        (   R=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(C, E, P, S, I, Q, T, U),
            (   U=[] ->
                'sharedPrograms.divideBindings.p4'(A, S, V, _),
                'lists_g.append.p3'(O, V, W),
                'sharedPrograms.meltedStandardTyping.p8'(D, E, W, G, J, T, L, M)
            ;   M=U
            )
        ;   M=R
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.iST.f3'(A,B,C), D, E, F, 'metaDefs.iST.f3'(A,G,H), I, J, K) :-
        'sharedPrograms.divideBindings.p4'(A, E, L, M),
        'sharedPrograms.meltedStandardTyping.p8'(B, D, L, N, G, I, O, P),
        (   P=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(C, D, N, Q, H, O, J, K),
            (   K=[] ->
                'sharedPrograms.divideBindings.p4'(A, Q, R, _),
                'lists_g.append.p3'(M, R, F)
            ;   true
            )
        ;   K=P
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.iTE.f3'(A,B,C), D, E, F, 'metaDefs.iTE.f3'(G,H,I), J, K, L) :-
        'sharedPrograms.meltedStandardTyping.p8'(A, D, E, M, G, J, N, O),
        (   O=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(B, D, M, P, H, N, Q, R),
            (   R=[] ->
                'sharedPrograms.meltedStandardTyping.p8'(C, D, P, F, I, Q, K, L)
            ;   L=R
            )
        ;   L=O
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.iT.f2'(A,B), C, D, E, 'metaDefs.iT.f2'(F,G), H, I, J) :-
        'sharedPrograms.meltedStandardTyping.p8'(A, C, D, K, F, H, L, M),
        (   M=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(B, C, K, E, G, L, I, J)
        ;   J=M
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.&''.f2'(A,B), C, D, E, 'metaDefs.&''.f2'(F,G), H, I, J) :-
        'sharedPrograms.meltedStandardTyping.p8'(A, C, D, K, F, H, L, M),
        (   M=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(B, C, K, E, G, L, I, J)
        ;   J=M
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.\\/''.f2'(A,B), C, D, E, 'metaDefs.\\/''.f2'(F,G), H, I, J) :-  % added 2 \ djd
        'sharedPrograms.meltedStandardTyping.p8'(A, C, D, K, F, H, L, M),
        (   M=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(B, C, K, E, G, L, I, J)
        ;   J=M
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.->''.f2'(A,B), C, D, E, 'metaDefs.->''.f2'(F,G), H, I, J) :-
        'sharedPrograms.meltedStandardTyping.p8'(A, C, D, K, F, H, L, M),
        (   M=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(B, C, K, E, G, L, I, J)
        ;   J=M
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.<-''.f2'(A,B), C, D, E, 'metaDefs.<-''.f2'(F,G), H, I, J) :-
        'sharedPrograms.meltedStandardTyping.p8'(A, C, D, K, F, H, L, M),
        (   M=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(B, C, K, E, G, L, I, J)
        ;   J=M
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.<->''.f2'(A,B), C, D, E, 'metaDefs.<->''.f2'(F,G), H, I, J) :-
        'sharedPrograms.meltedStandardTyping.p8'(A, C, D, K, F, H, L, M),
        (   M=[] ->
            'sharedPrograms.meltedStandardTyping.p8'(B, C, K, E, G, L, I, J)
        ;   J=M
        ).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.~''.f1'(A), B, C, D, 'metaDefs.~''.f1'(E), F, G, H) :-
        'sharedPrograms.meltedStandardTyping.p8'(A, B, C, D, E, F, G, H).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.all.f2'(A,B), C, D, E, 'metaDefs.all.f2'(A,F), G, H, I) :-
        'sharedPrograms.divideBindings.p4'(A, D, J, K),
        'sharedPrograms.meltedStandardTyping.p8'(B, C, J, L, F, G, H, I),
        'sharedPrograms.divideBindings.p4'(A, L, M, _),
        'lists_g.append.p3'(K, M, E).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.some.f2'(A,B), C, D, E, 'metaDefs.some.f2'(A,F), G, H, I) :-
        'sharedPrograms.divideBindings.p4'(A, D, J, K),
        'sharedPrograms.meltedStandardTyping.p8'(B, C, J, L, F, G, H, I),
        'sharedPrograms.divideBindings.p4'(A, L, M, _),
        'lists_g.append.p3'(K, M, E).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.pAtom.f1'(A), B, C, D, E, F, G, H) :-
        'sharedPrograms.meltedAtomTyping.p8'('metaDefs.pAtom.f1'(A), B, C, D, E, F, G, H).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.atom.f2'(A,B), C, D, E, F, G, H, I) :-
        'sharedPrograms.meltedAtomTyping.p8'('metaDefs.atom.f2'(A,B), C, D, E, F, G, H, I).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.xPAtom.f1'(A), B, C, D, E, F, G, H) :-
        'sharedPrograms.meltedAtomTyping.p8'('metaDefs.xPAtom.f1'(A), B, C, D, E, F, G, H).
'sharedPrograms.meltedStandardTyping.p8'('metaDefs.xAtom.f2'(A,B), C, D, E, F, G, H, I) :-
        'sharedPrograms.meltedAtomTyping.p8'('metaDefs.xAtom.f2'(A,B), C, D, E, F, G, H, I).
'sharedPrograms.moduleLanguage.p3'('progDefs.program.f4'(_,A,'progDefs.language.f1'(B),_), C, 'progDefs.language.f1'(D)) :-
        'sharedPrograms.emptyLanguage.p1'('progDefs.language.f1'(E)),
        'avlTrees.avlSearch.p3'(A, C, 'progDefs.modDef.f4'(F,G,H,I)),
        (   F='progDefs.closedKind.c0' ->
            'sharedPrograms.importedLanguage.p6'([C], A, B, [], E, D)
        ;   (   'avlTrees.avlSearch.p3'(B, C, J) ->
                'avlTrees.avlInsert.p4'(E, C, J, K)
            ;   K=E
            ),
            'lists_g.append.p3'(G, H, L),
            'lists_g.append.p3'(I, L, M),
            'sharedPrograms.importedLanguage.p6'(M, A, B, [C], K, D)
        ).
'sharedPrograms.symbolInLanguage.p3'('metaDefs.name.f4'(A,B,C,D), 'progDefs.language.f1'(E), F) :-
        'sharedPrograms.avlFind.p3'(E, A, 'progDefs.module.f3'(G,'progDefs.categories.f2'(_,H),_)),
        'sharedPrograms.avlFind.p3'(H, B, I),
        'sharedPrograms.findDescriptor.p5'(I, G, C, D, F).
'sharedPrograms.sControlInProgram.p5'('progDefs.program.f4'(_,A,'progDefs.language.f1'(B),C), D, E, F, G) :-
        E='metaDefs.name.f4'(D,H,_,I),
        'sharedPrograms.avlFind.p3'(B, D, 'progDefs.module.f3'(_,'progDefs.categories.f2'(_,J),_)),
        'sharedPrograms.avlFind.p3'(J, H, K),
        (   D='"' ->
            L='progDefs.closedKind.c0',
            M='progDefs.exported.c0'
        ;   'avlTrees.avlSearch.p3'(A, D, 'progDefs.modDef.f4'(L,_,_,_)),
            (   L='progDefs.closedKind.c0' ->
                M='progDefs.exported.c0'
            ;   M='progDefs.hidden.c0'
            )
        ),
        'sharedPrograms.findDescriptor.p5'(K, M, _, I, 'progDefs.predicateDecl.f3'(_,_,_)),
        (   'avlTrees.avlSearch.p3'(C, D, 'progDefs.code.f2'(_,N)),
            'avlTrees.avlSearch.p3'(N, H, O),
            'sharedPrograms.findPredDef.p3'(I, O, 'progDefs.predDef.f4'(I,_,P,Q)) ->
            (   L='progDefs.closedKind.c0' ->
                R=P
            ;   'lists_g.append.p3'(P, Q, R)
            ),
            'sharedPrograms.reformatDelays.p3'(R, F, G)
        ;   F=[],
            G=[]
        ).
'sharedPrograms.programSkeleton.p4'(A, B, C, 'progDefs.program.f4'(A,D,E,F)) :-
        'avlTrees.avlIsEmpty.p1'(G),
        'avlTrees.avlIsEmpty.p1'(H),
        'avlTrees.avlIsEmpty.p1'(I),
        'avlTrees.avlInsert.p4'(G, A, 'progDefs.modDef.f4'(B,[],[],[]), D),
        'avlTrees.avlInsert.p4'(H, A, 'progDefs.code.f2'(C,I), F),
        'sharedPrograms.emptyLanguage.p1'(E).
'sharedPrograms.openModuleAux.p2'(A, B) :-
        'sharedPrograms.avlFind.p3'(A, B, 'progDefs.modDef.f4'(C,_,_,_)),
        'sharedPrograms.openKind.p1'(C).
'sharedPrograms.openKind.p1'('progDefs.normalKind.c0').
'sharedPrograms.openKind.p1'('progDefs.moduleKind.c0').
'sharedPrograms.mustBracketThen.p1'('metaDefs.iTE.f3'(_,_,_)).
'sharedPrograms.mustBracketThen.p1'('metaDefs.iSTE.f4'(_,_,_,_)).
'sharedPrograms.mustBracketThen.p1'('metaDefs.&''.f2'(A,B)) :-
        'sharedPrograms.containsConditional.p1'('metaDefs.&''.f2'(A,B)).
'sharedPrograms.predicateInLanguage.p4'(A, B, C, D) :-
        'sharedPrograms.symbolInLanguage.p3'(A, B, 'progDefs.predicateDecl.f3'(_,C,D)).
'sharedPrograms.orSeqToIntDL.p3'('progDefs.or.f2'(A,B), C, D) :-
        'sharedPrograms.simpleCondToIntDL.p3'(A, C, E),
        'strings.stringInts.p2'('" \\/ ', F), % added \ djd
        'lists_g.append.p3'(F, G, E),
        (   B='progDefs.or.f2'(_,_) ->
            'sharedPrograms.orSeqToIntDL.p3'(B, G, D)
        ;   'sharedPrograms.simpleCondToIntDL.p3'(B, G, D)
        ).
'sharedPrograms.programLanguage.p2'('progDefs.program.f4'(_,_,A,_), A).
'sharedPrograms.rationalTerm.p2'(A, 'metaDefs.term.f2'('metaDefs.name.f4'('"Rationals','"//','metaDefs.function.c0',2),['metaDefs.int.f1'(A),'metaDefs.int.f1'(1)])).
'sharedPrograms.quantifiedFormulaToIntDL.p6'(A, B, C, D, E, F) :-
        'sharedPrograms.quantifiedFormula.p3'(A, G, H),
        'sharedPrograms.deleteUnderscores.p2'(G, I),
        (   I=[] ->
            'sharedPrograms.formulaToIntDL.p6'(H, B, C, D, E, F)
        ;   'sharedPrograms.quantifierChars.p3'(A, E, J),
            'sharedPrograms.varListToIntDL.p6'(G, B, C, D, J, K),
            'sharedPrograms.charDL.p3'('" ', K, L),
            'sharedPrograms.formulaToIntDL.p6'(H, B, C, D, M, N),
            (   'sharedPrograms.cLPrec.p2'(H, O),
                'sharedPrograms.cRPrec.p2'(A, P),
                'sharedPrograms.bindsTighter.p2'(O, P) ->
                L=M,
                F=N
            ;   'sharedPrograms.charDL.p3'('"(', L, M),
                'sharedPrograms.charDL.p3'('")', N, F)
            )
        ).
'sharedPrograms.propositionInLanguage.p2'(A, B) :-
        'sharedPrograms.symbolInLanguage.p3'(A, B, 'progDefs.propositionDecl.c0').
'sharedPrograms.quantifiedFormula.p3'('metaDefs.some.f2'(A,B), A, B).
'sharedPrograms.quantifiedFormula.p3'('metaDefs.all.f2'(A,B), A, B).
'sharedPrograms.rPrec.p2'('syntax.noFunctInd.c0', 'sharedPrograms.infinity.c0').
'sharedPrograms.rPrec.p2'('syntax.xFX.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.rPrec.p2'('syntax.xFY.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.Y.c0')).
'sharedPrograms.rPrec.p2'('syntax.yFX.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.rPrec.p2'('syntax.fX.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.rPrec.p2'('syntax.fY.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.Y.c0')).
'sharedPrograms.rPrec.p2'('syntax.xF.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.rPrec.p2'('syntax.yF.f1'(A), 'sharedPrograms.prec.f2'(A,'sharedPrograms.X.c0')).
'sharedPrograms.quantifierChars.p3'('metaDefs.some.f2'(_,_), A, B) :-
        'strings.stringInts.p2'('"SOME ', C),
        'lists_g.append.p3'(C, B, A).
'sharedPrograms.quantifierChars.p3'('metaDefs.all.f2'(_,_), A, B) :-
        'strings.stringInts.p2'('"ALL ', C),
        'lists_g.append.p3'(C, B, A).
'sharedPrograms.reformatDelays.p3'([], [], []).
'sharedPrograms.reformatDelays.p3'(['progDefs.delay.f2'(B,C)|A], [B|D], [C|E]) :-
        'sharedPrograms.reformatDelays.p3'(A, D, E).
'sharedPrograms.rationalToIntDL.p9'(A, B, C, D, E, F, G, H, I) :-
        'sharedPrograms.cookRationalTerm.p2'(A, J),
        (   B=1 ->
            'sharedPrograms.termToIntDL.p9'(J, C, D, [], E, F, G, H, I)
        ;   'sharedPrograms.cookRationalTerm.p2'(B, K),
            'sharedPrograms.termToIntDL.p9'('metaDefs.term.f2'('metaDefs.name.f4'('"Rationals','"/','metaDefs.function.c0',2),[J,K]), C, D, [], E, F, G, H, I)
        ).
'sharedPrograms.restVarListToIntDL.p6'([], _, _, _, A, A).
'sharedPrograms.restVarListToIntDL.p6'([A|B], C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('",', F, H),
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, H, I),
        'sharedPrograms.restVarListToIntDL.p6'(B, C, D, E, I, G).
'sharedPrograms.sConditionToString.p2'(A, B) :-
        'sharedPrograms.conditionToIntDL.p3'(A, C, []),
        'strings.stringInts.p2'(B, C).
'sharedPrograms.sProgramTypeToString.p4'(A, B, C, D) :-
        'sharedPrograms.moduleLanguage.p3'(A, B, E),
        'sharedPrograms.typeToIntDL.p4'(C, E, F, []),
        'strings.stringInts.p2'(D, F).
'sharedPrograms.sOpenModule.p2'('progDefs.program.f4'(_,A,_,_), B) :-
        'sharedPrograms.openModuleAux.p2'(A, B).
'sharedPrograms.sMainModuleInProgram.p2'('progDefs.program.f4'(A,_,_,_), A).
'sharedPrograms.sProgramTermToString.p4'(A, B, C, D) :-
        'sharedPrograms.termToIntList.p4'(A, B, C, E),
        'strings.stringInts.p2'(D, E).
'sharedPrograms.sProgramFormulaToString.p4'(A, B, C, D) :-
        'sharedPrograms.formulaToIntList.p4'(A, B, C, E),
        'strings.stringInts.p2'(D, E).
'sharedPrograms.spaceIfNeeded.p4'(A, B, C, D) :-
        (   A=B,
            user:not_equal([], [A], A, 'sharedPrograms.bounded.c0') ->
            'sharedPrograms.charDL.p3'('" ', C, D)
        ;   C=D
        ).
'sharedPrograms.setExprToIntDL.p6'([A,B], C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('"{', F, H),
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, H, I),
        'sharedPrograms.chainExprToIntDL.p6'(B, C, D, E, I, J),
        'sharedPrograms.charDL.p3'('"}', J, G).
'sharedPrograms.simpleCondToIntDL.p3'('progDefs.nonvar.f1'(A), B, C) :-
        'strings.stringInts.p2'('"NONVAR(', D),
        'lists_g.append.p3'(D, E, B),
        'sharedPrograms.termToIntDL.p9'(A, _, _, _, _, _, _, E, F),
        'sharedPrograms.charDL.p3'('")', F, C).
'sharedPrograms.simpleCondToIntDL.p3'('progDefs.ground.f1'(A), B, C) :-
        'strings.stringInts.p2'('"GROUND(', D),
        'lists_g.append.p3'(D, E, B),
        'sharedPrograms.termToIntDL.p9'(A, _, _, _, _, _, _, E, F),
        'sharedPrograms.charDL.p3'('")', F, C).
'sharedPrograms.simpleCondToIntDL.p3'('progDefs.and.f2'(A,B), C, D) :-
        'sharedPrograms.charDL.p3'('"(', C, E),
        'sharedPrograms.andSeqToIntDL.p3'('progDefs.and.f2'(A,B), E, F),
        'sharedPrograms.charDL.p3'('")', F, D).
'sharedPrograms.simpleCondToIntDL.p3'('progDefs.or.f2'(A,B), C, D) :-
        'sharedPrograms.charDL.p3'('"(', C, E),
        'sharedPrograms.orSeqToIntDL.p3'('progDefs.or.f2'(A,B), E, F),
        'sharedPrograms.charDL.p3'('")', F, D).
'sharedPrograms.statementInLanguage.p5'('metaDefs.<-''.f2'(A,B), C, 'metaDefs.<-''.f2'(D,E), F, G) :-
        'sharedPrograms.meltedBodyTyping.p8'(B, C, [], H, E, I, J, K),
        (   K=[] ->
            'sharedPrograms.headAtom.p9'(A, C, H, _, D, J, [], L, M),
            (   M=[] ->
                'sharedPrograms.fixRationals.p2'(I, F),
                'sharedPrograms.checkHeadArgs.p4'(D, L, C, G)
            ;   G=M
            )
        ;   G=K
        ).
'sharedPrograms.typeInLanguage.p2'('metaDefs.par.f2'(_,_), _).
'sharedPrograms.typeInLanguage.p2'('metaDefs.par.f1'(_), _).
'sharedPrograms.typeInLanguage.p2'('metaDefs.bType.f1'(A), B) :-
        'sharedPrograms.baseInLanguage.p2'(A, B).
'sharedPrograms.typeInLanguage.p2'('metaDefs.xBType.f1'(A), B) :-
        'sharedPrograms.baseInLanguage.p2'(A, B).
'sharedPrograms.typeInLanguage.p2'('metaDefs.type.f2'(A,B), C) :-
        'sharedPrograms.constructorInLanguage.p3'(A, C, D),
        'lists_g.length.p2'(B, D),
        'sharedPrograms.listTypesInLanguage.p2'(B, C).
'sharedPrograms.typeInLanguage.p2'('metaDefs.xType.f2'(A,B), C) :-
        'sharedPrograms.constructorInLanguage.p3'(A, C, D),
        'lists_g.length.p2'(B, D),
        'sharedPrograms.listTypesInLanguage.p2'(B, C).
'sharedPrograms.termToIntDL.p9'('metaDefs.term.f2'(A,B), C, D, E, F, G, H, I, J) :-
        (   'sharedPrograms.functionInLanguage.p5'(A, C, K, _, _) ->
            'sharedPrograms.termToIntDLAux.p11'(K, A, B, C, D, E, L, G, H, I, J),
            F=L
        ;   F='syntax.noFunctInd.c0',
            G='sharedPrograms.bounded.c0',
            H='sharedPrograms.bounded.c0',
            'sharedPrograms.termInLanguage.p5'('metaDefs.term.f2'(A,B), D, 'metaDefs.varTyping.f1'(E), _, M),
            'sharedPrograms.charDL.p3'('"<', I, N),
            'sharedPrograms.typeToIntDL.p4'(M, C, N, O),
            'sharedPrograms.charDL.p3'('">', O, J)
        ).
'sharedPrograms.termToIntDL.p9'('metaDefs.xTerm.f3'(_,_,A), B, _, _, 'syntax.noFunctInd.c0', 'sharedPrograms.bounded.c0', 'sharedPrograms.bounded.c0', C, D) :-
        'sharedPrograms.charDL.p3'('"<', C, E),
        'sharedPrograms.typeToIntDL.p4'(A, B, E, F),
        'sharedPrograms.charDL.p3'('">', F, D).
'sharedPrograms.termToIntDL.p9'('metaDefs.cTerm.f1'(A), B, C, D, 'syntax.noFunctInd.c0', E, E, F, G) :-
        (   'sharedPrograms.constantInLanguage.p3'(A, B, _) ->
            'sharedPrograms.constantToIntDL.p4'(A, E, F, G)
        ;   E='sharedPrograms.bounded.c0',
            'sharedPrograms.termInLanguage.p5'('metaDefs.cTerm.f1'(A), C, 'metaDefs.varTyping.f1'(D), _, H),
            'sharedPrograms.charDL.p3'('"<', F, I),
            'sharedPrograms.typeToIntDL.p4'(H, B, I, J),
            'sharedPrograms.charDL.p3'('">', J, G)
        ).
'sharedPrograms.termToIntDL.p9'('metaDefs.xCTerm.f2'(_,A), B, _, _, 'syntax.noFunctInd.c0', 'sharedPrograms.bounded.c0', 'sharedPrograms.bounded.c0', C, D) :-
        'sharedPrograms.charDL.p3'('"<', C, E),
        'sharedPrograms.typeToIntDL.p4'(A, B, E, F),
        'sharedPrograms.charDL.p3'('">', F, D).
'sharedPrograms.termToIntDL.p9'('metaDefs.var.f2'(A,B), _, _, _, 'syntax.noFunctInd.c0', 'sharedPrograms.alphaNum.c0', 'sharedPrograms.alphaNum.c0', C, D) :-
        'strings.stringInts.p2'(A, E),
        'lists_g.append.p3'(E, F, C),
        (   (   B=0
            ;   concat('"_', _, G),
                A=G
            ) ->
            D=F
        ;   'sharedPrograms.charDL.p3'('"_', F, H),
            'sharedSyntax.integerToCharDL.p3'(B, H, D)
        ).
'sharedPrograms.termToIntDL.p9'('metaDefs.var.f1'(A), _, _, _, 'syntax.noFunctInd.c0', 'sharedPrograms.alphaNum.c0', 'sharedPrograms.alphaNum.c0', B, C) :-
        'strings.stringInts.p2'('"v', D),
        'lists_g.append.p3'(D, E, B),
        (   A=0 ->
            C=E
        ;   'sharedPrograms.charDL.p3'('"_', E, F),
            'sharedSyntax.integerToCharDL.p3'(A, F, C)
        ).
'sharedPrograms.termToIntDL.p9'('metaDefs.str.f1'(A), B, _, _, 'syntax.noFunctInd.c0', 'sharedPrograms.bounded.c0', 'sharedPrograms.bounded.c0', C, D) :-
        'sharedPrograms.baseInLanguage.p2'('metaDefs.name.f4'('"Strings','"String','metaDefs.base.c0',0), B),
        'strings.stringInts.p2'(A, E),
        'sharedPrograms.expandString.p3'(E, C, D).
'sharedPrograms.termToIntDL.p9'('metaDefs.int.f1'(A), B, _, _, C, D, 'sharedPrograms.alphaNum.c0', E, F) :-
        'sharedPrograms.baseInLanguage.p2'('metaDefs.name.f4'('"Integers','"Integer','metaDefs.base.c0',0), B),
        'sharedSyntax.integerToCharDL.p3'(A, E, F),
        (   'integers.<.p2'(A, 0) ->
            'sharedPrograms.functionInLanguage.p5'('metaDefs.name.f4'('"Integers','"-','metaDefs.function.c0',1), B, C, _, _),
            D='sharedPrograms.graphic.c0'
        ;   C='syntax.noFunctInd.c0',
            D='sharedPrograms.alphaNum.c0'
        ).
'sharedPrograms.termToIntDL.p9'('metaDefs.prm.f1'(A), B, C, D, 'syntax.noFunctInd.c0', 'sharedPrograms.bounded.c0', 'sharedPrograms.bounded.c0', E, F) :-
        'sharedPrograms.termInLanguage.p5'('metaDefs.prm.f1'(A), C, 'metaDefs.varTyping.f1'(D), _, G),
        'sharedPrograms.charDL.p3'('"<', E, H),
        'sharedPrograms.typeToIntDL.p4'(G, B, H, I),
        'sharedPrograms.charDL.p3'('">', I, F).
'sharedPrograms.termToIntDL.p9'('metaDefs.suchThat.f2'(A,B), C, D, E, 'syntax.noFunctInd.c0', 'sharedPrograms.bounded.c0', 'sharedPrograms.bounded.c0', F, G) :-
        'sharedPrograms.charDL.p3'('"{', F, H),
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, H, I),
        'strings.stringInts.p2'('" : ', J),
        'lists_g.append.p3'(J, K, I),
        'sharedPrograms.formulaToIntDL.p6'(B, C, D, E, K, L),
        'sharedPrograms.charDL.p3'('"}', L, G).
'sharedPrograms.termListToIntDL.p6'([A|B], C, D, E, F, G) :-
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, F, H),
        'sharedPrograms.termListToIntDLAux.p6'(B, C, D, E, H, G).
'sharedPrograms.termInLanguage.p5'(A, B, 'metaDefs.varTyping.f1'(C), 'metaDefs.varTyping.f1'(D), E) :-
        'sharedPrograms.meltVariableTyping.p4'(C, B, [], F),
        'sharedPrograms.meltedTermType.p9'(A, E, B, F, D, _, [], [], []),
        'sharedPrograms.fixType.p3'(E, 0, G),
        'sharedPrograms.fixVariableTyping.p2'(D, G).
'sharedPrograms.termListToIntDLAux.p6'([], _, _, _, A, A).
'sharedPrograms.termListToIntDLAux.p6'([A|B], C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('",', F, H),
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, H, I),
        'sharedPrograms.termListToIntDLAux.p6'(B, C, D, E, I, G).
'sharedPrograms.termToIntList.p4'(A, B, C, D) :-
        'sharedPrograms.programLanguage.p2'(A, E),
        'sharedPrograms.moduleLanguage.p3'(A, B, F),
        'sharedPrograms.termInLanguage.p5'(C, E, 'metaDefs.varTyping.f1'([]), 'metaDefs.varTyping.f1'(G), _),
        'sharedPrograms.termToIntDL.p9'(C, F, E, G, _, _, _, D, []).
'sharedPrograms.termToIntDLAux.p11'('syntax.noFunctInd.c0', 'metaDefs.name.f4'(A,B,C,D), E, F, G, H, 'syntax.noFunctInd.c0', I, 'sharedPrograms.bounded.c0', J, K) :-
        (   A='"lists_g',
            B='"Cons',
            C='metaDefs.function.c0',
            D=2 ->
            I='sharedPrograms.bounded.c0',
            'sharedPrograms.listExprToIntDL.p6'(E, F, G, H, J, K)
        ;   A='"Sets',
            B='"Inc',
            C='metaDefs.function.c0',
            D=2 ->
            I='sharedPrograms.bounded.c0',
            'sharedPrograms.setExprToIntDL.p6'(E, F, G, H, J, K)
        ;   'sharedPrograms.classifyToken.p2'(B, I),
            'strings.stringInts.p2'(B, L),
            'lists_g.append.p3'(L, M, J),
            'sharedPrograms.charDL.p3'('"(', M, N),
            'sharedPrograms.termListToIntDL.p6'(E, F, G, H, N, O),
            'sharedPrograms.charDL.p3'('")', O, K)
        ).
'sharedPrograms.termToIntDLAux.p11'('syntax.xFX.f1'(A), B, [C,D], E, F, G, H, I, J, K, L) :-
        'sharedPrograms.binaryInfixToIntDL.p12'('syntax.xFX.f1'(A), B, C, D, E, F, G, H, I, J, K, L).
'sharedPrograms.termToIntDLAux.p11'('syntax.xFY.f1'(A), B, [C,D], E, F, G, H, I, J, K, L) :-
        'sharedPrograms.binaryInfixToIntDL.p12'('syntax.xFY.f1'(A), B, C, D, E, F, G, H, I, J, K, L).
'sharedPrograms.termToIntDLAux.p11'('syntax.yFX.f1'(A), B, [C,D], E, F, G, H, I, J, K, L) :-
        'sharedPrograms.binaryInfixToIntDL.p12'('syntax.yFX.f1'(A), B, C, D, E, F, G, H, I, J, K, L).
'sharedPrograms.termToIntDLAux.p11'('syntax.fX.f1'(A), B, [C], D, E, F, 'syntax.fX.f1'(A), G, H, I, J) :-
        'sharedPrograms.unaryPrefixToIntDL.p10'('syntax.fX.f1'(A), B, C, D, E, F, G, H, I, J).
'sharedPrograms.termToIntDLAux.p11'('syntax.fY.f1'(A), B, [C], D, E, F, 'syntax.fY.f1'(A), G, H, I, J) :-
        'sharedPrograms.unaryPrefixToIntDL.p10'('syntax.fY.f1'(A), B, C, D, E, F, G, H, I, J).
'sharedPrograms.termToIntDLAux.p11'('syntax.xF.f1'(A), B, [C], D, E, F, 'syntax.xF.f1'(A), G, H, I, J) :-
        'sharedPrograms.unaryPostfixToIntDL.p10'('syntax.xF.f1'(A), B, C, D, E, F, G, H, I, J).
'sharedPrograms.termToIntDLAux.p11'('syntax.yF.f1'(A), B, [C], D, E, F, 'syntax.yF.f1'(A), G, H, I, J) :-
        'sharedPrograms.unaryPostfixToIntDL.p10'('syntax.yF.f1'(A), B, C, D, E, F, G, H, I, J).
'sharedPrograms.thenPartToIntDL.p6'(A, B, C, D, E, F) :-
        'sharedPrograms.formulaToIntDL.p6'(A, B, C, D, G, H),
        (   'sharedPrograms.mustBracketThen.p1'(A) ->
            'sharedPrograms.charDL.p3'('"(', E, G),
            'sharedPrograms.charDL.p3'('")', H, F)
        ;   E=G,
            F=H
        ).
'sharedPrograms.typeSymbolInLanguage.p3'('metaDefs.name.f4'(A,B,C,D), 'progDefs.language.f1'(E), F) :-
        'sharedPrograms.avlFind.p3'(E, A, 'progDefs.module.f3'(G,'progDefs.categories.f2'(H,_),_)),
        'sharedPrograms.avlFind.p3'(H, B, I),
        'sharedPrograms.findDescriptor.p5'(I, G, C, D, F).
'sharedPrograms.typeListToIntDL.p4'([A|B], C, D, E) :-
        'sharedPrograms.typeToIntDL.p4'(A, C, D, F),
        'sharedPrograms.typeListToIntDLAux.p4'(B, C, F, E).
'sharedPrograms.typeListToIntDLAux.p4'([], _, A, A).
'sharedPrograms.typeListToIntDLAux.p4'([A|B], C, D, E) :-
        'sharedPrograms.charDL.p3'('",', D, F),
        'sharedPrograms.typeToIntDL.p4'(A, C, F, G),
        'sharedPrograms.typeListToIntDLAux.p4'(B, C, G, E).
'sharedPrograms.unaryPrefixToIntDL.p10'(A, 'metaDefs.name.f4'(_,B,_,_), C, D, E, F, G, H, I, J) :-
        'sharedPrograms.termToIntDL.p9'(C, D, E, F, K, L, M, N, O),
        'sharedPrograms.classifyToken.p2'(B, G),
        'strings.stringInts.p2'(B, P),
        'lists_g.append.p3'(P, Q, I),
        (   'sharedPrograms.lPrec.p2'(K, R),
            'sharedPrograms.rPrec.p2'(A, S),
            'sharedPrograms.bindsTighter.p2'(R, S) ->
            H=M,
            'sharedPrograms.spaceIfNeeded.p4'(G, L, Q, N),
            J=O
        ;   H='sharedPrograms.bounded.c0',
            'sharedPrograms.charDL.p3'('"(', Q, N),
            'sharedPrograms.charDL.p3'('")', O, J)
        ).
'sharedPrograms.typeToIntDL.p4'('metaDefs.type.f2'(A,B), C, D, E) :-
        'sharedPrograms.constructorInLanguage.p3'(A, C, F),
        'lists_g.length.p2'(B, F),
        A='metaDefs.name.f4'(_,G,_,_),
        'strings.stringInts.p2'(G, H),
        'lists_g.append.p3'(H, I, D),
        'sharedPrograms.charDL.p3'('"(', I, J),
        'sharedPrograms.typeListToIntDL.p4'(B, C, J, K),
        'sharedPrograms.charDL.p3'('")', K, E).
'sharedPrograms.typeToIntDL.p4'('metaDefs.bType.f1'(A), B, C, D) :-
        'sharedPrograms.baseInLanguage.p2'(A, B),
        A='metaDefs.name.f4'(_,E,_,_),
        'strings.stringInts.p2'(E, F),
        'lists_g.append.p3'(F, D, C).
'sharedPrograms.typeToIntDL.p4'('metaDefs.par.f2'(A,B), _, C, D) :-
        'strings.stringInts.p2'(A, E),
        'lists_g.append.p3'(E, F, C),
        (   B=0 ->
            D=F
        ;   'sharedPrograms.charDL.p3'('"_', F, G),
            'sharedSyntax.integerToCharDL.p3'(B, G, D)
        ).
'sharedPrograms.typeToIntDL.p4'('metaDefs.par.f1'(A), _, B, C) :-
        'sharedPrograms.charDL.p3'('"p', B, D),
        (   A=0 ->
            C=D
        ;   'sharedPrograms.charDL.p3'('"_', D, E),
            'sharedSyntax.integerToCharDL.p3'(A, E, C)
        ).
'sharedPrograms.unaryPostfixToIntDL.p10'(A, 'metaDefs.name.f4'(_,B,_,_), C, D, E, F, G, H, I, J) :-
        'sharedPrograms.termToIntDL.p9'(C, D, E, F, K, L, M, N, O),
        'sharedPrograms.classifyToken.p2'(B, H),
        (   'sharedPrograms.rPrec.p2'(K, P),
            'sharedPrograms.lPrec.p2'(A, Q),
            'sharedPrograms.bindsTighter.p2'(P, Q) ->
            G=L,
            I=N,
            'sharedPrograms.spaceIfNeeded.p4'(M, H, O, R)
        ;   G='sharedPrograms.bounded.c0',
            'sharedPrograms.charDL.p3'('"(', I, N),
            'sharedPrograms.charDL.p3'('")', O, R)
        ),
        'strings.stringInts.p2'(B, S),
        'lists_g.append.p3'(S, J, R).
'sharedPrograms.updateDelays.p6'('progDefs.export.c0', A, B, C, [A|B], C).
'sharedPrograms.updateDelays.p6'('progDefs.closed.c0', A, B, C, [A|B], C).
'sharedPrograms.updateDelays.p6'('progDefs.local.c0', A, B, C, B, [A|C]).
'sharedPrograms.updateDelays.p6'('progDefs.module.c0', A, B, C, B, [A|C]).
'sharedPrograms.varListToIntDL.p6'([A|B], C, D, E, F, G) :-
        'sharedPrograms.charDL.p3'('"[', F, H),
        'sharedPrograms.termToIntDL.p9'(A, C, D, E, _, _, _, H, I),
        'sharedPrograms.restVarListToIntDL.p6'(B, C, D, E, I, J),
        'sharedPrograms.charDL.p3'('"]', J, G).
%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
% Prolog routines shared by the parser and Programs and Scripts system modules.
%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
% Useful routines
%------------------------------------------------------------------------------
 
'sharedPrograms.findMember.p2'(X, Ys) :-
   ( var(X) ->
     Ys = [Z|Zs],
     member_in(Zs, Z, X)
   ; user:'lists_g.memberCheck.p2'(X, Ys)
   ).

member_in([], X, X).

member_in([Y|Ys], Z, X) :-
   ( X = Z ; member_in(Ys, Y, X)).

'~sharedPrograms.findMember.p2'(X, Ys) :-
   'sharedPrograms.findMember.p2'(X, Ys).


'sharedPrograms.pickOne.p3'(X, Ys, Rest) :-
   ( var(X) ->
     delete_one(Ys, X, Rest)
   ; user:'lists_g.deleteFirst.p3'(X, Ys, Rest)
   ).

'~sharedPrograms.pickOne.p3'(X, Ys, Rest) :-
   'sharedPrograms.pickOne.p3'(X, Ys, Rest).


delete_one([Y|Ys], X, Rest) :-
   ( Ys = [] ->
     X = Y,
     Rest = Ys
   ;
     ( X = Y, 
       Rest = Ys
     ; delete_one(Ys, X, Rest1),
       Rest = [Y|Rest1]
     )
   ).

%------------------------------------------------------------------------------
% Support for access to symbols in language
%------------------------------------------------------------------------------ 

'sharedPrograms.findDescriptor.p5'([Desc|Descs], Access, Category, Arity, Decl) :-
   ( nonvar(Arity), nonvar(Category) ->
     one_descriptor_in([Desc|Descs], Access, Category, Arity, Decl)
   ; descriptor_in(Descs, Desc, Access, Category, Arity, Decl) 
   ).

'~sharedPrograms.findDescriptor.p5'(Descriptors, Access, Category, Arity, Decl) :-
   'sharedPrograms.findDescriptor.p5'(Descriptors, Access, Category, Arity, Decl).


descriptor_in([], Desc, Access, Cat, Arity, Decl) :-
   'sharedPrograms.matchingDescriptor.p5'(Desc, Access, Cat, Arity, Decl).

descriptor_in([D|Ds], Desc, Access, Cat, Arity, Decl) :-
   ( 'sharedPrograms.matchingDescriptor.p5'(Desc, Access, Cat, Arity, Decl)
   ; descriptor_in(Ds, D, Access, Cat, Arity, Decl)
   ).


one_descriptor_in([Desc|Descs], Access, Cat, Arity, Decl) :-
   ( 'sharedPrograms.matchingDescriptor.p5'(Desc, Access, Cat, Arity, Decl) ->
     true
   ; one_descriptor_in(Descs, Access, Cat, Arity, Decl)
   ).

%------------------------------------------------------------------------------
% Support for access to Program code
%------------------------------------------------------------------------------

'sharedPrograms.systemModule.p1'(S) :-
   (S == '"' ; user:system_module_name(S)), !.

'~sharedPrograms.systemModule.p1'(S) :-
   'sharedPrograms.systemModule.p1'(S).

 
'sharedPrograms.avlFind.p3'(Tree, Key, Item) :-
   ( var(Key) ->
     user:'avlTrees.avlMember.p3'(Tree, Key, Item)
   ; user:'avlTrees.avlSearch.p3'(Tree, Key, Item)
   ).

'~sharedPrograms.avlFind.p3'(Tree, Key, Item) :-
   'sharedPrograms.avlFind.p3'(Tree, Key, Item).


'sharedPrograms.findPredDef.p3'(Arity, PredDefs
      , 'progDefs.predDef.f4'(Arity, Statements, Delays1, Delays2)
      ) :-
   ( var(Arity) ->
     user:'lists_g.member.p2'('progDefs.predDef.f4'(Arity, Statements
           , Delays1, Delays2)
        , PredDefs)
   ; user:'lists_g.memberCheck.p2'('progDefs.predDef.f4'(Arity, Statements
           , Delays1, Delays2)
        , PredDefs)
   ).

'~sharedPrograms.findPredDef.p3'(Arity, PredDefs, Program) :-
   'sharedPrograms.findPredDef.p3'(Arity, PredDefs, Program).


'sharedPrograms.pickPredDef.p4'(Arity, PredDefs
      , 'progDefs.predDef.f4'(Arity, Statements, Delays1, Delays2), RestDefs
      ) :-
   ( var(Arity) ->
     'lists_g':'lists_g.delete.p3'('progDefs.predDef.f4'(Arity, Statements
           , Delays1, Delays2)
        , PredDefs, RestDefs)
   ; 'lists_g':'lists_g.deleteFirst.p3'('progDefs.predDef.f4'(Arity, Statements
           , Delays1, Delays2)
        , PredDefs, RestDefs)
   ).

'~sharedPrograms.pickPredDef.p4'(Arity, PredDefs, PredDef, RestDefs) :-
   'sharedPrograms.pickPredDef.p4'(Arity, PredDefs, PredDef, RestDefs).

%------------------------------------------------------------------------------
% Support for autorecompilation (Succeed etc.)
%------------------------------------------------------------------------------

:- dynamic used_module_version/2.

'sharedPrograms.nextModuleVersion.p2'(Module, Version) :-
   ( retract(used_module_version(Module, Old)) ->
     Version is Old + 1
   ; Version is 1
   ),
   assert(used_module_version(Module, Version)).

'~sharedPrograms.nextModuleVersion.p2'(Module, Version) :-
   'sharedPrograms.nextModuleVersion.p2'(Module, Version).


'sharedPrograms.systemModuleRep.p4'(Module, Definition, Descriptor, PredDefs) :-
   user:system_module(Module, Definition, Descriptor, PredDefs).

'~sharedPrograms.systemModuleRep.p4'(Module, Definition, Descriptor, PredDefs) :-
   'sharedPrograms.systemModuleRep.p4'(Module, Definition, Descriptor, PredDefs).
%------------------------------------------------------------------------------
% Support for Type Checking
%------------------------------------------------------------------------------

'sharedPrograms.fixType.p3'(Type, N, NewN) :-
   ( var(Type) ->
     Type = 'metaDefs.par.f1'(N), NewN is N + 1
   ; nonvar_fix_type(Type, N, NewN)
   ).

'~sharedPrograms.fixType.p3'(Type, N, NewN) :-
   'sharedPrograms.fixType.p3'(Type, N, NewN).

nonvar_fix_type('metaDefs.par.f1'(_), N, N).

nonvar_fix_type('metaDefs.par.f2'(_, _), N, N).

nonvar_fix_type('metaDefs.bType.f1'(_), N, N).

nonvar_fix_type('metaDefs.type.f2'(_, Args), N, NewN) :-
   list_fix_type(Args, N, NewN).


list_fix_type([], N, N).

list_fix_type([Type|Types], N, NewN) :-
   'sharedPrograms.fixType.p3'(Type, N, N1),
   list_fix_type(Types, N1, NewN).


'sharedPrograms.fixRationals.p2'([], 0).

'sharedPrograms.fixRationals.p2'([NumType|NumTypes], Count) :-
   fix_rational(NumType, R),
   'sharedPrograms.fixRationals.p2'(NumTypes, Count1),
   Count is Count1 + R.

'~sharedPrograms.fixRationals.p2'(NumTypes, Count) :-
   'sharedPrograms.fixRationals.p2'(NumTypes, Count).


fix_rational('sharedPrograms.numType.f3'(Value, 'metaDefs.bType.f1'(Name), Term)
      , Rational
      ) :-
   ( Name = 'metaDefs.name.f4'('"Rationals', '"Rational', 'metaDefs.base.c0', 0) ->
     'sharedPrograms.rationalTerm.p2'(Value, Term),
     Rational = 1
   ; Term = 'metaDefs.int.f1'(Value),
     Rational = 0
   ). 

%------------------------------------------------------------------------------
% Type Unification
%------------------------------------------------------------------------------
 
'sharedPrograms.unifyMeltedTypes.p4'(ContextType, ArgType, Term, Errors) :-
   ( unify_types(ContextType, ArgType) ->
     Errors = []
   ; copy_term((ContextType, ArgType), (ContextTypeCopy, ArgTypeCopy)),
     'sharedPrograms.fixType.p3'(ArgTypeCopy, 0, N),
     'sharedPrograms.fixType.p3'(ContextTypeCopy, N, _),
     Errors = ['sharedPrograms.typeError.f3'(Term, ArgTypeCopy, ContextTypeCopy)]
   ).

'~sharedPrograms.unifyMeltedTypes.p4'(ContextType, ArgType, Term, Errors) :-
   'sharedPrograms.unifyMeltedTypes.p4'(ContextType, ArgType, Term, Errors).

unify_types(Type1, Type2) :-
   ( nonvar(Type1) ->
     ( nonvar(Type2) ->
       nonvar_unify_types(Type1, Type2)
     ; not_occurs_in(Type1, Type2), Type2 = Type1
     )
   ; ( nonvar(Type2) ->
       not_occurs_in(Type2, Type1), Type1 = Type2
     ; Type1 = Type2
     )
   ).


nonvar_unify_types('metaDefs.bType.f1'(Name), 'metaDefs.bType.f1'(Name)).

nonvar_unify_types('metaDefs.type.f2'(Name, Args1), 
                   'metaDefs.type.f2'(Name, Args2)
                  ) :-   
   unify_type_lists(Args1, Args2).


unify_type_lists([], []).

unify_type_lists([Type1|Types1], [Type2|Types2]) :-
   unify_types(Type1, Type2),
   unify_type_lists(Types1, Types2).

 
not_occurs_in('metaDefs.bType.f1'(_), _).

not_occurs_in('metaDefs.type.f2'(_, Args), Var) :-
   not_occurs_in_list(Args, Var).


not_occurs_in_list([], _).

not_occurs_in_list([Term|Terms], Var) :-
   ( var(Term) ->
     Term \== Var
   ; not_occurs_in(Term, Var)
   ),
   not_occurs_in_list(Terms, Var).

%------------------------------------------------------------------------------
% Conversion between delay conditions and strings
%------------------------------------------------------------------------------
 
'sharedPrograms.sStringToCondition.p2'(String, Condition) :-
   user:'strings.stringInts.p2'(String, IntList),
   user:append(IntList, [0'.], Chars),
   user:get_one_item_2nd(Chars, [], Item),
   user:cond(Item, [], Condition, [], Error, 1, 2, local),
   var(Error).

'~sharedPrograms.sStringToCondition.p2'(String, Condition) :-
   'sharedPrograms.sStringToCondition.p2'(String, Condition).

%------------------------------------------------------------------------------
% Support for ground representation to String conversion
%------------------------------------------------------------------------------

'sharedPrograms.charDL.p3'(Gstr, [Char|Chars], Chars) :-
   name(Gstr, [0'", Char]).

'~sharedPrograms.charDL.p3'(Gstr, Chars, Chars1) :-
   'sharedPrograms.charDL.p3'(Gstr, Chars, Chars1).


'sharedPrograms.classifyToken.p2'(Token, Class) :-
   name(Token, [0'", Sample|_]),
   ( 0'A =< Sample, Sample =< 0'Z ->
     Class = 'sharedPrograms.alphaNum.c0'
   ; Class = 'sharedPrograms.graphic.c0'
   ).

'~sharedPrograms.classifyToken.p2'(Token, Class) :-
   'sharedPrograms.classifyToken.p2'(Token, Class).

%------------------------------------------------------------------------------
% Support for symbol insertion routines
%------------------------------------------------------------------------------
 
'sharedPrograms.addToDescriptorList.p6'(Descriptors, ModAccess, Category, Arity
      , NewDescriptor, [NewDescriptor|Descriptors]
      ) :-
   \+ 'sharedPrograms.findDescriptor.p5'(Descriptors, ModAccess, Category, Arity
         , _Declaration).

'~sharedPrograms.addToDescriptorList.p6'(Descriptors, ModAccess, Category, Arity
      , NewDescriptor, NewDescriptors
      ) :-
   'sharedPrograms.addToDescriptorList.p6'(Descriptors, ModAccess, Category, Arity
      , NewDescriptor, NewDescriptors).

%------------------------------------------------------------------------------
% Variant types (used to check head condition)
%------------------------------------------------------------------------------
 
'sharedPrograms.variantTypes.p4'(ContextType, ArgType, Term, Errors) :-
   ( variant_types(ContextType, ArgType, [], _) ->
     Errors = []
   ;
     copy_term((ContextType, ArgType), (ContextTypeCopy, ArgTypeCopy)),
     'sharedPrograms.fixType.p3'(ArgTypeCopy, 0, N),
     'sharedPrograms.fixType.p3'(ContextTypeCopy, N, _),
     Errors = ['sharedPrograms.headError.f3'(Term, ArgTypeCopy, ContextTypeCopy)]
   ).

'~sharedPrograms.variantTypes.p4'(ContextType, ArgType, Term, Errors) :-
   'sharedPrograms.variantTypes.p4'(ContextType, ArgType, Term, Errors).

variant_types(Type1, Type2, ParDict, NewParDict) :-
   ( var(Type1) ->
     var(Type2),
     ( in_par_dict(Type1, ParDict, Type1Alias) ->
       Type1Alias == Type2,
       NewParDict = ParDict
     ; NewParDict = [Type1/Type2|ParDict]
     )
   ; nonvar(Type2),
     nonvar_variant_types(Type1, Type2, ParDict, NewParDict)
   ).

nonvar_variant_types('metaDefs.bType.f1'(Name), 'metaDefs.bType.f1'(Name)
      , ParDict, ParDict).

nonvar_variant_types('metaDefs.type.f2'(Name, Args1)
      , 'metaDefs.type.f2'(Name, Args2), ParDict, NewParDict
      ) :-
   list_variant_types(Args1, Args2, ParDict, NewParDict).


list_variant_types([], [], ParDict, ParDict).

list_variant_types([Type1|Types1], [Type2|Types2], ParDict, NewParDict) :-
   variant_types(Type1, Type2, ParDict, ParDict1),
   list_variant_types(Types1, Types2, ParDict1, NewParDict).

in_par_dict(P1, [A1/A2|Entries], P2) :-
   ( P1 == A1 ->
     P2 = A2
   ; in_par_dict(P1, Entries, P2)
   ).
:- op(500, yfx, and).
:- op(400, yfx, or).

'substs.fullDerefType.p4'('metaDefs.par.f1'(A), B, _, C) :-
        (   B='metaDefs.par.f1'(A) ->
            C='metaDefs.occ.f1'('metaDefs.par.f1'(A))
        ;   C='metaDefs.par.f1'(A)
        ).
'substs.fullDerefType.p4'('metaDefs.par.f2'(A,B), C, _, D) :-
        (   C='metaDefs.par.f2'(A,B) ->
            D='metaDefs.occ.f1'('metaDefs.par.f2'(A,B))
        ;   D='metaDefs.par.f2'(A,B)
        ).
'substs.fullDerefType.p4'('metaDefs.bType.f1'(A), _, _, 'metaDefs.bType.f1'(A)).
'substs.fullDerefType.p4'('metaDefs.type.f2'(A,B), C, D, 'metaDefs.type.f2'(A,E)) :-
        'substs.fullDerefType1.p4'(B, C, D, E).
'substs.fullDerefType.p4'('metaDefs.xBType.f1'(A), _, _, 'metaDefs.xBType.f1'(A)).
'substs.fullDerefType.p4'('metaDefs.xType.f2'(A,B), C, D, 'metaDefs.xType.f2'(A,E)) :-
        'substs.fullDerefType1.p4'(B, C, D, E).
'substs.fullDerefType.p3'('metaDefs.par.f2'(A,B), _, 'metaDefs.par.f2'(A,B)).
'substs.fullDerefType.p3'('metaDefs.par.f1'(A), _, 'metaDefs.par.f1'(A)).
'substs.fullDerefType.p3'('metaDefs.type.f2'(A,B), C, 'metaDefs.type.f2'(A,D)) :-
        'substs.applyTypeSubst.p3'(B, C, D).
'substs.fullDerefType.p3'('metaDefs.bType.f1'(A), _, 'metaDefs.bType.f1'(A)).
'substs.fullDerefType.p3'('metaDefs.xType.f2'(A,B), C, 'metaDefs.xType.f2'(A,D)) :-
        'substs.applyTypeSubst.p3'(B, C, D).
'substs.fullDerefType.p3'('metaDefs.xBType.f1'(A), _, 'metaDefs.xBType.f1'(A)).
'substs.composeTypeSubsts2.p3'('substs.typeSubst.f2'(A,B), 'substs.typeSubst.f2'(C,D), 'substs.typeSubst.f2'(E,F)) :-
        'substs.composeHeaps.p3'(A, C, E),
        'substs.Composelists_g.p3'(D, B, F).
'substs.applyTypeSubst.p3'([], _, []).
'substs.applyTypeSubst.p3'([A|B], C, [D|E]) :-
        'substs.substApplyToType.p3'(A, C, D),
        'substs.applyTypeSubst.p3'(B, C, E).
'substs.addTypeBinding1.p4'('metaDefs.par.f2'(A,B), C, D, E) :-
        'substs.addBinding.p4'(C, 'substs.V.f1'('metaDefs.par.f2'(A,B)), D, E).
'substs.addTypeBinding1.p4'('metaDefs.par.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.R.f1'(A), C, D).
'substs.addTypeBinding1.p4'('metaDefs.bType.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.T.f1'('metaDefs.bType.f1'(A)), C, D).
'substs.addTypeBinding1.p4'('metaDefs.type.f2'(A,B), C, D, E) :-
        'substs.addBinding.p4'(C, 'substs.T.f1'('metaDefs.type.f2'(A,B)), D, E).
'substs.addTypeBinding1.p4'('metaDefs.xType.f2'(A,B), C, D, E) :-
        'substs.addBinding.p4'(C, 'substs.T.f1'('metaDefs.xType.f2'(A,B)), D, E).
'substs.addTypeBinding1.p4'('metaDefs.xBType.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.T.f1'('metaDefs.xBType.f1'(A)), C, D).
'substs.addTermBinding1.p4'('metaDefs.var.f2'(A,B), C, D, E) :-
        'substs.addBinding.p4'(C, 'substs.V.f1'('metaDefs.var.f2'(A,B)), D, E).
'substs.addTermBinding1.p4'('metaDefs.var.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.R.f1'(A), C, D).
'substs.addTermBinding1.p4'('metaDefs.cTerm.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.T.f1'('metaDefs.cTerm.f1'(A)), C, D).
'substs.addTermBinding1.p4'('metaDefs.term.f2'(A,B), C, D, E) :-
        'substs.addBinding.p4'(C, 'substs.T.f1'('metaDefs.term.f2'(A,B)), D, E).
'substs.addTermBinding1.p4'('metaDefs.xTerm.f3'(A,B,C), D, E, F) :-
        'substs.addBinding.p4'(D, 'substs.T.f1'('metaDefs.xTerm.f3'(A,B,C)), E, F).
'substs.addTermBinding1.p4'('metaDefs.xCTerm.f2'(A,B), C, D, E) :-
        'substs.addBinding.p4'(C, 'substs.T.f1'('metaDefs.xCTerm.f2'(A,B)), D, E).
'substs.addTermBinding1.p4'('metaDefs.int.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.T.f1'('metaDefs.int.f1'(A)), C, D).
'substs.addTermBinding1.p4'('metaDefs.prm.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.T.f1'('metaDefs.prm.f1'(A)), C, D).
'substs.addTermBinding1.p4'('metaDefs.str.f1'(A), B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.T.f1'('metaDefs.str.f1'(A)), C, D).
'substs.addTermBinding1.p4'('metaDefs.suchThat.f2'(A,B), C, D, E) :-
        'substs.addBinding.p4'(C, 'substs.T.f1'('metaDefs.suchThat.f2'(A,B)), D, E).
'substs.addNewBinding.p5'(15, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D)) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(14, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(13, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(12, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(11, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(10, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(9, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(8, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(7, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(6, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(5, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(4, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(3, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(2, A, B, C, 'substs.H.f16'('substs.N.c0','substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(1, A, B, C, 'substs.H.f16'('substs.N.c0',D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addNewBinding.p5'(0, A, B, C, 'substs.H.f16'(D,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0')) :-
        'substs.addNewBinding1.p4'(A, B, C, D).
'substs.addBinding2.p21'(15, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,T)) :-
        'substs.addBinding1.p5'(S, A, B, C, T).
'substs.addBinding2.p21'(14, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,L,M,N,O,P,Q,T,S)) :-
        'substs.addBinding1.p5'(R, A, B, C, T).
'substs.addBinding2.p21'(13, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,L,M,N,O,P,T,R,S)) :-
        'substs.addBinding1.p5'(Q, A, B, C, T).
'substs.addBinding2.p21'(12, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,L,M,N,O,T,Q,R,S)) :-
        'substs.addBinding1.p5'(P, A, B, C, T).
'substs.addBinding2.p21'(11, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,L,M,N,T,P,Q,R,S)) :-
        'substs.addBinding1.p5'(O, A, B, C, T).
'substs.addBinding2.p21'(10, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,L,M,T,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(N, A, B, C, T).
'substs.addBinding2.p21'(9, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,L,T,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(M, A, B, C, T).
'substs.addBinding2.p21'(8, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,K,T,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(L, A, B, C, T).
'substs.addBinding2.p21'(7, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,J,T,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(K, A, B, C, T).
'substs.addBinding2.p21'(6, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,I,T,K,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(J, A, B, C, T).
'substs.addBinding2.p21'(5, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,H,T,J,K,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(I, A, B, C, T).
'substs.addBinding2.p21'(4, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,G,T,I,J,K,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(H, A, B, C, T).
'substs.addBinding2.p21'(3, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,F,T,H,I,J,K,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(G, A, B, C, T).
'substs.addBinding2.p21'(2, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,E,T,G,H,I,J,K,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(F, A, B, C, T).
'substs.addBinding2.p21'(1, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(D,T,F,G,H,I,J,K,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(E, A, B, C, T).
'substs.addBinding2.p21'(0, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, 'substs.H.f16'(T,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S)) :-
        'substs.addBinding1.p5'(D, A, B, C, T).
'substs.addTermBinding.p4'(A, B, 'substs.termSubst.f2'(C,D), 'substs.termSubst.f2'(E,D)) :-
        'substs.addTermBinding1.p4'(A, B, C, E).
'substs.addTypeBinding.p4'(A, B, 'substs.typeSubst.f2'(C,D), 'substs.typeSubst.f2'(E,D)) :-
        'substs.addTypeBinding1.p4'(A, B, C, E).
'substs.applySubstToType.p4'(A, B, C, D) :-
        'substs.derefType.p3'(A, C, E),
        'substs.fullDerefType.p4'(E, B, C, D).
'substs.applySubstToTerm.p4'(A, B, C, D) :-
        'substs.dereference.p3'(A, C, E),
        'substs.fullDerefTerm.p4'(E, B, C, D).
'substs.applyTermSubst.p3'([], _, []).
'substs.applyTermSubst.p3'([A|B], C, [D|E]) :-
        'substs.substApplyToTerm.p3'(A, C, D),
        'substs.applyTermSubst.p3'(B, C, E).
'substs.composeTermSubsts1.p3'('substs.termSubst.f2'('substs.heap.f2'(A,B),C), D, 'substs.termSubst.f2'(E,F)) :-
        'substs.rationaliseTermList.p3'(C, F, D),
        'substs.emptyHeap.p1'(G),
        'substs.rationaliseTermHeap.p6'(B, A, 0, D, G, E).
'substs.composeHeaps.p3'(A, 'substs.heap.f2'(B,C), D) :-
        'substs.composeHeaps1.p5'(C, B, 0, A, D).
'substs.bindVariable.p4'('metaDefs.var.f2'(A,B), C, 'substs.termSubst.f2'(D,E), 'substs.termSubst.f2'(D,['metaDefs.!.f2'('metaDefs.var.f2'(A,B),C)|E])).
'substs.bindVariable.p4'('metaDefs.var.f1'(A), B, C, D) :-
        'substs.addTermBinding.p4'(B, A, C, D).
'substs.bindParameter.p4'('metaDefs.par.f2'(A,B), C, 'substs.typeSubst.f2'(D,E), 'substs.typeSubst.f2'(D,['metaDefs.!.f2'('metaDefs.par.f2'(A,B),C)|E])).
'substs.bindParameter.p4'('metaDefs.par.f1'(A), B, C, D) :-
        'substs.addTypeBinding.p4'(B, A, C, D).
'substs.bindingInHeap.p3'('substs.heap.f2'(A,B), C, D) :-
        'substs.address.p5'(B, A, 0, C, D).
'substs.Composelists_g.p3'([], A, A).
'substs.Composelists_g.p3'(['metaDefs.!.f2'(B,C)|A], D, ['metaDefs.!.f2'(B,C)|E]) :-
        'substs.dB.p3'(D, B, F),
        'substs.Composelists_g.p3'(A, F, E).
'substs.composeHeaps1.p5'('substs.N.c0', _, _, A, A).
'substs.composeHeaps1.p5'('substs.R.f1'(A), _, B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.R.f1'(A), C, D).
'substs.composeHeaps1.p5'('substs.V.f1'(A), _, B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.V.f1'(A), C, D).
'substs.composeHeaps1.p5'('substs.T.f1'(A), _, B, C, D) :-
        'substs.addBinding.p4'(B, 'substs.T.f1'(A), C, D).
'substs.composeHeaps1.p5'('substs.H.f16'(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), Q, R, S, T) :-
        minus(Q, 1, V),
        U=V,
        power(16, Q, X),
        W=X,
        'substs.composeHeaps1.p5'(A, U, R, S, Y),
        plus(W, R, Z),
        'substs.composeHeaps1.p5'(B, U, Z, Y, A1),
        times(2, W, D1),
        plus(D1, R, B1),
        'substs.composeHeaps1.p5'(C, U, B1, A1, C1),
        times(3, W, G1),
        plus(G1, R, E1),
        'substs.composeHeaps1.p5'(D, U, E1, C1, F1),
        times(4, W, J1),
        plus(J1, R, H1),
        'substs.composeHeaps1.p5'(E, U, H1, F1, I1),
        times(5, W, M1),
        plus(M1, R, K1),
        'substs.composeHeaps1.p5'(F, U, K1, I1, L1),
        times(6, W, P1),
        plus(P1, R, N1),
        'substs.composeHeaps1.p5'(G, U, N1, L1, O1),
        times(7, W, S1),
        plus(S1, R, Q1),
        'substs.composeHeaps1.p5'(H, U, Q1, O1, R1),
        times(8, W, V1),
        plus(V1, R, T1),
        'substs.composeHeaps1.p5'(I, U, T1, R1, U1),
        times(9, W, Y1),
        plus(Y1, R, W1),
        'substs.composeHeaps1.p5'(J, U, W1, U1, X1),
        times(10, W, B2),
        plus(B2, R, Z1),
        'substs.composeHeaps1.p5'(K, U, Z1, X1, A2),
        times(11, W, E2),
        plus(E2, R, C2),
        'substs.composeHeaps1.p5'(L, U, C2, A2, D2),
        times(12, W, H2),
        plus(H2, R, F2),
        'substs.composeHeaps1.p5'(M, U, F2, D2, G2),
        times(13, W, K2),
        plus(K2, R, I2),
        'substs.composeHeaps1.p5'(N, U, I2, G2, J2),
        times(14, W, N2),
        plus(N2, R, L2),
        'substs.composeHeaps1.p5'(O, U, L2, J2, M2),
        times(15, W, P2),
        plus(P2, R, O2),
        'substs.composeHeaps1.p5'(P, U, O2, M2, T).
'substs.composeTypeSubsts1.p3'('substs.typeSubst.f2'('substs.heap.f2'(A,B),C), D, 'substs.typeSubst.f2'(E,F)) :-
        'substs.rationaliseTypeList.p3'(C, F, D),
        'substs.emptyHeap.p1'(G),
        'substs.rationaliseTypeHeap.p6'(B, A, 0, D, G, E).
'substs.composeTermSubsts2.p3'('substs.termSubst.f2'(A,B), 'substs.termSubst.f2'(C,D), 'substs.termSubst.f2'(E,F)) :-
        'substs.composeHeaps.p3'(A, C, E),
        'substs.Composelists_g.p3'(D, B, F).
'substs.derefType1.p6'('substs.N.c0', A, _, _, _, A).
'substs.derefType1.p6'('substs.R.f1'(A), _, B, C, D, E) :-
        'substs.contents.p4'(A, B, C, F),
        'substs.derefType1.p6'(F, 'metaDefs.par.f1'(A), B, C, D, E).
'substs.derefType1.p6'('substs.V.f1'(A), _, B, C, D, E) :-
        'substs.derefType.p3'(A, 'substs.typeSubst.f2'('substs.heap.f2'(B,C),D), E).
'substs.derefType1.p6'('substs.T.f1'(A), _, _, _, _, A).
'substs.delTypeBinding.p4'('metaDefs.par.f2'(A,B), C, 'substs.typeSubst.f2'(D,E), 'substs.typeSubst.f2'(D,F)) :-
        'lists_g.deleteFirst.p3'('metaDefs.!.f2'('metaDefs.par.f2'(A,B),G), E, F),
        'substs.substApplyToType.p3'(G, 'substs.typeSubst.f2'(D,E), C).
'substs.delTypeBinding.p4'('metaDefs.par.f1'(A), B, 'substs.typeSubst.f2'(C,D), 'substs.typeSubst.f2'(E,D)) :-
        'substs.addBinding.p4'(A, 'substs.N.c0', C, E),
        'substs.substApplyToType.p3'('metaDefs.par.f1'(A), 'substs.typeSubst.f2'(C,D), B),
        user:not_equal([], [B,A], B, 'metaDefs.par.f1'(A)).
'substs.dB.p3'([], _, []).
'substs.dB.p3'(['metaDefs.!.f2'(B,C)|A], D, E) :-
        (   B=D ->
            E=A
        ;   E=['metaDefs.!.f2'(B,C)|F],
            'substs.dB.p3'(A, D, F)
        ).
'substs.delTermBinding.p4'('metaDefs.var.f2'(A,B), C, 'substs.termSubst.f2'(D,E), 'substs.termSubst.f2'(D,F)) :-
        'lists_g.deleteFirst.p3'('metaDefs.!.f2'('metaDefs.var.f2'(A,B),G), E, F),
        'substs.substApplyToTerm.p3'(G, 'substs.termSubst.f2'(D,E), C).
'substs.delTermBinding.p4'('metaDefs.var.f1'(A), B, 'substs.termSubst.f2'(C,D), 'substs.termSubst.f2'(E,D)) :-
        'substs.addBinding.p4'(A, 'substs.N.c0', C, E),
        'substs.substApplyToTerm.p3'('metaDefs.var.f1'(A), 'substs.termSubst.f2'(C,D), B),
        user:not_equal([], [B,A], B, 'metaDefs.var.f1'(A)).
'substs.derefType.p3'('metaDefs.occ.f1'(A), _, A).
'substs.derefType.p3'('metaDefs.par.f1'(A), 'substs.typeSubst.f2'('substs.heap.f2'(B,C),D), E) :-
        'substs.contents.p4'(A, B, C, F),
        'substs.derefType1.p6'(F, 'metaDefs.par.f1'(A), B, C, D, E).
'substs.derefType.p3'('metaDefs.type.f2'(A,B), _, 'metaDefs.type.f2'(A,B)).
'substs.derefType.p3'('metaDefs.bType.f1'(A), _, 'metaDefs.bType.f1'(A)).
'substs.derefType.p3'('metaDefs.xType.f2'(A,B), _, 'metaDefs.xType.f2'(A,B)).
'substs.derefType.p3'('metaDefs.xBType.f1'(A), _, 'metaDefs.xBType.f1'(A)).
'substs.derefType.p3'('metaDefs.par.f2'(A,B), 'substs.typeSubst.f2'(C,D), E) :-
        user:one_solution(('lists_g.memberCheck.p2'('metaDefs.!.f2'('metaDefs.par.f2'(A,B),F),D)->'substs.derefType.p3'(F,'substs.typeSubst.f2'(C,D),E);E='metaDefs.par.f2'(A,B))).
'substs.dereference1.p6'('substs.N.c0', A, _, _, _, A).
'substs.dereference1.p6'('substs.R.f1'(A), _, B, C, D, E) :-
        'substs.contents.p4'(A, B, C, F),
        'substs.dereference1.p6'(F, 'metaDefs.var.f1'(A), B, C, D, E).
'substs.dereference1.p6'('substs.V.f1'(A), _, B, C, D, E) :-
        'substs.dereference.p3'(A, 'substs.termSubst.f2'('substs.heap.f2'(B,C),D), E).
'substs.dereference1.p6'('substs.T.f1'(A), _, _, _, _, A).
'substs.dereference.p3'('metaDefs.occ.f1'(A), _, A).
'substs.dereference.p3'('metaDefs.var.f1'(A), 'substs.termSubst.f2'('substs.heap.f2'(B,C),D), E) :-
        'substs.contents.p4'(A, B, C, F),
        'substs.dereference1.p6'(F, 'metaDefs.var.f1'(A), B, C, D, E).
'substs.dereference.p3'('metaDefs.term.f2'(A,B), _, 'metaDefs.term.f2'(A,B)).
'substs.dereference.p3'('metaDefs.cTerm.f1'(A), _, 'metaDefs.cTerm.f1'(A)).
'substs.dereference.p3'('metaDefs.xTerm.f3'(A,B,C), _, 'metaDefs.xTerm.f3'(A,B,C)).
'substs.dereference.p3'('metaDefs.xCTerm.f2'(A,B), _, 'metaDefs.xCTerm.f2'(A,B)).
'substs.dereference.p3'('metaDefs.str.f1'(A), _, 'metaDefs.str.f1'(A)).
'substs.dereference.p3'('metaDefs.int.f1'(A), _, 'metaDefs.int.f1'(A)).
'substs.dereference.p3'('metaDefs.prm.f1'(A), _, 'metaDefs.prm.f1'(A)).
'substs.dereference.p3'('metaDefs.suchThat.f2'(A,B), _, 'metaDefs.suchThat.f2'(A,B)).
'substs.dereference.p3'('metaDefs.var.f2'(A,B), 'substs.termSubst.f2'(C,D), E) :-
        user:one_solution(('lists_g.memberCheck.p2'('metaDefs.!.f2'('metaDefs.var.f2'(A,B),F),D)->'substs.dereference.p3'(F,'substs.termSubst.f2'(C,D),E);E='metaDefs.var.f2'(A,B))).
'substs.fullDerefTerm.p4'('metaDefs.var.f1'(A), B, _, C) :-
        (   B='metaDefs.var.f1'(A) ->
            C='metaDefs.occ.f1'(B)
        ;   C='metaDefs.var.f1'(A)
        ).
'substs.fullDerefTerm.p4'('metaDefs.var.f2'(A,B), C, _, D) :-
        (   C='metaDefs.var.f2'(A,B) ->
            D='metaDefs.occ.f1'(C)
        ;   D='metaDefs.var.f2'(A,B)
        ).
'substs.fullDerefTerm.p4'('metaDefs.cTerm.f1'(A), _, _, 'metaDefs.cTerm.f1'(A)).
'substs.fullDerefTerm.p4'('metaDefs.term.f2'(A,B), C, D, 'metaDefs.term.f2'(A,E)) :-
        'substs.fullDerefTerm1.p4'(B, C, D, E).
'substs.fullDerefTerm.p4'('metaDefs.xCTerm.f2'(A,B), _, _, 'metaDefs.xCTerm.f2'(A,B)).
'substs.fullDerefTerm.p4'('metaDefs.xTerm.f3'(A,B,C), D, E, 'metaDefs.xTerm.f3'(A,F,C)) :-
        'substs.fullDerefTerm1.p4'(B, D, E, F).
'substs.fullDerefTerm.p4'('metaDefs.int.f1'(A), _, _, 'metaDefs.int.f1'(A)).
'substs.fullDerefTerm.p4'('metaDefs.prm.f1'(A), _, _, 'metaDefs.prm.f1'(A)).
'substs.fullDerefTerm.p4'('metaDefs.str.f1'(A), _, _, 'metaDefs.str.f1'(A)).
'substs.fullDerefTerm.p4'('metaDefs.suchThat.f2'(A,B), _, _, 'metaDefs.suchThat.f2'(A,B)).
'substs.emptyHeap.p1'('substs.heap.f2'(0,'substs.H.f16'('substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0'))).
'substs.fullDerefTerm1.p4'([], _, _, []).
'substs.fullDerefTerm1.p4'([A|B], C, D, [E|F]) :-
        'substs.applySubstToTerm.p4'(A, C, D, E),
        'substs.fullDerefTerm1.p4'(B, C, D, F).
'substs.rationaliseTypeHeap.p6'('substs.N.c0', _, _, _, A, A).
'substs.rationaliseTypeHeap.p6'('substs.R.f1'(A), _, B, C, D, E) :-
        'substs.applySubstToType.p4'('metaDefs.par.f1'(A), 'metaDefs.par.f1'(B), C, F),
        (   user:not_equal([], [F,B], F, 'metaDefs.occ.f1'('metaDefs.par.f1'(B))) ->
            'substs.addTypeBinding1.p4'(F, B, D, E)
        ;   E=D
        ).
'substs.rationaliseTypeHeap.p6'('substs.V.f1'(A), _, B, C, D, E) :-
        'substs.applySubstToType.p4'(A, 'metaDefs.par.f1'(B), C, F),
        (   user:not_equal([], [F,B], F, 'metaDefs.occ.f1'('metaDefs.par.f1'(B))) ->
            'substs.addTypeBinding1.p4'(F, B, D, E)
        ;   E=D
        ).
'substs.rationaliseTypeHeap.p6'('substs.T.f1'(A), _, B, C, D, E) :-
        'substs.applySubstToType.p4'(A, 'metaDefs.par.f1'(B), C, F),
        'substs.addTypeBinding1.p4'(F, B, D, E).
'substs.rationaliseTypeHeap.p6'('substs.H.f16'(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), Q, R, S, T, U) :-
        minus(Q, 1, W),
        V=W,
        power(16, Q, Y),
        X=Y,
        'substs.rationaliseTypeHeap.p6'(A, V, R, S, T, Z),
        plus(X, R, A1),
        'substs.rationaliseTypeHeap.p6'(B, V, A1, S, Z, B1),
        times(2, X, E1),
        plus(E1, R, C1),
        'substs.rationaliseTypeHeap.p6'(C, V, C1, S, B1, D1),
        times(3, X, H1),
        plus(H1, R, F1),
        'substs.rationaliseTypeHeap.p6'(D, V, F1, S, D1, G1),
        times(4, X, K1),
        plus(K1, R, I1),
        'substs.rationaliseTypeHeap.p6'(E, V, I1, S, G1, J1),
        times(5, X, N1),
        plus(N1, R, L1),
        'substs.rationaliseTypeHeap.p6'(F, V, L1, S, J1, M1),
        times(6, X, Q1),
        plus(Q1, R, O1),
        'substs.rationaliseTypeHeap.p6'(G, V, O1, S, M1, P1),
        times(7, X, T1),
        plus(T1, R, R1),
        'substs.rationaliseTypeHeap.p6'(H, V, R1, S, P1, S1),
        times(8, X, W1),
        plus(W1, R, U1),
        'substs.rationaliseTypeHeap.p6'(I, V, U1, S, S1, V1),
        times(9, X, Z1),
        plus(Z1, R, X1),
        'substs.rationaliseTypeHeap.p6'(J, V, X1, S, V1, Y1),
        times(10, X, C2),
        plus(C2, R, A2),
        'substs.rationaliseTypeHeap.p6'(K, V, A2, S, Y1, B2),
        times(11, X, F2),
        plus(F2, R, D2),
        'substs.rationaliseTypeHeap.p6'(L, V, D2, S, B2, E2),
        times(12, X, I2),
        plus(I2, R, G2),
        'substs.rationaliseTypeHeap.p6'(M, V, G2, S, E2, H2),
        times(13, X, L2),
        plus(L2, R, J2),
        'substs.rationaliseTypeHeap.p6'(N, V, J2, S, H2, K2),
        times(14, X, O2),
        plus(O2, R, M2),
        'substs.rationaliseTypeHeap.p6'(O, V, M2, S, K2, N2),
        times(15, X, Q2),
        plus(Q2, R, P2),
        'substs.rationaliseTypeHeap.p6'(P, V, P2, S, N2, U).
'substs.heapTerm.p2'('substs.R.f1'(A), 'metaDefs.var.f1'(A)).
'substs.heapTerm.p2'('substs.V.f1'(A), A).
'substs.heapTerm.p2'('substs.T.f1'(A), A).
'substs.getConstant1.p4'('metaDefs.var.f1'(A), B, 'substs.termSubst.f2'(C,D), 'substs.termSubst.f2'(E,D)) :-
        'substs.addBinding.p4'(A, 'substs.T.f1'(B), C, E).
'substs.getConstant1.p4'('metaDefs.var.f2'(A,B), C, 'substs.termSubst.f2'(D,E), 'substs.termSubst.f2'(D,['metaDefs.!.f2'('metaDefs.var.f2'(A,B),C)|E])).
'substs.getConstant1.p4'('metaDefs.cTerm.f1'(A), 'metaDefs.cTerm.f1'(A), B, B).
'substs.getConstant1.p4'('metaDefs.xCTerm.f2'(A,B), 'metaDefs.xCTerm.f2'(A,B), C, C).
'substs.getConstant1.p4'('metaDefs.int.f1'(A), 'metaDefs.int.f1'(A), B, B).
'substs.getConstant1.p4'('metaDefs.prm.f1'(A), 'metaDefs.prm.f1'(A), B, B).
'substs.getConstant1.p4'('metaDefs.str.f1'(A), 'metaDefs.str.f1'(A), B, B).
'substs.getBase.p4'(A, B, C, D) :-
        'substs.derefType.p3'(A, C, E),
        'substs.getBase1.p4'(E, B, C, D).
'substs.fullDereference.p3'('metaDefs.var.f2'(A,B), _, 'metaDefs.var.f2'(A,B)).
'substs.fullDereference.p3'('metaDefs.var.f1'(A), _, 'metaDefs.var.f1'(A)).
'substs.fullDereference.p3'('metaDefs.term.f2'(A,B), C, 'metaDefs.term.f2'(A,D)) :-
        'substs.applyTermSubst.p3'(B, C, D).
'substs.fullDereference.p3'('metaDefs.cTerm.f1'(A), _, 'metaDefs.cTerm.f1'(A)).
'substs.fullDereference.p3'('metaDefs.xTerm.f3'(A,B,C), D, 'metaDefs.xTerm.f3'(A,E,C)) :-
        'substs.applyTermSubst.p3'(B, D, E).
'substs.fullDereference.p3'('metaDefs.xCTerm.f2'(A,B), _, 'metaDefs.xCTerm.f2'(A,B)).
'substs.fullDereference.p3'('metaDefs.str.f1'(A), _, 'metaDefs.str.f1'(A)).
'substs.fullDereference.p3'('metaDefs.int.f1'(A), _, 'metaDefs.int.f1'(A)).
'substs.fullDereference.p3'('metaDefs.prm.f1'(A), _, 'metaDefs.prm.f1'(A)).
'substs.fullDereference.p3'('metaDefs.suchThat.f2'(A,B), _, 'metaDefs.suchThat.f2'(A,B)).
'substs.fullDerefType1.p4'([], _, _, []).
'substs.fullDerefType1.p4'([A|B], C, D, [E|F]) :-
        'substs.applySubstToType.p4'(A, C, D, E),
        'substs.fullDerefType1.p4'(B, C, D, F).
'substs.getConstant.p4'(A, B, C, D) :-
        'substs.dereference.p3'(A, C, E),
        'substs.getConstant1.p4'(E, B, C, D).
'substs.getBase1.p4'('metaDefs.par.f1'(A), B, 'substs.typeSubst.f2'(C,D), 'substs.typeSubst.f2'(E,D)) :-
        'substs.addBinding.p4'(A, 'substs.T.f1'(B), C, E).
'substs.getBase1.p4'('metaDefs.par.f2'(A,B), C, 'substs.typeSubst.f2'(D,E), 'substs.typeSubst.f2'(D,['metaDefs.!.f2'('metaDefs.par.f2'(A,B),C)|E])).
'substs.getBase1.p4'('metaDefs.bType.f1'(A), 'metaDefs.bType.f1'(A), B, B).
'substs.getBase1.p4'('metaDefs.xBType.f1'(A), 'metaDefs.xBType.f1'(A), B, B).
'substs.getType.p5'(A, B, C, D, E) :-
        'substs.derefType.p3'(A, D, F),
        'substs.getType1.p5'(F, B, C, D, E).
'substs.getFunction.p5'(A, B, C, D, E) :-
        'substs.dereference.p3'(A, D, F),
        'substs.getFunction1.p5'(F, B, C, D, E).
'substs.getFunction1.p5'('metaDefs.var.f1'(A), B, 'substs.write.c0', 'substs.termSubst.f2'(C,D), 'substs.termSubst.f2'(E,D)) :-
        'substs.addBinding.p4'(A, 'substs.T.f1'(B), C, E).
'substs.getFunction1.p5'('metaDefs.var.f2'(A,B), C, 'substs.write.c0', 'substs.termSubst.f2'(D,E), 'substs.termSubst.f2'(D,['metaDefs.!.f2'('metaDefs.var.f2'(A,B),C)|E])).
'substs.getFunction1.p5'('metaDefs.term.f2'(A,B), 'metaDefs.term.f2'(A,B), 'substs.read.c0', C, C).
'substs.getFunction1.p5'('metaDefs.xTerm.f3'(A,B,C), 'metaDefs.xTerm.f3'(A,B,C), 'substs.read.c0', D, D).
'substs.getType1.p5'('metaDefs.par.f1'(A), B, 'substs.write.c0', 'substs.typeSubst.f2'(C,D), 'substs.typeSubst.f2'(E,D)) :-
        'substs.addBinding.p4'(A, 'substs.T.f1'(B), C, E).
'substs.getType1.p5'('metaDefs.par.f2'(A,B), C, 'substs.write.c0', 'substs.typeSubst.f2'(D,E), 'substs.typeSubst.f2'(D,['metaDefs.!.f2'('metaDefs.par.f2'(A,B),C)|E])).
'substs.getType1.p5'('metaDefs.type.f2'(A,B), 'metaDefs.type.f2'(A,B), 'substs.read.c0', C, C).
'substs.getType1.p5'('metaDefs.xType.f2'(A,B), 'metaDefs.xType.f2'(A,B), 'substs.read.c0', C, C).
'substs.parameterInSubst.p3'('substs.typeSubst.f2'(_,A), B, C) :-
        'lists_g.member.p2'('metaDefs.!.f2'(B,C), A).
'substs.parameterInSubst.p3'('substs.typeSubst.f2'(A,_), 'metaDefs.par.f1'(B), C) :-
        'substs.bindingInHeap.p3'(A, B, D),
        'substs.heapType.p2'(D, C).
'substs.heapType.p2'('substs.R.f1'(A), 'metaDefs.par.f1'(A)).
'substs.heapType.p2'('substs.V.f1'(A), A).
'substs.heapType.p2'('substs.T.f1'(A), A).
'substs.rationaliseTermHeap.p6'('substs.N.c0', _, _, _, A, A).
'substs.rationaliseTermHeap.p6'('substs.R.f1'(A), _, B, C, D, E) :-
        'substs.applySubstToTerm.p4'('metaDefs.var.f1'(A), 'metaDefs.var.f1'(B), C, F),
        (   user:not_equal([], [F,B], F, 'metaDefs.occ.f1'('metaDefs.var.f1'(B))) ->
            'substs.addTermBinding1.p4'(F, B, D, E)
        ;   E=D
        ).
'substs.rationaliseTermHeap.p6'('substs.V.f1'(A), _, B, C, D, E) :-
        'substs.applySubstToTerm.p4'(A, 'metaDefs.var.f1'(B), C, F),
        (   user:not_equal([], [F,B], F, 'metaDefs.occ.f1'('metaDefs.var.f1'(B))) ->
            'substs.addTermBinding1.p4'(F, B, D, E)
        ;   E=D
        ).
'substs.rationaliseTermHeap.p6'('substs.T.f1'(A), _, B, C, D, E) :-
        'substs.applySubstToTerm.p4'(A, 'metaDefs.var.f1'(B), C, F),
        'substs.addTermBinding1.p4'(F, B, D, E).
'substs.rationaliseTermHeap.p6'('substs.H.f16'(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), Q, R, S, T, U) :-
        minus(Q, 1, W),
        V=W,
        power(16, Q, Y),
        X=Y,
        'substs.rationaliseTermHeap.p6'(A, V, R, S, T, Z),
        plus(X, R, A1),
        'substs.rationaliseTermHeap.p6'(B, V, A1, S, Z, B1),
        times(2, X, E1),
        plus(E1, R, C1),
        'substs.rationaliseTermHeap.p6'(C, V, C1, S, B1, D1),
        times(3, X, H1),
        plus(H1, R, F1),
        'substs.rationaliseTermHeap.p6'(D, V, F1, S, D1, G1),
        times(4, X, K1),
        plus(K1, R, I1),
        'substs.rationaliseTermHeap.p6'(E, V, I1, S, G1, J1),
        times(5, X, N1),
        plus(N1, R, L1),
        'substs.rationaliseTermHeap.p6'(F, V, L1, S, J1, M1),
        times(6, X, Q1),
        plus(Q1, R, O1),
        'substs.rationaliseTermHeap.p6'(G, V, O1, S, M1, P1),
        times(7, X, T1),
        plus(T1, R, R1),
        'substs.rationaliseTermHeap.p6'(H, V, R1, S, P1, S1),
        times(8, X, W1),
        plus(W1, R, U1),
        'substs.rationaliseTermHeap.p6'(I, V, U1, S, S1, V1),
        times(9, X, Z1),
        plus(Z1, R, X1),
        'substs.rationaliseTermHeap.p6'(J, V, X1, S, V1, Y1),
        times(10, X, C2),
        plus(C2, R, A2),
        'substs.rationaliseTermHeap.p6'(K, V, A2, S, Y1, B2),
        times(11, X, F2),
        plus(F2, R, D2),
        'substs.rationaliseTermHeap.p6'(L, V, D2, S, B2, E2),
        times(12, X, I2),
        plus(I2, R, G2),
        'substs.rationaliseTermHeap.p6'(M, V, G2, S, E2, H2),
        times(13, X, L2),
        plus(L2, R, J2),
        'substs.rationaliseTermHeap.p6'(N, V, J2, S, H2, K2),
        times(14, X, O2),
        plus(O2, R, M2),
        'substs.rationaliseTermHeap.p6'(O, V, M2, S, K2, N2),
        times(15, X, Q2),
        plus(Q2, R, P2),
        'substs.rationaliseTermHeap.p6'(P, V, P2, S, N2, U).
'substs.rationaliseTermList.p3'([], [], _).
'substs.rationaliseTermList.p3'(['metaDefs.!.f2'(B,C)|A], D, E) :-
        'substs.applySubstToTerm.p4'(C, B, E, F),
        (   user:not_equal([], [C,B], C, 'metaDefs.occ.f1'(B)) ->
            D=['metaDefs.!.f2'(B,F)|G]
        ;   D=G
        ),
        'substs.rationaliseTermList.p3'(A, G, E).
'substs.substsComposeType.p3'(A, B, C) :-
        'substs.composeTypeSubsts1.p3'(A, A, D),
        'substs.composeTypeSubsts1.p3'(D, B, E),
        'substs.composeTypeSubsts1.p3'(B, B, F),
        'substs.composeTypeSubsts2.p3'(F, E, C).
'substs.substApplyToType.p3'(A, B, C) :-
        'substs.derefType.p3'(A, B, D),
        'substs.fullDerefType.p3'(D, B, C).
'substs.rationaliseTypeList.p3'([], [], _).
'substs.rationaliseTypeList.p3'(['metaDefs.!.f2'(B,C)|A], D, E) :-
        'substs.applySubstToType.p4'(C, B, E, F),
        (   user:not_equal([], [C,B], C, 'metaDefs.occ.f1'(B)) ->
            D=['metaDefs.!.f2'(B,F)|G]
        ;   D=G
        ),
        'substs.rationaliseTypeList.p3'(A, G, E).
'substs.substApplyToTerm.p3'(A, B, C) :-
        'substs.dereference.p3'(A, B, D),
        'substs.fullDereference.p3'(D, B, C).
'substs.substsComposeTerm.p3'(A, B, C) :-
        'substs.composeTermSubsts1.p3'(A, A, D),
        'substs.composeTermSubsts1.p3'(D, B, E),
        'substs.composeTermSubsts1.p3'(B, B, F),
        'substs.composeTermSubsts2.p3'(F, E, C).
'substs.unifyParameter.p5'('substs.write.c0', A, A, B, B).
'substs.unifyParameter.p5'('substs.read.c0', A, B, C, D) :-
        (   user:not_equal([], [A,B], A, B) ->
            'substs.bindParameter.p4'(B, A, C, D)
        ;   D=C
        ).
'substs.unifyConstant.p5'('substs.write.c0', A, A, B, B).
'substs.unifyConstant.p5'('substs.read.c0', A, B, C, D) :-
        'substs.dereference.p3'(A, C, E),
        'substs.getConstant1.p4'(E, B, C, D).
'substs.unifyBase.p5'('substs.write.c0', A, A, B, B).
'substs.unifyBase.p5'('substs.read.c0', A, B, C, D) :-
        'substs.derefType.p3'(A, C, E),
        'substs.getBase1.p4'(E, B, C, D).
'substs.unifyKnownVariable.p5'('substs.write.c0', A, A, B, B).
'substs.unifyKnownVariable.p5'('substs.read.c0', A, B, C, D) :-
        (   user:not_equal([], [A,B], A, B) ->
            'substs.bindVariable.p4'(B, A, C, D)
        ;   D=C
        ).
'substs.unifyFunction.p6'('substs.write.c0', A, A, 'substs.write.c0', B, B).
'substs.unifyFunction.p6'('substs.read.c0', A, B, C, D, E) :-
        'substs.dereference.p3'(A, D, F),
        'substs.getFunction1.p5'(F, B, C, D, E).
'substs.unifyVariable.p4'('substs.write.c0', 'metaDefs.var.f1'(A), A, B) :-
        plus(A, 1, B),
        true.
'substs.unifyVariable.p4'('substs.read.c0', _, A, A).
'substs.unifyType.p6'('substs.write.c0', A, A, 'substs.write.c0', B, B).
'substs.unifyType.p6'('substs.read.c0', A, B, C, D, E) :-
        'substs.derefType.p3'(A, D, F),
        'substs.getType1.p5'(F, B, C, D, E).
'substs.variableInSubst.p3'('substs.termSubst.f2'(_,A), B, C) :-
        'lists_g.member.p2'('metaDefs.!.f2'(B,C), A).
'substs.variableInSubst.p3'('substs.termSubst.f2'(A,_), 'metaDefs.var.f1'(B), C) :-
        'substs.bindingInHeap.p3'(A, B, D),
        'substs.heapTerm.p2'(D, C).
%	---------------------------------------------------
%	---------------------------------------------------
%	Fast Prolog code for Substs bindings.
%	---------------------------------------------------
%	---------------------------------------------------


'substs.addBinding.p4'(Index,Term,'substs.heap.f2'(Exp,Heap)
				,'substs.heap.f2'(Exp1,Heap1)) :-
	Exp2 is Exp+1,
	power16(Exp2,Pow),
	( Index < Pow ->
		Exp1 = Exp,
		'substs.addBinding1.p5'(Heap,Index,Exp,Term,Heap1)
	;	newbinding(Index,Exp2,Exp1,Term,Heap,Heap1)).

'~substs.addBinding.p4'(A, B, C, D) :-
	'substs.addBinding.p4'(A, B, C, D).


newbinding(Index,Exp,Exp1,Term,Heap,Heap1) :-
	Exp2 is Exp+1,
	power16(Exp2,Pow),
	( Index < Pow ->
		'substs.addBinding1.p5'('substs.H.f16'(Heap,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0'),Index,Exp,Term,Heap1),
		Exp1 = Exp
	;	newbinding(Index,Exp2,Exp1,Term,'substs.H.f16'(Heap,'substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0','substs.N.c0'),Heap1)).


'substs.addBinding1.p5'('substs.H.f16'(H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,HA,HB,HC,HD,HE,HF),Index,Exp,Term,Heap1) :-
	power16(Exp,Pow),
	Div is Index // Pow,
	Mod is Index mod Pow,
	Exp1 is Exp-1,
	'substs.addBinding2.p21'(Div,Mod,Exp1,Term,H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,HA,HB,HC,HD,HE,HF,Heap1).

'substs.addBinding1.p5'('substs.N.c0',Index,Exp,Term,Heap1) :-
	'substs.addNewBinding1.p4'(Index,Exp,Term,Heap1).

'substs.addBinding1.p5'('substs.R.f1'(_),_,_,Term,Term).
	       
'substs.addBinding1.p5'('substs.V.f1'(_),_,_,Term,Term).
	       
'substs.addBinding1.p5'('substs.T.f1'(_),_,_,Term,Term).
	       
'~substs.addBinding1.p5'(Heap,Index,Exp,Term,Heap1) :-
	'substs.addBinding1.p5'(Heap,Index,Exp,Term,Heap1).


'substs.addNewBinding1.p4'(Index,Exp,Term,Heap) :-
	( Exp =  -1 ->
		Heap = Term
	;	power16(Exp,Pow),
		Div is Index // Pow,
		Mod is Index mod Pow,
		Exp1 is Exp-1,
		'substs.addNewBinding.p5'(Div,Mod,Exp1,Term,Heap)).

'~substs.addNewBinding1.p4'(A, B, C, D) :-
	'substs.addNewBinding1.p4'(A, B, C, D).


'substs.contents.p4'(Index,Exp,Heap,Value) :-
	Index1 is Index+1,
	Exp1 is Exp+1,
	power16(Exp1,Pow),
	( Index1 > Pow ->
		Value = 'substs.N.c0'
	;	contents(Heap,Index,Exp,Value)).

'~substs.contents.p4'(Index,Exp,Heap,Value) :-
	'substs.contents.p4'(Index,Exp,Heap,Value).


contents(Heap,Indx,Exp,Val):-
	( Heap = 'substs.N.c0' ->
		Val = 'substs.N.c0'
	;	( Exp = 0 ->
			Indx1 is Indx+1,
			arg(Indx1,Heap,Val)
		;	power16(Exp,Pow),
			Div is Indx // Pow,
			Div1 is Div+1,
			arg(Div1,Heap,V1),
			Mod is Indx mod Pow,
			Exp1 is Exp-1,
			contents(V1,Mod,Exp1,Val))).
	

'substs.address.p5'(Heap, Exp, A, A1, Term) :-
  (  Heap = 'substs.N.c0' ->
       fail
  ;    ( Heap = 'substs.V.f1'(_) ->
            A = A1,
            Term = Heap
       ;    ( Heap = 'substs.R.f1'(_) ->
                 A = A1,
                 Term = Heap
            ;    ( Heap = 'substs.T.f1'(_) ->
                     A = A1,
                     Term = Heap
                 ;   power16(Exp,Pow),
                     Exp1 is Exp-1,
                     member3(Arg,1,[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),
                     Arg1 is Arg-1,
                     A2 is A + (Pow * Arg1),
                     arg(Arg,Heap,Heap1),
                     'substs.address.p5'(Heap1,Exp1,A2,A1,Term) )))).

'~substs.address.p5'(Heap, Exp, A, A1, Term) :-
	'substs.address.p5'(Heap, Exp, A, A1, Term).

power16(0,1).
power16(1,16).
power16(2,256).
power16(3,4096).
power16(4,65536).
%power16(5,1048576).
%power10(6,16777216).
%power10(7,268435456).
%power10(8,4294967296).

member3(X,X,_).

member3(X,_,[Y|L]) :-
	member3(X,Y,L).

%------------------------------------------------------------------------------
% Predicates required by Syntax (moved here from Syntax.sup)
%------------------------------------------------------------------------------
 
% Avoid unnecessary choicepoints

'substs.sBindingInTypeSubst.p3'(Subst, Var, Type) :-
        ( var(Var) ->
                'substs':'substs.parameterInSubst.p3'(Subst, Var, Type1),
                'substs':'substs.substApplyToType.p3'(Type1, Subst, Type)
                ; 'substs':'substs.substApplyToType.p3'(Var, Subst, Type),
		  Type \== Var
        ).

'~substs.sBindingInTypeSubst.p3'(Subst, Param, Type) :-
   'substs.sBindingInTypeSubst.p3'(Subst, Param, Type).


'substs.sBindingInTermSubst.p3'(Subst, Var, Term) :-
        ( var(Var) ->
                'substs':'substs.variableInSubst.p3'(Subst, Var, Term1),
                'substs':'substs.substApplyToTerm.p3'(Term1, Subst, Term)
                ; 'substs':'substs.substApplyToTerm.p3'(Var, Subst, Term),
		  Term \== Var
        ).

'~substs.sBindingInTermSubst.p3'(Subst, Param, Term) :-
   'substs.sBindingInTermSubst.p3'(Subst, Param, Term).


'substs.sDelBindingInTypeSubst.p4'(Subst, Var, Type, NewSubst) :-
   ( var(Var) ->
	'substs':'substs.parameterInSubst.p3'(Subst, Var, _),
	'substs':'substs.delTypeBinding.p4'(Var, Type, Subst, NewSubst)
     ;  'substs':'substs.delTypeBinding.p4'(Var, Type, Subst, NewSubst)
   ).

'~substs.sDelBindingInTypeSubst.p4'(Subst, Var, Type, NewSubst) :-
   'substs.sDelBindingInTypeSubst.p4'(Subst, Var, Type, NewSubst).


'substs.sDelBindingInTermSubst.p4'(Subst, Var, Term, NewSubst) :-
   ( var(Var) ->
	'substs':'substs.variableInSubst.p3'(Subst, Var, _),
	'substs':'substs.delTermBinding.p4'(Var, Term, Subst, NewSubst)
     ;  'substs':'substs.delTermBinding.p4'(Var, Term, Subst, NewSubst)
   ).

'~substs.sDelBindingInTermSubst.p4'(Subst, Var, Term, NewSubst) :-
   'substs.sDelBindingInTermSubst.p4'(Subst, Var, Term, NewSubst).

