src/Tools/Metis/src/selftest.sml
author wenzelm
Sat, 07 Apr 2012 16:41:59 +0200
changeset 47389 e8552cba702d
parent 45778 df6e210fb44c
child 72004 913162a47d9f
permissions -rw-r--r--
explicit checks stable_finished_theory/stable_command allow parallel asynchronous command transactions; tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     1
(* ========================================================================= *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     2
(* METIS TESTS                                                               *)
39502
cffceed8e7fa fix license
blanchet
parents: 39501
diff changeset
     3
(* Copyright (c) 2004 Joe Hurd, distributed under the BSD License            *)
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     4
(* ========================================================================= *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     5
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     6
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     7
(* Dummy versions of Moscow ML declarations to stop real compilers barfing.  *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     8
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     9
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    10
(*mlton
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    11
val quotation = ref true;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    12
val quietdec  = ref true;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    13
val loadPath  = ref ([] : string list);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    14
val load = fn (_ : string) => ();
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    15
*)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    16
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    17
(*polyml
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    18
val quotation = ref true;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    19
val quietdec  = ref true;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    20
val loadPath  = ref ([] : string list);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    21
val load = fn (_ : string) => ();
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    22
*)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    23
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    24
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    25
(* Load and open some useful modules                                         *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    26
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    27
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    28
val () = loadPath := !loadPath @ ["../bin/mosml"];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    29
val () = app load ["Options"];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    30
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    31
open Useful;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    32
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    33
val time = Portable.time;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    34
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    35
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    36
(* Problem data.                                                             *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    37
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    38
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    39
val ref oldquietdec = quietdec;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    40
val () = quietdec := true;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    41
val () = quotation := true;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    42
use "../src/problems.sml";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    43
val () = quietdec := oldquietdec;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    44
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    45
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    46
(* Helper functions.                                                         *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    47
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    48
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    49
fun partialOrderToString (SOME LESS) = "SOME LESS"
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    50
  | partialOrderToString (SOME GREATER) = "SOME GREATER"
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    51
  | partialOrderToString (SOME EQUAL) = "SOME EQUAL"
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    52
  | partialOrderToString NONE = "NONE";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    53
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    54
fun SAY s =
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
    55
    TextIO.print
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    56
      ("-------------------------------------" ^
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    57
       "-------------------------------------\n" ^ s ^ "\n\n");
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    58
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
    59
fun printval p x = (TextIO.print (Print.toString p x ^ "\n\n"); x);
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    60
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    61
fun mkCl p th = Clause.mk {parameters = p, id = Clause.newId (), thm = th};
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    62
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    63
val pvBool = printval Print.ppBool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    64
and pvPo = printval (Print.ppMap partialOrderToString Print.ppString)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    65
and pvFm = printval Formula.pp
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    66
and pvFms = printval (Print.ppList Formula.pp)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    67
and pvThm = printval Thm.pp
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    68
and pvEqn : Rule.equation -> Rule.equation = printval (Print.ppMap snd Thm.pp)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    69
and pvNet = printval (LiteralNet.pp Print.ppInt)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    70
and pvRw = printval Rewrite.pp
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    71
and pvU = printval Units.pp
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    72
and pvLits = printval LiteralSet.pp
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    73
and pvCl = printval Clause.pp
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    74
and pvCls = printval (Print.ppList Clause.pp)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    75
and pvM = printval Model.pp;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    76
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    77
val NV = Name.fromString
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    78
and NF = Name.fromString
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    79
and NR = Name.fromString;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    80
val V = Term.Var o NV
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    81
and C = (fn c => Term.Fn (NF c, []))
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    82
and T = Term.parse
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    83
and A = Atom.parse
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    84
and L = Literal.parse
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    85
and F = Formula.parse
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    86
and S = Subst.fromList;
42102
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
    87
val LS = LiteralSet.fromList o List.map L;
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    88
val AX = Thm.axiom o LS;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    89
val CL = mkCl Clause.default o AX;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    90
val Q = (fn th => (Thm.destUnitEq th, th)) o AX o singleton
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    91
and U = (fn th => (Thm.destUnit th, th)) o AX o singleton;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    92
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    93
fun test_fun eq p r a =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    94
  if eq r a then p a ^ "\n" else
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
    95
    (TextIO.print
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
    96
       ("\n\n" ^
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
    97
        "test: should have\n-->" ^ p r ^ "<--\n\n" ^
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
    98
        "test: actually have\n-->" ^ p a ^ "<--\n\n");
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    99
     raise Fail "test: failed a test");
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   100
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
   101
fun test eq p r a = TextIO.print (test_fun eq p r a ^ "\n");
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   102
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   103
val test_tm = test Term.equal Term.toString o Term.parse;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   104
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   105
val test_fm = test Formula.equal Formula.toString o Formula.parse;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   106
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   107
fun test_id p f a = test p a (f a);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   108
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   109
fun chop_newline s =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   110
    if String.sub (s,0) = #"\n" then String.extract (s,1,NONE) else s;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   111
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   112
fun unquote (QUOTE q) = q
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   113
  | unquote (ANTIQUOTE _) = raise Fail "unquote";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   114
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   115
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   116
val () = SAY "The parser and pretty-printer";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   117
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   118
42102
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
   119
fun prep l = (chop_newline o String.concat o List.map unquote) l;
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   120
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   121
fun mini_print n fm = withRef (Print.lineLength,n) Formula.toString fm;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   122
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   123
fun testlen_pp n q =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   124
    (fn s => test_fun equal I s ((mini_print n o Formula.fromString) s))
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   125
      (prep q);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   126
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
   127
fun test_pp q = TextIO.print (testlen_pp 40 q ^ "\n");
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   128
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   129
val () = test_pp `3 = f x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   130
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   131
val () = test_pp `f x y = y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   132
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   133
val () = test_pp `P x y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   134
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   135
val () = test_pp `P (f x) y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   136
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   137
val () = test_pp `f x = 3`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   138
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   139
val () = test_pp `!x. P x y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   140
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   141
val () = test_pp `!x y. P x y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   142
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   143
val () = test_pp `!x y z. P x y z`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   144
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   145
val () = test_pp `x = y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   146
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   147
val () = test_pp `x = 3`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   148
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   149
val () = test_pp `x + y = y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   150
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   151
val () = test_pp `x / y * z = w`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   152
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   153
val () = test_pp `x * y * z = x * (y * z)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   154
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   155
val () = test_pp `!x. ?y. x <= y /\ y <= x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   156
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   157
val () = test_pp `?x. !y. x + y = y /\ y <= x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   158
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   159
val () = test_pp `p /\ q \/ r /\ p ==> q <=> p`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   160
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   161
val () = test_pp `p`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   162
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   163
val () = test_pp `~!x. bool x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   164
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   165
val () = test_pp `p ==> !x. bool x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   166
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   167
val () = test_pp `p ==> ~!x. bool x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   168
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   169
val () = test_pp `~!x. bool x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   170
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   171
val () = test_pp `~~!x. bool x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   172
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   173
val () = test_pp `hello + there <> everybody`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   174
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   175
val () = test_pp `!x y. ?z. x < z /\ y < z`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   176
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   177
val () = test_pp `~(!x. P x) <=> ?y. ~P y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   178
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   179
val () = test_pp `?y. x < y ==> !v. ?w. x * v < y * w`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   180
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   181
val () = test_pp `(<=)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   182
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   183
val () = test_pp `(<=) <= b`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   184
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   185
val () = test_pp `(<=) <= (+)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   186
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   187
val () = test_pp `(<=) x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   188
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   189
val () = test_pp `(<=) <= (+) x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   190
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   191
val () = test_pp `~B (P % ((,) % c_a % v_b))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   192
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   193
val () = test_pp `B ((<=) % 0 % (LENGTH % NIL))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   194
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   195
val () = test_pp `~(a = b)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   196
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   197
val () = test_pp `!x. p x ==> !y. p y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   198
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   199
val () = test_pp `(!x. p x) ==> !y. p y`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   200
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   201
val () = test_pp `!x. ~~x = x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   202
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   203
val () = test_pp `x + (y + z) = a`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   204
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   205
val () = test_pp `(x @ y) @ z = a`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   206
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   207
val () = test_pp `p ((a @ a) @ a = a)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   208
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   209
val () = test_pp `!x y z. (x @ y) @ z = (x @ z) @ y @ z`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   210
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   211
val () = test_pp `~(!x. q x) /\ p`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   212
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   213
val () = test_pp `!x. f (~~x) b (~c)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   214
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   215
val () = test_pp `p ==> ~(a /\ b)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   216
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   217
val () = test_pp `!water. drinks (water)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   218
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   219
val () = test_pp `!vat water. drinks ((vat) p x (water))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   220
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   221
val () = test_pp `!x y. ~{x < y} /\ T`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   222
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   223
val () = test_pp `[3]`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   224
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   225
val () = test_pp `
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   226
!x y z. ?x' y' z'.
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   227
  P x y z ==> P x' y' z'`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   228
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   229
val () = test_pp `
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   230
(!x. P x ==> !x. Q x) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   231
((!x. Q x \/ R x) ==> ?x. Q x /\ R x) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   232
((?x. R x) ==> !x. L x ==> M x) ==>
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   233
!x. P x /\ L x ==> M x`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   234
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   235
val () = test_pp `
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   236
!x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   237
  x12 x13 x14 x15 x16 x17 x18 x19 x20
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   238
  x21 x22 x23 x24 x25 x26 x27 x28 x29
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   239
  x30 x31 x32. ?y0 y1 y2 y3 y4 y5 y6 y7.
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   240
  P`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   241
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   242
val () = test_pp `
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   243
!x x x x x x x x x x x x x x x x x x x x
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   244
  x x x x x x x x x x. ?y y y y y y y y
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   245
  y y y y y y y y y y y.
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   246
  P (x, y) /\ P (x, y) /\ P (x, y) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   247
  P (x, y) /\ P (x, y) /\ P (x, y) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   248
  P (x, y) /\ P (x, y) /\ P (x, y) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   249
  P (x, y) /\ P (x, y) /\ P (x, y) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   250
  P (x, y) /\ P (x, y) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   251
  ~~~~~~~~~~~~~f
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   252
                 (f (f (f x y) (f x y))
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   253
                    (f (f x y) (f x y)))
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   254
                 (f (f (f x y) (f x y))
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   255
                    (f (f x y) (f x y)))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   256
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   257
val () = test_pp `
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   258
(!x.
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   259
   extremely__long__predicate__name) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   260
F`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   261
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   262
val () = test_pp `
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   263
(!x. x = x) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   264
(!x y. ~(x = y) \/ y = x) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   265
(!x y z.
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   266
   ~(x = y) \/ ~(y = z) \/ x = z) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   267
(!x y z. b . x . y . z = x . (y . z)) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   268
(!x y. t . x . y = y . x) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   269
(!x y z. ~(x = y) \/ x . z = y . z) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   270
(!x y z. ~(x = y) \/ z . x = z . y) ==>
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   271
~(b . (b . (t . b) . b) . t . x . y .
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   272
  z = y . (x . z)) ==> F`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   273
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   274
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   275
val () = SAY "Substitution";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   276
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   277
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   278
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   279
    test Name.equal Name.toString (NV"x")
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   280
      (Term.variantPrime (NameSet.fromList [NV"y",NV"z" ]) (NV"x"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   281
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   282
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   283
    test Name.equal Name.toString (NV"x'")
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   284
      (Term.variantPrime (NameSet.fromList [NV"x",NV"y" ]) (NV"x"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   285
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   286
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   287
    test Name.equal Name.toString (NV"x''")
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   288
      (Term.variantPrime (NameSet.fromList [NV"x",NV"x'"]) (NV"x"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   289
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   290
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   291
    test Name.equal Name.toString (NV"x")
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   292
      (Term.variantNum (NameSet.fromList [NV"y",NV"z"]) (NV"x"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   293
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   294
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   295
    test Name.equal Name.toString (NV"x0")
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   296
      (Term.variantNum (NameSet.fromList [NV"x",NV"y"]) (NV"x"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   297
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   298
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   299
    test Name.equal Name.toString (NV"x1")
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   300
      (Term.variantNum (NameSet.fromList [NV"x",NV"x0"]) (NV"x"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   301
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   302
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   303
    test_fm
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   304
      `!x. x = $z`
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   305
      (Formula.subst (S [(NV"y", V"z")]) (F`!x. x = $y`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   306
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   307
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   308
    test_fm
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   309
      `!x'. x' = $x`
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   310
      (Formula.subst (S [(NV"y", V"x")]) (F`!x. x = $y`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   311
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   312
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   313
    test_fm
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   314
      `!x' x''. x' = $x ==> x' = x''`
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   315
      (Formula.subst (S [(NV"y", V"x")])
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   316
         (F`!x x'. x = $y ==> x = x'`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   317
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   318
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   319
val () = SAY "Unification";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   320
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   321
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   322
fun unify_and_apply tm1 tm2 =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   323
    Subst.subst (Subst.unify Subst.empty tm1 tm2) tm1;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   324
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   325
val () = test_tm `c` (unify_and_apply (V"x") (C"c"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   326
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   327
val () = test_tm `c` (unify_and_apply (C"c") (V"x"));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   328
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   329
val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   330
    test_tm
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   331
      `f c`
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   332
      (unify_and_apply
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   333
         (Term.Fn (NF"f", [V"x"]))
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   334
         (Term.Fn (NF"f", [C"c"])));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   335
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   336
val () = test_tm `f 0 0 0` (unify_and_apply (T`f 0 $x $x`) (T`f $y $y $z`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   337
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   338
fun f x y = (printval Subst.pp (Atom.unify Subst.empty x y); ());
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   339
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   340
val () = f (NR"P", [V"x"]) (NR"P", [V"x"]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   341
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   342
val () = f (NR"P", [V"x"]) (NR"P", [C"c"]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   343
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   344
val () = f (A`P c_x`) (A`P $x`);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   345
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   346
val () = f (A`q $x (f $x)`) (A`q $y $z`);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   347
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   348
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   349
val () = SAY "The logical kernel";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   350
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   351
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   352
val th0 = AX [`p`,`q`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   353
val th1 = AX [`~p`,`r`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   354
val th2 = Thm.resolve (L`p`) th0 th1;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   355
val _ = printval Proof.pp (Proof.proof th2);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   356
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   357
val th0 = Rule.relationCongruence Atom.eqRelation;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   358
val th1 =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   359
    Thm.subst (S [(NV"y0",T`$x`),(NV"y1",T`$y`),(NV"x1",T`$z`),(NV"x0",T`$x`)]) th0;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   360
val th2 = Thm.resolve (L`$x = $x`) Rule.reflexivity th1;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   361
val th3 = Rule.symNeq (L`~($z = $y)`) th2;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   362
val _ = printval Proof.pp (Proof.proof th3);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   363
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   364
(* Testing the elimination of redundancies in proofs *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   365
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   366
val th0 = Rule.reflexivity;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   367
val th1 = Thm.subst (S [(NV"x", Term.Fn (NF"f", [V"y"]))]) th0;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   368
val th2 = Thm.subst (S [(NV"y", C"c")]) th1;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   369
val _ = printval Proof.pp (Proof.proof th2);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   370
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   371
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   372
val () = SAY "Derived rules of inference";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   373
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   374
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   375
val th0 = pvThm (AX [`$x = a`, `f a = $x`, `~(a = b)`, `a = $x`,
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   376
                     `$x = a`, `a = $x`, `~(b = a)`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   377
val th1 = pvThm (Rule.removeSym th0);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   378
val th2 = pvThm (Rule.symEq (L`a = $x`) th0);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   379
val th3 = pvThm (Rule.symEq (L`f a = $x`) th0);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   380
val th5 = pvThm (Rule.symNeq (L`~(a = b)`) th0);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   381
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   382
(* Testing the rewrConv conversion *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   383
val (x_y as (x,y), eqTh) = pvEqn (Q`e * (i $z * $z) = e`);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   384
val tm = Term.Fn (NF"f",[x]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   385
val path : int list = [0];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   386
val reflTh = Thm.refl tm;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   387
val reflLit = Thm.destUnit reflTh;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   388
val th = Thm.equality reflLit (1 :: path) y;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   389
val th = Thm.resolve reflLit reflTh th;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   390
val th = pvThm (try (Thm.resolve (Literal.mkEq x_y) eqTh) th);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   391
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   392
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   393
val () = SAY "Discrimination nets for literals";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   394
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   395
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   396
val n = pvNet (LiteralNet.new {fifo = true});
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   397
val n = pvNet (LiteralNet.insert n (L`P (f c $x a)`, 1));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   398
val n = pvNet (LiteralNet.insert n (L`P (f c $y a)`, 2));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   399
val n = pvNet (LiteralNet.insert n (L`P (f c a a)`, 3));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   400
val n = pvNet (LiteralNet.insert n (L`P (f c b a)`, 4));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   401
val n = pvNet (LiteralNet.insert n (L`~Q`, 5));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   402
val n = pvNet (LiteralNet.insert n (L`~Q`, 6));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   403
val n = pvNet (LiteralNet.insert n (L`~Q`, 7));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   404
val n = pvNet (LiteralNet.insert n (L`~Q`, 8));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   405
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   406
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   407
val () = SAY "The Knuth-Bendix ordering on terms";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   408
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   409
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   410
val kboOrder = KnuthBendixOrder.default;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   411
val kboCmp = KnuthBendixOrder.compare kboOrder;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   412
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   413
val x = pvPo (kboCmp (T`f a`, T`g b`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   414
val x = pvPo (kboCmp (T`f a b`, T`g b`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   415
val x = pvPo (kboCmp (T`f $x`, T`g a`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   416
val x = pvPo (kboCmp (T`f a $x`, T`g $x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   417
val x = pvPo (kboCmp (T`f $x`, T`g $x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   418
val x = pvPo (kboCmp (T`f $x`, T`f $x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   419
val x = pvPo (kboCmp (T`$x + $y`, T`$x + $x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   420
val x = pvPo (kboCmp (T`$x + $y + $x`, T`$y + $x + $x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   421
val x = pvPo (kboCmp (T`$x + $y + $x`, T`$y * $x + $x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   422
val x = pvPo (kboCmp (T`a`, T`$x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   423
val x = pvPo (kboCmp (T`f a`, T`$x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   424
val x = pvPo (kboCmp (T`f $x (f $y $z)`, T`f (f $x $y) $z`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   425
val x = pvPo (kboCmp (T`f (g $x a)`, T`f (h a $x)`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   426
val x = pvPo (kboCmp (T`f (g a)`, T`f (h $x)`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   427
val x = pvPo (kboCmp (T`f (h a)`, T`f (g $x)`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   428
val x = pvPo (kboCmp (T`f $y`, T`f (g a b c)`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   429
val x = pvPo (kboCmp (T`$x * $y + $x * $z`, T`$x * ($y + $z)`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   430
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   431
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   432
val () = SAY "Rewriting";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   433
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   434
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   435
val eqnsToRw = Rewrite.addList (Rewrite.new kboCmp) o enumerate;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   436
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   437
val eqns = [Q`e * $x = $x`, Q`$x * e = $x`, Q`i $x * $x = e`, Q`$x * i $x = e`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   438
val ax = pvThm (AX [`e * (i $z * $z) = i e * e`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   439
val th = pvThm (Rewrite.orderedRewrite kboCmp eqns ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   440
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   441
val rw = pvRw (eqnsToRw eqns);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   442
val th = pvThm (snd (try (Rewrite.rewriteConv rw kboCmp) (T`e * e`)));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   443
val th = pvThm (snd (try (Rewrite.rewriteConv rw kboCmp) (T`e * (i $z * $z)`)));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   444
val th = pvThm (try (Rewrite.rewriteRule rw kboCmp) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   445
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   446
(* Bug check: in this one a literal goes missing, due to the Resolve in Subst *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   447
val eqns = [Q`f a = a`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   448
val ax = pvThm (AX [`~(g (f a) = b)`, `~(f a = a)`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   449
val th = pvThm (try (Rewrite.orderedRewrite kboCmp eqns) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   450
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   451
(* Bug check: term paths were not being reversed before use *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   452
val eqns = [Q`a = f a`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   453
val ax = pvThm (AX [`a <= f (f a)`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   454
val th = pvThm (try (Rewrite.orderedRewrite kboCmp eqns) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   455
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   456
(* Bug check: Equality used to complain if the literal didn't exist *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   457
val eqns = [Q`b = f a`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   458
val ax = pvThm (AX [`~(f a = f a)`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   459
val th = pvThm (try (Rewrite.orderedRewrite kboCmp eqns) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   460
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   461
(* Testing the rewriting with disequalities in the same clause *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   462
val ax = pvThm (AX [`~(a = b)`, `P a`, `P b`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   463
val th = pvThm (try (Rewrite.orderedRewrite kboCmp []) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   464
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   465
val ax = pvThm (AX [`~(f $x = $x)`, `P (f a)`, `P (f $x)`, `P (f $y)`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   466
val th = pvThm (try (Rewrite.orderedRewrite kboCmp []) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   467
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   468
val ax = pvThm
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   469
  (AX [`~(f (f (f (f (f $x)))) = $x)`,
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   470
          `~(f (f (f (f (f (f (f (f $x))))))) = $x)`,
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   471
          `P (f $x)`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   472
val th = pvThm (try (Rewrite.orderedRewrite kboCmp []) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   473
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   474
(* Symmetry should yield a tautology on ground clauses *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   475
val ax = pvThm (AX [`~(a = b)`, `b = a`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   476
val th = pvThm (try (Rewrite.orderedRewrite kboCmp []) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   477
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   478
(* Transitivity should yield a tautology on ground clauses *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   479
val ax = pvThm (AX [`~(a = b)`, `~(b = c)`, `a = c`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   480
val th = pvThm (try (Rewrite.orderedRewrite kboCmp []) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   481
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   482
(* Extended transitivity should yield a tautology on ground clauses *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   483
val ax = pvThm (AX [`~(a = b)`, `~(b = c)`, `~(c = d)`, `a = d`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   484
val th = pvThm (try (Rewrite.orderedRewrite kboCmp []) ax);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   485
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   486
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   487
val () = SAY "Unit cache";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   488
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   489
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   490
val u = pvU (Units.add Units.empty (U`~p $x`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   491
val u = pvU (Units.add u (U`a = b`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   492
val _ = pvThm (Units.reduce u (AX [`p 0`,`~(b = a)`]));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   493
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   494
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   495
val () = SAY "Negation normal form";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   496
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   497
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   498
val nnf = Normalize.nnf;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   499
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   500
val _ = pvFm (nnf (F`p /\ ~p`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   501
val _ = pvFm (nnf (F`(!x. P x) ==> ((?y. Q y) <=> (?z. P z /\ Q z))`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   502
val _ = pvFm (nnf (F`~(~(p <=> q) <=> r) <=> ~(p <=> ~(q <=> r))`));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   503
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   504
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   505
val () = SAY "Conjunctive normal form";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   506
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   507
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   508
local
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   509
  fun clauseToFormula cl =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   510
      Formula.listMkDisj (LiteralSet.transform Literal.toFormula cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   511
in
42102
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
   512
  fun clausesToFormula cls = Formula.listMkConj (List.map clauseToFormula cls);
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   513
end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   514
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   515
val cnf' = pvFm o clausesToFormula o Normalize.cnf o F;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   516
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   517
val cnf = pvFm o clausesToFormula o Normalize.cnf o
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   518
          Formula.Not o Formula.generalize o F;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   519
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   520
val _ = cnf `p \/ ~p`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   521
val _ = cnf `~((p /\ (q \/ r /\ s)) /\ (~p \/ ~q \/ ~s))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   522
val _ = cnf `~((p /\ (q \/ r /\ s)) /\ (~p \/ ~q \/ ~s) /\ (p \/ ~p))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   523
val _ = cnf `~(~(p <=> q) <=> r) <=> ~(p <=> ~(q <=> r))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   524
val _ = cnf `((p <=> q) <=> r) <=> (p <=> (q <=> r))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   525
val _ = cnf `~(!x. ?y. x < y ==> !v. ?w. x * v < y * w)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   526
val _ = cnf `~(!x. P x ==> (?y z. Q y \/ ~(?z. P z /\ Q z)))`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   527
val _ = cnf `~(?x y. x + y = 2)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   528
val _ = cnf' `(!x. p x) \/ (!y. r $x y)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   529
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   530
val _ = cnf
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   531
  `(!x. P x ==> (!x. Q x)) /\ ((!x. Q x \/ R x) ==> (?x. Q x /\ R x)) /\
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   532
   ((?x. R x) ==> (!x. L x ==> M x)) ==> (!x. P x /\ L x ==> M x)`;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   533
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   534
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   535
val () = SAY "Finite models";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   536
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   537
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   538
fun checkModelClause M cl =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   539
    let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   540
      val randomSamples = 100
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   541
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   542
      fun addRandomSample {T,F} =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   543
          let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   544
            val {T = T', F = F'} = Model.checkClause {maxChecks = SOME 1} M cl
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   545
          in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   546
            {T = T + T', F = F + F'}
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   547
          end
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   548
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   549
      val {T,F} = funpow randomSamples addRandomSample {T = 0, F = 0}
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   550
      val rx = Real.fromInt T / Real.fromInt (T + F)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   551
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   552
      val {T,F} = Model.checkClause {maxChecks = NONE} M cl
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   553
      val ry = Real.fromInt T / Real.fromInt (T + F)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   554
    in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   555
      [Formula.toString (LiteralSet.disjoin cl),
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   556
       " | random sampling = " ^ percentToString rx,
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   557
       " | exhaustive = " ^ percentToString ry]
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   558
    end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   559
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   560
local
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   561
  val format =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   562
      [{leftAlign = true, padChar = #" "},
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   563
       {leftAlign = true, padChar = #" "},
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   564
       {leftAlign = true, padChar = #" "}];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   565
in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   566
  fun checkModel M cls =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   567
      let
42102
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
   568
        val table = List.map (checkModelClause M) cls
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   569
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   570
        val rows = alignTable format table
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   571
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
   572
        val () = TextIO.print (join "\n" rows ^ "\n\n")
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   573
      in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   574
        ()
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   575
      end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   576
end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   577
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   578
fun perturbModel M cls n =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   579
    let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   580
      val N = {size = Model.size M}
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   581
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   582
      fun perturbClause (fv,cl) =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   583
          let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   584
            val V = Model.randomValuation N fv
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   585
          in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   586
            if Model.interpretClause M V cl then ()
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   587
            else Model.perturbClause M V cl
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   588
          end
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   589
42102
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
   590
      val cls = List.map (fn cl => (LiteralSet.freeVars cl, cl)) cls
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   591
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   592
      fun perturbClauses () = app perturbClause cls
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   593
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   594
      val () = funpow n perturbClauses ()
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   595
    in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   596
      M
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   597
    end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   598
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   599
val groupAxioms =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   600
    [LS[`0 + $x = $x`],
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   601
     LS[`~$x + $x = 0`],
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   602
     LS[`$x + $y + $z = $x + ($y + $z)`]];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   603
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   604
val groupThms =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   605
    [LS[`$x + 0 = $x`],
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   606
     LS[`$x + ~$x = 0`],
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   607
     LS[`~~$x = $x`]];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   608
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   609
fun newM fixed = Model.new {size = 8, fixed = fixed};
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   610
val M = pvM (newM Model.basicFixed);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   611
val () = checkModel M (groupAxioms @ groupThms);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   612
val M = pvM (perturbModel M groupAxioms 1000);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   613
val () = checkModel M (groupAxioms @ groupThms);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   614
val M = pvM (newM (Model.unionFixed Model.modularFixed Model.basicFixed));
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   615
val () = checkModel M (groupAxioms @ groupThms);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   616
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   617
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   618
val () = SAY "Checking the standard model";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   619
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   620
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   621
fun ppPercentClause (r,cl) =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   622
    let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   623
      val ind = 6
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   624
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   625
      val p = percentToString r
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   626
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   627
      val fm = LiteralSet.disjoin cl
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   628
    in
45778
df6e210fb44c updated Metis to 20110926 version
blanchet
parents: 42102
diff changeset
   629
      Print.consistentBlock ind
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
   630
        [Print.ppString p,
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
   631
         Print.ppString (nChars #" " (ind - size p)),
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   632
         Formula.pp fm]
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   633
    end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   634
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   635
val standardModel = Model.new Model.default;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   636
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   637
fun checkStandardModelClause cl =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   638
    let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   639
      val {T,F} = Model.checkClause {maxChecks = SOME 1000} standardModel cl
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   640
      val r = Real.fromInt T / Real.fromInt (T + F)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   641
    in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   642
      (r,cl)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   643
    end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   644
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   645
val pvPCl = printval ppPercentClause
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   646
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   647
(* Equality *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   648
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   649
val cl = LS[`$x = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   650
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   651
val cl = LS[`~($x = $y)`,`$y = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   652
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   653
val cl = LS[`~($x = $y)`,`~($y = $z)`,`$x = $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   654
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   655
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   656
(* Projections *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   657
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   658
val cl = LS[`project1 $x1 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   659
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   660
val cl = LS[`project1 $x1 $x2 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   661
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   662
val cl = LS[`project2 $x1 $x2 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   663
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   664
val cl = LS[`project1 $x1 $x2 $x3 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   665
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   666
val cl = LS[`project2 $x1 $x2 $x3 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   667
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   668
val cl = LS[`project3 $x1 $x2 $x3 = $x3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   669
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   670
val cl = LS[`project1 $x1 $x2 $x3 $x4 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   671
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   672
val cl = LS[`project2 $x1 $x2 $x3 $x4 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   673
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   674
val cl = LS[`project3 $x1 $x2 $x3 $x4 = $x3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   675
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   676
val cl = LS[`project4 $x1 $x2 $x3 $x4 = $x4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   677
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   678
val cl = LS[`project1 $x1 $x2 $x3 $x4 $x5 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   679
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   680
val cl = LS[`project2 $x1 $x2 $x3 $x4 $x5 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   681
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   682
val cl = LS[`project3 $x1 $x2 $x3 $x4 $x5 = $x3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   683
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   684
val cl = LS[`project4 $x1 $x2 $x3 $x4 $x5 = $x4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   685
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   686
val cl = LS[`project5 $x1 $x2 $x3 $x4 $x5 = $x5`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   687
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   688
val cl = LS[`project1 $x1 $x2 $x3 $x4 $x5 $x6 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   689
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   690
val cl = LS[`project2 $x1 $x2 $x3 $x4 $x5 $x6 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   691
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   692
val cl = LS[`project3 $x1 $x2 $x3 $x4 $x5 $x6 = $x3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   693
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   694
val cl = LS[`project4 $x1 $x2 $x3 $x4 $x5 $x6 = $x4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   695
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   696
val cl = LS[`project5 $x1 $x2 $x3 $x4 $x5 $x6 = $x5`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   697
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   698
val cl = LS[`project6 $x1 $x2 $x3 $x4 $x5 $x6 = $x6`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   699
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   700
val cl = LS[`project1 $x1 $x2 $x3 $x4 $x5 $x6 $x7 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   701
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   702
val cl = LS[`project2 $x1 $x2 $x3 $x4 $x5 $x6 $x7 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   703
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   704
val cl = LS[`project3 $x1 $x2 $x3 $x4 $x5 $x6 $x7 = $x3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   705
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   706
val cl = LS[`project4 $x1 $x2 $x3 $x4 $x5 $x6 $x7 = $x4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   707
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   708
val cl = LS[`project5 $x1 $x2 $x3 $x4 $x5 $x6 $x7 = $x5`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   709
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   710
val cl = LS[`project6 $x1 $x2 $x3 $x4 $x5 $x6 $x7 = $x6`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   711
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   712
val cl = LS[`project7 $x1 $x2 $x3 $x4 $x5 $x6 $x7 = $x7`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   713
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   714
val cl = LS[`project1 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   715
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   716
val cl = LS[`project2 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   717
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   718
val cl = LS[`project3 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   719
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   720
val cl = LS[`project4 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   721
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   722
val cl = LS[`project5 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x5`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   723
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   724
val cl = LS[`project6 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x6`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   725
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   726
val cl = LS[`project7 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x7`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   727
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   728
val cl = LS[`project8 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 = $x8`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   729
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   730
val cl = LS[`project1 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   731
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   732
val cl = LS[`project2 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   733
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   734
val cl = LS[`project3 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   735
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   736
val cl = LS[`project4 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   737
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   738
val cl = LS[`project5 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x5`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   739
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   740
val cl = LS[`project6 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x6`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   741
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   742
val cl = LS[`project7 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x7`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   743
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   744
val cl = LS[`project8 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x8`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   745
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   746
val cl = LS[`project9 $x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 = $x9`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   747
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   748
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   749
(* Arithmetic *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   750
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   751
(* Zero *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   752
val cl = LS[`~isZero $x`,`$x = 0`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   753
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   754
val cl = LS[`isZero $x`,`~($x = 0)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   755
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   756
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   757
(* Positive numerals *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   758
val cl = LS[`0 + 1 = 1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   759
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   760
val cl = LS[`1 + 1 = 2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   761
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   762
val cl = LS[`2 + 1 = 3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   763
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   764
val cl = LS[`3 + 1 = 4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   765
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   766
val cl = LS[`4 + 1 = 5`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   767
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   768
val cl = LS[`5 + 1 = 6`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   769
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   770
val cl = LS[`6 + 1 = 7`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   771
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   772
val cl = LS[`7 + 1 = 8`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   773
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   774
val cl = LS[`8 + 1 = 9`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   775
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   776
val cl = LS[`9 + 1 = 10`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   777
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   778
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   779
(* Negative numerals *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   780
val cl = LS[`~1 = negative1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   781
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   782
val cl = LS[`~2 = negative2`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   783
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   784
val cl = LS[`~3 = negative3`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   785
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   786
val cl = LS[`~4 = negative4`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   787
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   788
val cl = LS[`~5 = negative5`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   789
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   790
val cl = LS[`~6 = negative6`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   791
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   792
val cl = LS[`~7 = negative7`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   793
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   794
val cl = LS[`~8 = negative8`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   795
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   796
val cl = LS[`~9 = negative9`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   797
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   798
val cl = LS[`~10 = negative10`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   799
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   800
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   801
(* Addition *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   802
val cl = LS[`0 + $x = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   803
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   804
val cl = LS[`$x + $y = $y + $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   805
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   806
val cl = LS[`$x + ($y + $z) = ($x + $y) + $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   807
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   808
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   809
(* Negation *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   810
val cl = LS[`~$x + $x = 0`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   811
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   812
val cl = LS[`~~$x = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   813
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   814
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   815
(* Subtraction *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   816
val cl = LS[`$x - $y = $x + ~$y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   817
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   818
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   819
(* Successor *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   820
val cl = LS[`suc $x = $x + 1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   821
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   822
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   823
(* Predecessor *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   824
val cl = LS[`pre $x = $x - 1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   825
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   826
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   827
(* Ordering *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   828
val cl = LS[`$x <= $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   829
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   830
val cl = LS[`~($x <= $y)`,`~($y <= $z)`,`$x <= $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   831
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   832
val cl = LS[`~($x <= $y)`,`~($y <= $x)`,`$x = $y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   833
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   834
val cl = LS[`0 <= $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   835
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   836
val cl = LS[`~($x >= $y)`,`$y <= $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   837
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   838
val cl = LS[`$x >= $y`,`~($y <= $x)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   839
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   840
val cl = LS[`$x > $y`,`$x <= $y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   841
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   842
val cl = LS[`~($x > $y)`,`~($x <= $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   843
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   844
val cl = LS[`$x < $y`,`$y <= $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   845
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   846
val cl = LS[`~($x < $y)`,`~($y <= $x)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   847
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   848
val cl = LS[`$x = 0`,`~($x <= $y)`,`~$y <= ~$x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   849
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   850
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   851
(* Multiplication *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   852
val cl = LS[`1 * $x = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   853
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   854
val cl = LS[`0 * $x = 0`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   855
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   856
val cl = LS[`$x * $y = $y * $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   857
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   858
val cl = LS[`$x * ($y * $z) = ($x * $y) * $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   859
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   860
val cl = LS[`$x * ($y + $z) = ($x * $y) + ($x * $z)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   861
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   862
val cl = LS[`$x * ~$y = ~($x * $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   863
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   864
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   865
(* Division *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   866
val cl = LS[`$y = 0`,`$x mod $y < $y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   867
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   868
val cl = LS[`$y * ($x div $y) + $x mod $y = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   869
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   870
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   871
(* Exponentiation *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   872
val cl = LS[`exp $x 0 = 1`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   873
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   874
val cl = LS[`$y = 0`,`exp $x $y = $x * exp $x (pre $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   875
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   876
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   877
(* Divides *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   878
val cl = LS[`divides $x $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   879
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   880
val cl = LS[`~(divides $x $y)`,`~(divides $y $z)`,`divides $x $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   881
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   882
val cl = LS[`~(divides $x $y)`,`~(divides $y $x)`,`$x = $y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   883
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   884
val cl = LS[`divides 1 $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   885
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   886
val cl = LS[`divides $x 0`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   887
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   888
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   889
(* Even and odd *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   890
val cl = LS[`even 0`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   891
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   892
val cl = LS[`$x = 0`,`~(even (pre $x))`,`odd $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   893
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   894
val cl = LS[`$x = 0`,`~(odd (pre $x))`,`even $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   895
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   896
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   897
(* Sets *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   898
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   899
(* The empty set *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   900
val cl = LS[`~member $x empty`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   901
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   902
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   903
(* The universal set *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   904
val cl = LS[`member $x universe`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   905
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   906
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   907
(* Complement *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   908
val cl = LS[`member $x $y`,`member $x (complement $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   909
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   910
val cl = LS[`~(member $x $y)`,`~member $x (complement $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   911
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   912
val cl = LS[`complement (complement $x) = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   913
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   914
val cl = LS[`complement empty = universe`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   915
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   916
val cl = LS[`complement universe = empty`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   917
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   918
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   919
(* The subset relation *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   920
val cl = LS[`subset $x $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   921
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   922
val cl = LS[`~subset $x $y`,`~subset $y $z`,`subset $x $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   923
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   924
val cl = LS[`~subset $x $y`,`~subset $y $x`,`$x = $y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   925
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   926
val cl = LS[`subset empty $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   927
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   928
val cl = LS[`subset $x universe`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   929
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   930
val cl = LS[`~subset $x $y`,`subset (complement $y) (complement $x)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   931
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   932
val cl = LS[`~member $x $y`,`~subset $y $z`,`member $x $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   933
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   934
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   935
(* Union *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   936
val cl = LS[`union $x $y = union $y $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   937
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   938
val cl = LS[`union $x (union $y $z) = union (union $x $y) $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   939
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   940
val cl = LS[`union empty $x = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   941
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   942
val cl = LS[`union universe $x = universe`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   943
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   944
val cl = LS[`subset $x (union $x $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   945
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   946
val cl = LS[`~member $x (union $y $z)`,`member $x $y`,`member $x $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   947
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   948
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   949
(* Intersection *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   950
val cl = LS[`intersect $x $y =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   951
             complement (union (complement $x) (complement $y))`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   952
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   953
val cl = LS[`subset (intersect $x $y) $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   954
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   955
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   956
(* Difference *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   957
val cl = LS[`difference $x $y = intersect $x (complement $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   958
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   959
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   960
(* Symmetric difference *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   961
val cl = LS[`symmetricDifference $x $y =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   962
             union (difference $x $y) (difference $y $x)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   963
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   964
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   965
(* Insert *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   966
val cl = LS[`member $x (insert $x $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   967
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   968
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   969
(* Singleton *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   970
val cl = LS[`singleton $x = (insert $x empty)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   971
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   972
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   973
(* Cardinality *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   974
val cl = LS[`card empty = 0`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   975
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   976
val cl = LS[`member $x $y`,`card (insert $x $y) = suc (card $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   977
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   978
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   979
(* Lists *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   980
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   981
(* Nil *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   982
val cl = LS[`null nil`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   983
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   984
val cl = LS[`~null $x`, `$x = nil`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   985
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   986
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   987
(* Cons *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   988
val cl = LS[`~(nil = $x :: $y)`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   989
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   990
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   991
(* Append *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   992
val cl = LS[`$x @ ($y @ $z) = ($x @ $y) @ $z`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   993
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   994
val cl = LS[`nil @ $x = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   995
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   996
val cl = LS[`$x @ nil = $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   997
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   998
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   999
(* Length *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1000
val cl = LS[`length nil = 0`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1001
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1002
val cl = LS[`length ($x :: $y) >= length $y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1003
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1004
val cl = LS[`length ($x @ $y) >= length $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1005
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1006
val cl = LS[`length ($x @ $y) >= length $y`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1007
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1008
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1009
(* Tail *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1010
val cl = LS[`null $x`,`suc (length (tail $x)) = length $x`];
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1011
val _ = pvPCl (checkStandardModelClause cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1012
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1013
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1014
val () = SAY "Clauses";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1015
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1016
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1017
val cl = pvCl (CL[`P $x`,`P $y`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1018
val _ = pvLits (Clause.largestLiterals cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1019
val _ = pvCls (Clause.factor cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1020
val cl = pvCl (CL[`P $x`,`~P (f $x)`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1021
val _ = pvLits (Clause.largestLiterals cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1022
val cl = pvCl (CL[`$x = $y`,`f $y = f $x`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1023
val _ = pvLits (Clause.largestLiterals cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1024
val cl = pvCl (CL[`$x = f $y`,`f $x = $y`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1025
val _ = pvLits (Clause.largestLiterals cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1026
val cl = pvCl (CL[`s = a`,`s = b`,`h b c`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1027
val _ = pvLits (Clause.largestLiterals cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1028
val cl = pvCl (CL[`a = a`,`a = b`,`h b c`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1029
val _ = pvLits (Clause.largestLiterals cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1030
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1031
(* Test cases contributed by Larry Paulson *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1032
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1033
local
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1034
  val lnFnName = Name.fromString "ln"
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1035
  and expFnName = Name.fromString "exp"
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1036
  and divFnName = Name.fromString "/"
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1037
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1038
  val leRelName = Name.fromString "<";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1039
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1040
  fun weight na =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1041
      case na of
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1042
        (n,1) =>
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1043
        if Name.equal n lnFnName then 500
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1044
        else if Name.equal n expFnName then 500
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1045
        else 1
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1046
      | (n,2) =>
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1047
        if Name.equal n divFnName then 50
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1048
        else if Name.equal n leRelName then 20
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1049
        else 1
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1050
      | _ => 1;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1051
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1052
  val ordering =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1053
      {weight = weight, precedence = #precedence KnuthBendixOrder.default};
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1054
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1055
  val clauseParameters =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1056
      {ordering = ordering,
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1057
       orderLiterals = Clause.UnsignedLiteralOrder,
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1058
       orderTerms = true};
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1059
in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1060
  val LcpCL = mkCl clauseParameters o AX;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1061
end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1062
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1063
val cl = pvCl (LcpCL[`~($y <= (2 + (2 * $x + pow $x 2)) / 2)`, `~(0 <= $x)`,
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1064
                     `$y <= exp $x`]);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1065
val _ = pvLits (Clause.largestLiterals cl);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1066
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1067
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1068
val () = SAY "Syntax checking the problem sets";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1069
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1070
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1071
local
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1072
  fun same n = raise Fail ("Two goals called " ^ n);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1073
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1074
  fun dup n n' =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1075
      raise Fail ("Goal " ^ n' ^ " is probable duplicate of " ^ n);
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1076
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1077
  fun quot fm =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1078
      let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1079
        fun f (v,s) = Subst.insert s (v,V"_")
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1080
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1081
        val sub = NameSet.foldl f Subst.empty (Formula.freeVars fm)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1082
      in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1083
        Formula.subst sub fm
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1084
      end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1085
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1086
  val quot_clauses =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1087
      Formula.listMkConj o sort Formula.compare o
42102
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
  1088
      List.map (quot o snd o Formula.stripForall) o Formula.stripConj;
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1089
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1090
  fun quotient (Formula.Imp (a, Formula.Imp (b, Formula.False))) =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1091
      Formula.Imp (quot_clauses a, Formula.Imp (quot_clauses b, Formula.False))
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1092
    | quotient fm = fm;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1093
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1094
  fun check ({name,goal,...}, acc) =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1095
    let
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1096
      val g = prep goal
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1097
      val p =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1098
          Formula.fromString g
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1099
          handle Parse.NoParse =>
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1100
                 raise Error ("failed to parse problem " ^ name)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1101
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1102
      val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1103
        case List.find (fn (n,_) => n = name) acc of NONE => ()
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1104
        | SOME _ => same name
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1105
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1106
      val () =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1107
        case List.find (fn (_,x) => Formula.equal x p) acc of NONE => ()
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1108
        | SOME (n,_) => dup n name
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1109
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1110
      val _ =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1111
        test_fun equal I g (mini_print (!Print.lineLength) p)
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1112
        handle e =>
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1113
          (TextIO.print ("Error in problem " ^ name ^ "\n\n");
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1114
           raise e)
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1115
    in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1116
      (name,p) :: acc
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1117
    end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1118
in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1119
  fun check_syntax (p : problem list) =
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1120
      let
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1121
        val _ = List.foldl check [] p
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1122
      in
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1123
        TextIO.print "ok\n\n"
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1124
      end;
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1125
end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1126
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1127
val () = check_syntax problems;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1128
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1129
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1130
val () = SAY "Parsing TPTP problems";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1131
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1132
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1133
fun tptp f =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1134
    let
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1135
      val () = TextIO.print ("parsing " ^ f ^ "... ")
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1136
      val filename = "tptp/" ^ f ^ ".tptp"
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1137
      val mapping = Tptp.defaultMapping
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1138
      val goal = Tptp.goal (Tptp.read {filename = filename, mapping = mapping})
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39353
diff changeset
  1139
      val () = TextIO.print "ok\n"
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1140
    in
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1141
      pvFm goal
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1142
    end;
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1143
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1144
val _ = tptp "PUZ001-1";
42102
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
  1145
val _ = tptp "NO_FORMULAS";
fcfd07f122d4 new version of Metis 2.3 (29 Dec. 2010)
blanchet
parents: 39502
diff changeset
  1146
val _ = tptp "SEPARATED_COMMENTS";
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1147
val _ = tptp "NUMBERED_FORMULAS";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1148
val _ = tptp "DEFINED_TERMS";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1149
val _ = tptp "SYSTEM_TERMS";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1150
val _ = tptp "QUOTED_TERMS";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1151
val _ = tptp "QUOTED_TERMS_IDENTITY";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1152
val _ = tptp "QUOTED_TERMS_DIFFERENT";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1153
val _ = tptp "QUOTED_TERMS_SPECIAL";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1154
val _ = tptp "RENAMING_VARIABLES";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1155
val _ = tptp "MIXED_PROBLEM";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1156
val _ = tptp "BLOCK_COMMENTS";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1157
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1158
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1159
val () = SAY "The TPTP finite model";
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1160
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1161
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
  1162
val _ = printval (Tptp.ppFixedMap Tptp.defaultMapping) Tptp.defaultFixedMap;