src/HOL/Groebner_Basis.thy
 author wenzelm Thu Apr 12 18:39:19 2012 +0200 (2012-04-12) changeset 47432 e1576d13e933 parent 47165 9344891b504b child 48891 c0eafbd55de3 permissions -rw-r--r--
more standard method setup;
```     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 uses
```
```    10   ("Tools/groebner.ML")
```
```    11 begin
```
```    12
```
```    13 subsection {* Groebner Bases *}
```
```    14
```
```    15 lemmas bool_simps = simp_thms(1-34)
```
```    16
```
```    17 lemma dnf:
```
```    18     "(P & (Q | R)) = ((P&Q) | (P&R))" "((Q | R) & P) = ((Q&P) | (R&P))"
```
```    19     "(P \<and> Q) = (Q \<and> P)" "(P \<or> Q) = (Q \<or> P)"
```
```    20   by blast+
```
```    21
```
```    22 lemmas weak_dnf_simps = dnf bool_simps
```
```    23
```
```    24 lemma nnf_simps:
```
```    25     "(\<not>(P \<and> Q)) = (\<not>P \<or> \<not>Q)" "(\<not>(P \<or> Q)) = (\<not>P \<and> \<not>Q)" "(P \<longrightarrow> Q) = (\<not>P \<or> Q)"
```
```    26     "(P = Q) = ((P \<and> Q) \<or> (\<not>P \<and> \<not> Q))" "(\<not> \<not>(P)) = P"
```
```    27   by blast+
```
```    28
```
```    29 lemma PFalse:
```
```    30     "P \<equiv> False \<Longrightarrow> \<not> P"
```
```    31     "\<not> P \<Longrightarrow> (P \<equiv> False)"
```
```    32   by auto
```
```    33
```
```    34 ML {*
```
```    35 structure Algebra_Simplification = Named_Thms
```
```    36 (
```
```    37   val name = @{binding algebra}
```
```    38   val description = "pre-simplification rules for algebraic methods"
```
```    39 )
```
```    40 *}
```
```    41
```
```    42 setup Algebra_Simplification.setup
```
```    43
```
```    44 use "Tools/groebner.ML"
```
```    45
```
```    46 method_setup algebra = {*
```
```    47   let
```
```    48     fun keyword k = Scan.lift (Args.\$\$\$ k -- Args.colon) >> K ()
```
```    49     val addN = "add"
```
```    50     val delN = "del"
```
```    51     val any_keyword = keyword addN || keyword delN
```
```    52     val thms = Scan.repeat (Scan.unless any_keyword Attrib.multi_thm) >> flat;
```
```    53   in
```
```    54     Scan.optional (keyword addN |-- thms) [] --
```
```    55      Scan.optional (keyword delN |-- thms) [] >>
```
```    56     (fn (add_ths, del_ths) => fn ctxt =>
```
```    57       SIMPLE_METHOD' (Groebner.algebra_tac add_ths del_ths ctxt))
```
```    58   end
```
```    59 *} "solve polynomial equations over (semi)rings and ideal membership problems using Groebner bases"
```
```    60
```
```    61 declare dvd_def[algebra]
```
```    62 declare dvd_eq_mod_eq_0[symmetric, algebra]
```
```    63 declare mod_div_trivial[algebra]
```
```    64 declare mod_mod_trivial[algebra]
```
```    65 declare div_by_0[algebra]
```
```    66 declare mod_by_0[algebra]
```
```    67 declare zmod_zdiv_equality[symmetric,algebra]
```
```    68 declare div_mod_equality2[symmetric, algebra]
```
```    69 declare div_minus_minus[algebra]
```
```    70 declare mod_minus_minus[algebra]
```
```    71 declare div_minus_right[algebra]
```
```    72 declare mod_minus_right[algebra]
```
```    73 declare div_0[algebra]
```
```    74 declare mod_0[algebra]
```
```    75 declare mod_by_1[algebra]
```
```    76 declare div_by_1[algebra]
```
```    77 declare mod_minus1_right[algebra]
```
```    78 declare div_minus1_right[algebra]
```
```    79 declare mod_mult_self2_is_0[algebra]
```
```    80 declare mod_mult_self1_is_0[algebra]
```
```    81 declare zmod_eq_0_iff[algebra]
```
```    82 declare dvd_0_left_iff[algebra]
```
```    83 declare zdvd1_eq[algebra]
```
```    84 declare zmod_eq_dvd_iff[algebra]
```
```    85 declare nat_mod_eq_iff[algebra]
```
```    86
```
```    87 end
```