1 % (c) 2009-2026 Lehrstuhl fuer Softwaretechnik und Programmiersprachen,
2 % Heinrich Heine Universitaet Duesseldorf
3 % This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html)
4
5 :- module(model_checker,[is_deadlocked/1, node_satisfies_goal/1,
6 open_search/11,
7 expired_static_analysis_time/1,
8 proof_info_model_checking_incomplete/5, model_checking_is_incomplete/6,
9 perform_static_analyses/3, compute_transitions_opt/3,
10 get_model_check_stats/6,
11 find_invariant_error/4, replay_stored_mc_error/1]).
12
13 :- use_module(module_information).
14 :- module_info(group,model_checker).
15 :- module_info(description,'The core model checker (does not treat LTL).').
16
17 :- use_module(b_interpreter,[state_violates_assertions/2]).
18 :- use_module(error_manager,[enter_new_error_scope/1, exit_error_scope_if_necessary/2, error_occurred_in_error_scope/0,
19 clear_events_in_current_error_scope/1,
20 add_internal_error/2]).
21
22 :- use_module(specfile,[animation_mode/1,csp_mode/1]).
23 :- use_module(state_space,[visited_expression/2,transition/3, operation_not_yet_covered/1]).
24
25 :- use_module(probporsrc(static_analysis),[compute_dependendency_relation_of_all_events_in_the_model/3]).
26
27 :- use_module(state_space_exploration_modes,[depth_breadth_first_mode/1]).
28 :- use_module(bmachine,[b_machine_has_constants/0]).
29 :- use_module(state_space,[multiple_concrete_constants_exist/0]).
30
31 :- dynamic mc_found_error/2.
32
33 /* open_search: search for errors/goals among open nodes (i.e., not yet processed nodes)*/
34 /* LimitNr: max number of nodes to check, NodesAnalysed: number of nodes checked */
35 open_search(LimitNr,NodesAnalysed,LimitTime,Res,FindDeadlocks,FindInvViolations,
36 FindGoal,FindAssViolations,FindStateErrors,
37 StopAtFullCoverage,PartialOrderReduction) :-
38 animation_mode(MODE),
39 retractall(mc_found_error(_,_)),
40 initialise_optimisations(MODE,PartialOrderReduction,FindInvViolations,Optimisations),
41 perform_static_analyses(MODE,FindInvViolations,Optimisations),
42 %(error_manager:real_error_occurred -> print(error_after_perform_static_analyses),nl ; true),
43 depth_breadth_first_mode(DFMODE),
44 preferences:temporary_set_preference(do_invariant_checking,true,CHNG),
45 statistics(walltime,[ReferenceTime,_]),
46 get_model_check_stats(States,_Transitions,ProcessedTotal,Percentage,_,_),
47 % MEMO: used to cache expanded concrete_constants values
48 % particularly useful, e.g., for ../prob_examples/public_examples/B/PerformanceTests/LiftLargeWithLargeCst.mch
49 ((\+ b_machine_has_constants ; multiple_concrete_constants_exist)
50 -> MEMO = '$disabled' % it could still be useful to cache one constant setup ??
51 ; true),
52 enter_new_error_scope(ScopeID),
53 set_context_state(root),
54 % call_cleanup: also clean up when interrupted by an exception, e.g., by the time_out of probcli's -timeout
55 call_cleanup(
56 once(open_search10(0,LimitNr,refstatus(ReferenceTime,Percentage,States,ProcessedTotal,ReferenceTime),
57 NodesAnalysed,LimitTime,MCRes,FindDeadlocks,FindInvViolations,
58 FindGoal,FindAssViolations,FindStateErrors,
59 StopAtFullCoverage,Optimisations,MODE,DFMODE,MEMO)),
60 open_search_cleanup(ScopeID,CHNG)),
61 %tools_printing:print_term_summary(memo(MEMO)),nl,
62 (no_error_found_result(MCRes),
63 mc_found_error(Res,ID) % stored error because of mc_continue_after_error
64 -> set_counter_example_last_node(ID)
65 ; Res=MCRes).
66
67 open_search_cleanup(ScopeID,CHNG) :-
68 exit_error_scope_if_necessary(ScopeID,open_search),
69 preferences:reset_temporary_preference(do_invariant_checking,CHNG),
70 clear_context_state.
71
72 % replay an error stored with mc_continue_after_error, e.g., after the model checker was interrupted by a time-out
73 replay_stored_mc_error(Res) :-
74 mc_found_error(Res,ID), !,
75 set_counter_example_last_node(ID).
76
77 no_error_found_result(no).
78 no_error_found_result(all).
79 no_error_found_result([timeout,_]). % a time-out must not hide an error found and stored with mc_continue_after_error
80
81 :- use_module(probsrc(tools),[statistics_memory_used/1]).
82 :- use_module(probsrc(debug),[silent_mode/1, formatsilent/3]).
83 :- use_module(library(random)).
84 open_search10(Nr,LimitNr,RefStatus,NodesAnalysed,LimitTime,Res,
85 FindDeadlocks,FindInvViolations,FindGoal,FindAssViolations,FindStateErrors,
86 SFC,Optimisations,MODE,DF,MEMO) :-
87 %print(open_search(Nr,LimitNr,RefStatus)),nl,
88 Nr < LimitNr,!,
89 (\+ number(LimitTime)
90 -> open_search_do_one_node(Nr,LimitNr,RefStatus,NodesAnalysed,LimitTime,Res,
91 FindDeadlocks,FindInvViolations,FindGoal,FindAssViolations,FindStateErrors,
92 SFC,Optimisations,MODE,DF,MEMO)
93 ; statistics(walltime,[NewTime,_]),
94 (Nr mod 25 =:= 24, silent_mode(off) %, Nr\=0
95 -> RefStatus = refstatus(RefTime,RefPerc,PrevStates,PrevProcessed,StartTime),
96 Delta is NewTime-RefTime,
97 (Delta>20000 % more than 20 seconds since last progress message
98 % ; random(0,20000,X), X=<Delta)
99 -> get_model_check_stats(States,Transitions,ProcessedTotal,Perc,Ignored,ScopePerc),
100 (Ignored>0
101 -> format('~n* ~w states checked (~1f% of total ~w, ~1f% wo ~w ignored), ~w transitions,',
102 [ProcessedTotal,Perc,States,ScopePerc,Ignored,Transitions])
103 ; get_current_breadth_first_level(Level)
104 -> format('~n* ~w states checked (~1f% of total ~w), ~w transitions, bf-level ~w, ',
105 [ProcessedTotal,Perc,States,Transitions,Level])
106 ; format('~n* ~w states checked (~1f% of total ~w), ~w transitions,',
107 [ProcessedTotal,Perc,States,Transitions])
108 ),
109 findall(Op,operation_not_yet_covered(Op),NotCov), length(NotCov,NrNotCov),
110 (NrNotCov = 1 -> format(' 1 operation not covered,',[])
111 ; NrNotCov > 0 -> format(' ~w operations not covered,',[NrNotCov]) ; true),
112 statistics_memory_used(M), tools:print_mb(M),
113 DeltaProcessedStates is (ProcessedTotal-PrevProcessed),
114 NodesProcessedPerSec is DeltaProcessedStates*1000 / (NewTime-RefTime),
115 format('~n* currently checking ~2f states/sec',[NodesProcessedPerSec]),
116 DeltaStates is (States-PrevStates),
117 NodesPerSec is DeltaStates*1000 / (NewTime-RefTime),
118 format(', adding ~2f new states/sec~n',[NodesPerSec]),
119 RefStatus1 = refstatus(NewTime,Perc,States,ProcessedTotal,StartTime),
120 FullDeltaTime is NewTime - StartTime,
121 FullDeltaTimeMinutes is FullDeltaTime / 60000.0,
122 (Perc>RefPerc -> format('* walltime ~1f minutes~n',[FullDeltaTimeMinutes])
123 ; format('* walltime ~1f minutes, percentage of checked states decreasing from ~1f%~n',[FullDeltaTimeMinutes,RefPerc]))
124 ; RefStatus1 = RefStatus
125 )
126 ; RefStatus1 = RefStatus
127 ),
128 (NewTime>LimitTime, Nr>0
129 -> Res = [timeout,Nr], NodesAnalysed=Nr
130 ; open_search_do_one_node(Nr,LimitNr,RefStatus1,NodesAnalysed,LimitTime,Res,
131 FindDeadlocks,FindInvViolations,FindGoal,FindAssViolations,FindStateErrors,
132 SFC,Optimisations,MODE,DF,MEMO))
133 ).
134 open_search10(N,_LimitNr,_RefStatus,N,_,no ,_,_,_,_,_,_,_,_,_,_MEMO).
135
136 % States: total number of states encounetered
137 % ProcessedTotal: number of states already processed
138 % Percentage: percentate of total processed
139 % Ignored: number of states ignored because not satisfying SCOPE predicate
140 % ScopePercentage: percentage processed taking into account ignored states
141 get_model_check_stats(States,Transitions,ProcessedTotal,Percentage,Ignored,ScopePercentage) :-
142 get_state_space_stats(States,Transitions,ProcessedTotal,Ignored),
143 Percentage is (100*ProcessedTotal / States),
144 InScope is (States-Ignored),
145 (InScope > 0 -> ScopePercentage is (100*ProcessedTotal / InScope) ; ScopePercentage = 100).
146
147 :- use_module(preferences,[preference/2]).
148 :- use_module(specfile,[prepare_state_for_specfile_trans/4]).
149 open_search_do_one_node(Nr,LimitNr,RefStatus,NodesAnalysed,LimitTime,Res,
150 FindDeadlocks,FindInvViolations,
151 FindGoal,FindAssViolations,FindStateErrors,
152 StopAtFullCoverage,Optimisations,MODE,DFMODE,MEMO) :-
153 ? get_next_node_to_check(FindInvViolations,ID,MODE,DFMODE),!,
154 update_context_state(ID), %print(treating_node(ID)),nl,
155
156 (preference(ignore_hash_collisions,true),
157 preference(forget_state_space,true)
158 -> retract_visited_expression(ID,CurState) %, retractall(id_to_marker(ID,_)) not necessary
159 ; visited_expression(ID,CurState)),
160 (FindInvViolations=1 % compute invariant status
161 -> prepare_state_for_specfile_trans(CurState,ID,MEMO,PCurState),
162 tcltk_interface:compute_invariant_if_necessary(ID,PCurState,MODE)
163 ; CurState=PCurState),
164 %print(processed_invariant(ID)), statistics(memory_used,M), tools:print_mb(M),nl,
165 !,
166 compute_transitions_opt(Optimisations,ID,PCurState),
167 %tools:print_message(mc(ID)),
168 %print(computed_all_transitions(ID)), statistics(memory_used,M2), tools:print_mb(M2),nl,
169 % !,
170 (open_search_check_for_error(ID,PCurState,Res,
171 FindDeadlocks,FindInvViolations,FindGoal,FindAssViolations,
172 FindStateErrors,StopAtFullCoverage,MODE)
173 -> print_found_error(Res,ID),
174 NodesAnalysed=Nr,
175 set_counter_example_last_node(ID)
176 ; N1 is Nr + 1,
177 open_search10(N1,LimitNr,RefStatus,NodesAnalysed,LimitTime,Res,
178 FindDeadlocks,FindInvViolations,FindGoal,FindAssViolations,FindStateErrors,StopAtFullCoverage,
179 Optimisations,MODE,DFMODE,MEMO)
180 ).
181 open_search_do_one_node(N,_LimitNr,_RefStatus,N,_,all,_,_,_,_,_,_,_,_,_,_MEMO) :-
182 formatsilent(user_output,'% Model checking finished, all open states visited~n',[]).
183
184 set_counter_example_last_node(ID) :-
185 tcltk_interface:tcltk_execute_trace_to_node(ID). % TO DO: allow to disable this when -nocounter option given
186
187 :- use_module(tools_printing,[format_with_colour_nl/4]).
188 print_found_error(goal_found,ID) :- !,
189 format_with_colour_nl(user_output,[green],'Found GOAL in state id ~w',[ID]).
190 print_found_error(full_coverage,ID) :- !,
191 format_with_colour_nl(user_output,[green],'Full coverage achieved in state id ~w',[ID]).
192 print_found_error(state_error(X),ID) :- nonvar(X),functor(X,F,_),!, % only print functor; term can be big
193 format_with_colour_nl(user_error,[red],'Found "~w" in state id ~w',[F,ID]).
194 print_found_error(X,ID) :-
195 format_with_colour_nl(user_error,[red],'Found "~w" error in state id ~w',[X,ID]).
196
197
198 %% Optimisation options (see first argument 'Optimisations'):
199 compute_transitions_opt(Optimisations,ID,CurState) :-
200 Optimisations = opt(PORPrefs,_),
201 compute_transitions(PORPrefs,ID,CurState).
202
203 compute_transitions(PORPrefs,ID,CurState) :-
204 PORPrefs = por(POROption,_UseEnableGraph,_Depth,_UsePGE),
205 (POROption==ample_sets;POROption==ample_sets2),!,
206 tcltk_interface: compute_ample_set(ID,CurState,PORPrefs).
207 compute_transitions(_,ID,CurState) :-
208 tcltk_interface: compute_all_transitions(ID,CurState).
209
210 :- use_module(preferences,[get_preference/2]).
211 :- use_module(specfile,[b_or_z_mode/1]).
212 :- use_module(state_space_exploration_modes,[get_open_node_to_check/2, get_current_breadth_first_level/1]).
213 %%get_next_node_to_check(1,ID,_) :- state_space:not_invariant_checked(ID). % if there is an existing node whose invariant we have not yet checked: check it now
214 get_next_node_to_check(_,ID,AnimMODE,DFMODE) :-
215 %(nonvar(ID) -> print(nonvar(ID)),nl ; true),
216 ? get_open_node_to_check(DFMODE,ID),
217 (b_or_z_mode(AnimMODE) -> assertz(not_invariant_checked(ID)) ; true).
218
219
220 :- use_module(state_space).
221 open_search_check_for_error(ID,PCurState,Res,
222 FindDeadlocks,FindInvViolations,FindGoal,FindAssViolations,
223 FindStateErrors,StopAtFullCoverage,MODE) :-
224 open_search_found_error(ID,PCurState,Res,
225 FindDeadlocks,FindInvViolations,FindGoal,FindAssViolations,
226 FindStateErrors,StopAtFullCoverage,MODE),
227 (get_preference(mc_continue_after_error,false)
228 -> true
229 ; print_found_error(Res,ID), % just print the error and try find more
230 %ajoin(['Found at state ',ID,':'],Msg), add_error(model_checker,'Found error:'Res),
231 % we could call analyse_invariant_for_state(ID)
232 (Res == general_error_occurred
233 -> % reset the error flag of the open_search error scope; otherwise every later state reports this error again
234 clear_events_in_current_error_scope(_)
235 ; true),
236 \+ mc_found_error(_,_),
237 assertz(mc_found_error(Res,ID)), % store error to replay at end
238 fail
239 ).
240
241 open_search_found_error(ID,CurState,Error,
242 _FindDeadlocks,1,_FindGoal,_FindAssViolations,_FindStateErrors,_StopAtFullCoverage,MODE) :-
243 find_invariant_error(MODE,ID,CurState,Error).
244 open_search_found_error(ID,_CurState,deadlock,1,_,_,_,_,_,_) :-
245 is_deadlocked(ID). %, print(deadlock(ID)),nl.
246 open_search_found_error(ID,CurState,assertion_violation,_,_,_,1,_,_,_MODE) :-
247 state_violates_assertions(ID,CurState).
248 open_search_found_error(ID,_CurState,ERR,_,_,_,_,1,_,_MODE) :-
249 state_space:state_error(ID,_,Error),
250 Error \== invariant_violated,
251 ERR = state_error(Error).
252 open_search_found_error(_ID,_CurState,general_error_occurred,_,_,_,_,1,_,_MODE) :-
253 error_occurred_in_error_scope. % enter_new_error_scope set up in open_search
254 %% we no longer use: error_manager:real_error_occurred ; errors can happen e.g. in POR static analysis
255 open_search_found_error(ID,CurState,goal_found,_,_,1,_,_,_,MODE) :-
256 node_satisfies_goal(ID,CurState,MODE).
257 open_search_found_error(_ID,_CurState,full_coverage,_,_,_,_,_,1,_MODE) :- % StopAtFullCoverage = 1
258 \+ operation_not_yet_covered(_).
259
260 find_invariant_error(b,ID,_CurState,invariant_violation) :- !, % here we know that invariant information has been computed
261 (invariant_violated(ID) -> true).
262 %find_invariant_error(b,_ID,CurState,invariant_false) :- !,
263 % preference(double_evaluation_when_analysing,true), % DOUBLE_EVALUATION
264 % CurState \= root, CurState \= concrete_constants(_),
265 % specfile:expand_const_and_vars_to_full_store(CurState,FullState), %print(eval_neg_inv(_ID)),nl,
266 % (b_interpreter:state_satisfies_negation_of_invariant(FullState)->true).
267 find_invariant_error(cspm,ID,_CurState,csp_error) :- !, % we know that only csp_can be possible
268 is_csp_error_state(ID).
269 find_invariant_error(MODE,ID,CurState,invariant_violation) :-
270 tcltk_interface:check_invariantKO(MODE,ID,CurState).
271 find_invariant_error(csp_and_b,ID,_CurState,csp_error) :- !, % xtl mode cannot apply
272 is_csp_error_state(ID).
273 find_invariant_error(MODE,ID,CurState,xtl_error) :-
274 is_xtl_error_state(ID,CurState,MODE).
275
276 :- use_module(error_manager,[add_warning/3]).
277 is_deadlocked(ID) :-
278 preferences:preference(forget_state_space,true),!, /* transitions not added */
279 (retract(state_space:transition(ID,_,_,_)) -> fail ; true).
280 is_deadlocked(ID) :- % ID must be ground upon call
281 %% visited_expression_id(ID),
282 deadlocked_state(ID),
283 \+ max_reached_or_timeout_for_node(ID),
284 (get_preference(store_only_one_incoming_transition,true)
285 -> add_warning(model_checker,'Deadlock may not exist and be caused by preference SAFETY_MODEL_CHECK being TRUE: ',ID)
286 ; true).
287 /* \+((transition(ID,_,NID),NID \= ID)). <-- to detect more liberal form of DEADLOCK */
288
289 is_csp_error_state(ID) :-
290 transition(ID,io(_,error,_),_). /* <--- THE CSP has raised the error channel */
291
292 :- use_module(xtl_interface,[xtl_invariant_violated/1]).
293 is_xtl_error_state(_ID,CurState,xtl) :-
294 xtl_invariant_violated(CurState). /* <--- XTL has found unsafe configuration */
295 % ; AM=promela -> promela_property(CurState,unsafe)
296 % ; AM=smv -> smv_property(CurState,unsafe) ).
297
298
299 :- use_module(specfile,[animation_mode/1, b_or_z_mode/1, csp_mode/1]).
300
301 node_satisfies_goal(NodeID) :-
302 animation_mode(MODE),
303 (MODE=xtl
304 -> visited_expression(NodeID,State),
305 node_satisfies_goal(NodeID,State,MODE)
306 ; node_satisfies_goal(NodeID,[],MODE) % we do not need the state
307 ).
308
309 :- use_module(xtl_interface,[xtl_goal_found/1]).
310 :- use_module(bmachine,[b_get_machine_goal/1]).
311 node_satisfies_goal(NodeID,_,MODE) :- b_or_z_mode(MODE), !,
312 b_get_machine_goal(Goal),
313 eclipse_interface:test_boolean_expression_in_node(NodeID,Goal,'model checking GOAL'). % TODO: avoid re-expanding state
314 node_satisfies_goal(NodeID,_,MODE) :- csp_mode(MODE), !,
315 transition(NodeID,io(_,goal,_),_).
316 node_satisfies_goal(_,State,xtl) :-
317 xtl_goal_found(State).
318 % TO DO: allow LTL atomic properties like e(Op1), ...
319 % TO DO: seperate machine GOAL from MC goal; provide intermediate PROB fact and set_mc_goal/1
320
321 % ---------------------------------------
322
323 :- use_module(tools, [ajoin/2]).
324 :- use_module(symsrc(symmetry_marker),[hash_model_checking_imprecise/2]).
325 :- use_module(specfile, [get_specific_max_operations_for_operation/2]).
326 :- use_module(bmachine,[b_machine_has_constants_or_properties/0]).
327 % Note: we do not need mcFindStateErrors flag
328 %model_checking_is_unsound(FindInvViolations,FindDeadlocks,FindGoal,FindAssViolations,Msg,Term)
329 model_checking_is_incomplete(FindInvViolations,FindDeadlocks,FindGoal,FindAssViolations,Msg,'') :-
330 proof_info_model_checking_incomplete(FindInvViolations,FindDeadlocks,FindGoal,FindAssViolations,Msg).
331 model_checking_is_incomplete(_FindInv,_FindDeadlocks,_FindGoal,_FindAss,Msg,Term) :-
332 (get_preference(symmetry_mode,hash),hash_model_checking_imprecise(ID,BasicType)
333 -> Msg = '*** Possibly not all states computed, symmetry hashing may be imprecise, e.g., for variable ',
334 translate:pretty_type(BasicType,S),
335 ajoin([ID,' : ',S],Term)).
336 model_checking_is_incomplete(1,_FindDeadlocks,_FindGoal,_FindAss,Msg,Term) :-
337 (time_out_for_invariant(ID)
338 -> Msg = '*** Timeout(s) occured during invariant computation, e.g., state with id = ', Term=ID).
339 model_checking_is_incomplete(_FindInv,_FindDeadlocks,_FindGoal,1,Msg,Term) :-
340 (time_out_for_assertions(ID)
341 -> Msg = '*** Timeout(s) occured during evaluation of ASSERTIONS, e.g., state with id = ', Term=ID).
342 model_checking_is_incomplete(_FindInv,_FindDeadlocks,_FindGoal,_FindAss,Msg,Term) :-
343 (max_reached_for_node(ID)
344 -> ((ID=root -> CCS=false ; is_concrete_constants_state_id(ID) -> CCS=true)
345 -> (CCS=false, b_or_z_mode(_), b_machine_has_constants_or_properties,
346 get_specific_max_operations_for_operation('SETUP_CONSTANTS',MI)
347 -> Def = 'MAX_OPERATIONS_SETUP_CONSTANTS'
348 ; (CCS=true ; \+ b_machine_has_constants_or_properties),
349 get_specific_max_operations_for_operation('INITIALISATION',MI)
350 -> Def = 'MAX_OPERATIONS_INITIALISATION'
351 ; get_preference(maxNrOfInitialisations,MI),
352 Def = 'MAX_INITIALISATIONS'
353 ),
354 ajoin(['*** Not all transitions were computed as ',Def,'=',MI,' was too small, e.g., for state with id = '],Msg)
355 ; get_preference(maxNrOfEnablingsPerOperation,MO),
356 ajoin(['*** Not all transitions were computed as MAX_OPERATIONS=',MO,' was too small, e.g., for state with id = '],Msg)
357 ),
358 Term=ID).
359 model_checking_is_incomplete(_FindInv,_FindDeadlocks,_FindGoal,_FindAss,Msg,Term) :-
360 (time_out_for_node(ID,Op,Reason) ->
361 functor(Reason,Func,_), % time_out or virtual_time_out
362 ajoin(['*** Not all transitions were computed due to a ', Func,', e.g., for ',Op, ' and state with id = '],Msg),
363 Term=ID).
364 model_checking_is_incomplete(_FindInv,_FindDeadlocks,_FindGoal,_FindAss,Msg,'') :-
365 get_preference(ignore_hash_collisions,true),
366 Msg = '*** Possibly not all states computed due to IGNORE_HASH_COLLISIONS preference'.
367
368 :- use_module(bmachine, [b_machine_has_proven_invariants/0, b_machine_has_unproven_assertions/0]).
369 proof_info_model_checking_incomplete(1,_FindDeadlocks,_FindGoal,0,Msg) :-
370 b_machine_has_proven_invariants,
371 preferences:get_preference(use_po,true),
372 b_machine_has_unproven_assertions,
373 Msg = '*** Using proof information (-p PROOF_INFO TRUE) is potentially incomplete when not checking theorems (-noass) !'.
374
375
376 % disable POR if not applicable + merge POR/PGE info into one atom for easier lookup in compute_transitions
377 initialise_optimisations(MODE,PartialOrderReduction,FindInvViolations,Optimisations) :-
378 MODE == b,
379 !,
380 ((PartialOrderReduction == ample_sets; PartialOrderReduction == ample_sets2) ->
381 get_preference(enable_graph,UseEnableGraph),
382 get_preference(enable_graph_depth,Depth),
383 PORPrefs = por(PartialOrderReduction,UseEnableGraph,Depth,off),
384 Optimisations = opt(PORPrefs,off),
385 (FindInvViolations == 1 -> assertz(ample_sets:check_cycle_proviso);true)
386 ;
387 Optimisations = opt(off,off)).
388 initialise_optimisations(_,_,_,opt(off,off)).
389
390
391 :- dynamic expired_static_analysis_time/1.
392 perform_static_analyses(MODE,FindInvViolations,opt(PORPrefs,_)) :-
393 MODE == b,
394 !,
395 retractall(expired_static_analysis_time(_)),
396 statistics(runtime,[T1,_]),
397 (perform_static_analyses_aux(PORPrefs,FindInvViolations) -> true
398 ; add_internal_error('POR static analysis failed:',perform_static_analyses_aux(PORPrefs,FindInvViolations))
399 ),
400 statistics(runtime,[T2,_]),
401 D is T2-T1,
402 assertz(expired_static_analysis_time(D)).
403 perform_static_analyses(_,_,_) :- retractall(expired_static_analysis_time(_)).
404
405 perform_static_analyses_aux(off,_FindInvViolations) :- !.
406 perform_static_analyses_aux(PORPrefs,FindInvViolations) :-
407 PORPrefs = por(POROption,_UseEnableGraph,_Depth,_),
408 (POROption==ample_sets;POROption==ample_sets2),!,
409 compute_dependendency_relation_of_all_events_in_the_model(FindInvViolations,PORPrefs,_EnableGraph).
410 perform_static_analyses_aux(_,_).