let force_transition loc f st (_,tr_status) =
let states,_ as auto = Data_for_aorai.getAutomata() in
let aux (impossible_states,possible_states,has_crossable_trans) state =
let trans = Path_analysis.get_transitions_of_state state auto in
let add_one_trans (_,has_crossable_trans as acc) trans =
if tr_status.(trans.numt) then begin
let guard =
crosscond_to_pred ~event:(f,st) (fst trans.cross)
(Data_for_aorai.get_logic_var Data_for_aorai.curOp)
(Data_for_aorai.get_logic_var Data_for_aorai.curOpStatus)
in
true,Logic_const.por ~loc (has_crossable_trans,guard)
end else acc
in
let is_possible_start, cond =
List.fold_left add_one_trans (false,pfalse) trans
in
if is_possible_start then begin
let start = is_state_pred state in
let has_crossable_trans =
if Logic_utils.is_trivially_true cond then has_crossable_trans
else Logic_const.new_predicate
(pimplies ~loc (start,cond)) :: has_crossable_trans
in
impossible_states,
Logic_const.por ~loc (possible_states,start), has_crossable_trans
end else begin
let not_start = is_out_of_state_pred state in
Logic_const.pand ~loc (impossible_states,not_start),
possible_states, has_crossable_trans
end
in
let impossible_states, possible_states, crossable_trans =
List.fold_left aux (ptrue, pfalse,[]) states
in
let states =
if Aorai_option.Deterministic.get() then
possible_states
else
Logic_const.pand ~loc (possible_states, impossible_states)
in
Logic_const.new_predicate states :: (List.rev crossable_trans)