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