src/HOL/Tools/Groebner_Basis/misc.ML
author wenzelm
Tue, 03 Jul 2007 22:27:19 +0200
changeset 23558 9325845aff1c
parent 23252 67268bb40b21
child 25252 833abbc3e733
permissions -rw-r--r--
tuned is_comb/is_binop -- avoid construction of cterms; removed conjunction rules (cf. HOLogic.conj_XXX);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/Tools/Groebner_Basis/misc.ML
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     3
    Author:     Amine Chaieb, TU Muenchen
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     4
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     5
Very basic stuff for cterms.
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     6
*)
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     7
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     8
structure Misc =
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     9
struct
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    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
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    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
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    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
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    22
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    23
fun dest_binop ct ct' =
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    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
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    26
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    27
fun inst_thm inst = Thm.instantiate ([], inst);
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    28
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    29
end;