author | wenzelm |
Tue, 03 Jul 2007 22:27:19 +0200 | |
changeset 23558 | 9325845aff1c |
parent 23252 | 67268bb40b21 |
child 25252 | 833abbc3e733 |
permissions | -rw-r--r-- |
23252 | 1 |
(* Title: HOL/Tools/Groebner_Basis/misc.ML |
2 |
ID: $Id$ |
|
3 |
Author: Amine Chaieb, TU Muenchen |
|
4 |
||
5 |
Very basic stuff for cterms. |
|
6 |
*) |
|
7 |
||
8 |
structure Misc = |
|
9 |
struct |
|
10 |
||
23558
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
11 |
fun is_comb ct = |
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
12 |
(case Thm.term_of ct of |
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
13 |
_ $ _ => true |
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
14 |
| _ => false); |
23252 | 15 |
|
23558
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
16 |
val concl = Thm.cprop_of #> Thm.dest_arg; |
23252 | 17 |
|
23558
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
18 |
fun is_binop ct ct' = |
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
19 |
(case Thm.term_of ct' of |
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
20 |
c $ _ $ _ => Thm.term_of ct aconv c |
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
21 |
| _ => false); |
23252 | 22 |
|
23 |
fun dest_binop ct ct' = |
|
24 |
if is_binop ct ct' then Thm.dest_binop ct' |
|
23558
9325845aff1c
tuned is_comb/is_binop -- avoid construction of cterms;
wenzelm
parents:
23252
diff
changeset
|
25 |
else raise CTERM ("dest_binop: bad binop", [ct, ct']) |
23252 | 26 |
|
27 |
fun inst_thm inst = Thm.instantiate ([], inst); |
|
28 |
||
29 |
end; |