[-Test_Isac] extend "is_polyexp (Const _) = true" for AA
authorWalther Neuper <wneuper@ist.tugraz.at>
Thu, 21 Mar 2019 17:51:18 +0100
changeset 59529886969027389
parent 59528 8c7dcea539c4
child 59530 2f33c24381e7
[-Test_Isac] extend "is_polyexp (Const _) = true" for AA
src/Tools/isac/Knowledge/Poly.thy
test/Tools/isac/Interpret/mathengine.sml
test/Tools/isac/Knowledge/eqsystem.sml
test/Tools/isac/Knowledge/poly.sml
test/Tools/isac/ProgLang/rewrite.sml
test/Tools/isac/Test_Isac.thy
test/Tools/isac/library.sml
     1.1 --- a/src/Tools/isac/Knowledge/Poly.thy	Wed Mar 20 15:34:43 2019 +0100
     1.2 +++ b/src/Tools/isac/Knowledge/Poly.thy	Thu Mar 21 17:51:18 2019 +0100
     1.3 @@ -531,6 +531,7 @@
     1.4  (*.the expression contains + - * ^ only ?
     1.5     this is weaker than 'is_polynomial' !.*)
     1.6  fun is_polyexp (Free _) = true
     1.7 +  | is_polyexp (Const _) = true (* potential danger: bdv is not considered *)
     1.8    | is_polyexp (Const ("Groups.plus_class.plus",_) $ Free _ $ Free _) = true
     1.9    | is_polyexp (Const ("Groups.minus_class.minus",_) $ Free _ $ Free _) = true
    1.10    | is_polyexp (Const ("Groups.times_class.times",_) $ Free _ $ Free _) = true
     2.1 --- a/test/Tools/isac/Interpret/mathengine.sml	Wed Mar 20 15:34:43 2019 +0100
     2.2 +++ b/test/Tools/isac/Interpret/mathengine.sml	Thu Mar 21 17:51:18 2019 +0100
     2.3 @@ -180,14 +180,14 @@
     2.4  val ((pt,_),_) = get_calc 1;
     2.5  val pp = par_pblobj pt p;
     2.6  val keID = guh2kestoreID guh;
     2.7 -case context_pbl keID pt pp of (true,["univariate", "equation"],_,_,_)=>()
     2.8 +case context_pbl keID pt pp of (true,["univariate","equation"],_,_,_)=>()
     2.9  | _ => error "mathengine.sml: context_pbl .. pbl_equ_univ checked";
    2.10  
    2.11  case get_obj g_spec pt p of (_, ["e_pblID"], _) => ()
    2.12  | _ => error "mathengine.sml: context_pbl .. pbl still empty";
    2.13  setContext 1 pos guh;
    2.14  val ((pt,_),_) = get_calc 1;
    2.15 -case get_obj g_spec pt p of (_, ["univariate", "equation"], _) => ()
    2.16 +case get_obj g_spec pt p of (_, ["univariate","equation"], _) => ()
    2.17  | _ => error "mathengine.sml: context_pbl .. pbl set";
    2.18  
    2.19  
     3.1 --- a/test/Tools/isac/Knowledge/eqsystem.sml	Wed Mar 20 15:34:43 2019 +0100
     3.2 +++ b/test/Tools/isac/Knowledge/eqsystem.sml	Thu Mar 21 17:51:18 2019 +0100
     3.3 @@ -179,7 +179,7 @@
     3.4  	    \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L ^^^ 3 +         \
     3.5  	    \                                     -1 * q_0 / 24 * L ^^^ 4)]";
     3.6  val SOME (t,_) = rewrite_set_ thy true norm_Rational t;
     3.7 -if term2str t="[0 = c_2 + 0 / EI, 0 = c_2 + L * c + L ^^^ 4 * q_0 / (EI * 24)]"
     3.8 +if term2str t = "[0 = c_2 + 0 / EI, 0 = c_2 + L * c + L ^^^ 4 * q_0 / (24 * EI)]"
     3.9  then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.0b";
    3.10  
    3.11  val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
     4.1 --- a/test/Tools/isac/Knowledge/poly.sml	Wed Mar 20 15:34:43 2019 +0100
     4.2 +++ b/test/Tools/isac/Knowledge/poly.sml	Thu Mar 21 17:51:18 2019 +0100
     4.3 @@ -13,7 +13,7 @@
     4.4  "--------------------------------------------------------";
     4.5  "table of contents --------------------------------------";
     4.6  "--------------------------------------------------------";
     4.7 -"-------- check is'_polyexp is_polyexp ------------------";
     4.8 +"----------- fun is_polyexp --------------------------------------------------------------------";
     4.9  "----------- fun has_degree_in -----------------------------------------------------------------";
    4.10  "----------- fun mono_deg_in -------------------------------------------------------------------";
    4.11  "----------- fun mono_deg_in -------------------------------------------------------------------";
    4.12 @@ -32,11 +32,20 @@
    4.13  "--------------------------------------------------------";
    4.14  
    4.15  
    4.16 -"-------- check is'_polyexp is_polyexp ------------------";
    4.17 -"-------- check is'_polyexp is_polyexp ------------------";
    4.18 -"-------- check is'_polyexp is_polyexp ------------------";
    4.19 -if is_polyexp @{term "x / x"} 
    4.20 -then error "poly.sml: check is'_polyexp is_polyexp" else ();
    4.21 +"----------- fun is_polyexp --------------------------------------------------------------------";
    4.22 +"----------- fun is_polyexp --------------------------------------------------------------------";
    4.23 +"----------- fun is_polyexp --------------------------------------------------------------------";
    4.24 +val thy = @{theory Partial_Fractions};
    4.25 +val ctxt = Proof_Context.init_global thy;
    4.26 +
    4.27 +val t = (the o (parseNEW  ctxt)) "x / x";
    4.28 +if is_polyexp t then error "NOT is_polyexp (x / x)" else ();
    4.29 +
    4.30 +val t = (the o (parseNEW  ctxt)) "-1 * A * 3";
    4.31 +if is_polyexp t then () else error "is_polyexp (-1 * A * 3)";
    4.32 +
    4.33 +val t = (the o (parseNEW  ctxt)) "-1 * AA * 3";
    4.34 +if is_polyexp t then () else error "is_polyexp (-1 * AA * 3)";
    4.35  
    4.36  "----------- fun has_degree_in -----------------------------------------------------------------";
    4.37  "----------- fun has_degree_in -----------------------------------------------------------------";
    4.38 @@ -643,9 +652,11 @@
    4.39  "-------- norm_Poly NOT COMPLETE ------------------------";
    4.40  "-------- norm_Poly NOT COMPLETE ------------------------";
    4.41  "-------- norm_Poly NOT COMPLETE ------------------------";
    4.42 -val SOME (f',_) = rewrite_set_ thy false norm_Poly 
    4.43 +val thy = @{theory Simplify};
    4.44 +
    4.45 +val SOME (f',_) = rewrite_set_ thy false norm_Poly
    4.46  (str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben");
    4.47 -if term2str f' = "L = 2 * 2 * k + 2 * -4 * q + senkrecht + oben"
    4.48 +if term2str f' = "L = 2 * 2 * (k + -2 * q) + senkrecht + oben"
    4.49  then ((*norm_Poly NOT COMPLETE -- TODO MG*))
    4.50  else error "norm_Poly changed behavior";
    4.51  
     5.1 --- a/test/Tools/isac/ProgLang/rewrite.sml	Wed Mar 20 15:34:43 2019 +0100
     5.2 +++ b/test/Tools/isac/ProgLang/rewrite.sml	Thu Mar 21 17:51:18 2019 +0100
     5.3 @@ -308,7 +308,7 @@
     5.4  val subs = [(@{term "bdv"}, @{term  "x"})];
     5.5  val rls = norm_Rational_noadd_fractions;
     5.6  val SOME (t', asms) = rewrite_set_inst_ thy true subs rls t;
     5.7 -if term2str t' = "1 / EI * (L * q_0 * x / 2 + -1 * 1 * q_0 * x ^^^ 2 / 2)" andalso
     5.8 +if term2str t' = "1 / EI * (L * q_0 * x / 2 + -1 * q_0 * 1 * x ^^^ 2 / 2)" andalso
     5.9    terms2str asms = "[]" then {}
    5.10  else error "this was NONE with Isabelle2013-2 ?!?"
    5.11  "----- rewrite_ rat_mult_poly_r--------------------------";
     6.1 --- a/test/Tools/isac/Test_Isac.thy	Wed Mar 20 15:34:43 2019 +0100
     6.2 +++ b/test/Tools/isac/Test_Isac.thy	Thu Mar 21 17:51:18 2019 +0100
     6.3 @@ -215,7 +215,7 @@
     6.4    ML_file "Knowledge/rateq.sml"   (*some complicated equations not recovered from 2002 *)
     6.5    ML_file "Knowledge/rootrat.sml"
     6.6    ML_file "Knowledge/rootrateq.sml"(*ome complicated equations not recovered from 2002 *)
     6.7 -  ML_file "Knowledge/partial_fractions.sml"
     6.8 +(*ML_file "Knowledge/partial_fractions.sml"      does NOT terminate ==========================*)
     6.9    ML_file "Knowledge/polyeq.sml"
    6.10  (*ML_file "Knowledge/rlang.sml"     much to clean up, similar tests in other files     *)
    6.11    ML_file "Knowledge/calculus.sml"
     7.1 --- a/test/Tools/isac/library.sml	Wed Mar 20 15:34:43 2019 +0100
     7.2 +++ b/test/Tools/isac/library.sml	Thu Mar 21 17:51:18 2019 +0100
     7.3 @@ -38,7 +38,7 @@
     7.4  *)
     7.5  
     7.6  (* > takelast (2, ["normalise","polynomial","univariate","equation"]);
     7.7 -val it = ["univariate", "equation"] : pblID
     7.8 +val it = ["univariate","equation"] : pblID
     7.9  > takelast (2, ["equation"]);
    7.10  val it = ["equation"] : pblID
    7.11  > takelast (3, ["normalise","polynomial","univariate","equation"]);