random_pred_mutation(b(Predicate,pred,Info),b(NewPredicate,pred,Info)) :-
Predicate =.. [Type,Expr1,Expr2] ,
random_mutation(Expr1,NewExpr1) ,
random_mutation(Expr2,NewExpr2) ,
% randomly swap predicates with a matching one
random(0,9,R) ,
(R > 4 ->
swap_type(Type,MutatedType)
; MutatedType = Type) ,
NewPredicate =.. [MutatedType,NewExpr1,NewExpr2].
random_pred_mutation(b(Predicate,pred,Info),b(NewPredicate,pred,Info)) :-
Predicate =.. [Type,Expr] ,
random_mutation(Expr,NewExpr) ,
NewPredicate =.. [Type,NewExpr].
random_pred_mutation(Value,Value).