user_interaction_graduate_examples(_,[],_,[],[],[],[],_).
user_interaction_graduate_examples(Vars,[Example|R],Assuming,PosIn,NegIn,PosOut,NegOut,Type) :-
% examples can be bindings from the solver
(Example = (In,Out)
-> maplist(example_bindings_to_ast_nodes,[In,Out],[InputNodes,OutputNodes]) ,
maplist(translate_bexpression,InputNodes,RawInput) ,
maplist(translate_bexpression,OutputNodes,RawOutput)
; Example = (RawInput-->RawOutput) ,
findall(Name,member(b(identifier(Name),_,_),Vars),VarNames) ,
synthesis_util:pretty_example_to_ast_nodes(RawInput,VarNames,InputNodes) ,
synthesis_util:pretty_example_to_ast_nodes(RawOutput,VarNames,OutputNodes)) ,
% only give the opportunity to change output of examples from model checking,
% if there is no assuming it's an example from the user
(Assuming = none
-> format("~nIs ~w-->~w a valid example? [yes/no] ",[RawInput,RawOutput])
; format("~nIs ~w-->~w a valid example? (assuming ~w) [yes/no/edit] ",[RawInput,RawOutput,Assuming])) ,
read(Answer) ,
(Answer = edit
-> Type = action ,
user_interaction_change_output(RawInput,RawOutput,TNewOutput) ,
synthesis_util:pretty_example_to_ast_nodes(TNewOutput,Vars,NewOutput) ,
user_interaction_graduate_examples_aux([InputNodes|OldPosIn],OldNegIn,[NewOutput|OldPosOut],
OldNegOut,PosIn,NegIn,PosOut,NegOut)
; ((Answer = yes
-> user_interaction_graduate_examples_aux([InputNodes|OldPosIn],OldNegIn,
[OutputNodes|OldPosOut],OldNegOut,PosIn,NegIn,PosOut,NegOut)
; Answer = no ,
user_interaction_graduate_examples_aux(OldPosIn,[InputNodes|OldNegIn],OldPosOut,
[OutputNodes|OldNegOut],PosIn,NegIn,PosOut,NegOut)))) ,
user_interaction_graduate_examples(Vars,R,Assuming,OldPosIn,OldNegIn,OldPosOut,OldNegOut,Type).