src/HOL/SMT.thy
author blanchet
Tue Mar 27 16:59:13 2012 +0300 (2012-03-27)
changeset 47152 446cfc760ccf
parent 46950 d0181abdbdac
child 47701 157e6108a342
permissions -rw-r--r--
renamed "smt_fixed" to "smt_read_only_certificates"
boehmes@36898
     1
(*  Title:      HOL/SMT.thy
boehmes@36898
     2
    Author:     Sascha Boehme, TU Muenchen
boehmes@36898
     3
*)
boehmes@36898
     4
boehmes@36898
     5
header {* Bindings to Satisfiability Modulo Theories (SMT) solvers *}
boehmes@36898
     6
boehmes@36898
     7
theory SMT
boehmes@41426
     8
imports Record
wenzelm@46950
     9
keywords "smt_status" :: diag
boehmes@36898
    10
uses
boehmes@41124
    11
  "Tools/SMT/smt_utils.ML"
boehmes@40424
    12
  "Tools/SMT/smt_failure.ML"
boehmes@40424
    13
  "Tools/SMT/smt_config.ML"
boehmes@40277
    14
  ("Tools/SMT/smt_builtin.ML")
boehmes@41426
    15
  ("Tools/SMT/smt_datatypes.ML")
boehmes@36898
    16
  ("Tools/SMT/smt_normalize.ML")
boehmes@36898
    17
  ("Tools/SMT/smt_translate.ML")
boehmes@36898
    18
  ("Tools/SMT/smt_solver.ML")
boehmes@36898
    19
  ("Tools/SMT/smtlib_interface.ML")
boehmes@41328
    20
  ("Tools/SMT/z3_interface.ML")
boehmes@36898
    21
  ("Tools/SMT/z3_proof_parser.ML")
boehmes@36898
    22
  ("Tools/SMT/z3_proof_tools.ML")
boehmes@36898
    23
  ("Tools/SMT/z3_proof_literals.ML")
boehmes@40662
    24
  ("Tools/SMT/z3_proof_methods.ML")
boehmes@36898
    25
  ("Tools/SMT/z3_proof_reconstruction.ML")
boehmes@36898
    26
  ("Tools/SMT/z3_model.ML")
boehmes@40162
    27
  ("Tools/SMT/smt_setup_solvers.ML")
boehmes@36898
    28
begin
boehmes@36898
    29
boehmes@36898
    30
boehmes@36898
    31
huffman@36902
    32
subsection {* Triggers for quantifier instantiation *}
boehmes@36898
    33
boehmes@36898
    34
text {*
boehmes@41125
    35
Some SMT solvers support patterns as a quantifier instantiation
boehmes@41125
    36
heuristics.  Patterns may either be positive terms (tagged by "pat")
boehmes@41125
    37
triggering quantifier instantiations -- when the solver finds a
boehmes@41125
    38
term matching a positive pattern, it instantiates the corresponding
boehmes@41125
    39
quantifier accordingly -- or negative terms (tagged by "nopat")
boehmes@41125
    40
inhibiting quantifier instantiations.  A list of patterns
boehmes@41125
    41
of the same kind is called a multipattern, and all patterns in a
boehmes@41125
    42
multipattern are considered conjunctively for quantifier instantiation.
boehmes@41125
    43
A list of multipatterns is called a trigger, and their multipatterns
boehmes@41125
    44
act disjunctively during quantifier instantiation.  Each multipattern
boehmes@41125
    45
should mention at least all quantified variables of the preceding
boehmes@41125
    46
quantifier block.
boehmes@36898
    47
*}
boehmes@36898
    48
boehmes@36898
    49
datatype pattern = Pattern
boehmes@36898
    50
boehmes@37124
    51
definition pat :: "'a \<Rightarrow> pattern" where "pat _ = Pattern"
boehmes@37124
    52
definition nopat :: "'a \<Rightarrow> pattern" where "nopat _ = Pattern"
boehmes@36898
    53
boehmes@37124
    54
definition trigger :: "pattern list list \<Rightarrow> bool \<Rightarrow> bool"
boehmes@36898
    55
where "trigger _ P = P"
boehmes@36898
    56
boehmes@36898
    57
boehmes@36898
    58
boehmes@40664
    59
subsection {* Quantifier weights *}
boehmes@40664
    60
boehmes@40664
    61
text {*
boehmes@40664
    62
Weight annotations to quantifiers influence the priority of quantifier
boehmes@40664
    63
instantiations.  They should be handled with care for solvers, which support
boehmes@40664
    64
them, because incorrect choices of weights might render a problem unsolvable.
boehmes@40664
    65
*}
boehmes@40664
    66
boehmes@40664
    67
definition weight :: "int \<Rightarrow> bool \<Rightarrow> bool" where "weight _ P = P"
boehmes@40664
    68
boehmes@40664
    69
text {*
boehmes@40664
    70
Weights must be non-negative.  The value @{text 0} is equivalent to providing
boehmes@40664
    71
no weight at all.
boehmes@40664
    72
boehmes@40664
    73
Weights should only be used at quantifiers and only inside triggers (if the
boehmes@40664
    74
quantifier has triggers).  Valid usages of weights are as follows:
boehmes@40664
    75
boehmes@40664
    76
\begin{itemize}
boehmes@40664
    77
\item
boehmes@40664
    78
@{term "\<forall>x. trigger [[pat (P x)]] (weight 2 (P x))"}
boehmes@40664
    79
\item
boehmes@40664
    80
@{term "\<forall>x. weight 3 (P x)"}
boehmes@40664
    81
\end{itemize}
boehmes@40664
    82
*}
boehmes@40664
    83
boehmes@40664
    84
boehmes@40664
    85
huffman@36902
    86
subsection {* Higher-order encoding *}
boehmes@36898
    87
boehmes@36898
    88
text {*
boehmes@36898
    89
Application is made explicit for constants occurring with varying
boehmes@36898
    90
numbers of arguments.  This is achieved by the introduction of the
boehmes@36898
    91
following constant.
boehmes@36898
    92
*}
boehmes@36898
    93
boehmes@41127
    94
definition fun_app where "fun_app f = f"
boehmes@36898
    95
boehmes@36898
    96
text {*
boehmes@36898
    97
Some solvers support a theory of arrays which can be used to encode
boehmes@36898
    98
higher-order functions.  The following set of lemmas specifies the
boehmes@36898
    99
properties of such (extensional) arrays.
boehmes@36898
   100
*}
boehmes@36898
   101
boehmes@36898
   102
lemmas array_rules = ext fun_upd_apply fun_upd_same fun_upd_other
boehmes@37157
   103
  fun_upd_upd fun_app_def
boehmes@36898
   104
boehmes@36898
   105
boehmes@36898
   106
huffman@36902
   107
subsection {* First-order logic *}
boehmes@36898
   108
boehmes@36898
   109
text {*
boehmes@41059
   110
Some SMT solvers only accept problems in first-order logic, i.e.,
boehmes@41059
   111
where formulas and terms are syntactically separated. When
boehmes@41059
   112
translating higher-order into first-order problems, all
boehmes@41059
   113
uninterpreted constants (those not built-in in the target solver)
boehmes@36898
   114
are treated as function symbols in the first-order sense.  Their
boehmes@41059
   115
occurrences as head symbols in atoms (i.e., as predicate symbols) are
boehmes@41281
   116
turned into terms by logically equating such atoms with @{term True}.
boehmes@41281
   117
For technical reasons, @{term True} and @{term False} occurring inside
boehmes@41281
   118
terms are replaced by the following constants.
boehmes@36898
   119
*}
boehmes@36898
   120
boehmes@41281
   121
definition term_true where "term_true = True"
boehmes@41281
   122
definition term_false where "term_false = False"
boehmes@41281
   123
boehmes@36898
   124
boehmes@36898
   125
boehmes@37151
   126
subsection {* Integer division and modulo for Z3 *}
boehmes@37151
   127
boehmes@37151
   128
definition z3div :: "int \<Rightarrow> int \<Rightarrow> int" where
boehmes@37151
   129
  "z3div k l = (if 0 \<le> l then k div l else -(k div (-l)))"
boehmes@37151
   130
boehmes@37151
   131
definition z3mod :: "int \<Rightarrow> int \<Rightarrow> int" where
boehmes@37151
   132
  "z3mod k l = (if 0 \<le> l then k mod l else k mod (-l))"
boehmes@37151
   133
boehmes@37151
   134
boehmes@37151
   135
huffman@36902
   136
subsection {* Setup *}
boehmes@36898
   137
boehmes@40277
   138
use "Tools/SMT/smt_builtin.ML"
boehmes@41426
   139
use "Tools/SMT/smt_datatypes.ML"
boehmes@36898
   140
use "Tools/SMT/smt_normalize.ML"
boehmes@36898
   141
use "Tools/SMT/smt_translate.ML"
boehmes@36898
   142
use "Tools/SMT/smt_solver.ML"
boehmes@36898
   143
use "Tools/SMT/smtlib_interface.ML"
boehmes@36898
   144
use "Tools/SMT/z3_interface.ML"
boehmes@36898
   145
use "Tools/SMT/z3_proof_parser.ML"
boehmes@36898
   146
use "Tools/SMT/z3_proof_tools.ML"
boehmes@36898
   147
use "Tools/SMT/z3_proof_literals.ML"
boehmes@40662
   148
use "Tools/SMT/z3_proof_methods.ML"
boehmes@36898
   149
use "Tools/SMT/z3_proof_reconstruction.ML"
boehmes@36898
   150
use "Tools/SMT/z3_model.ML"
boehmes@40162
   151
use "Tools/SMT/smt_setup_solvers.ML"
boehmes@36898
   152
boehmes@36898
   153
setup {*
boehmes@40424
   154
  SMT_Config.setup #>
boehmes@41059
   155
  SMT_Normalize.setup #>
boehmes@36898
   156
  SMT_Solver.setup #>
boehmes@41059
   157
  SMTLIB_Interface.setup #>
boehmes@41059
   158
  Z3_Interface.setup #>
boehmes@36898
   159
  Z3_Proof_Reconstruction.setup #>
boehmes@40162
   160
  SMT_Setup_Solvers.setup
boehmes@36898
   161
*}
boehmes@36898
   162
boehmes@36898
   163
boehmes@36898
   164
huffman@36902
   165
subsection {* Configuration *}
boehmes@36898
   166
boehmes@36898
   167
text {*
boehmes@36899
   168
The current configuration can be printed by the command
boehmes@36899
   169
@{text smt_status}, which shows the values of most options.
boehmes@36898
   170
*}
boehmes@36898
   171
boehmes@36898
   172
boehmes@36898
   173
boehmes@36898
   174
subsection {* General configuration options *}
boehmes@36898
   175
boehmes@36898
   176
text {*
boehmes@36898
   177
The option @{text smt_solver} can be used to change the target SMT
boehmes@41432
   178
solver.  The possible values can be obtained from the @{text smt_status}
boehmes@41432
   179
command.
boehmes@41459
   180
boehmes@41459
   181
Due to licensing restrictions, Yices and Z3 are not installed/enabled
boehmes@41459
   182
by default.  Z3 is free for non-commercial applications and can be enabled
boehmes@41462
   183
by simply setting the environment variable @{text Z3_NON_COMMERCIAL} to
boehmes@41462
   184
@{text yes}.
boehmes@36898
   185
*}
boehmes@36898
   186
boehmes@41601
   187
declare [[ smt_solver = z3 ]]
boehmes@36898
   188
boehmes@36898
   189
text {*
boehmes@36898
   190
Since SMT solvers are potentially non-terminating, there is a timeout
boehmes@36898
   191
(given in seconds) to restrict their runtime.  A value greater than
boehmes@36898
   192
120 (seconds) is in most cases not advisable.
boehmes@36898
   193
*}
boehmes@36898
   194
boehmes@36898
   195
declare [[ smt_timeout = 20 ]]
boehmes@36898
   196
boehmes@40162
   197
text {*
boehmes@41121
   198
SMT solvers apply randomized heuristics.  In case a problem is not
boehmes@41121
   199
solvable by an SMT solver, changing the following option might help.
boehmes@41121
   200
*}
boehmes@41121
   201
boehmes@41121
   202
declare [[ smt_random_seed = 1 ]]
boehmes@41121
   203
boehmes@41121
   204
text {*
boehmes@40162
   205
In general, the binding to SMT solvers runs as an oracle, i.e, the SMT
boehmes@40162
   206
solvers are fully trusted without additional checks.  The following
boehmes@40162
   207
option can cause the SMT solver to run in proof-producing mode, giving
boehmes@40162
   208
a checkable certificate.  This is currently only implemented for Z3.
boehmes@40162
   209
*}
boehmes@40162
   210
boehmes@40162
   211
declare [[ smt_oracle = false ]]
boehmes@40162
   212
boehmes@40162
   213
text {*
boehmes@40162
   214
Each SMT solver provides several commandline options to tweak its
boehmes@40162
   215
behaviour.  They can be passed to the solver by setting the following
boehmes@40162
   216
options.
boehmes@40162
   217
*}
boehmes@40162
   218
boehmes@41432
   219
declare [[ cvc3_options = "", remote_cvc3_options = "" ]]
boehmes@41432
   220
declare [[ yices_options = "" ]]
boehmes@41432
   221
declare [[ z3_options = "", remote_z3_options = "" ]]
boehmes@40162
   222
boehmes@40162
   223
text {*
boehmes@40162
   224
Enable the following option to use built-in support for datatypes and
boehmes@40162
   225
records.  Currently, this is only implemented for Z3 running in oracle
boehmes@40162
   226
mode.
boehmes@40162
   227
*}
boehmes@40162
   228
boehmes@40162
   229
declare [[ smt_datatypes = false ]]
boehmes@40162
   230
boehmes@41125
   231
text {*
boehmes@41125
   232
The SMT method provides an inference mechanism to detect simple triggers
boehmes@41125
   233
in quantified formulas, which might increase the number of problems
boehmes@41125
   234
solvable by SMT solvers (note: triggers guide quantifier instantiations
boehmes@41125
   235
in the SMT solver).  To turn it on, set the following option.
boehmes@41125
   236
*}
boehmes@41125
   237
boehmes@41125
   238
declare [[ smt_infer_triggers = false ]]
boehmes@41125
   239
boehmes@41125
   240
text {*
boehmes@41125
   241
The SMT method monomorphizes the given facts, that is, it tries to
boehmes@41125
   242
instantiate all schematic type variables with fixed types occurring
boehmes@41125
   243
in the problem.  This is a (possibly nonterminating) fixed-point
boehmes@41125
   244
construction whose cycles are limited by the following option.
boehmes@41125
   245
*}
boehmes@41125
   246
boehmes@43230
   247
declare [[ monomorph_max_rounds = 5 ]]
boehmes@41125
   248
boehmes@41762
   249
text {*
boehmes@41762
   250
In addition, the number of generated monomorphic instances is limited
boehmes@41762
   251
by the following option.
boehmes@41762
   252
*}
boehmes@41762
   253
boehmes@43230
   254
declare [[ monomorph_max_new_instances = 500 ]]
boehmes@41762
   255
boehmes@36898
   256
boehmes@36898
   257
boehmes@36898
   258
subsection {* Certificates *}
boehmes@36898
   259
boehmes@36898
   260
text {*
boehmes@36898
   261
By setting the option @{text smt_certificates} to the name of a file,
boehmes@36898
   262
all following applications of an SMT solver a cached in that file.
boehmes@36898
   263
Any further application of the same SMT solver (using the very same
boehmes@36898
   264
configuration) re-uses the cached certificate instead of invoking the
boehmes@36898
   265
solver.  An empty string disables caching certificates.
boehmes@36898
   266
boehmes@36898
   267
The filename should be given as an explicit path.  It is good
boehmes@36898
   268
practice to use the name of the current theory (with ending
boehmes@36898
   269
@{text ".certs"} instead of @{text ".thy"}) as the certificates file.
boehmes@36898
   270
*}
boehmes@36898
   271
boehmes@36898
   272
declare [[ smt_certificates = "" ]]
boehmes@36898
   273
boehmes@36898
   274
text {*
blanchet@47152
   275
The option @{text smt_read_only_certificates} controls whether only
blanchet@47152
   276
stored certificates are should be used or invocation of an SMT solver
blanchet@47152
   277
is allowed.  When set to @{text true}, no SMT solver will ever be
boehmes@36898
   278
invoked and only the existing certificates found in the configured
boehmes@36898
   279
cache are used;  when set to @{text false} and there is no cached
boehmes@36898
   280
certificate for some proposition, then the configured SMT solver is
boehmes@36898
   281
invoked.
boehmes@36898
   282
*}
boehmes@36898
   283
blanchet@47152
   284
declare [[ smt_read_only_certificates = false ]]
boehmes@36898
   285
boehmes@36898
   286
boehmes@36898
   287
boehmes@36898
   288
subsection {* Tracing *}
boehmes@36898
   289
boehmes@36898
   290
text {*
boehmes@40424
   291
The SMT method, when applied, traces important information.  To
boehmes@40424
   292
make it entirely silent, set the following option to @{text false}.
boehmes@40424
   293
*}
boehmes@40424
   294
boehmes@40424
   295
declare [[ smt_verbose = true ]]
boehmes@40424
   296
boehmes@40424
   297
text {*
boehmes@36898
   298
For tracing the generated problem file given to the SMT solver as
boehmes@36898
   299
well as the returned result of the solver, the option
boehmes@36898
   300
@{text smt_trace} should be set to @{text true}.
boehmes@36898
   301
*}
boehmes@36898
   302
boehmes@36898
   303
declare [[ smt_trace = false ]]
boehmes@36898
   304
boehmes@36898
   305
text {*
boehmes@40162
   306
From the set of assumptions given to the SMT solver, those assumptions
boehmes@40162
   307
used in the proof are traced when the following option is set to
boehmes@40162
   308
@{term true}.  This only works for Z3 when it runs in non-oracle mode
boehmes@40162
   309
(see options @{text smt_solver} and @{text smt_oracle} above).
boehmes@36898
   310
*}
boehmes@36898
   311
boehmes@40162
   312
declare [[ smt_trace_used_facts = false ]]
boehmes@39298
   313
boehmes@36898
   314
boehmes@36898
   315
huffman@36902
   316
subsection {* Schematic rules for Z3 proof reconstruction *}
boehmes@36898
   317
boehmes@36898
   318
text {*
boehmes@36898
   319
Several prof rules of Z3 are not very well documented.  There are two
boehmes@36898
   320
lemma groups which can turn failing Z3 proof reconstruction attempts
boehmes@36898
   321
into succeeding ones: the facts in @{text z3_rule} are tried prior to
boehmes@36898
   322
any implemented reconstruction procedure for all uncertain Z3 proof
boehmes@36898
   323
rules;  the facts in @{text z3_simp} are only fed to invocations of
boehmes@36898
   324
the simplifier when reconstructing theory-specific proof steps.
boehmes@36898
   325
*}
boehmes@36898
   326
boehmes@36898
   327
lemmas [z3_rule] =
boehmes@36898
   328
  refl eq_commute conj_commute disj_commute simp_thms nnf_simps
boehmes@36898
   329
  ring_distribs field_simps times_divide_eq_right times_divide_eq_left
boehmes@36898
   330
  if_True if_False not_not
boehmes@36898
   331
boehmes@36898
   332
lemma [z3_rule]:
boehmes@44488
   333
  "(P \<and> Q) = (\<not>(\<not>P \<or> \<not>Q))"
boehmes@44488
   334
  "(P \<and> Q) = (\<not>(\<not>Q \<or> \<not>P))"
boehmes@44488
   335
  "(\<not>P \<and> Q) = (\<not>(P \<or> \<not>Q))"
boehmes@44488
   336
  "(\<not>P \<and> Q) = (\<not>(\<not>Q \<or> P))"
boehmes@44488
   337
  "(P \<and> \<not>Q) = (\<not>(\<not>P \<or> Q))"
boehmes@44488
   338
  "(P \<and> \<not>Q) = (\<not>(Q \<or> \<not>P))"
boehmes@44488
   339
  "(\<not>P \<and> \<not>Q) = (\<not>(P \<or> Q))"
boehmes@44488
   340
  "(\<not>P \<and> \<not>Q) = (\<not>(Q \<or> P))"
boehmes@44488
   341
  by auto
boehmes@44488
   342
boehmes@44488
   343
lemma [z3_rule]:
boehmes@36898
   344
  "(P \<longrightarrow> Q) = (Q \<or> \<not>P)"
boehmes@36898
   345
  "(\<not>P \<longrightarrow> Q) = (P \<or> Q)"
boehmes@36898
   346
  "(\<not>P \<longrightarrow> Q) = (Q \<or> P)"
boehmes@44488
   347
  "(True \<longrightarrow> P) = P"
boehmes@44488
   348
  "(P \<longrightarrow> True) = True"
boehmes@44488
   349
  "(False \<longrightarrow> P) = True"
boehmes@44488
   350
  "(P \<longrightarrow> P) = True"
boehmes@36898
   351
  by auto
boehmes@36898
   352
boehmes@36898
   353
lemma [z3_rule]:
boehmes@36898
   354
  "((P = Q) \<longrightarrow> R) = (R | (Q = (\<not>P)))"
boehmes@36898
   355
  by auto
boehmes@36898
   356
boehmes@36898
   357
lemma [z3_rule]:
boehmes@44488
   358
  "(\<not>True) = False"
boehmes@44488
   359
  "(\<not>False) = True"
boehmes@44488
   360
  "(x = x) = True"
boehmes@44488
   361
  "(P = True) = P"
boehmes@44488
   362
  "(True = P) = P"
boehmes@44488
   363
  "(P = False) = (\<not>P)"
boehmes@44488
   364
  "(False = P) = (\<not>P)"
boehmes@36898
   365
  "((\<not>P) = P) = False"
boehmes@36898
   366
  "(P = (\<not>P)) = False"
boehmes@44488
   367
  "((\<not>P) = (\<not>Q)) = (P = Q)"
boehmes@44488
   368
  "\<not>(P = (\<not>Q)) = (P = Q)"
boehmes@44488
   369
  "\<not>((\<not>P) = Q) = (P = Q)"
boehmes@36898
   370
  "(P \<noteq> Q) = (Q = (\<not>P))"
boehmes@36898
   371
  "(P = Q) = ((\<not>P \<or> Q) \<and> (P \<or> \<not>Q))"
boehmes@36898
   372
  "(P \<noteq> Q) = ((\<not>P \<or> \<not>Q) \<and> (P \<or> Q))"
boehmes@36898
   373
  by auto
boehmes@36898
   374
boehmes@36898
   375
lemma [z3_rule]:
boehmes@36898
   376
  "(if P then P else \<not>P) = True"
boehmes@36898
   377
  "(if \<not>P then \<not>P else P) = True"
boehmes@36898
   378
  "(if P then True else False) = P"
boehmes@36898
   379
  "(if P then False else True) = (\<not>P)"
boehmes@44488
   380
  "(if P then Q else True) = ((\<not>P) \<or> Q)"
boehmes@44488
   381
  "(if P then Q else True) = (Q \<or> (\<not>P))"
boehmes@44488
   382
  "(if P then Q else \<not>Q) = (P = Q)"
boehmes@44488
   383
  "(if P then Q else \<not>Q) = (Q = P)"
boehmes@44488
   384
  "(if P then \<not>Q else Q) = (P = (\<not>Q))"
boehmes@44488
   385
  "(if P then \<not>Q else Q) = ((\<not>Q) = P)"
boehmes@36898
   386
  "(if \<not>P then x else y) = (if P then y else x)"
boehmes@44488
   387
  "(if P then (if Q then x else y) else x) = (if P \<and> (\<not>Q) then y else x)"
boehmes@44488
   388
  "(if P then (if Q then x else y) else x) = (if (\<not>Q) \<and> P then y else x)"
boehmes@44488
   389
  "(if P then (if Q then x else y) else y) = (if P \<and> Q then x else y)"
boehmes@44488
   390
  "(if P then (if Q then x else y) else y) = (if Q \<and> P then x else y)"
boehmes@44488
   391
  "(if P then x else if P then y else z) = (if P then x else z)"
boehmes@44488
   392
  "(if P then x else if Q then x else y) = (if P \<or> Q then x else y)"
boehmes@44488
   393
  "(if P then x else if Q then x else y) = (if Q \<or> P then x else y)"
boehmes@44488
   394
  "(if P then x = y else x = z) = (x = (if P then y else z))"
boehmes@44488
   395
  "(if P then x = y else y = z) = (y = (if P then x else z))"
boehmes@44488
   396
  "(if P then x = y else z = y) = (y = (if P then x else z))"
boehmes@36898
   397
  by auto
boehmes@36898
   398
boehmes@36898
   399
lemma [z3_rule]:
boehmes@44488
   400
  "0 + (x::int) = x"
boehmes@44488
   401
  "x + 0 = x"
boehmes@44488
   402
  "x + x = 2 * x"
boehmes@44488
   403
  "0 * x = 0"
boehmes@44488
   404
  "1 * x = x"
boehmes@44488
   405
  "x + y = y + x"
boehmes@44488
   406
  by auto
boehmes@44488
   407
boehmes@44488
   408
lemma [z3_rule]:  (* for def-axiom *)
boehmes@36898
   409
  "P = Q \<or> P \<or> Q"
boehmes@36898
   410
  "P = Q \<or> \<not>P \<or> \<not>Q"
boehmes@36898
   411
  "(\<not>P) = Q \<or> \<not>P \<or> Q"
boehmes@36898
   412
  "(\<not>P) = Q \<or> P \<or> \<not>Q"
boehmes@36898
   413
  "P = (\<not>Q) \<or> \<not>P \<or> Q"
boehmes@36898
   414
  "P = (\<not>Q) \<or> P \<or> \<not>Q"
boehmes@36898
   415
  "P \<noteq> Q \<or> P \<or> \<not>Q"
boehmes@36898
   416
  "P \<noteq> Q \<or> \<not>P \<or> Q"
boehmes@36898
   417
  "P \<noteq> (\<not>Q) \<or> P \<or> Q"
boehmes@36898
   418
  "(\<not>P) \<noteq> Q \<or> P \<or> Q"
boehmes@36898
   419
  "P \<or> Q \<or> P \<noteq> (\<not>Q)"
boehmes@36898
   420
  "P \<or> Q \<or> (\<not>P) \<noteq> Q"
boehmes@36898
   421
  "P \<or> \<not>Q \<or> P \<noteq> Q"
boehmes@36898
   422
  "\<not>P \<or> Q \<or> P \<noteq> Q"
boehmes@44488
   423
  "P \<or> y = (if P then x else y)"
boehmes@44488
   424
  "P \<or> (if P then x else y) = y"
boehmes@44488
   425
  "\<not>P \<or> x = (if P then x else y)"
boehmes@44488
   426
  "\<not>P \<or>  (if P then x else y) = x"
boehmes@44488
   427
  "P \<or> R \<or> \<not>(if P then Q else R)"
boehmes@44488
   428
  "\<not>P \<or> Q \<or> \<not>(if P then Q else R)"
boehmes@44488
   429
  "\<not>(if P then Q else R) \<or> \<not>P \<or> Q"
boehmes@44488
   430
  "\<not>(if P then Q else R) \<or> P \<or> R"
boehmes@44488
   431
  "(if P then Q else R) \<or> \<not>P \<or> \<not>Q"
boehmes@44488
   432
  "(if P then Q else R) \<or> P \<or> \<not>R"
boehmes@44488
   433
  "(if P then \<not>Q else R) \<or> \<not>P \<or> Q"
boehmes@44488
   434
  "(if P then Q else \<not>R) \<or> P \<or> R"
boehmes@36898
   435
  by auto
boehmes@36898
   436
boehmes@37124
   437
boehmes@37124
   438
boehmes@37124
   439
hide_type (open) pattern
boehmes@41281
   440
hide_const Pattern fun_app term_true term_false z3div z3mod
boehmes@41280
   441
hide_const (open) trigger pat nopat weight
boehmes@37124
   442
boehmes@36898
   443
end