src/Tools/isac/Knowledge/Partial_Fractions.thy
author Jan Rocnik <jan.rocnik@student.tugraz.at>
Tue, 27 Sep 2011 11:05:00 +0200
branchdecompose-isar
changeset 42293 b24574463e1a
parent 42291 033b904e9a3e
child 42295 e9b9d3f7712c
permissions -rwxr-xr-x
before merge
     1 theory Partial_Fractions imports Rational begin
     2 
     3 subsection {*get the denominator out of a fraction*}
     4 text {*this function can be put into rule sets*}
     5 ML {*
     6 (*("get_denominator", ("Rational.get'_denominator", eval_get_denominator ""))*)
     7 fun eval_get_denominator (thmid:string) _ 
     8 		      (t as (Const("Rings.inverse_class.divide", _) $ num $ denom)) thy = 
     9     SOME (mk_thmid thmid "" 
    10             (Print_Mode.setmp [] (Syntax.string_of_term (thy2ctxt thy)) denom) "", 
    11 	          Trueprop $ (mk_equality (t, denom)))
    12   | eval_get_denominator _ _ _ _ = NONE; 
    13 *}
    14 
    15 
    16 
    17 subsection {*get the argument out of a fraction*}
    18 
    19 ML {*
    20 (*("get_argument", ("Rational.get'_argument", eval_get_argument ""))*)
    21 
    22 (* 
    23 fun eval_get_argument "Atools.argument'_in" 
    24 		     (t as (Const ("Atools.argument'_in", _) $ (f $ arg))) _ =
    25     if is_Free arg (*could be something to be simplified before*)
    26     then SOME (term2str t ^ " = " ^ term2str arg,
    27 	       Trueprop $ (mk_equality (t, arg)))
    28     else NONE
    29   | eval_argument_in _ _ _ _ = NONE;
    30 *)
    31 
    32 *}
    33 
    34 subsection{*rule set for partial fractions*}
    35 ML {*
    36 val partial_fraction = 
    37   Rls {id="partial_fraction", preconds = [], rew_ord = ("termlessI",termlessI), 
    38 	  erls = Erls, srls = Erls, calc = [],
    39 	  rules = [
    40 				    Calc ("Rings.inverse_class.divide", eval_get_denominator "#", eval_get_argument "X")
    41 		  ],
    42 	 scr = EmptyScr};
    43 *}
    44 
    45 subsection{*store the rule set for math engine*}
    46 ML {*
    47   overwritelthy @{theory} (!ruleset', 
    48 	    [("partial_fraction", prep_rls partial_fraction)
    49 	     ]);
    50 *}
    51 
    52 end