src/HOL/Tools/Mirabelle/mirabelle_metis.ML
author desharna
Fri, 17 Dec 2021 09:51:37 +0100
changeset 74948 15ce207f69c8
parent 73847 58f6b41efe88
child 75003 f21e7e6172a0
permissions -rw-r--r--
added support for initialization messages to Mirabelle
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47847
7cddb6c8f93c updated headers;
wenzelm
parents: 47730
diff changeset
     1
(*  Title:      HOL/Mirabelle/Tools/mirabelle_metis.ML
73847
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
     2
    Author:     Jasmin Blanchette, TU Munich
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
     3
    Author:     Sascha Boehme, TU Munich
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
     4
    Author:     Martin Desharnais, UniBw Munich
73691
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
     5
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
     6
Mirabelle action: "metis".
32385
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
73847
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
     9
structure Mirabelle_Metis: MIRABELLE_ACTION =
32385
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    10
struct
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    11
73847
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
    12
fun make_action ({timeout, ...} : Mirabelle.action_context) =
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
    13
  let
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
    14
    fun run_action ({pre, post, ...} : Mirabelle.command) =
73691
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    15
      let
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    16
        val thms = Mirabelle.theorems_of_sucessful_proof post;
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    17
        val names = map Thm.get_name_hint thms;
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    18
        val facts = map #1 (Facts.props (Proof_Context.facts_of (Proof.context_of pre)));
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    19
        fun metis ctxt = Metis_Tactic.metis_tac [] ATP_Problem_Generate.liftingN ctxt (thms @ facts);
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    20
      in
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    21
        (if Mirabelle.can_apply timeout metis pre then "succeeded" else "failed")
2f9877db82a1 reimplemented Mirabelle as Isabelle/ML presentation hook + Isabelle/Scala tool, but sledgehammer is still inactive;
wenzelm
parents: 63337
diff changeset
    22
        |> not (null names) ? suffix (":\n" ^ commas names)
73847
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
    23
      end
74948
15ce207f69c8 added support for initialization messages to Mirabelle
desharna
parents: 73847
diff changeset
    24
  in ("", {run_action = run_action, finalize = K ""}) end
73847
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
    25
58f6b41efe88 refactored Mirabelle to produce output in real time
desharna
parents: 73691
diff changeset
    26
val () = Mirabelle.register_action "metis" make_action
32385
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    27
594890623c46 split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
diff changeset
    28
end