neuper@42289
|
1 |
theory Partial_Fractions imports Rational begin
|
neuper@42289
|
2 |
|
neuper@42289
|
3 |
subsection {*get the denominator out of a fraction*}
|
neuper@42289
|
4 |
text {*this function can be put into rule sets*}
|
neuper@42289
|
5 |
ML {*
|
neuper@42289
|
6 |
(*("get_denominator", ("Rational.get'_denominator", eval_get_denominator ""))*)
|
neuper@42289
|
7 |
fun eval_get_denominator (thmid:string) _
|
neuper@42289
|
8 |
(t as (Const("Rings.inverse_class.divide", _) $ num $ denom)) thy =
|
neuper@42289
|
9 |
SOME (mk_thmid thmid ""
|
neuper@42289
|
10 |
(Print_Mode.setmp [] (Syntax.string_of_term (thy2ctxt thy)) denom) "",
|
neuper@42289
|
11 |
Trueprop $ (mk_equality (t, denom)))
|
neuper@42289
|
12 |
| eval_get_denominator _ _ _ _ = NONE;
|
neuper@42289
|
13 |
*}
|
neuper@42289
|
14 |
text {*rule set for partial fractions*}
|
neuper@42289
|
15 |
ML {*
|
neuper@42289
|
16 |
val partial_fraction =
|
neuper@42289
|
17 |
Rls {id="partial_fraction", preconds = [], rew_ord = ("termlessI",termlessI),
|
neuper@42289
|
18 |
erls = Erls, srls = Erls, calc = [],
|
neuper@42289
|
19 |
rules = [
|
neuper@42289
|
20 |
Calc ("Rings.inverse_class.divide", eval_get_denominator "#")
|
neuper@42289
|
21 |
],
|
neuper@42289
|
22 |
scr = EmptyScr};
|
neuper@42289
|
23 |
*}
|
neuper@42289
|
24 |
text {*store the rule set for math engine*}
|
neuper@42289
|
25 |
ML {*
|
neuper@42289
|
26 |
overwritelthy @{theory} (!ruleset',
|
neuper@42289
|
27 |
[("partial_fraction", prep_rls partial_fraction)
|
neuper@42289
|
28 |
]);
|
neuper@42289
|
29 |
*}
|
neuper@42289
|
30 |
|
neuper@42289
|
31 |
|
neuper@42289
|
32 |
end |