src/HOL/Mirabelle/Tools/mirabelle_refute.ML
author boehmes
Wed, 02 Sep 2009 16:23:53 +0200
changeset 32496 4ab00a2642c3
parent 32469 src/HOL/Tools/Mirabelle/Tools/mirabelle_refute.ML@1ad7d4fc0954
child 32518 e3c4e337196c
permissions -rw-r--r--
moved Mirabelle from HOL/Tools to HOL, added session HOL-Mirabelle
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32385
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     1
(* Title:  mirabelle_refute.ML
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     2
   Author: Jasmin Blanchette and Sascha Boehme
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     3
*)
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     4
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     5
structure Mirabelle_Refute : MIRABELLE_ACTION =
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     6
struct
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     7
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
     8
32386
18bbd9f4c2cd disabled refute action (needs changes in the code of refute)
boehmes
parents: 32385
diff changeset
     9
(* FIXME:
32469
1ad7d4fc0954 Mirabelle: added preliminary documentation,
boehmes
parents: 32386
diff changeset
    10
fun refute_action args timeout {pre=st, ...} = 
32385
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    11
  let
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    12
    val subgoal = 0
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    13
    val thy     = Proof.theory_of st
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    14
    val thm = goal_thm_of st
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    15
32469
1ad7d4fc0954 Mirabelle: added preliminary documentation,
boehmes
parents: 32386
diff changeset
    16
    val refute = Refute.refute_subgoal thy args thm
1ad7d4fc0954 Mirabelle: added preliminary documentation,
boehmes
parents: 32386
diff changeset
    17
    val _ = TimeLimit.timeLimit timeout refute subgoal
32385
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    18
  in
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    19
    val writ_log = Substring.full (the (Symtab.lookup tab "writeln"))
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    20
    val warn_log = Substring.full (the (Symtab.lookup tab "warning"))
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    21
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    22
    val r =
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    23
      if Substring.isSubstring "model found" writ_log
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    24
      then
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    25
        if Substring.isSubstring "spurious" warn_log
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    26
        then SOME "potential counterexample"
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    27
        else SOME "real counterexample (bug?)"
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    28
      else
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    29
        if Substring.isSubstring "time limit" writ_log
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    30
        then SOME "no counterexample (time out)"
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    31
        else if Substring.isSubstring "Search terminated" writ_log
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    32
        then SOME "no counterexample (normal termination)"
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    33
        else SOME "no counterexample (unknown)"
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    34
  in r end
32386
18bbd9f4c2cd disabled refute action (needs changes in the code of refute)
boehmes
parents: 32385
diff changeset
    35
*)
32385
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    36
32386
18bbd9f4c2cd disabled refute action (needs changes in the code of refute)
boehmes
parents: 32385
diff changeset
    37
fun invoke args = I (*Mirabelle.register ("refute", refute_action args)*)
32385
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    38
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    39
end