verify_alloy_command(ProvidedCmdName, Solver, CmdIsValid, IsCheckCmd, Res) :-
(ProvidedCmdName = '_' , b_get_machine_operation(CmdName, _, _, _) -> true % _ as a wildcard for first command
; CmdName = ProvidedCmdName),
if(b_get_machine_operation(CmdName, _, _, Body),
true,
(add_error(cbc_path_solver,'Unknown Alloy command name:',CmdName),
findall(Other,b_get_machine_operation(Other, _, _, _),OL),
add_message(cbc_path_solver,'Available B operations: ',OL),fail)),
get_precondition_from_translated_alloy_operation(Body, Precondition),
b_get_properties_from_machine(Properties),
conjunct_predicates([Properties,Precondition], Conj),
start_ms_timer(Timer),
( Solver == prob
-> solve_predicate(Conj, _, 1, [use_smt_mode/true,use_clpfd_solver/true,use_chr_solver/false,clean_up_pred,allow_improving_wd_mode/true], Res)
; Solver == probkodkod
-> solve_predicate(Conj, _, 1, [use_smt_mode/true,use_clpfd_solver/true,use_chr_solver/false,clean_up_pred,allow_improving_wd_mode/true,use_solver_on_load/kodkod], Res)
; Solver == probsmt
-> cdclt_solve_predicate(Conj, _SolvedWDPred, Res)
; Solver == z3,
smt_solve_predicate(z3, Conj, _, Res)
),
( atom_concat(check, _, CmdName)
-> validate_solver_result_for_command(check, Res, CmdIsValid),
IsCheckCmd = true
; validate_solver_result_for_command(run, Res, CmdIsValid),
IsCheckCmd = false
),
(silent_mode(on) -> true
; (Res=solution(_) -> RS=solution ; RS=Res),
ajoin(['Checking Alloy command ',CmdName,' with ',Solver,'; result = ',RS],Msg),
stop_ms_walltimer_with_msg(Timer,Msg)).
verify_alloy_command(ProvidedCmdName, Solver, CmdIsValid, IsCheckCmd, Res) :-
add_internal_error('Call failed:',verify_alloy_command(ProvidedCmdName, Solver, CmdIsValid, IsCheckCmd, Res)).