- let rec comp_acc_self set flag =
- () (* given a current set of states we add
- states from self transitions which satisfy the two conditions *)
- (* With result (below) we have all valid transitions at step 0
- we compute the self states which occur in it and which are not in cthe current state.
- For each of these states we compute the transitions with the correct label and state
- we infer each of these transitions: true -> add self states occuring in it
- to the acc and to the current set + add left and right states as result do *)
- (* ----> With a FIFO *)
- and fix_point selfq_i =
- () in
- NodeHash.replace run node (set_node, set_nr);
+ let rec result_q self_q queue = function (* for initializing the queue *)
+ | [] -> self_q,queue
+ | (q,form) :: tl ->
+ if (StateSet.mem q self_q)
+ then begin
+ let q_cand,_,_ = Formula.st form in
+ StateSet.iter (fun x -> Queue.push x queue) q_cand;
+ result_q (StateSet.add q self_q) queue tl;
+ end
+ else result_q self_q queue tl
+ and result_st_q self_q queue flag = function (*for computing the fixed p*)
+ | [] -> flag,queue
+ | form :: tl ->
+ if Formula.infer_form (self_q,self_r) qf qn form
+ then begin
+ let q_cand,_,_ = Formula.st form in
+ StateSet.iter (fun x -> Queue.push x queue) q_cand;
+ result_st_q self_q queue 1 tl;
+ end
+ else result_st_q self_q queue flag tl in
+ let rec comp_acc_self self_q_i queue = (* compute the fixed point *)
+ if Queue.is_empty queue
+ then self_q_i
+ else
+ let q = Queue.pop queue in
+ let list_q,_ = Asta.transitions_st_lab asta q lab in
+ let flag,queue = result_st_q self_q_i queue 0 list_q in
+ let self_q = if flag = 1 then StateSet.add q self_q_i else self_q_i in
+ comp_acc_self self_q queue in