Commit f4f6c6c1 by David Hauzar

### Merge branch 'counter-examples'

parents 2a6e896f 01fab6cc
 ... ... @@ -450,6 +450,20 @@ are grouped together under several tabs. decision by clicking on it. \end{description} % \subsection{Displaying Counterexamples} % % how to use counterexamples - explain labels, projections, the option --get-ce of why3prove and the setting in why3ide % % problem with set logic and counterexamples % % which provers % % where it is displayed % % how to interpret the display % % example \subsection{Additional Command-Line Options} The \texttt{ide} command also accepts the following options described for the command \texttt{prove} in Section~\ref{sec:proveoptions}. ... ...
 ... ... @@ -12,9 +12,6 @@ prelude "(set-logic AUFBVDTLIRA)" does not seem to include DT *) (* Counterexamples: makes it possible to get rid of more quantifiers while introducing premises *) (* transformation "split_intro" *) (* Counterexamples: set model parser *) model_parser "smtv2" ... ... @@ -24,9 +21,7 @@ import "discrimination.gen" transformation "inline_trivial" transformation "eliminate_builtin" (* temporarily disabled: too much experimental transformation "detect_polymorphism" *) transformation "eliminate_definition_if_poly" transformation "eliminate_inductive" transformation "eliminate_algebraic_if_poly" ... ...
 ... ... @@ -22,7 +22,11 @@ module M ensures { !x < old !x } = incr x; while "model" "model_trace:cond" !x > 0 do invariant { !x >= 0 } variant { !x } x := !x - 1 done while "model" "model_trace:cond" !x > 0 do invariant { !x >= 0 } variant { !x } x := !x - 1 done (************************************** ** Getting counterexamples for maps ** ... ...
 ... ... @@ -93,6 +93,7 @@ let add_proofs_attempts g = ~obsolete:true ~archived:false ~timelimit:5 ~steplimit:(-1) ~memlimit:1000 ~edit:None g p.Whyconf.prover Session.Scheduled ... ... @@ -106,5 +107,3 @@ let () = (* save the session on disk *) let () = Session.save_session config env_session.Session.session
 ... ... @@ -1285,7 +1285,7 @@ let why3tac ?(timelimit=timelimit) s gl = match res.pr_answer with | Valid -> admit_as_an_axiom gl | Invalid -> error "Invalid" | Unknown s -> error ("Don't know: " ^ s) | Call_provers.Unknown (s, _) -> error ("Don't know: " ^ s) | Call_provers.Failure s -> error ("Failure: " ^ s) | Call_provers.Timeout -> error "Timeout" | OutOfMemory -> error "Out Of Memory" ... ...
 ... ... @@ -16,6 +16,29 @@ let debug = Debug.register_info_flag "call_prover" ~desc:"Print@ debugging@ messages@ about@ prover@ calls@ \ and@ keep@ temporary@ files." type reason_unknown = | Resourceout | Other type prover_answer = | Valid | Invalid | Timeout | OutOfMemory | StepLimitExceeded | Unknown of (string * reason_unknown option) | Failure of string | HighFailure type prover_result = { pr_answer : prover_answer; pr_status : Unix.process_status; pr_output : string; pr_time : float; pr_steps : int; (* -1 if unknown *) pr_model : model; } (** time regexp "%h:%m:%s" *) type timeunit = | Hour ... ... @@ -83,26 +106,15 @@ let rec grep_steps out = function with _ -> grep_steps out l end (** *) type prover_answer = | Valid | Invalid | Timeout | OutOfMemory | StepLimitExceeded | Unknown of string | Failure of string | HighFailure type prover_result = { pr_answer : prover_answer; pr_status : Unix.process_status; pr_output : string; pr_time : float; pr_steps : int; (* -1 if unknown *) pr_model : model; } let grep_reason_unknown out = try let re = Str.regexp "^(:reason-unknown \$$[^)]*\$$" in ignore (Str.search_forward re out 0); match (Str.matched_group 1 out) with | "resourceout" -> Resourceout | _ -> Other with Not_found -> Other type prover_result_parser = { prp_regexps : (Str.regexp * prover_answer) list; ... ... @@ -112,15 +124,20 @@ type prover_result_parser = { prp_model_parser : Model_parser.model_parser; } let print_unknown_reason fmt r = match r with | Some Resourceout -> fprintf fmt " because of resource limit reached " | _ -> () let print_prover_answer fmt = function | Valid -> fprintf fmt "Valid" | Invalid -> fprintf fmt "Invalid" | Timeout -> fprintf fmt "Timeout" | OutOfMemory -> fprintf fmt "Ouf Of Memory" | StepLimitExceeded -> fprintf fmt "Step limit exceeded" | Unknown "" -> fprintf fmt "Unknown" | Unknown ("", r) -> fprintf fmt "Unknown%a" print_unknown_reason r | Failure "" -> fprintf fmt "Failure" | Unknown s -> fprintf fmt "Unknown (%s)" s | Unknown (s, r) -> fprintf fmt "Unknown %a(%s)" print_unknown_reason r s | Failure s -> fprintf fmt "Failure (%s)" s | HighFailure -> fprintf fmt "HighFailure" ... ... @@ -151,7 +168,7 @@ let rec grep out l = match l with ignore (Str.search_forward re out 0); match pa with | Valid | Invalid | Timeout | OutOfMemory | StepLimitExceeded -> pa | Unknown s -> Unknown (Str.replace_matched s out) | Unknown (s, ru) -> Unknown ((Str.replace_matched s out), ru) | Failure s -> Failure (Str.replace_matched s out) | HighFailure -> assert false with Not_found -> grep out l end ... ... @@ -188,6 +205,10 @@ let parse_prover_run res_parser time out ret on_timelimit timelimit ~printer_map Debug.dprintf debug "Call_provers: prover output:@\n%s@." out; let time = Opt.get_def (time) (grep_time out res_parser.prp_timeregexps) in let steps = Opt.get_def (-1) (grep_steps out res_parser.prp_stepregexps) in let reason_unknown = grep_reason_unknown out in let ans = match ans with | Unknown (s, _) -> Unknown (s, Some reason_unknown) | _ -> ans in let ans = match ans with | Unknown _ | HighFailure when on_timelimit && timelimit > 0 && time >= (0.9 *. float timelimit) -> Timeout ... ...
 ... ... @@ -15,6 +15,13 @@ open Model_parser (** {2 data types for prover answers} *) (** The reason why unknown was reported *) type reason_unknown = | Resourceout (** Out of resources *) | Other (** Other reason *) type prover_answer = | Valid (** The task is valid according to the prover *) ... ... @@ -26,7 +33,7 @@ type prover_answer = (** the task runs out of memory *) | StepLimitExceeded (** the task required more steps than the limit provided *) | Unknown of string | Unknown of (string * reason_unknown option) (** The prover can't determine if the task is valid *) | Failure of string (** The prover reports a failure *) ... ... @@ -45,8 +52,8 @@ type prover_result = { (** The time taken by the prover *) pr_steps : int; (** The number of steps taken by the prover (-1 if not available) *) (** The model produced by a the solver *) pr_model : model; (** The model produced by a the solver *) } val print_prover_answer : Format.formatter -> prover_answer -> unit ... ...
 ... ... @@ -13,6 +13,7 @@ %token DEC_STR %token MINUS_DEC_STR %token LPAREN RPAREN %token MK_T_REF %token EOF %% ... ... @@ -53,6 +54,7 @@ text_without_int: | AS { "as" } value: | LPAREN MK_T_REF SPACE value RPAREN { $4 } | integer {$1 } | decimal { $1 } | other_val_str { Model_parser.Unparsed$1 } ... ...