equal
deleted
inserted
replaced
1 (* Title: HOL/Tools/inductive_realizer.ML |
1 (* Title: HOL/Tools/inductive_realizer.ML |
2 Author: Stefan Berghofer, TU Muenchen |
2 Author: Stefan Berghofer, TU Muenchen |
3 |
3 |
4 Porgram extraction from proofs involving inductive predicates: |
4 Program extraction from proofs involving inductive predicates: |
5 Realizers for induction and elimination rules. |
5 Realizers for induction and elimination rules. |
6 *) |
6 *) |
7 |
7 |
8 signature INDUCTIVE_REALIZER = |
8 signature INDUCTIVE_REALIZER = |
9 sig |
9 sig |
62 | (_, vs) => vs) [] (OldTerm.term_vars prop); |
62 | (_, vs) => vs) [] (OldTerm.term_vars prop); |
63 |
63 |
64 fun dt_of_intrs thy vs nparms intrs = |
64 fun dt_of_intrs thy vs nparms intrs = |
65 let |
65 let |
66 val iTs = OldTerm.term_tvars (prop_of (hd intrs)); |
66 val iTs = OldTerm.term_tvars (prop_of (hd intrs)); |
67 val Tvs = map TVar iTs; |
|
68 val (Const (s, _), ts) = strip_comb (HOLogic.dest_Trueprop |
67 val (Const (s, _), ts) = strip_comb (HOLogic.dest_Trueprop |
69 (Logic.strip_imp_concl (prop_of (hd intrs)))); |
68 (Logic.strip_imp_concl (prop_of (hd intrs)))); |
70 val params = map dest_Var (take nparms ts); |
69 val params = map dest_Var (take nparms ts); |
71 val tname = Binding.name (space_implode "_" (Long_Name.base_name s ^ "T" :: vs)); |
70 val tname = Binding.name (space_implode "_" (Long_Name.base_name s ^ "T" :: vs)); |
72 fun constr_of_intr intr = (Binding.name (Long_Name.base_name (name_of_thm intr)), |
71 fun constr_of_intr intr = (Binding.name (Long_Name.base_name (name_of_thm intr)), |