1 | | % (c) 2009-2024 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(eval_strings,[ |
6 | | add_last_expression_to_unit_tests/0, print_last_expression/0, indent_print_last_expression/0, |
7 | | unsat_core_last_expression/0, |
8 | | recheck_pp_of_last_expression/3, |
9 | | last_expression_type/1, last_expression/2, get_last_result_value/3, clear_last_expression/0, |
10 | | print_last_info/0, print_last_value/0, browse_repl_lets/0, |
11 | | toggle_eval_det/0, toggle_normalising/0, |
12 | | eval_string/2,eval_string/3,eval_string/4,eval_string_with_time_out/4, |
13 | | eval_codes/6, |
14 | | eval_expression_codes/7, |
15 | | eval_file/6, |
16 | | toggle_observe_evaluation/0, |
17 | | set_eval_dot_file/1, unset_eval_dot_file/0, |
18 | | turn_normalising_on/0, turn_normalising_off/0, |
19 | | get_error_positions/1]). |
20 | | |
21 | | :- use_module(library(lists)). |
22 | | :- use_module(library(codesio),[format_to_codes/3]). |
23 | | |
24 | | :- use_module(error_manager). |
25 | | :- use_module(tools). |
26 | | :- use_module(debug). |
27 | | :- use_module(external_functions,[observe_parameters/2]). |
28 | | :- use_module(kernel_objects,[max_cardinality/2]). |
29 | | %:- use_module(b_ast_cleanup,[get_sorted_ids/2,not_occurs_in_predicate/2]). % TO DO: move predicate calling this to another module |
30 | | :- use_module(preferences,[get_computed_preference/2, get_preference/2, |
31 | | temporary_set_preference/3, reset_temporary_preference/2]). |
32 | | |
33 | | :- use_module(typing_tools,[create_maximal_type_set/2]). |
34 | | |
35 | | :- use_module(module_information,[module_info/2]). |
36 | | :- module_info(group,repl). |
37 | | :- module_info(description,'Tools to evaluate B expressions and predicates passed as strings.'). |
38 | | |
39 | | :- use_module(bmachine,[b_get_machine_constants/1,b_get_machine_variables/1, |
40 | | b_parse_machine_expression_from_codes/6, |
41 | | b_parse_machine_predicate_from_codes_open/5, |
42 | | b_parse_machine_subsitutions_from_codes/6]). |
43 | | :- use_module(wdsrc(well_def_analyser),[analyse_wd_for_expr/4, annotate_wd/2]). |
44 | | :- use_module(smt_solvers_interface(solver_dispatcher),[smt_solver_version/2, smt_solver_header_version/2]). |
45 | | :- use_module(kernel_waitflags). |
46 | | :- use_module(b_enumerate,[b_tighter_enumerate_values_in_ctxt/3]). |
47 | | :- use_module(bsyntaxtree). |
48 | | :- use_module(eval_let_store,[stored_let_value/3, add_stored_let_value/3, |
49 | | retract_stored_let_value/3, reset_let_values/0, |
50 | | extend_state_with_stored_lets/2, get_stored_let_typing_scope/1]). |
51 | | |
52 | | |
53 | | :- set_prolog_flag(double_quotes, codes). |
54 | | |
55 | | % GENERAL EVAL for Expressions & Predicates |
56 | | |
57 | | eval_string(String,StringResult) :- eval_string(String,StringResult,_EnumWarning,_). |
58 | | eval_string(String,StringResult,EnumWarning) :- eval_string(String,StringResult,EnumWarning,_). |
59 | | eval_string(String,StringResult,EnumWarning,LocalState) :- % String is an atom |
60 | | atom_codes(String,Codes), |
61 | | eval_codes(Codes,exists,StringResult,EnumWarning,LocalState,_). |
62 | | |
63 | | eval_string_with_time_out(String,StringResult,EnumWarning,LocalState) :- |
64 | | atom_codes(String,Codes), |
65 | | eval_codes_with_time_out(Codes,exists,StringResult,EnumWarning,LocalState,_). |
66 | | |
67 | | % evaluate a single formula from a file |
68 | | % Solver is either default, or one of the solver names recognised in the REPL (sat, sat-z3, cdclt, prob, z3,...) |
69 | | eval_file(Solver,Filename,OuterQuantifier,StringResult,EnumWarning,TypeInfo) :- |
70 | | format('Solving ~w with ~w~n',[Filename,Solver]), |
71 | | safe_read_string_from_file(Filename,utf8,Codes), |
72 | | (Solver=default -> FullCodes=Codes |
73 | | ; translate_solver_to_prefix(Solver,Prefix) -> append(Prefix,Codes,FullCodes) |
74 | | ; add_error(eval_file,'Unknown solver name: ',Solver), |
75 | | FullCodes=Codes |
76 | | ), |
77 | | eval_codes_with_time_out(FullCodes,OuterQuantifier,StringResult,EnumWarning,_,TypeInfo), |
78 | | debug_println(19,eval_file(Filename,StringResult,EnumWarning)). |
79 | | |
80 | | %:- use_module(library(timeout)). |
81 | | :- use_module(tools_meta,[safe_time_out/3]). |
82 | | eval_codes_with_time_out(Codes,OuterQuantifier,StringResult,EnumWarning,LocalState,TypeInfo) :- |
83 | | %format("Eval: ~s~n",[Codes]), |
84 | | get_computed_preference(debug_time_out,DTO), |
85 | | %print(debug_time_out(DTO)),nl, |
86 | | safe_time_out(eval_codes(Codes,OuterQuantifier,StringResult,EnumWarning,LocalState,TypeInfo),DTO,TimeOutRes), |
87 | | (TimeOutRes=time_out -> |
88 | | StringResult = '**** TIME-OUT ****', print(StringResult), print(' ('),print(DTO), print('ms)'),nl, |
89 | | EnumWarning = time_out |
90 | | ; true). |
91 | | |
92 | | :- use_module(tools_meta,[call_residue/2]). |
93 | | :- volatile current_codes/1. |
94 | | :- dynamic current_codes/1. |
95 | | set_current_codes(C) :- retractall(current_codes(_)), assertz(current_codes(C)). |
96 | | %eval_codes(C,_,Res,E,L) :- print(eval_codes(C)),nl,fail. |
97 | | eval_codes(E,Q,Res,EnumWarning,LS,TypeInfo) :- |
98 | | call_residue(eval_codes2(E,Q,Res,EnumWarning,LS,TypeInfo),Residue), |
99 | | (Residue = [] -> true ; |
100 | | eval_det -> print('Call residue in eval_codes: '),print_term_summary(Residue),nl |
101 | | ; add_internal_error('Call residue in eval_codes: ',Residue) %,tools_printing:print_goal(Residue) |
102 | | ). |
103 | | eval_codes2(E,Q,Res,EnumWarning,LS,TypeInfo) :- |
104 | | set_error_context(eval_codes), |
105 | | reset_repl_lets, % remove invalid lets if required |
106 | | catch( |
107 | | eval_codes_aux0(E,Q,Res,EnumWarning,LS,TypeInfo), |
108 | | enumeration_warning(Cause,ID,_,_,_), |
109 | | (get_time_out_message(Cause,ID,CauseStr), |
110 | | format_with_colour_nl(user_output,[red,bold],'VIRTUAL TIME-OUT forced by ~w',[CauseStr]), |
111 | | EnumWarning = true, |
112 | | Res = 'TIME-OUT' |
113 | | )), |
114 | | clear_error_context. |
115 | | |
116 | | get_time_out_message(kodkod_timeout,_ProblemId,Msg) :- !, Msg = 'KODKOD'. |
117 | | get_time_out_message(kodkod_error,_ProblemId,Msg) :- !, Msg = 'KODKOD ERROR'. |
118 | | get_time_out_message(translating_for_kodkod,_Ids,Msg) :- !, Msg = 'UNABLE TO TRANSLATE TO KODKOD'. |
119 | | get_time_out_message(_,_,'ENUMERATION WARNING'). |
120 | | |
121 | | :- use_module(library(between),[between/3]). |
122 | | |
123 | | eval_codes_aux0("$$",_,Res,false,[],print_last_expression) :- !, Res='', |
124 | | print_last_expression. |
125 | | eval_codes_aux0("$",_,Res,false,[],print_last_info) :- !, Res='', |
126 | | print_last_info. |
127 | | eval_codes_aux0(":col",_,Res,false,[],print_last_expression) :- !, Res='', |
128 | | toggle_colouring. |
129 | | eval_codes_aux0(":recheck",_,Res,EnumWarning,[],recheck_pp_of_last_expression) :- !, |
130 | | recheck_pp_of_last_expression(ascii,Res,EnumWarning). |
131 | | eval_codes_aux0(Codes,_,Res,false,[],set_eval_repeat) :- append("!r",Rest,Codes), |
132 | | number_codes(Nr,Rest), !, Res='', |
133 | | set_eval_repeat(Nr). |
134 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
135 | | append(":repeat ",RestC,Codes),!, |
136 | | (eval_repeat(Nr) -> true ; Nr=100), N1 is Nr-1, |
137 | | (between(1,N1,Try), |
138 | | format('>>> (~w)~n',[Try]), |
139 | | (eval_codes_aux0(RestC,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) -> true), |
140 | | reset_errors, |
141 | | fail |
142 | | ; |
143 | | format('>>> (~w)~n',[Nr]), |
144 | | eval_codes_aux0(RestC,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) |
145 | | ). |
146 | | eval_codes_aux0(Codes,_OuterQuantifier,Res,false,LocalState,list) :- |
147 | | ( append(":list ",Rest,Codes), |
148 | | scan_identifier(Rest,IDCodes,Rest2), atom_codes(ID,IDCodes) |
149 | | ; |
150 | | Codes = ":list", ID=help, Rest2=[]), |
151 | | !, |
152 | | (just_whitespace(Rest2) -> true ; add_error(eval_strings,'Ignoring extra argument: ',Rest2)), |
153 | | list_information(ID,Res,LocalState). |
154 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
155 | | match_command(":print", Codes,PredCodes), |
156 | | TypeInfo=predicate(_), |
157 | | !, EnumWarning=false,LocalState=[], |
158 | | repl_parse_predicate_allow_ws(PredCodes,OuterQuantifier,Typed,TypeInfo), |
159 | | nested_print_repl_expression(Typed), |
160 | | Res=''. |
161 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
162 | | match_command(":sym", Codes,PredCodes), |
163 | | TypeInfo=predicate(_), |
164 | | !, EnumWarning=false,LocalState=[], |
165 | | repl_parse_predicate_allow_ws(PredCodes,OuterQuantifier,ExTyped,TypeInfo), |
166 | | (is_existential_quantifier(ExTyped,_,Typed) -> true ; Typed=ExTyped), |
167 | | format('Computing symmetry breaking predicate for: ',[]), |
168 | | translate:print_bexpr(Typed),nl, |
169 | | smt_symmetry_breaking:get_top_level_symmetry_breaking_predicates_decomposed(Typed,TS), |
170 | | format('Symmetry breaking: ',[]), translate:print_bexpr(TS),nl, |
171 | | Res=''. |
172 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
173 | | match_command(":check-ast",Codes,PredCodes), |
174 | | TypeInfo=predicate(_), |
175 | | !, EnumWarning=false,LocalState=[], |
176 | | format('Checking generated AST (Abstract Syntax Tree)~n',[]), |
177 | | repl_parse_predicate_allow_ws(PredCodes,OuterQuantifier,Typed,TypeInfo), |
178 | | (bsyntaxtree:check_ast(Typed) -> Res='TRUE' ; Res='FALSE'). |
179 | | eval_codes_aux0(Codes,_OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
180 | | match_command(":components", Codes,PredCodes), |
181 | | TypeInfo=predicate(_), |
182 | | !, EnumWarning=false,LocalState=[], |
183 | | repl_parse_predicate_allow_ws(PredCodes,no_quantifier,Typed,TypeInfo), |
184 | | predicate_components(Typed,Components), |
185 | | maplist(print_component,Components), |
186 | | Res=''. |
187 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
188 | | match_command(":compile",Codes,PredCodes), |
189 | | TypeInfo=predicate(_), |
190 | | !, EnumWarning=false,LocalState=[], |
191 | | repl_parse_predicate_allow_ws(PredCodes,OuterQuantifier,Typed,TypeInfo), |
192 | | write('Compiling: '), translate:print_bexpr(Typed),nl, |
193 | | get_cur_state_for_repl(Typed,State), |
194 | | b_compiler:b_optimize(Typed,[],[],State,NewTyped,no_wf_available), |
195 | | nested_print_repl_expression(NewTyped), |
196 | | Res=''. |
197 | | eval_codes_aux0(":wd",_,Res,EnumWarning,LocalState,analyse_wd_for_machine) :- !, |
198 | | EnumWarning=false,LocalState=[], |
199 | | well_def_analyser:analyse_wd_for_machine(_,_,Res). |
200 | | eval_codes_aux0(":pinv",_,Res,EnumWarning,LocalState,analyse_wd_for_machine) :- !, |
201 | | EnumWarning=false,LocalState=[], |
202 | | start_timer(T1,W1), |
203 | | well_def_analyser:analyse_invariants_for_machine(UnchangedNr,ProvenNr,UnProvenNr,TotPOsNr,[]), |
204 | | stop_timer('% Time to run wd-prover on all invariant POs: ',T1,W1), |
205 | | (TotPOsNr>0 -> Perc is (UnchangedNr+ProvenNr)*100/ TotPOsNr ; Perc = 100.0), |
206 | | format('Proof summary for ~w POs (~2f % discharged): ~w unchanged, ~w proven, ~w unproven~n', |
207 | | [TotPOsNr,Perc,UnchangedNr,ProvenNr,UnProvenNr]), Res=ProvenNr. |
208 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
209 | | append(":wd ",PredCodes,Codes), |
210 | | !, |
211 | | set_current_codes(PredCodes), |
212 | | (TypeInfo=predicate(_),repl_parse_predicate_allow_ws(PredCodes,OuterQuantifier,Typed,TypeInfo) |
213 | | -> EnumWarning=false,LocalState=[], |
214 | | analyse_wd_for_expr(Typed,_ResStr,Discharged,message), Res=Discharged |
215 | | ; eval_codes_error(Res,EnumWarning,LocalState,TypeInfo) |
216 | | ). |
217 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
218 | | match_command(":wde",Codes,PredCodes), % perform WD analysis and solve transformed predicate |
219 | | TypeInfo=predicate(_), |
220 | | !, |
221 | | repl_parse_predicate_allow_ws(PredCodes,OuterQuantifier,Typed,TypeInfo), |
222 | | annotate_wd(Typed,NewTyped), |
223 | | eval_predicate_in_cur_state(NewTyped,Res,EnumWarning,LocalState). |
224 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
225 | | append(":check ",Rest,Codes), |
226 | | TypeInfo=predicate(_), |
227 | | !, |
228 | | debug_println(20,check_recognised), |
229 | | (eval_codes_aux(Rest,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) |
230 | | -> (Res== 'TRUE' -> true ; |
231 | | atom_codes(S,Rest), add_error(check,':check predicate not TRUE: ',S) |
232 | | ) |
233 | | ; atom_codes(S,Rest), add_error(check,':check illegal predicate: ',S) |
234 | | ). |
235 | | eval_codes_aux0(Codes,_OuterQuantifier,RRes,EnumWarning,LocalState,TypeInfo) :- |
236 | | append(":exec ",Rest,Codes), |
237 | | TypeInfo=subst, |
238 | | !, |
239 | | debug_println(4,'parsing substitution'), |
240 | | repl_parse_substitution(Rest,Statement), |
241 | | pp_eval_expr(Statement), |
242 | | enter_new_error_scope(ScopeID,eval_codes_aux0),clear_all_errors_in_error_scope(ScopeID), |
243 | | (tcltk_interface:tcltk_add_user_executed_statement(Statement,Updates,NewID) |
244 | | -> format('Successfully executed statement leading to state: ~w~n',[NewID]), |
245 | | Res = 'TRUE',LocalState=Updates |
246 | | ; translate:translate_substitution(Statement,Str), |
247 | | format_with_colour_nl(user_output,[red],'Could not execute statement: ~w',[Str]), |
248 | | Res = 'FALSE',LocalState=[] |
249 | | ), |
250 | | EnumWarning=false, |
251 | | print('Execution result: '),display_and_set_result(ScopeID,Res,RRes,EnumWarning), |
252 | | (LocalState=[] -> true |
253 | | ; display_solution('Updates:~n',unknown,LocalState)). |
254 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- % let ID = EXPR construct |
255 | | (append("let ",Rest,Codes),DotForm=false ; append(":let ",Rest,Codes), DotForm=true), |
256 | ? | scan_identifier(Rest,IDCodes,Rest2), |
257 | | atom_codes(ID,IDCodes), |
258 | | (scan_to_equal(Rest2,Rest3) -> true |
259 | | ; DotForm=false -> debug_println(19,'Missing = sign for let-construction'), |
260 | | fail % let mod 2 = 0 is a valid predicate |
261 | | ; debug_println(19,'Inserting missing = for :let'), Rest3=Rest2 |
262 | | ), |
263 | | !, |
264 | | debug_println(20,let_recognised(ID)), |
265 | | eval_codes_aux(Rest3,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo), |
266 | | (store_let_id_last_value(ID) -> true ; |
267 | | format_with_colour_nl(user_error,[red],'### Could not store let: ~w',[ID])). |
268 | | eval_codes_aux0(Codes,_,Res,EnumWarning,LocalState,TypeInfo) :- % :s ID : store ID extracted from last predicate |
269 | | (append(":s ",Rest,Codes) ; append(":store ",Rest,Codes)), |
270 | | scan_identifier(Rest,IDCodes,Rest2), |
271 | | atom_codes(ID,IDCodes), |
272 | | Rest2=[], % TO DO: allow whitespace |
273 | | !, |
274 | | (get_last_predicate_value_for_id(ID,T,Val) |
275 | | -> store_let_id_last_value(ID), translate_bvalue_with_limit_and_col(Val,50,VS), |
276 | | format('Stored ~w = ~w~n',[ID,VS]), Res=Val, TypeInfo = T |
277 | | ; format_with_colour_nl(user_error,[red],'### Could not find value for ~w in last predicate',[ID]), |
278 | | Res=error, TypeInfo=error), |
279 | | EnumWarning=false, LocalState=[]. |
280 | | eval_codes_aux0(Codes,_,Res,EnumWarning,LocalState,TypeInfo) :- % :u ID : remove let for ID |
281 | | (append(":u ",Rest,Codes) ; append(":unlet ",Rest,Codes)), |
282 | | scan_identifier(Rest,IDCodes,Rest2), |
283 | | atom_codes(ID,IDCodes), |
284 | | Rest2=[], % TO DO: allow whitespace |
285 | | !, |
286 | | (retract_stored_let_value(ID,_,_) -> |
287 | | format('Undefined let ~w~n',[ID]), Res=ID, TypeInfo = unlet, |
288 | | reset_parse_cache % TO DO: maybe remove just all cached expressions using ID |
289 | | ; format_with_colour_nl(user_error,[red],'### Could not find let for ~w. Use :b to browse your lets.',[ID]), Res=error, TypeInfo=error), |
290 | | EnumWarning=false, LocalState=[]. |
291 | | eval_codes_aux0(":b",_,Res,EnumWarning,LocalState,browsing) :- |
292 | | !,EnumWarning=false, LocalState=[], |
293 | | get_repl_lets_info(Res), print(repl_lets(Res)),nl. |
294 | | eval_codes_aux0(Codes,_,Res,EnumWarning,LocalState,typing) :- |
295 | | (append(":t ",Expression,Codes) ; append(":type ",Expression,Codes)), |
296 | | % :t Expression Haskell like command |
297 | | !, EnumWarning=false, LocalState=[], |
298 | | repl_typing_scope(TypingScope), |
299 | | (b_parse_machine_expression_from_codes(Expression,TypingScope,_Typed,Type,true,Error) |
300 | | -> (Error=none |
301 | | -> %translate:pretty_type(Type,PrettyType), % will print seq(.) |
302 | | create_maximal_type_set(Type,MaxTS), translate_bexpression(MaxTS,PrettyType), |
303 | | (max_cardinality(Type,Card) -> true ; Card='??'), |
304 | | ajoin([PrettyType,' /* card=',Card,' */'],Res), |
305 | | print(Res),nl |
306 | | ; (Error=type_error -> get_type_error(Res) ; Res = 'SYNTAX ERROR'), |
307 | | print_red('Not a valid expression'),nl) |
308 | | ; print_red('Parsing failed'),nl, |
309 | | Res = 'SYNTAX ERROR'). |
310 | | % TO DO: add bind(VAR,EXPR_Val) for next eval |
311 | | eval_codes_aux0(Codes,_,Res,EnumWarning,LocalState,TypeInfo) :- |
312 | | append(":find-value ",Codes1,Codes), |
313 | | find_value_options(Options,Codes1,ExpressionCodes), |
314 | | EnumWarning=false, LocalState=[], |
315 | | repl_parse_expression(ExpressionCodes,TExpr,TypeInfo,Error), |
316 | | Error=none, |
317 | | eval_expression_direct(TExpr,GoalValue), |
318 | | get_texpr_type(TExpr,Type), |
319 | | (Options = [Opt1|_], GoalValue \= string(_) |
320 | | -> add_warning(find_value,':find-value option only useful when using string as target: ',Opt1) |
321 | | ; true), |
322 | | findall(list([ID,Kind,MatchMsg]), |
323 | | (tcltk_interface:find_value_in_cur_state(GoalValue,Type,Options,match(Kind,ID,Path)), |
324 | | format_to_codes('~w~n',[Path],MatchMsgC), |
325 | | format('* match inside ~w ~w @ path: ~w~n',[Kind,ID,Path]), |
326 | | atom_codes(MatchMsg,MatchMsgC)),Res). |
327 | | |
328 | | eval_codes_aux0(Codes,_OuterQuantifier,OuterRes,false,LocalState,TypeInfo) :- TypeInfo=predicate(_), |
329 | ? | available_krt_prover(_,Provers,CommandStr), |
330 | | match_command(CommandStr,Codes,PredCodes), % commands like :pp, :ml, :krt |
331 | | !, |
332 | | % we ignore OuterQuantifier for proof commands and use forall: |
333 | | temporary_set_preference(use_common_subexpression_elimination,false,CHG), |
334 | | call_cleanup(repl_parse_predicate_allow_ws(PredCodes,forall,ExTyped,TypeInfo), |
335 | | reset_temporary_preference(use_common_subexpression_elimination,CHG)), |
336 | | LocalState=[], |
337 | | prove_sequent_with_krt_provers(Provers,ExTyped,Res), |
338 | | format('Universally quantified predicate is ',[]), |
339 | | (Res=proved |
340 | | -> print_green('PROVED'), |
341 | | OuterRes='TRUE' % for -evalt |
342 | | ; print_red(Res), |
343 | | OuterRes = 'UNKNOWN' % for -evalu |
344 | | ), |
345 | | format(' with ~w~n',[Provers]). |
346 | | eval_codes_aux0(Codes,_OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- TypeInfo=predicate(_), |
347 | | append(":forall ",PredCodes,Codes), % like krt, ml, pp command, but using ProB |
348 | | !, |
349 | | eval_codes_aux(PredCodes,forall,Res,EnumWarning,LocalState,TypeInfo). |
350 | | eval_codes_aux0(Codes,OuterQuantifier,Res,false,LocalState,TypeInfo) :- TypeInfo=predicate(_), |
351 | ? | available_smt_solver(Solver,CommandStr), % :z3, :cvc4, ... |
352 | | append(CommandStr,PredCodes,Codes), |
353 | | !, |
354 | | solve_using_smt_solver(Solver,PredCodes,no_prolog,OuterQuantifier,Res,LocalState,TypeInfo). |
355 | | eval_codes_aux0(":z3-version",_,Res,false,LS,TypeInfo) :- LS=[], TypeInfo=string, |
356 | | smt_solver_version(z3,Version), |
357 | | smt_solver_header_version(z3,HVersion), |
358 | | !, |
359 | | format('Z3 version is ~w (ProB was compiled against ~w)~n',[Version,HVersion]), |
360 | | Res = Version. |
361 | | eval_codes_aux0(Codes,OuterQuantifier,Res,false,LocalState,TypeInfo) :- TypeInfo=predicate(_), |
362 | ? | available_smt_solver_for_file(Solver,FileCommandStr), % :z3-file, ... |
363 | | append(FileCommandStr,FileCodes,Codes), |
364 | | !, |
365 | | solve_using_smt_solver_from_file(Solver,FileCodes,OuterQuantifier,Res,LocalState,TypeInfo). |
366 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- %TypeInfo=predicate(_), |
367 | | append(":kodkod ",PredCodes,Codes), !, |
368 | | temporary_set_preference(use_solver_on_load,kodkod,CHG), |
369 | | call_cleanup(eval_codes_aux(PredCodes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo), |
370 | | reset_temporary_preference(use_solver_on_load,CHG)). |
371 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
372 | | append(":chr ",PredCodes,Codes), !, |
373 | | temporary_set_preference(use_chr_solver,true,CHG), |
374 | | call_cleanup(eval_codes_aux(PredCodes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo), |
375 | | reset_temporary_preference(use_chr_solver,CHG)). |
376 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
377 | | append(":cse ",PredCodes,Codes), !, |
378 | | temporary_set_preference(use_common_subexpression_elimination,true,CHG), |
379 | | call_cleanup(eval_codes_aux(PredCodes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo), |
380 | | reset_temporary_preference(use_common_subexpression_elimination,CHG)). |
381 | | eval_codes_aux0(Codes,_OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
382 | | get_minmax_command(Codes,OptMode,LambdaExprC), % :min or :max |
383 | | repl_parse_expression(LambdaExprC,LambdaExpr,TypeInfo,Error), |
384 | | Error=none, |
385 | | closures:is_lambda_comprehension_set(LambdaExpr,Parameters,TypedPred,OptExpr), |
386 | | format(' ~w lambda expression of type ~w~n',[OptMode,TypeInfo]), |
387 | | !, |
388 | | get_cur_state_for_repl(LambdaExpr,EState), |
389 | | optimizing_solve_predicate(OptMode,EState, Parameters,TypedPred,OptExpr,OptVal,LocalState), |
390 | | translate:translate_bvalue(OptVal,OS), |
391 | | format('OPTIMAL VALUE = ~w~nFOR SOLUTION:~n',[OS]), |
392 | | display_solution('',Parameters,LocalState), |
393 | | Res = OS,EnumWarning=false. |
394 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
395 | | get_minmax_command(Codes,OptMode,PredCodes), |
396 | | !, |
397 | | set_eval_mode(optimizing(OptMode)), |
398 | | call_cleanup(eval_codes_aux(PredCodes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo), |
399 | | unset_eval_mode). |
400 | | |
401 | | eval_codes_aux0(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
402 | | eval_codes_aux(Codes,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo). |
403 | | |
404 | | eval_codes_aux(Expression,_,Res,EnumWarning,LocalState,TypeInfo) :- TypeInfo=expression(_), |
405 | | repl_parse_expression(Expression,Typed,Type,Error), |
406 | | (Error=none ; Error=type_error), |
407 | | !, |
408 | | eval_expression_codes2(Typed,Type,Error,Res,EnumWarning,LocalState,TypeInfo,[]). |
409 | | eval_codes_aux(Expression,OuterQuantifier,Res,EnumWarning,LocalState,TypeInfo) :- |
410 | | TypeInfo=predicate(_), |
411 | | repl_parse_predicate_for_solving(Expression,OuterQuantifier,Typed,TypeInfo), |
412 | | !, |
413 | | eval_predicate_in_cur_state(Typed,Res,EnumWarning,LocalState). |
414 | | eval_codes_aux(_E,_,Res,EnumWarning,LocalState,TypeInfo) :- eval_codes_error(Res,EnumWarning,LocalState,TypeInfo). |
415 | | |
416 | | % an error occured: provide user feedback |
417 | | eval_codes_error(Res,false,[],TypeInfo) :- |
418 | | %findall(S,check_error_occured(S,_),L), print(errs(L)),nl, |
419 | ? | (check_error_occured(type_expression_error,_) -> Res = 'TYPE ERROR', TI = error |
420 | | ; Res = 'SYNTAX ERROR', TI = syntax_error |
421 | | ), |
422 | | show_error_pos, |
423 | | ((nonvar(TypeInfo),TypeInfo=predicate(_)) -> print('Not a valid predicate'),nl |
424 | | ; (nonvar(TypeInfo),TypeInfo=expression(_)) -> print('Not a valid expression'),nl |
425 | | ; print('Not a valid expression or predicate'),nl |
426 | | ), |
427 | | TypeInfo=TI. |
428 | | |
429 | | % ------------------ |
430 | | |
431 | | % a separate predicate for evaluating expressions |
432 | | eval_expression_codes(Expression,Res,EnumWarning,LocalState,Typed,TypeInfo,Options) :- |
433 | | repl_parse_expression(Expression,Typed,Type,Error), |
434 | | (Error=none ; Error=type_error), |
435 | | eval_expression_codes2(Typed,Type,Error,Res,EnumWarning,LocalState,TypeInfo,Options). |
436 | | eval_expression_codes2(Typed,Type,Error,Res,EnumWarning,LocalState,TypeInfo,Options) :- |
437 | | (Error=type_error |
438 | | -> show_error_pos,print('TYPE ERROR'),nl, |
439 | | get_type_error(Res), EnumWarning=false, LocalState=[], TypeInfo=error |
440 | | ; pp_eval_expr(Typed), |
441 | | (Type=pred |
442 | | -> eval_predicate_in_cur_state(Typed,Res,EnumWarning,LocalState) % happens for DEFINITIONS ?? |
443 | | % TypeInfo unification will fail ??? TO DO : investigate !! |
444 | | ; eval_expression(Typed,Res,Options), |
445 | | EnumWarning=false,LocalState=[]), |
446 | | extract_type_information(Typed,TypeInfo) |
447 | | ). |
448 | | |
449 | | % optionally cache parsing results, avoid overhead of Java B parser call and socket communication |
450 | | % especially useful for latex_processor with while loops |
451 | | :- dynamic parse_expr_cache/5, parse_pred_cache/5. |
452 | | :- use_module(library(terms),[term_hash/2]). |
453 | | %:- use_module(covsrc(hit_profiler),[add_profile_hit/1]). |
454 | | % TO DO: try number_codes, TRUE, FALSE, simple identifier to avoid calling Java |
455 | | repl_parse_expression(Expression,Typed,Type,Error) :- |
456 | | get_preference(repl_cache_parsing,true), |
457 | | term_hash(Expression,H),!, |
458 | | (parse_expr_cache(H,Expression,CTyped,CType,CError) -> true |
459 | | ; parse_pred_cache(H,Expression,_,_,_) |
460 | | -> !, fail % we have already parsed it as a predicate; fail so that we call repl_parse_predicate later |
461 | | ; repl_parse_expression_direct(Expression,CTyped,CType,CError), %format('Cached: ~s~n',[Expression]), |
462 | | assertz(parse_expr_cache(H,Expression,CTyped,CType,CError)) |
463 | | ), |
464 | | Typed=CTyped, Type=CType, Error=CError. |
465 | | %hit_profiler:add_profile_hit(parse_expr_cache). |
466 | | repl_parse_expression(Expression,Typed,Type,Error) :- |
467 | | repl_parse_expression_direct(Expression,Typed,Type,Error). |
468 | | |
469 | | repl_parse_expression_direct(Expression,Typed,Type,Error) :- |
470 | | %hit_profiler:add_profile_hit(parse_expr), |
471 | | set_current_codes(Expression), |
472 | | debug_format(20,"parsing_as_expression: '~s'~n",[Expression]), |
473 | | %open('repl_parsing.txt',append,S),format(S,'~s~n',[Expression]),close(S), |
474 | | repl_typing_scope(TypingScope), |
475 | | b_parse_machine_expression_from_codes(Expression,TypingScope,Typed,Type,type_errors_only,Error), |
476 | | debug_println(20,parse_result(Error,Type)). %translate:print_bexpr(Typed),nl, |
477 | | |
478 | | |
479 | | :- use_module(bmachine,[b_get_properties_from_machine/1,b_get_invariant_from_machine/1]). |
480 | | repl_parse_predicate_allow_ws(WS,_OuterQuantifier,Typed,TypeInfo) :- |
481 | | is_whitspace(WS), !, % no argument provided; use last expr |
482 | | (last_expression(pred,Typed,_) |
483 | | -> extract_type_information(Typed,TypeInfo) |
484 | | ; last_expression(_,_,_) -> add_error(repl_parse_predicate,'Last REPL expression is not a predicate'),fail |
485 | | ; add_error(repl_parse_predicate,'Evaluate a predicate first or provide it as an argument'),fail |
486 | | ). |
487 | | repl_parse_predicate_allow_ws(PredCodes,OuterQuantifier,Typed,TypeInfo) :- |
488 | | repl_parse_predicate(PredCodes,OuterQuantifier,Typed,TypeInfo). |
489 | | |
490 | | repl_parse_predicate_for_solving(PredCodes,OuterQuantifier,Typed,TypeInfo) :- |
491 | | temporary_set_preference(allow_improving_wd_mode,true,Change), |
492 | | % allow some left propagations of failure/truth in ast_cleanup which would be done by the solver anyway: |
493 | | call_cleanup(repl_parse_predicate(PredCodes,OuterQuantifier,Typed,TypeInfo), |
494 | | reset_temporary_preference(allow_improving_wd_mode,Change)). |
495 | | |
496 | | repl_parse_predicate("@INVARIANT",_OuterQuantifier,Typed,TypeInfo) :- |
497 | | b_get_invariant_from_machine(Invariant),!, |
498 | | Typed=Invariant,extract_type_information(Typed,TypeInfo). |
499 | | repl_parse_predicate("@PROPERTIES",_OuterQuantifier,Typed,TypeInfo) :- |
500 | | b_get_properties_from_machine(Properties),!, |
501 | | Typed=Properties,extract_type_information(Typed,TypeInfo). |
502 | | %TODO: @ASSERTIONS for b_get_assertions_from_main_machine |
503 | | repl_parse_predicate("@FUZZ",_OuterQuantifier,Typed,TypeInfo) :-!, |
504 | | use_module(extension('prolog_fuzzer/fuzzing')), |
505 | | (generate(prob_ast_pred([]), Pred) -> true |
506 | | ; generate(prob_ast_pred([]), Pred) -> true % generation sometimes fails; try again |
507 | | ; Pred = b(truth,pred,[]) |
508 | | ), |
509 | | clean_up_pred(Pred,[],Typed), |
510 | | write('@FUZZ = '),translate:print_bexpr_with_limit(Typed,20000),nl, |
511 | | (debug_mode(on) |
512 | | -> tools_printing:nested_write_term_to_codes(Typed,Cs), format('% Prolog term:~n~s~n',[Cs]) ; true), |
513 | | extract_type_information(Typed,TypeInfo). |
514 | | repl_parse_predicate([First|PredCodes],OuterQuantifier,Typed,TypeInfo) :- |
515 | | (First = 35 ; First = 64), % # or @ or #file or @file |
516 | | append("file",[Code1|FileCodes],PredCodes), |
517 | | (Code1=32 -> true ; Code1=61), % space or equal = sign |
518 | | (FileCodes = [46,Code2|_] % 46 is the dot. |
519 | | -> Code2 \= 32, Code2 \= 40 % we do not have existential quantifer #file .(PRED) |
520 | | % TODO: check for other whitespace than 32 (40 is open parenthesis) |
521 | | ; true), |
522 | | !, |
523 | | atom_codes(Filename,FileCodes), |
524 | | format('Reading predicate from file: ~w~n',[Filename]), |
525 | | statistics(walltime,[T1,_]), |
526 | | safe_read_string_from_file(Filename,utf8,Codes), |
527 | | %format('Read:~n~s~n',[Codes]),nl, |
528 | | statistics(walltime,[T2,_]), Delta1 is T2-T1, |
529 | | (debug_mode(off) -> true ; length(Codes,NrC), format('Read ~w characters in ~w ms~n',[NrC,Delta1])), |
530 | | (repl_get_prolog_predicate(Codes,clean_up_pred,Typed,TypeInfo) |
531 | | -> true |
532 | | ; repl_parse_predicate_direct(Codes,OuterQuantifier,Typed,TypeInfo) |
533 | | ), |
534 | | statistics(walltime,[T3,_]), Delta2 is T3-T2, |
535 | | (debug_mode(off) -> true ; format('Parsed and typechecked predicate in ~w ms~n',[Delta2])). |
536 | | repl_parse_predicate(PredCodes,OuterQuantifier,Typed,TypeInfo) :- |
537 | | repl_parse_predicate2(PredCodes,OuterQuantifier,Typed,TypeInfo). |
538 | | |
539 | | repl_parse_predicate2(PredCodes,OuterQuantifier,Typed,TypeInfo) :- |
540 | | get_preference(repl_cache_parsing,true), |
541 | | term_hash(PredCodes,H),!, |
542 | | (parse_pred_cache(H,PredCodes,OuterQuantifier,CTyped,CTypeInfo) -> true |
543 | | ; repl_parse_predicate_direct(PredCodes,OuterQuantifier,CTyped,CTypeInfo), |
544 | | assertz(parse_pred_cache(H,PredCodes,OuterQuantifier,CTyped,CTypeInfo)) |
545 | | ), |
546 | | Typed=CTyped, TypeInfo=CTypeInfo. |
547 | | repl_parse_predicate2(PredCodes,OuterQuantifier,Typed,TypeInfo) :- |
548 | | repl_parse_predicate_direct(PredCodes,OuterQuantifier,Typed,TypeInfo). |
549 | | |
550 | | repl_parse_predicate_direct(PredCodes,OuterQuantifier,Typed,TypeInfo) :- |
551 | | repl_typing_scope(TypingScope), |
552 | | b_parse_machine_predicate_from_codes_open(OuterQuantifier,PredCodes, |
553 | | % will also mark outer variables so that they are not removed |
554 | | [],TypingScope,Typed),!, |
555 | | pp_eval_expr(Typed), |
556 | | extract_type_information(Typed,TypeInfo). |
557 | | |
558 | | is_whitspace(Codes) :- is_whitspace(Codes,[]). |
559 | | is_whitspace --> " ",is_whitspace. |
560 | | is_whitspace --> "". |
561 | | |
562 | | match_command(Command,Codes,Arguments) :- |
563 | | append(Command,Args,Codes), % command matched |
564 | | (Args = [32|Rest] -> Arguments = Rest |
565 | | ; Args=[] -> Arguments = []). % no whitespace after; also allow as command without args |
566 | | |
567 | | repl_parse_substitution(Codes,Typed) :- |
568 | ? | repl_typing_scope(TypingScope), select(variables,TypingScope,SubstScope), % remove variables; otherwise we get clash warnings |
569 | | % we could also always allow calling operations in expressions? |
570 | | b_parse_machine_subsitutions_from_codes(Codes,[operation_bodies|SubstScope], |
571 | | Typed,_Type,true,Error), |
572 | | (Error=none -> true ; add_error(eval_strings,'Error occured while parsing substitution: ',Error),fail). |
573 | | |
574 | | |
575 | | % repeat a pretty-printed version of the expression/predicate that is evaluated |
576 | | pp_eval_expr(Typed) :- |
577 | | % nl,nl,print('SOLVING:'),nl,nested_print_bexpr(Typed),nl,nl, |
578 | | % get_texpr_type(Typed,Type), |
579 | | (preferences:get_preference(repl_unicode,true) -> |
580 | | translate_subst_or_bexpr_in_mode(unicode,Typed,UnicodeString), |
581 | | format(' ~w ~w~n',['\x21DD\',UnicodeString]) |
582 | | ; true). |
583 | | |
584 | | extract_type_information(b(exists(Parameters,_Typed),pred,_),predicate(exists(Parameters))) :- !. |
585 | | extract_type_information(b(forall(Parameters,_LHS,_RHS),pred,_),predicate(forall(Parameters))) :- !. |
586 | | extract_type_information(b(_,pred,_),predicate(no_outer_quantifier)) :- !. |
587 | | extract_type_information(b(_,T,_),expression(T)). |
588 | | |
589 | | %:- use_module(library(timeout)). |
590 | | %:- use_module(library(file_systems)). |
591 | | |
592 | | % |
593 | | % |
594 | | % eval_rule_file removed; now use: probcli -eval_rule_file /Users/leuschel/svn_root/NewProBPrivate/examples/B/Siemens/RuleValidation/Deploy/AssociativityXY_3_type.v /Users/leuschel/svn_root/NewProBPrivate/examples/B/Siemens/RuleValidation/MainRuleBaseFile.mch |
595 | | |
596 | | % performance benchmark: |
597 | | % time(eval_strings:test_parser('examples/Rules/sample.rule')). |
598 | | % time(eval_strings:test_parser('examples/Rules/sample2.rule')). |
599 | | % time(eval_strings:test_parser('examples/Rules/sudoku.rule')). |
600 | | :- public test_parser/1. |
601 | | test_parser(File) :- print(processing_rule_file(File)),nl, |
602 | | safe_read_string_from_file(File,utf8,Codes),print(parsing),nl, |
603 | | repl_typing_scope(TypingScope), |
604 | | b_parse_machine_predicate_from_codes_open(exists,Codes,[],TypingScope, |
605 | | _Typed), |
606 | | print(done),nl. |
607 | | |
608 | | |
609 | | % ---------- |
610 | | % EXPRESSIONS |
611 | | % ---------- |
612 | | |
613 | | :- use_module(state_space,[current_state_id/1]). |
614 | | :- use_module(store). |
615 | | :- use_module(translate). |
616 | | :- use_module(b_interpreter). |
617 | | |
618 | | :- meta_predicate probcli_clpfd_overflow_mnf_call1(0). |
619 | | :- meta_predicate probcli_clpfd_overflow_call1(0). |
620 | | |
621 | | :- dynamic last_expansion_time/1. |
622 | | |
623 | | :- use_module(eval_let_store,[extend_state_with_probids_and_lets/2]). |
624 | | :- use_module(specfile, [get_current_state_for_b_formula/2]). |
625 | | % get state for REPL as required by the provided typed expression/predicate |
626 | | get_cur_state_for_repl(Typed,State) :- |
627 | | retractall(last_expansion_time(_)), |
628 | | statistics(walltime,[T1,_]), |
629 | | get_current_state_for_b_formula(Typed,State1), |
630 | | extend_state_with_probids_and_lets(State1,State), |
631 | | statistics(walltime,[T2,_]), Delta is T2-T1, |
632 | | assertz(last_expansion_time(Delta)). |
633 | | |
634 | | |
635 | | |
636 | | :- use_module(kodkodsrc(kodkod), [current_solver_is_not_incremental/0]). |
637 | | replace_expression_by_kodkod_if_enabled(Typed,NewExpression) :- |
638 | | (replace_expression_by_kodkod_if_enabled_aux(Typed,NewExpression) -> true |
639 | | ; NewExpression=Typed). |
640 | | replace_expression_by_kodkod_if_enabled_aux(Typed,NewExpression) :- |
641 | | % do :kodkod replacment inside set comprehensions |
642 | | get_texpr_expr(Typed,comprehension_set(Ids,Pred)), |
643 | | get_preference(use_solver_on_load,kodkod), |
644 | | \+ current_solver_is_not_incremental, % otherwise we cannot get all solutions |
645 | | replace_kodkod_if_enabled(Ids,Pred,NewPred), % TO DO: we could pass a parameter that says we want all solutions here |
646 | | get_preference(kodkod_symmetry_level,Symm), |
647 | | (Symm > 0 , Pred \= NewPred |
648 | | -> get_texpr_ids(Ids,I), |
649 | | add_warning(kodkod,'KODKOD_SYMMETRY > 0, not all solutions to set comprehension may be computed: ',I,Typed) |
650 | | % it seems too late now to set symmetry to 0; problem already loaded ?!? |
651 | | ; true), |
652 | | get_texpr_info(Typed,Info),get_texpr_type(Typed,Type), |
653 | | create_texpr(comprehension_set(Ids,NewPred),Type,Info,NewExpression). |
654 | | |
655 | | |
656 | | eval_expression_direct(Typed,Value) :- |
657 | | get_cur_state_for_repl(Typed,EState), |
658 | | probcli_clpfd_overflow_mnf_call1(b_interpreter:b_compute_expression_nowf(Typed,[],EState,Value,'none',0)). |
659 | | |
660 | | eval_expression(Typed,RRes,Options) :- eval_expression(Typed,RRes,_PrologTerm,Options). |
661 | | |
662 | | % EnumWarnings are no longer returned but thrown if problematic |
663 | | eval_expression(Typed,RRes,NValue,Options) :- %% print('Start Eval Expression: '),nl,flush_output, |
664 | | enter_new_error_scope(ScopeID,eval_expression), |
665 | | clear_all_errors_in_error_scope(ScopeID), |
666 | | replace_expression_by_kodkod_if_enabled(Typed,Typed2), |
667 | | set_last_expression(expr,Typed2,exception), |
668 | | debug_println(5,'Start Eval Expression'), |
669 | | %profile_reset, set_prolog_flag(profiling,on), % comment in to profile individual expression evaluations |
670 | | (eval_expression_direct(Typed2,Value) |
671 | | -> true |
672 | | ; set_last_expression(expr,Typed2,error),fail % probably wd-error |
673 | | ), |
674 | | !, |
675 | | %set_prolog_flag(profiling,off), print_profile, % comment in to profile individual expression evaluations |
676 | | debug_println(5,'Normalising Value'), |
677 | | normalise_eval_value(Value,NValue), |
678 | | set_last_expression(expr,Typed2,NValue), |
679 | | (member(silent_no_string_result,Options) -> RRes = '?' |
680 | | ; |
681 | | debug_println(5,'Translating Value'), |
682 | | translate_bvalue_with_col(NValue,Typed2,Result), |
683 | | %get_only_critical_enum_warning(EnumWarning), |
684 | | start_terminal_colour([dark_gray],user_output), |
685 | | format(user_output,'Expression Value = ~n',[]), % TO DO: make output optional, e.g., for json trace replay |
686 | | reset_terminal_colour(user_output), |
687 | | display_and_set_result(ScopeID,Result,RRes,false), |
688 | | display_dot_expr_result(Typed2,NValue) % TO DO: if we have a let with ID: use ID rather than result |
689 | | ). |
690 | | eval_expression(_,Cause,error,_) :- |
691 | | get_fail_error_cause(Cause), % TO DO: refactor and use abort_error_occured_in_error_scope,... |
692 | | exit_error_scope(_ScopeID,_,eval_expression). |
693 | | |
694 | | |
695 | | :- dynamic normalising_off/0. |
696 | | toggle_normalising :- print('% Normalising Result Values: '), |
697 | | (retract(normalising_off) -> print('ON') |
698 | | ; assertz(normalising_off),print('OFF')),nl. |
699 | | turn_normalising_off :- (normalising_off -> true ; assertz(normalising_off)). |
700 | | turn_normalising_on :- retractall(normalising_off). |
701 | | |
702 | | normalise_eval_value(Value,NValue) :- normalising_off,!, |
703 | | start_norm_timer(NT,NWT), |
704 | | NValue=Value, stop_norm_timer(NT,NWT). |
705 | | normalise_eval_value(Value,NValue) :- |
706 | | %EXPAND=limit(100000), % expand up until 100,000 elements; don't expand SYMBOLIC |
707 | | EXPAND=force, % don't expand definitely infinite sets + sets known larger than 20,000 |
708 | | % but sets marked with prob_annotation('SYMBOLIC') may be expanded! |
709 | | debug_println(20,normalising(Value)), |
710 | | start_norm_timer(NT,NWT), |
711 | | ( store:normalise_value_for_var(eval_strings,EXPAND,Value,NValue), |
712 | | stop_norm_timer(NT,NWT) |
713 | | -> true |
714 | | ; stop_norm_timer(NT,NWT), |
715 | | print_red('Could not normalise value:'),nl, |
716 | | NValue=Value |
717 | | ). |
718 | | |
719 | | get_fail_error_cause(Cause) :- |
720 | | logged_error(identifier_not_found,_B,_C,_D), % print(logged_error(identifier_not_found,B,_C,_D)), |
721 | | %atom_codes(B,Codes), append("Cannot find identifier",_,Codes), |
722 | | !, |
723 | | Cause = 'IDENTIFIER(S) NOT YET INITIALISED; INITIALISE MACHINE FIRST'. |
724 | | get_fail_error_cause('NOT-WELL-DEFINED'). |
725 | | |
726 | | get_type_error(Cause) :- logged_error(A,B,_C,_D), % print(logged_error(A,B,C,D)), |
727 | | A=type_expression_error, |
728 | | atom_codes(B,Codes), |
729 | | append("Unknown identifier",_,Codes),!, |
730 | | Cause = 'UNKNOWN IDENTIFIER(S)'. |
731 | | get_type_error('TYPE ERROR'). |
732 | | |
733 | | |
734 | | % ----------------- |
735 | | |
736 | | |
737 | | |
738 | | % options in REPL for :find-value |
739 | | find_value_options([prefix]) --> "prefix ". |
740 | | find_value_options([suffix]) --> "suffix ". |
741 | | find_value_options([exact]) --> "exact ". |
742 | | find_value_options([fuzzy]) --> "fuzzy ". |
743 | | find_value_options([infix]) --> "infix ". |
744 | | find_value_options([]) --> "". |
745 | | |
746 | | |
747 | | % ---------- |
748 | | % PREDICATES |
749 | | % ---------- |
750 | | |
751 | | |
752 | | :- volatile eval_repeat/1. |
753 | | :- dynamic eval_repeat/1. |
754 | | |
755 | | set_eval_repeat(X) :- format('Finding ~w first solutions for predicates~n',[X]), |
756 | | retractall(eval_repeat(_)),assertz(eval_repeat(X)). |
757 | | |
758 | | :- use_module(succeed_max,[succeed_max_call_id/3]). %succeed_max_call_id('$setup_constants',member(_,_),1) |
759 | | test_bool_exists(EState, Parameters,Typed,LocalState,WF) :- eval_repeat(Nr), |
760 | | format_with_colour_nl(user_output,[dark_gray],'** Finding first ~w solutions',[Nr]), |
761 | | call_residue(succeed_max_call_id(test_bool_exists, |
762 | | eval_strings:test_bool_exists2(EState, Parameters,Typed,LocalState,WF),Nr),Residue), |
763 | | display_solution('Solution:~n',Parameters,LocalState), |
764 | | (Residue = [] -> true ; print_red('RESIDUE = '), print_red(Residue),nl), |
765 | | fail. |
766 | | test_bool_exists(EState, Parameters,Typed,LocalState,WF) :- |
767 | ? | test_bool_exists2(EState, Parameters,Typed,LocalState,WF). |
768 | | |
769 | | :- use_module(extrasrc(optimizing_solver),[optimizing_solve_predicate/5,optimizing_solve_predicate/7]). |
770 | | get_minmax_command(Codes,maximizing,PredCodes) :- append(":max ",PredCodes,Codes). |
771 | | get_minmax_command(Codes,minimizing,PredCodes) :- append(":min ",PredCodes,Codes). |
772 | | test_bool_exists2(EState, Parameters,Typed,LocalState,_WF) :- eval_mode(optimizing(OptMode)), !, |
773 | | optimizing_solve_predicate(OptMode,EState, Parameters,Typed,LocalState). |
774 | | test_bool_exists2(EState, Parameters,Typed,LocalState,WF) :- \+ eval_det, !, |
775 | | % evaluate component wise |
776 | | %init_wait_flags(WF,[expansion_context(test_bool_exists2,Parameters)]), |
777 | | init_quantifier_wait_flag(no_wf_available,exists,Parameters,FreshOutputVars,unknown,WF), |
778 | ? | b_interpreter:set_up_typed_localstate(Parameters,FreshOutputVars,TypedVals,[],LocalState,positive), |
779 | | append(LocalState,EState,State), |
780 | | b_interpreter_components:reset_unsat_component_info, |
781 | | % NOTE: WF not passed to b_interpreter_components ! |
782 | ? | b_interpreter_components:b_trace_test_components_wf(Typed,State,TypedVals,WF), |
783 | | \+ b_interpreter_components:unsat_component_exists. |
784 | | test_bool_exists2(EState, Parameters,Typed,LocalState,WF) :- |
785 | | %init_wait_flags(WF,[expansion_context(test_bool_exists2,Parameters)]), |
786 | | init_quantifier_wait_flag(no_wf_available,exists,Parameters,FreshOutputVars,unknown,WF), |
787 | | b_interpreter:set_up_typed_localstate(Parameters,FreshOutputVars,TypedVals,[],LocalState,positive), |
788 | | b_tighter_enumerate_values_in_ctxt(TypedVals,Typed,WF), |
789 | | b_interpreter:b_test_boolean_expression(Typed,LocalState,EState,WF). |
790 | | |
791 | | |
792 | | :- use_module(eventhandling,[announce_event/1]). |
793 | | %:- use_module(bmachine, [determine_type_of_formula/2]). |
794 | | |
795 | | eval_predicate_in_cur_state(ExTyped,RRes,EnumWarning,LocalState) :- |
796 | | get_cur_state_for_repl(ExTyped,State),!, |
797 | | announce_event(start_solving), |
798 | | eval_predicate(State,ExTyped,RRes,EnumWarning,LocalState), |
799 | | announce_event(end_solving). |
800 | | eval_predicate_in_cur_state(_ExTyped,RRes,EnumWarning,LocalState) :- |
801 | | format_with_colour_nl(user_output,[red,bold],'UNKNOWN',[]), |
802 | | RRes = 'UNKNOWN', EnumWarning=false, LocalState=[]. |
803 | | |
804 | | :- use_module(probsrc(solver_interface),[apply_kodkod_or_other_optimisations/3]). |
805 | | replace_kodkod_if_enabled(Parameters,Typed,NewPredicate) :- |
806 | | b_get_machine_constants(Constants), |
807 | | b_get_machine_variables(Variables), |
808 | | get_repl_lets_tids(LetIds), |
809 | | append([Parameters,Variables,Constants,LetIds],Identifiers), |
810 | | apply_kodkod_or_other_optimisations(Identifiers,Typed,NewPredicate). |
811 | | |
812 | | eval_predicate(State,Typed,RRes,EnumWarning,LocalState) :- |
813 | | %b_ast_cleanup:predicate_level_optimizations(Typed,Typed2), |
814 | | % detect set partitions, ... no longer necessary ! as already called in b_ast_cleanup now |
815 | | eval_predicate_aux(State,Typed,RRes,EnumWarning,LocalState). |
816 | | eval_predicate_aux(State,ExTyped,RRes,EnumWarning,LocalState) :- |
817 | | %ExTyped=b(exists(Parameters,Typed),pred,_I), |
818 | | is_existential_quantifier(ExTyped,Parameters,Typed), |
819 | | !, |
820 | | %print('Existentially Quantified Predicate is '),flush_output, |
821 | | replace_kodkod_if_enabled(Parameters,Typed,NTyped), |
822 | | enter_new_error_scope(ScopeID,eval_predicate_exists), clear_all_errors_in_error_scope(ScopeID), |
823 | | set_last_expression(pred,ExTyped,exception), % in case an exception occurs |
824 | | (observe_parameters(true) -> observe_parameters(Parameters,LocalState) ; true), |
825 | | (probcli_clpfd_overflow_call1((test_bool_exists(State, Parameters,NTyped,LocalState,WF), |
826 | | eval_ground_wf(WF))) |
827 | | -> get_only_critical_enum_warning(EnumWarning), |
828 | | (eval_det -> Res = 'POSSIBLY TRUE' ; Res = 'TRUE'), |
829 | | set_last_expression(pred,ExTyped,pred_true) |
830 | | ; get_enum_warning(EnumWarning), |
831 | | % The result has to be ground for the eclipse interface to work as intended. |
832 | | % Hence, we need to bind the LocalState (?) |
833 | | LocalState = [], |
834 | | Res = 'FALSE', set_last_expression(pred,ExTyped,pred_false)), |
835 | | (eval_det, debug_level_active_for(20) -> portray_waitflags_and_frozen_state_info(WF,(LocalState,State)) ; true), |
836 | | print('Existentially Quantified Predicate over '), print_parameters(Parameters), |
837 | | print(' is '),display_and_set_result(ScopeID,Res,RRes,EnumWarning), |
838 | | (Res='FALSE' -> true |
839 | | ; display_solution('Solution:~n',Parameters,LocalState) |
840 | | ). |
841 | | eval_predicate_aux(State, ExTyped,RRes,EnumWarning,LocalState) :- |
842 | | ExTyped=b(forall(Parameters,TypedLHS,TypedRHS),pred,_I),!, |
843 | | %print('Universally Quantified Predicate is '),flush_output, |
844 | | enter_new_error_scope(ScopeID,eval_predicate_forall), clear_all_errors_in_error_scope(ScopeID), |
845 | | safe_create_texpr(negation(TypedRHS),pred,[try_smt],NegRHS), |
846 | | conjunct_predicates([TypedLHS,NegRHS],Conjunction), |
847 | | replace_kodkod_if_enabled(Parameters,Conjunction,NConjunction), |
848 | | %translate:print_bexpr(Conjunction), |
849 | | set_last_expression(pred,ExTyped,exception), % in case an exception occurs |
850 | | (probcli_clpfd_overflow_call1((test_bool_exists(State, Parameters,NConjunction,LocalState,WF), |
851 | | eval_ground_wf(WF))) |
852 | | -> get_only_critical_enum_warning(EnumWarning), |
853 | | (eval_det -> Res = 'POSSIBLY TRUE' ; Res = 'FALSE'), |
854 | | set_last_expression(pred,ExTyped,pred_false) |
855 | | ; get_enum_warning(EnumWarning), |
856 | | % The result has to be ground for the eclipse interface to work as intended. |
857 | | % Hence, we need to bind the LocalState (?) |
858 | | LocalState = [], |
859 | | Res = 'TRUE', set_last_expression(pred,ExTyped,pred_true)), |
860 | | print('Universally Quantified Predicate over '), print_parameters(Parameters), |
861 | | print(' is '), display_and_set_result(ScopeID,Res,RRes,EnumWarning), |
862 | | (Res='TRUE' -> true |
863 | | ; display_solution('Counter example:~n',Parameters,LocalState) |
864 | | ). |
865 | | eval_predicate_aux(State, Typed,RRes,EnumWarning,[]) :- |
866 | | enter_new_error_scope(ScopeID,eval_predicate), clear_all_errors_in_error_scope(ScopeID), |
867 | | debug_println(20,test_boolean_expression(Typed)), |
868 | | replace_kodkod_if_enabled([],Typed,NTyped), |
869 | | set_last_expression(pred,NTyped,exception), % in case an exception occurs |
870 | | % TO DO: the next does not decompose into components !?; either call solve_predicate if State=[] or call b_trace_test_components inside b_test_boolean_expression_cs |
871 | | (probcli_clpfd_overflow_call1(b_interpreter:b_test_boolean_expression_cs(NTyped,[],State,'none',0)) |
872 | | -> Res='TRUE',set_last_expression(pred,Typed,pred_true), |
873 | | get_only_critical_enum_warning(EnumWarning) |
874 | | ; Res='FALSE',set_last_expression(pred,Typed,pred_false), |
875 | | get_enum_warning(EnumWarning) |
876 | | ), |
877 | | print('Predicate is '),display_and_set_result(ScopeID,Res,RRes,EnumWarning). |
878 | | |
879 | | get_enum_warning(EnumWarning) :- |
880 | | (event_occurred_in_error_scope(enumeration_warning(_,_,_,_,_Critical)) |
881 | | -> EnumWarning=true %,print(' ** ENUM WARNING ** ') |
882 | | ; EnumWarning=false). |
883 | | get_only_critical_enum_warning(EnumWarning) :- EnumWarning=false. |
884 | | % we no longer distinguish between critical & non-critical; also assuming_finite_closure now fails (renamed to checking_finite_closure) |
885 | | % Enumeration warning means that not all cases have been looked at, but if a result is true then it is guaranteed to be true |
886 | | |
887 | | |
888 | | display_and_set_result(ScopeID,Res,RRes,EnumWarning) :- |
889 | | %error_manager:print_error_scopes, |
890 | | findall(E,specific_event_occurred_at_level(ScopeID,E),Errors), |
891 | ? | (abort_error_occured_in_error_scope -> WDError=true ; WDError=false), |
892 | | (specific_event_occurred_at_level(ScopeID,identifier_not_found) -> IdNotFound=true ; IdNotFound=false), |
893 | | exit_error_scope(ScopeID,ErrOcc,display_and_set_result), |
894 | | ErrOcc=true, % TO DO: check which kind of error occured: could be CLPFD overflow |
895 | | !, |
896 | | show_error_pos, |
897 | | (WDError=true |
898 | | -> format_with_colour(user_output,[red,bold],'NOT-WELL-DEFINED (~w)',[Res]), |
899 | | RRes = 'NOT-WELL-DEFINED' |
900 | | ; IdNotFound=true -> % should no longer happen; we check requirements first |
901 | | format_with_colour(user_output,[red,bold],'IDENTIFIER-NOT-FOUND-ERROR ~w',[Errors]), |
902 | | RRes = 'IDENTIFIER(S) NOT YET INITIALISED; INITIALISE MACHINE FIRST' |
903 | | ; format_with_colour(user_output,[red,bold],'UNKNOWN ~w',[Errors]), |
904 | | RRes = 'UNKNOWN' |
905 | | ), |
906 | | print_enum_warning(EnumWarning), nl. |
907 | | display_and_set_result(_,Res,RRes,EnumWarning) :- |
908 | | print_result(Res,EnumWarning), nl, |
909 | | (EnumWarning=false -> RRes=Res |
910 | | ; Res = 'TRUE' -> RRes=Res % enumeration warning does not matter when solution found |
911 | | ; RRes= 'UNKNOWN'). |
912 | | print_result('FALSE',false) :- !, |
913 | | start_terminal_colour(light_red,user_output), |
914 | | write('FALSE'),reset_terminal_colour(user_output). |
915 | | print_result('TRUE',false) :- !, |
916 | | start_terminal_colour(green,user_output), |
917 | | write('TRUE'),reset_terminal_colour(user_output). |
918 | | print_result(Res,false) :- !, write(Res). |
919 | | print_result(Res,_) :- |
920 | | (debug_mode(on) |
921 | | -> format_with_colour(user_output,[red,bold],'UNKNOWN [~w with ** ENUMERATION WARNING **]',[Res]) |
922 | | ; format_with_colour(user_output,[red,bold],'UNKNOWN',[]) |
923 | | ). |
924 | | |
925 | | |
926 | | :- use_module(tools_printing,[print_red/1,print_green/1,format_with_colour/4, format_with_colour_nl/4]). |
927 | | print_enum_warning(false) :- !. |
928 | | print_enum_warning(_) :- print_red(' [** ENUMERATION WARNING **]'). |
929 | | |
930 | | :- use_module(dotsrc(state_as_dot_graph),[print_cstate_graph/2]). |
931 | | display_sol_required :- silent_mode(off),!. |
932 | | display_sol_required :- eval_dot_file(_),!. |
933 | | %display_sol_required :- format(user_output,'Not showing solution~n',[]),trace,fail. |
934 | | |
935 | | display_solution(HeaderStr,Parameters,LocalState) :- |
936 | | set_last_solution(Parameters,LocalState), |
937 | | (display_sol_required |
938 | | -> format(HeaderStr,[]), |
939 | | display_solution_aux(Parameters,LocalState) |
940 | | ; true). |
941 | | display_solution_aux(Parameters,LocalState) :- |
942 | | (eval_det |
943 | | -> % copy_term(LocalState,CLS), % avoid triggering co-routines via numbervars |
944 | | % tools_meta:safe_numbervars(CLS,0,_), |
945 | | print_visible_solution_with_type(Parameters,LocalState) |
946 | | ; debug_println(19,normalising_solution(LocalState)), |
947 | | normalise_solution(LocalState,NState) |
948 | | -> %translate:print_bstate(NState) |
949 | | print_visible_solution_with_type(Parameters,NState), |
950 | | %visualize_graph:tcltk_print_state_as_graph_for_dot(NState,'~/Desktop/out.dot') |
951 | | display_dot_solution(NState) |
952 | | ; print_red('Could not normalise value(s):'),nl, |
953 | | translate:print_bstate(LocalState) |
954 | | ),nl. |
955 | | |
956 | | normalise_solution(LocalState,NormState) :- normalising_off,!, NormState=LocalState. |
957 | | normalise_solution(LocalState,NormState) :- |
958 | | start_norm_timer(NT,NWT), |
959 | | (normalise_store(LocalState,NormState) -> stop_norm_timer(NT,NWT) ; stop_norm_timer(NT,NWT),fail). |
960 | | |
961 | | display_dot_expr_result(Expr,Value) :- |
962 | | (eval_dot_file(File) |
963 | | -> get_dot_expr_state(Expr,Value,NState,[]), |
964 | | debug_println(9,writing_dot_file(File)), |
965 | | print_cstate_graph(NState,File) |
966 | | ; true). |
967 | | |
968 | | % try and decompose an expression value into subvalues for better dot rendering |
969 | | get_dot_expr_state(b(couple(A,B),_,_),(VA,VB)) --> !, |
970 | | get_dot_expr_state(A,VA), |
971 | | get_dot_expr_state(B,VB). |
972 | | get_dot_expr_state(b(identifier(ID),_,_),Val) --> !, [bind(ID,Val)]. |
973 | | get_dot_expr_state(_,Val) --> [bind(result,Val)]. |
974 | | |
975 | | % display_dot_solution([bind(result,NValue)]). |
976 | | display_dot_solution(NState) :- |
977 | | (eval_dot_file(File) |
978 | | -> debug_println(9,writing_dot_file(File)), |
979 | | print_cstate_graph(NState,File) ; true). |
980 | | |
981 | | :- dynamic last_solution/2. |
982 | | set_last_solution(Parameters,LocalState) :- |
983 | | retractall(last_solution(_,_)), |
984 | | assertz(last_solution(Parameters,LocalState)). |
985 | | |
986 | | % small utility to extract last result; if we had a predicate with just one existential variable extract its value: |
987 | | get_last_result_value(Parameter,Type,Value) :- |
988 | ? | get_last_predicate_value_for_typed_id(Parameter,[],T,V), % only allow single parameter; otherwise confusion may exist |
989 | | !,Value=V, Type=T. |
990 | | get_last_result_value(Expr,Type,Value) :- get_last_expr_type_and_value(Expr,Type,Value). |
991 | | |
992 | | convert_result(T,V,Type,Value) :- |
993 | | (convert_aux(T,V,Type,Value) -> true ; Type=T,Value=V). |
994 | | convert_aux(pred,pred_true,boolean,pred_true). |
995 | | convert_aux(pred,pred_false,boolean,pred_false). |
996 | | |
997 | | % try and extract a value for a give parameter from last solution for a predicate |
998 | | get_last_predicate_value_for_id(ID,Type,Val) :- |
999 | | get_texpr_id(Parameter,ID),get_last_predicate_value_for_typed_id(Parameter,_,Type,Val). |
1000 | | get_last_predicate_value_for_typed_id(Parameter,Rest,Type,Value) :- |
1001 | | last_expression(pred,_,pred_true), % we solved a predicate, look in solution environment |
1002 | | last_solution(Parameters,LocalState), |
1003 | ? | select(Parameter,Parameters,Rest), |
1004 | | get_texpr_id(Parameter,ParameterID), |
1005 | | get_texpr_type(Parameter,Type), |
1006 | | member(bind(ParameterID,Value),LocalState). |
1007 | | |
1008 | | :- volatile eval_dot_file/1, observe_parameters/1. |
1009 | | :- dynamic eval_dot_file/1, observe_parameters/1. |
1010 | | observe_parameters(false). |
1011 | | |
1012 | | toggle_observe_evaluation :- |
1013 | | (observe_parameters(false) |
1014 | | -> print('Observing parameters'),nl, |
1015 | | set_observe_evaluation(true) |
1016 | | ; print('Observing OFF'),nl, |
1017 | | set_observe_evaluation(false)). |
1018 | | set_observe_evaluation(T) :- retractall(observe_parameters(_)), assertz(observe_parameters(T)). |
1019 | | set_eval_dot_file(F) :- unset_eval_dot_file, |
1020 | | debug_println(5,setting_eval_dot_file(F)), |
1021 | | assertz(eval_dot_file(F)). |
1022 | | unset_eval_dot_file :- retractall(eval_dot_file(_)). |
1023 | | |
1024 | | % ---------------- |
1025 | | |
1026 | | % print solution using type information of non-generated ids (unless in debug mode) |
1027 | | print_visible_solution_with_type(Ids,Bindings) :- Ids = [_|_], |
1028 | | debug_mode(off), |
1029 | | exclude(generated_id,Ids,VisibleIds),!, |
1030 | | print_solution_with_type2(VisibleIds,Bindings). |
1031 | | print_visible_solution_with_type(Ids,Bindings) :- print_solution_with_type1(Ids,Bindings). |
1032 | | |
1033 | | generated_id(b(_,_,I)) :- member(generated,I). |
1034 | | |
1035 | | % print solution using type information |
1036 | | print_solution_with_type1([],Bindings) :- !,print_solution_with_type2(unknown,Bindings). |
1037 | | print_solution_with_type1(T,Bindings) :- print_solution_with_type2(T,Bindings). |
1038 | | |
1039 | | print_solution_with_type2([],_) :- !. % can be non-empty due to generated ids being removed |
1040 | | print_solution_with_type2([Identifier|TT],Bindings) :- |
1041 | | def_get_texpr_id(Identifier,Varname), |
1042 | ? | select(bind(Varname,Value), Bindings, VT), |
1043 | | !, |
1044 | | translate_bvalue_with_col(Value,Identifier,Result), |
1045 | | print_binding(Varname,Result), |
1046 | | (TT=[] -> nl ; print(' &'),nl,print_solution_with_type2(TT,VT)). |
1047 | | print_solution_with_type2(unknown,[bind(Varname,Value)|VT]) :- !, |
1048 | | translate_bvalue_with_limit_and_col(Value,100,Result), |
1049 | | print_binding(Varname,Result), |
1050 | | (VT=[] -> nl ; print(' &'),nl,print_solution_with_type2(unknown,VT)). |
1051 | | print_solution_with_type2(unknown,[]) :- !. |
1052 | | print_solution_with_type2([Identifier|TT],Bindings) :- |
1053 | | def_get_texpr_id(Identifier,Varname), !, |
1054 | | % possibly ast_cleanup has removed all predicates involving Identifier, appears in test 2168 for level 1 |
1055 | | % add_internal_error('No binding for variable: ', print_solution_with_type2(Varname,Bindings)), |
1056 | | get_texpr_type(Identifier,Type), |
1057 | | print_no_binding(Varname,Type), |
1058 | | (TT=[] -> nl ; print(' &'),nl,print_solution_with_type2(TT,Bindings)). |
1059 | | print_solution_with_type2(P,State) :- |
1060 | | add_internal_error('Illegal call: ', print_solution_with_type2(P,State)). |
1061 | | |
1062 | | print_binding(Varname,Result) :- |
1063 | | format(' ~w = ~w',[Varname,Result]). |
1064 | | print_no_binding(Varname,Type) :- |
1065 | | pretty_type(Type,PrettyType), |
1066 | | format(' ~w : ~w',[Varname,PrettyType]). |
1067 | | |
1068 | | % translate a value with optional colouring |
1069 | | :- dynamic colour_values/1. |
1070 | | colour_values(false). |
1071 | | toggle_colouring :- retract(colour_values(V)), |
1072 | | (V=false -> V2=true ; V2=false), |
1073 | | assertz(colour_values(V2)), |
1074 | | format('Colouring of values is now ~w~n',[V2]). |
1075 | | translate_bvalue_with_col(Value,Identifier,Result) :- colour_values(false),!, |
1076 | | translate_bvalue_for_expression(Value,Identifier,Result). |
1077 | | translate_bvalue_with_col(Value,Identifier,Result) :- |
1078 | | temporary_set_preference(pp_with_terminal_colour,true,C), |
1079 | | call_cleanup(translate_bvalue_for_expression(Value,Identifier,Result), |
1080 | | reset_temporary_preference(pp_with_terminal_colour,C)). |
1081 | | |
1082 | | translate_bvalue_with_limit_and_col(Value,Limit,Result) :- colour_values(false),!, |
1083 | | translate_bvalue_with_limit(Value,Limit,Result). |
1084 | | translate_bvalue_with_limit_and_col(Value,Limit,Result) :- |
1085 | | temporary_set_preference(pp_with_terminal_colour,true,C), |
1086 | | call_cleanup(translate_bvalue_with_limit(Value,Limit,Result), |
1087 | | reset_temporary_preference(pp_with_terminal_colour,C)). |
1088 | | |
1089 | | % ------------------ |
1090 | | |
1091 | | % translate a solver name to the prefix to be used on the REPL: |
1092 | | translate_solver_to_prefix(Solver,Prefix) :- available_smt_solver(Solver,Prefix). |
1093 | | translate_solver_to_prefix('sat',":sat "). % entry for eval_file |
1094 | | translate_solver_to_prefix(prob,":prob "). % for eval_file |
1095 | | translate_solver_to_prefix('prob-chr',":prob "). % for eval_file |
1096 | | translate_solver_to_prefix('sat-z3',":sat-z3 "). % entry for eval_file |
1097 | | translate_solver_to_prefix(kodkod,":kodkod "). % entry for eval_file |
1098 | | |
1099 | | available_smt_solver(cvc4,":cvc "). |
1100 | | available_smt_solver(cvc4,":cvc4 "). |
1101 | | available_smt_solver(nostate(cvc4),":cvc4-free "). |
1102 | | available_smt_solver(z3,":z3 "). |
1103 | | available_smt_solver(z3sat,":z3-sat "). |
1104 | | available_smt_solver(z3axm,":z3-axm "). |
1105 | | available_smt_solver(z3cns,":z3-cns "). |
1106 | | available_smt_solver(nostate(z3),":z3-free "). |
1107 | | available_smt_solver(nostate(z3sat),":z3-sat-free "). |
1108 | | available_smt_solver(nostate(z3axm),":z3-axm-free "). |
1109 | | available_smt_solver(nostate(z3cns),":z3-cns-free "). |
1110 | | available_smt_solver(double_check(z3),":z3-double-check "). |
1111 | | available_smt_solver(double_check(nostate(z3)),":z3-free-double-check "). |
1112 | | available_smt_solver(cdcl_sat,":cdcl-sat "). |
1113 | | available_smt_solver(nostate(cdcl_sat),":cdcl-sat-free "). |
1114 | | available_smt_solver(cdclt,":cdclt "). |
1115 | | available_smt_solver(nostate(cdclt),":cdclt-free "). |
1116 | | available_smt_solver(double_check(cdclt),":cdclt-double-check "). |
1117 | | available_smt_solver(double_check(nostate(cdclt)),":cdclt-free-double-check "). |
1118 | | available_smt_solver(idl,":idl "). |
1119 | | available_smt_solver(setlog,":slog "). |
1120 | | available_smt_solver(double_check(setlog),":slog-double-check "). |
1121 | | available_smt_solver(prob(default),":prob "). % solve with SMT |
1122 | | available_smt_solver(prob(strong),":prob-chr "). |
1123 | | available_smt_solver(prob(eval),":eval "). % solve without SMT option; like default REPL eval |
1124 | | available_smt_solver('prob-unsat-core',":core "). |
1125 | | available_smt_solver('prob-unsat-core-no-chr',":ccore "). |
1126 | | available_smt_solver('prob-unsat-cores',":cores "). |
1127 | | available_smt_solver('prob-fast-unsat-core',":fcore "). |
1128 | | available_smt_solver('prob-fast-unsat-core',":fast-core "). |
1129 | | available_smt_solver('prob-min-core',":mcore "). |
1130 | | available_smt_solver('prob-min-core',":min-core "). |
1131 | | available_smt_solver('smt-unsat-core'(z3),":z3-core "). |
1132 | | available_smt_solver('smt-quick-bup-unsat-core'(z3),":z3-qcore "). |
1133 | | available_smt_solver('smt-quick-bup-unsat-core'(z3cns),":z3-cns-qcore "). |
1134 | | available_smt_solver('smt-quick-bup-unsat-core'(z3axm),":z3-axm-qcore "). % z3axm best for bup-unsat core? |
1135 | | available_smt_solver('smt-unsat-core'(z3cns),":z3-cns-core "). |
1136 | | available_smt_solver('smt-unsat-core'(z3axm),":z3-axm-core "). |
1137 | | available_smt_solver('cdclt-unsat-core',":cdclt-core "). |
1138 | | available_smt_solver('satsolver'(glucose,with_state),":sat "). |
1139 | | available_smt_solver('satsolver'(glucose,nostate),":sat-free "). |
1140 | | available_smt_solver('satsolver'(z3,with_state),":sat-z3 "). |
1141 | | available_smt_solver('satsolver'(z3,nostate),":sat-z3-free "). |
1142 | | available_smt_solver(double_check('satsolver'(glucose,with_state)),":sat-double-check "). |
1143 | | available_smt_solver(double_check('satsolver'(z3,with_state)),":sat-z3-double-check "). |
1144 | | |
1145 | | |
1146 | | available_smt_solver_for_file(cdclt,":cdclt-file "). |
1147 | | available_smt_solver_for_file(nostate(cdclt),":cdclt-free-file "). |
1148 | | available_smt_solver_for_file(idl,":idl-file "). |
1149 | | available_smt_solver_for_file(z3,":z3-file "). |
1150 | | available_smt_solver_for_file(z3sat,":z3-sat-file "). |
1151 | | available_smt_solver_for_file(z3axm,":z3-axm-file "). |
1152 | | available_smt_solver_for_file(z3cns,":z3-cns-file "). |
1153 | | available_smt_solver_for_file(nostate(z3),":z3-free-file "). |
1154 | | available_smt_solver_for_file('smt-unsat-core'(z3),":z3-core-file "). |
1155 | | available_smt_solver_for_file(cvc4,":cvc4-file "). |
1156 | | available_smt_solver_for_file(nostate(cvc4),":cvc4-free-file "). |
1157 | | available_smt_solver_for_file(prob(default),":prob-file "). |
1158 | | available_smt_solver_for_file(prob(strong),":prob-chr-file "). |
1159 | | available_smt_solver_for_file('prob-unsat-core',":prob-core-file "). |
1160 | | |
1161 | | :- use_module(extrasrc(atelierb_provers_interface),[prove_sequent_with_provers/3]). |
1162 | | available_krt_prover(krt,[ml,pp],":krt"). |
1163 | | available_krt_prover(ml,[ml],":ml"). |
1164 | | available_krt_prover(pp,[pp],":pp"). |
1165 | | available_krt_prover(probwd,['prob-wd-prover'(no_double_check)],":prove"). % not a krt prover |
1166 | | available_krt_prover(probwd,['prob-wd-prover'(double_check)],":prove-double-check"). |
1167 | | |
1168 | | prove_sequent_with_krt_provers(['prob-wd-prover'(DC)],Typed,Result) :- !, |
1169 | | debug_format(19,'Calling ProB WD Prover~n',[]), |
1170 | | (prove_sequent(Typed) |
1171 | | -> Result = 'proved', |
1172 | | (DC = no_double_check -> true ; double_check_proven_sequent(Typed)) |
1173 | | ; Result = 'unproved' |
1174 | | ). |
1175 | | prove_sequent_with_krt_provers(Provers,ExTyped,Res) :- |
1176 | | debug_format(19,'Proving with Atelier-B provers ~w~n',[Provers]), |
1177 | | prove_sequent_with_provers(Provers,ExTyped,Res). |
1178 | | |
1179 | | double_check_proven_sequent(Typed) :- |
1180 | | create_negation(Typed,NegTyped), |
1181 | | member(Solver,[prob(strong),z3]), |
1182 | | %format_with_colour_nl(user_output,[dark_gray],'Double checking proof using ~w',[Solver]), |
1183 | | statistics(walltime,[W1,_]), |
1184 | | %solve_typed_pred_using_smt_solver(Solver,NegTyped,Res,_), |
1185 | | temporary_set_preference(strict_raise_enum_warnings,false,Chng), |
1186 | | (solve_using_smt_solver_aux(Solver,[],NegTyped,_,Res) -> true), |
1187 | | reset_temporary_preference(strict_raise_enum_warnings,Chng), |
1188 | | statistics(walltime,[W2,_]), W is W2-W1, |
1189 | | (Res=solution(_) -> Col=[red,bold] ; Col = [dark_gray]), |
1190 | | format_with_colour_nl(user_output,Col,'Double checking result of ~w after ~w ms: ~w',[Solver,W,Res]), |
1191 | | (Res=solution(_) ; Res='TRUE'), |
1192 | | !, |
1193 | | add_error(double_check_proven_sequent,'Counter example for proven sequent found:',Typed,Typed). |
1194 | | double_check_proven_sequent(_). |
1195 | | |
1196 | | |
1197 | | |
1198 | | :- use_module(probsrc(tools), [start_ms_timer/1,stop_ms_timer_with_debug_msg/2]). |
1199 | | solve_using_smt_solver_from_file(Solver,FileCodes,OuterQuantifier,Res,LocalState,TypeInfo) :- |
1200 | | atom_codes(File,FileCodes), |
1201 | | format_with_colour_nl(user_output,[dark_gray],'Reading B predicate for ~w from file ~w',[Solver,File]), |
1202 | | start_ms_timer(T0), |
1203 | | safe_read_string_from_file(File,utf8,PredCodes), |
1204 | | stop_ms_timer_with_debug_msg(T0,reading_file(File)), |
1205 | | debug_format(19,'Predicate read from file:~n~s~n',[PredCodes]), |
1206 | | solve_using_smt_solver(Solver,PredCodes,try_prolog,OuterQuantifier,Res,LocalState,TypeInfo). |
1207 | | |
1208 | | :- use_module(state_space,[current_state_id/1]). |
1209 | | :- use_module(smt_solvers_interface(smt_solvers_interface),[smt_solve_predicate_in_state/5, |
1210 | | smt_solve_predicate/4]). |
1211 | | solve_using_smt_solver(Solver,PredCodes,TryProlog,OuterQuantifier,Res,LocalState,TypeInfo) :- |
1212 | | (TryProlog=try_prolog, |
1213 | | repl_get_prolog_predicate(PredCodes,clean_up_pred,ExTyped,TypeInfo) -> true |
1214 | | ; repl_parse_predicate_for_solving(PredCodes,OuterQuantifier,ExTyped,TypeInfo) % TO DO: make lets,... available |
1215 | | ), |
1216 | | solve_typed_pred_using_smt_solver(Solver,ExTyped,Res,LocalState). |
1217 | | |
1218 | | solve_typed_pred_using_smt_solver(Solver,ExTyped,Res,LocalState) :- |
1219 | | set_last_expression(pred,ExTyped,exception), % in case an exception occurs |
1220 | | start_ms_timer(T0), |
1221 | | (is_existential_quantifier(ExTyped,Parameters,Typed) |
1222 | | -> get_clashing_identifiers(Parameters,ClashParas), |
1223 | | % we cannot peel off quantified variables which clash with current state variables, constants, ... |
1224 | | create_exists_opt_liftable(ClashParas,Typed,NewTyped), |
1225 | | % we could also remove the ClashParas from the state passed to the smt solver |
1226 | | (debug_mode(on), ClashParas=[_|_] |
1227 | | -> get_texpr_ids(ClashParas,CP), |
1228 | | add_message(eval_strings,'Existentially quantified variables have global definition: ',CP) |
1229 | | ; true |
1230 | | ) |
1231 | | ; Parameters=[],ExTyped = NewTyped), |
1232 | | stop_ms_timer_with_debug_msg(T0,existential_quantifier_lifting(Solver)), |
1233 | | start_timer(T1,WT1), |
1234 | ? | (call_residue(solve_using_smt_solver_aux0(Solver,Parameters,NewTyped,LocalState,Result),Residue) |
1235 | | -> ajoin(['% Solve using solver ',Solver,':'],Msg), |
1236 | | stop_timer(Msg,T1,WT1), |
1237 | | %print(smt_result(Solver,Result)),nl, |
1238 | | print('PREDICATE is '),display_smt_result(Result,Parameters,ExTyped,Res), |
1239 | | check_residue(Residue) |
1240 | | ; stop_timer('% Solve using SMT solver FAILED',T1,WT1), Res = 'FAILED', |
1241 | | set_last_expression(pred,ExTyped,failed), |
1242 | | LocalState=[]). |
1243 | | |
1244 | | %:- use_module(tools_fastread,[read_term_from_string/2]). |
1245 | | :- use_module(library(codesio),[read_from_codes/2]). |
1246 | | %:- use_module(bsyntaxtree,[repair_used_ids/3]). |
1247 | | :- use_module(b_ast_cleanup,[clean_up_pred/3]). |
1248 | | % detect if we have a Prolog AST and read it in: |
1249 | | repl_get_prolog_predicate(PredPrologASTCodes,Cleanup,CTyped,TypeInfo) :- |
1250 | | append("b(",_,PredPrologASTCodes), |
1251 | | reverse(PredPrologASTCodes,RC), |
1252 | | skip_ws(RC,RC2), |
1253 | | (RC2 = [0'., 0')|_] -> true % we end in ")." |
1254 | | ; append("/*",_,RC2) |
1255 | | -> add_message(eval_strings,'Predicate could be a Prolog AST term; remove final comment'), |
1256 | | fail % we end in a Prolog comment, but it could also be a B comment |
1257 | | ), |
1258 | | add_message(eval_strings,'Predicate seems to be in Prolog AST format, trying to read it'), |
1259 | | read_from_codes(PredPrologASTCodes,Typed), |
1260 | | repair_used_ids(repl_get_prolog_predicate,Typed,RTyped), |
1261 | | bsyntaxtree:check_ast(RTyped), |
1262 | | (Cleanup = clean_up_pred, |
1263 | | clean_up_pred(RTyped,[],CTyped) -> true |
1264 | | ; CTyped=RTyped), |
1265 | | extract_type_information(CTyped,TypeInfo), |
1266 | | add_message(eval_strings,'Successfully read Prolog AST format:'), |
1267 | | nested_print_repl_expression(CTyped). |
1268 | | |
1269 | | skip_ws([32|T],R) :- !, skip_ws(T,R). |
1270 | | skip_ws([10|T],R) :- !, skip_ws(T,R). |
1271 | | skip_ws([13|T],R) :- !, skip_ws(T,R). |
1272 | | skip_ws([9|T],R) :- !, skip_ws(T,R). |
1273 | | skip_ws(R,R). |
1274 | | |
1275 | | :- use_module(bsyntaxtree,[get_global_identifiers/1]). |
1276 | | :- use_module(library(ordsets),[ord_member/2]). |
1277 | | clash(SIds,TID) :- def_get_texpr_id(TID,ID), ord_member(ID,SIds). |
1278 | | get_clashing_identifiers(Parameters,ClashParas) :- |
1279 | | get_repl_ids(TIds), |
1280 | | get_texpr_ids(TIds,Ids), get_global_identifiers(Csts), |
1281 | | append(Csts,Ids,AllIds), |
1282 | | sort(AllIds,SIds), |
1283 | | include(clash(SIds),Parameters,ClashParas). |
1284 | | |
1285 | | get_repl_ids(Identifiers) :- |
1286 | | b_get_machine_constants(Constants), |
1287 | | b_get_machine_variables(Variables), |
1288 | | get_repl_lets_tids(LetIds), |
1289 | | % TO DO: add enumerated set global constants |
1290 | | append([Variables,Constants,LetIds],Identifiers). |
1291 | | |
1292 | | :- use_module(probsrc(solver_interface), [solve_predicate/3, solve_predicate/5]). |
1293 | | :- use_module(wdsrc(well_def_analyser),[prove_sequent/1]). |
1294 | | :- use_module(library(terms),[term_size/2]). |
1295 | | |
1296 | | solve_with_cdclt_in_state(_Paras,Typed,LocalState,SolvedPred,Result) :- !, |
1297 | | get_current_state_full_store(Typed, FullStore), |
1298 | | LocalState=[], |
1299 | ? | cdclt_solve_predicate_in_state(Typed,FullStore,SolvedPred,Result). |
1300 | | |
1301 | | solve_with_cdclt_no_state(Paras,Typed,LocalState,SolvedPred,Result) :- !, |
1302 | | solver_clash_feedback(cdclt,Paras,Typed), |
1303 | | LocalState=[], |
1304 | | cdclt_solve_predicate(Typed,SolvedPred,Result). |
1305 | | |
1306 | | solve_with_cdcl_sat_in_state(_Paras,Typed,LocalState,Result) :- !, |
1307 | | get_current_state_full_store(Typed, FullStore), |
1308 | | LocalState=[], |
1309 | | cdcl_sat_solve_predicate_in_state(Typed,FullStore,Result). |
1310 | | |
1311 | | solve_with_cdcl_sat_no_state(Paras,Typed,LocalState,Result) :- !, |
1312 | | solver_clash_feedback(cdclt,Paras,Typed), |
1313 | | LocalState=[], |
1314 | | cdcl_sat_solve_predicate(Typed,Result). |
1315 | | |
1316 | | solve_using_smt_solver_aux0(Solver,Parameters,NewTyped,LocalState,Result) :- eval_repeat(Nr), |
1317 | | format('Trying to find ~w solutions using ~w:~n',[Nr,Solver]), |
1318 | | succeed_max_call_id(solve_using_smt_solver_aux, |
1319 | | solve_using_smt_solver_aux(Solver,Parameters,NewTyped,LocalState,Result), |
1320 | | Nr), |
1321 | | print('PREDICATE is '),display_smt_result(Result,Parameters,NewTyped,_), |
1322 | | fail. |
1323 | | solve_using_smt_solver_aux0(Solver,Parameters,NewTyped,LocalState,Result) :- |
1324 | ? | solve_using_smt_solver_aux(Solver,Parameters,NewTyped,LocalState,Result). |
1325 | | |
1326 | | :- use_module(cdclt_solver('cdclt_solver')). |
1327 | | :- use_module(cdclt_solver('difference_logic/difference_logic_solver'), [solve_idl_conj/2]). |
1328 | | :- use_module(extrasrc(b2setlog), [solve_pred_with_setlog/3]). |
1329 | | %solve_using_smt_solver_aux(Solver,_Paras,Typed,_,_) :- |
1330 | | % format('Solving with ~w:~n',[Solver]), translate:print_bexpr(Typed),nl,fail. |
1331 | | solve_using_smt_solver_aux(nostate(cdcl_sat),Paras,Typed,LocalState,Result) :- !, |
1332 | | solve_with_cdcl_sat_no_state(Paras,Typed,LocalState,Result). |
1333 | | solve_using_smt_solver_aux(cdcl_sat,Paras,Typed,LocalState,Result) :- !, |
1334 | | solve_with_cdcl_sat_in_state(Paras,Typed,LocalState,Result). |
1335 | | solve_using_smt_solver_aux(nostate(cdclt),Paras,Typed,LocalState,Result) :- !, |
1336 | | solve_with_cdclt_no_state(Paras,Typed,LocalState,_SolvedPred,Result). |
1337 | | solve_using_smt_solver_aux(cdclt,Paras,Typed,LocalState,Result) :- !, |
1338 | ? | solve_with_cdclt_in_state(Paras,Typed,LocalState,_SolvedPred,Result). |
1339 | | solve_using_smt_solver_aux(idl,_,Typed,LocalState,Result) :- !, |
1340 | | LocalState=[], |
1341 | | solve_idl_conj(Typed,Result). |
1342 | | solve_using_smt_solver_aux(setlog,_,Typed,LocalState,Result) :- !, |
1343 | | solve_pred_with_setlog(Typed,LocalState,Result). |
1344 | | solve_using_smt_solver_aux(double_check(nostate(cdclt)),Paras,Typed,LocalState,Result) :- !, |
1345 | | solve_with_cdclt_no_state(Paras, Typed, LocalState, SolvedPred, Result), |
1346 | | % cdclt possibly adds wd conditions; SolvedPred is always well-defined which is not guaranteed for the input |
1347 | | double_check_smt_result(nostate(cdclt),Paras,SolvedPred,LocalState,Result). |
1348 | | solve_using_smt_solver_aux(double_check(cdclt),Paras,Typed,LocalState,Result) :- !, |
1349 | ? | solve_with_cdclt_in_state(Paras, Typed, LocalState, SolvedPred, Result), |
1350 | | double_check_smt_result(cdclt,Paras,SolvedPred,LocalState,Result). |
1351 | | solve_using_smt_solver_aux(double_check(Solver),Paras,Typed,LocalState,Result) :- !, |
1352 | ? | solve_using_smt_solver_aux(Solver,Paras,Typed,LocalState,Result), |
1353 | | double_check_smt_result(Solver,Paras,Typed,LocalState,Result). |
1354 | | solve_using_smt_solver_aux(prob(POpts),Paras,Typed,LocalState,Result) :- !, |
1355 | | solver_clash_feedback(prob,Paras,Typed), |
1356 | | start_ms_timer(T0), |
1357 | | (POpts=default -> Opts = [use_smt_mode/true,use_clpfd_solver/true] |
1358 | | ; POpts=eval -> Opts = [use_smt_mode/false,use_clpfd_solver/true] |
1359 | | ; POpts=strong -> Opts=[use_smt_mode/true,use_clpfd_solver/true,use_chr_solver/true,solver_strength/200] |
1360 | | ; Opts=POpts), %other options could be allow_improving_wd_mode, clean_up_pred, smt_supported_interpreter, ... |
1361 | | solve_predicate(Typed,LocalState,1,Opts,Result), |
1362 | | stop_ms_timer_with_debug_msg(T0,solve_predicate). |
1363 | | solve_using_smt_solver_aux('prob-unsat-core',_,Typed,LocalState,Result) :- !, LocalState=[], |
1364 | | % TODO: provide unsat core in state |
1365 | ? | unsat_core_predicate(Typed,1500,[auto_time_out_factor(180), |
1366 | | min_time_out(20),use_chr_solver/true],_Core,_,Result). |
1367 | | solve_using_smt_solver_aux('prob-unsat-core-no-chr',_,Typed,LocalState,Result) :- !, LocalState=[], |
1368 | | % TODO: provide unsat core in state |
1369 | | unsat_core_predicate(Typed,1500,[auto_time_out_factor(180), |
1370 | | min_time_out(20),use_chr_solver/false],_Core,_,Result). |
1371 | | solve_using_smt_solver_aux('prob-fast-unsat-core',_,Typed,LocalState,Result) :- !, LocalState=[], |
1372 | | unsat_core_predicate(Typed,20,[inspect_nested_conjuncts(false),use_chr_solver/true],_Core,_,Result). |
1373 | | solve_using_smt_solver_aux('smt-unsat-core'(Solver),_,Typed,LocalState,Result) :- !, LocalState=[], |
1374 | | unsat_core_predicate(Typed,1500,[auto_time_out_factor(180), use_smt_solver(Solver), use_chr_solver/true, |
1375 | | unsat_core_target(contradiction_found)],_Core,_,Result). |
1376 | | solve_using_smt_solver_aux('smt-quick-bup-unsat-core'(Solver),_,Typed,LocalState,Result) :- !, LocalState=[], |
1377 | | quick_bup_unsat_core_predicate(Typed,[use_smt_solver(Solver), use_chr_solver/true, |
1378 | | try_prob_solver_first(fixed_time_out(5))],Result). |
1379 | | solve_using_smt_solver_aux('cdclt-unsat-core',_,Typed,LocalState,Result) :- !, LocalState=[], |
1380 | | unsat_core_predicate(Typed,1500,[auto_time_out_factor(180), use_chr_solver/true, |
1381 | | min_time_out(20), use_cdclt_solver],_Core,_,Result). |
1382 | | solve_using_smt_solver_aux('prob-unsat-cores',_,Typed,LocalState,Result) :- !, LocalState=[], |
1383 | | findall(Len-R,unsat_core_predicate(Typed,1000,[use_chr_solver/true],_Core,Len,R),All), |
1384 | | length(All,Len), |
1385 | | min_member(MinL-Result,All), |
1386 | | format('~nFound ~w unsat cores, minimum number of conjuncts ~w~n',[Len,MinL]). |
1387 | | solve_using_smt_solver_aux('satsolver'(SOLVER,STATE),_,Typed,_LocalState,Result) :- !, % :sat |
1388 | | (STATE = nostate |
1389 | | -> b2sat:solve_predicate_with_satsolver_free(Typed,[],Result,[use_satsolver(SOLVER)]) |
1390 | | ; get_cur_state_for_repl(Typed,CState), |
1391 | ? | b2sat:solve_predicate_with_satsolver_in_state(Typed,CState,Result,[use_satsolver(SOLVER)]) |
1392 | | ). |
1393 | | solve_using_smt_solver_aux('prob-min-core',_,Typed,LocalState,Result) :- !, LocalState=[], |
1394 | | findall(core(Len,Sz,Core,R), |
1395 | | (unsat_core_predicate(Typed,1000,[use_chr_solver/true, |
1396 | | branch_and_bound,auto_time_out_factor(160),no_print],Core,Len,R), |
1397 | | term_size(Core,Sz)), |
1398 | | All), |
1399 | | length(All,Len), |
1400 | | min_member(core(MinL,_,MinCore,Result),All), |
1401 | | format(user_output,'~nFound ~w unsat cores~n% MINIMAL UNSAT CORE (~w conjuncts):~n',[Len,MinL]), |
1402 | | translate:nested_print_bexpr_as_classicalb(MinCore), |
1403 | | format(user_output,'% END OF MIN UNSAT CORE (~w conjuncts)~n',[MinL]). |
1404 | | solve_using_smt_solver_aux(Solver,Parameters,Typed,LocalState,Result) :- |
1405 | | (solver_call_should_ignore_state(Solver,Solver2) |
1406 | | -> solver_clash_feedback(Solver2,Parameters,Typed), |
1407 | | smt_solve_predicate(Solver2,Typed,LocalState,Result) |
1408 | | ; current_state_id(SID), SID \= root |
1409 | | -> smt_solve_predicate_in_state(SID,Solver,Typed,LocalState,Result) |
1410 | ? | ; smt_solve_predicate(Solver,Typed,LocalState,Result) |
1411 | | ). |
1412 | | |
1413 | | %is_already_declared_in_state(State,TID) :- def_get_texpr_id(TID,ID), member(bind(ID,_),State). |
1414 | | |
1415 | | solver_call_should_ignore_state(nostate(Solver),Solver). |
1416 | | solver_call_should_ignore_state('satsolver'(_,nostate),'satsolver'). |
1417 | | |
1418 | | % ------------- |
1419 | | % provide feedback when solver ignores variables/constants in current state |
1420 | | |
1421 | | solver_clash_feedback(Solver,Parameters,Typed) :- |
1422 | | current_state_id(SID), |
1423 | | potential_clash_in_state(Parameters,Typed,SID,Clashes), |
1424 | | Clashes \= [], |
1425 | | !, |
1426 | | (silent_mode(on) -> true |
1427 | | ; format_with_colour_nl(user_output,[dark_gray], |
1428 | | 'Calling solver ~w, ignoring values ~w in state ~w',[Solver,Clashes,SID])). |
1429 | | solver_clash_feedback(Solver,_,_) :- |
1430 | | debug_format(19,'Calling ~w solver via solve_predicate~n',[Solver]). |
1431 | | |
1432 | | potential_clash_in_state(_,_,root,IDs) :- !, IDs=[]. |
1433 | | potential_clash_in_state(Parameters,Typed,_StateID,IDs) :- |
1434 | | get_texpr_ids(Parameters,ParaIDs), |
1435 | | find_identifier_uses_top_level(Typed,UsedIds), |
1436 | | findall(ID,(member(ID,UsedIds), is_var_or_const(_,ID), nonmember(ID,ParaIDs)),IDs). |
1437 | | |
1438 | | is_var_or_const(constant,ID) :- bmachine:b_is_constant(ID). |
1439 | | is_var_or_const(variable,ID) :- bmachine:b_is_variable(ID). |
1440 | | |
1441 | | % ----------- |
1442 | | |
1443 | | :- use_module(probsrc(specfile),[get_state_for_b_formula/3]). |
1444 | | %:- use_module(probsrc(bsyntaxtree),[find_identifier_uses_top_level/2]). |
1445 | | |
1446 | | get_current_state_full_store(Typed, FullStore) :- |
1447 | | ( current_state_id(StateID) |
1448 | | -> get_state_for_b_formula(StateID, Typed, StateBindings) |
1449 | | ; StateBindings = [] |
1450 | | ), |
1451 | | find_identifier_uses_top_level(Typed, UsedIds), % do not include global sets |
1452 | | % add unbound variables for all used identifiers |
1453 | | findall(bind(Id,_), (member(Id, UsedIds), \+ member(bind(Id,_), StateBindings)), Bindings), |
1454 | | append(Bindings, StateBindings, FullStore). |
1455 | | |
1456 | | double_check_smt_result(Solver,_Parameters,Typed,_LocalState,solution(Bindings)) :- !, |
1457 | | maplist(get_bind,Bindings,State), |
1458 | | ( solver_call_should_ignore_state(Solver, Solver2) |
1459 | | -> find_identifier_uses_top_level(Typed, UsedIds), |
1460 | | findall(bind(IdName,_), (member(IdName,UsedIds), \+ member(bind(IdName,_),State)), FreeBindings), |
1461 | | append(State, FreeBindings, FullStore) |
1462 | | ; Solver2 = Solver, |
1463 | | get_current_state_full_store(Typed, TFullStore), |
1464 | | findall(bind(IdName,_), (member(bind(IdName,_),TFullStore), \+ member(bind(IdName,_),State)), TFullStore2), |
1465 | | append(State, TFullStore2, FullStore) |
1466 | | ), |
1467 | | debug_format(19,'Double-checking ~w with ProB solver using solve_predicate~n',[Solver]), |
1468 | | %print(bindings(Bindings)),nl, |
1469 | | (solve_predicate(Typed,FullStore,DCResult), %print(DCResult),nl, |
1470 | | check_dc_sol(DCResult,Solver2,solution(_)) -> true |
1471 | | ; add_error(double_check_smt_result,'Double checking NOT successful, solution not confirmed: ',Typed,Typed)). |
1472 | | double_check_smt_result(Solver,_Parameters, Typed, _LocalState, Res) :- |
1473 | | ( solver_call_should_ignore_state(Solver, Solver2) |
1474 | | -> % FullStore is var |
1475 | | debug_format(19,'Double checking result of ~w with ProB solver (ignoring current state)~n',[Solver2]) |
1476 | | ; get_current_state_full_store(Typed, FullStore), |
1477 | | Solver2 = Solver, |
1478 | | debug_format(19,'Double checking result with of ~w ProB solver (in current state)~n',[Solver2]) |
1479 | | ), |
1480 | | ( solve_predicate(Typed, FullStore, TDCResult) |
1481 | | -> DCResult = TDCResult |
1482 | | ; % solve_predicate did fail if contradiction with current state |
1483 | | % should no longer happen |
1484 | | add_warning(double_check_smt_result,'solve_predicate failed: ',Typed, Typed), |
1485 | | DCResult = contradiction_found |
1486 | | ), |
1487 | | ( check_dc_sol(DCResult, Solver2, Res) |
1488 | | -> true |
1489 | | ; add_error(double_check_smt_result,'Double checking NOT successful', Typed, Typed) |
1490 | | ). |
1491 | | |
1492 | | get_bind(binding(Var,Val,_PP),bind(Var,Val)). |
1493 | | get_bind(bind(Var,Val),bind(Var,Val)). |
1494 | | |
1495 | | check_dc_sol(X,_,X) :- !, print_green('double check ok'),nl. |
1496 | | check_dc_sol(no_solution_found(unfixed_deferred_sets),_,contradiction_found) :- |
1497 | | % Z3, CDCL(T) do not check for unfixed_deferred sets; see test 2060 |
1498 | | !, print_green('double check of contradiction_found ok'),nl. |
1499 | | check_dc_sol(X,Solver,E) :- |
1500 | | format_with_colour_nl(user_error,[red,bold], |
1501 | | 'double check unexpected result, ProB reported: ~w,~n ~w reported: ~w',[X,Solver,E]), |
1502 | | fail. |
1503 | | |
1504 | | display_smt_result(solution(Bindings),Parameters,ExTyped,Res) :- !, |
1505 | | set_last_expression(pred,ExTyped,pred_true), |
1506 | | print_green('TRUE'),nl, |
1507 | | ( Bindings=[] |
1508 | | -> set_last_solution(Parameters,[]) |
1509 | | ; silent_mode(off), write('Solution: '),nl,Bindings=[bind(_,_)|_] |
1510 | | -> print_visible_solution_with_type(Parameters, Bindings), |
1511 | | set_last_solution(Parameters,Bindings) |
1512 | | ; Bindings = [bind(_,_)|_] -> set_last_solution(Parameters,Bindings) |
1513 | | ; findall(bind(ID,Val),member(binding(ID,Val,_),Bindings),LocalState), |
1514 | | set_last_solution(Parameters,LocalState), |
1515 | | findall(1,(member(binding(ID2,_,S2),Bindings),print_binding(ID2,S2),nl),_) |
1516 | | ), Res = 'TRUE'. |
1517 | | display_smt_result(contradiction_found,_,ExTyped,Res) :- !, |
1518 | | format_with_colour(user_output,[light_red],'FALSE',[]),nl, |
1519 | | set_last_expression(pred,ExTyped,pred_false), |
1520 | | Res = 'FALSE'. |
1521 | | display_smt_result(contradiction_found(UnsatCore),_,ExTyped,Res) :- !, |
1522 | | display_smt_result(contradiction_found,_,ExTyped,'FALSE'), |
1523 | | translate_bexpression(UnsatCore, PrettyUnsatCore), |
1524 | | format_with_colour_nl(user_output,[dark_gray],'Unsat Core: ~w',[PrettyUnsatCore]), |
1525 | | Res = 'FALSE'. |
1526 | | display_smt_result(no_solution_found(no_idl_constraint),_,_,'UNKNOWN') :- !, |
1527 | | print_red('UNKNOWN: '),nl, |
1528 | | format_with_colour_nl(user_output,[light_red],'Constraint can not be transformed to integer difference logic.',[]). |
1529 | | display_smt_result(no_solution_found(cvc4_unknown),_,ExTyped,'UNKNOWN') :- !, |
1530 | | print_red('UNKNOWN'),nl, |
1531 | | set_last_expression(pred,ExTyped,unknown). |
1532 | | display_smt_result(no_solution_found(Reason),_,ExTyped,'UNKNOWN') :- !, |
1533 | | print_red('UNKNOWN: '),print(Reason),nl, |
1534 | | set_last_expression(pred,ExTyped,unknown). |
1535 | | display_smt_result(error,_,ExTyped,'UNKNOWN') :- !, |
1536 | | print_red('UNKNOWN: '),print('(due to error, possibly well-definedness error)'),nl, |
1537 | | set_last_expression(pred,ExTyped,unknown). |
1538 | | display_smt_result(Other,_,ExTyped,'UNKNOWN') :- !, |
1539 | | print_red('*** UNKNOWN SMT RESULT ***: '),print(Other),nl, |
1540 | | set_last_expression(pred,ExTyped,unknown). |
1541 | | |
1542 | | |
1543 | | %:- use_module(bsyntaxtree,[def_get_texpr_id/2]). |
1544 | | print_parameters([]). |
1545 | | print_parameters([TID]) :- !, print_id(TID). |
1546 | | print_parameters([TID|T]) :- print_id(TID), print(','), print_parameters(T). |
1547 | | print_id(TID) :- def_get_texpr_id(TID,ID), print(ID). |
1548 | | |
1549 | | |
1550 | | |
1551 | | %indent(X) :- X<1,!. |
1552 | | %indent(X) :- print('+ '), X1 is X-1, indent(X1). |
1553 | | |
1554 | | % TOOLS |
1555 | | % ----- |
1556 | | |
1557 | | |
1558 | | % detecting existential quantifiers: so that the REPL can print the solutions for them |
1559 | | % an example is the following test: |
1560 | | % probcli -eval "#active,ready,waiting,rr.(active : POW(PID) & ready : POW(PID) & waiting : POW(PID) & active <: PID & ready <: PID & waiting <: PID & (ready /\ waiting = {}) & (active /\ (ready \/ waiting)) = {} & card(active) <= 1 & rr : waiting & active = {})" ../prob_examples/public_examples/B/Benchmarks/scheduler.mch |
1561 | | % alternative would be to avoid optimizer to run at top-level |
1562 | | is_existential_quantifier(TE,Par,Body) :- is_existential_quantifier(TE,recur,Par,Body). |
1563 | | is_existential_quantifier(b(EXISTS,pred,_),Recur,FullParameters,FullTypedBody) :- |
1564 | | is_existential_aux(EXISTS,Parameters,TypedBody), |
1565 | | !, |
1566 | | (Recur=recur, |
1567 | | is_existential_quantifier(TypedBody,Recur,InnerPar,InnerBody) % recursively look inside |
1568 | | -> append(Parameters,InnerPar,FullParameters), |
1569 | | FullTypedBody = InnerBody |
1570 | | ; FullTypedBody = TypedBody, FullParameters=Parameters). |
1571 | | is_existential_aux(Var,_,_) :- var(Var),!, add_internal_error('Illegal call:',is_existential_aux(Var,_,_)),fail. |
1572 | | is_existential_aux(exists(Parameters,TypedBody),Parameters,TypedBody). |
1573 | | is_existential_aux(let_predicate(Parameters,AssignmentExprs,Pred),Parameters,TypedBody) :- |
1574 | | generate_let_equality_pred(Parameters,AssignmentExprs,EqPreds), |
1575 | | append(EqPreds,[Pred],AllPreds), |
1576 | | conjunct_predicates(AllPreds,TypedBody). |
1577 | | is_existential_aux(conjunct(A,B),Parameters,TypedBody) :- |
1578 | | is_existential_quantifier(A,no_recur,Parameters,TAA), |
1579 | | !, % then do not look if B is existential quantifier below |
1580 | | b_ast_cleanup:get_sorted_ids(Parameters,SIds), |
1581 | | b_ast_cleanup:not_occurs_in_predicate(SIds,B), |
1582 | | \+ is_existential_quantifier(B,no_recur,_,_), |
1583 | | conjunct_predicates([TAA,B],TypedBody),!. |
1584 | | is_existential_aux(conjunct(A,B),Parameters,TypedBody) :- |
1585 | | is_existential_quantifier(B,no_recur,Parameters,TBB), |
1586 | | !, |
1587 | | b_ast_cleanup:get_sorted_ids(Parameters,SIds), |
1588 | | b_ast_cleanup:not_occurs_in_predicate(SIds,A), |
1589 | | conjunct_predicates([A,TBB],TypedBody). |
1590 | | % TO DO: treat lazy_let_pred |
1591 | | |
1592 | | generate_let_equality_pred([],[],[]). |
1593 | | generate_let_equality_pred([ID|T],[Exp|TE],[EqPred|TR]) :- |
1594 | | EqPred = b(equal(ID,Exp),pred,[]), % TO DO: update WD info |
1595 | | generate_let_equality_pred(T,TE,TR). |
1596 | | |
1597 | | |
1598 | | |
1599 | | :- use_module(clpfd_interface,[clpfd_overflow_error_message/0]). |
1600 | | |
1601 | | |
1602 | | :- use_module(tools_meta,[call_residue/2]). |
1603 | | :- use_module(clpfd_interface,[catch_clpfd_overflow_call2/2]). |
1604 | | probcli_clpfd_overflow_mnf_call1(Call) :- |
1605 | | call_residue(probcli_clpfd_overflow_mnf_call2(Call),Residue), |
1606 | | check_residue(Residue). |
1607 | | probcli_clpfd_overflow_mnf_call2(Call) :- start_timer(T1,WT1), |
1608 | | catch_clpfd_overflow_call2( |
1609 | | (Call->stop_timer(T1,WT1) |
1610 | | ; stop_timer('% ProB evaluation: ',T1,WT1),show_error_pos, |
1611 | | print_red('Expression not well-defined !'),nl, |
1612 | | fail), |
1613 | | ( stop_timer('% ProB evaluation: ',T1,WT1),clpfd_overflow_error_message, fail)). |
1614 | | |
1615 | | |
1616 | | |
1617 | | probcli_clpfd_overflow_call1(Call) :- |
1618 | | call_residue(probcli_clpfd_overflow_call2(Call),Residue), |
1619 | | check_residue(Residue). |
1620 | | probcli_clpfd_overflow_call2(Call) :- start_timer(T1,WT1), |
1621 | | catch_clpfd_overflow_call2( |
1622 | | (Call -> stop_timer(T1,WT1) ; stop_timer(T1,WT1),fail), |
1623 | | ( stop_timer(T1,WT1),clpfd_interface:clpfd_overflow_error_message, fail)). |
1624 | | |
1625 | | check_residue([]) :- !. |
1626 | | check_residue(Residue) :- |
1627 | | add_internal_error('Call residue: ',Residue), |
1628 | | portray_residue(Residue). % or tools_printing:print_goal(Residue) |
1629 | | portray_residue(L) :- gen_clause(L,C), portray_clause((residue :- C)). |
1630 | | gen_clause([],true). |
1631 | | gen_clause([X],X) :- !. |
1632 | | gen_clause([H|T],(H,R)) :- gen_clause(T,R). |
1633 | | |
1634 | | :- volatile last_eval_time/2. |
1635 | | :- dynamic last_eval_time/2. |
1636 | | start_timer(T1,WT1) :- retractall(last_eval_time(_,_)), retractall(last_norm_time(_,_)), |
1637 | | statistics(runtime,[T1,_]), |
1638 | | statistics(walltime,[WT1,_]). |
1639 | | stop_timer(T1,WT1) :- |
1640 | | statistics(runtime,[T2,_]), TotTime is T2-T1, |
1641 | | statistics(walltime,[WT2,_]), WTotTime is WT2-WT1, |
1642 | | retractall(last_eval_time(_,_)), |
1643 | | %debug_println(20,stopped_timer(TotTime,T2,T1)), |
1644 | | (debug_mode(off) -> true |
1645 | | ; format_with_colour_nl(user_output,[dark_gray],'stopped timer ~w ms (~w ms walltime).',[TotTime,WTotTime])), |
1646 | | assertz(last_eval_time(TotTime,WTotTime)). |
1647 | | stop_timer(Msg,T1,WT1) :- |
1648 | | statistics(runtime,[T2,_]), TotTime is T2-T1, |
1649 | | statistics(walltime,[WT2,_]), WTotTime is WT2-WT1, |
1650 | | format_with_colour_nl(user_output,[dark_gray],'~w ~w ms (~w ms walltime).',[Msg,TotTime,WTotTime]), |
1651 | | assertz(last_eval_time(TotTime,WTotTime)). |
1652 | | |
1653 | | :- volatile last_norm_time/2. |
1654 | | :- dynamic last_norm_time/2. |
1655 | | start_norm_timer(T1,WT1) :- retractall(last_norm_time(_,_)), |
1656 | | statistics(runtime,[T1,_]), |
1657 | | statistics(walltime,[WT1,_]). |
1658 | | stop_norm_timer(T1,WT1) :- |
1659 | | statistics(runtime,[T2,_]), TotTime is T2-T1, |
1660 | | statistics(walltime,[WT2,_]), WTotTime is WT2-WT1, |
1661 | | retractall(last_norm_time(_,_)), |
1662 | | debug_println(20,stopped_norm_timer(TotTime,T2,T1)), |
1663 | | assertz(last_norm_time(TotTime,WTotTime)). |
1664 | | |
1665 | | |
1666 | | :- volatile eval_mode/1. |
1667 | | :- dynamic eval_mode/1. |
1668 | | eval_det :- eval_mode(eval_det). |
1669 | | |
1670 | | toggle_eval_det :- retract(eval_mode(_)),!, |
1671 | | format('% Going back to ordinary enumeration~n',[]). |
1672 | | toggle_eval_det :- set_eval_det, |
1673 | | format('% Going to deterministic mode (for existentially quantified formulas)~n',[]). |
1674 | | |
1675 | | set_eval_det :- set_eval_mode(eval_det). |
1676 | | set_eval_mode(M) :- retractall(eval_mode(_)), assertz(eval_mode(M)). |
1677 | | unset_eval_mode :- retractall(eval_mode(_)). |
1678 | | |
1679 | | eval_ground_wf(WF) :- (eval_det -> ground_det_wait_flag(WF) ; ground_wait_flags(WF)). |
1680 | | |
1681 | | |
1682 | | |
1683 | | |
1684 | | |
1685 | | show_error_pos :- |
1686 | | %File = null, % console text typed by user |
1687 | | findall(error_pos(Line,Col,EndLine,EndCol), |
1688 | | (check_error_span_file_linecol(_Src,File,Line,Col,EndLine,EndCol), file_unknown(File)), |
1689 | | Errs), |
1690 | | !, |
1691 | | remove_dups(Errs,Errs2), |
1692 | | LastLine is -100, show_error_pos(Errs2,LastLine). |
1693 | | |
1694 | | file_unknown(null). |
1695 | | file_unknown(unknown(_)). |
1696 | | file_unknown(unknown). |
1697 | | |
1698 | | :- use_module(tools_printing,[start_terminal_colour/2, reset_terminal_colour/1]). |
1699 | | show_line(Line,FromCol,ToCol) :- % highlight if possible FromCol ToCol, Columns start at 0, ToCol is not included ?! |
1700 | | % TO DO: handle multiple errors on line |
1701 | | (current_codes(E),get_line(E,Line,ErrLine) |
1702 | | -> append(ErrLine,[32],Errline2), % add one whitespace at end |
1703 | | prefix_length(Errline2,Prefix,FromCol), |
1704 | | format(user_output,'~n### ~s',[Prefix]), |
1705 | | Len is ToCol - FromCol, |
1706 | | sublist(Errline2,ErrStr,FromCol,Len,_), |
1707 | | % start_terminal_colour([red_background,white,bold],user_output), |
1708 | | start_terminal_colour([red,underline,bold],user_output), |
1709 | | format(user_output,'~s',[ErrStr]), % Print Error Part in RED |
1710 | | reset_terminal_colour(user_output), |
1711 | ? | sublist(Errline2,Suffix,ToCol,_,0), |
1712 | | format(user_output,'~s~n',[Suffix]) |
1713 | | ; true). |
1714 | | show_line(Line) :- |
1715 | | (current_codes(E),get_line(E,Line,ErrLine) |
1716 | | -> format('~n### ~s~n',[ErrLine]) |
1717 | | ; true). |
1718 | | show_error_pos([],_). |
1719 | | show_error_pos([error_pos(Line,Col,EL,EC)|T],LastLine) :- % print(pos(Line,Col,EL,EC)),nl, |
1720 | | % first display source code of line with error: |
1721 | ? | (LastLine==Line -> true ; EL==Line,show_line(Line,Col,EC) -> true ; show_line(Line)), |
1722 | | print('### '), indent_ws(Col), |
1723 | | (EL=Line,EC>Col -> Len is EC-Col ; Len=1), |
1724 | | underline(Len),nl, |
1725 | | (Line>1 -> print('### Line: '), print(Line), |
1726 | | print(' Column: '), print(Col),nl |
1727 | | ; true), |
1728 | | show_error_pos(T,Line). |
1729 | | |
1730 | | indent_ws(X) :- X<1,!. |
1731 | | indent_ws(X) :- print(' '), X1 is X-1, indent_ws(X1). |
1732 | | underline(0) :- !. |
1733 | | underline(N) :- N>0, print('^'), N1 is N-1, underline(N1). |
1734 | | |
1735 | | get_line(_,Nr,R) :- Nr<1,!,R=[]. |
1736 | | get_line([],_,R) :- !, R=[]. |
1737 | | get_line(Codes,Nr,Res) :- is_newline(Codes,T),!, N1 is Nr-1, get_line(T,N1,Res). |
1738 | | get_line([H|T],1,Res) :- !, Res=[H|RT], get_line(T,1,RT). |
1739 | | get_line([_H|T],Nr,Res) :- get_line(T,Nr,Res). |
1740 | | |
1741 | | is_newline([10,13|T],T). |
1742 | | is_newline([10|T],T). |
1743 | | is_newline([13|T],T). |
1744 | | |
1745 | | %%%%% to show error position in Tcl/Tk console %%%%% |
1746 | | get_error_positions(EPos) :- |
1747 | | findall(error_pos(Line,Col,EndLine,EndCol),check_error_span_file_linecol(_Src,_File,Line,Col,EndLine,EndCol),Errs),!, |
1748 | | get_error_position_string_l(Errs,EPos). |
1749 | | |
1750 | | get_error_position_string_l(List,EPos) :- |
1751 | | maplist(get_error_position,List,StringList), |
1752 | | haskell_csp:convert_string_list_to_string(StringList,EPos). |
1753 | | |
1754 | | get_error_position(error_pos(Line,Col,EL,EC),String) :- |
1755 | | ((current_codes(E),get_line(E,Line,ErrLine)) |
1756 | | -> atom_codes(N,ErrLine), |
1757 | | atom_concat('### ',N, FirstLineAtom), |
1758 | | atom_concat(FirstLineAtom,';',FirstLineAtom1) |
1759 | | ; FirstLineAtom1 = '### ;'), |
1760 | | get_ident_ws(Col,'',WS), |
1761 | | (EL=Line,EC>Col -> Len is EC-Col ; Len=1), |
1762 | | get_underlines(Len,'',Underlines), |
1763 | | atom_concat('### ',WS,SecondLineAtom), |
1764 | | atom_concat(SecondLineAtom,Underlines,SecondLineAtom1), |
1765 | | atom_concat(SecondLineAtom1,';',SecondLineAtom2), |
1766 | | atom_concat(FirstLineAtom1,SecondLineAtom2,String). |
1767 | | |
1768 | | get_ident_ws(X,WS,WS) :- |
1769 | | X<1,!. |
1770 | | get_ident_ws(X,WS,Res) :- |
1771 | | atom_concat(WS,' ',WS1), |
1772 | | X1 is X-1, |
1773 | | get_ident_ws(X1,WS1,Res). |
1774 | | |
1775 | | get_underlines(0,U,U) :- !. |
1776 | | get_underlines(X,U,Res) :- |
1777 | | X>0, |
1778 | | atom_concat(U,'^',U1), |
1779 | | X1 is X-1, |
1780 | | get_underlines(X1,U1,Res). |
1781 | | |
1782 | | :- volatile last_expression/2, last_expression_value/1. |
1783 | | :- dynamic last_expression/2, last_expression_value/1. |
1784 | | last_expression(Type,Expr,Value) :- |
1785 | | last_expression(Type,Expr), last_expression_value(Value). |
1786 | | set_last_expression(Type,Expr,Value) :- |
1787 | | clear_last_expression, %print(assert),debug:nl_time, |
1788 | | assertz(last_expression(Type,Expr)), |
1789 | | % can be expensive; we could pack the value: mypack(Value,PackedValue),debug:nl_time, |
1790 | | PackedValue=Value, |
1791 | | assertz(last_expression_value(PackedValue)). % print(done),debug:nl_time. |
1792 | | |
1793 | | %mypack(Atom,PVal) :- atom(Atom),!,PVal=Atom. |
1794 | | %mypack(Val,PVal) :- state_packing:pack_value(Val,PVal). |
1795 | | |
1796 | | last_expression_type(Type) :- last_expression(Type,_). |
1797 | | |
1798 | | clear_last_expression :- |
1799 | | retractall(last_expression(_,_)), retractall(last_expression_value(_)). |
1800 | | |
1801 | | %:- use_module(bsyntaxtree,[get_texpr_type/2]). |
1802 | | |
1803 | | %print_last_info :- stream_property(A,mode(M)), write(open_stream(A,M)),nl,fail. |
1804 | | print_last_info :- \+ last_expression(_,_Expr),!, |
1805 | | print_red('Please evaluate an expression or predicate first.'),nl. |
1806 | | print_last_info :- last_expression(Type,Expr), |
1807 | | % for insertion into unit tests |
1808 | | print('% Type: '), print_quoted(Type), |
1809 | | (Type=expr,get_texpr_type(Expr,ET),pretty_type(ET,PrettyType) |
1810 | | -> print(' : '), print(PrettyType), |
1811 | | print(' [Card='), |
1812 | | (max_cardinality(ET,Card) -> print(Card) ; print('??')), print(']') |
1813 | | ; true),nl, |
1814 | | |
1815 | | print('% Eval Time: '), |
1816 | | (last_eval_time(Time,WTime) |
1817 | | -> format('~w ms (~w ms walltime)',[Time,WTime]), |
1818 | | (last_norm_time(NTime,NWTime) |
1819 | | -> format(' + Normalisation: ~w ms (~w ms walltime)',[NTime,NWTime]) |
1820 | | ; true), |
1821 | | (last_expansion_time(EWT) -> format(' + State expansion: ~w ms walltime',[EWT]) ; true) |
1822 | | ; print_red('*UNKNOWN*') |
1823 | | ),nl. |
1824 | | |
1825 | | |
1826 | | print_last_value :- \+ last_expression(_,_Expr),!, |
1827 | | print_red('Please evaluate an expression or predicate first.'),nl. |
1828 | | print_last_value :- last_expression_value(Value), |
1829 | | print('Last Expression Value = '),nl, |
1830 | | translate:print_bvalue(Value),nl. |
1831 | | |
1832 | | print_last_expression :- \+ last_expression(_,_Expr),!, |
1833 | | print_red('Please evaluate an expression or predicate first.'),nl. |
1834 | | print_last_expression :- last_expression(_Type,Expr,Value), |
1835 | | print_last_info, |
1836 | | print('% '), translate:print_bexpr(Expr),nl, |
1837 | | (Value = false -> print_quoted(must_fail_det(1,"",Expr)),print('.'),nl |
1838 | | ; print_quoted(Expr),nl, |
1839 | | print('% = '),print_quoted(Value),nl). |
1840 | | |
1841 | | indent_print_last_expression :- \+ last_expression(_,_Expr),!, |
1842 | | print_red('Please evaluate an expression or predicate first.'),nl. |
1843 | | indent_print_last_expression :- last_expression(_Type,Expr), |
1844 | | nested_print_bexpr(Expr). |
1845 | | |
1846 | | nested_print_repl_expression(Typed) :- |
1847 | | set_unicode_mode, temporary_set_preference(pp_with_terminal_colour,true,C), |
1848 | | call_cleanup((nested_print_bexpr(Typed),nl), |
1849 | | (unset_unicode_mode, reset_temporary_preference(pp_with_terminal_colour,C))). |
1850 | | print_component(component(Pred,Ids)) :- format('Component over ~w :~n',[Ids]), translate:print_bexpr(Pred),nl. |
1851 | | |
1852 | | :- use_module(extrasrc(unsat_cores),[unsat_core_wth_auto_time_limit/5, quick_bup_core/4]). |
1853 | | unsat_core_last_expression :- \+ last_expression(pred,_Expr),!, |
1854 | | print_red('Please evaluate a predicate first.'),nl. |
1855 | | unsat_core_last_expression :- \+ last_expression(pred,_Expr,pred_false),!, |
1856 | | print('The UNSAT CORE can only be computed for false predicates.'),nl. |
1857 | | unsat_core_last_expression :- last_expression(pred,Expr), |
1858 | | last_eval_time(_Time,WTime), |
1859 | | unsat_core_predicate(Expr,WTime,[use_chr_solver/true],_,_,_). % we could use without auto |
1860 | | |
1861 | | unsat_core_predicate(Pred,MaxTimeOut,Options,Core,Len,Result) :- |
1862 | | start_timer(T1,W1), |
1863 | | print('% COMPUTING UNSAT CORE: '), translate:print_bexpr(Pred),nl, |
1864 | | % maybe strip top-level existential quantifier |
1865 | ? | unsat_core_wth_auto_time_limit(Pred,MaxTimeOut,Options,Result,Core), |
1866 | | nl,stop_timer('% Time to compute core: ',T1,W1), |
1867 | | print_unsat_core(Pred,Core,Options,Result,Len). |
1868 | | |
1869 | | |
1870 | | quick_bup_unsat_core_predicate(Pred,Options,Result) :- |
1871 | | start_timer(T1,W1), |
1872 | | print('% Trying to compute UNSAT CORE in bottom-up fashion: '), translate:print_bexpr(Pred),nl, |
1873 | | quick_bup_core(Pred,Options,Core,Result),!, |
1874 | | nl,stop_timer('% Time to compute core: ',T1,W1), |
1875 | | print_unsat_core(Pred,Core,Options,Result,_). |
1876 | | quick_bup_unsat_core_predicate(_,_,'UNKNOWN') :- |
1877 | | print('% No unsat core found in bottom-up fashion. Use regular unsat core instead.'),nl. |
1878 | | |
1879 | | |
1880 | | print_unsat_core(Pred,Core,Options,Result,Len) :- |
1881 | | size_of_conjunction(Pred,OrigSize), |
1882 | | length(Core,Len), |
1883 | | (member(no_print,Options) -> true |
1884 | | ; format('% UNSAT CORE (~w conjuncts out of ~w): ~w~n',[Len,OrigSize,Result]), |
1885 | | translate:nested_print_bexpr_as_classicalb(Core), |
1886 | | format('% END OF UNSAT CORE (~w conjuncts)~n',[Len]) |
1887 | | ). |
1888 | | |
1889 | | % test that we obtain same value with pretty-printed version of last expression: |
1890 | | recheck_pp_of_last_expression(_,_,_) :- \+ last_expression(_,_Expr),!, |
1891 | | print_red('Please evaluate an expression or predicate first.'),nl. |
1892 | | recheck_pp_of_last_expression(Mode,NewResult,EnumWarning) :- last_expression(_Type,Expr,Value), |
1893 | | translate_subst_or_bexpr_in_mode(Mode,Expr,Str), % Mode=unicode or ascii |
1894 | | translate_bvalue(Value,ExpectedRes), |
1895 | | format('Rechecking pretty-printed version of last formula (expecting ~w): ~w~n',[ExpectedRes,Str]), |
1896 | | (eval_string(Str,NewResult,EnumWarning) |
1897 | | -> (NewResult = ExpectedRes -> print_green('OK'),nl |
1898 | | ; add_error(recheck_pp_of_last_expression,'Unexpected result: ',NewResult), |
1899 | | last_expression(_Type2,Expr2), |
1900 | | translate_subst_or_bexpr_in_mode(Mode,Expr2,Str2), |
1901 | | format(' Re-Pretty-printed version of re-checked formula: ~w~n',[Str2])) |
1902 | | ; add_error(recheck_pp_of_last_expression,'Evaluation failed:',Str), |
1903 | | NewResult='FAIL', EnumWarning=false |
1904 | | ). |
1905 | | |
1906 | | :- use_module(library(system)). |
1907 | | add_last_expression_to_unit_tests :- \+ last_expression(_,_Expr),!, |
1908 | | print_red('Please evaluate an expression or predicate first.'),nl. |
1909 | | add_last_expression_to_unit_tests :- last_expression(Type,Expr,Value), |
1910 | | open_unit_test_file(S), !, write(S,' & '), nl(S), write(S,' ( '), |
1911 | | (print_unit_test_assertion(Type,Expr,Value,S) -> true ; print('PRINTING FAILED'),nl), |
1912 | | write(S,' ) '), datime(datime(Yr,Mon,Day,Hr,Min,_Sec)), |
1913 | | format(S,'/* ~w/~w/~w ~w:~w */',[Day,Mon,Yr,Hr,Min]), |
1914 | | nl(S), close(S). |
1915 | | add_last_expression_to_unit_tests :- print('Could not save expression to unit test file ($PROB_EX_DIR/B/Laws/REPL_UNIT_TESTS.def).'),nl. |
1916 | | |
1917 | | open_unit_test_file(S) :- |
1918 | | environ('PROB_EX_DIR',Dir), |
1919 | | atom_concat(Dir,'/B/Laws/REPL_UNIT_TESTS.def',REPLFILE), |
1920 | | print(opening(REPLFILE)),nl, |
1921 | | my_open(REPLFILE,append,S). |
1922 | | |
1923 | | |
1924 | | my_open(File,Mode,S) :- |
1925 | | catch(open(File,Mode,S), |
1926 | | error(existence_error(_,_),E), |
1927 | | add_error_fail(my_open,'File does not exist: ',File:E)). |
1928 | | |
1929 | | %:- use_module(bsyntaxtree,[create_texpr/4, safe_create_texpr/4]). |
1930 | | print_unit_test_assertion(pred,Typed,true,S) :- |
1931 | | print_bexpr_stream(S,Typed). |
1932 | | print_unit_test_assertion(pred,Typed,false,S) :- |
1933 | | safe_create_texpr(negation(Typed),pred,[],Neg), |
1934 | | print_bexpr_stream(S,Neg). |
1935 | | print_unit_test_assertion(expr,Typed,Val,S) :- |
1936 | | print_bexpr_stream(S,Typed), write(S,' = '), print_bvalue_stream(S,Val). |
1937 | | |
1938 | | |
1939 | | :- use_module(tools_printing,[print_term_summary/1]). |
1940 | | portray_waitflags_and_frozen_state_info(WF,StateTerm) :- |
1941 | | portray_waitflags(WF), |
1942 | | print_term_summary(frozen_info_for_state(StateTerm)), |
1943 | | term_variables(StateTerm,Vars), |
1944 | | translate:l_print_frozen_info(Vars). |
1945 | | |
1946 | | %% Utilities for defining values inside the REPL using let : |
1947 | | % ---------------------- |
1948 | | % scanning code utilities to recognize let construct |
1949 | | scan_identifier([32|T],ID,Rest) :- scan_identifier(T,ID,Rest). |
1950 | ? | scan_identifier([H|T],[H|TID],Rest) :- letter(H), |
1951 | ? | scan_identifier2(T,TID,Rest). |
1952 | | scan_identifier2([],[],[]). |
1953 | | scan_identifier2([32|T],[],T). |
1954 | | scan_identifier2([61|T],[],[61|T]). |
1955 | ? | scan_identifier2([H|T],[H|TID],Rest) :- ( letter(H) ; H = 95 ; H=45 ; digit(H)), |
1956 | ? | scan_identifier2(T,TID,Rest). |
1957 | | letter(X) :- (X >= 97, X =< 122) ; (X >= 65, X=< 90). % underscore = 95, minus = 45 |
1958 | | digit(X) :- X >= 48, X =< 57. |
1959 | | |
1960 | | scan_to_equal([32|T],Rest) :- scan_to_equal(T,Rest). |
1961 | | scan_to_equal([61|T],T). % "=" = [61] |
1962 | | |
1963 | | just_whitespace([32|T]) :- just_whitespace(T). |
1964 | | just_whitespace([]). |
1965 | | |
1966 | | store_let_id_last_value(ID) :- |
1967 | | retract_stored_let_value(ID,LastType,_), |
1968 | | !, |
1969 | | get_last_value(ID,Type,Value), %print(updating(ID)),nl, |
1970 | | add_stored_let_value(ID,Type,Value), |
1971 | | (LastType=Type -> true |
1972 | | ; reset_parse_cache). % type has changed |
1973 | | store_let_id_last_value(ID) :- |
1974 | | get_cur_state_for_repl(b(truth,pred,[]),State), member(bind(ID,_),State),!, |
1975 | | add_error(store_let_id_last_value,'Cannot redefine existing identifier using let: ',ID). |
1976 | | store_let_id_last_value(ID) :- |
1977 | | get_last_value(ID,Type,Value), |
1978 | | add_stored_let_value(ID,Type,Value), |
1979 | | reset_parse_cache. |
1980 | | |
1981 | | % construct the scope that the typechecker will use |
1982 | | repl_typing_scope([IdScope,prob_ids(visible),S|L]) :- % promoted if we allow operation_call_in_expr |
1983 | | get_stored_let_typing_scope(IdScope), % identifier(Ids) |
1984 | | !, |
1985 | | get_main_repl_scope(S),external_libraries(L). |
1986 | | repl_typing_scope([prob_ids(visible),S|L]) :- get_main_repl_scope(S),external_libraries(L). |
1987 | | |
1988 | | external_libraries([external_library(all_available_libraries)]). |
1989 | | |
1990 | | get_main_repl_scope(assertions_scope) :- get_preference(allow_operation_calls_in_expr,true),!. |
1991 | | get_main_repl_scope(variables). |
1992 | | |
1993 | | get_last_value(ID,Type,Value) :- % first try and see if we had a predicate with identifier ID |
1994 | | get_last_predicate_value_for_id(ID,T,V), |
1995 | | !, |
1996 | | Type=T, Value=V. |
1997 | | get_last_value(_ID,Type,Value) :- get_last_expr_type_and_value(_,Type,Value). |
1998 | | |
1999 | | get_last_expr_type_and_value(Expr,Type,Value) :- |
2000 | | last_expression(_,Expr,V), |
2001 | | get_texpr_type(Expr,T), |
2002 | | convert_result(T,V,Type,Value). |
2003 | | |
2004 | | % display information about stored lets |
2005 | | browse_repl_lets :- \+ \+ stored_let_value(_,_,_), |
2006 | | print('Available let definitions:'),nl, |
2007 | | stored_let_value(ID,_,Value), |
2008 | | translate_bvalue_with_limit_and_col(Value,50,VS), |
2009 | | format(' ~w = ~w~n',[ID,VS]), |
2010 | | fail. |
2011 | | browse_repl_lets. |
2012 | | |
2013 | | get_repl_lets_info(Lets) :- |
2014 | | findall(S, (stored_let_value(ID,_,Value), |
2015 | | translate_bvalue_with_limit_and_col(Value,50,VS), |
2016 | | ajoin([ID,' = ',VS,'\n'],S)), |
2017 | | Lets). |
2018 | | |
2019 | | get_repl_lets_tids(List) :- |
2020 | | findall(b(identifier(ID),Type,[repl_let]), stored_let_value(ID,Type,_),List). |
2021 | | |
2022 | | |
2023 | | list_information(INFO,Res,[INFO/BList]) :- !, |
2024 | | external_functions:'PROJECT_INFO'(string(INFO),BList,unknown,no_wf_available), |
2025 | | !, |
2026 | | translate_bvalue_with_limit_and_col(BList,5000,Res), |
2027 | | format('~w~n',[Res]). |
2028 | | list_information(Arg,Res,[]) :- add_error(eval_strings,'Unknown argument for :list: ',Arg), |
2029 | | Res='ERROR'. |
2030 | | |
2031 | | |
2032 | | :- use_module(eventhandling,[register_event_listener/3]). |
2033 | | :- register_event_listener(clear_specification,reset_eval_strings, |
2034 | | 'Reset REPL (lets, caches, ...)'). |
2035 | | |
2036 | | reset_eval_strings :- clear_last_expression, |
2037 | | retractall(last_solution(_,_)), |
2038 | | reset_parse_cache, |
2039 | | set_observe_evaluation(false), |
2040 | | retractall(eval_dot_file(_)), |
2041 | | retractall(stored_let_value(_,_,_)), |
2042 | | retractall(eval_repeat(_)), |
2043 | | unset_eval_mode, |
2044 | | (reset_required -> true ; assertz(reset_required)). % before next evaluation we need to remove invalid lets |
2045 | | |
2046 | | reset_parse_cache :- |
2047 | | retractall(parse_expr_cache(_,_,_,_,_)), |
2048 | | retractall(parse_pred_cache(_,_,_,_,_)). |
2049 | | |
2050 | | :- dynamic reset_required/0. |
2051 | | |
2052 | | reset_repl_lets :- retract(reset_required),!, |
2053 | | reset_let_values. |
2054 | | reset_repl_lets. |
2055 | | |
2056 | | |
2057 | | %% ------------------------------------ |
2058 | | %% DETERMINISTIC PROPAGATION UNIT TESTS |
2059 | | %% ------------------------------------ |
2060 | | |
2061 | | |
2062 | | % check that certain predicates are determined to be failing without enumeration |
2063 | | % to do: also add positive tests: certain predicates succeed with instantiating all variables |
2064 | | % eval_strings:must_fail_tests. |
2065 | | |
2066 | | must_fail_tests :- set_eval_det, |
2067 | | must_fail_det(Nr,Str,ExTyped), |
2068 | | check_failed(Nr,ExTyped), |
2069 | | Str \= [], |
2070 | | % print('PARSING: '),nl,name(SS,Str), print(SS),nl, |
2071 | | repl_typing_scope(TypingScope), |
2072 | | ( b_parse_machine_predicate_from_codes_open(exists,Str,[],TypingScope,NewTyped) -> |
2073 | | check_same_ast(Nr,NewTyped,ExTyped) |
2074 | | ; |
2075 | | print('*** Could not parse: '), print(Nr), nl |
2076 | | %add_error(must_fail_tests,'Could not parse saved string: ',Nr) |
2077 | | ), |
2078 | | fail. |
2079 | | must_fail_tests :- preferences:preference(use_clpfd_solver,true), |
2080 | | must_fail_clpfd_det(Nr,ExTyped), |
2081 | | test_enabled(Nr), |
2082 | | check_failed(Nr,ExTyped),fail. |
2083 | | must_fail_tests :- unset_eval_mode. |
2084 | | |
2085 | | check_failed(Nr,ExTyped) :- |
2086 | | nl,print(Nr), print(' >>> '), translate:print_bexpr(ExTyped),nl, |
2087 | | (eval_predicate_in_cur_state(ExTyped,Res,_,_) |
2088 | | -> (Res='FALSE' -> true ; |
2089 | | add_error(must_fail_tests,'Test has not failed deterministically: ',Nr)) |
2090 | | ; add_error(must_fail_tests,'eval_predicate failed: ',Nr) |
2091 | | ). |
2092 | | |
2093 | | :- use_module(self_check). |
2094 | | |
2095 | | :- assert_must_succeed(must_fail_tests). |
2096 | | |
2097 | | check_same_ast(Nr,A_New,B_Old) :- % check equivalent to stored AST B, apart from pos |
2098 | | (compare(A_New,B_Old) -> true |
2099 | | ; add_error(check_same_ast,'AST not identical: ',Nr), |
2100 | | print('New AST:'),nl,print(A_New),nl, |
2101 | | print('Stored AST :'),nl,print(B_Old),nl, |
2102 | | tools_printing:trace_unify(A_New,B_Old) |
2103 | | ). |
2104 | | |
2105 | | compare(A,B) :- atomic(A),!,B=A. |
2106 | | compare(b(A,TA,IA),b(B,TB,IB)) :- !, |
2107 | | TA=TB, |
2108 | | exclude(remove_this,IA,IA1), sort(IA1,SIA1), |
2109 | | exclude(remove_this,IB,IB1), sort(IB1,SIB1), |
2110 | | compare_infos(SIA1,SIB1), |
2111 | | compare(A,B). |
2112 | | compare(A,B) :- A=..[F|As], B=..[F|Bs], |
2113 | | maplist(compare,As,Bs). |
2114 | | |
2115 | | compare_infos([],[]). |
2116 | | compare_infos([H|TA],[H|TB]) :- !, compare_infos(TA,TB). |
2117 | | compare_infos([used_ids(_)|TA],TB) :- TB \= [used_ids(_)|_], % skip additional new used_ids field |
2118 | | compare_infos(TA,TB). |
2119 | | |
2120 | | remove_this(removed_typing). % new info field |
2121 | | remove_this(nodeid(_)). % new AST sometimes has more nodeids than old stored ones |
2122 | | remove_this(prob_annotation('DO_NOT_ENUMERATE'('$$NONE$$'))). % this field now shows when enumeration order analysis was run and nothing found |
2123 | | |
2124 | | :- load_files(library(system), [when(compile_time), imports([environ/2])]). |
2125 | | :- if(environ(prob_release,true)). |
2126 | | must_fail_det(_Nr,_Str,_ExTyped) :- fail. |
2127 | | must_fail_clpfd_det(_Nr,_ExTyped) :- fail. |
2128 | | :- else. |
2129 | | % |
2130 | | must_fail_det(1,"#(x,y,z).(x:BOOL & x=z & z=y & x /= y)", |
2131 | | %b(exists([b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,3,1,3)),introduced_by(exists)]),b(identifier(y),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,5,1,5)),introduced_by(exists)]),b(identifier(z),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,7,1,7)),introduced_by(exists)])],b(conjunct(b(conjunct(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,20,1,20)),introduced_by(exists)]),b(identifier(z),boolean,[nodeid(pos(nan,1,1,22,1,22)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,20,1,22))]),b(equal(b(identifier(z),boolean,[nodeid(pos(nan,1,1,26,1,26)),introduced_by(exists)]),b(identifier(y),boolean,[nodeid(pos(nan,1,1,28,1,28)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,26,1,28))])),pred,[nodeid(pos(nan,1,1,11,1,28))]),b(not_equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,32,1,32)),introduced_by(exists)]),b(identifier(y),boolean,[nodeid(pos(nan,1,1,37,1,37)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,32,1,37))])),pred,[nodeid(pos(nan,1,1,11,1,37))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,38))])). |
2132 | | b(exists([b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(3,-1,1,3,1,3)),introduced_by(exists)]),b(identifier(y),boolean,[do_not_optimize_away,nodeid(pos(4,-1,1,5,1,5)),introduced_by(exists)]),b(identifier(z),boolean,[do_not_optimize_away,nodeid(pos(5,-1,1,7,1,7)),introduced_by(exists)])],b(conjunct(b(conjunct(b(conjunct(b(equal(b(identifier(x),boolean,[nodeid(pos(13,-1,1,20,1,20)),introduced_by(exists)]),b(identifier(z),boolean,[nodeid(pos(14,-1,1,22,1,22)),introduced_by(exists)])),pred,[nodeid(pos(12,-1,1,20,1,22))]),b(equal(b(identifier(z),boolean,[nodeid(pos(16,-1,1,26,1,26)),introduced_by(exists)]),b(identifier(y),boolean,[nodeid(pos(17,-1,1,28,1,28)),introduced_by(exists)])),pred,[nodeid(pos(15,-1,1,26,1,28))])),pred,[nodeid(pos(7,-1,1,11,1,28))]),b(not_equal(b(identifier(x),boolean,[nodeid(pos(19,-1,1,32,1,32)),introduced_by(exists)]),b(identifier(y),boolean,[nodeid(pos(20,-1,1,37,1,37)),introduced_by(exists)])),pred,[nodeid(pos(18,-1,1,32,1,37))])),pred,[nodeid(pos(6,-1,1,11,1,37))]),b(external_pred_call('LEQ_SYM',[b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(3,-1,1,3,1,3)),introduced_by(exists)]),b(identifier(y),boolean,[do_not_optimize_away,nodeid(pos(4,-1,1,5,1,5)),introduced_by(exists)])]),pred,[do_not_optimize_away,nodeid(pos(3,-1,1,3,1,3)),introduced_by(exists)])),pred,[])),pred,[used_ids([]),prob_symmetry(x,y),nodeid(pos(2,-1,1,1,1,38))])). % with symmetry breaking |
2133 | | |
2134 | | |
2135 | | % |
2136 | | must_fail_det(2,"#x.(x:BOOL & (x=FALSE <=> x=TRUE))", b(exists([b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,2,1,2)),introduced_by(exists)])],b(equivalence(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,15,1,15)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,17,1,17))])),pred,[nodeid(pos(nan,1,1,15,1,17))]),b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,27,1,27)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,29,1,29))])),pred,[nodeid(pos(nan,1,1,27,1,29))])),pred,[nodeid(pos(nan,1,1,15,1,29))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,34))])). |
2137 | | |
2138 | | % |
2139 | | must_fail_det(3,"#(b,c).(b:BOOL & b=c & b/=c)", |
2140 | | b(exists([b(identifier(b),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,3,1,3)),introduced_by(exists)]),b(identifier(c),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,5,1,5)),introduced_by(exists)])],b(conjunct(b(equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,18,1,18)),introduced_by(exists)]),b(identifier(c),boolean,[nodeid(pos(nan,1,1,20,1,20)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,18,1,20))]),b(not_equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,24,1,24)),introduced_by(exists)]),b(identifier(c),boolean,[nodeid(pos(nan,1,1,27,1,27)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,24,1,27))])),pred,[nodeid(pos(nan,1,1,9,1,27))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,28))])). |
2141 | | |
2142 | | |
2143 | | % |
2144 | | must_fail_det(4,"#(e,s).(s<:INT & e:s & e/:s)", b(exists([b(identifier(e),integer,[do_not_optimize_away,nodeid(pos(3,-1,1,3,1,4)),introduced_by(exists)]),b(identifier(s),set(integer),[do_not_optimize_away,nodeid(pos(4,-1,1,5,1,6)),introduced_by(exists)])],b(conjunct(b(conjunct(b(subset(b(identifier(s),set(integer),[nodeid(pos(8,-1,1,9,1,10)),introduced_by(exists)]),b(interval(b(min_int,integer,[nodeid(pos(9,-1,1,12,1,15))]),b(max_int,integer,[nodeid(pos(9,-1,1,12,1,15))])),set(integer),[was(integer_set('INT')),nodeid(pos(9,-1,1,12,1,15))])),pred,[nodeid(pos(7,-1,1,9,1,15))]),b(member(b(identifier(e),integer,[nodeid(pos(11,-1,1,18,1,19)),introduced_by(exists)]),b(identifier(s),set(integer),[nodeid(pos(12,-1,1,20,1,21)),introduced_by(exists)])),pred,[nodeid(pos(10,-1,1,18,1,21))])),pred,[nodeid(pos(6,-1,1,9,1,21))]),b(not_member(b(identifier(e),integer,[nodeid(pos(14,-1,1,24,1,25)),introduced_by(exists)]),b(identifier(s),set(integer),[nodeid(pos(15,-1,1,27,1,28)),introduced_by(exists)])),pred,[nodeid(pos(13,-1,1,24,1,28))])),pred,[nodeid(pos(5,-1,1,9,1,28))])),pred,[used_ids([]),nodeid(pos(2,-1,1,1,1,29))])). |
2145 | | |
2146 | | % |
2147 | | must_fail_det(5,"#(x,y,z,v,xz).(x:BOOL & x/=y & v/=z & x=v & (x=z <=> xz=TRUE) & (xz=FALSE => x=TRUE) & (xz=FALSE => x=FALSE))", b(exists([b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(3,-1,1,3,1,4)),introduced_by(exists)]),b(identifier(y),boolean,[do_not_optimize_away,nodeid(pos(4,-1,1,5,1,6)),introduced_by(exists)]),b(identifier(z),boolean,[do_not_optimize_away,nodeid(pos(5,-1,1,7,1,8)),introduced_by(exists)]),b(identifier(v),boolean,[do_not_optimize_away,nodeid(pos(6,-1,1,9,1,10)),introduced_by(exists)]),b(identifier(xz),boolean,[do_not_optimize_away,nodeid(pos(7,-1,1,11,1,13)),introduced_by(exists)])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(not_equal(b(identifier(x),boolean,[nodeid(pos(18,-1,1,25,1,26)),introduced_by(exists)]),b(identifier(y),boolean,[nodeid(pos(19,-1,1,28,1,29)),introduced_by(exists)])),pred,[removed_typing,nodeid(pos(17,-1,1,25,1,29))]),b(not_equal(b(identifier(v),boolean,[nodeid(pos(21,-1,1,32,1,33)),introduced_by(exists)]),b(identifier(z),boolean,[nodeid(pos(22,-1,1,35,1,36)),introduced_by(exists)])),pred,[nodeid(pos(20,-1,1,32,1,36))])),pred,[nodeid(pos(12,-1,1,16,1,36))]),b(equal(b(identifier(x),boolean,[nodeid(pos(24,-1,1,39,1,40)),introduced_by(exists)]),b(identifier(v),boolean,[nodeid(pos(25,-1,1,41,1,42)),introduced_by(exists)])),pred,[nodeid(pos(23,-1,1,39,1,42))])),pred,[nodeid(pos(11,-1,1,16,1,42))]),b(equivalence(b(equal(b(identifier(x),boolean,[nodeid(pos(28,-1,1,46,1,47)),introduced_by(exists)]),b(identifier(z),boolean,[nodeid(pos(29,-1,1,48,1,49)),introduced_by(exists)])),pred,[nodeid(pos(27,-1,1,46,1,49))]),b(equal(b(identifier(xz),boolean,[nodeid(pos(31,-1,1,54,1,56)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(32,-1,1,57,1,61))])),pred,[nodeid(pos(30,-1,1,54,1,61))])),pred,[nodeid(pos(26,-1,1,46,1,61))])),pred,[nodeid(pos(10,-1,1,16,1,61))]),b(implication(b(equal(b(identifier(xz),boolean,[nodeid(pos(35,-1,1,66,1,68)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(36,-1,1,69,1,74))])),pred,[nodeid(pos(34,-1,1,66,1,74))]),b(equal(b(identifier(x),boolean,[nodeid(pos(38,-1,1,78,1,79)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(39,-1,1,80,1,84))])),pred,[nodeid(pos(37,-1,1,78,1,84))])),pred,[nodeid(pos(33,-1,1,66,1,84))])),pred,[nodeid(pos(9,-1,1,16,1,84))]),b(implication(b(equal(b(identifier(xz),boolean,[nodeid(pos(42,-1,1,89,1,91)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(43,-1,1,92,1,97))])),pred,[nodeid(pos(41,-1,1,89,1,97))]),b(equal(b(identifier(x),boolean,[nodeid(pos(45,-1,1,101,1,102)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(46,-1,1,103,1,108))])),pred,[nodeid(pos(44,-1,1,101,1,108))])),pred,[nodeid(pos(40,-1,1,89,1,108))])),pred,[nodeid(pos(8,-1,1,16,1,108))])),pred,[removed_typing,used_ids([]),nodeid(pos(2,-1,1,1,1,110))])). |
2148 | | |
2149 | | % |
2150 | | must_fail_det(6,"#(x,xz).((x : BOOL & xz : BOOL) & (((x = TRUE) <=> not(x = TRUE)) <=> (xz = TRUE) & ((x = TRUE) <=> not(x = TRUE)) <=> (xz = FALSE)))", b(exists([b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,3,1,3)),introduced_by(exists)]),b(identifier(xz),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,5,1,5)),introduced_by(exists)])],b(conjunct(b(equivalence(b(equivalence(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,38,1,38)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,42,1,42))])),pred,[nodeid(pos(nan,1,1,38,1,42))]),b(negation(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,56,1,56)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,60,1,60))])),pred,[nodeid(pos(nan,1,1,56,1,60))])),pred,[nodeid(pos(nan,1,1,52,1,64))])),pred,[nodeid(pos(nan,1,1,37,1,64))]),b(equal(b(identifier(xz),boolean,[nodeid(pos(nan,1,1,72,1,72)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,77,1,77))])),pred,[nodeid(pos(nan,1,1,72,1,77))])),pred,[nodeid(pos(nan,1,1,36,1,81))]),b(equivalence(b(equivalence(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,87,1,87)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,91,1,91))])),pred,[nodeid(pos(nan,1,1,87,1,91))]),b(negation(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,105,1,105)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,109,1,109))])),pred,[nodeid(pos(nan,1,1,105,1,109))])),pred,[nodeid(pos(nan,1,1,101,1,113))])),pred,[nodeid(pos(nan,1,1,86,1,113))]),b(equal(b(identifier(xz),boolean,[nodeid(pos(nan,1,1,121,1,121)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,126,1,126))])),pred,[nodeid(pos(nan,1,1,121,1,126))])),pred,[nodeid(pos(nan,1,1,85,1,131))])),pred,[nodeid(pos(nan,1,1,36,1,131))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,133))])). |
2151 | | |
2152 | | % |
2153 | | must_fail_det(7,"#(x,z,x2,xz).((((x : BOOL & z : BOOL) & x2 : BOOL) & xz : BOOL) & (((x2 /= z & x = x2) & ((x = TRUE) <=> (x2 = FALSE)) <=> (xz = TRUE)) & ((x = TRUE) <=> (x2 = FALSE)) <=> (xz = FALSE)))", b(exists([b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,3,1,3)),introduced_by(exists)]),b(identifier(z),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,5,1,5)),introduced_by(exists)]),b(identifier(x2),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,7,1,7)),introduced_by(exists)]),b(identifier(xz),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,10,1,10)),introduced_by(exists)])],b(conjunct(b(conjunct(b(conjunct(b(not_equal(b(identifier(x2),boolean,[nodeid(pos(nan,1,1,70,1,70)),introduced_by(exists)]),b(identifier(z),boolean,[nodeid(pos(nan,1,1,76,1,76)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,70,1,76))]),b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,80,1,80)),introduced_by(exists)]),b(identifier(x2),boolean,[nodeid(pos(nan,1,1,84,1,84)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,80,1,84))])),pred,[nodeid(pos(nan,1,1,70,1,84))]),b(equivalence(b(equivalence(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,92,1,92)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,96,1,96))])),pred,[nodeid(pos(nan,1,1,92,1,96))]),b(equal(b(identifier(x2),boolean,[nodeid(pos(nan,1,1,107,1,107)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,112,1,112))])),pred,[nodeid(pos(nan,1,1,107,1,112))])),pred,[nodeid(pos(nan,1,1,91,1,117))]),b(equal(b(identifier(xz),boolean,[nodeid(pos(nan,1,1,125,1,125)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,130,1,130))])),pred,[nodeid(pos(nan,1,1,125,1,130))])),pred,[nodeid(pos(nan,1,1,90,1,134))])),pred,[nodeid(pos(nan,1,1,69,1,134))]),b(equivalence(b(equivalence(b(equal(b(identifier(x),boolean,[nodeid(pos(nan,1,1,141,1,141)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,145,1,145))])),pred,[nodeid(pos(nan,1,1,141,1,145))]),b(equal(b(identifier(x2),boolean,[nodeid(pos(nan,1,1,156,1,156)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,161,1,161))])),pred,[nodeid(pos(nan,1,1,156,1,161))])),pred,[nodeid(pos(nan,1,1,140,1,166))]),b(equal(b(identifier(xz),boolean,[nodeid(pos(nan,1,1,174,1,174)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,179,1,179))])),pred,[nodeid(pos(nan,1,1,174,1,179))])),pred,[nodeid(pos(nan,1,1,139,1,184))])),pred,[nodeid(pos(nan,1,1,68,1,184))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,186))])). |
2154 | | |
2155 | | % |
2156 | | must_fail_det(8,"#(a,b).((a : BOOL & b : BOOL) & ((b = TRUE) <=> ((a = TRUE) <=> not(a = TRUE)) & (b = FALSE) <=> ((a = FALSE) <=> (a = TRUE))))", b(exists([b(identifier(a),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,3,1,3)),introduced_by(exists)]),b(identifier(b),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,5,1,5)),introduced_by(exists)])],b(conjunct(b(equivalence(b(equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,35,1,35)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,39,1,39))])),pred,[nodeid(pos(nan,1,1,35,1,39))]),b(equivalence(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,51,1,51)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,55,1,55))])),pred,[nodeid(pos(nan,1,1,51,1,55))]),b(negation(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,69,1,69)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,73,1,73))])),pred,[nodeid(pos(nan,1,1,69,1,73))])),pred,[nodeid(pos(nan,1,1,65,1,77))])),pred,[nodeid(pos(nan,1,1,50,1,77))])),pred,[nodeid(pos(nan,1,1,34,1,78))]),b(equivalence(b(equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,83,1,83)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,87,1,87))])),pred,[nodeid(pos(nan,1,1,83,1,87))]),b(equivalence(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,100,1,100)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,104,1,104))])),pred,[nodeid(pos(nan,1,1,100,1,104))]),b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,116,1,116)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,120,1,120))])),pred,[nodeid(pos(nan,1,1,116,1,120))])),pred,[nodeid(pos(nan,1,1,99,1,124))])),pred,[nodeid(pos(nan,1,1,82,1,125))])),pred,[nodeid(pos(nan,1,1,34,1,125))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,127))])). |
2157 | | |
2158 | | % |
2159 | | must_fail_det(9,[], % let predicate now also optimizes bool equalities: |
2160 | | %"#(a,b,c).(((a : BOOL & b : BOOL) & c : BOOL) & ((((b = TRUE) <=> (a = TRUE => a = FALSE) & b = TRUE) & (a = FALSE => c = FALSE)) & (a = FALSE => c = TRUE)))", |
2161 | | b(let_predicate([b(identifier(b),boolean,[nodeid(pos(nan,1,1,5,1,5)),introduced_by(exists)])],[b(boolean_true,boolean,[nodeid(pos(nan,1,1,96,1,96))])],b(exists([b(identifier(a),boolean,[nodeid(pos(nan,1,1,3,1,3)),introduced_by(exists)]),b(identifier(c),boolean,[nodeid(pos(nan,1,1,7,1,7)),introduced_by(exists)])],b(conjunct(b(conjunct(b(equivalence(b(equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,52,1,52)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,56,1,56))])),pred,[nodeid(pos(nan,1,1,52,1,56))]),b(implication(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,67,1,67)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,71,1,71))])),pred,[nodeid(pos(nan,1,1,67,1,71))]),b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,79,1,79)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,83,1,83))])),pred,[nodeid(pos(nan,1,1,79,1,83))])),pred,[nodeid(pos(nan,1,1,67,1,83))])),pred,[nodeid(pos(nan,1,1,51,1,88))]),b(implication(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,105,1,105)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,109,1,109))])),pred,[nodeid(pos(nan,1,1,105,1,109))]),b(equal(b(identifier(c),boolean,[nodeid(pos(nan,1,1,118,1,118)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,122,1,122))])),pred,[nodeid(pos(nan,1,1,118,1,122))])),pred,[nodeid(pos(nan,1,1,105,1,122))])),pred,[]),b(implication(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,133,1,133)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,137,1,137))])),pred,[nodeid(pos(nan,1,1,133,1,137))]),b(equal(b(identifier(c),boolean,[nodeid(pos(nan,1,1,146,1,146)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,150,1,150))])),pred,[nodeid(pos(nan,1,1,146,1,150))])),pred,[nodeid(pos(nan,1,1,133,1,150))])),pred,[])),pred,[used_ids([b]),used_ids([b]),used_ids([a,b,c])])),pred,[nodeid(pos(nan,1,1,1,1,156))])). |
2162 | | |
2163 | | % |
2164 | | must_fail_det(10,"#(a,b,c).(((a : BOOL & b : BOOL) & c : BOOL) & (((b = TRUE) <=> (a = TRUE => a = FALSE) & (c = TRUE) <=> (a = b)) & (c = TRUE) <=> not(a = b)))", b(exists([b(identifier(a),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,3,1,3)),introduced_by(exists)]),b(identifier(b),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,5,1,5)),introduced_by(exists)]),b(identifier(c),boolean,[do_not_optimize_away,nodeid(pos(nan,1,1,7,1,7)),introduced_by(exists)])],b(conjunct(b(conjunct(b(equivalence(b(equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,51,1,51)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,55,1,55))])),pred,[nodeid(pos(nan,1,1,51,1,55))]),b(implication(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,66,1,66)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,70,1,70))])),pred,[nodeid(pos(nan,1,1,66,1,70))]),b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,78,1,78)),introduced_by(exists)]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,82,1,82))])),pred,[nodeid(pos(nan,1,1,78,1,82))])),pred,[nodeid(pos(nan,1,1,66,1,82))])),pred,[nodeid(pos(nan,1,1,50,1,87))]),b(equivalence(b(equal(b(identifier(c),boolean,[nodeid(pos(nan,1,1,92,1,92)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,96,1,96))])),pred,[nodeid(pos(nan,1,1,92,1,96))]),b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,107,1,107)),introduced_by(exists)]),b(identifier(b),boolean,[nodeid(pos(nan,1,1,111,1,111)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,107,1,111))])),pred,[nodeid(pos(nan,1,1,91,1,112))])),pred,[nodeid(pos(nan,1,1,50,1,112))]),b(equivalence(b(equal(b(identifier(c),boolean,[nodeid(pos(nan,1,1,118,1,118)),introduced_by(exists)]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,122,1,122))])),pred,[nodeid(pos(nan,1,1,118,1,122))]),b(negation(b(equal(b(identifier(a),boolean,[nodeid(pos(nan,1,1,136,1,136)),introduced_by(exists)]),b(identifier(b),boolean,[nodeid(pos(nan,1,1,140,1,140)),introduced_by(exists)])),pred,[nodeid(pos(nan,1,1,136,1,140))])),pred,[nodeid(pos(nan,1,1,132,1,141))])),pred,[nodeid(pos(nan,1,1,117,1,141))])),pred,[nodeid(pos(nan,1,1,49,1,141))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,143))]) |
2165 | | ). |
2166 | | |
2167 | | % "#(x,y,z).(((x : BOOL & y : BOOL) & z : BOOL) & ((TRUE:BOOL) => ((x : {TRUE}) <=> (y = TRUE) & (x = y) <=> (z = TRUE)) & x /= y <=> (z = TRUE)))" |
2168 | | must_fail_det(11,[], b(exists([b(identifier(x),boolean,[do_not_optimize_away,nodeid(pos(7,1,4,3,4,3))]),b(identifier(y),boolean,[do_not_optimize_away,nodeid(pos(8,1,4,5,4,5))]),b(identifier(z),boolean,[do_not_optimize_away,nodeid(pos(9,1,4,7,4,7))])],b(implication(b(truth,pred,[nodeid(pos(19,1,4,29,4,34))]),b(conjunct(b(conjunct(b(equivalence(b(member(b(identifier(x),boolean,[nodeid(pos(26,1,4,40,4,40))]),b(set_extension([b(boolean_true,boolean,[nodeid(pos(28,1,4,43,4,46))])]),set(boolean),[nodeid(pos(27,1,4,42,4,47))])),pred,[nodeid(pos(25,1,4,40,4,47))]),b(equal(b(identifier(y),boolean,[nodeid(pos(30,1,4,53,4,53))]),b(boolean_true,boolean,[nodeid(pos(31,1,4,55,4,58))])),pred,[nodeid(pos(29,1,4,53,4,58))])),pred,[nodeid(pos(24,1,4,40,4,58))]),b(equivalence(b(equal(b(identifier(x),boolean,[nodeid(pos(34,1,4,64,4,64))]),b(identifier(y),boolean,[nodeid(pos(35,1,4,66,4,66))])),pred,[nodeid(pos(33,1,4,64,4,66))]),b(equal(b(identifier(z),boolean,[nodeid(pos(37,1,4,72,4,72))]),b(boolean_true,boolean,[nodeid(pos(38,1,4,74,4,77))])),pred,[nodeid(pos(36,1,4,72,4,77))])),pred,[nodeid(pos(32,1,4,64,4,77))])),pred,[nodeid(pos(23,1,4,40,4,77))]),b(equivalence(b(not_equal(b(identifier(x),boolean,[nodeid(pos(41,1,4,82,4,82))]),b(identifier(y),boolean,[nodeid(pos(42,1,4,85,4,85))])),pred,[nodeid(pos(40,1,4,82,4,85))]),b(equal(b(identifier(z),boolean,[nodeid(pos(44,1,4,90,4,90))]),b(boolean_true,boolean,[nodeid(pos(45,1,4,92,4,95))])),pred,[nodeid(pos(43,1,4,90,4,95))])),pred,[nodeid(pos(39,1,4,82,4,95))])),pred,[nodeid(pos(22,1,4,40,4,95))])),pred,[nodeid(pos(10,1,4,11,4,95))])),pred,[used_ids([]),nodeid(pos(6,1,4,1,4,97))])). |
2169 | | |
2170 | | |
2171 | | must_fail_det(12,[], %"SIGMA(x,y).(x : 1 .. 10 & y : {1,2}|x) = 111", |
2172 | | b(equal(b(general_sum([b(identifier(x),integer,[nodeid(pos(nan,1,1,7,1,7)),introduced_by(general_sum)]),b(identifier(y),integer,[nodeid(pos(nan,1,1,9,1,9)),introduced_by(general_sum)])],b(conjunct(b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,13,1,13)),introduced_by(general_sum)]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,17,1,17))]),b(integer(10),integer,[nodeid(pos(nan,1,1,22,1,22))])),set(integer),[nodeid(pos(nan,1,1,17,1,22))])),pred,[nodeid(pos(nan,1,1,13,1,22))]),b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,27,1,27)),introduced_by(general_sum)]),b(set_extension([b(integer(1),integer,[nodeid(pos(nan,1,1,32,1,32))]),b(integer(2),integer,[nodeid(pos(nan,1,1,34,1,34))])]),set(integer),[nodeid(pos(nan,1,1,31,1,35))])),pred,[nodeid(pos(nan,1,1,27,1,35))])),pred,[nodeid(pos(nan,1,1,13,1,35))]),b(identifier(x),integer,[nodeid(pos(nan,1,1,37,1,37)),introduced_by(general_sum)])),integer,[nodeid(pos(nan,1,1,1,1,38))]),b(integer(111),integer,[nodeid(pos(nan,1,1,42,1,42))])),pred,[nodeid(pos(nan,1,1,1,1,42))])). |
2173 | | |
2174 | | must_fail_det(13,[], %"PI(x,y).(x : 1 .. 10 & y : {1,2}|x) = 111", |
2175 | | b(equal(b(general_product([b(identifier(x),integer,[nodeid(pos(nan,1,1,4,1,4)),introduced_by(general_product)]),b(identifier(y),integer,[nodeid(pos(nan,1,1,6,1,6)),introduced_by(general_product)])],b(conjunct(b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,10,1,10)),introduced_by(general_product)]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,14,1,14))]),b(integer(10),integer,[nodeid(pos(nan,1,1,19,1,19))])),set(integer),[nodeid(pos(nan,1,1,14,1,19))])),pred,[nodeid(pos(nan,1,1,10,1,19))]),b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,24,1,24)),introduced_by(general_product)]),b(set_extension([b(integer(1),integer,[nodeid(pos(nan,1,1,29,1,29))]),b(integer(2),integer,[nodeid(pos(nan,1,1,31,1,31))])]),set(integer),[nodeid(pos(nan,1,1,28,1,32))])),pred,[nodeid(pos(nan,1,1,24,1,32))])),pred,[nodeid(pos(nan,1,1,10,1,32))]),b(identifier(x),integer,[nodeid(pos(nan,1,1,34,1,34)),introduced_by(general_product)])),integer,[nodeid(pos(nan,1,1,1,1,35))]),b(integer(111),integer,[nodeid(pos(nan,1,1,39,1,39))])),pred,[nodeid(pos(nan,1,1,1,1,39))])). |
2176 | | |
2177 | | /* |
2178 | | must_fail_det(16,"union(ran(%x.((x <: {1,2,3,4} & card(x) > 0) & min(x) = 2|x))) = {1,2,3,4}", |
2179 | | b(equal(b(general_union(b(range(b(comprehension_set([b(identifier(x),set(integer),[nodeid(pos(0,0,0,0,0,0))]),b(identifier('_lambda_result_'),set(integer),[lambda_result])],b(conjunct(b(conjunct(b(conjunct(b(subset(b(identifier(x),set(integer),[nodeid(pos(0,0,0,0,0,0))]),b(set_extension([b(integer(1),integer,[nodeid(pos(0,0,0,0,0,0))]),b(integer(2),integer,[nodeid(pos(0,0,0,0,0,0))]),b(integer(3),integer,[nodeid(pos(0,0,0,0,0,0))]),b(integer(4),integer,[nodeid(pos(0,0,0,0,0,0))])]),set(integer),[nodeid(pos(0,0,0,0,0,0))])),pred,[nodeid(pos(0,0,0,0,0,0))]),b(greater(b(card(b(identifier(x),set(integer),[nodeid(pos(0,0,0,0,0,0))])),integer,[nodeid(pos(0,0,0,0,0,0))]),b(integer(0),integer,[nodeid(pos(0,0,0,0,0,0))])),pred,[nodeid(pos(0,0,0,0,0,0))])),pred,[nodeid(pos(0,0,0,0,0,0))]),b(equal(b(min(b(identifier(x),set(integer),[nodeid(pos(0,0,0,0,0,0))])),integer,[contains_wd_condition,nodeid(pos(0,0,0,0,0,0))]),b(integer(2),integer,[nodeid(pos(0,0,0,0,0,0))])),pred,[contains_wd_condition,nodeid(pos(0,0,0,0,0,0))])),pred,[contains_wd_condition,nodeid(pos(0,0,0,0,0,0))]),b(equal(b(identifier('_lambda_result_'),set(integer),[lambda_result]),b(identifier(x),set(integer),[nodeid(pos(0,0,0,0,0,0))])),pred,[])),pred,[contains_wd_condition])),set(couple(set(integer),set(integer))),[contains_wd_condition,was(lambda),generated(quantified_union)])),set(set(integer)),[contains_wd_condition,generated(quantified_union)])),set(integer),[contains_wd_condition,nodeid(pos(0,0,0,0,0,0))]),b(set_extension([b(integer(1),integer,[nodeid(pos(0,0,0,0,0,0))]),b(integer(2),integer,[nodeid(pos(0,0,0,0,0,0))]),b(integer(3),integer,[nodeid(pos(0,0,0,0,0,0))]),b(integer(4),integer,[nodeid(pos(0,0,0,0,0,0))])]),set(integer),[nodeid(pos(0,0,0,0,0,0))])),pred,[contains_wd_condition,nodeid(pos(0,0,0,0,0,0))])). |
2180 | | */ |
2181 | | |
2182 | | |
2183 | | % #(z,x,y).(((z : POW(POW(BOOL)) & x : POW(BOOL)) & y : INTEGER) & ((z = {{},{TRUE},{FALSE},{TRUE,FALSE}} & (x : z) <=> (y = 2)) & y > 3)) |
2184 | | % check that we detect that z is a complete set, hence x:z and hence y=2 |
2185 | | must_fail_det(14,[], %"z = {{},{TRUE},{FALSE},{TRUE,FALSE}} & (x:z <=> y=2) & y>3 ", |
2186 | | b(exists([b(identifier(z),set(set(boolean)),[]),b(identifier(x),set(boolean),[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(z),set(set(boolean)),[nodeid(pos(nan,1,1,1,1,1))]),b(set_extension([b(empty_set,set(boolean),[nodeid(pos(nan,1,1,6,1,6))]),b(set_extension([b(boolean_true,boolean,[nodeid(pos(nan,1,1,10,1,10))])]),set(boolean),[nodeid(pos(nan,1,1,9,1,14))]),b(set_extension([b(boolean_false,boolean,[nodeid(pos(nan,1,1,17,1,17))])]),set(boolean),[nodeid(pos(nan,1,1,16,1,22))]),b(set_extension([b(boolean_true,boolean,[nodeid(pos(nan,1,1,25,1,25))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,30,1,30))])]),set(boolean),[nodeid(pos(nan,1,1,24,1,35))])]),set(set(boolean)),[nodeid(pos(nan,1,1,5,1,36))])),pred,[nodeid(pos(nan,1,1,1,1,36))]),b(equivalence(b(member(b(identifier(x),set(boolean),[nodeid(pos(nan,1,1,41,1,41))]),b(identifier(z),set(set(boolean)),[nodeid(pos(nan,1,1,43,1,43))])),pred,[nodeid(pos(nan,1,1,41,1,43))]),b(equal(b(identifier(y),integer,[nodeid(pos(nan,1,1,49,1,49))]),b(integer(2),integer,[nodeid(pos(nan,1,1,51,1,51))])),pred,[nodeid(pos(nan,1,1,49,1,51))])),pred,[nodeid(pos(nan,1,1,41,1,51))])),pred,[nodeid(pos(nan,1,1,1,1,52))]),b(greater(b(identifier(y),integer,[nodeid(pos(nan,1,1,56,1,56))]),b(integer(3),integer,[nodeid(pos(nan,1,1,58,1,58))])),pred,[nodeid(pos(nan,1,1,56,1,58))])),pred,[nodeid(pos(nan,1,1,1,1,58))])),pred,[used_ids([x,y,z])])). |
2187 | | |
2188 | | % #(z,x,y).(((z : POW(BOOL * BOOL) & x : BOOL * BOOL) & y : INTEGER) & ((z = {TRUE |-> FALSE,TRUE |-> TRUE,FALSE |-> FALSE,FALSE |-> TRUE} & (x : z) <=> (y = 2)) & y > 3)) |
2189 | | % check that we detect that z is a complete set, hence x:z and hence y=2 |
2190 | | must_fail_det(15,[], %" z = {(TRUE,FALSE),(TRUE,TRUE),(FALSE,FALSE),(FALSE,TRUE)} & (x:z <=> y=2) & y>3 ", |
2191 | | b(exists([b(identifier(z),set(couple(boolean,boolean)),[]),b(identifier(x),couple(boolean,boolean),[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(z),set(couple(boolean,boolean)),[nodeid(pos(nan,1,1,1,1,1))]),b(set_extension([b(couple(b(boolean_true,boolean,[nodeid(pos(nan,1,1,7,1,7))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,12,1,12))])),couple(boolean,boolean),[nodeid(pos(nan,1,1,6,1,17))]),b(couple(b(boolean_true,boolean,[nodeid(pos(nan,1,1,20,1,20))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,25,1,25))])),couple(boolean,boolean),[nodeid(pos(nan,1,1,19,1,29))]),b(couple(b(boolean_false,boolean,[nodeid(pos(nan,1,1,32,1,32))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,38,1,38))])),couple(boolean,boolean),[nodeid(pos(nan,1,1,31,1,43))]),b(couple(b(boolean_false,boolean,[nodeid(pos(nan,1,1,46,1,46))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,52,1,52))])),couple(boolean,boolean),[nodeid(pos(nan,1,1,45,1,56))])]),set(couple(boolean,boolean)),[nodeid(pos(nan,1,1,5,1,57))])),pred,[nodeid(pos(nan,1,1,1,1,57))]),b(equivalence(b(member(b(identifier(x),couple(boolean,boolean),[nodeid(pos(nan,1,1,62,1,62))]),b(identifier(z),set(couple(boolean,boolean)),[nodeid(pos(nan,1,1,64,1,64))])),pred,[nodeid(pos(nan,1,1,62,1,64))]),b(equal(b(identifier(y),integer,[nodeid(pos(nan,1,1,70,1,70))]),b(integer(2),integer,[nodeid(pos(nan,1,1,72,1,72))])),pred,[nodeid(pos(nan,1,1,70,1,72))])),pred,[nodeid(pos(nan,1,1,62,1,72))])),pred,[nodeid(pos(nan,1,1,1,1,73))]),b(greater(b(identifier(y),integer,[nodeid(pos(nan,1,1,77,1,77))]),b(integer(3),integer,[nodeid(pos(nan,1,1,79,1,79))])),pred,[nodeid(pos(nan,1,1,77,1,79))])),pred,[nodeid(pos(nan,1,1,1,1,79))])),pred,[used_ids([x,y,z])])). |
2192 | | |
2193 | | % #(z,x,y).(((z : POW(POW(BOOL)) & x : POW(POW(BOOL))) & y : INTEGER) & ((z = {{},{TRUE},{FALSE},{TRUE,FALSE}} & x <: z <=> (y = 2)) & y > 3)) |
2194 | | must_fail_det(16,[],b(exists([b(identifier(z),set(set(boolean)),[]),b(identifier(x),set(set(boolean)),[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(z),set(set(boolean)),[nodeid(pos(nan,1,1,1,1,1))]),b(set_extension([b(empty_set,set(boolean),[nodeid(pos(nan,1,1,6,1,6))]),b(set_extension([b(boolean_true,boolean,[nodeid(pos(nan,1,1,10,1,10))])]),set(boolean),[nodeid(pos(nan,1,1,9,1,14))]),b(set_extension([b(boolean_false,boolean,[nodeid(pos(nan,1,1,17,1,17))])]),set(boolean),[nodeid(pos(nan,1,1,16,1,22))]),b(set_extension([b(boolean_true,boolean,[nodeid(pos(nan,1,1,25,1,25))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,30,1,30))])]),set(boolean),[nodeid(pos(nan,1,1,24,1,35))])]),set(set(boolean)),[nodeid(pos(nan,1,1,5,1,36))])),pred,[nodeid(pos(nan,1,1,1,1,36))]),b(equivalence(b(subset(b(identifier(x),set(set(boolean)),[nodeid(pos(nan,1,1,41,1,41))]),b(identifier(z),set(set(boolean)),[nodeid(pos(nan,1,1,44,1,44))])),pred,[nodeid(pos(nan,1,1,41,1,44))]),b(equal(b(identifier(y),integer,[nodeid(pos(nan,1,1,50,1,50))]),b(integer(2),integer,[nodeid(pos(nan,1,1,52,1,52))])),pred,[nodeid(pos(nan,1,1,50,1,52))])),pred,[nodeid(pos(nan,1,1,41,1,52))])),pred,[nodeid(pos(nan,1,1,1,1,53))]),b(greater(b(identifier(y),integer,[nodeid(pos(nan,1,1,57,1,57))]),b(integer(3),integer,[nodeid(pos(nan,1,1,59,1,59))])),pred,[nodeid(pos(nan,1,1,57,1,59))])),pred,[nodeid(pos(nan,1,1,1,1,59))])),pred,[used_ids([x,y,z])])). |
2195 | | |
2196 | | % Eval Time: 0 ms (0 ms walltime) |
2197 | | % #(x).(x : INTEGER & ([111,222,333,444,555] |>> {x} = [111,222,333,444] & x > 555)) |
2198 | | must_fail_det(17,"#(x).(([111,222,333,444,555] |>> {x} = [111,222,333,444] & x > 555))", b(exists([b(identifier(x),integer,[do_not_optimize_away,nodeid(pos(3,-1,1,3,1,3)),introduced_by(exists)])],b(conjunct(b(equal(b(range_subtraction(b(value(avl_set(node((int(3),int(333)),true,0,node((int(1),int(111)),true,1,empty,node((int(2),int(222)),true,0,empty,empty)),node((int(4),int(444)),true,1,empty,node((int(5),int(555)),true,0,empty,empty))))),set(couple(integer,integer)),[nodeid(pos(7,-1,1,8,1,28))]),b(set_extension([b(identifier(x),integer,[nodeid(pos(14,-1,1,35,1,35)),introduced_by(exists)])]),set(integer),[nodeid(pos(13,-1,1,34,1,36))])),set(couple(integer,integer)),[nodeid(pos(6,-1,1,8,1,36))]),b(value(avl_set(node((int(2),int(222)),true,1,node((int(1),int(111)),true,0,empty,empty),node((int(3),int(333)),true,1,empty,node((int(4),int(444)),true,0,empty,empty))))),set(couple(integer,integer)),[nodeid(pos(15,-1,1,40,1,56))])),pred,[nodeid(pos(5,-1,1,8,1,56))]),b(greater(b(identifier(x),integer,[nodeid(pos(21,-1,1,60,1,60)),introduced_by(exists)]),b(integer(555),integer,[nodeid(pos(22,-1,1,64,1,66))])),pred,[nodeid(pos(20,-1,1,60,1,66))])),pred,[nodeid(pos(4,-1,1,8,1,66))])),pred,[used_ids([]),nodeid(pos(2,-1,1,1,1,68))])). |
2199 | | |
2200 | | |
2201 | | % #(m,n).(m:30..100 & n:10..20 & m<n ) |
2202 | | must_fail_clpfd_det(101,b(exists([b(identifier(x),integer,[nodeid(pos(nan,1,1,3,1,3))])],b(conjunct(b(equal(b(range_subtraction(b(sequence_extension([b(integer(111),integer,[nodeid(pos(nan,1,1,9,1,9))]),b(integer(222),integer,[nodeid(pos(nan,1,1,13,1,13))]),b(integer(333),integer,[nodeid(pos(nan,1,1,17,1,17))]),b(integer(444),integer,[nodeid(pos(nan,1,1,21,1,21))]),b(integer(555),integer,[nodeid(pos(nan,1,1,25,1,25))])]),set(couple(integer,integer)),[nodeid(pos(nan,1,1,8,1,28))]),b(set_extension([b(identifier(x),integer,[nodeid(pos(nan,1,1,35,1,35)),introduced_by(exists)])]),set(integer),[nodeid(pos(nan,1,1,34,1,36))])),set(couple(integer,integer)),[nodeid(pos(nan,1,1,8,1,36))]),b(sequence_extension([b(integer(111),integer,[nodeid(pos(nan,1,1,41,1,41))]),b(integer(222),integer,[nodeid(pos(nan,1,1,45,1,45))]),b(integer(333),integer,[nodeid(pos(nan,1,1,49,1,49))]),b(integer(444),integer,[nodeid(pos(nan,1,1,53,1,53))])]),set(couple(integer,integer)),[nodeid(pos(nan,1,1,40,1,56))])),pred,[nodeid(pos(nan,1,1,8,1,56))]),b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,60,1,60)),introduced_by(exists)]),b(integer(555),integer,[nodeid(pos(nan,1,1,64,1,64))])),pred,[nodeid(pos(nan,1,1,60,1,64))])),pred,[nodeid(pos(nan,1,1,8,1,64))])),pred,[used_ids([]),nodeid(pos(nan,1,1,1,1,68))])). |
2203 | | |
2204 | | % #(m,n).(m:30..101 & n:10..20 & n*n=m & m/=100) |
2205 | | must_fail_clpfd_det(102,b(exists([b(identifier(m),integer,[nodeid(pos(7,1,4,3,4,3))]),b(identifier(n),integer,[nodeid(pos(8,1,4,5,4,5))])],b(conjunct(b(conjunct(b(conjunct(b(member(b(identifier(m),integer,[nodeid(pos(13,1,4,9,4,9))]),b(interval(b(integer(30),integer,[nodeid(pos(15,1,4,11,4,12))]),b(integer(101),integer,[nodeid(pos(16,1,4,15,4,17))])),set(integer),[nodeid(pos(14,1,4,11,4,17))])),pred,[nodeid(pos(12,1,4,9,4,17))]),b(member(b(identifier(n),integer,[nodeid(pos(18,1,4,21,4,21))]),b(interval(b(integer(10),integer,[nodeid(pos(20,1,4,23,4,24))]),b(integer(20),integer,[nodeid(pos(21,1,4,27,4,28))])),set(integer),[nodeid(pos(19,1,4,23,4,28))])),pred,[nodeid(pos(17,1,4,21,4,28))])),pred,[nodeid(pos(11,1,4,9,4,28))]),b(equal(b(multiplication(b(identifier(n),integer,[nodeid(pos(24,1,4,32,4,32))]),b(identifier(n),integer,[nodeid(pos(25,1,4,34,4,34))])),integer,[nodeid(pos(23,1,4,32,4,34))]),b(identifier(m),integer,[nodeid(pos(26,1,4,36,4,36))])),pred,[nodeid(pos(22,1,4,32,4,36))])),pred,[nodeid(pos(10,1,4,9,4,36))]),b(not_equal(b(identifier(m),integer,[nodeid(pos(28,1,4,40,4,40))]),b(integer(100),integer,[nodeid(pos(29,1,4,43,4,45))])),pred,[nodeid(pos(27,1,4,40,4,45))])),pred,[nodeid(pos(9,1,4,9,4,45))])),pred,[used_ids([]),nodeid(pos(6,1,4,1,4,46))])). |
2206 | | |
2207 | | % #(x,y).(y : BOOL & (x : NATURAL & (((x : {11}) <=> (y = TRUE) & x < 10) & (x : {12}) <=> (y = FALSE)))) |
2208 | | must_fail_clpfd_det(103,b(exists([b(identifier(x),integer,[nodeid(pos(7,1,4,3,4,3))]),b(identifier(y),boolean,[nodeid(pos(8,1,4,5,4,5))])],b(conjunct(b(member(b(identifier(x),integer,[nodeid(pos(12,1,4,9,4,9))]),b(integer_set('NATURAL'),set(integer),[nodeid(pos(13,1,4,11,4,17))])),pred,[nodeid(pos(11,1,4,9,4,17))]),b(conjunct(b(conjunct(b(equivalence(b(member(b(identifier(x),integer,[nodeid(pos(21,1,4,32,4,32))]),b(set_extension([b(integer(11),integer,[nodeid(pos(23,1,4,35,4,36))])]),set(integer),[nodeid(pos(22,1,4,34,4,37))])),pred,[nodeid(pos(20,1,4,32,4,37))]),b(equal(b(identifier(y),boolean,[nodeid(pos(25,1,4,43,4,43))]),b(boolean_true,boolean,[nodeid(pos(26,1,4,45,4,48))])),pred,[nodeid(pos(24,1,4,43,4,48))])),pred,[nodeid(pos(19,1,4,32,4,48))]),b(less(b(identifier(x),integer,[nodeid(pos(28,1,4,53,4,53))]),b(integer(10),integer,[nodeid(pos(29,1,4,55,4,56))])),pred,[nodeid(pos(27,1,4,53,4,56))])),pred,[nodeid(pos(18,1,4,32,4,56))]),b(equivalence(b(member(b(identifier(x),integer,[nodeid(pos(32,1,4,61,4,61))]),b(set_extension([b(integer(12),integer,[nodeid(pos(34,1,4,64,4,65))])]),set(integer),[nodeid(pos(33,1,4,63,4,66))])),pred,[nodeid(pos(31,1,4,61,4,66))]),b(equal(b(identifier(y),boolean,[nodeid(pos(36,1,4,72,4,72))]),b(boolean_false,boolean,[nodeid(pos(37,1,4,74,4,78))])),pred,[nodeid(pos(35,1,4,72,4,78))])),pred,[nodeid(pos(30,1,4,61,4,78))])),pred,[nodeid(pos(17,1,4,32,4,78))])),pred,[nodeid(pos(9,1,4,9,4,78))])),pred,[used_ids([]),nodeid(pos(6,1,4,1,4,81))])). |
2209 | | |
2210 | | |
2211 | | % #(x,y).((x : INTEGER & y : INTEGER) & (({x} /<<: {11,12} <=> (y = 3) & x > 12) & y < 3)) |
2212 | | must_fail_clpfd_det(104,b(exists([b(identifier(x),integer,[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(equivalence(b(not_subset_strict(b(set_extension([b(identifier(x),integer,[nodeid(pos(nan,1,1,2,1,2))])]),set(integer),[nodeid(pos(nan,1,1,1,1,3))]),b(set_extension([b(integer(11),integer,[nodeid(pos(nan,1,1,11,1,11))]),b(integer(12),integer,[nodeid(pos(nan,1,1,14,1,14))])]),set(integer),[nodeid(pos(nan,1,1,10,1,16))])),pred,[nodeid(pos(nan,1,1,1,1,16))]),b(equal(b(identifier(y),integer,[nodeid(pos(nan,1,1,22,1,22))]),b(integer(3),integer,[nodeid(pos(nan,1,1,24,1,24))])),pred,[nodeid(pos(nan,1,1,22,1,24))])),pred,[nodeid(pos(nan,1,1,1,1,24))]),b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,28,1,28))]),b(integer(12),integer,[nodeid(pos(nan,1,1,30,1,30))])),pred,[nodeid(pos(nan,1,1,28,1,30))])),pred,[nodeid(pos(nan,1,1,1,1,30))]),b(less(b(identifier(y),integer,[nodeid(pos(nan,1,1,35,1,35))]),b(integer(3),integer,[nodeid(pos(nan,1,1,37,1,37))])),pred,[nodeid(pos(nan,1,1,35,1,37))])),pred,[nodeid(pos(nan,1,1,1,1,37))])),pred,[used_ids([x,y])])). |
2213 | | |
2214 | | % #(x,y).((x : 5 .. 10000 & x / y = 19000) & y : 1 .. 100) |
2215 | | must_fail_clpfd_det(105,b(exists([b(identifier(x),integer,[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,1,1,1))]),b(interval(b(integer(5),integer,[nodeid(pos(nan,1,1,3,1,3))]),b(integer(10000),integer,[nodeid(pos(nan,1,1,6,1,6))])),set(integer),[nodeid(pos(nan,1,1,3,1,6))])),pred,[nodeid(pos(nan,1,1,1,1,6))]),b(equal(b(div(b(identifier(x),integer,[nodeid(pos(nan,1,1,14,1,14))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,16,1,16))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,14,1,16))]),b(integer(19000),integer,[nodeid(pos(nan,1,1,18,1,18))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,14,1,18))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,18))]),b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,26,1,26))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,28,1,28))]),b(integer(100),integer,[nodeid(pos(nan,1,1,31,1,31))])),set(integer),[nodeid(pos(nan,1,1,28,1,31))])),pred,[nodeid(pos(nan,1,1,26,1,31))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,31))])),pred,[used_ids([x,y])])). |
2216 | | |
2217 | | % #(x,y).((x : 500 .. 10000 & 499 / y = x) & y : 1 .. 100) |
2218 | | must_fail_clpfd_det(106,b(exists([b(identifier(x),integer,[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,1,1,1))]),b(interval(b(integer(500),integer,[nodeid(pos(nan,1,1,3,1,3))]),b(integer(10000),integer,[nodeid(pos(nan,1,1,8,1,8))])),set(integer),[nodeid(pos(nan,1,1,3,1,8))])),pred,[nodeid(pos(nan,1,1,1,1,8))]),b(equal(b(div(b(integer(499),integer,[nodeid(pos(nan,1,1,16,1,16))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,20,1,20))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,16,1,20))]),b(identifier(x),integer,[nodeid(pos(nan,1,1,22,1,22))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,16,1,22))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,22))]),b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,26,1,26))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,28,1,28))]),b(integer(100),integer,[nodeid(pos(nan,1,1,31,1,31))])),set(integer),[nodeid(pos(nan,1,1,28,1,31))])),pred,[nodeid(pos(nan,1,1,26,1,31))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,31))])),pred,[used_ids([x,y])])). |
2219 | | |
2220 | | % #(y,f,x).((((y : 1 .. 1000001 & f : 100001 .. 100005 --> 1 .. 9000) & x : dom(f)) & x : 2 .. 100003) & (x > 5000 => y : 2000001 .. 2000002)) |
2221 | | must_fail_clpfd_det(107,b(exists([b(identifier(y),integer,[]),b(identifier(f),set(couple(integer,integer)),[]),b(identifier(x),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,1,1,1))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,3,1,3))]),b(integer(1000001),integer,[nodeid(pos(nan,1,1,6,1,6))])),set(integer),[nodeid(pos(nan,1,1,3,1,6))])),pred,[nodeid(pos(nan,1,1,1,1,6))]),b(member(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,16,1,16))]),b(total_function(b(interval(b(integer(100001),integer,[nodeid(pos(nan,1,1,18,1,18))]),b(integer(100005),integer,[nodeid(pos(nan,1,1,26,1,26))])),set(integer),[nodeid(pos(nan,1,1,18,1,26))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,37,1,37))]),b(integer(9000),integer,[nodeid(pos(nan,1,1,40,1,40))])),set(integer),[nodeid(pos(nan,1,1,37,1,40))])),set(set(couple(integer,integer))),[nodeid(pos(nan,1,1,18,1,40))])),pred,[nodeid(pos(nan,1,1,16,1,40))])),pred,[nodeid(pos(nan,1,1,1,1,40))]),b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,48,1,48))]),b(domain(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,54,1,54))])),set(integer),[nodeid(pos(nan,1,1,50,1,55))])),pred,[nodeid(pos(nan,1,1,48,1,55))])),pred,[nodeid(pos(nan,1,1,1,1,55))]),b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,59,1,59))]),b(interval(b(integer(2),integer,[nodeid(pos(nan,1,1,61,1,61))]),b(integer(100003),integer,[nodeid(pos(nan,1,1,64,1,64))])),set(integer),[nodeid(pos(nan,1,1,61,1,64))])),pred,[nodeid(pos(nan,1,1,59,1,64))])),pred,[nodeid(pos(nan,1,1,1,1,64))]),b(implication(b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,74,1,74))]),b(integer(5000),integer,[nodeid(pos(nan,1,1,76,1,76))])),pred,[nodeid(pos(nan,1,1,74,1,76))]),b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,84,1,84))]),b(interval(b(integer(2000001),integer,[nodeid(pos(nan,1,1,86,1,86))]),b(integer(2000002),integer,[nodeid(pos(nan,1,1,95,1,95))])),set(integer),[nodeid(pos(nan,1,1,86,1,95))])),pred,[nodeid(pos(nan,1,1,84,1,95))])),pred,[nodeid(pos(nan,1,1,74,1,95))])),pred,[nodeid(pos(nan,1,1,1,1,102))])),pred,[used_ids([f,x,y])])). |
2222 | | % #(f,x).((f : (BOOL * (123456 .. 123459)) * BOOL --> 1 .. 100 & x : dom(f)) & #(b,y,b2).(((b : BOOL & y : INTEGER) & b2 : BOOL) & (x = (b |-> y) |-> b2 & (y > 123459 or y < 123456)))) |
2223 | | must_fail_clpfd_det(108,b(exists([b(identifier(f),set(couple(couple(couple(boolean,integer),boolean),integer)),[]),b(identifier(x),couple(couple(boolean,integer),boolean),[])],b(conjunct(b(conjunct(b(member(b(identifier(f),set(couple(couple(couple(boolean,integer),boolean),integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(total_function(b(cartesian_product(b(cartesian_product(b(bool_set,set(boolean),[nodeid(pos(nan,1,1,5,1,5))]),b(interval(b(integer(123456),integer,[nodeid(pos(nan,1,1,11,1,11))]),b(integer(123459),integer,[nodeid(pos(nan,1,1,19,1,19))])),set(integer),[nodeid(pos(nan,1,1,11,1,19))])),set(couple(boolean,integer)),[nodeid(pos(nan,1,1,5,1,25))]),b(bool_set,set(boolean),[nodeid(pos(nan,1,1,27,1,27))])),set(couple(couple(boolean,integer),boolean)),[nodeid(pos(nan,1,1,5,1,27))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,37,1,37))]),b(integer(100),integer,[nodeid(pos(nan,1,1,40,1,40))])),set(integer),[nodeid(pos(nan,1,1,37,1,40))])),set(set(couple(couple(couple(boolean,integer),boolean),integer))),[nodeid(pos(nan,1,1,4,1,40))])),pred,[nodeid(pos(nan,1,1,1,1,40))]),b(member(b(identifier(x),couple(couple(boolean,integer),boolean),[nodeid(pos(nan,1,1,46,1,46))]),b(domain(b(identifier(f),set(couple(couple(couple(boolean,integer),boolean),integer)),[nodeid(pos(nan,1,1,52,1,52))])),set(couple(couple(boolean,integer),boolean)),[nodeid(pos(nan,1,1,48,1,53))])),pred,[nodeid(pos(nan,1,1,46,1,53))])),pred,[nodeid(pos(nan,1,1,1,1,53))]),b(exists([b(identifier(b),boolean,[nodeid(pos(nan,1,1,59,1,59)),introduced_by(exists)]),b(identifier(y),integer,[nodeid(pos(nan,1,1,61,1,61)),introduced_by(exists)]),b(identifier(b2),boolean,[nodeid(pos(nan,1,1,63,1,63)),introduced_by(exists)])],b(conjunct(b(equal(b(identifier(x),couple(couple(boolean,integer),boolean),[nodeid(pos(nan,1,1,68,1,68))]),b(couple(b(couple(b(identifier(b),boolean,[nodeid(pos(nan,1,1,71,1,71)),introduced_by(exists)]),b(identifier(y),integer,[nodeid(pos(nan,1,1,73,1,73)),introduced_by(exists)])),couple(boolean,integer),[nodeid(pos(nan,1,1,70,1,77))]),b(identifier(b2),boolean,[nodeid(pos(nan,1,1,75,1,75)),introduced_by(exists)])),couple(couple(boolean,integer),boolean),[nodeid(pos(nan,1,1,70,1,77))])),pred,[nodeid(pos(nan,1,1,68,1,77))]),b(disjunct(b(greater(b(identifier(y),integer,[nodeid(pos(nan,1,1,82,1,82)),introduced_by(exists)]),b(integer(123459),integer,[nodeid(pos(nan,1,1,84,1,84))])),pred,[nodeid(pos(nan,1,1,82,1,84))]),b(less(b(identifier(y),integer,[nodeid(pos(nan,1,1,94,1,94)),introduced_by(exists)]),b(integer(123456),integer,[nodeid(pos(nan,1,1,96,1,96))])),pred,[nodeid(pos(nan,1,1,94,1,96))])),pred,[nodeid(pos(nan,1,1,82,1,96))])),pred,[nodeid(pos(nan,1,1,68,1,102))])),pred,[used_ids([x]),nodeid(pos(nan,1,1,57,1,103))])),pred,[nodeid(pos(nan,1,1,1,1,103))])),pred,[used_ids([f,x])])). |
2224 | | % #(f,x,y).((x : INTEGER & y : INTEGER) & ((f : 10 .. 200 --> 1 .. 200000 & x |-> y : f) & (x > 200 or x < 10))) |
2225 | | must_fail_clpfd_det(109,b(exists([b(identifier(f),set(couple(integer,integer)),[]),b(identifier(x),integer,[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(member(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(total_function(b(interval(b(integer(10),integer,[nodeid(pos(nan,1,1,4,1,4))]),b(integer(200),integer,[nodeid(pos(nan,1,1,8,1,8))])),set(integer),[nodeid(pos(nan,1,1,4,1,8))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,16,1,16))]),b(integer(200000),integer,[nodeid(pos(nan,1,1,19,1,19))])),set(integer),[nodeid(pos(nan,1,1,16,1,19))])),set(set(couple(integer,integer))),[nodeid(pos(nan,1,1,4,1,19))])),pred,[nodeid(pos(nan,1,1,1,1,19))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,28,1,28))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,32,1,32))])),couple(integer,integer),[nodeid(pos(nan,1,1,28,1,32))]),b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,36,1,36))])),pred,[nodeid(pos(nan,1,1,28,1,36))])),pred,[nodeid(pos(nan,1,1,1,1,36))]),b(disjunct(b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,41,1,41))]),b(integer(200),integer,[nodeid(pos(nan,1,1,43,1,43))])),pred,[nodeid(pos(nan,1,1,41,1,43))]),b(less(b(identifier(x),integer,[nodeid(pos(nan,1,1,50,1,50))]),b(integer(10),integer,[nodeid(pos(nan,1,1,52,1,52))])),pred,[nodeid(pos(nan,1,1,50,1,52))])),pred,[nodeid(pos(nan,1,1,41,1,52))])),pred,[nodeid(pos(nan,1,1,1,1,54))])),pred,[used_ids([f,x,y])])). |
2226 | | % #(f,b,x).((b : BOOL * BOOL & x : INTEGER) & ((f : BOOL * BOOL --> 100 .. 200000 & b |-> x : f) & (x > 200000 or x < 100))) |
2227 | | must_fail_clpfd_det(110,b(exists([b(identifier(f),set(couple(couple(boolean,boolean),integer)),[]),b(identifier(b),couple(boolean,boolean),[]),b(identifier(x),integer,[])],b(conjunct(b(conjunct(b(member(b(identifier(f),set(couple(couple(boolean,boolean),integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(total_function(b(cartesian_product(b(bool_set,set(boolean),[nodeid(pos(nan,1,1,5,1,5))]),b(bool_set,set(boolean),[nodeid(pos(nan,1,1,10,1,10))])),set(couple(boolean,boolean)),[nodeid(pos(nan,1,1,5,1,10))]),b(interval(b(integer(100),integer,[nodeid(pos(nan,1,1,20,1,20))]),b(integer(200000),integer,[nodeid(pos(nan,1,1,25,1,25))])),set(integer),[nodeid(pos(nan,1,1,20,1,25))])),set(set(couple(couple(boolean,boolean),integer))),[nodeid(pos(nan,1,1,4,1,25))])),pred,[nodeid(pos(nan,1,1,1,1,25))]),b(member(b(couple(b(identifier(b),couple(boolean,boolean),[nodeid(pos(nan,1,1,34,1,34))]),b(identifier(x),integer,[nodeid(pos(nan,1,1,38,1,38))])),couple(couple(boolean,boolean),integer),[nodeid(pos(nan,1,1,34,1,38))]),b(identifier(f),set(couple(couple(boolean,boolean),integer)),[nodeid(pos(nan,1,1,42,1,42))])),pred,[nodeid(pos(nan,1,1,34,1,42))])),pred,[nodeid(pos(nan,1,1,1,1,42))]),b(disjunct(b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,47,1,47))]),b(integer(200000),integer,[nodeid(pos(nan,1,1,49,1,49))])),pred,[nodeid(pos(nan,1,1,47,1,49))]),b(less(b(identifier(x),integer,[nodeid(pos(nan,1,1,59,1,59))]),b(integer(100),integer,[nodeid(pos(nan,1,1,61,1,61))])),pred,[nodeid(pos(nan,1,1,59,1,61))])),pred,[nodeid(pos(nan,1,1,47,1,61))])),pred,[nodeid(pos(nan,1,1,1,1,64))])),pred,[used_ids([b,f,x])])). |
2228 | | % #(f,g).(((f : 10001 .. 10110 --> NATURAL & !(x).(x : dom(f) => f(x) : dom(f))) & g : 20010 .. 20020 --> BOOL) & !(x).(x : dom(f) => f(x) : dom(g))) |
2229 | | must_fail_clpfd_det(111,b(exists([b(identifier(f),set(couple(integer,integer)),[]),b(identifier(g),set(couple(integer,boolean)),[])],b(conjunct(b(conjunct(b(conjunct(b(member(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,2,1,2))]),b(total_function(b(interval(b(integer(10001),integer,[nodeid(pos(nan,1,1,5,1,5))]),b(integer(10110),integer,[nodeid(pos(nan,1,1,12,1,12))])),set(integer),[nodeid(pos(nan,1,1,5,1,12))]),b(integer_set('NATURAL'),set(integer),[nodeid(pos(nan,1,1,22,1,22))])),set(set(couple(integer,integer))),[nodeid(pos(nan,1,1,5,1,22))])),pred,[nodeid(pos(nan,1,1,2,1,22))]),b(forall([b(identifier(x),integer,[nodeid(pos(nan,1,1,33,1,33)),introduced_by(forall)])],b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,36,1,36)),introduced_by(forall)]),b(domain(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,42,1,42))])),set(integer),[nodeid(pos(nan,1,1,38,1,43))])),pred,[nodeid(pos(nan,1,1,36,1,43))]),b(member(b(function(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,48,1,48))]),b(identifier(x),integer,[nodeid(pos(nan,1,1,50,1,50)),introduced_by(forall)])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,48,1,51))]),b(domain(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,57,1,57))])),set(integer),[nodeid(pos(nan,1,1,53,1,58))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,48,1,58))])),pred,[used_ids([f]),nodeid(pos(nan,1,1,32,1,59))])),pred,[nodeid(pos(nan,1,1,2,1,59))]),b(member(b(identifier(g),set(couple(integer,boolean)),[nodeid(pos(nan,1,1,63,1,63))]),b(total_function(b(interval(b(integer(20010),integer,[nodeid(pos(nan,1,1,65,1,65))]),b(integer(20020),integer,[nodeid(pos(nan,1,1,72,1,72))])),set(integer),[nodeid(pos(nan,1,1,65,1,72))]),b(bool_set,set(boolean),[nodeid(pos(nan,1,1,82,1,82))])),set(set(couple(integer,boolean))),[nodeid(pos(nan,1,1,65,1,82))])),pred,[nodeid(pos(nan,1,1,63,1,82))])),pred,[nodeid(pos(nan,1,1,2,1,82))]),b(forall([b(identifier(x),integer,[nodeid(pos(nan,1,1,90,1,90)),introduced_by(forall)])],b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,93,1,93)),introduced_by(forall)]),b(domain(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,99,1,99))])),set(integer),[nodeid(pos(nan,1,1,95,1,100))])),pred,[nodeid(pos(nan,1,1,93,1,100))]),b(member(b(function(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,105,1,105))]),b(identifier(x),integer,[nodeid(pos(nan,1,1,107,1,107)),introduced_by(forall)])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,105,1,108))]),b(domain(b(identifier(g),set(couple(integer,boolean)),[nodeid(pos(nan,1,1,114,1,114))])),set(integer),[nodeid(pos(nan,1,1,110,1,115))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,105,1,115))])),pred,[used_ids([f,g]),nodeid(pos(nan,1,1,89,1,116))])),pred,[nodeid(pos(nan,1,1,2,1,116))])),pred,[used_ids([f,g])])). |
2230 | | % #(f,x,y).((x : INTEGER & y : INTEGER) & ((f : 1001 .. 2001 --> 1900 .. 3333 & x |-> y : f) & y + 101 < x)) |
2231 | | must_fail_clpfd_det(112,b(exists([b(identifier(f),set(couple(integer,integer)),[]),b(identifier(x),integer,[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(member(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(total_function(b(interval(b(integer(1001),integer,[nodeid(pos(nan,1,1,5,1,5))]),b(integer(2001),integer,[nodeid(pos(nan,1,1,11,1,11))])),set(integer),[nodeid(pos(nan,1,1,5,1,11))]),b(interval(b(integer(1900),integer,[nodeid(pos(nan,1,1,20,1,20))]),b(integer(3333),integer,[nodeid(pos(nan,1,1,26,1,26))])),set(integer),[nodeid(pos(nan,1,1,20,1,26))])),set(set(couple(integer,integer))),[nodeid(pos(nan,1,1,5,1,26))])),pred,[nodeid(pos(nan,1,1,1,1,26))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,33,1,33))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,37,1,37))])),couple(integer,integer),[nodeid(pos(nan,1,1,33,1,37))]),b(identifier(f),set(couple(integer,integer)),[nodeid(pos(nan,1,1,41,1,41))])),pred,[nodeid(pos(nan,1,1,33,1,41))])),pred,[nodeid(pos(nan,1,1,1,1,41))]),b(less(b(add(b(identifier(y),integer,[nodeid(pos(nan,1,1,45,1,45))]),b(integer(101),integer,[nodeid(pos(nan,1,1,47,1,47))])),integer,[nodeid(pos(nan,1,1,45,1,47))]),b(identifier(x),integer,[nodeid(pos(nan,1,1,51,1,51))])),pred,[nodeid(pos(nan,1,1,45,1,51))])),pred,[nodeid(pos(nan,1,1,1,1,51))])),pred,[used_ids([f,x,y])])). |
2232 | | |
2233 | | % #(r,x,y,v,w).((((x : INTEGER & y : INTEGER) & v : INTEGER) & w : INTEGER) & ((((r : 1001 .. 1005 <-> 1000 .. 1099 & x |-> y : r) & v |-> w : r) & x + y = (v + w) + 120) & card(r) = 3)) |
2234 | | must_fail_clpfd_det(113,b(exists([b(identifier(r),set(couple(integer,integer)),[]),b(identifier(x),integer,[]),b(identifier(y),integer,[]),b(identifier(v),integer,[]),b(identifier(w),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(member(b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(relations(b(interval(b(integer(1001),integer,[nodeid(pos(nan,1,1,4,1,4))]),b(integer(1005),integer,[nodeid(pos(nan,1,1,10,1,10))])),set(integer),[nodeid(pos(nan,1,1,4,1,10))]),b(interval(b(integer(1000),integer,[nodeid(pos(nan,1,1,19,1,19))]),b(integer(1099),integer,[nodeid(pos(nan,1,1,25,1,25))])),set(integer),[nodeid(pos(nan,1,1,19,1,25))])),set(set(couple(integer,integer))),[nodeid(pos(nan,1,1,4,1,25))])),pred,[nodeid(pos(nan,1,1,1,1,25))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,32,1,32))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,36,1,36))])),couple(integer,integer),[nodeid(pos(nan,1,1,32,1,36))]),b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,40,1,40))])),pred,[nodeid(pos(nan,1,1,32,1,40))])),pred,[nodeid(pos(nan,1,1,1,1,40))]),b(member(b(couple(b(identifier(v),integer,[nodeid(pos(nan,1,1,44,1,44))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,48,1,48))])),couple(integer,integer),[nodeid(pos(nan,1,1,44,1,48))]),b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,52,1,52))])),pred,[nodeid(pos(nan,1,1,44,1,52))])),pred,[nodeid(pos(nan,1,1,1,1,52))]),b(equal(b(add(b(identifier(x),integer,[nodeid(pos(nan,1,1,57,1,57))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,59,1,59))])),integer,[nodeid(pos(nan,1,1,57,1,59))]),b(add(b(add(b(identifier(v),integer,[nodeid(pos(nan,1,1,63,1,63))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,65,1,65))])),integer,[nodeid(pos(nan,1,1,63,1,65))]),b(integer(120),integer,[nodeid(pos(nan,1,1,67,1,67))])),integer,[nodeid(pos(nan,1,1,63,1,67))])),pred,[nodeid(pos(nan,1,1,57,1,67))])),pred,[nodeid(pos(nan,1,1,1,1,67))]),b(equal(b(card(b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,78,1,78))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,73,1,79))]),b(integer(3),integer,[nodeid(pos(nan,1,1,83,1,83))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,73,1,83))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,83))])),pred,[used_ids([r,v,w,x,y])])). |
2235 | | |
2236 | | % #(r,x,y,v,w).((((x : INTEGER & y : INTEGER) & v : INTEGER) & w : INTEGER) & ((((r : 1001 .. 1005 +-> 1000 .. 1099 & x |-> y : r) & v |-> w : r) & x + y = (v + w) + 120) & card(r) = 3)) |
2237 | | must_fail_clpfd_det(114,b(exists([b(identifier(r),set(couple(integer,integer)),[]),b(identifier(x),integer,[]),b(identifier(y),integer,[]),b(identifier(v),integer,[]),b(identifier(w),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(member(b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(partial_function(b(interval(b(integer(1001),integer,[nodeid(pos(nan,1,1,4,1,4))]),b(integer(1005),integer,[nodeid(pos(nan,1,1,10,1,10))])),set(integer),[nodeid(pos(nan,1,1,4,1,10))]),b(interval(b(integer(1000),integer,[nodeid(pos(nan,1,1,19,1,19))]),b(integer(1099),integer,[nodeid(pos(nan,1,1,25,1,25))])),set(integer),[nodeid(pos(nan,1,1,19,1,25))])),set(set(couple(integer,integer))),[nodeid(pos(nan,1,1,4,1,25))])),pred,[nodeid(pos(nan,1,1,1,1,25))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,32,1,32))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,36,1,36))])),couple(integer,integer),[nodeid(pos(nan,1,1,32,1,36))]),b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,40,1,40))])),pred,[nodeid(pos(nan,1,1,32,1,40))])),pred,[nodeid(pos(nan,1,1,1,1,40))]),b(member(b(couple(b(identifier(v),integer,[nodeid(pos(nan,1,1,44,1,44))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,48,1,48))])),couple(integer,integer),[nodeid(pos(nan,1,1,44,1,48))]),b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,52,1,52))])),pred,[nodeid(pos(nan,1,1,44,1,52))])),pred,[nodeid(pos(nan,1,1,1,1,52))]),b(equal(b(add(b(identifier(x),integer,[nodeid(pos(nan,1,1,57,1,57))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,59,1,59))])),integer,[nodeid(pos(nan,1,1,57,1,59))]),b(add(b(add(b(identifier(v),integer,[nodeid(pos(nan,1,1,63,1,63))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,65,1,65))])),integer,[nodeid(pos(nan,1,1,63,1,65))]),b(integer(120),integer,[nodeid(pos(nan,1,1,67,1,67))])),integer,[nodeid(pos(nan,1,1,63,1,67))])),pred,[nodeid(pos(nan,1,1,57,1,67))])),pred,[nodeid(pos(nan,1,1,1,1,67))]),b(equal(b(card(b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,78,1,78))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,73,1,79))]),b(integer(3),integer,[nodeid(pos(nan,1,1,83,1,83))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,73,1,83))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,83))])),pred,[used_ids([r,v,w,x,y])])). |
2238 | | % #(r,x,y,v,w).((((x : INTEGER & y : INTEGER) & v : INTEGER) & w : INTEGER) & ((((r : 1001 .. 1005 >+> 1000 .. 1099 & x |-> y : r) & v |-> w : r) & x + y = (v + w) + 104) & card(r) = 2)) |
2239 | | must_fail_clpfd_det(115,b(exists([b(identifier(r),set(couple(integer,integer)),[]),b(identifier(x),integer,[]),b(identifier(y),integer,[]),b(identifier(v),integer,[]),b(identifier(w),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(member(b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(partial_injection(b(interval(b(integer(1001),integer,[nodeid(pos(nan,1,1,4,1,4))]),b(integer(1005),integer,[nodeid(pos(nan,1,1,10,1,10))])),set(integer),[nodeid(pos(nan,1,1,4,1,10))]),b(interval(b(integer(1000),integer,[nodeid(pos(nan,1,1,19,1,19))]),b(integer(1099),integer,[nodeid(pos(nan,1,1,25,1,25))])),set(integer),[nodeid(pos(nan,1,1,19,1,25))])),set(set(couple(integer,integer))),[nodeid(pos(nan,1,1,4,1,25))])),pred,[nodeid(pos(nan,1,1,1,1,25))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,32,1,32))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,36,1,36))])),couple(integer,integer),[nodeid(pos(nan,1,1,32,1,36))]),b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,40,1,40))])),pred,[nodeid(pos(nan,1,1,32,1,40))])),pred,[nodeid(pos(nan,1,1,1,1,40))]),b(member(b(couple(b(identifier(v),integer,[nodeid(pos(nan,1,1,44,1,44))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,48,1,48))])),couple(integer,integer),[nodeid(pos(nan,1,1,44,1,48))]),b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,52,1,52))])),pred,[nodeid(pos(nan,1,1,44,1,52))])),pred,[nodeid(pos(nan,1,1,1,1,52))]),b(equal(b(add(b(identifier(x),integer,[nodeid(pos(nan,1,1,57,1,57))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,59,1,59))])),integer,[nodeid(pos(nan,1,1,57,1,59))]),b(add(b(add(b(identifier(v),integer,[nodeid(pos(nan,1,1,63,1,63))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,65,1,65))])),integer,[nodeid(pos(nan,1,1,63,1,65))]),b(integer(104),integer,[nodeid(pos(nan,1,1,67,1,67))])),integer,[nodeid(pos(nan,1,1,63,1,67))])),pred,[nodeid(pos(nan,1,1,57,1,67))])),pred,[nodeid(pos(nan,1,1,1,1,67))]),b(equal(b(card(b(identifier(r),set(couple(integer,integer)),[nodeid(pos(nan,1,1,78,1,78))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,73,1,79))]),b(integer(2),integer,[nodeid(pos(nan,1,1,83,1,83))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,73,1,83))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,83))])),pred,[used_ids([r,v,w,x,y])])). |
2240 | | % #(s,x,b,y,b2).(((((s : POW((INTEGER * STRING) * BOOL) & x : INTEGER) & b : BOOL) & y : INTEGER) & b2 : BOOL) & (((s = {((1|->"a")|->TRUE),((2|->"a")|->FALSE),((3|->"b")|->FALSE),((4|->"b")|->FALSE)} & (x |-> "a") |-> b : s) & (y |-> "b") |-> b2 : s) & x > y)) |
2241 | | must_fail_clpfd_det(116,b(exists([b(identifier(s),set(couple(couple(integer,string),boolean)),[]),b(identifier(x),integer,[]),b(identifier(b),boolean,[]),b(identifier(y),integer,[]),b(identifier(b2),boolean,[])],b(conjunct(b(conjunct(b(conjunct(b(equal(b(identifier(s),set(couple(couple(integer,string),boolean)),[nodeid(pos(nan,1,1,1,1,1))]),b(value(avl_set(node(((int(2),string(a)),pred_false),true,1,node(((int(1),string(a)),pred_true),true,0,empty,empty),node(((int(3),string(b)),pred_false),true,1,empty,node(((int(4),string(b)),pred_false),true,0,empty,empty))))),set(couple(couple(integer,string),boolean)),[nodeid(pos(nan,1,1,5,1,66))])),pred,[nodeid(pos(nan,1,1,1,1,66))]),b(member(b(couple(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,71,1,71))]),b(string(a),string,[nodeid(pos(nan,1,1,75,1,75))])),couple(integer,string),[nodeid(pos(nan,1,1,71,1,75))]),b(identifier(b),boolean,[nodeid(pos(nan,1,1,81,1,81))])),couple(couple(integer,string),boolean),[nodeid(pos(nan,1,1,71,1,81))]),b(identifier(s),set(couple(couple(integer,string),boolean)),[nodeid(pos(nan,1,1,85,1,85))])),pred,[nodeid(pos(nan,1,1,71,1,85))])),pred,[nodeid(pos(nan,1,1,1,1,85))]),b(member(b(couple(b(couple(b(identifier(y),integer,[nodeid(pos(nan,1,1,89,1,89))]),b(string(b),string,[nodeid(pos(nan,1,1,93,1,93))])),couple(integer,string),[nodeid(pos(nan,1,1,89,1,93))]),b(identifier(b2),boolean,[nodeid(pos(nan,1,1,99,1,99))])),couple(couple(integer,string),boolean),[nodeid(pos(nan,1,1,89,1,99))]),b(identifier(s),set(couple(couple(integer,string),boolean)),[nodeid(pos(nan,1,1,104,1,104))])),pred,[nodeid(pos(nan,1,1,89,1,104))])),pred,[nodeid(pos(nan,1,1,1,1,104))]),b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,108,1,108))]),b(identifier(y),integer,[nodeid(pos(nan,1,1,110,1,110))])),pred,[nodeid(pos(nan,1,1,108,1,110))])),pred,[nodeid(pos(nan,1,1,1,1,110))])),pred,[used_ids([b,b2,s,x,y])])). |
2242 | | % #(f,v,x).(((f : POW((INTEGER * BOOL) * INTEGER) & v : INTEGER) & x : INTEGER) & ((f = {(11 |-> TRUE) |-> 3,(10 |-> TRUE) |-> 4,(2 |-> FALSE) |-> 5,(3 |-> FALSE) |-> v} & x |-> FALSE : dom(f)) & x |-> TRUE : dom(f))) |
2243 | | must_fail_clpfd_det(117,b(exists([b(identifier(f),set(couple(couple(integer,boolean),integer)),[]),b(identifier(v),integer,[]),b(identifier(x),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(f),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(set_extension([b(couple(b(couple(b(integer(11),integer,[nodeid(pos(nan,1,1,5,1,5))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,10,1,10))])),couple(integer,boolean),[nodeid(pos(nan,1,1,5,1,10))]),b(integer(3),integer,[nodeid(pos(nan,1,1,17,1,17))])),couple(couple(integer,boolean),integer),[nodeid(pos(nan,1,1,5,1,17))]),b(couple(b(couple(b(integer(10),integer,[nodeid(pos(nan,1,1,20,1,20))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,25,1,25))])),couple(integer,boolean),[nodeid(pos(nan,1,1,20,1,25))]),b(integer(4),integer,[nodeid(pos(nan,1,1,32,1,32))])),couple(couple(integer,boolean),integer),[nodeid(pos(nan,1,1,20,1,32))]),b(couple(b(couple(b(integer(2),integer,[nodeid(pos(nan,1,1,35,1,35))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,39,1,39))])),couple(integer,boolean),[nodeid(pos(nan,1,1,35,1,39))]),b(integer(5),integer,[nodeid(pos(nan,1,1,47,1,47))])),couple(couple(integer,boolean),integer),[nodeid(pos(nan,1,1,35,1,47))]),b(couple(b(couple(b(integer(3),integer,[nodeid(pos(nan,1,1,49,1,49))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,53,1,53))])),couple(integer,boolean),[nodeid(pos(nan,1,1,49,1,53))]),b(identifier(v),integer,[nodeid(pos(nan,1,1,61,1,61))])),couple(couple(integer,boolean),integer),[nodeid(pos(nan,1,1,49,1,61))])]),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,4,1,62))])),pred,[nodeid(pos(nan,1,1,1,1,62))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,66,1,66))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,70,1,70))])),couple(integer,boolean),[nodeid(pos(nan,1,1,66,1,70))]),b(domain(b(identifier(f),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,82,1,82))])),set(couple(integer,boolean)),[nodeid(pos(nan,1,1,78,1,83))])),pred,[nodeid(pos(nan,1,1,66,1,83))])),pred,[nodeid(pos(nan,1,1,1,1,83))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,87,1,87))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,91,1,91))])),couple(integer,boolean),[nodeid(pos(nan,1,1,87,1,91))]),b(domain(b(identifier(f),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,102,1,102))])),set(couple(integer,boolean)),[nodeid(pos(nan,1,1,98,1,103))])),pred,[nodeid(pos(nan,1,1,87,1,103))])),pred,[nodeid(pos(nan,1,1,1,1,103))])),pred,[used_ids([f,v,x])])). |
2244 | | % #(f,x).((f : POW((INTEGER * BOOL) * INTEGER) & x : INTEGER) & ((f = {((2|->FALSE)|->5),((3|->FALSE)|->77),((10|->TRUE)|->4),((11|->TRUE)|->3)} & x |-> FALSE : dom(f)) & x |-> TRUE : dom(f))) |
2245 | | must_fail_clpfd_det(118,b(exists([b(identifier(f),set(couple(couple(integer,boolean),integer)),[]),b(identifier(x),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(f),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,1,1,1))]),b(value(avl_set(node(((int(3),pred_false),int(77)),true,1,node(((int(2),pred_false),int(5)),true,0,empty,empty),node(((int(10),pred_true),int(4)),true,1,empty,node(((int(11),pred_true),int(3)),true,0,empty,empty))))),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,4,1,63))])),pred,[nodeid(pos(nan,1,1,1,1,63))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,67,1,67))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,71,1,71))])),couple(integer,boolean),[nodeid(pos(nan,1,1,67,1,71))]),b(domain(b(identifier(f),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,83,1,83))])),set(couple(integer,boolean)),[nodeid(pos(nan,1,1,79,1,84))])),pred,[nodeid(pos(nan,1,1,67,1,84))])),pred,[nodeid(pos(nan,1,1,1,1,84))]),b(member(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,88,1,88))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,92,1,92))])),couple(integer,boolean),[nodeid(pos(nan,1,1,88,1,92))]),b(domain(b(identifier(f),set(couple(couple(integer,boolean),integer)),[nodeid(pos(nan,1,1,103,1,103))])),set(couple(integer,boolean)),[nodeid(pos(nan,1,1,99,1,104))])),pred,[nodeid(pos(nan,1,1,88,1,104))])),pred,[nodeid(pos(nan,1,1,1,1,104))])),pred,[used_ids([f,x])])). |
2246 | | % #(a,v1,v2,w).((((a : POW(struct(x:INTEGER * INTEGER,y:INTEGER)) & v1 : INTEGER) & v2 : INTEGER) & w : INTEGER) & ((a = {rec(x:1 |-> 33,y:22),rec(x:2 |-> 34,y:44),rec(x:3 |-> 34,y:45)} & rec(x:v1 |-> v2,y:w) : a) & (v1 + v2) + w < 56)) |
2247 | | must_fail_clpfd_det(119,b(exists([b(identifier(a),set(record([field(x,couple(integer,integer)),field(y,integer)])),[]),b(identifier(v1),integer,[]),b(identifier(v2),integer,[]),b(identifier(w),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(a),set(record([field(x,couple(integer,integer)),field(y,integer)])),[nodeid(pos(nan,1,1,1,1,1))]),b(set_extension([b(rec([field(x,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,13,1,13))]),b(integer(33),integer,[nodeid(pos(nan,1,1,15,1,15))])),couple(integer,integer),[nodeid(pos(nan,1,1,12,1,17))])),field(y,b(integer(22),integer,[nodeid(pos(nan,1,1,21,1,21))]))]),record([field(x,couple(integer,integer)),field(y,integer)]),[nodeid(pos(nan,1,1,6,1,23))]),b(rec([field(x,b(couple(b(integer(2),integer,[nodeid(pos(nan,1,1,32,1,32))]),b(integer(34),integer,[nodeid(pos(nan,1,1,34,1,34))])),couple(integer,integer),[nodeid(pos(nan,1,1,31,1,36))])),field(y,b(integer(44),integer,[nodeid(pos(nan,1,1,40,1,40))]))]),record([field(x,couple(integer,integer)),field(y,integer)]),[nodeid(pos(nan,1,1,25,1,42))]),b(rec([field(x,b(couple(b(integer(3),integer,[nodeid(pos(nan,1,1,51,1,51))]),b(integer(34),integer,[nodeid(pos(nan,1,1,53,1,53))])),couple(integer,integer),[nodeid(pos(nan,1,1,50,1,55))])),field(y,b(integer(45),integer,[nodeid(pos(nan,1,1,59,1,59))]))]),record([field(x,couple(integer,integer)),field(y,integer)]),[nodeid(pos(nan,1,1,44,1,61))])]),set(record([field(x,couple(integer,integer)),field(y,integer)])),[nodeid(pos(nan,1,1,5,1,62))])),pred,[nodeid(pos(nan,1,1,1,1,62))]),b(member(b(rec([field(x,b(couple(b(identifier(v1),integer,[nodeid(pos(nan,1,1,73,1,73))]),b(identifier(v2),integer,[nodeid(pos(nan,1,1,76,1,76))])),couple(integer,integer),[nodeid(pos(nan,1,1,72,1,78))])),field(y,b(identifier(w),integer,[nodeid(pos(nan,1,1,82,1,82))]))]),record([field(x,couple(integer,integer)),field(y,integer)]),[nodeid(pos(nan,1,1,66,1,83))]),b(identifier(a),set(record([field(x,couple(integer,integer)),field(y,integer)])),[nodeid(pos(nan,1,1,85,1,85))])),pred,[nodeid(pos(nan,1,1,66,1,85))])),pred,[nodeid(pos(nan,1,1,1,1,85))]),b(less(b(add(b(add(b(identifier(v1),integer,[nodeid(pos(nan,1,1,89,1,89))]),b(identifier(v2),integer,[nodeid(pos(nan,1,1,92,1,92))])),integer,[nodeid(pos(nan,1,1,89,1,92))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,95,1,95))])),integer,[nodeid(pos(nan,1,1,89,1,95))]),b(integer(56),integer,[nodeid(pos(nan,1,1,98,1,98))])),pred,[nodeid(pos(nan,1,1,89,1,98))])),pred,[nodeid(pos(nan,1,1,1,1,98))])),pred,[used_ids([a,v1,v2,w])])). |
2248 | | % #(n,r1,a,b).((((n : INTEGER & r1 : POW(struct(x:INTEGER,y:INTEGER))) & a : INTEGER) & b : INTEGER) & ((({x|x : struct(x:INTEGER,y:INTEGER) & #(vv,ww).((x = rec(x:ww,y:vv) & vv : 1 .. n) & ww : 33 .. 34)} = r1 & n = 50) & rec(x:a,y:b) : r1) & rec(x:a + 2,y:b) : r1)) |
2249 | | must_fail_clpfd_det(120,b(exists([b(identifier(n),integer,[]),b(identifier(r1),set(record([field(x,integer),field(y,integer)])),[]),b(identifier(a),integer,[]),b(identifier(b),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(equal(b(comprehension_set([b(identifier(x),record([field(x,integer),field(y,integer)]),[nodeid(pos(nan,1,1,12,1,12)),introduced_by(comprehension_set)])],b(exists([b(identifier(vv),integer,[nodeid(pos(nan,1,1,6,1,6)),introduced_by(comprehension_set)]),b(identifier(ww),integer,[nodeid(pos(nan,1,1,9,1,9)),introduced_by(comprehension_set)])],b(conjunct(b(conjunct(b(equal(b(identifier(x),record([field(x,integer),field(y,integer)]),[nodeid(pos(nan,1,1,14,1,14)),introduced_by(comprehension_set)]),b(rec([field(x,b(identifier(ww),integer,[nodeid(pos(nan,1,1,22,1,22)),introduced_by(comprehension_set)])),field(y,b(identifier(vv),integer,[nodeid(pos(nan,1,1,27,1,27)),introduced_by(comprehension_set)]))]),record([field(x,integer),field(y,integer)]),[nodeid(pos(nan,1,1,16,1,29))])),pred,[nodeid(pos(nan,1,1,14,1,29))]),b(member(b(identifier(vv),integer,[nodeid(pos(nan,1,1,33,1,33)),introduced_by(comprehension_set)]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,36,1,36))]),b(identifier(n),integer,[nodeid(pos(nan,1,1,39,1,39))])),set(integer),[nodeid(pos(nan,1,1,36,1,39))])),pred,[nodeid(pos(nan,1,1,33,1,39))])),pred,[nodeid(pos(nan,1,1,14,1,39))]),b(member(b(identifier(ww),integer,[nodeid(pos(nan,1,1,43,1,43)),introduced_by(comprehension_set)]),b(interval(b(integer(33),integer,[nodeid(pos(nan,1,1,46,1,46))]),b(integer(34),integer,[nodeid(pos(nan,1,1,50,1,50))])),set(integer),[nodeid(pos(nan,1,1,46,1,50))])),pred,[nodeid(pos(nan,1,1,43,1,50))])),pred,[nodeid(pos(nan,1,1,14,1,50))])),pred,[used_ids([n,vv,ww,x])])),set(record([field(x,integer),field(y,integer)])),[nodeid(pos(nan,1,1,1,1,53))]),b(identifier(r1),set(record([field(x,integer),field(y,integer)])),[nodeid(pos(nan,1,1,55,1,55))])),pred,[nodeid(pos(nan,1,1,1,1,55))]),b(equal(b(identifier(n),integer,[nodeid(pos(nan,1,1,60,1,60))]),b(integer(50),integer,[nodeid(pos(nan,1,1,62,1,62))])),pred,[nodeid(pos(nan,1,1,60,1,62))])),pred,[nodeid(pos(nan,1,1,1,1,62))]),b(member(b(rec([field(x,b(identifier(a),integer,[nodeid(pos(nan,1,1,74,1,74))])),field(y,b(identifier(b),integer,[nodeid(pos(nan,1,1,78,1,78))]))]),record([field(x,integer),field(y,integer)]),[nodeid(pos(nan,1,1,68,1,79))]),b(identifier(r1),set(record([field(x,integer),field(y,integer)])),[nodeid(pos(nan,1,1,81,1,81))])),pred,[nodeid(pos(nan,1,1,68,1,81))])),pred,[nodeid(pos(nan,1,1,1,1,81))]),b(member(b(rec([field(x,b(add(b(identifier(a),integer,[nodeid(pos(nan,1,1,92,1,92))]),b(integer(2),integer,[nodeid(pos(nan,1,1,94,1,94))])),integer,[nodeid(pos(nan,1,1,92,1,94))])),field(y,b(identifier(b),integer,[nodeid(pos(nan,1,1,98,1,98))]))]),record([field(x,integer),field(y,integer)]),[nodeid(pos(nan,1,1,86,1,99))]),b(identifier(r1),set(record([field(x,integer),field(y,integer)])),[nodeid(pos(nan,1,1,101,1,101))])),pred,[nodeid(pos(nan,1,1,86,1,101))])),pred,[nodeid(pos(nan,1,1,1,1,101))])),pred,[used_ids([a,b,n,r1])])). |
2250 | | % #(x,y).(y : INTEGER & (((rec(f:x) /= rec(f:y) & x : 1 .. 2) & y = 2) & rec(f:x) /= rec(f:1))) |
2251 | | must_fail_clpfd_det(121,b(exists([b(identifier(x),integer,[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(not_equal(b(rec([field(f,b(identifier(x),integer,[nodeid(pos(nan,1,1,7,1,7))]))]),record([field(f,integer)]),[nodeid(pos(nan,1,1,1,1,8))]),b(rec([field(f,b(identifier(y),integer,[nodeid(pos(nan,1,1,19,1,19))]))]),record([field(f,integer)]),[nodeid(pos(nan,1,1,13,1,20))])),pred,[nodeid(pos(nan,1,1,1,1,20))]),b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,24,1,24))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,26,1,26))]),b(integer(2),integer,[nodeid(pos(nan,1,1,29,1,29))])),set(integer),[nodeid(pos(nan,1,1,26,1,29))])),pred,[nodeid(pos(nan,1,1,24,1,29))])),pred,[nodeid(pos(nan,1,1,1,1,29))]),b(equal(b(identifier(y),integer,[nodeid(pos(nan,1,1,33,1,33))]),b(integer(2),integer,[nodeid(pos(nan,1,1,35,1,35))])),pred,[nodeid(pos(nan,1,1,33,1,35))])),pred,[nodeid(pos(nan,1,1,1,1,35))]),b(not_equal(b(rec([field(f,b(identifier(x),integer,[nodeid(pos(nan,1,1,45,1,45))]))]),record([field(f,integer)]),[nodeid(pos(nan,1,1,39,1,46))]),b(rec([field(f,b(integer(1),integer,[nodeid(pos(nan,1,1,57,1,57))]))]),record([field(f,integer)]),[nodeid(pos(nan,1,1,51,1,58))])),pred,[nodeid(pos(nan,1,1,39,1,58))])),pred,[nodeid(pos(nan,1,1,1,1,58))])),pred,[used_ids([x,y])])). |
2252 | | % #(x,y).(y : INTEGER & ((((x |-> (1 |-> 2)) /= (y |-> (1 |-> 2)) & x : 1 .. 2) & y = 2) & (x |-> (1 |-> 2)) /= (1 |-> (1 |-> 2)))) |
2253 | | must_fail_clpfd_det(122,b(exists([b(identifier(x),integer,[]),b(identifier(y),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(not_equal(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,2,1,2))]),b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,5,1,5))]),b(integer(2),integer,[nodeid(pos(nan,1,1,7,1,7))])),couple(integer,integer),[nodeid(pos(nan,1,1,4,1,8))])),couple(integer,couple(integer,integer)),[nodeid(pos(nan,1,1,1,1,9))]),b(couple(b(identifier(y),integer,[nodeid(pos(nan,1,1,15,1,15))]),b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,18,1,18))]),b(integer(2),integer,[nodeid(pos(nan,1,1,20,1,20))])),couple(integer,integer),[nodeid(pos(nan,1,1,17,1,21))])),couple(integer,couple(integer,integer)),[nodeid(pos(nan,1,1,14,1,22))])),pred,[nodeid(pos(nan,1,1,1,1,22))]),b(member(b(identifier(x),integer,[nodeid(pos(nan,1,1,26,1,26))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,28,1,28))]),b(integer(2),integer,[nodeid(pos(nan,1,1,31,1,31))])),set(integer),[nodeid(pos(nan,1,1,28,1,31))])),pred,[nodeid(pos(nan,1,1,26,1,31))])),pred,[nodeid(pos(nan,1,1,1,1,31))]),b(equal(b(identifier(y),integer,[nodeid(pos(nan,1,1,35,1,35))]),b(integer(2),integer,[nodeid(pos(nan,1,1,37,1,37))])),pred,[nodeid(pos(nan,1,1,35,1,37))])),pred,[nodeid(pos(nan,1,1,1,1,37))]),b(not_equal(b(couple(b(identifier(x),integer,[nodeid(pos(nan,1,1,42,1,42))]),b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,45,1,45))]),b(integer(2),integer,[nodeid(pos(nan,1,1,47,1,47))])),couple(integer,integer),[nodeid(pos(nan,1,1,44,1,48))])),couple(integer,couple(integer,integer)),[nodeid(pos(nan,1,1,41,1,49))]),b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,55,1,55))]),b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,58,1,58))]),b(integer(2),integer,[nodeid(pos(nan,1,1,60,1,60))])),couple(integer,integer),[nodeid(pos(nan,1,1,57,1,61))])),couple(integer,couple(integer,integer)),[nodeid(pos(nan,1,1,54,1,62))])),pred,[nodeid(pos(nan,1,1,41,1,62))])),pred,[nodeid(pos(nan,1,1,1,1,62))])),pred,[used_ids([x,y])])). |
2254 | | % #(y,v).(v : INTEGER & (((rec(a:y,b:1,c:1 |-> 2) /= rec(a:v,b:1,c:1 |-> 2) & y : 1 .. 2) & v = 1) & rec(a:1,b:y,c:1 |-> 2) /= rec(a:v,b:2,c:1 |-> 2))) |
2255 | | must_fail_clpfd_det(123,b(exists([b(identifier(y),integer,[]),b(identifier(v),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(not_equal(b(rec([field(a,b(identifier(y),integer,[nodeid(pos(nan,1,1,8,1,8))])),field(b,b(integer(1),integer,[nodeid(pos(nan,1,1,12,1,12))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,17,1,17))]),b(integer(2),integer,[nodeid(pos(nan,1,1,19,1,19))])),couple(integer,integer),[nodeid(pos(nan,1,1,16,1,20))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,2,1,21))]),b(rec([field(a,b(identifier(v),integer,[nodeid(pos(nan,1,1,30,1,30))])),field(b,b(integer(1),integer,[nodeid(pos(nan,1,1,34,1,34))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,39,1,39))]),b(integer(2),integer,[nodeid(pos(nan,1,1,41,1,41))])),couple(integer,integer),[nodeid(pos(nan,1,1,38,1,42))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,24,1,43))])),pred,[nodeid(pos(nan,1,1,2,1,43))]),b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,48,1,48))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,50,1,50))]),b(integer(2),integer,[nodeid(pos(nan,1,1,53,1,53))])),set(integer),[nodeid(pos(nan,1,1,50,1,53))])),pred,[nodeid(pos(nan,1,1,48,1,53))])),pred,[nodeid(pos(nan,1,1,1,1,53))]),b(equal(b(identifier(v),integer,[nodeid(pos(nan,1,1,57,1,57))]),b(integer(1),integer,[nodeid(pos(nan,1,1,59,1,59))])),pred,[nodeid(pos(nan,1,1,57,1,59))])),pred,[nodeid(pos(nan,1,1,1,1,59))]),b(not_equal(b(rec([field(a,b(integer(1),integer,[nodeid(pos(nan,1,1,70,1,70))])),field(b,b(identifier(y),integer,[nodeid(pos(nan,1,1,74,1,74))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,79,1,79))]),b(integer(2),integer,[nodeid(pos(nan,1,1,81,1,81))])),couple(integer,integer),[nodeid(pos(nan,1,1,78,1,82))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,64,1,83))]),b(rec([field(a,b(identifier(v),integer,[nodeid(pos(nan,1,1,92,1,92))])),field(b,b(integer(2),integer,[nodeid(pos(nan,1,1,96,1,96))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,101,1,101))]),b(integer(2),integer,[nodeid(pos(nan,1,1,103,1,103))])),couple(integer,integer),[nodeid(pos(nan,1,1,100,1,104))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,86,1,105))])),pred,[nodeid(pos(nan,1,1,64,1,105))])),pred,[nodeid(pos(nan,1,1,1,1,106))])),pred,[used_ids([v,y])])). |
2256 | | % #(b,y,v).((b : BOOL & v : INTEGER) & ((((b = bool(rec(a:y,b:1,c:1 |-> 2) /= rec(a:v,b:1,c:1 |-> 2)) & y : 1 .. 2) & v = 1) & rec(a:1,b:y,c:1 |-> 2) /= rec(a:v,b:2,c:1 |-> 2)) & b = TRUE)) |
2257 | | must_fail_clpfd_det(124,b(exists([b(identifier(b),boolean,[]),b(identifier(y),integer,[]),b(identifier(v),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,1,1,1))]),b(convert_bool(b(not_equal(b(rec([field(a,b(identifier(y),integer,[nodeid(pos(nan,1,1,14,1,14))])),field(b,b(integer(1),integer,[nodeid(pos(nan,1,1,18,1,18))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,23,1,23))]),b(integer(2),integer,[nodeid(pos(nan,1,1,25,1,25))])),couple(integer,integer),[nodeid(pos(nan,1,1,22,1,26))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,8,1,27))]),b(rec([field(a,b(identifier(v),integer,[nodeid(pos(nan,1,1,36,1,36))])),field(b,b(integer(1),integer,[nodeid(pos(nan,1,1,40,1,40))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,45,1,45))]),b(integer(2),integer,[nodeid(pos(nan,1,1,47,1,47))])),couple(integer,integer),[nodeid(pos(nan,1,1,44,1,48))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,30,1,49))])),pred,[nodeid(pos(nan,1,1,8,1,49))])),boolean,[nodeid(pos(nan,1,1,3,1,50))])),pred,[nodeid(pos(nan,1,1,1,1,50))]),b(member(b(identifier(y),integer,[nodeid(pos(nan,1,1,54,1,54))]),b(interval(b(integer(1),integer,[nodeid(pos(nan,1,1,56,1,56))]),b(integer(2),integer,[nodeid(pos(nan,1,1,59,1,59))])),set(integer),[nodeid(pos(nan,1,1,56,1,59))])),pred,[nodeid(pos(nan,1,1,54,1,59))])),pred,[nodeid(pos(nan,1,1,1,1,59))]),b(equal(b(identifier(v),integer,[nodeid(pos(nan,1,1,63,1,63))]),b(integer(1),integer,[nodeid(pos(nan,1,1,65,1,65))])),pred,[nodeid(pos(nan,1,1,63,1,65))])),pred,[nodeid(pos(nan,1,1,1,1,65))]),b(not_equal(b(rec([field(a,b(integer(1),integer,[nodeid(pos(nan,1,1,76,1,76))])),field(b,b(identifier(y),integer,[nodeid(pos(nan,1,1,80,1,80))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,85,1,85))]),b(integer(2),integer,[nodeid(pos(nan,1,1,87,1,87))])),couple(integer,integer),[nodeid(pos(nan,1,1,84,1,88))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,70,1,89))]),b(rec([field(a,b(identifier(v),integer,[nodeid(pos(nan,1,1,98,1,98))])),field(b,b(integer(2),integer,[nodeid(pos(nan,1,1,102,1,102))])),field(c,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,107,1,107))]),b(integer(2),integer,[nodeid(pos(nan,1,1,109,1,109))])),couple(integer,integer),[nodeid(pos(nan,1,1,106,1,110))]))]),record([field(a,integer),field(b,integer),field(c,couple(integer,integer))]),[nodeid(pos(nan,1,1,92,1,111))])),pred,[nodeid(pos(nan,1,1,70,1,111))])),pred,[nodeid(pos(nan,1,1,1,1,112))]),b(equal(b(identifier(b),boolean,[nodeid(pos(nan,1,1,116,1,116))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,118,1,118))])),pred,[nodeid(pos(nan,1,1,116,1,118))])),pred,[nodeid(pos(nan,1,1,1,1,118))])),pred,[used_ids([b,v,y])])). |
2258 | | % #(a,v1,v2,w).((((a : POW(struct(x:INTEGER * INTEGER,y:INTEGER,z:BOOL)) & v1 : INTEGER) & v2 : INTEGER) & w : INTEGER) & ((a = {rec(x:1 |-> 33,y:22,z:FALSE),rec(x:2 |-> 34,y:44,z:TRUE),rec(x:3 |-> 34,y:45,z:TRUE)} & rec(x:v1 |-> v2,y:w,z:TRUE) : a) & (v1 + v2) + w < 57)) |
2259 | | must_fail_clpfd_det(125,b(exists([b(identifier(a),set(record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)])),[]),b(identifier(v1),integer,[]),b(identifier(v2),integer,[]),b(identifier(w),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(a),set(record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)])),[nodeid(pos(nan,1,1,1,1,1))]),b(set_extension([b(rec([field(x,b(couple(b(integer(1),integer,[nodeid(pos(nan,1,1,13,1,13))]),b(integer(33),integer,[nodeid(pos(nan,1,1,15,1,15))])),couple(integer,integer),[nodeid(pos(nan,1,1,12,1,17))])),field(y,b(integer(22),integer,[nodeid(pos(nan,1,1,21,1,21))])),field(z,b(boolean_false,boolean,[nodeid(pos(nan,1,1,26,1,26))]))]),record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)]),[nodeid(pos(nan,1,1,6,1,31))]),b(rec([field(x,b(couple(b(integer(2),integer,[nodeid(pos(nan,1,1,40,1,40))]),b(integer(34),integer,[nodeid(pos(nan,1,1,42,1,42))])),couple(integer,integer),[nodeid(pos(nan,1,1,39,1,44))])),field(y,b(integer(44),integer,[nodeid(pos(nan,1,1,48,1,48))])),field(z,b(boolean_true,boolean,[nodeid(pos(nan,1,1,53,1,53))]))]),record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)]),[nodeid(pos(nan,1,1,33,1,57))]),b(rec([field(x,b(couple(b(integer(3),integer,[nodeid(pos(nan,1,1,66,1,66))]),b(integer(34),integer,[nodeid(pos(nan,1,1,68,1,68))])),couple(integer,integer),[nodeid(pos(nan,1,1,65,1,70))])),field(y,b(integer(45),integer,[nodeid(pos(nan,1,1,74,1,74))])),field(z,b(boolean_true,boolean,[nodeid(pos(nan,1,1,79,1,79))]))]),record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)]),[nodeid(pos(nan,1,1,59,1,83))])]),set(record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)])),[nodeid(pos(nan,1,1,5,1,84))])),pred,[nodeid(pos(nan,1,1,1,1,84))]),b(member(b(rec([field(x,b(couple(b(identifier(v1),integer,[nodeid(pos(nan,1,1,95,1,95))]),b(identifier(v2),integer,[nodeid(pos(nan,1,1,98,1,98))])),couple(integer,integer),[nodeid(pos(nan,1,1,94,1,100))])),field(y,b(identifier(w),integer,[nodeid(pos(nan,1,1,104,1,104))])),field(z,b(boolean_true,boolean,[nodeid(pos(nan,1,1,108,1,108))]))]),record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)]),[nodeid(pos(nan,1,1,88,1,112))]),b(identifier(a),set(record([field(x,couple(integer,integer)),field(y,integer),field(z,boolean)])),[nodeid(pos(nan,1,1,114,1,114))])),pred,[nodeid(pos(nan,1,1,88,1,114))])),pred,[nodeid(pos(nan,1,1,1,1,114))]),b(less(b(add(b(add(b(identifier(v1),integer,[nodeid(pos(nan,1,1,118,1,118))]),b(identifier(v2),integer,[nodeid(pos(nan,1,1,121,1,121))])),integer,[nodeid(pos(nan,1,1,118,1,121))]),b(identifier(w),integer,[nodeid(pos(nan,1,1,124,1,124))])),integer,[nodeid(pos(nan,1,1,118,1,124))]),b(integer(57),integer,[nodeid(pos(nan,1,1,127,1,127))])),pred,[nodeid(pos(nan,1,1,118,1,127))])),pred,[nodeid(pos(nan,1,1,1,1,127))])),pred,[used_ids([a,v1,v2,w])])). |
2260 | | % #(x).(x : INTEGER & ((((x > 0 & x mod 50 = 0) & x mod 61 = 0) & x mod 23 = 0) & x < 70150)) |
2261 | | must_fail_clpfd_det(126,b(exists([b(identifier(x),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,1,1,1))]),b(integer(0),integer,[nodeid(pos(nan,1,1,5,1,5))])),pred,[nodeid(pos(nan,1,1,1,1,5))]),b(equal(b(modulo(b(identifier(x),integer,[nodeid(pos(nan,1,1,10,1,10))]),b(integer(50),integer,[nodeid(pos(nan,1,1,16,1,16))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,10,1,16))]),b(integer(0),integer,[nodeid(pos(nan,1,1,20,1,20))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,10,1,20))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,20))]),b(equal(b(modulo(b(identifier(x),integer,[nodeid(pos(nan,1,1,24,1,24))]),b(integer(61),integer,[nodeid(pos(nan,1,1,30,1,30))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,24,1,30))]),b(integer(0),integer,[nodeid(pos(nan,1,1,35,1,35))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,24,1,35))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,35))]),b(equal(b(modulo(b(identifier(x),integer,[nodeid(pos(nan,1,1,39,1,39))]),b(integer(23),integer,[nodeid(pos(nan,1,1,45,1,45))])),integer,[contains_wd_condition,nodeid(pos(nan,1,1,39,1,45))]),b(integer(0),integer,[nodeid(pos(nan,1,1,50,1,50))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,39,1,50))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,50))]),b(less(b(identifier(x),integer,[nodeid(pos(nan,1,1,54,1,54))]),b(integer(70150),integer,[nodeid(pos(nan,1,1,56,1,56))])),pred,[nodeid(pos(nan,1,1,54,1,56))])),pred,[contains_wd_condition,nodeid(pos(nan,1,1,1,1,56))])),pred,[used_ids([x])])). |
2262 | | % #(x,B,C).(((x : INTEGER & B : INTEGER) & C : BOOL) & (((((({x} : POW({101,102})) <=> B < 20 & x > 103) & B > 0) & B < 100) & (B = 19) <=> (C = TRUE)) & (C = FALSE => B < 20))) |
2263 | | must_fail_clpfd_det(127,b(exists([b(identifier(x),integer,[]),b(identifier('B'),integer,[]),b(identifier('C'),boolean,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(equivalence(b(member(b(set_extension([b(identifier(x),integer,[nodeid(pos(nan,1,1,3,1,3))])]),set(integer),[nodeid(pos(nan,1,1,2,1,4))]),b(pow_subset(b(value(avl_set(node(int(101),true,1,empty,node(int(102),true,0,empty,empty)))),set(integer),[nodeid(pos(nan,1,1,10,1,18))])),set(set(integer)),[nodeid(pos(nan,1,1,6,1,19))])),pred,[nodeid(pos(nan,1,1,2,1,19))]),b(less(b(identifier('B'),integer,[nodeid(pos(nan,1,1,25,1,25))]),b(integer(20),integer,[nodeid(pos(nan,1,1,27,1,27))])),pred,[nodeid(pos(nan,1,1,25,1,27))])),pred,[nodeid(pos(nan,1,1,2,1,27))]),b(greater(b(identifier(x),integer,[nodeid(pos(nan,1,1,33,1,33))]),b(integer(103),integer,[nodeid(pos(nan,1,1,35,1,35))])),pred,[nodeid(pos(nan,1,1,33,1,35))])),pred,[nodeid(pos(nan,1,1,1,1,35))]),b(greater(b(identifier('B'),integer,[nodeid(pos(nan,1,1,40,1,40))]),b(integer(0),integer,[nodeid(pos(nan,1,1,42,1,42))])),pred,[nodeid(pos(nan,1,1,40,1,42))])),pred,[nodeid(pos(nan,1,1,1,1,42))]),b(less(b(identifier('B'),integer,[nodeid(pos(nan,1,1,46,1,46))]),b(integer(100),integer,[nodeid(pos(nan,1,1,48,1,48))])),pred,[nodeid(pos(nan,1,1,46,1,48))])),pred,[nodeid(pos(nan,1,1,1,1,48))]),b(equivalence(b(equal(b(identifier('B'),integer,[nodeid(pos(nan,1,1,55,1,55))]),b(integer(19),integer,[nodeid(pos(nan,1,1,57,1,57))])),pred,[nodeid(pos(nan,1,1,55,1,57))]),b(equal(b(identifier('C'),boolean,[nodeid(pos(nan,1,1,64,1,64))]),b(boolean_true,boolean,[nodeid(pos(nan,1,1,66,1,66))])),pred,[nodeid(pos(nan,1,1,64,1,66))])),pred,[nodeid(pos(nan,1,1,55,1,66))])),pred,[nodeid(pos(nan,1,1,1,1,70))]),b(implication(b(equal(b(identifier('C'),boolean,[nodeid(pos(nan,1,1,75,1,75))]),b(boolean_false,boolean,[nodeid(pos(nan,1,1,77,1,77))])),pred,[nodeid(pos(nan,1,1,75,1,77))]),b(less(b(identifier('B'),integer,[nodeid(pos(nan,1,1,86,1,86))]),b(integer(20),integer,[nodeid(pos(nan,1,1,88,1,88))])),pred,[nodeid(pos(nan,1,1,86,1,88))])),pred,[nodeid(pos(nan,1,1,75,1,88))])),pred,[nodeid(pos(nan,1,1,1,1,90))])),pred,[used_ids(['B','C',x])])). |
2264 | | |
2265 | | % Eval Time: 10 ms (0 ms walltime) |
2266 | | % #(r,x,y,z).(((r : POW((INTEGER * INTEGER) * INTEGER) & x : INTEGER) & z : INTEGER) & (((r = {((1|->2)|->3),((3|->4)|->5),((6|->7)|->8),((9|->10)|->11),((12|->13)|->14)} & (x |-> y) |-> z : r) & y : 10 .. 13) & z < 11)) |
2267 | | must_fail_clpfd_det(128,b(let_predicate([b(identifier(r),set(couple(couple(integer,integer),integer)),[do_not_optimize_away,nodeid(pos(3,-1,1,3,1,3)),introduced_by(exists)])],[b(value(avl_set(node(((int(6),int(7)),int(8)),true,0,node(((int(1),int(2)),int(3)),true,1,empty,node(((int(3),int(4)),int(5)),true,0,empty,empty)),node(((int(9),int(10)),int(11)),true,1,empty,node(((int(12),int(13)),int(14)),true,0,empty,empty))))),set(couple(couple(integer,integer),integer)),[nodeid(pos(29,-1,1,93,1,168))])],b(exists([b(identifier(x),integer,[do_not_optimize_away,nodeid(pos(4,-1,1,5,1,5)),introduced_by(exists)]),b(identifier(y),integer,[do_not_optimize_away,nodeid(pos(5,-1,1,7,1,7)),introduced_by(exists)]),b(identifier(z),integer,[do_not_optimize_away,nodeid(pos(6,-1,1,9,1,9)),introduced_by(exists)])],b(conjunct(b(conjunct(b(member(b(couple(b(couple(b(identifier(x),integer,[nodeid(pos(58,-1,1,173,1,173)),introduced_by(exists)]),b(identifier(y),integer,[nodeid(pos(59,-1,1,179,1,179)),introduced_by(exists)])),couple(integer,integer),[nodeid(pos(57,-1,1,173,1,179))]),b(identifier(z),integer,[nodeid(pos(60,-1,1,186,1,186)),introduced_by(exists)])),couple(couple(integer,integer),integer),[nodeid(pos(56,-1,1,173,1,186))]),b(identifier(r),set(couple(couple(integer,integer),integer)),[nodeid(pos(61,-1,1,190,1,190)),introduced_by(exists)])),pred,[nodeid(pos(55,-1,1,173,1,190))]),b(member(b(identifier(y),integer,[nodeid(pos(63,-1,1,195,1,195)),introduced_by(exists)]),b(interval(b(integer(10),integer,[nodeid(pos(65,-1,1,199,1,200))]),b(integer(13),integer,[nodeid(pos(66,-1,1,205,1,206))])),set(integer),[nodeid(pos(64,-1,1,199,1,206))])),pred,[nodeid(pos(62,-1,1,195,1,206))])),pred,[]),b(less(b(identifier(z),integer,[nodeid(pos(68,-1,1,211,1,211)),introduced_by(exists)]),b(integer(11),integer,[nodeid(pos(69,-1,1,215,1,216))])),pred,[nodeid(pos(67,-1,1,211,1,216))])),pred,[])),pred,[used_ids([r])])),pred,[nodeid(pos(2,-1,1,1,1,218))])). |
2268 | | |
2269 | | % Eval Time: 0 ms (0 ms walltime) |
2270 | | % #(f,a,b,c,x,r).(((((a : INTEGER & b : INTEGER) & c : INTEGER) & x : INTEGER) & r : INTEGER) & ((((((((f : 11 .. 23 +-> 1 .. 10 & f = {a |-> 2,b |-> 3,c |-> 4}) & card({a,b,c}) = 3) & f(x) = r) & a > b) & b > c) & x /= a) & /* falsity */ x /= x) & r /= b)) |
2271 | | must_fail_clpfd_det(129,b(exists([b(identifier(f),set(couple(integer,integer)),[]),b(identifier(a),integer,[]),b(identifier(b),integer,[]),b(identifier(c),integer,[]),b(identifier(x),integer,[]),b(identifier(r),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(member(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(11,-1,1,1,1,1))]),b(partial_function(b(interval(b(integer(11),integer,[nodeid(pos(14,-1,1,5,1,6))]),b(integer(23),integer,[nodeid(pos(15,-1,1,9,1,10))])),set(integer),[nodeid(pos(13,-1,1,5,1,10))]),b(interval(b(integer(1),integer,[nodeid(pos(17,-1,1,16,1,16))]),b(integer(10),integer,[nodeid(pos(18,-1,1,19,1,20))])),set(integer),[nodeid(pos(16,-1,1,16,1,20))])),set(set(couple(integer,integer))),[nodeid(pos(12,-1,1,5,1,20))])),pred,[nodeid(pos(10,-1,1,1,1,20))]),b(equal(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(20,-1,1,24,1,24))]),b(set_extension([b(couple(b(identifier(a),integer,[nodeid(pos(23,-1,1,29,1,29))]),b(integer(2),integer,[nodeid(pos(24,-1,1,33,1,33))])),couple(integer,integer),[nodeid(pos(22,-1,1,29,1,33))]),b(couple(b(identifier(b),integer,[nodeid(pos(26,-1,1,36,1,36))]),b(integer(3),integer,[nodeid(pos(27,-1,1,40,1,40))])),couple(integer,integer),[nodeid(pos(25,-1,1,36,1,40))]),b(couple(b(identifier(c),integer,[nodeid(pos(29,-1,1,43,1,43))]),b(integer(4),integer,[nodeid(pos(30,-1,1,47,1,47))])),couple(integer,integer),[nodeid(pos(28,-1,1,43,1,47))])]),set(couple(integer,integer)),[nodeid(pos(21,-1,1,28,1,48))])),pred,[nodeid(pos(19,-1,1,24,1,48))])),pred,[nodeid(pos(9,-1,1,1,1,48))]),b(equal(b(card(b(set_extension([b(identifier(a),integer,[nodeid(pos(34,-1,1,58,1,58))]),b(identifier(b),integer,[nodeid(pos(35,-1,1,60,1,60))]),b(identifier(c),integer,[nodeid(pos(36,-1,1,62,1,62))])]),set(integer),[nodeid(pos(33,-1,1,57,1,63))])),integer,[nodeid(pos(32,-1,1,52,1,64))]),b(integer(3),integer,[nodeid(pos(37,-1,1,66,1,66))])),pred,[nodeid(pos(31,-1,1,52,1,66))])),pred,[nodeid(pos(8,-1,1,1,1,66))]),b(equal(b(function(b(identifier(f),set(couple(integer,integer)),[nodeid(pos(40,-1,1,70,1,70))]),b(identifier(x),integer,[nodeid(pos(41,-1,1,72,1,72))])),integer,[contains_wd_condition,nodeid(pos(39,-1,1,70,1,73))]),b(identifier(r),integer,[nodeid(pos(42,-1,1,75,1,75))])),pred,[contains_wd_condition,nodeid(pos(38,-1,1,70,1,75))])),pred,[contains_wd_condition,nodeid(pos(7,-1,1,1,1,75))]),b(greater(b(identifier(a),integer,[nodeid(pos(44,-1,1,79,1,79))]),b(identifier(b),integer,[nodeid(pos(45,-1,1,81,1,81))])),pred,[nodeid(pos(43,-1,1,79,1,81))])),pred,[contains_wd_condition,nodeid(pos(6,-1,1,1,1,81))]),b(greater(b(identifier(b),integer,[nodeid(pos(47,-1,1,85,1,85))]),b(identifier(c),integer,[nodeid(pos(48,-1,1,87,1,87))])),pred,[nodeid(pos(46,-1,1,85,1,87))])),pred,[contains_wd_condition,nodeid(pos(5,-1,1,1,1,87))]),b(not_equal(b(identifier(x),integer,[nodeid(pos(50,-1,1,91,1,91))]),b(identifier(a),integer,[nodeid(pos(51,-1,1,94,1,94))])),pred,[nodeid(pos(49,-1,1,91,1,94))])),pred,[contains_wd_condition,nodeid(pos(4,-1,1,1,1,94))]),b(falsity,pred,[was(not_equal(b(identifier(x),integer,[nodeid(pos(53,-1,1,98,1,98))]),b(identifier(x),integer,[nodeid(pos(54,-1,1,101,1,101))]))),nodeid(pos(52,-1,1,98,1,101))])),pred,[contains_wd_condition,nodeid(pos(3,-1,1,1,1,101))]),b(not_equal(b(identifier(r),integer,[nodeid(pos(56,-1,1,105,1,105))]),b(identifier(b),integer,[nodeid(pos(57,-1,1,108,1,108))])),pred,[nodeid(pos(55,-1,1,105,1,108))])),pred,[contains_wd_condition,nodeid(pos(2,-1,1,1,1,108))])),pred,[used_ids([]),contains_wd_condition])). |
2272 | | |
2273 | | % Eval Time: 10 ms (0 ms walltime) |
2274 | | % #(f,aa,x,y,r,v).((f : POW(INTEGER * (INTEGER * INTEGER)) & r : INTEGER * INTEGER) & ((((((f = {aa |-> (1 |-> aa),x |-> (2 |-> x + 1),y |-> (3 |-> y + 1)} & x : 1 .. 2) & aa : 0 .. 1) & y : 3 .. 5) & r = f(v)) & v : 2 .. 4) & prj1(INTEGER,INTEGER)(r) /: 2 .. 3)) |
2275 | | % REQUIRES TRY_FIND_ABORT=FALSE |
2276 | | must_fail_clpfd_det(130,b(exists([b(identifier(f),set(couple(integer,couple(integer,integer))),[]),b(identifier(aa),integer,[]),b(identifier(x),integer,[]),b(identifier(y),integer,[]),b(identifier(r),couple(integer,integer),[]),b(identifier(v),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(equal(b(identifier(f),set(couple(integer,couple(integer,integer))),[nodeid(pos(9,-1,1,1,1,1))]),b(set_extension([b(couple(b(identifier(aa),integer,[nodeid(pos(12,-1,1,6,1,7))]),b(couple(b(integer(1),integer,[nodeid(pos(14,-1,1,12,1,12))]),b(identifier(aa),integer,[nodeid(pos(15,-1,1,14,1,15))])),couple(integer,integer),[nodeid(pos(13,-1,1,11,1,16))])),couple(integer,couple(integer,integer)),[nodeid(pos(11,-1,1,6,1,16))]),b(couple(b(identifier(x),integer,[nodeid(pos(17,-1,1,19,1,19))]),b(couple(b(integer(2),integer,[nodeid(pos(19,-1,1,24,1,24))]),b(add(b(identifier(x),integer,[nodeid(pos(21,-1,1,26,1,26))]),b(integer(1),integer,[nodeid(pos(22,-1,1,28,1,28))])),integer,[nodeid(pos(20,-1,1,26,1,28))])),couple(integer,integer),[nodeid(pos(18,-1,1,23,1,29))])),couple(integer,couple(integer,integer)),[nodeid(pos(16,-1,1,19,1,29))]),b(couple(b(identifier(y),integer,[nodeid(pos(24,-1,1,32,1,32))]),b(couple(b(integer(3),integer,[nodeid(pos(26,-1,1,37,1,37))]),b(add(b(identifier(y),integer,[nodeid(pos(28,-1,1,39,1,39))]),b(integer(1),integer,[nodeid(pos(29,-1,1,41,1,41))])),integer,[nodeid(pos(27,-1,1,39,1,41))])),couple(integer,integer),[nodeid(pos(25,-1,1,36,1,42))])),couple(integer,couple(integer,integer)),[nodeid(pos(23,-1,1,32,1,42))])]),set(couple(integer,couple(integer,integer))),[nodeid(pos(10,-1,1,5,1,43))])),pred,[nodeid(pos(8,-1,1,1,1,43))]),b(member(b(identifier(x),integer,[nodeid(pos(31,-1,1,47,1,47))]),b(interval(b(integer(1),integer,[nodeid(pos(33,-1,1,49,1,49))]),b(integer(2),integer,[nodeid(pos(34,-1,1,52,1,52))])),set(integer),[nodeid(pos(32,-1,1,49,1,52))])),pred,[nodeid(pos(30,-1,1,47,1,52))])),pred,[nodeid(pos(7,-1,1,1,1,52))]),b(member(b(identifier(aa),integer,[nodeid(pos(36,-1,1,56,1,57))]),b(interval(b(integer(0),integer,[nodeid(pos(38,-1,1,59,1,59))]),b(integer(1),integer,[nodeid(pos(39,-1,1,62,1,62))])),set(integer),[nodeid(pos(37,-1,1,59,1,62))])),pred,[nodeid(pos(35,-1,1,56,1,62))])),pred,[nodeid(pos(6,-1,1,1,1,62))]),b(member(b(identifier(y),integer,[nodeid(pos(41,-1,1,66,1,66))]),b(interval(b(integer(3),integer,[nodeid(pos(43,-1,1,68,1,68))]),b(integer(5),integer,[nodeid(pos(44,-1,1,71,1,71))])),set(integer),[nodeid(pos(42,-1,1,68,1,71))])),pred,[nodeid(pos(40,-1,1,66,1,71))])),pred,[nodeid(pos(5,-1,1,1,1,71))]),b(equal(b(identifier(r),couple(integer,integer),[nodeid(pos(46,-1,1,75,1,75))]),b(function(b(identifier(f),set(couple(integer,couple(integer,integer))),[nodeid(pos(48,-1,1,79,1,79))]),b(identifier(v),integer,[nodeid(pos(49,-1,1,81,1,81))])),couple(integer,integer),[contains_wd_condition,nodeid(pos(47,-1,1,79,1,82))])),pred,[contains_wd_condition,nodeid(pos(45,-1,1,75,1,82))])),pred,[contains_wd_condition,nodeid(pos(4,-1,1,1,1,82))]),b(member(b(identifier(v),integer,[nodeid(pos(51,-1,1,86,1,86))]),b(interval(b(integer(2),integer,[nodeid(pos(53,-1,1,88,1,88))]),b(integer(4),integer,[nodeid(pos(54,-1,1,91,1,91))])),set(integer),[nodeid(pos(52,-1,1,88,1,91))])),pred,[nodeid(pos(50,-1,1,86,1,91))])),pred,[contains_wd_condition,nodeid(pos(3,-1,1,1,1,91))]),b(not_member(b(first_of_pair(b(identifier(r),couple(integer,integer),[nodeid(pos(60,-1,1,117,1,117))])),integer,[nodeid(pos(56,-1,1,95,1,118))]),b(interval(b(integer(2),integer,[nodeid(pos(62,-1,1,123,1,123))]),b(integer(3),integer,[nodeid(pos(63,-1,1,126,1,126))])),set(integer),[nodeid(pos(61,-1,1,123,1,126))])),pred,[nodeid(pos(55,-1,1,95,1,126))])),pred,[contains_wd_condition,nodeid(pos(2,-1,1,1,1,126))])),pred,[used_ids([]),contains_wd_condition])). |
2277 | | |
2278 | | % Eval Time: 0 ms (0 ms walltime) |
2279 | | % #(f,aa,x,y,r,v).((f : POW(INTEGER * struct(p1:INTEGER,p2:INTEGER)) & r : struct(p1:INTEGER,p2:INTEGER)) & ((((((f = {aa |-> rec(p1:1,p2:aa),x |-> rec(p1:2,p2:x + 1),y |-> rec(p1:3,p2:y + 1)} & x : 1 .. 2) & aa : 0 .. 1) & y : 3 .. 5) & r = f(v)) & v : 2 .. 4) & r'p1 /: 2 .. 3)) |
2280 | | % REQUIRES TRY_FIND_ABORT=FALSE |
2281 | | must_fail_clpfd_det(131,b(exists([b(identifier(f),set(couple(integer,record([field(p1,integer),field(p2,integer)]))),[]),b(identifier(aa),integer,[]),b(identifier(x),integer,[]),b(identifier(y),integer,[]),b(identifier(r),record([field(p1,integer),field(p2,integer)]),[]),b(identifier(v),integer,[])],b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(conjunct(b(equal(b(identifier(f),set(couple(integer,record([field(p1,integer),field(p2,integer)]))),[nodeid(pos(9,-1,1,1,1,1))]),b(set_extension([b(couple(b(identifier(aa),integer,[nodeid(pos(12,-1,1,6,1,7))]),b(rec([field(p1,b(integer(1),integer,[nodeid(pos(16,-1,1,18,1,18))])),field(p2,b(identifier(aa),integer,[nodeid(pos(19,-1,1,23,1,24))]))]),record([field(p1,integer),field(p2,integer)]),[nodeid(pos(13,-1,1,11,1,25))])),couple(integer,record([field(p1,integer),field(p2,integer)])),[nodeid(pos(11,-1,1,6,1,25))]),b(couple(b(identifier(x),integer,[nodeid(pos(21,-1,1,28,1,28))]),b(rec([field(p1,b(integer(2),integer,[nodeid(pos(25,-1,1,39,1,39))])),field(p2,b(add(b(identifier(x),integer,[nodeid(pos(29,-1,1,44,1,44))]),b(integer(1),integer,[nodeid(pos(30,-1,1,46,1,46))])),integer,[nodeid(pos(28,-1,1,44,1,46))]))]),record([field(p1,integer),field(p2,integer)]),[nodeid(pos(22,-1,1,32,1,47))])),couple(integer,record([field(p1,integer),field(p2,integer)])),[nodeid(pos(20,-1,1,28,1,47))]),b(couple(b(identifier(y),integer,[nodeid(pos(32,-1,1,50,1,50))]),b(rec([field(p1,b(integer(3),integer,[nodeid(pos(36,-1,1,61,1,61))])),field(p2,b(add(b(identifier(y),integer,[nodeid(pos(40,-1,1,66,1,66))]),b(integer(1),integer,[nodeid(pos(41,-1,1,68,1,68))])),integer,[nodeid(pos(39,-1,1,66,1,68))]))]),record([field(p1,integer),field(p2,integer)]),[nodeid(pos(33,-1,1,54,1,69))])),couple(integer,record([field(p1,integer),field(p2,integer)])),[nodeid(pos(31,-1,1,50,1,69))])]),set(couple(integer,record([field(p1,integer),field(p2,integer)]))),[nodeid(pos(10,-1,1,5,1,70))])),pred,[nodeid(pos(8,-1,1,1,1,70))]),b(member(b(identifier(x),integer,[nodeid(pos(43,-1,1,74,1,74))]),b(interval(b(integer(1),integer,[nodeid(pos(45,-1,1,76,1,76))]),b(integer(2),integer,[nodeid(pos(46,-1,1,79,1,79))])),set(integer),[nodeid(pos(44,-1,1,76,1,79))])),pred,[nodeid(pos(42,-1,1,74,1,79))])),pred,[nodeid(pos(7,-1,1,1,1,79))]),b(member(b(identifier(aa),integer,[nodeid(pos(48,-1,1,83,1,84))]),b(interval(b(integer(0),integer,[nodeid(pos(50,-1,1,86,1,86))]),b(integer(1),integer,[nodeid(pos(51,-1,1,89,1,89))])),set(integer),[nodeid(pos(49,-1,1,86,1,89))])),pred,[nodeid(pos(47,-1,1,83,1,89))])),pred,[nodeid(pos(6,-1,1,1,1,89))]),b(member(b(identifier(y),integer,[nodeid(pos(53,-1,1,93,1,93))]),b(interval(b(integer(3),integer,[nodeid(pos(55,-1,1,95,1,95))]),b(integer(5),integer,[nodeid(pos(56,-1,1,98,1,98))])),set(integer),[nodeid(pos(54,-1,1,95,1,98))])),pred,[nodeid(pos(52,-1,1,93,1,98))])),pred,[nodeid(pos(5,-1,1,1,1,98))]),b(equal(b(identifier(r),record([field(p1,integer),field(p2,integer)]),[nodeid(pos(58,-1,1,102,1,102))]),b(function(b(identifier(f),set(couple(integer,record([field(p1,integer),field(p2,integer)]))),[nodeid(pos(60,-1,1,106,1,106))]),b(identifier(v),integer,[nodeid(pos(61,-1,1,108,1,108))])),record([field(p1,integer),field(p2,integer)]),[contains_wd_condition,nodeid(pos(59,-1,1,106,1,109))])),pred,[contains_wd_condition,nodeid(pos(57,-1,1,102,1,109))])),pred,[contains_wd_condition,nodeid(pos(4,-1,1,1,1,109))]),b(member(b(identifier(v),integer,[nodeid(pos(63,-1,1,113,1,113))]),b(interval(b(integer(2),integer,[nodeid(pos(65,-1,1,115,1,115))]),b(integer(4),integer,[nodeid(pos(66,-1,1,118,1,118))])),set(integer),[nodeid(pos(64,-1,1,115,1,118))])),pred,[nodeid(pos(62,-1,1,113,1,118))])),pred,[contains_wd_condition,nodeid(pos(3,-1,1,1,1,118))]),b(not_member(b(record_field(b(identifier(r),record([field(p1,integer),field(p2,integer)]),[nodeid(pos(69,-1,1,122,1,122))]),p1),integer,[nodeid(pos(68,-1,1,122,1,125))]),b(interval(b(integer(2),integer,[nodeid(pos(72,-1,1,130,1,130))]),b(integer(3),integer,[nodeid(pos(73,-1,1,133,1,133))])),set(integer),[nodeid(pos(71,-1,1,130,1,133))])),pred,[nodeid(pos(67,-1,1,122,1,133))])),pred,[contains_wd_condition,nodeid(pos(2,-1,1,1,1,133))])),pred,[used_ids([]),contains_wd_condition])). |
2282 | | |
2283 | | % Eval Time: 0 ms (0 ms walltime) |
2284 | | % #(x,a).((x = (IF a < 10 THEN 0 ELSE 5 END ) & x : 6 .. 10) & a : 1 .. 23) |
2285 | | must_fail_clpfd_det(132,b(exists([b(identifier(x),integer,[]),b(identifier(a),integer,[])],b(conjunct(b(conjunct(b(equal(b(identifier(x),integer,[nodeid(pos(5,-1,1,1,1,1))]),b(if_then_else(b(less(b(identifier(a),integer,[nodeid(pos(8,-1,1,8,1,8))]),b(integer(10),integer,[nodeid(pos(9,-1,1,10,1,11))])),pred,[nodeid(pos(7,-1,1,8,1,11))]),b(integer(0),integer,[nodeid(pos(10,-1,1,18,1,18))]),b(integer(5),integer,[nodeid(pos(11,-1,1,25,1,25))])),integer,[nodeid(pos(6,-1,1,5,1,29))])),pred,[nodeid(pos(4,-1,1,1,1,29))]),b(member(b(identifier(x),integer,[nodeid(pos(13,-1,1,33,1,33))]),b(interval(b(integer(6),integer,[nodeid(pos(15,-1,1,35,1,35))]),b(integer(10),integer,[nodeid(pos(16,-1,1,38,1,39))])),set(integer),[nodeid(pos(14,-1,1,35,1,39))])),pred,[nodeid(pos(12,-1,1,33,1,39))])),pred,[nodeid(pos(3,-1,1,1,1,39))]),b(member(b(identifier(a),integer,[nodeid(pos(18,-1,1,43,1,43))]),b(interval(b(integer(1),integer,[nodeid(pos(20,-1,1,45,1,45))]),b(integer(23),integer,[nodeid(pos(21,-1,1,48,1,49))])),set(integer),[nodeid(pos(19,-1,1,45,1,49))])),pred,[nodeid(pos(17,-1,1,43,1,49))])),pred,[nodeid(pos(2,-1,1,1,1,49))])),pred,[used_ids([])])). |
2286 | | |
2287 | | % Eval Time: 0 ms (0 ms walltime) |
2288 | | % #(x,bb).((x : INTEGER & bb : BOOL) & (((IF x < 10 THEN TRUE ELSE bb END ) = FALSE & x < 20) & (IF x < 12 THEN FALSE ELSE bb END ) = TRUE)) |
2289 | | must_fail_clpfd_det(133,b(exists([b(identifier(x),integer,[]),b(identifier(bb),boolean,[])],b(conjunct(b(conjunct(b(equal(b(if_then_else(b(less(b(identifier(x),integer,[nodeid(pos(7,-1,1,4,1,4))]),b(integer(10),integer,[nodeid(pos(8,-1,1,6,1,7))])),pred,[nodeid(pos(6,-1,1,4,1,7))]),b(boolean_true,boolean,[nodeid(pos(9,-1,1,14,1,17))]),b(identifier(bb),boolean,[nodeid(pos(10,-1,1,24,1,25))])),boolean,[nodeid(pos(5,-1,1,1,1,29))]),b(boolean_false,boolean,[nodeid(pos(11,-1,1,33,1,37))])),pred,[nodeid(pos(4,-1,1,1,1,37))]),b(less(b(identifier(x),integer,[nodeid(pos(13,-1,1,41,1,41))]),b(integer(20),integer,[nodeid(pos(14,-1,1,43,1,44))])),pred,[nodeid(pos(12,-1,1,41,1,44))])),pred,[nodeid(pos(3,-1,1,1,1,44))]),b(equal(b(if_then_else(b(less(b(identifier(x),integer,[nodeid(pos(18,-1,1,51,1,51))]),b(integer(12),integer,[nodeid(pos(19,-1,1,53,1,54))])),pred,[nodeid(pos(17,-1,1,51,1,54))]),b(boolean_false,boolean,[nodeid(pos(20,-1,1,61,1,65))]),b(identifier(bb),boolean,[nodeid(pos(21,-1,1,72,1,73))])),boolean,[nodeid(pos(16,-1,1,48,1,77))]),b(boolean_true,boolean,[nodeid(pos(22,-1,1,81,1,84))])),pred,[nodeid(pos(15,-1,1,48,1,84))])),pred,[nodeid(pos(2,-1,1,1,1,84))])),pred,[used_ids([])])). |
2290 | | |
2291 | | :- endif. |
2292 | | |
2293 | | test_enabled(130) :- get_preference(find_abort_values,false). |
2294 | | test_enabled(131) :- get_preference(find_abort_values,false). |