diff -r 2b6e73df4e5d -r d3a3cc2f0382 src/Tools/isac/Knowledge/Rational.thy --- a/src/Tools/isac/Knowledge/Rational.thy Wed Aug 18 11:35:24 2021 +0200 +++ b/src/Tools/isac/Knowledge/Rational.thy Wed Aug 18 16:03:08 2021 +0200 @@ -89,7 +89,7 @@ (*real_times_divide1_eq .. Isa02*) real_times_divide_1_eq: "-1 * (c / d) = -1 * c / d " and - real_times_divide_num: "a is_const ==> a * (c / d) = a * c / d " and + real_times_divide_num: "a is_num ==> a * (c / d) = a * c / d " and real_mult_div_cancel2: "k ~= 0 ==> m * k / (n * k) = m / n" and (*real_mult_div_cancel1: "k ~= 0 ==> k * m / (k * n) = m / n"..Isa02*) @@ -100,21 +100,21 @@ rat_power: "(a / b) \ n = (a \ n) / (b \ n)" and - rat_add: "[| a is_const; b is_const; c is_const; d is_const |] ==> + rat_add: "[| a is_num; b is_num; c is_num; d is_num |] ==> a / c + b / d = (a * d + b * c) / (c * d)" and - rat_add_assoc: "[| a is_const; b is_const; c is_const; d is_const |] ==> + rat_add_assoc: "[| a is_num; b is_num; c is_num; d is_num |] ==> a / c +(b / d + e) = (a * d + b * c)/(d * c) + e" and - rat_add1: "[| a is_const; b is_const; c is_const |] ==> + rat_add1: "[| a is_num; b is_num; c is_num |] ==> a / c + b / c = (a + b) / c" and - rat_add1_assoc: "[| a is_const; b is_const; c is_const |] ==> + rat_add1_assoc: "[| a is_num; b is_num; c is_num |] ==> a / c + (b / c + e) = (a + b) / c + e" and - rat_add2: "[| a is_const; b is_const; c is_const |] ==> + rat_add2: "[| a is_num; b is_num; c is_num |] ==> a / c + b = (a + b * c) / c" and - rat_add2_assoc: "[| a is_const; b is_const; c is_const |] ==> + rat_add2_assoc: "[| a is_num; b is_num; c is_num |] ==> a / c + (b + e) = (a + b * c) / c + e" and - rat_add3: "[| a is_const; b is_const; c is_const |] ==> + rat_add3: "[| a is_num; b is_num; c is_num |] ==> a + b / c = (a * c + b) / c" and - rat_add3_assoc: "[| a is_const; b is_const; c is_const |] ==> + rat_add3_assoc: "[| a is_num; b is_num; c is_num |] ==> a + (b / c + e) = (a * c + b) / c + e" section \Cancellation and addition of fractions\ @@ -414,7 +414,9 @@ rules = [ \<^rule_eval>\matches\ (Prog_Expr.eval_matches "#matches_"), \<^rule_eval>\HOL.eq\ (Prog_Expr.eval_equal "#equal_"), - \<^rule_eval>\is_const\ (Prog_Expr.eval_const "#is_const_"), +(*/----- TOODOO from 2b6e73df4e5d assoc_calc: 'Prog_Expr.is_num' not found in theory Poly -------\* ) + \<^rule_eval>\is_num\ (Prog_Expr.eval_is_num "#is_num_"), +( *\---- TOODOO from 2b6e73df4e5d assoc_calc: 'Prog_Expr.is_num' not found in theory Poly ------/*) \<^rule_thm>\not_true\, \<^rule_thm>\not_false\], scr = Rule.Empty_Prog}); @@ -432,10 +434,10 @@ \<^rule_thm_sym>\minus_divide_left\, (*SYM - ?x / ?y = - (?x / ?y) may come from subst*) \<^rule_thm>\rat_add\, - (*"[| a is_const; b is_const; c is_const; d is_const |] ==> a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*) - \<^rule_thm>\rat_add1\, (*"[| a is_const; b is_const; c is_const |] ==> a / c + b / c = (a + b) / c"*) - \<^rule_thm>\rat_add2\, (*"[| ?a is_const; ?b is_const; ?c is_const |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*) - \<^rule_thm>\rat_add3\, (*"[| a is_const; b is_const; c is_const |] ==> a + b / c = (a * c) / c + b / c" *) + (*"[| a is_num; b is_num; c is_num; d is_num |] ==> a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*) + \<^rule_thm>\rat_add1\, (*"[| a is_num; b is_num; c is_num |] ==> a / c + b / c = (a + b) / c"*) + \<^rule_thm>\rat_add2\, (*"[| ?a is_num; ?b is_num; ?c is_num |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*) + \<^rule_thm>\rat_add3\, (*"[| a is_num; b is_num; c is_num |] ==> a + b / c = (a * c) / c + b / c" *) \<^rule_thm>\rat_mult\, (*a / b * (c / d) = a * c / (b * d)*) \<^rule_thm>\times_divide_eq_right\, (*?x * (?y / ?z) = ?x * ?y / ?z*) @@ -626,6 +628,7 @@ \<^rule_eval>\plus\ (**)(eval_binop "#add_")], scr = Rule.Empty_Prog}); +\ ML \ (*.contains absolute minimum of thms for context in norm_Rational.*) val rat_mult_divide = prep_rls'( Rule_Def.Repeat {id = "rat_mult_divide", preconds = [], @@ -643,6 +646,7 @@ \<^rule_eval>\divide\ (Prog_Expr.eval_cancel "#divide_e")], scr = Rule.Empty_Prog}); +\ ML \ (*.contains absolute minimum of thms for context in norm_Rational.*) val reduce_0_1_2 = prep_rls'( Rule_Def.Repeat{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), @@ -664,15 +668,23 @@ \<^rule_thm>\division_ring_divide_zero\ (*"0 / ?x = 0"*)], scr = Rule.Empty_Prog}); +\ ML \ +\ ML \@{term "1 is_num"}\ (*.."Prog_Expr.is_num" IS KNOWN TOODOO*) +ML \ (*erls for calculate_Rational; make local with FIXX@ME result:term *term list WN0609???SKMG*) val norm_rat_erls = prep_rls'( Rule_Def.Repeat {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [], rules = [ - \<^rule_eval>\Prog_Expr.is_const\ (Prog_Expr.eval_const "#is_const_")], + \<^rule_thm>\refl\ (* ..DELETE, just to avoid ERROR fun #> not applicable to "[]"*) +(*/----- TOODOO from 2b6e73df4e5d assoc_calc: 'Prog_Expr.is_num' not found in theory Poly -------\* ) + \<^rule_eval>\Prog_Expr.is_num\ (Prog_Expr.eval_is_num "#is_num_") +( *\---- TOODOO from 2b6e73df4e5d assoc_calc: 'Prog_Expr.is_num' not found in theory Poly ------/*) +], scr = Rule.Empty_Prog}); +\ ML \ (* consists of rls containing the absolute minimum of thms *) (* which is now replaced by MGs version "norm_Rational" below @@ -693,6 +705,7 @@ ], scr = Rule.Empty_Prog}); +\ ML \ val norm_Rational_parenthesized = prep_rls'( Rule_Set.Sequence {id = "norm_Rational_parenthesized", preconds = []:term list, rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),