src/HOL/Library/Old_SMT.thy
changeset 61585 a9599d3d7610
parent 60500 903bb1495239
child 64078 0b22328a353c
equal deleted inserted replaced
61584:f06e5a5a4b46 61585:a9599d3d7610
    49 \<close>
    49 \<close>
    50 
    50 
    51 definition weight :: "int \<Rightarrow> bool \<Rightarrow> bool" where "weight _ P = P"
    51 definition weight :: "int \<Rightarrow> bool \<Rightarrow> bool" where "weight _ P = P"
    52 
    52 
    53 text \<open>
    53 text \<open>
    54 Weights must be non-negative.  The value @{text 0} is equivalent to providing
    54 Weights must be non-negative.  The value \<open>0\<close> is equivalent to providing
    55 no weight at all.
    55 no weight at all.
    56 
    56 
    57 Weights should only be used at quantifiers and only inside triggers (if the
    57 Weights should only be used at quantifiers and only inside triggers (if the
    58 quantifier has triggers).  Valid usages of weights are as follows:
    58 quantifier has triggers).  Valid usages of weights are as follows:
    59 
    59 
   148 
   148 
   149 subsection \<open>Configuration\<close>
   149 subsection \<open>Configuration\<close>
   150 
   150 
   151 text \<open>
   151 text \<open>
   152 The current configuration can be printed by the command
   152 The current configuration can be printed by the command
   153 @{text old_smt_status}, which shows the values of most options.
   153 \<open>old_smt_status\<close>, which shows the values of most options.
   154 \<close>
   154 \<close>
   155 
   155 
   156 
   156 
   157 
   157 
   158 subsection \<open>General configuration options\<close>
   158 subsection \<open>General configuration options\<close>
   159 
   159 
   160 text \<open>
   160 text \<open>
   161 The option @{text old_smt_solver} can be used to change the target SMT
   161 The option \<open>old_smt_solver\<close> can be used to change the target SMT
   162 solver.  The possible values can be obtained from the @{text old_smt_status}
   162 solver.  The possible values can be obtained from the \<open>old_smt_status\<close>
   163 command.
   163 command.
   164 
   164 
   165 Due to licensing restrictions, Yices and Z3 are not installed/enabled
   165 Due to licensing restrictions, Yices and Z3 are not installed/enabled
   166 by default.  Z3 is free for non-commercial applications and can be enabled
   166 by default.  Z3 is free for non-commercial applications and can be enabled
   167 by setting the @{text OLD_Z3_NON_COMMERCIAL} environment variable to
   167 by setting the \<open>OLD_Z3_NON_COMMERCIAL\<close> environment variable to
   168 @{text yes}.
   168 \<open>yes\<close>.
   169 \<close>
   169 \<close>
   170 
   170 
   171 declare [[ old_smt_solver = z3 ]]
   171 declare [[ old_smt_solver = z3 ]]
   172 
   172 
   173 text \<open>
   173 text \<open>
   240 
   240 
   241 
   241 
   242 subsection \<open>Certificates\<close>
   242 subsection \<open>Certificates\<close>
   243 
   243 
   244 text \<open>
   244 text \<open>
   245 By setting the option @{text old_smt_certificates} to the name of a file,
   245 By setting the option \<open>old_smt_certificates\<close> to the name of a file,
   246 all following applications of an SMT solver a cached in that file.
   246 all following applications of an SMT solver a cached in that file.
   247 Any further application of the same SMT solver (using the very same
   247 Any further application of the same SMT solver (using the very same
   248 configuration) re-uses the cached certificate instead of invoking the
   248 configuration) re-uses the cached certificate instead of invoking the
   249 solver.  An empty string disables caching certificates.
   249 solver.  An empty string disables caching certificates.
   250 
   250 
   251 The filename should be given as an explicit path.  It is good
   251 The filename should be given as an explicit path.  It is good
   252 practice to use the name of the current theory (with ending
   252 practice to use the name of the current theory (with ending
   253 @{text ".certs"} instead of @{text ".thy"}) as the certificates file.
   253 \<open>.certs\<close> instead of \<open>.thy\<close>) as the certificates file.
   254 Certificate files should be used at most once in a certain theory context,
   254 Certificate files should be used at most once in a certain theory context,
   255 to avoid race conditions with other concurrent accesses.
   255 to avoid race conditions with other concurrent accesses.
   256 \<close>
   256 \<close>
   257 
   257 
   258 declare [[ old_smt_certificates = "" ]]
   258 declare [[ old_smt_certificates = "" ]]
   259 
   259 
   260 text \<open>
   260 text \<open>
   261 The option @{text old_smt_read_only_certificates} controls whether only
   261 The option \<open>old_smt_read_only_certificates\<close> controls whether only
   262 stored certificates are should be used or invocation of an SMT solver
   262 stored certificates are should be used or invocation of an SMT solver
   263 is allowed.  When set to @{text true}, no SMT solver will ever be
   263 is allowed.  When set to \<open>true\<close>, no SMT solver will ever be
   264 invoked and only the existing certificates found in the configured
   264 invoked and only the existing certificates found in the configured
   265 cache are used;  when set to @{text false} and there is no cached
   265 cache are used;  when set to \<open>false\<close> and there is no cached
   266 certificate for some proposition, then the configured SMT solver is
   266 certificate for some proposition, then the configured SMT solver is
   267 invoked.
   267 invoked.
   268 \<close>
   268 \<close>
   269 
   269 
   270 declare [[ old_smt_read_only_certificates = false ]]
   270 declare [[ old_smt_read_only_certificates = false ]]
   273 
   273 
   274 subsection \<open>Tracing\<close>
   274 subsection \<open>Tracing\<close>
   275 
   275 
   276 text \<open>
   276 text \<open>
   277 The SMT method, when applied, traces important information.  To
   277 The SMT method, when applied, traces important information.  To
   278 make it entirely silent, set the following option to @{text false}.
   278 make it entirely silent, set the following option to \<open>false\<close>.
   279 \<close>
   279 \<close>
   280 
   280 
   281 declare [[ old_smt_verbose = true ]]
   281 declare [[ old_smt_verbose = true ]]
   282 
   282 
   283 text \<open>
   283 text \<open>
   284 For tracing the generated problem file given to the SMT solver as
   284 For tracing the generated problem file given to the SMT solver as
   285 well as the returned result of the solver, the option
   285 well as the returned result of the solver, the option
   286 @{text old_smt_trace} should be set to @{text true}.
   286 \<open>old_smt_trace\<close> should be set to \<open>true\<close>.
   287 \<close>
   287 \<close>
   288 
   288 
   289 declare [[ old_smt_trace = false ]]
   289 declare [[ old_smt_trace = false ]]
   290 
   290 
   291 text \<open>
   291 text \<open>
   292 From the set of assumptions given to the SMT solver, those assumptions
   292 From the set of assumptions given to the SMT solver, those assumptions
   293 used in the proof are traced when the following option is set to
   293 used in the proof are traced when the following option is set to
   294 @{term true}.  This only works for Z3 when it runs in non-oracle mode
   294 @{term true}.  This only works for Z3 when it runs in non-oracle mode
   295 (see options @{text old_smt_solver} and @{text old_smt_oracle} above).
   295 (see options \<open>old_smt_solver\<close> and \<open>old_smt_oracle\<close> above).
   296 \<close>
   296 \<close>
   297 
   297 
   298 declare [[ old_smt_trace_used_facts = false ]]
   298 declare [[ old_smt_trace_used_facts = false ]]
   299 
   299 
   300 
   300 
   302 subsection \<open>Schematic rules for Z3 proof reconstruction\<close>
   302 subsection \<open>Schematic rules for Z3 proof reconstruction\<close>
   303 
   303 
   304 text \<open>
   304 text \<open>
   305 Several prof rules of Z3 are not very well documented.  There are two
   305 Several prof rules of Z3 are not very well documented.  There are two
   306 lemma groups which can turn failing Z3 proof reconstruction attempts
   306 lemma groups which can turn failing Z3 proof reconstruction attempts
   307 into succeeding ones: the facts in @{text z3_rule} are tried prior to
   307 into succeeding ones: the facts in \<open>z3_rule\<close> are tried prior to
   308 any implemented reconstruction procedure for all uncertain Z3 proof
   308 any implemented reconstruction procedure for all uncertain Z3 proof
   309 rules;  the facts in @{text z3_simp} are only fed to invocations of
   309 rules;  the facts in \<open>z3_simp\<close> are only fed to invocations of
   310 the simplifier when reconstructing theory-specific proof steps.
   310 the simplifier when reconstructing theory-specific proof steps.
   311 \<close>
   311 \<close>
   312 
   312 
   313 lemmas [old_z3_rule] =
   313 lemmas [old_z3_rule] =
   314   refl eq_commute conj_commute disj_commute simp_thms nnf_simps
   314   refl eq_commute conj_commute disj_commute simp_thms nnf_simps