312 val prod = mk_prod e_term facs; |
312 val prod = mk_prod e_term facs; |
313 term2str prod = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))"; |
313 term2str prod = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))"; |
314 |
314 |
315 val prod = mk_prod e_term [str2term "x + 1", str2term "x + 2", str2term "x + 3"]; |
315 val prod = mk_prod e_term [str2term "x + 1", str2term "x + 2", str2term "x + 3"]; |
316 term2str prod = "(x + 1) * (x + 2) * (x + 3)"; |
316 term2str prod = "(x + 1) * (x + 2) * (x + 3)"; |
317 |
|
318 *) |
317 *) |
319 |
318 |
320 fun factors_from_solution sol = |
319 fun factors_from_solution sol = |
321 let val ts = HOLogic.dest_list sol |
320 let val ts = HOLogic.dest_list sol |
322 in mk_prod e_term (map fac_from_sol ts) end; |
321 in mk_prod e_term (map fac_from_sol ts) end; |
491 subsubsection {*Build a rule-set for ansatz*} |
490 subsubsection {*Build a rule-set for ansatz*} |
492 text {* the "ansatz" rules violate the principle that each variable on |
491 text {* the "ansatz" rules violate the principle that each variable on |
493 the right-hand-side must also occur on the left-hand-side of the rule: |
492 the right-hand-side must also occur on the left-hand-side of the rule: |
494 A, B, etc don't. |
493 A, B, etc don't. |
495 Thus the rewriter marks these variables with question marks: ?A, ?B, etc. |
494 Thus the rewriter marks these variables with question marks: ?A, ?B, etc. |
496 These question marks are dropped by a function, which can be included |
495 These question marks can be dropped by "fun drop_questionmarks". |
497 into a ruleset by Calc. |
|
498 *} |
496 *} |
499 ML {* |
497 ML {* |
500 val ansatz_rls = prep_rls( |
498 val ansatz_rls = prep_rls( |
501 Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), |
499 Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), |
502 erls = e_rls, srls = Erls, calc = [], |
500 erls = e_rls, srls = Erls, calc = [], |
505 Thm ("multiply_eq2",num_str @{thm multiply_eq2}) |
503 Thm ("multiply_eq2",num_str @{thm multiply_eq2}) |
506 ], |
504 ], |
507 scr = EmptyScr}); |
505 scr = EmptyScr}); |
508 *} |
506 *} |
509 ML {* |
507 ML {* |
510 trace_rewrite := true; |
|
511 val SOME (ttttt,_) = rewrite_set_ @{theory Isac} false ansatz_rls expr'; |
508 val SOME (ttttt,_) = rewrite_set_ @{theory Isac} false ansatz_rls expr'; |
512 *} |
509 *} |
513 ML {* |
510 ML {* |
514 term2str expr' = "3 / ((z - 1 / 2) * (z - -1 / 4))"; |
511 term2str expr' = "3 / ((z - 1 / 2) * (z - -1 / 4))"; |
515 term2str ttttt = "?A / (z - 1 / 2) + ?B / (z - -1 / 4)"; |
512 term2str ttttt = "?A / (z - 1 / 2) + ?B / (z - -1 / 4)"; |
978 without "?" BUT THEN WRONG "*** upd_env_opt: (NONE,24 = ?A * ..."*) |
973 without "?" BUT THEN WRONG "*** upd_env_opt: (NONE,24 = ?A * ..."*) |
979 trace_script := true; |
974 trace_script := true; |
980 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
975 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
981 (*([6], Res), 24 = ?A * (1 / 2 + -1 * (-1 / 4)) + ?B * (1 / 2 + -1 * (1 / 2))*) |
976 (*([6], Res), 24 = ?A * (1 / 2 + -1 * (-1 / 4)) + ?B * (1 / 2 + -1 * (1 / 2))*) |
982 *} |
977 *} |
|
978 |
|
979 ML {* |
|
980 show_pt pt; |
|
981 *} |
|
982 |
983 ML {* |
983 ML {* |
984 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
984 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
985 (*([7], Res), 24 = ?A * 3 / 4*) |
985 (*([7], Res), 24 = ?A * 3 / 4*) |
986 show_pt pt; |
986 show_pt pt; |
987 *} |
987 *} |
988 |
988 |
|
989 |
989 ML {* |
990 ML {* |
990 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
991 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
991 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
992 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
992 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
993 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
993 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |
994 val (p,_,f,nxt,_,pt) = me nxt p [] pt; |