Extra sml procedures for ProofPower
Overview
This document contains extra sml procedures for use with ProofPower to support the methods adopted at X-Logic.org.
The available proof context facilities are a bit cumbersome if you want to build up a proof context incrementatlly as you work your way through a theory. Here are some hacks to make that easier.
Building Proof Contexts
The available proof context facilities are a bit cumbersome if you want to build up a proof context incrementatlly as you work your way through a theory. Here are some hacks to make that easier.
force new theory
This procedure is for making a new theory in a context where a previous version of the same theory could be present and if so should be deleted (even if it has children).
xl-sml
fun force_new_theory name =
let
val _ = force_delete_theory name handle _ => ();
in
new_theory name
end;

force new proof context
This procedure is for making a new pc in a context where a previous version of the pc could be present and if so should be deleted.
xl-sml
fun force_new_pc name =
let
val _ = delete_pc name handle _ => ();
in
new_pc name
end;

Adding new theorems
The following procedure just abbreviates the process of adding one or more theorems for rewriting and for stripping.
xl-sml
fun add_pc_thms pc thms =
fttabfttab(add_rw_thms thms pc;
fttabfttabadd_sc_thms thms pc;
ftbrfttabfttabadd_st_thms thms pc);

Consistency Proofs
To permit hand consistency proofs to be completed before a HOLCONST specification we provide a consistency prover which just looks up a standard location for the consistency proof and put this in a proof context.
xl-sml
open_theory "basic_hol";
val xl_consistency_result = ref t_thm;
fun xl_cs_∃_conv x =
fttabif x =$ (concl(!xl_consistency_result))
fttabthen ≡_t_intro (!xl_consistency_result)
fttabelse eq_sym_conv x;
force_new_pc "xl_cs_∃_conv";
set_cs_∃_convs [xl_cs_∃_conv] "xl_cs_∃_conv";
set_pr_conv basic_prove_conv "xl_cs_∃_conv";
set_pr_tac basic_prove_tac "xl_cs_∃_conv";
commit_pc "xl_cs_∃_conv";
fun xl_set_cs_∃_thm thm = (xl_consistency_result := thm);

Trawling for helpful theorems and definitions
To make it easier to find things relevant to the current goal.
xl-sml
set_goal([], ⌜0=1 ∧ F⌝);

val avoid_theories = ref ["min", "log"];
val avoid_constants = ref ["=", "∧"];
val avoid_specs = ref ["=", "∧"];

fun defined_consts t =
fttablet val consts = term_consts t
fttabin filter (fn x => (fst x) mem ["=", "ε", "⇒"]) consts
fttabend;

fun on_goal_conc f = f (snd (top_goal()));

fun term_const_defns t =
ftbr letfttabval consts = defined_consts t;
fttabfun cd c = get_defn (get_const_theory c) c
ftbr in map (cd o fst) consts
ftbr end;

fun goal_defns void =
ftbr term_const_defns(snd(top_goal()));

fun term_const_specs t =
ftbr letfttabval consts = defined_consts t
ftbr in map (get_spec o mk_const) consts
ftbr end;

fun goal_specs void =
ftbr term_const_specs(snd(top_goal()));

fun const_thms c =
ftbr let val allthms = get_thms (get_const_theory c)
ftbr in allthms
ftbr end;

fun goal_const_thms void =
ftbr let val consts = term_consts (snd(top_goal()))
ftbr in map (const_thms o fst) consts
ftbr end;

fun get_thml th kl = map (get_thm th) kl;

fun get_thml2 thkl =
ftbr foldl (op @) [] (map (fn (th, kl) => get_thml th kl) thkl);

fun get_keys th l =
ftbr let val thms = get_thms th
ftbr in map (fn chose => (hd o fst o chose) thms) (map nth l)
ftbr end;

fun no_map f l =
ftbr let fun g n f [] = []
ftbr | g n f (h::t) = f n h :: (g (n+1) f t)
ftbr in g 0 f l
ftbr end;

fun get_num_thms th =
ftbr no_map (fn x => fn t => (x,t)) (get_thms th);

(* get_thml "-" ["tc_mono_thm", "tran_tc_thm2"];
get_thml2 [("-", ["tc_mono_thm", "tran_tc_thm2"])];
*)

fun term_const_thms t =
ftbr letfttabval consts = term_consts t
ftbr in map (get_spec o mk_const) consts
ftbr end;


up quick index © RBJ

privacy policy

Created:

$Id: pp-smlxtras.xml,v 1.5 2008/04/15 18:21:36 rbj01 Exp $

V