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