src/HOL/Groebner_Basis.thy
author hoelzl
Tue Nov 05 09:44:57 2013 +0100 (2013-11-05)
changeset 54257 5c7a3b6b05a9
parent 54251 adea9f6986b2
child 55178 318cd8ac1817
permissions -rw-r--r--
generalize SUP and INF to the syntactic type classes Sup and Inf
     1 (*  Title:      HOL/Groebner_Basis.thy
     2     Author:     Amine Chaieb, TU Muenchen
     3 *)
     4 
     5 header {* Groebner bases *}
     6 
     7 theory Groebner_Basis
     8 imports Semiring_Normalization
     9 begin
    10 
    11 subsection {* Groebner Bases *}
    12 
    13 lemmas bool_simps = simp_thms(1-34) -- {* FIXME move to @{theory HOL} *}
    14 
    15 lemma nnf_simps: -- {* FIXME shadows fact binding in @{theory HOL} *}
    16   "(\<not>(P \<and> Q)) = (\<not>P \<or> \<not>Q)" "(\<not>(P \<or> Q)) = (\<not>P \<and> \<not>Q)"
    17   "(P \<longrightarrow> Q) = (\<not>P \<or> Q)"
    18   "(P = Q) = ((P \<and> Q) \<or> (\<not>P \<and> \<not> Q))" "(\<not> \<not>(P)) = P"
    19   by blast+
    20 
    21 lemma dnf:
    22   "(P & (Q | R)) = ((P&Q) | (P&R))"
    23   "((Q | R) & P) = ((Q&P) | (R&P))"
    24   "(P \<and> Q) = (Q \<and> P)"
    25   "(P \<or> Q) = (Q \<or> P)"
    26   by blast+
    27 
    28 lemmas weak_dnf_simps = dnf bool_simps
    29 
    30 lemma PFalse:
    31     "P \<equiv> False \<Longrightarrow> \<not> P"
    32     "\<not> P \<Longrightarrow> (P \<equiv> False)"
    33   by auto
    34 
    35 ML {*
    36 structure Algebra_Simplification = Named_Thms
    37 (
    38   val name = @{binding algebra}
    39   val description = "pre-simplification rules for algebraic methods"
    40 )
    41 *}
    42 
    43 setup Algebra_Simplification.setup
    44 
    45 ML_file "Tools/groebner.ML"
    46 
    47 method_setup algebra = {*
    48   let
    49     fun keyword k = Scan.lift (Args.$$$ k -- Args.colon) >> K ()
    50     val addN = "add"
    51     val delN = "del"
    52     val any_keyword = keyword addN || keyword delN
    53     val thms = Scan.repeat (Scan.unless any_keyword Attrib.multi_thm) >> flat;
    54   in
    55     Scan.optional (keyword addN |-- thms) [] --
    56      Scan.optional (keyword delN |-- thms) [] >>
    57     (fn (add_ths, del_ths) => fn ctxt =>
    58       SIMPLE_METHOD' (Groebner.algebra_tac add_ths del_ths ctxt))
    59   end
    60 *} "solve polynomial equations over (semi)rings and ideal membership problems using Groebner bases"
    61 
    62 declare dvd_def[algebra]
    63 declare dvd_eq_mod_eq_0[symmetric, algebra]
    64 declare mod_div_trivial[algebra]
    65 declare mod_mod_trivial[algebra]
    66 declare div_by_0[algebra]
    67 declare mod_by_0[algebra]
    68 declare zmod_zdiv_equality[symmetric,algebra]
    69 declare div_mod_equality2[symmetric, algebra]
    70 declare div_minus_minus[algebra]
    71 declare mod_minus_minus[algebra]
    72 declare div_minus_right[algebra]
    73 declare mod_minus_right[algebra]
    74 declare div_0[algebra]
    75 declare mod_0[algebra]
    76 declare mod_by_1[algebra]
    77 declare div_by_1[algebra]
    78 declare mod_minus1_right[algebra]
    79 declare div_minus1_right[algebra]
    80 declare mod_mult_self2_is_0[algebra]
    81 declare mod_mult_self1_is_0[algebra]
    82 declare zmod_eq_0_iff[algebra]
    83 declare dvd_0_left_iff[algebra]
    84 declare zdvd1_eq[algebra]
    85 declare zmod_eq_dvd_iff[algebra]
    86 declare nat_mod_eq_iff[algebra]
    87 
    88 end