src/Tools/isac/Knowledge/PolyMinus.thy
author wenzelm
Tue, 15 Jun 2021 22:24:20 +0200
changeset 60303 815b0dc8b589
parent 60300 447f80af6749
child 60306 51ec2e101e9f
permissions -rw-r--r--
Isar command 'method' as combination of KEStore_Elems.add_mets + MethodC.prep_import, without change of semantics;
neuper@37906
     1
(* attempts to perserve binary minus as wanted by Austrian teachers
neuper@37906
     2
   WN071207
neuper@37906
     3
   (c) due to copyright terms
neuper@37906
     4
*)
neuper@37906
     5
neuper@37950
     6
theory PolyMinus imports (*Poly// due to "is_ratpolyexp" in...*) Rational begin
neuper@37906
     7
neuper@37906
     8
consts
neuper@37906
     9
neuper@37906
    10
  (*predicates for conditions in rewriting*)
neuper@37906
    11
  kleiner     :: "['a, 'a] => bool" 	("_ kleiner _") 
walther@60278
    12
  ist_monom  :: "'a => bool"		("_ ist'_monom")
neuper@37906
    13
neuper@37906
    14
  (*the CAS-command*)
neuper@37906
    15
  Probe       :: "[bool, bool list] => bool"  
neuper@37906
    16
	(*"Probe (3*a+2*b+a = 4*a+2*b) [a=1,b=2]"*)
neuper@37906
    17
neuper@37906
    18
  (*descriptions for the pbl and met*)
neuper@37950
    19
  Pruefe      :: "bool => una"
neuper@37950
    20
  mitWert     :: "bool list => tobooll"
neuper@37950
    21
  Geprueft    :: "bool => una"
neuper@37906
    22
neuper@52148
    23
axiomatization where
neuper@37906
    24
neuper@52148
    25
  null_minus:            "0 - a = -a" and
neuper@52148
    26
  vor_minus_mal:         "- a * b = (-a) * b" and
neuper@37906
    27
neuper@37906
    28
  (*commute with invariant (a.b).c -association*)
neuper@37980
    29
  tausche_plus:		"[| b ist_monom; a kleiner b  |] ==> 
neuper@52148
    30
			 (b + a) = (a + b)" and
neuper@37980
    31
  tausche_minus:		"[| b ist_monom; a kleiner b  |] ==> 
neuper@52148
    32
			 (b - a) = (-a + b)" and
neuper@37980
    33
  tausche_vor_plus:	"[| b ist_monom; a kleiner b  |] ==> 
neuper@52148
    34
			 (- b + a) = (a - b)" and
neuper@37980
    35
  tausche_vor_minus:	"[| b ist_monom; a kleiner b  |] ==> 
neuper@52148
    36
			 (- b - a) = (-a - b)" and
walther@60269
    37
(*Ambiguous input\<^here> produces 3 parse trees -----------------------------\\*)
neuper@52148
    38
  tausche_plus_plus:	"b kleiner c ==> (a + c + b) = (a + b + c)" and
neuper@52148
    39
  tausche_plus_minus:	"b kleiner c ==> (a + c - b) = (a - b + c)" and
neuper@52148
    40
  tausche_minus_plus:	"b kleiner c ==> (a - c + b) = (a + b - c)" and
neuper@52148
    41
  tausche_minus_minus:	"b kleiner c ==> (a - c - b) = (a - b - c)" and
walther@60269
    42
(*Ambiguous input\<^here> produces 3 parse trees -----------------------------//*)
neuper@37906
    43
neuper@37906
    44
  (*commute with invariant (a.b).c -association*)
neuper@37980
    45
  tausche_mal:		"[| b is_atom; a kleiner b  |] ==> 
neuper@52148
    46
			 (b * a) = (a * b)" and
neuper@37980
    47
  tausche_vor_mal:	"[| b is_atom; a kleiner b  |] ==> 
neuper@52148
    48
			 (-b * a) = (-a * b)" and
neuper@37980
    49
  tausche_mal_mal:	"[| c is_atom; b kleiner c  |] ==> 
neuper@52148
    50
			 (x * c * b) = (x * b * c)" and
walther@60242
    51
  x_quadrat:             "(x * a) * a = x * a \<up> 2" and
neuper@37906
    52
neuper@37906
    53
neuper@37980
    54
  subtrahiere:               "[| l is_const; m is_const |] ==>  
neuper@52148
    55
			     m * v - l * v = (m - l) * v" and
neuper@37980
    56
  subtrahiere_von_1:         "[| l is_const |] ==>  
neuper@52148
    57
			     v - l * v = (1 - l) * v" and
neuper@37980
    58
  subtrahiere_1:             "[| l is_const; m is_const |] ==>  
neuper@52148
    59
			     m * v - v = (m - 1) * v" and
neuper@37906
    60
neuper@37980
    61
  subtrahiere_x_plus_minus:  "[| l is_const; m is_const |] ==>  
neuper@52148
    62
			     (x + m * v) - l * v = x + (m - l) * v" and
neuper@37980
    63
  subtrahiere_x_plus1_minus: "[| l is_const |] ==>  
neuper@52148
    64
			     (x + v) - l * v = x + (1 - l) * v" and
neuper@37980
    65
  subtrahiere_x_plus_minus1: "[| m is_const |] ==>  
neuper@52148
    66
			     (x + m * v) - v = x + (m - 1) * v" and
neuper@37906
    67
neuper@37980
    68
  subtrahiere_x_minus_plus:  "[| l is_const; m is_const |] ==>  
neuper@52148
    69
			     (x - m * v) + l * v = x + (-m + l) * v" and
neuper@37980
    70
  subtrahiere_x_minus1_plus: "[| l is_const |] ==>  
neuper@52148
    71
			     (x - v) + l * v = x + (-1 + l) * v" and
neuper@37980
    72
  subtrahiere_x_minus_plus1: "[| m is_const |] ==>  
neuper@52148
    73
			     (x - m * v) + v = x + (-m + 1) * v" and
neuper@37906
    74
neuper@37980
    75
  subtrahiere_x_minus_minus: "[| l is_const; m is_const |] ==>  
neuper@52148
    76
			     (x - m * v) - l * v = x + (-m - l) * v" and
neuper@37980
    77
  subtrahiere_x_minus1_minus:"[| l is_const |] ==>  
neuper@52148
    78
			     (x - v) - l * v = x + (-1 - l) * v" and
neuper@37980
    79
  subtrahiere_x_minus_minus1:"[| m is_const |] ==>  
neuper@52148
    80
			     (x - m * v) - v = x + (-m - 1) * v" and
neuper@37906
    81
neuper@37906
    82
neuper@37980
    83
  addiere_vor_minus:         "[| l is_const; m is_const |] ==>  
neuper@52148
    84
			     - (l * v) +  m * v = (-l + m) * v" and
neuper@37980
    85
  addiere_eins_vor_minus:    "[| m is_const |] ==>  
neuper@52148
    86
			     -  v +  m * v = (-1 + m) * v" and
neuper@37980
    87
  subtrahiere_vor_minus:     "[| l is_const; m is_const |] ==>  
neuper@52148
    88
			     - (l * v) -  m * v = (-l - m) * v" and
neuper@37980
    89
  subtrahiere_eins_vor_minus:"[| m is_const |] ==>  
neuper@52148
    90
			     -  v -  m * v = (-1 - m) * v" and
neuper@37906
    91
walther@60269
    92
(*Ambiguous input\<^here> produces 3 parse trees -----------------------------\\*)
neuper@52148
    93
  vorzeichen_minus_weg1:      "l kleiner 0 ==> a + l * b = a - -1*l * b" and
neuper@52148
    94
  vorzeichen_minus_weg2:      "l kleiner 0 ==> a - l * b = a + -1*l * b" and
neuper@52148
    95
  vorzeichen_minus_weg3:      "l kleiner 0 ==> k + a - l * b = k + a + -1*l * b" and
neuper@52148
    96
  vorzeichen_minus_weg4:      "l kleiner 0 ==> k - a - l * b = k - a + -1*l * b" and
walther@60269
    97
(*Ambiguous input\<^here> produces 3 parse trees -----------------------------//*)
neuper@37906
    98
walther@59877
    99
  (*klammer_plus_plus = (add.assoc RS sym)*)
neuper@52148
   100
  klammer_plus_minus:          "a + (b - c) = (a + b) - c" and
neuper@52148
   101
  klammer_minus_plus:          "a - (b + c) = (a - b) - c" and
neuper@52148
   102
  klammer_minus_minus:         "a - (b - c) = (a - b) + c" and
neuper@37906
   103
neuper@52148
   104
  klammer_mult_minus:          "a * (b - c) = a * b - a * c" and
neuper@37980
   105
  klammer_minus_mult:          "(b - c) * a = b * a - c * a"
neuper@37906
   106
wneuper@59472
   107
ML \<open>
neuper@37950
   108
(** eval functions **)
neuper@37906
   109
neuper@37950
   110
(*. get the identifier from specific monomials; see fun ist_monom .*)
neuper@37950
   111
(*HACK.WN080107*)
neuper@37950
   112
fun increase str = 
walther@60269
   113
  let
walther@60269
   114
    val (s, ss) = 
walther@60269
   115
      case Symbol.explode str of
walther@60269
   116
        s :: ss => (s, ss)
walther@60269
   117
      | _ => raise ERROR "PolyMinus.increase: uncovered case"
walther@60269
   118
  in implode ((chr (ord s + 1))::ss) end;
walther@60269
   119
fun identifier (Free (id,_)) = id                            (* 2     ,   a   *)
walther@60269
   120
  | identifier (Const ("Groups.times_class.times", _) $ Free (_(*num*), _) $ Free (id, _)) = 
walther@60269
   121
    id                                                       (* 2*a   , a*b *)
neuper@38034
   122
  | identifier (Const ("Groups.times_class.times", _) $                          (* 3*a*b    *)
neuper@38034
   123
		     (Const ("Groups.times_class.times", _) $
neuper@37950
   124
			    Free (num, _) $ Free _) $ Free (id, _)) = 
wneuper@59390
   125
    if TermC.is_num' num then id
neuper@37950
   126
    else "|||||||||||||"
walther@60275
   127
  | identifier (Const ("Transcendental.powr", _) $ Free (base, _) $ Free (_(*exp*), _)) =
walther@60269
   128
    if TermC.is_num' base then "|||||||||||||"                     (* a^2      *)
neuper@37950
   129
    else (*increase*) base
neuper@38034
   130
  | identifier (Const ("Groups.times_class.times", _) $ Free (num, _) $          (* 3*a^2    *)
walther@60275
   131
		     (Const ("Transcendental.powr", _) $
walther@60269
   132
			    Free (base, _) $ Free (_(*exp*), _))) = 
wneuper@59390
   133
    if TermC.is_num' num andalso not (TermC.is_num' base) then (*increase*) base
neuper@37950
   134
    else "|||||||||||||"
neuper@37950
   135
  | identifier _ = "|||||||||||||"(*the "largest" string*);
neuper@37950
   136
neuper@37950
   137
(*("kleiner", ("PolyMinus.kleiner", eval_kleiner ""))*)
neuper@37950
   138
(* order "by alphabet" w.r.t. var: num < (var | num*var) > (var*var | ..) *)
neuper@37950
   139
fun eval_kleiner _ _ (p as (Const ("PolyMinus.kleiner",_) $ a $ b)) _  =
wneuper@59389
   140
     if TermC.is_num b then
wneuper@59389
   141
	 if TermC.is_num a then (*123 kleiner 32 = True !!!*)
wneuper@59392
   142
	     if TermC.num_of_term a < TermC.num_of_term b then 
walther@59868
   143
		 SOME ((UnparseC.term p) ^ " = True",
wneuper@59390
   144
		       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
walther@59868
   145
	     else SOME ((UnparseC.term p) ^ " = False",
wneuper@59390
   146
			HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
neuper@37950
   147
	 else (* -1 * -2 kleiner 0 *)
walther@59868
   148
	     SOME ((UnparseC.term p) ^ " = False",
wneuper@59390
   149
		   HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
neuper@37950
   150
    else
neuper@37950
   151
	if identifier a < identifier b then 
walther@59868
   152
	     SOME ((UnparseC.term p) ^ " = True",
wneuper@59390
   153
		  HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
walther@59868
   154
	else SOME ((UnparseC.term p) ^ " = False",
wneuper@59390
   155
		   HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
neuper@37950
   156
  | eval_kleiner _ _ _ _ =  NONE;
neuper@37950
   157
walther@60269
   158
fun ist_monom (Free _) = true
walther@60269
   159
  | ist_monom (Const ("Groups.times_class.times", _) $ Free (num, _) $ Free _) = 
wneuper@59390
   160
    if TermC.is_num' num then true else false
neuper@37950
   161
  | ist_monom _ = false;
walther@60269
   162
(*. this function only accepts the most simple monoms  vvvvvvvvvv .*)
walther@60269
   163
fun ist_monom (Free _) = true                          (* 2,   a   *)
neuper@38034
   164
  | ist_monom (Const ("Groups.times_class.times", _) $ Free _ $ Free (id, _)) = (* 2*a, a*b *)
wneuper@59390
   165
    if TermC.is_num' id then false else true
neuper@38034
   166
  | ist_monom (Const ("Groups.times_class.times", _) $                          (* 3*a*b    *)
neuper@38034
   167
		     (Const ("Groups.times_class.times", _) $
neuper@37950
   168
			    Free (num, _) $ Free _) $ Free (id, _)) =
wneuper@59390
   169
    if TermC.is_num' num andalso not (TermC.is_num' id) then true else false
walther@60275
   170
  | ist_monom (Const ("Transcendental.powr", _) $ Free _ $ Free _) = 
neuper@37950
   171
    true                                                    (* a^2      *)
neuper@38034
   172
  | ist_monom (Const ("Groups.times_class.times", _) $ Free (num, _) $          (* 3*a^2    *)
walther@60275
   173
		     (Const ("Transcendental.powr", _) $
walther@60269
   174
			    Free _ $ Free _)) = 
wneuper@59390
   175
    if TermC.is_num' num then true else false
neuper@37950
   176
  | ist_monom _ = false;
neuper@37950
   177
neuper@37950
   178
(* is this a univariate monomial ? *)
walther@60278
   179
(*("ist_monom", ("PolyMinus.ist_monom", eval_ist_monom ""))*)
walther@60278
   180
fun eval_ist_monom _ _ (p as (Const ("PolyMinus.ist_monom",_) $ a)) _  =
neuper@37950
   181
    if ist_monom a  then 
walther@59868
   182
	SOME ((UnparseC.term p) ^ " = True",
wneuper@59390
   183
	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
walther@59868
   184
    else SOME ((UnparseC.term p) ^ " = False",
wneuper@59390
   185
	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
neuper@37950
   186
  | eval_ist_monom _ _ _ _ =  NONE;
neuper@37950
   187
neuper@37950
   188
neuper@37950
   189
(** rewrite order **)
neuper@37950
   190
neuper@37950
   191
(** rulesets **)
neuper@37950
   192
neuper@37950
   193
val erls_ordne_alphabetisch =
walther@59852
   194
    Rule_Set.append_rules "erls_ordne_alphabetisch" Rule_Set.empty
wenzelm@60294
   195
	       [\<^rule_eval>\<open>PolyMinus.kleiner\<close> (eval_kleiner ""),
wenzelm@60294
   196
		     \<^rule_eval>\<open>PolyMinus.ist_monom\<close> (eval_ist_monom "")
neuper@37950
   197
		];
neuper@37950
   198
neuper@37950
   199
val ordne_alphabetisch = 
walther@59851
   200
  Rule_Def.Repeat{id = "ordne_alphabetisch", preconds = [], 
walther@59857
   201
      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
neuper@37950
   202
      erls = erls_ordne_alphabetisch, 
wenzelm@60297
   203
      rules = [\<^rule_thm>\<open>tausche_plus\<close>,
neuper@37950
   204
	       (*"b kleiner a ==> (b + a) = (a + b)"*)
wenzelm@60297
   205
	       \<^rule_thm>\<open>tausche_minus\<close>,
neuper@37950
   206
	       (*"b kleiner a ==> (b - a) = (-a + b)"*)
wenzelm@60297
   207
	       \<^rule_thm>\<open>tausche_vor_plus\<close>,
neuper@37950
   208
	       (*"[| b ist_monom; a kleiner b  |] ==> (- b + a) = (a - b)"*)
wenzelm@60297
   209
	       \<^rule_thm>\<open>tausche_vor_minus\<close>,
neuper@37950
   210
	       (*"[| b ist_monom; a kleiner b  |] ==> (- b - a) = (-a - b)"*)
wenzelm@60297
   211
	       \<^rule_thm>\<open>tausche_plus_plus\<close>,
neuper@37950
   212
	       (*"c kleiner b ==> (a + c + b) = (a + b + c)"*)
wenzelm@60297
   213
	       \<^rule_thm>\<open>tausche_plus_minus\<close>,
neuper@37950
   214
	       (*"c kleiner b ==> (a + c - b) = (a - b + c)"*)
wenzelm@60297
   215
	       \<^rule_thm>\<open>tausche_minus_plus\<close>,
neuper@37950
   216
	       (*"c kleiner b ==> (a - c + b) = (a + b - c)"*)
wenzelm@60297
   217
	       \<^rule_thm>\<open>tausche_minus_minus\<close>
neuper@37950
   218
	       (*"c kleiner b ==> (a - c - b) = (a - b - c)"*)
walther@59878
   219
	       ], scr = Rule.Empty_Prog};
neuper@37950
   220
neuper@37950
   221
val fasse_zusammen = 
walther@59851
   222
    Rule_Def.Repeat{id = "fasse_zusammen", preconds = [], 
walther@59857
   223
	rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
walther@59852
   224
	erls = Rule_Set.append_rules "erls_fasse_zusammen" Rule_Set.empty 
wenzelm@60294
   225
			  [\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_")],
walther@59851
   226
	srls = Rule_Set.Empty, calc = [], errpatts = [],
neuper@37950
   227
	rules = 
wenzelm@60297
   228
	[\<^rule_thm>\<open>real_num_collect\<close>, 
neuper@37950
   229
	 (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
wenzelm@60297
   230
	 \<^rule_thm>\<open>real_num_collect_assoc_r\<close>,
neuper@37950
   231
	 (*"[| l is_const; m..|] ==>  (k + m * n) + l * n = k + (l + m)*n"*)
wenzelm@60297
   232
	 \<^rule_thm>\<open>real_one_collect\<close>,	
neuper@37950
   233
	 (*"m is_const ==> n + m * n = (1 + m) * n"*)
wenzelm@60297
   234
	 \<^rule_thm>\<open>real_one_collect_assoc_r\<close>, 
neuper@37950
   235
	 (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
neuper@37950
   236
neuper@37950
   237
wenzelm@60297
   238
	 \<^rule_thm>\<open>subtrahiere\<close>,
neuper@37950
   239
	 (*"[| l is_const; m is_const |] ==> m * v - l * v = (m - l) * v"*)
wenzelm@60297
   240
	 \<^rule_thm>\<open>subtrahiere_von_1\<close>,
neuper@37950
   241
	 (*"[| l is_const |] ==> v - l * v = (1 - l) * v"*)
wenzelm@60297
   242
	 \<^rule_thm>\<open>subtrahiere_1\<close>,
neuper@37950
   243
	 (*"[| l is_const; m is_const |] ==> m * v - v = (m - 1) * v"*)
neuper@37950
   244
wenzelm@60297
   245
	 \<^rule_thm>\<open>subtrahiere_x_plus_minus\<close>, 
neuper@37950
   246
	 (*"[| l is_const; m..|] ==> (k + m * n) - l * n = k + ( m - l) * n"*)
wenzelm@60297
   247
	 \<^rule_thm>\<open>subtrahiere_x_plus1_minus\<close>,
neuper@37950
   248
	 (*"[| l is_const |] ==> (x + v) - l * v = x + (1 - l) * v"*)
wenzelm@60297
   249
	 \<^rule_thm>\<open>subtrahiere_x_plus_minus1\<close>,
neuper@37950
   250
	 (*"[| m is_const |] ==> (x + m * v) - v = x + (m - 1) * v"*)
neuper@37950
   251
wenzelm@60297
   252
	 \<^rule_thm>\<open>subtrahiere_x_minus_plus\<close>, 
neuper@37950
   253
	 (*"[| l is_const; m..|] ==> (k - m * n) + l * n = k + (-m + l) * n"*)
wenzelm@60297
   254
	 \<^rule_thm>\<open>subtrahiere_x_minus1_plus\<close>,
neuper@37950
   255
	 (*"[| l is_const |] ==> (x - v) + l * v = x + (-1 + l) * v"*)
wenzelm@60297
   256
	 \<^rule_thm>\<open>subtrahiere_x_minus_plus1\<close>,
neuper@37950
   257
	 (*"[| m is_const |] ==> (x - m * v) + v = x + (-m + 1) * v"*)
neuper@37950
   258
wenzelm@60297
   259
	 \<^rule_thm>\<open>subtrahiere_x_minus_minus\<close>, 
neuper@37950
   260
	 (*"[| l is_const; m..|] ==> (k - m * n) - l * n = k + (-m - l) * n"*)
wenzelm@60297
   261
	 \<^rule_thm>\<open>subtrahiere_x_minus1_minus\<close>,
neuper@37950
   262
	 (*"[| l is_const |] ==> (x - v) - l * v = x + (-1 - l) * v"*)
wenzelm@60297
   263
	 \<^rule_thm>\<open>subtrahiere_x_minus_minus1\<close>,
neuper@37950
   264
	 (*"[| m is_const |] ==> (x - m * v) - v = x + (-m - 1) * v"*)
neuper@37950
   265
	 
wenzelm@60294
   266
	 \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
wenzelm@60294
   267
	 \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#subtr_"),
neuper@37950
   268
	 
wneuper@59416
   269
	 (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
neuper@37950
   270
           (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
wenzelm@60297
   271
	 \<^rule_thm>\<open>real_mult_2_assoc_r\<close>,
neuper@37950
   272
	 (*"(k + z1) + z1 = k + 2 * z1"*)
wenzelm@60296
   273
	 \<^rule_thm_sym>\<open>real_mult_2\<close>,
neuper@37950
   274
	 (*"z1 + z1 = 2 * z1"*)
neuper@37950
   275
wenzelm@60297
   276
	 \<^rule_thm>\<open>addiere_vor_minus\<close>,
neuper@37950
   277
	 (*"[| l is_const; m is_const |] ==> -(l * v) +  m * v = (-l + m) *v"*)
wenzelm@60297
   278
	 \<^rule_thm>\<open>addiere_eins_vor_minus\<close>,
neuper@37950
   279
	 (*"[| m is_const |] ==> -  v +  m * v = (-1 + m) * v"*)
wenzelm@60297
   280
	 \<^rule_thm>\<open>subtrahiere_vor_minus\<close>,
neuper@37950
   281
	 (*"[| l is_const; m is_const |] ==> -(l * v) -  m * v = (-l - m) *v"*)
wenzelm@60297
   282
	 \<^rule_thm>\<open>subtrahiere_eins_vor_minus\<close>
neuper@37950
   283
	 (*"[| m is_const |] ==> -  v -  m * v = (-1 - m) * v"*)
neuper@37950
   284
	 
walther@59878
   285
	 ], scr = Rule.Empty_Prog};
neuper@37950
   286
    
neuper@37950
   287
val verschoenere = 
walther@59851
   288
  Rule_Def.Repeat{id = "verschoenere", preconds = [], 
walther@59857
   289
      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
walther@59852
   290
      erls = Rule_Set.append_rules "erls_verschoenere" Rule_Set.empty 
wenzelm@60294
   291
			[\<^rule_eval>\<open>PolyMinus.kleiner\<close> (eval_kleiner "")],
wenzelm@60297
   292
      rules = [\<^rule_thm>\<open>vorzeichen_minus_weg1\<close>,
neuper@37950
   293
	       (*"l kleiner 0 ==> a + l * b = a - -l * b"*)
wenzelm@60297
   294
	       \<^rule_thm>\<open>vorzeichen_minus_weg2\<close>,
neuper@37950
   295
	       (*"l kleiner 0 ==> a - l * b = a + -l * b"*)
wenzelm@60297
   296
	       \<^rule_thm>\<open>vorzeichen_minus_weg3\<close>,
neuper@37950
   297
	       (*"l kleiner 0 ==> k + a - l * b = k + a + -l * b"*)
wenzelm@60297
   298
	       \<^rule_thm>\<open>vorzeichen_minus_weg4\<close>,
neuper@37950
   299
	       (*"l kleiner 0 ==> k - a - l * b = k - a + -l * b"*)
neuper@37950
   300
wenzelm@60294
   301
	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
neuper@37950
   302
wenzelm@60297
   303
	       \<^rule_thm>\<open>mult_zero_left\<close>,    
neuper@37950
   304
	       (*"0 * z = 0"*)
wenzelm@60297
   305
	       \<^rule_thm>\<open>mult_1_left\<close>,     
neuper@37950
   306
	       (*"1 * z = z"*)
wenzelm@60297
   307
	       \<^rule_thm>\<open>add_0_left\<close>,
neuper@37950
   308
	       (*"0 + z = z"*)
wenzelm@60297
   309
	       \<^rule_thm>\<open>null_minus\<close>,
neuper@37950
   310
	       (*"0 - a = -a"*)
wenzelm@60297
   311
	       \<^rule_thm>\<open>vor_minus_mal\<close>
neuper@37950
   312
	       (*"- a * b = (-a) * b"*)
walther@59878
   313
	       ], scr = Rule.Empty_Prog} (*end verschoenere*);
neuper@37950
   314
neuper@37950
   315
val klammern_aufloesen = 
walther@59851
   316
  Rule_Def.Repeat{id = "klammern_aufloesen", preconds = [], 
walther@59857
   317
      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], erls = Rule_Set.Empty, 
wenzelm@60296
   318
      rules = [\<^rule_thm_sym>\<open>add.assoc\<close>,
neuper@37950
   319
	       (*"a + (b + c) = (a + b) + c"*)
wenzelm@60297
   320
	       \<^rule_thm>\<open>klammer_plus_minus\<close>,
neuper@37950
   321
	       (*"a + (b - c) = (a + b) - c"*)
wenzelm@60297
   322
	       \<^rule_thm>\<open>klammer_minus_plus\<close>,
neuper@37950
   323
	       (*"a - (b + c) = (a - b) - c"*)
wenzelm@60297
   324
	       \<^rule_thm>\<open>klammer_minus_minus\<close>
neuper@37950
   325
	       (*"a - (b - c) = (a - b) + c"*)
walther@59878
   326
	       ], scr = Rule.Empty_Prog};
neuper@37950
   327
neuper@37950
   328
val klammern_ausmultiplizieren = 
walther@59851
   329
  Rule_Def.Repeat{id = "klammern_ausmultiplizieren", preconds = [], 
walther@59857
   330
      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], erls = Rule_Set.Empty, 
wenzelm@60297
   331
      rules = [\<^rule_thm>\<open>distrib_right\<close>,
neuper@37950
   332
	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
wenzelm@60297
   333
	       \<^rule_thm>\<open>distrib_left\<close>,
neuper@37950
   334
	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
neuper@37950
   335
	       
wenzelm@60297
   336
	       \<^rule_thm>\<open>klammer_mult_minus\<close>,
neuper@37950
   337
	       (*"a * (b - c) = a * b - a * c"*)
wenzelm@60297
   338
	       \<^rule_thm>\<open>klammer_minus_mult\<close>
neuper@37950
   339
	       (*"(b - c) * a = b * a - c * a"*)
walther@59878
   340
	       ], scr = Rule.Empty_Prog};
neuper@37950
   341
neuper@37950
   342
val ordne_monome = 
walther@59851
   343
  Rule_Def.Repeat{id = "ordne_monome", preconds = [], 
walther@59857
   344
      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], 
walther@59852
   345
      erls = Rule_Set.append_rules "erls_ordne_monome" Rule_Set.empty
wenzelm@60294
   346
	       [\<^rule_eval>\<open>PolyMinus.kleiner\<close> (eval_kleiner ""),
wenzelm@60294
   347
		      \<^rule_eval>\<open>Prog_Expr.is_atom\<close> (Prog_Expr.eval_is_atom "")
neuper@37950
   348
		], 
wenzelm@60297
   349
      rules = [\<^rule_thm>\<open>tausche_mal\<close>,
neuper@37950
   350
	       (*"[| b is_atom; a kleiner b  |] ==> (b * a) = (a * b)"*)
wenzelm@60297
   351
	       \<^rule_thm>\<open>tausche_vor_mal\<close>,
neuper@37950
   352
	       (*"[| b is_atom; a kleiner b  |] ==> (-b * a) = (-a * b)"*)
wenzelm@60297
   353
	       \<^rule_thm>\<open>tausche_mal_mal\<close>,
neuper@37950
   354
	       (*"[| c is_atom; b kleiner c  |] ==> (a * c * b) = (a * b *c)"*)
wenzelm@60297
   355
	       \<^rule_thm>\<open>x_quadrat\<close>
walther@60242
   356
	       (*"(x * a) * a = x * a \<up> 2"*)
walther@59878
   357
	       ], scr = Rule.Empty_Prog};
neuper@37950
   358
neuper@37950
   359
neuper@37950
   360
val rls_p_33 = 
walther@59852
   361
    Rule_Set.append_rules "rls_p_33" Rule_Set.empty
wneuper@59416
   362
	       [Rule.Rls_ ordne_alphabetisch,
wneuper@59416
   363
		Rule.Rls_ fasse_zusammen,
wneuper@59416
   364
		Rule.Rls_ verschoenere
neuper@37950
   365
		];
neuper@37950
   366
val rls_p_34 = 
walther@59852
   367
    Rule_Set.append_rules "rls_p_34" Rule_Set.empty
wneuper@59416
   368
	       [Rule.Rls_ klammern_aufloesen,
wneuper@59416
   369
		Rule.Rls_ ordne_alphabetisch,
wneuper@59416
   370
		Rule.Rls_ fasse_zusammen,
wneuper@59416
   371
		Rule.Rls_ verschoenere
neuper@37950
   372
		];
neuper@37950
   373
val rechnen = 
walther@59852
   374
    Rule_Set.append_rules "rechnen" Rule_Set.empty
wenzelm@60294
   375
	       [\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
wenzelm@60294
   376
          \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
wenzelm@60294
   377
          \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#subtr_")
neuper@37950
   378
		];
wneuper@59472
   379
\<close>
wenzelm@60289
   380
rule_set_knowledge
wenzelm@60286
   381
  ordne_alphabetisch = \<open>prep_rls' ordne_alphabetisch\<close> and
wenzelm@60286
   382
  fasse_zusammen = \<open>prep_rls' fasse_zusammen\<close> and
wenzelm@60286
   383
  verschoenere = \<open>prep_rls' verschoenere\<close> and
wenzelm@60286
   384
  ordne_monome = \<open>prep_rls' ordne_monome\<close> and
wenzelm@60286
   385
  klammern_aufloesen = \<open>prep_rls' klammern_aufloesen\<close> and
wenzelm@60286
   386
  klammern_ausmultiplizieren = \<open>prep_rls' klammern_ausmultiplizieren\<close>
neuper@37950
   387
neuper@37950
   388
(** problems **)
wneuper@59472
   389
setup \<open>KEStore_Elems.add_pbts
wenzelm@60290
   390
  [(Problem.prep_input @{theory} "pbl_vereinf_poly" [] Problem.id_empty
walther@59997
   391
      (["polynom", "vereinfachen"], [], Rule_Set.Empty, NONE, [])),
wenzelm@60290
   392
    (Problem.prep_input @{theory} "pbl_vereinf_poly_minus" [] Problem.id_empty
walther@59997
   393
      (["plus_minus", "polynom", "vereinfachen"],
s1210629013@55339
   394
        [("#Given", ["Term t_t"]),
s1210629013@55339
   395
          ("#Where", ["t_t is_polyexp",
s1210629013@55339
   396
            "Not (matchsub (?a + (?b + ?c)) t_t | " ^
s1210629013@55339
   397
            "     matchsub (?a + (?b - ?c)) t_t | " ^
s1210629013@55339
   398
            "     matchsub (?a - (?b + ?c)) t_t | " ^
s1210629013@55339
   399
            "     matchsub (?a + (?b - ?c)) t_t )",
s1210629013@55339
   400
            "Not (matchsub (?a * (?b + ?c)) t_t | " ^
s1210629013@55339
   401
            "     matchsub (?a * (?b - ?c)) t_t | " ^
s1210629013@55339
   402
            "     matchsub ((?b + ?c) * ?a) t_t | " ^
s1210629013@55339
   403
            "     matchsub ((?b - ?c) * ?a) t_t )"]),
s1210629013@55339
   404
          ("#Find", ["normalform n_n"])],
walther@59852
   405
        Rule_Set.append_rules "prls_pbl_vereinf_poly" Rule_Set.empty 
wenzelm@60294
   406
	        [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
wenzelm@60294
   407
	         \<^rule_eval>\<open>Prog_Expr.matchsub\<close> (Prog_Expr.eval_matchsub ""),
wenzelm@60297
   408
	          \<^rule_thm>\<open>or_true\<close>,
s1210629013@55339
   409
            (*"(?a | True) = True"*)
wenzelm@60297
   410
            \<^rule_thm>\<open>or_false\<close>,
s1210629013@55339
   411
            (*"(?a | False) = ?a"*)
wenzelm@60297
   412
            \<^rule_thm>\<open>not_true\<close>,
s1210629013@55339
   413
            (*"(~ True) = False"*)
wenzelm@60297
   414
            \<^rule_thm>\<open>not_false\<close>
s1210629013@55339
   415
            (*"(~ False) = True"*)], 
walther@59997
   416
       SOME "Vereinfache t_t", [["simplification", "for_polynomials", "with_minus"]])),
wenzelm@60290
   417
    (Problem.prep_input @{theory} "pbl_vereinf_poly_klammer" [] Problem.id_empty
walther@59997
   418
      (["klammer", "polynom", "vereinfachen"],
s1210629013@55339
   419
        [("#Given" ,["Term t_t"]),
s1210629013@55339
   420
          ("#Where" ,["t_t is_polyexp",
s1210629013@55339
   421
            "Not (matchsub (?a * (?b + ?c)) t_t | " ^
s1210629013@55339
   422
            "     matchsub (?a * (?b - ?c)) t_t | " ^
s1210629013@55339
   423
            "     matchsub ((?b + ?c) * ?a) t_t | " ^
s1210629013@55339
   424
            "     matchsub ((?b - ?c) * ?a) t_t )"]),
s1210629013@55339
   425
          ("#Find"  ,["normalform n_n"])],
walther@59852
   426
        Rule_Set.append_rules "prls_pbl_vereinf_poly_klammer" Rule_Set.empty
wenzelm@60294
   427
          [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
wenzelm@60294
   428
	           \<^rule_eval>\<open>Prog_Expr.matchsub\<close> (Prog_Expr.eval_matchsub ""),
wenzelm@60297
   429
             \<^rule_thm>\<open>or_true\<close>,
s1210629013@55339
   430
             (*"(?a | True) = True"*)
wenzelm@60297
   431
             \<^rule_thm>\<open>or_false\<close>,
s1210629013@55339
   432
             (*"(?a | False) = ?a"*)
wenzelm@60297
   433
             \<^rule_thm>\<open>not_true\<close>,
s1210629013@55339
   434
             (*"(~ True) = False"*)
wenzelm@60297
   435
             \<^rule_thm>\<open>not_false\<close>
s1210629013@55339
   436
             (*"(~ False) = True"*)], 
s1210629013@55339
   437
        SOME "Vereinfache t_t", 
walther@59997
   438
        [["simplification", "for_polynomials", "with_parentheses"]])),
wenzelm@60290
   439
    (Problem.prep_input @{theory} "pbl_vereinf_poly_klammer_mal" [] Problem.id_empty
walther@59997
   440
      (["binom_klammer", "polynom", "vereinfachen"],
s1210629013@55339
   441
        [("#Given", ["Term t_t"]),
s1210629013@55339
   442
          ("#Where", ["t_t is_polyexp"]),
s1210629013@55339
   443
          ("#Find", ["normalform n_n"])],
walther@59852
   444
        Rule_Set.append_rules "empty" Rule_Set.empty [(*for preds in where_*)
wenzelm@60294
   445
			      \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp "")], 
s1210629013@55339
   446
        SOME "Vereinfache t_t", 
walther@59997
   447
        [["simplification", "for_polynomials", "with_parentheses_mult"]])),
wenzelm@60290
   448
    (Problem.prep_input @{theory} "pbl_probe" [] Problem.id_empty (["probe"], [], Rule_Set.Empty, NONE, [])),
wenzelm@60290
   449
    (Problem.prep_input @{theory} "pbl_probe_poly" [] Problem.id_empty
walther@59997
   450
      (["polynom", "probe"],
s1210629013@55339
   451
        [("#Given", ["Pruefe e_e", "mitWert w_w"]),
s1210629013@55339
   452
          ("#Where", ["e_e is_polyexp"]),
s1210629013@55339
   453
          ("#Find", ["Geprueft p_p"])],
walther@59852
   454
        Rule_Set.append_rules "prls_pbl_probe_poly" Rule_Set.empty [(*for preds in where_*)
wenzelm@60294
   455
		      \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp "")], 
s1210629013@55339
   456
        SOME "Probe e_e w_w", 
walther@59997
   457
        [["probe", "fuer_polynom"]])),
wenzelm@60290
   458
    (Problem.prep_input @{theory} "pbl_probe_bruch" [] Problem.id_empty
walther@59997
   459
      (["bruch", "probe"],
s1210629013@55339
   460
        [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
s1210629013@55339
   461
          ("#Where" ,["e_e is_ratpolyexp"]),
s1210629013@55339
   462
          ("#Find"  ,["Geprueft p_p"])],
walther@59852
   463
        Rule_Set.append_rules "prls_pbl_probe_bruch" Rule_Set.empty [(*for preds in where_*)
wenzelm@60294
   464
		      \<^rule_eval>\<open>is_ratpolyexp\<close> (eval_is_ratpolyexp "")], 
walther@59997
   465
        SOME "Probe e_e w_w", [["probe", "fuer_bruch"]]))]\<close>
neuper@37950
   466
neuper@37950
   467
(** methods **)
wneuper@59545
   468
wneuper@59504
   469
partial_function (tailrec) simplify :: "real \<Rightarrow> real"
wneuper@59504
   470
  where
walther@59635
   471
"simplify t_t = (
walther@59635
   472
  (Repeat(
walther@59637
   473
    (Try (Rewrite_Set ''ordne_alphabetisch'')) #>
walther@59637
   474
    (Try (Rewrite_Set ''fasse_zusammen'')) #>
walther@59635
   475
    (Try (Rewrite_Set ''verschoenere'')))
walther@59635
   476
  ) t_t)"
wenzelm@60303
   477
wenzelm@60303
   478
method met_simp_poly_minus : "simplification/for_polynomials/with_minus" =
wenzelm@60303
   479
  \<open>{rew_ord'="tless_true", rls' = Rule_Set.empty, calc = [], srls = Rule_Set.empty,
wenzelm@60303
   480
    prls =
wenzelm@60303
   481
      Rule_Set.append_rules "prls_met_simp_poly_minus" Rule_Set.empty 
wenzelm@60303
   482
        [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
wenzelm@60303
   483
          \<^rule_eval>\<open>Prog_Expr.matchsub\<close> (Prog_Expr.eval_matchsub ""),
wenzelm@60303
   484
          \<^rule_thm>\<open>and_true\<close>,
wenzelm@60303
   485
          (*"(?a & True) = ?a"*)
wenzelm@60303
   486
          \<^rule_thm>\<open>and_false\<close>,
wenzelm@60303
   487
          (*"(?a & False) = False"*)
wenzelm@60303
   488
          \<^rule_thm>\<open>not_true\<close>,
wenzelm@60303
   489
          (*"(~ True) = False"*)
wenzelm@60303
   490
          \<^rule_thm>\<open>not_false\<close>
wenzelm@60303
   491
          (*"(~ False) = True"*)],
wenzelm@60303
   492
    crls = Rule_Set.empty, errpats = [], nrls = rls_p_33}\<close>
wenzelm@60303
   493
  Program: simplify.simps
wenzelm@60303
   494
  Given: "Term t_t"
wenzelm@60303
   495
  Where:
wenzelm@60303
   496
    "t_t is_polyexp"
wenzelm@60303
   497
    "Not (matchsub (?a + (?b + ?c)) t_t |
wenzelm@60303
   498
          matchsub (?a + (?b - ?c)) t_t |
wenzelm@60303
   499
          matchsub (?a - (?b + ?c)) t_t |
wenzelm@60303
   500
          matchsub (?a + (?b - ?c)) t_t)"
wenzelm@60303
   501
  Find: "normalform n_n"
wneuper@59545
   502
wneuper@59504
   503
partial_function (tailrec) simplify2 :: "real \<Rightarrow> real"
wneuper@59504
   504
  where
walther@59635
   505
"simplify2 t_t = (
walther@59635
   506
  (Repeat(
walther@59637
   507
    (Try (Rewrite_Set ''klammern_aufloesen'')) #>
walther@59637
   508
    (Try (Rewrite_Set ''ordne_alphabetisch'')) #>
walther@59637
   509
    (Try (Rewrite_Set ''fasse_zusammen'')) #>
walther@59635
   510
    (Try (Rewrite_Set ''verschoenere'')))
walther@59635
   511
  ) t_t)"
wenzelm@60303
   512
wenzelm@60303
   513
method met_simp_poly_parenth : "simplification/for_polynomials/with_parentheses" =
wenzelm@60303
   514
  \<open>{rew_ord'="tless_true", rls' = Rule_Set.empty, calc = [], srls = Rule_Set.empty, 
wenzelm@60303
   515
    prls = Rule_Set.append_rules "simplification_for_polynomials_prls" Rule_Set.empty 
wenzelm@60303
   516
      [(*for preds in where_*) \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp"")],
wenzelm@60303
   517
    crls = Rule_Set.empty, errpats = [], nrls = rls_p_34}\<close>
wenzelm@60303
   518
  Program: simplify2.simps
wenzelm@60303
   519
  Given: "Term t_t"
wenzelm@60303
   520
  Where: "t_t is_polyexp"
wenzelm@60303
   521
  Find: "normalform n_n"
wneuper@59545
   522
wneuper@59504
   523
partial_function (tailrec) simplify3 :: "real \<Rightarrow> real"
wneuper@59504
   524
  where
walther@59635
   525
"simplify3 t_t = (
walther@59635
   526
  (Repeat(
walther@59637
   527
    (Try (Rewrite_Set ''klammern_ausmultiplizieren'')) #>
walther@59637
   528
    (Try (Rewrite_Set ''discard_parentheses'')) #>
walther@59637
   529
    (Try (Rewrite_Set ''ordne_monome'')) #>
walther@59637
   530
    (Try (Rewrite_Set ''klammern_aufloesen'')) #>
walther@59637
   531
    (Try (Rewrite_Set ''ordne_alphabetisch'')) #>
walther@59637
   532
    (Try (Rewrite_Set ''fasse_zusammen'')) #>
walther@59635
   533
    (Try (Rewrite_Set ''verschoenere'')))
walther@59635
   534
  ) t_t)"
wenzelm@60303
   535
wenzelm@60303
   536
method met_simp_poly_parenth_mult : "simplification/for_polynomials/with_parentheses_mult" =
wenzelm@60303
   537
  \<open>{rew_ord'="tless_true", rls' = Rule_Set.empty, calc = [], srls = Rule_Set.empty, 
wenzelm@60303
   538
    prls = Rule_Set.append_rules "simplification_for_polynomials_prls" Rule_Set.empty 
wenzelm@60303
   539
      [(*for preds in where_*) \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp"")],
wenzelm@60303
   540
    crls = Rule_Set.empty, errpats = [], nrls = rls_p_34}\<close>
wenzelm@60303
   541
  Program: simplify3.simps
wenzelm@60303
   542
  Given: "Term t_t"
wenzelm@60303
   543
  Where: "t_t is_polyexp"
wenzelm@60303
   544
  Find: "normalform n_n"
wenzelm@60303
   545
wenzelm@60303
   546
method met_probe : "probe" =
wenzelm@60303
   547
  \<open>{rew_ord'="tless_true", rls' = Rule_Set.empty, calc = [], srls = Rule_Set.empty, prls = Rule_Set.Empty, crls = Rule_Set.empty,
wenzelm@60303
   548
    errpats = [], nrls = Rule_Set.Empty}\<close>
wneuper@59545
   549
wneuper@59504
   550
partial_function (tailrec) mache_probe :: "bool \<Rightarrow> bool list \<Rightarrow> bool"
wneuper@59504
   551
  where
walther@59635
   552
"mache_probe e_e w_w = (
walther@59635
   553
  let
walther@59635
   554
     e_e = Take e_e;
walther@59635
   555
     e_e = Substitute w_w e_e
walther@59635
   556
  in (
walther@59635
   557
    Repeat (
walther@59637
   558
      (Try (Repeat (Calculate ''TIMES''))) #>
walther@59637
   559
      (Try (Repeat (Calculate ''PLUS'' ))) #>
walther@59635
   560
      (Try (Repeat (Calculate ''MINUS''))))
walther@59635
   561
    ) e_e)"
wenzelm@60303
   562
wenzelm@60303
   563
method met_probe_poly : "probe/fuer_polynom" =
wenzelm@60303
   564
  \<open>{rew_ord'="tless_true", rls' = Rule_Set.empty, calc = [], srls = Rule_Set.empty, 
wenzelm@60303
   565
    prls = Rule_Set.append_rules "prls_met_probe_bruch" Rule_Set.empty
wenzelm@60303
   566
        [(*for preds in where_*) \<^rule_eval>\<open>is_ratpolyexp\<close> (eval_is_ratpolyexp "")], 
wenzelm@60303
   567
    crls = Rule_Set.empty, errpats = [], nrls = rechnen}\<close>
wenzelm@60303
   568
  Program: mache_probe.simps
wenzelm@60303
   569
  Given: "Pruefe e_e" "mitWert w_w"
wenzelm@60303
   570
  Where: "e_e is_polyexp"
wenzelm@60303
   571
  Find: "Geprueft p_p"
wenzelm@60303
   572
wenzelm@60303
   573
method met_probe_bruch : "probe/fuer_bruch" =
wenzelm@60303
   574
  \<open>{rew_ord'="tless_true", rls' = Rule_Set.empty, calc = [], srls = Rule_Set.empty, 
wenzelm@60303
   575
    prls = Rule_Set.append_rules "prls_met_probe_bruch" Rule_Set.empty
wenzelm@60303
   576
        [(*for preds in where_*) \<^rule_eval>\<open>is_ratpolyexp\<close> (eval_is_ratpolyexp "")],
wenzelm@60303
   577
    crls = Rule_Set.empty, errpats = [], nrls = Rule_Set.Empty}\<close>
wenzelm@60303
   578
  Given: "Pruefe e_e" "mitWert w_w"
wenzelm@60303
   579
  Where: "e_e is_ratpolyexp"
wenzelm@60303
   580
  Find: "Geprueft p_p"
wenzelm@60303
   581
wenzelm@60303
   582
ML \<open>
walther@60278
   583
\<close> ML \<open>
wneuper@59472
   584
\<close>
neuper@37906
   585
neuper@37906
   586
end
neuper@37906
   587