1.1 --- a/src/Tools/isac/BaseDefinitions/environment.sml Sat Feb 04 16:49:08 2023 +0100
1.2 +++ b/src/Tools/isac/BaseDefinitions/environment.sml Sat Feb 04 17:00:25 2023 +0100
1.3 @@ -31,7 +31,7 @@
1.4 (strs2str o
1.5 (map (
1.6 linefeed o pair2str o
1.7 - (apsnd (UnparseC.term_in_ctxt ctxt)) o (apfst (UnparseC.term_in_ctxt ctxt))))) s
1.8 + (apsnd (UnparseC.term ctxt)) o (apfst (UnparseC.term ctxt))))) s
1.9 end;
1.10 fun subst2str' s =
1.11 let
1.12 @@ -39,7 +39,7 @@
1.13 in
1.14 (strs2str' o
1.15 (map (
1.16 - pair2str o (apsnd (UnparseC.term_in_ctxt ctxt)) o (apfst (UnparseC.term_in_ctxt ctxt))))) s
1.17 + pair2str o (apsnd (UnparseC.term ctxt)) o (apfst (UnparseC.term ctxt))))) s
1.18 end;
1.19 val env2str = subst2str
1.20 val env2str' = subst2str'
1.21 @@ -56,7 +56,7 @@
1.22 thus "NONE" must be set at the end of currying (ill designed anyway)*)
1.23 fun update_opt env (SOME id, vl) = update env (id, vl)
1.24 | update_opt env (NONE, _) =
1.25 - ((** )tracing ("*** update_opt: (NONE," ^ UnparseC.term_in_ctxt @{context} vl ^ ")");( **) env);
1.26 + ((** )tracing ("*** update_opt: (NONE," ^ UnparseC.term @{context} vl ^ ")");( **) env);
1.27 fun update_opt' (env, (id, vl)) = update_opt env (id, vl)
1.28 fun update_opt'' ((vl, env), id) = update_opt env (id, vl)
1.29
2.1 --- a/src/Tools/isac/BaseDefinitions/error-pattern-def.sml Sat Feb 04 16:49:08 2023 +0100
2.2 +++ b/src/Tools/isac/BaseDefinitions/error-pattern-def.sml Sat Feb 04 17:00:25 2023 +0100
2.3 @@ -29,7 +29,7 @@
2.4 * thm list (* thms related to error patterns; note that respective lhs
2.5 do not match (which reflects student's error). *)
2.6 fun errpat2str ctxt (id, tms, thms) =
2.7 - "(\"" ^ id ^ "\",\n" ^ UnparseC.terms_in_ctxt ctxt tms ^ ",\n" ^ ThmC_Def.string_of_thms ctxt thms
2.8 + "(\"" ^ id ^ "\",\n" ^ UnparseC.terms ctxt tms ^ ",\n" ^ ThmC_Def.string_of_thms ctxt thms
2.9 fun s_to_string ctxt errpats = (strs2str' o (map (errpat2str ctxt))) errpats
2.10
2.11 fun adapt_to_type ctxt (id, terms, thms) =
3.1 --- a/src/Tools/isac/BaseDefinitions/model-pattern.sml Sat Feb 04 16:49:08 2023 +0100
3.2 +++ b/src/Tools/isac/BaseDefinitions/model-pattern.sml Sat Feb 04 17:00:25 2023 +0100
3.3 @@ -61,7 +61,7 @@
3.4 let
3.5 val (m_field, (hd, arg)) = case strip_comb dsc_tm of
3.6 (hd, [arg]) => (m_field, (hd, arg))
3.7 - | _ => error ("Wrong descriptor " ^ quote (UnparseC.term_in_ctxt ctxt dsc_tm) ^ Position.here pos)
3.8 + | _ => error ("Wrong descriptor " ^ quote (UnparseC.term ctxt dsc_tm) ^ Position.here pos)
3.9 in (m_field, (hd, arg), pos) end
3.10
3.11
3.12 @@ -85,7 +85,7 @@
3.13 in (model, where_) end
3.14
3.15 fun pat2str ctxt (field, (dsc, id)) =
3.16 - pair2str (field, pair2str (UnparseC.term_in_ctxt ctxt dsc, UnparseC.term_in_ctxt ctxt id));
3.17 + pair2str (field, pair2str (UnparseC.term ctxt dsc, UnparseC.term ctxt id));
3.18 fun to_string ctxt pats = (strs2str o (map (pat2str ctxt))) pats;
3.19
3.20 \<^isac_test>\<open>
4.1 --- a/src/Tools/isac/BaseDefinitions/problem-def.sml Sat Feb 04 16:49:08 2023 +0100
4.2 +++ b/src/Tools/isac/BaseDefinitions/problem-def.sml Sat Feb 04 17:00:25 2023 +0100
4.3 @@ -54,7 +54,7 @@
4.4 ^ (strs2str init') ^ ", mathauthors = " ^ (strs2str ma' |> quote) ^ ", solve_mets = "
4.5 ^ (strslist2strs met') ^ ", model = " ^ Model_Pattern.to_string ctxt model' ^ ", where_rls = "
4.6 ^ (Rule_Set.id prls' |> quote) ^ ", thy = {" ^ Context.theory_name thy' ^ "}, where_ = "
4.7 - ^ (UnparseC.terms_in_ctxt ctxt w') ^ "}" |> linefeed;
4.8 + ^ (UnparseC.terms ctxt w') ^ "}" |> linefeed;
4.9 fun s_to_string ctxt pbts = map (pbt2str ctxt) pbts |> list2str;
4.10
4.11 val empty_store = Store.Node ("empty_probl_id", [empty], [])
5.1 --- a/src/Tools/isac/BaseDefinitions/rule-def.sml Sat Feb 04 16:49:08 2023 +0100
5.2 +++ b/src/Tools/isac/BaseDefinitions/rule-def.sml Sat Feb 04 17:00:25 2023 +0100
5.3 @@ -131,7 +131,7 @@
5.4 rew_ord: rew_ord_T, asm_rls: rule_set, calc: eval_ml_from_prog list, errpatts: errpatID list, program: program}
5.5
5.6 fun program_to_string _ Empty_Prog = "Empty_Prog"
5.7 - | program_to_string ctxt (Prog s) = "Prog " ^ UnparseC.term_in_ctxt ctxt s
5.8 + | program_to_string ctxt (Prog s) = "Prog " ^ UnparseC.term ctxt s
5.9 | program_to_string _ (Rfuns _) = "Rfuns";
5.10
5.11 (**)end(**)
6.1 --- a/src/Tools/isac/BaseDefinitions/rule-set.sml Sat Feb 04 16:49:08 2023 +0100
6.2 +++ b/src/Tools/isac/BaseDefinitions/rule-set.sml Sat Feb 04 17:00:25 2023 +0100
6.3 @@ -65,12 +65,12 @@
6.4 | rep (Rule_Def.Rrls _) = rep empty
6.5 fun to_string_test _ Rule_Def.Empty = "Rule_Set.Empty"
6.6 | to_string_test ctxt (Rule_Def.Repeat {id, preconds, rew_ord, asm_rls = _, prog_rls = _, calc = _, errpatts = _, rules, program}) =
6.7 - "(Rule_Def.Repeat {id = " ^ id ^ ", preconds = " ^ UnparseC.terms_in_ctxt ctxt preconds ^ ", rew_ord = " ^ Rewrite_Ord.to_string rew_ord
6.8 + "(Rule_Def.Repeat {id = " ^ id ^ ", preconds = " ^ UnparseC.terms ctxt preconds ^ ", rew_ord = " ^ Rewrite_Ord.to_string rew_ord
6.9 ^ ",\n asm_rls = _, prog_rls = _, calc = _, errpatts = _, "
6.10 ^ ",\n rules = " ^ Rule.s_to_string rules
6.11 ^ ",\n rules = " ^ Rule_Def.program_to_string ctxt program ^ "})"
6.12 | to_string_test ctxt (Rule_Def.Sequence {id, preconds, rew_ord, asm_rls = _, prog_rls = _, calc = _, errpatts = _, rules, program}) =
6.13 - "(Rule_Def.Repeat {id = " ^ id ^ ", preconds = " ^ UnparseC.terms_in_ctxt ctxt preconds ^ ", rew_ord = " ^ Rewrite_Ord.to_string rew_ord
6.14 + "(Rule_Def.Repeat {id = " ^ id ^ ", preconds = " ^ UnparseC.terms ctxt preconds ^ ", rew_ord = " ^ Rewrite_Ord.to_string rew_ord
6.15 ^ ",\n asm_rls = _, prog_rls = _, calc = _, errpatts = _, "
6.16 ^ ",\n rules = " ^ Rule.s_to_string rules
6.17 ^ ",\n rules = " ^ Rule_Def.program_to_string ctxt program ^ "})"
7.1 --- a/src/Tools/isac/BaseDefinitions/substitution.sml Sat Feb 04 16:49:08 2023 +0100
7.2 +++ b/src/Tools/isac/BaseDefinitions/substitution.sml Sat Feb 04 17:00:25 2023 +0100
7.3 @@ -46,8 +46,8 @@
7.4 fun to_string ctxt s =
7.5 (strs2str o
7.6 (map (
7.7 - linefeed o pair2str o (apsnd (UnparseC.term_in_ctxt ctxt)) o
7.8 - (apfst (UnparseC.term_in_ctxt ctxt))))) s;
7.9 + linefeed o pair2str o (apsnd (UnparseC.term ctxt)) o
7.10 + (apfst (UnparseC.term ctxt))))) s;
7.11
7.12 type input = TermC.as_string list;
7.13 val input_empty = [];
7.14 @@ -62,22 +62,22 @@
7.15 type as_eqs = term list;
7.16 type program = term;
7.17
7.18 -fun T_to_string_eqs ctxt subst = map (UnparseC.term_in_ctxt ctxt) (map HOLogic.mk_eq subst)
7.19 +fun T_to_string_eqs ctxt subst = map (UnparseC.term ctxt) (map HOLogic.mk_eq subst)
7.20 fun T_to_input ctxt subst_rew = (subst_rew
7.21 - |> map (apsnd (UnparseC.term_in_ctxt ctxt))
7.22 - |> map (apfst (UnparseC.term_in_ctxt ctxt))
7.23 + |> map (apsnd (UnparseC.term ctxt))
7.24 + |> map (apfst (UnparseC.term ctxt))
7.25 |> map (apfst (enclose "''" "''")))
7.26 |> map pair2str
7.27 handle TERM _ => raise TERM ("T_to_input: wrong argument " ^ to_string ctxt subst_rew, [])
7.28
7.29 fun T_from_string_eqs ctxt s = map
7.30 (TermC.dest_equals o the o (ParseC.patt_opt (Proof_Context.theory_of ctxt))) s;
7.31 -fun eqs_to_input ctxt eqs = map (UnparseC.term_in_ctxt ctxt) eqs;
7.32 +fun eqs_to_input ctxt eqs = map (UnparseC.term ctxt) eqs;
7.33
7.34 fun program_to_input ctxt sub = (sub
7.35 |> HOLogic.dest_list
7.36 |> map HOLogic.dest_prod
7.37 - |> map (fn (e1, e2) => (HOLogic.dest_string e1, UnparseC.term_in_ctxt ctxt e2))
7.38 + |> map (fn (e1, e2) => (HOLogic.dest_string e1, UnparseC.term ctxt e2))
7.39 |> map (fn (e1, e2) => "(''" ^ e1 ^ "'', " ^ e2 ^ ")"): TermC.as_string list)
7.40 handle TERM _ => raise TERM ("program_to_input: wrong argument ", [sub])
7.41
8.1 --- a/src/Tools/isac/BaseDefinitions/termC.sml Sat Feb 04 16:49:08 2023 +0100
8.2 +++ b/src/Tools/isac/BaseDefinitions/termC.sml Sat Feb 04 17:00:25 2023 +0100
8.3 @@ -130,7 +130,7 @@
8.4 let
8.5 val ctxt = "Isac_Knowledge" |> Know_Store.get_via_last_thy |> Proof_Context.init_global
8.6 in
8.7 - UnparseC.term_in_ctxt ctxt t
8.8 + UnparseC.term ctxt t
8.9 end
8.10
8.11 datatype lrd = L (*t1 in "t1$t2"*)
8.12 @@ -158,13 +158,13 @@
8.13 (** transform typ / term to a String to be parsed by Scala after transport via libisabelle **)
8.14 fun string_of_detail ctxt t =
8.15 let
8.16 - fun ato (Const (a, T)) n = "\n*** " ^ indent n ^ "Const (" ^ a ^ ", " ^ UnparseC.typ_in_ctxt ctxt T ^ ")"
8.17 - | ato (Free (a, T)) n = "\n*** " ^ indent n ^ "Free (" ^ a ^ ", " ^ UnparseC.typ_in_ctxt ctxt T ^ ")"
8.18 + fun ato (Const (a, T)) n = "\n*** " ^ indent n ^ "Const (" ^ a ^ ", " ^ UnparseC.typ ctxt T ^ ")"
8.19 + | ato (Free (a, T)) n = "\n*** " ^ indent n ^ "Free (" ^ a ^ ", " ^ UnparseC.typ ctxt T ^ ")"
8.20 | ato (Var ((a, i), T)) n =
8.21 - "\n*** " ^ indent n ^ "Var ((" ^ a ^ ", " ^ string_of_int i ^ "), " ^ UnparseC.typ_in_ctxt ctxt T ^ ")"
8.22 + "\n*** " ^ indent n ^ "Var ((" ^ a ^ ", " ^ string_of_int i ^ "), " ^ UnparseC.typ ctxt T ^ ")"
8.23 | ato (Bound i) n = "\n*** " ^ indent n ^ "Bound " ^ string_of_int i
8.24 | ato (Abs(a, T, body)) n =
8.25 - "\n*** " ^ indent n ^ "Abs (" ^ a ^ ", " ^ UnparseC.typ_in_ctxt ctxt T ^ ",.." ^ ato body (n + 1)
8.26 + "\n*** " ^ indent n ^ "Abs (" ^ a ^ ", " ^ UnparseC.typ ctxt T ^ ",.." ^ ato body (n + 1)
8.27 | ato (f $ t) n = ato f n ^ ato t (n + 1)
8.28 in "\n*** " ^ ato t 0 ^ "\n***" end;
8.29
9.1 --- a/src/Tools/isac/BaseDefinitions/unparseC.sml Sat Feb 04 16:49:08 2023 +0100
9.2 +++ b/src/Tools/isac/BaseDefinitions/unparseC.sml Sat Feb 04 17:00:25 2023 +0100
9.3 @@ -10,16 +10,14 @@
9.4 val term_empty: term
9.5 val typ_empty: typ
9.6
9.7 - val term_in_ctxt: Proof.context -> term -> term_as_string
9.8 - val term: term -> term_as_string (*remains until final replace "_in_ctxt" \<longrightarrow> "" *)
9.9 + val term: Proof.context -> term -> term_as_string
9.10 (*val term_ERROR \<longrightarrow> TermC.unparse_ERROR: term -> term_as_string, due to file dependencies*)
9.11 -
9.12 val term_in_thy: theory -> term -> term_as_string
9.13 val term_opt: Proof.context -> term option -> term_as_string
9.14
9.15 - val terms_in_ctxt: Proof.context -> term list -> term_as_string
9.16 + val terms: Proof.context -> term list -> term_as_string
9.17 val terms_in_thy: theory -> term list -> term_as_string
9.18 - val typ_in_ctxt: Proof.context -> typ -> term_as_string
9.19 + val typ: Proof.context -> typ -> term_as_string
9.20
9.21 \<^isac_test>\<open>
9.22 val term_by_thyID: ThyC.id -> term -> term_as_string
9.23 @@ -34,21 +32,20 @@
9.24
9.25 type term_as_string = string;
9.26
9.27 -fun term_in_ctxt ctxt t =
9.28 +fun term ctxt t =
9.29 let
9.30 val ctxt' = Config.put show_markup false ctxt;
9.31 in
9.32 Print_Mode.setmp [] (Syntax.string_of_term ctxt') t
9.33 end;
9.34 -fun terms_in_ctxt ctxt ts = ts |> map (term_in_ctxt ctxt) |> strs2str';
9.35 +fun terms ctxt ts = ts |> map (term ctxt) |> strs2str';
9.36
9.37 -fun term t = term_in_ctxt (ThyC.id_to_ctxt "Isac_Knowledge") t;
9.38 -fun term_in_thy thy t = term_in_ctxt (Proof_Context.init_global thy) t;
9.39 +fun term_in_thy thy t = term (Proof_Context.init_global thy) t;
9.40 fun terms_in_thy thy ts = ts |> map (term_in_thy thy) |> strs2str';
9.41
9.42 -fun typ_in_ctxt ctxt typ = Print_Mode.setmp [] (Syntax.string_of_typ ctxt) typ
9.43 +fun typ ctxt typ = Print_Mode.setmp [] (Syntax.string_of_typ ctxt) typ
9.44
9.45 -fun term_opt ctxt (SOME t) = "(SOME " ^ term_in_ctxt ctxt t ^ ")"
9.46 +fun term_opt ctxt (SOME t) = "(SOME " ^ term ctxt t ^ ")"
9.47 | term_opt _ NONE = "NONE";
9.48
9.49 val typ_empty = Type ("empty", []);
9.50 @@ -63,7 +60,7 @@
9.51 Print_Mode.setmp [] (Syntax.string_of_term ctxt') t
9.52 end;
9.53 (*for eq_set, in particular for (re-ordered) assumptions*)
9.54 -fun asms_test ctxt ts = map (term_in_ctxt ctxt) ts;
9.55 +fun asms_test ctxt ts = map (term ctxt) ts;
9.56 \<close>
9.57
9.58 (**)end(**)
10.1 --- a/src/Tools/isac/Interpret/derive.sml Sat Feb 04 16:49:08 2023 +0100
10.2 +++ b/src/Tools/isac/Interpret/derive.sml Sat Feb 04 17:00:25 2023 +0100
10.3 @@ -40,8 +40,8 @@
10.4 type derivation = step list;
10.5
10.6 fun trta2str ctxt (t, r, (t', a)) =
10.7 - "\n(" ^ UnparseC.term_in_ctxt ctxt t ^ ", " ^ Rule.to_string_short r ^
10.8 - ", (" ^ UnparseC.term_in_ctxt ctxt t' ^ ", " ^ UnparseC.terms_in_ctxt ctxt a ^ "))"
10.9 + "\n(" ^ UnparseC.term ctxt t ^ ", " ^ Rule.to_string_short r ^
10.10 + ", (" ^ UnparseC.term ctxt t' ^ ", " ^ UnparseC.terms ctxt a ^ "))"
10.11 fun trtas2str ctxt trtas = (strs2str o (map (trta2str ctxt))) trtas
10.12 val deriv2str = trtas2str
10.13
10.14 @@ -54,11 +54,11 @@
10.15 fun msg_2 ctxt thmid =
10.16 if not (Config.get ctxt rewrite_trace) then () else tracing ("### trying thm \"" ^ thmid ^ "\"");
10.17 fun msg_3 ctxt t' =
10.18 - if Config.get ctxt rewrite_trace then tracing ("=== rewrites to: " ^ UnparseC.term_in_ctxt ctxt t') else ();
10.19 + if Config.get ctxt rewrite_trace then tracing ("=== rewrites to: " ^ UnparseC.term ctxt t') else ();
10.20 fun msg_4 ctxt op_ =
10.21 if not (Config.get ctxt rewrite_trace) then () else tracing ("### trying calc. \"" ^ op_^"\"");
10.22 fun msg_5 ctxt t' =
10.23 - if not (Config.get ctxt rewrite_trace) then () else tracing("=== calc. to: " ^ UnparseC.term_in_ctxt ctxt t')
10.24 + if not (Config.get ctxt rewrite_trace) then () else tracing("=== calc. to: " ^ UnparseC.term ctxt t')
10.25
10.26
10.27 fun do_one ctxt asm_rls rs ro goal tt =
10.28 @@ -66,7 +66,7 @@
10.29 datatype switch = Appl | Noap (* TODO: unify with version in Rewrite *)
10.30 fun rew_once _ rts t Noap [] =
10.31 (case goal of NONE => rts | SOME _ =>
10.32 - raise ERROR ("Derive.do_one: no derivation for " ^ UnparseC.term_in_ctxt ctxt t))
10.33 + raise ERROR ("Derive.do_one: no derivation for " ^ UnparseC.term ctxt t))
10.34 | rew_once lim rts t Appl [] = rew_once lim rts t Noap rs
10.35 | rew_once lim rts t apno rs' =
10.36 (case goal of
11.1 --- a/src/Tools/isac/Interpret/li-tool.sml Sat Feb 04 16:49:08 2023 +0100
11.2 +++ b/src/Tools/isac/Interpret/li-tool.sml Sat Feb 04 17:00:25 2023 +0100
11.3 @@ -51,7 +51,7 @@
11.4 (* *)
11.5 val error_msg_1 = "ERROR: the guard is missing (#model in 'type met' added in prep_met)."
11.6 fun error_msg_2 ctxt d itms =
11.7 - ("arguments_from_model: '" ^ UnparseC.term_in_ctxt ctxt d ^ "' not in itms:\n" ^
11.8 + ("arguments_from_model: '" ^ UnparseC.term ctxt d ^ "' not in itms:\n" ^
11.9 "itms:\n" ^ I_Model.to_string @{context} itms)
11.10 (* turn Model-items into arguments for a program *)
11.11 fun arguments_from_model ctxt mI itms =
11.12 @@ -97,17 +97,17 @@
11.13 | (Const (\<^const_name>\<open>Prog_Tac.Calculate\<close>, _) $ op_ $ _) =>
11.14 (Tactic.Calculate (HOLogic.dest_string op_))
11.15 | (Const (\<^const_name>\<open>Prog_Tac.Take\<close>, _) $ t) =>
11.16 - (Tactic.Take (UnparseC.term_in_ctxt ctxt t))
11.17 + (Tactic.Take (UnparseC.term ctxt t))
11.18 | (Const (\<^const_name>\<open>Prog_Tac.Substitute\<close>, _) $ isasub $ _) =>
11.19 Tactic.Substitute (Prog_Tac.Substitute_adapt_to_type thy isasub)
11.20 | (Const (\<^const_name>\<open>Prog_Tac.Check_elementwise\<close>, _) $ _ $
11.21 (Const (\<^const_name>\<open>Collect\<close>, _) $ Abs (_, _, pred))) =>
11.22 - (Tactic.Check_elementwise (UnparseC.term_in_ctxt ctxt pred))
11.23 + (Tactic.Check_elementwise (UnparseC.term ctxt pred))
11.24 | (Const (\<^const_name>\<open>Prog_Tac.Or_to_List\<close>, _) $ _ ) => Tactic.Or_to_List
11.25 | (ptac as Const (\<^const_name>\<open>Prog_Tac.SubProblem\<close>, _) $ _ $ _) =>
11.26 fst (Sub_Problem.tac_from_prog (pt, pos) ptac) (*might involve problem refinement etc*)
11.27 | t =>
11.28 - raise ERROR ("stac2tac_ TODO: no match for " ^ UnparseC.term_in_ctxt ctxt t)
11.29 + raise ERROR ("stac2tac_ TODO: no match for " ^ UnparseC.term ctxt t)
11.30 end
11.31
11.32 datatype ass =
11.33 @@ -262,27 +262,27 @@
11.34 fun msg_miss ctxt sc metID caller f formals actuals =
11.35 "ERROR in creating the environment from formal args. of partial_function \"" ^ fst (Program.get_fun_id sc) ^ "\"\n" ^
11.36 "and the actual args., ie. items of the guard of \"" ^ MethodC.id_to_string metID ^ "\" by \"" ^ caller ^ "\":\n" ^
11.37 - "formal arg \"" ^ UnparseC.term_in_ctxt ctxt f ^ "\" doesn't match any actual arg.\n" ^
11.38 + "formal arg \"" ^ UnparseC.term ctxt f ^ "\" doesn't match any actual arg.\n" ^
11.39 "with:\n" ^
11.40 - (string_of_int o length) formals ^ " formal args: " ^ UnparseC.terms_in_ctxt ctxt formals ^ "\n" ^
11.41 - (string_of_int o length) actuals ^ " actual args: " ^ UnparseC.terms_in_ctxt ctxt actuals
11.42 + (string_of_int o length) formals ^ " formal args: " ^ UnparseC.terms ctxt formals ^ "\n" ^
11.43 + (string_of_int o length) actuals ^ " actual args: " ^ UnparseC.terms ctxt actuals
11.44 fun msg_miss_type ctxt sc metID f formals actuals =
11.45 "ERROR in creating the environment from formal args. of partial_function \"" ^ fst (Program.get_fun_id sc) ^ "\"\n" ^
11.46 "and the actual args., ie. items of the guard of \"" ^ MethodC.id_to_string metID ^ "\" by \"assoc_by_type\":\n" ^
11.47 - "formal arg \"" ^ UnparseC.term_in_ctxt ctxt f ^ "\" of type \"" ^ UnparseC.typ_in_ctxt ctxt (type_of f) ^
11.48 + "formal arg \"" ^ UnparseC.term ctxt f ^ "\" of type \"" ^ UnparseC.typ ctxt (type_of f) ^
11.49 "\" doesn't mach any actual arg.\nwith:\n" ^
11.50 - (string_of_int o length) formals ^ " formal args: " ^ UnparseC.terms_in_ctxt ctxt formals ^ "\n" ^
11.51 - (string_of_int o length) actuals ^ " actual args: " ^ UnparseC.terms_in_ctxt ctxt actuals ^ "\n" ^
11.52 - " with types: " ^ (strs2str o (map ((UnparseC.typ_in_ctxt ctxt) o type_of))) actuals
11.53 + (string_of_int o length) formals ^ " formal args: " ^ UnparseC.terms ctxt formals ^ "\n" ^
11.54 + (string_of_int o length) actuals ^ " actual args: " ^ UnparseC.terms ctxt actuals ^ "\n" ^
11.55 + " with types: " ^ (strs2str o (map ((UnparseC.typ ctxt) o type_of))) actuals
11.56 fun msg_ambiguous ctxt sc metID f aas formals actuals =
11.57 "AMBIGUITY in creating the environment from formal args. of partial_function \"" ^ fst (Program.get_fun_id sc) ^ "\"\n" ^
11.58 "and the actual args., ie. items of the guard of \"" ^ MethodC.id_to_string metID ^ "\" by \"assoc_by_type\":\n" ^
11.59 - "formal arg. \"" ^ UnparseC.term_in_ctxt ctxt f ^ "\" type-matches with several..." ^
11.60 - "actual args. \"" ^ UnparseC.terms_in_ctxt ctxt aas ^ "\"\n" ^
11.61 - "selected \"" ^ UnparseC.term_in_ctxt ctxt (hd aas) ^ "\"\n" ^
11.62 + "formal arg. \"" ^ UnparseC.term ctxt f ^ "\" type-matches with several..." ^
11.63 + "actual args. \"" ^ UnparseC.terms ctxt aas ^ "\"\n" ^
11.64 + "selected \"" ^ UnparseC.term ctxt (hd aas) ^ "\"\n" ^
11.65 "with\n" ^
11.66 - "formals: " ^ UnparseC.terms_in_ctxt ctxt formals ^ "\n" ^
11.67 - "actuals: " ^ UnparseC.terms_in_ctxt ctxt actuals
11.68 + "formals: " ^ UnparseC.terms ctxt formals ^ "\n" ^
11.69 + "actuals: " ^ UnparseC.terms ctxt actuals
11.70 fun trace_init ctxt metID =
11.71 if Config.get ctxt LI_trace
11.72 then tracing("@@@ program \"" ^ strs2str metID ^ "\"")
11.73 @@ -352,13 +352,13 @@
11.74
11.75 fun trace_msg_1 ctxt call t stac =
11.76 if Config.get ctxt LI_trace then
11.77 - tracing ("@@@ " ^ call ^ " leaf \"" ^ UnparseC.term_in_ctxt ctxt t ^ "\" \<longrightarrow> Tac \"" ^
11.78 - UnparseC.term_in_ctxt ctxt stac ^ "\"")
11.79 + tracing ("@@@ " ^ call ^ " leaf \"" ^ UnparseC.term ctxt t ^ "\" \<longrightarrow> Tac \"" ^
11.80 + UnparseC.term ctxt stac ^ "\"")
11.81 else ();
11.82 fun trace_msg_2 ctxt call t lexpr' =
11.83 if Config.get ctxt LI_trace then
11.84 - tracing("@@@ " ^ call ^ " leaf '" ^ UnparseC.term_in_ctxt ctxt t ^ "' \<longrightarrow> Expr \"" ^
11.85 - UnparseC.term_in_ctxt ctxt lexpr' ^ "\"")
11.86 + tracing("@@@ " ^ call ^ " leaf '" ^ UnparseC.term ctxt t ^ "' \<longrightarrow> Expr \"" ^
11.87 + UnparseC.term ctxt lexpr' ^ "\"")
11.88 else ();
11.89 (*
11.90 check a leaf at the end of recursive descent; a leaf is either a Prog_Tac or a Prog_Expr.
12.1 --- a/src/Tools/isac/Interpret/lucas-interpreter.sml Sat Feb 04 16:49:08 2023 +0100
12.2 +++ b/src/Tools/isac/Interpret/lucas-interpreter.sml Sat Feb 04 17:00:25 2023 +0100
12.3 @@ -74,11 +74,11 @@
12.4 fun check_Let_up ctxt ({path, ...}: pstate) prog =
12.5 case TermC.sub_at (drop_last path) prog of
12.6 Const (\<^const_name>\<open>Let\<close>,_) $ _ $ (Abs (i, T, body)) => (TermC.mk_Free (i, T), body)
12.7 - | t => raise ERROR ("scan_up1..\"HOL.Let $ _\" with: \"" ^ UnparseC.term_in_ctxt ctxt t ^ "\"")
12.8 + | t => raise ERROR ("scan_up1..\"HOL.Let $ _\" with: \"" ^ UnparseC.term ctxt t ^ "\"")
12.9 fun check_Seq_up ctxt ({path, ...}: pstate) prog =
12.10 case TermC.sub_at (drop_last path) prog of
12.11 Const (\<^const_name>\<open>Tactical.Chain\<close>,_) $ _ $ e2=> e2
12.12 - | t => raise ERROR ("scan_up1..\"Tactical.Chain $ _\" with: \"" ^ UnparseC.term_in_ctxt ctxt t ^ "\"")
12.13 + | t => raise ERROR ("scan_up1..\"Tactical.Chain $ _\" with: \"" ^ UnparseC.term ctxt t ^ "\"")
12.14
12.15
12.16 (*** determine a next tactic within a program ***)
12.17 @@ -257,7 +257,7 @@
12.18 | scan_up pcc ist (Const (\<^const_name>\<open>Tactical.If\<close>(*1*), _) $ _ $ _ $ _) = go_scan_up pcc ist
12.19
12.20 | scan_up (pcc as (_, (_, ctxt))) _ t = raise ERROR ("scan_up not impl for " ^
12.21 - UnparseC.term_in_ctxt ctxt t)
12.22 + UnparseC.term ctxt t)
12.23
12.24 (* scan program until an applicable tactic is found *)
12.25 fun scan_to_tactic (prog, cc) (Pstate (ist as {path, ...})) =
12.26 @@ -475,7 +475,7 @@
12.27 | scan_up1 pcct ist (Const (\<^const_name>\<open>Tactical.If\<close>,_) $ _ $ _ $ _) = go_scan_up1 pcct ist
12.28
12.29 | scan_up1 (_, (_, ctxt, _)) _ t =
12.30 - raise ERROR ("scan_up1 not impl for t= " ^ UnparseC.term_in_ctxt ctxt t)
12.31 + raise ERROR ("scan_up1 not impl for t= " ^ UnparseC.term ctxt t)
12.32
12.33 fun scan_to_tactic1 (prog, (cctt as ((_, p), _, _))) (Pstate (ist as {path, ...})) =
12.34 if path = [] orelse Pos.at_first_tactic(*RM prog path RM WITH find_next_step IN solve*)p
13.1 --- a/src/Tools/isac/Interpret/solve-step.sml Sat Feb 04 16:49:08 2023 +0100
13.2 +++ b/src/Tools/isac/Interpret/solve-step.sml Sat Feb 04 17:00:25 2023 +0100
13.3 @@ -245,7 +245,7 @@
13.4 val ctxt = Ctree.get_ctxt pt pos
13.5 val thy = ctxt |> Proof_Context.theory_of
13.6 val f = Calc.current_formula cs;
13.7 - val f' = UnparseC.term_in_ctxt ctxt f
13.8 + val f' = UnparseC.term ctxt f
13.9 in
13.10 Applicable.Yes (Tactic.Tac_ (thy, f', id, f'))
13.11 end
13.12 @@ -285,7 +285,7 @@
13.13 in if p' = 0 then ps @ [1] else p end
13.14 val (pt, c) = Ctree.cappend_form pt p l t
13.15 in
13.16 - ((p, Pos.Frm), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt t), pt)
13.17 + ((p, Pos.Frm), c, Test_Out.FormKF (UnparseC.term ctxt t), pt)
13.18 end
13.19 | add (Tactic.Begin_Trans' t) (l as (_, ctxt)) (pt, (p, Pos.Frm)) =
13.20 let
13.21 @@ -295,7 +295,7 @@
13.22 val p = (Pos.lev_on o Pos.lev_dn (* starts with [...,0] *)) p
13.23 val (pt, c') = Ctree.cappend_form pt p l t (*FIXME.0402 same istate ???*)
13.24 in
13.25 - ((p, Pos.Frm), c @ c', Test_Out.FormKF (UnparseC.term_in_ctxt ctxt t), pt)
13.26 + ((p, Pos.Frm), c @ c', Test_Out.FormKF (UnparseC.term ctxt t), pt)
13.27 end
13.28 | add (Tactic.Begin_Trans' t) l (pt, (p, Pos.Res)) =
13.29 (*append after existing PrfObj vvvvvvvvvvvvv*)
13.30 @@ -305,7 +305,7 @@
13.31 val p' = Pos.lev_up p
13.32 val (pt, c) = Ctree.append_result pt p' l tasm Ctree.Complete
13.33 in
13.34 - ((p', Pos.Res), c, Test_Out.FormKF "DUMMY" (*UnparseC.term_in_ctxt ctxt t*), pt)
13.35 + ((p', Pos.Res), c, Test_Out.FormKF "DUMMY" (*UnparseC.term ctxt t*), pt)
13.36 end
13.37 | add (Tactic.Rewrite_Inst' (_, _, _, _, subs', thm', f, (f', asm))) (is, ctxt) (pt, (p, _)) =
13.38 let
13.39 @@ -313,14 +313,14 @@
13.40 (Tactic.Rewrite_Inst (Subst.T_to_input ctxt subs', thm')) (f',asm) Ctree.Complete;
13.41 val pt = Ctree.update_branch pt p Ctree.TransitiveB
13.42 in
13.43 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt f'), pt)
13.44 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt f'), pt)
13.45 end
13.46 | add (Tactic.Rewrite' (_, _, _, _, thm', f, (f', asm))) (is, ctxt) (pt, (p, _)) =
13.47 let
13.48 val (pt, c) = Ctree.cappend_atomic pt p (is, ctxt) f (Tactic.Rewrite thm') (f', asm) Ctree.Complete
13.49 val pt = Ctree.update_branch pt p Ctree.TransitiveB
13.50 in
13.51 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt f'), pt)
13.52 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt f'), pt)
13.53 end
13.54 | add (Tactic.Rewrite_Set_Inst' (_, _, subs', rls', f, (f', asm))) (is, ctxt) (pt, (p, _)) =
13.55 let
13.56 @@ -328,7 +328,7 @@
13.57 (Tactic.Rewrite_Set_Inst (Subst.T_to_input ctxt subs', Rule_Set.id rls')) (f', asm) Ctree.Complete
13.58 val pt = Ctree.update_branch pt p Ctree.TransitiveB
13.59 in
13.60 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt f'), pt)
13.61 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt f'), pt)
13.62 end
13.63 | add (Tactic.Rewrite_Set' (_, _, rls', f, (f', asm))) (is, ctxt) (pt, (p, _)) =
13.64 let
13.65 @@ -336,38 +336,38 @@
13.66 (Tactic.Rewrite_Set (Rule_Set.id rls')) (f', asm) Ctree.Complete
13.67 val pt = Ctree.update_branch pt p Ctree.TransitiveB
13.68 in
13.69 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt f'), pt)
13.70 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt f'), pt)
13.71 end
13.72 | add (Tactic.Check_Postcond' (_, scval)) (l as (_, ctxt)) (pt, (p, _)) =
13.73 let
13.74 val (pt, c) = Ctree.append_result pt p l (scval, []) Ctree.Complete
13.75 in
13.76 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt scval), pt)
13.77 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt scval), pt)
13.78 end
13.79 | add (Tactic.Calculate' (_, op_, f, (f', _))) (l as (_, ctxt)) (pt, (p, _)) =
13.80 let
13.81 val (pt,c) = Ctree.cappend_atomic pt p l f (Tactic.Calculate op_) (f', []) Ctree.Complete
13.82 in
13.83 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt f'), pt)
13.84 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt f'), pt)
13.85 end
13.86 | add (Tactic.Check_elementwise' (consts, pred, (f', asm))) (l as (_, ctxt)) (pt, (p, _)) =
13.87 let
13.88 val (pt,c) = Ctree.cappend_atomic pt p l consts (Tactic.Check_elementwise pred) (f', asm) Ctree.Complete
13.89 in
13.90 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt f'), pt)
13.91 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt f'), pt)
13.92 end
13.93 | add (Tactic.Or_to_List' (ors, list)) (l as (_, ctxt)) (pt, (p, _)) =
13.94 let
13.95 val (pt,c) = Ctree.cappend_atomic pt p l ors Tactic.Or_to_List (list, []) Ctree.Complete
13.96 in
13.97 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt list), pt)
13.98 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt list), pt)
13.99 end
13.100 | add (Tactic.Substitute' (_, _, subte, t, t')) (l as (_, ctxt)) (pt, (p, _)) =
13.101 let
13.102 val (pt, c) =
13.103 Ctree.cappend_atomic pt p l t
13.104 (Tactic.Substitute (Subst.eqs_to_input ctxt subte)) (t',[]) Ctree.Complete
13.105 - in ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt t'), pt)
13.106 + in ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt t'), pt)
13.107 end
13.108 | add (Tactic.Tac_ (_, f, id, f')) l (pt, pos as (p, _)) =
13.109 let
14.1 --- a/src/Tools/isac/Knowledge/Diff.thy Sat Feb 04 16:49:08 2023 +0100
14.2 +++ b/src/Tools/isac/Knowledge/Diff.thy Sat Feb 04 17:00:25 2023 +0100
14.3 @@ -91,11 +91,11 @@
14.4
14.5 fun primed (Const (id, T)) = Const (id ^ "'", T)
14.6 | primed (Free (id, T)) = Free (id ^ "'", T)
14.7 - | primed t = raise ERROR ("primed called with arg = '"^ UnparseC.term_in_ctxt @{context} t ^"'");
14.8 + | primed t = raise ERROR ("primed called with arg = '"^ UnparseC.term @{context} t ^"'");
14.9
14.10 (*("primed", ("Diff.primed", eval_primed "#primed"))*)
14.11 fun eval_primed _ _ (p as (Const (\<^const_name>\<open>Diff.primed\<close>,_) $ t)) _ =
14.12 - SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = " ^ UnparseC.term_in_ctxt @{context} (primed t),
14.13 + SOME ((UnparseC.term @{context} p) ^ " = " ^ UnparseC.term @{context} (primed t),
14.14 HOLogic.Trueprop $ (TermC.mk_equality (p, primed t)))
14.15 | eval_primed _ _ _ _ = NONE;
14.16 \<close>
15.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy Sat Feb 04 16:49:08 2023 +0100
15.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy Sat Feb 04 17:00:25 2023 +0100
15.3 @@ -73,9 +73,9 @@
15.4 (p as (Const (\<^const_name>\<open>EqSystem.occur_exactly_in\<close>,_)
15.5 $ vs $ all $ t)) _ =
15.6 if occur_exactly_in (TermC.isalist2list vs) (TermC.isalist2list all) t
15.7 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
15.8 + then SOME ((UnparseC.term @{context} p) ^ " = True",
15.9 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
15.10 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
15.11 + else SOME ((UnparseC.term @{context} p) ^ " = False",
15.12 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
15.13 | eval_occur_exactly_in _ _ _ _ = NONE;
15.14 \<close>
15.15 @@ -126,10 +126,10 @@
15.16 then
15.17 let
15.18 val (f, ts) = strip_comb t and (g, us) = strip_comb u;
15.19 - val _ = tracing ("t= f @ ts= \"" ^ UnparseC.term_in_ctxt ctxt f ^ "\" @ \"[" ^
15.20 - commas (map (UnparseC.term_in_ctxt ctxt) ts) ^ "]\"");
15.21 - val _ = tracing ("u= g @ us= \"" ^ UnparseC.term_in_ctxt ctxt g ^ "\" @ \"[" ^
15.22 - commas (map (UnparseC.term_in_ctxt ctxt) us) ^ "]\"");
15.23 + val _ = tracing ("t= f @ ts= \"" ^ UnparseC.term ctxt f ^ "\" @ \"[" ^
15.24 + commas (map (UnparseC.term ctxt) ts) ^ "]\"");
15.25 + val _ = tracing ("u= g @ us= \"" ^ UnparseC.term ctxt g ^ "\" @ \"[" ^
15.26 + commas (map (UnparseC.term ctxt) us) ^ "]\"");
15.27 val _ = tracing ("size_of_term (t, u) = (" ^ string_of_int (size_of_term' t) ^ ", " ^
15.28 string_of_int (size_of_term' u) ^ ")");
15.29 val _ = tracing ("hd_ord (f, g) = " ^ ((pr_ord o hd_ord) (f, g)) );
16.1 --- a/src/Tools/isac/Knowledge/Integrate.thy Sat Feb 04 16:49:08 2023 +0100
16.2 +++ b/src/Tools/isac/Knowledge/Integrate.thy Sat Feb 04 17:00:25 2023 +0100
16.3 @@ -78,7 +78,7 @@
16.4 Const (\<^const_name>\<open>HOL.eq\<close>, T) $ lh $ rh =>
16.5 Const (\<^const_name>\<open>HOL.eq\<close>, T) $ lh $ TermC.mk_add rh (new_c rh)
16.6 | p => TermC.mk_add p (new_c p)
16.7 - in SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = " ^ UnparseC.term_in_ctxt @{context} p',
16.8 + in SOME ((UnparseC.term @{context} p) ^ " = " ^ UnparseC.term @{context} p',
16.9 HOLogic.Trueprop $ (TermC.mk_equality (p, p')))
16.10 end
16.11 | eval_add_new_c _ _ _ _ = NONE;
16.12 @@ -88,9 +88,9 @@
16.13 fun eval_is_f_x _ _(p as (Const (\<^const_name>\<open>Integrate.is_f_x\<close>, _)
16.14 $ arg)) _ =
16.15 if TermC.is_f_x arg
16.16 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
16.17 + then SOME ((UnparseC.term @{context} p) ^ " = True",
16.18 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
16.19 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
16.20 + else SOME ((UnparseC.term @{context} p) ^ " = False",
16.21 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
16.22 | eval_is_f_x _ _ _ _ = NONE;
16.23 \<close>
17.1 --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy Sat Feb 04 16:49:08 2023 +0100
17.2 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy Sat Feb 04 17:00:25 2023 +0100
17.3 @@ -61,7 +61,7 @@
17.4 fun eval_factors_from_solution (thmid:string) _
17.5 (t as Const (\<^const_name>\<open>Partial_Fractions.factors_from_solution\<close>, _) $ sol) ctxt =
17.6 let val prod = factors_from_solution sol
17.7 - in SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt prod) "",
17.8 + in SOME (TermC.mk_thmid thmid (UnparseC.term ctxt prod) "",
17.9 HOLogic.Trueprop $ (TermC.mk_equality (t, prod)))
17.10 end
17.11 | eval_factors_from_solution _ _ _ _ = NONE;
18.1 --- a/src/Tools/isac/Knowledge/Poly.thy Sat Feb 04 16:49:08 2023 +0100
18.2 +++ b/src/Tools/isac/Knowledge/Poly.thy Sat Feb 04 17:00:25 2023 +0100
18.3 @@ -301,7 +301,7 @@
18.4 - zuerst lexikographisch nach Variablenname
18.5 - wenn gleich: nach steigender Potenz *)
18.6 fun var_ord (a, b) =
18.7 -(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term_in_ctxt @{context} a ^ ", " ^ UnparseC.term_in_ctxt @{context} b ^ ")",
18.8 +(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term @{context} a ^ ", " ^ UnparseC.term @{context} b ^ ")",
18.9 sort_args = "(" ^ get_basStr a ^ ", " ^ get_potStr a ^ "), (" ^ get_basStr b ^ ", " ^ get_potStr b ^ ")"};
18.10 prod_ord string_ord string_ord
18.11 ((get_basStr a, get_potStr a), (get_basStr b, get_potStr b))
18.12 @@ -315,7 +315,7 @@
18.13 - zuerst lexikographisch nach Variablenname
18.14 - wenn gleich: nach sinkender Potenz*)
18.15 fun var_ord_revPow (a, b: term) =
18.16 -(@{print} {a = "var_ord_revPow ", at_bt = "(" ^ UnparseC.term_in_ctxt @{context} a ^ ", " ^ UnparseC.term_in_ctxt @{context} b ^ ")",
18.17 +(@{print} {a = "var_ord_revPow ", at_bt = "(" ^ UnparseC.term @{context} a ^ ", " ^ UnparseC.term @{context} b ^ ")",
18.18 sort_args = "(" ^ get_basStr a ^ ", " ^ get_potStr a ^ "), (" ^ get_basStr b ^ ", " ^ get_potStr b ^ ")"};
18.19 prod_ord string_ord string_ord_rev
18.20 ((get_basStr a, get_potStr a), (get_basStr b, get_potStr b))
18.21 @@ -327,7 +327,7 @@
18.22
18.23 (* Ordnet ein Liste von Variablen (und Potenzen) lexikographisch *)
18.24 fun sort_varList ts =
18.25 -(@{print} {a = "sort_varList", args = UnparseC.terms_in_ctxt @{context} ts};
18.26 +(@{print} {a = "sort_varList", args = UnparseC.terms @{context} ts};
18.27 sort var_ord ts);
18.28 val sort_varList = sort var_ord;
18.29
18.30 @@ -373,8 +373,8 @@
18.31 | dict_cond_ord _ _ ([], _ :: _) = (@{print} {a = "dict_cond_ord ([], _ :: _)"}; LESS)
18.32 | dict_cond_ord _ _ (_ :: _, []) = (@{print} {a = "dict_cond_ord (_ :: _, [])"}; GREATER)
18.33 | dict_cond_ord elem_ord cond (x :: xs, y :: ys) =
18.34 - (@{print} {a = "dict_cond_ord", args = "(" ^ UnparseC.terms_in_ctxt @{context} (x :: xs) ^ ", " ^
18.35 - UnparseC.terms_in_ctxt @{context} (y :: ys) ^ ")",
18.36 + (@{print} {a = "dict_cond_ord", args = "(" ^ UnparseC.terms @{context} (x :: xs) ^ ", " ^
18.37 + UnparseC.terms @{context} (y :: ys) ^ ")",
18.38 is_nums = "(" ^ LibraryC.bool2str (cond x) ^ ", " ^ LibraryC.bool2str (cond y) ^ ")"};
18.39 case (cond x, cond y) of
18.40 (false, false) =>
18.41 @@ -521,10 +521,10 @@
18.42 (if pr then
18.43 let
18.44 val (f, ts) = strip_comb t and (g, us) = strip_comb u;
18.45 - val _ = tracing ("t= f@ts= \"" ^ UnparseC.term_in_ctxt ctxt f ^ "\" @ \"[" ^
18.46 - commas (map (UnparseC.term_in_ctxt ctxt) ts) ^ "]\"");
18.47 - val _ = tracing("u= g@us= \"" ^ UnparseC.term_in_ctxt ctxt g ^ "\" @ \"[" ^
18.48 - commas (map (UnparseC.term_in_ctxt ctxt) us) ^ "]\"");
18.49 + val _ = tracing ("t= f@ts= \"" ^ UnparseC.term ctxt f ^ "\" @ \"[" ^
18.50 + commas (map (UnparseC.term ctxt) ts) ^ "]\"");
18.51 + val _ = tracing("u= g@us= \"" ^ UnparseC.term ctxt g ^ "\" @ \"[" ^
18.52 + commas (map (UnparseC.term ctxt) us) ^ "]\"");
18.53 val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' t) ^ ", " ^
18.54 string_of_int (size_of_term' u) ^ ")");
18.55 val _ = tracing ("hd_ord(f,g) = " ^ (pr_ord o hd_ord) (f,g));
18.56 @@ -626,9 +626,9 @@
18.57 ML \<open>
18.58 fun eval_is_polyrat_in _ _(p as (Const (\<^const_name>\<open>Poly.is_polyrat_in\<close>, _) $ t $ v)) _ =
18.59 if is_polyrat_in t v
18.60 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
18.61 + then SOME ((UnparseC.term @{context} p) ^ " = True",
18.62 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
18.63 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
18.64 + else SOME ((UnparseC.term @{context} p) ^ " = True",
18.65 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
18.66 | eval_is_polyrat_in _ _ _ _ = ((*tracing"### no matches";*) NONE);
18.67
18.68 @@ -636,9 +636,9 @@
18.69 fun eval_is_expanded_in _ _
18.70 (p as (Const (\<^const_name>\<open>Poly.is_expanded_in\<close>, _) $ t $ v)) _ =
18.71 if is_expanded_in t v
18.72 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
18.73 + then SOME ((UnparseC.term @{context} p) ^ " = True",
18.74 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
18.75 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
18.76 + else SOME ((UnparseC.term @{context} p) ^ " = True",
18.77 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
18.78 | eval_is_expanded_in _ _ _ _ = NONE;
18.79
18.80 @@ -646,9 +646,9 @@
18.81 fun eval_is_poly_in _ _
18.82 (p as (Const (\<^const_name>\<open>Poly.is_poly_in\<close>, _) $ t $ v)) _ =
18.83 if is_poly_in t v
18.84 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
18.85 + then SOME ((UnparseC.term @{context} p) ^ " = True",
18.86 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
18.87 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
18.88 + else SOME ((UnparseC.term @{context} p) ^ " = True",
18.89 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
18.90 | eval_is_poly_in _ _ _ _ = NONE;
18.91
18.92 @@ -657,7 +657,7 @@
18.93 (p as (Const (\<^const_name>\<open>Poly.has_degree_in\<close>, _) $ t $ v)) _ =
18.94 let val d = has_degree_in t v
18.95 val d' = TermC.term_of_num HOLogic.realT d
18.96 - in SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = " ^ (string_of_int d),
18.97 + in SOME ((UnparseC.term @{context} p) ^ " = " ^ (string_of_int d),
18.98 HOLogic.Trueprop $ (TermC.mk_equality (p, d')))
18.99 end
18.100 | eval_has_degree_in _ _ _ _ = NONE;
18.101 @@ -666,9 +666,9 @@
18.102 fun eval_is_polyexp (thmid:string) _
18.103 (t as (Const (\<^const_name>\<open>is_polyexp\<close>, _) $ arg)) ctxt =
18.104 if is_polyexp arg
18.105 - then SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
18.106 + then SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
18.107 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
18.108 - else SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
18.109 + else SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
18.110 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
18.111 | eval_is_polyexp _ _ _ _ = NONE;
18.112 \<close>
18.113 @@ -680,18 +680,18 @@
18.114 fun eval_is_addUnordered (thmid:string) _
18.115 (t as (Const (\<^const_name>\<open>is_addUnordered\<close>, _) $ arg)) ctxt =
18.116 if is_addUnordered arg
18.117 - then SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
18.118 + then SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
18.119 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
18.120 - else SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
18.121 + else SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
18.122 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
18.123 | eval_is_addUnordered _ _ _ _ = NONE;
18.124
18.125 fun eval_is_multUnordered (thmid:string) _
18.126 (t as (Const (\<^const_name>\<open>is_multUnordered\<close>, _) $ arg)) ctxt =
18.127 if is_multUnordered arg
18.128 - then SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
18.129 + then SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
18.130 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
18.131 - else SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
18.132 + else SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
18.133 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
18.134 | eval_is_multUnordered _ _ _ _ = NONE;
18.135 \<close>
19.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy Sat Feb 04 16:49:08 2023 +0100
19.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy Sat Feb 04 17:00:25 2023 +0100
19.3 @@ -1030,26 +1030,26 @@
19.4
19.5 fun size_of_term' i pr x (t as Const (\<^const_name>\<open>realpow\<close>, _) $
19.6 Free (var, _) $ Free (pot, _)) =
19.7 - (if pr then tracing (idt "#" i ^ "size_of_term' realpow: " ^ UnparseC.term_in_ctxt @{context} t) else ();
19.8 + (if pr then tracing (idt "#" i ^ "size_of_term' realpow: " ^ UnparseC.term @{context} t) else ();
19.9 case x of (*WN*)
19.10 (Free (xstr, _)) =>
19.11 if xstr = var
19.12 then (if pr then tracing (idt "#" i ^ "xstr = var --> " ^ string_of_int (1000 * (the (TermC.int_opt_of_string pot)))) else ();
19.13 1000 * (the (TermC.int_opt_of_string pot)))
19.14 else (if pr then tracing (idt "#" i ^ "x <> Free --> " ^ "3") else (); 3)
19.15 - | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term_in_ctxt @{context} x))
19.16 + | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term @{context} x))
19.17 | size_of_term' i pr x (t as Abs (_, _, body)) =
19.18 - (if pr then tracing (idt "#" i ^ "size_of_term' Abs: " ^ UnparseC.term_in_ctxt @{context} t) else ();
19.19 + (if pr then tracing (idt "#" i ^ "size_of_term' Abs: " ^ UnparseC.term @{context} t) else ();
19.20 1 + size_of_term' (i + 1) pr x body)
19.21 | size_of_term' i pr x (f $ t) =
19.22 let
19.23 - val _ = if pr then tracing (idt "#" i ^ "size_of_term' $$$: " ^ UnparseC.term_in_ctxt @{context} f ^ " $$$ " ^ UnparseC.term_in_ctxt @{context} t) else ();
19.24 + val _ = if pr then tracing (idt "#" i ^ "size_of_term' $$$: " ^ UnparseC.term @{context} f ^ " $$$ " ^ UnparseC.term @{context} t) else ();
19.25 val s1 = size_of_term' (i + 1) pr x f
19.26 val s2 = size_of_term' (i + 1) pr x t
19.27 val _ = if pr then tracing (idt "#" i ^ "size_of_term' $$$-->: " ^ string_of_int s1 ^ " + " ^ string_of_int s2 ^ " = " ^ string_of_int(s1 + s2)) else ();
19.28 in (s1 + s2) end
19.29 | size_of_term' i pr x t =
19.30 - (if pr then tracing (idt "#" i ^ "size_of_term' bot: " ^ UnparseC.term_in_ctxt @{context} t) else ();
19.31 + (if pr then tracing (idt "#" i ^ "size_of_term' bot: " ^ UnparseC.term @{context} t) else ();
19.32 case t of
19.33 Free (subst, _) =>
19.34 (case x of
19.35 @@ -1057,7 +1057,7 @@
19.36 if xstr = subst
19.37 then (if pr then tracing (idt "#" i ^ "xstr = var --> " ^ "1000") else (); 1000)
19.38 else (if pr then tracing (idt "#" i ^ "x <> Free --> " ^ "1") else (); 1)
19.39 - | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term_in_ctxt @{context} x))
19.40 + | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term @{context} x))
19.41 | _ => (if pr then tracing (idt "#" i ^ "bot --> " ^ "1") else (); 1));
19.42
19.43 fun term_ord' i pr x ctxt (Abs (_, T, t), Abs(_, U, u)) = (* ~ term.ML *)
19.44 @@ -1069,8 +1069,8 @@
19.45 in ord end
19.46 | term_ord' i pr x ctxt (t, u) =
19.47 let
19.48 - val _ = if pr then tracing (idt "#" i ^ "term_ord' bot (" ^ UnparseC.term_in_ctxt ctxt t ^
19.49 - ", " ^ UnparseC.term_in_ctxt ctxt u ^ ")") else ();
19.50 + val _ = if pr then tracing (idt "#" i ^ "term_ord' bot (" ^ UnparseC.term ctxt t ^
19.51 + ", " ^ UnparseC.term ctxt u ^ ")") else ();
19.52 val ord =
19.53 case int_ord (size_of_term' (i + 1) pr x t, size_of_term' (i + 1) pr x u) of
19.54 EQUAL =>
19.55 @@ -1085,8 +1085,8 @@
19.56 in ord end
19.57 and hd_ord i pr x ctxt (f, g) = (* ~ term.ML *)
19.58 let
19.59 - val _ = if pr then tracing (idt "#" i ^ "hd_ord (" ^ UnparseC.term_in_ctxt ctxt f ^
19.60 - ", " ^ UnparseC.term_in_ctxt @{context} g ^ ")") else ();
19.61 + val _ = if pr then tracing (idt "#" i ^ "hd_ord (" ^ UnparseC.term ctxt f ^
19.62 + ", " ^ UnparseC.term @{context} g ^ ")") else ();
19.63 val ord = prod_ord
19.64 (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord
19.65 (dest_hd' x f, dest_hd' x g)
19.66 @@ -1094,8 +1094,8 @@
19.67 in ord end
19.68 and terms_ord x i pr ctxt (ts, us) =
19.69 let
19.70 - val _ = if pr then tracing (idt "#" i ^ "terms_ord (" ^ UnparseC.terms_in_ctxt ctxt ts ^
19.71 - ", " ^ UnparseC.terms_in_ctxt ctxt us ^ ")") else ();
19.72 + val _ = if pr then tracing (idt "#" i ^ "terms_ord (" ^ UnparseC.terms ctxt ts ^
19.73 + ", " ^ UnparseC.terms ctxt us ^ ")") else ();
19.74 val ord = list_ord (term_ord' (i + 1) pr x ctxt) (ts, us);
19.75 val _ = if pr then tracing (idt "#" i ^ "terms_ord --> " ^ pr_ord ord) else ();
19.76 in ord end
20.1 --- a/src/Tools/isac/Knowledge/PolyMinus.thy Sat Feb 04 16:49:08 2023 +0100
20.2 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy Sat Feb 04 17:00:25 2023 +0100
20.3 @@ -144,18 +144,18 @@
20.4 if TermC.is_num b then
20.5 if TermC.is_num a then (*123 kleiner 32 = True !!!*)
20.6 if TermC.num_of_term a < TermC.num_of_term b then
20.7 - SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
20.8 + SOME ((UnparseC.term @{context} p) ^ " = True",
20.9 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
20.10 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
20.11 + else SOME ((UnparseC.term @{context} p) ^ " = False",
20.12 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
20.13 else (* -1 * -2 kleiner 0 *)
20.14 - SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
20.15 + SOME ((UnparseC.term @{context} p) ^ " = False",
20.16 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
20.17 else
20.18 if identifier a < identifier b then
20.19 - SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
20.20 + SOME ((UnparseC.term @{context} p) ^ " = True",
20.21 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
20.22 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
20.23 + else SOME ((UnparseC.term @{context} p) ^ " = False",
20.24 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
20.25 | eval_kleiner _ _ _ _ = NONE;
20.26
20.27 @@ -173,9 +173,9 @@
20.28 (*("ist_monom", ("PolyMinus.ist_monom", eval_ist_monom ""))*)
20.29 fun eval_ist_monom _ _ (p as (Const (\<^const_name>\<open>PolyMinus.ist_monom\<close>,_) $ a)) _ =
20.30 if ist_monom a then
20.31 - SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
20.32 + SOME ((UnparseC.term @{context} p) ^ " = True",
20.33 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
20.34 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
20.35 + else SOME ((UnparseC.term @{context} p) ^ " = False",
20.36 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
20.37 | eval_ist_monom _ _ _ _ = NONE;
20.38
21.1 --- a/src/Tools/isac/Knowledge/RatEq.thy Sat Feb 04 16:49:08 2023 +0100
21.2 +++ b/src/Tools/isac/Knowledge/RatEq.thy Sat Feb 04 17:00:25 2023 +0100
21.3 @@ -69,8 +69,8 @@
21.4 ML \<open>
21.5 fun eval_is_ratequation_in _ _ (p as (Const (\<^const_name>\<open>RatEq.is_ratequation_in\<close>, _) $ t $ v)) _ =
21.6 if is_rateqation_in t v
21.7 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
21.8 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
21.9 + then SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
21.10 + else SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
21.11 | eval_is_ratequation_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
21.12 \<close>
21.13 calculation is_ratequation_in = \<open>eval_is_ratequation_in ""\<close>
22.1 --- a/src/Tools/isac/Knowledge/Rational.thy Sat Feb 04 16:49:08 2023 +0100
22.2 +++ b/src/Tools/isac/Knowledge/Rational.thy Sat Feb 04 17:00:25 2023 +0100
22.3 @@ -43,9 +43,9 @@
22.4 fun eval_is_ratpolyexp (thmid:string) _
22.5 (t as (Const (\<^const_name>\<open>Rational.is_ratpolyexp\<close>, _) $ arg)) ctxt =
22.6 if is_ratpolyexp arg
22.7 - then SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
22.8 + then SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
22.9 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
22.10 - else SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
22.11 + else SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
22.12 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
22.13 | eval_is_ratpolyexp _ _ _ _ = NONE;
22.14
22.15 @@ -54,7 +54,7 @@
22.16 (t as Const (\<^const_name>\<open>Rational.get_denominator\<close>, _) $
22.17 (Const (\<^const_name>\<open>divide\<close>, _) $ _(*num*) $
22.18 denom)) ctxt =
22.19 - SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt denom) "",
22.20 + SOME (TermC.mk_thmid thmid (UnparseC.term ctxt denom) "",
22.21 HOLogic.Trueprop $ (TermC.mk_equality (t, denom)))
22.22 | eval_get_denominator _ _ _ _ = NONE;
22.23
22.24 @@ -63,7 +63,7 @@
22.25 (t as Const (\<^const_name>\<open>Rational.get_numerator\<close>, _) $
22.26 (Const (\<^const_name>\<open>divide\<close>, _) $num
22.27 $denom )) ctxt =
22.28 - SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt num) "",
22.29 + SOME (TermC.mk_thmid thmid (UnparseC.term ctxt num) "",
22.30 HOLogic.Trueprop $ (TermC.mk_equality (t, num)))
22.31 | eval_get_numerator _ _ _ _ = NONE;
22.32 \<close>
22.33 @@ -141,7 +141,7 @@
22.34 | monom_of_term vs (c, es) (Const (\<^const_name>\<open>times\<close>, _) $ m1 $ m2) =
22.35 let val (c', es') = monom_of_term vs (c, es) m1
22.36 in monom_of_term vs (c', es') m2 end
22.37 - | monom_of_term _ _ t = raise ERROR ("poly malformed 1 with " ^ UnparseC.term_in_ctxt @{context} t)
22.38 + | monom_of_term _ _ t = raise ERROR ("poly malformed 1 with " ^ UnparseC.term @{context} t)
22.39
22.40 (*-------v------*)
22.41 fun monoms_of_term vs (t as Const (\<^const_name>\<open>zero_class.zero\<close>, _)) =
22.42 @@ -160,7 +160,7 @@
22.43 [monom_of_term vs (1, replicate (length vs) 0) t]
22.44 | monoms_of_term vs (Const (\<^const_name>\<open>plus\<close>, _) $ ms1 $ ms2) =
22.45 (monoms_of_term vs ms1) @ (monoms_of_term vs ms2)
22.46 - | monoms_of_term _ t = raise ERROR ("poly malformed 2 with " ^ UnparseC.term_in_ctxt @{context} t)
22.47 + | monoms_of_term _ t = raise ERROR ("poly malformed 2 with " ^ UnparseC.term @{context} t)
22.48
22.49 (* convert a term to the internal representation of a multivariate polynomial;
22.50 the conversion is quite liberal, see test --- fun poly_of_term ---:
22.51 @@ -456,9 +456,9 @@
22.52 fun eval_is_expanded (thmid:string) _
22.53 (t as (Const (\<^const_name>\<open>Rational.is_expanded\<close>, _) $ arg)) ctxt =
22.54 if is_expanded arg
22.55 - then SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
22.56 + then SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
22.57 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
22.58 - else SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
22.59 + else SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
22.60 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
22.61 | eval_is_expanded _ _ _ _ = NONE;
22.62 \<close>
22.63 @@ -497,7 +497,7 @@
22.64 in
22.65 case ropt of SOME ta => [(r, ta)]
22.66 | NONE => ((*tracing
22.67 - ("### locate_rule: rewrite " ^ Rule.thm_id r ^ " " ^ UnparseC.term_in_ctxt @{context} t ^ " = NONE");*) [])
22.68 + ("### locate_rule: rewrite " ^ Rule.thm_id r ^ " " ^ UnparseC.term @{context} t ^ " = NONE");*) [])
22.69 end
22.70 else ((*tracing ("### locate_rule: " ^ Rule.thm_id r ^ " not mem rrls");*) [])
22.71 | locate_rule _ _ _ _ _ _ = raise ERROR "locate_rule: doesnt match rev-sets in istate";
22.72 @@ -561,7 +561,7 @@
22.73 case ropt of
22.74 SOME ta => [(r, ta)]
22.75 | NONE =>
22.76 - ((*tracing ("### locate_rule: rewrite " ^ Rule.thm_id r ^ " " ^ UnparseC.term_in_ctxt @{context} t ^ " = NONE");*)
22.77 + ((*tracing ("### locate_rule: rewrite " ^ Rule.thm_id r ^ " " ^ UnparseC.term @{context} t ^ " = NONE");*)
22.78 []) end
22.79 else ((*tracing ("### locate_rule: " ^ Rule.thm_id r ^ " not mem rrls");*) [])
22.80 | locate_rule _ _ _ _ _ _ = raise ERROR "locate_rule: doesnt match rev-sets in istate";
23.1 --- a/src/Tools/isac/Knowledge/Root.thy Sat Feb 04 16:49:08 2023 +0100
23.2 +++ b/src/Tools/isac/Knowledge/Root.thy Sat Feb 04 17:00:25 2023 +0100
23.3 @@ -109,10 +109,10 @@
23.4 then
23.5 let
23.6 val (f, ts) = strip_comb t and (g, us) = strip_comb u;
23.7 - val _ = tracing ("t= f@ts= \"" ^ UnparseC.term_in_ctxt ctxt f ^"\" @ \"[" ^
23.8 - commas (map (UnparseC.term_in_ctxt ctxt) ts) ^ "]\"");
23.9 - val _ = tracing ("u= g@us= \"" ^ UnparseC.term_in_ctxt @{context} g ^"\" @ \"[" ^
23.10 - commas (map (UnparseC.term_in_ctxt ctxt) us) ^ "]\"");
23.11 + val _ = tracing ("t= f@ts= \"" ^ UnparseC.term ctxt f ^"\" @ \"[" ^
23.12 + commas (map (UnparseC.term ctxt) ts) ^ "]\"");
23.13 + val _ = tracing ("u= g@us= \"" ^ UnparseC.term @{context} g ^"\" @ \"[" ^
23.14 + commas (map (UnparseC.term ctxt) us) ^ "]\"");
23.15 val _ = tracing ("size_of_term(t,u)= (" ^
23.16 string_of_int(size_of_term' t) ^", " ^
23.17 string_of_int(size_of_term' u) ^")");
24.1 --- a/src/Tools/isac/Knowledge/RootEq.thy Sat Feb 04 16:49:08 2023 +0100
24.2 +++ b/src/Tools/isac/Knowledge/RootEq.thy Sat Feb 04 17:00:25 2023 +0100
24.3 @@ -153,20 +153,20 @@
24.4
24.5 fun eval_is_rootTerm_in _ _ (p as (Const (\<^const_name>\<open>RootEq.is_rootTerm_in\<close>,_) $ t $ v)) _ =
24.6 if is_rootTerm_in t v
24.7 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
24.8 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
24.9 + then SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
24.10 + else SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
24.11 | eval_is_rootTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
24.12
24.13 fun eval_is_sqrtTerm_in _ _ (p as (Const (\<^const_name>\<open>is_sqrtTerm_in\<close>,_) $ t $ v)) _ =
24.14 if is_sqrtTerm_in t v
24.15 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
24.16 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
24.17 + then SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
24.18 + else SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
24.19 | eval_is_sqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
24.20
24.21 fun eval_is_normSqrtTerm_in _ _ (p as (Const (\<^const_name>\<open>is_normSqrtTerm_in\<close>,_) $ t $ v)) _ =
24.22 if is_normSqrtTerm_in t v
24.23 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
24.24 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
24.25 + then SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
24.26 + else SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
24.27 | eval_is_normSqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
24.28 \<close>
24.29 calculation is_rootTerm_in = \<open>eval_is_rootTerm_in ""\<close>
25.1 --- a/src/Tools/isac/Knowledge/RootRatEq.thy Sat Feb 04 16:49:08 2023 +0100
25.2 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy Sat Feb 04 17:00:25 2023 +0100
25.3 @@ -57,8 +57,8 @@
25.4
25.5 fun eval_is_rootRatAddTerm_in _ _ (p as (Const (\<^const_name>\<open>is_rootRatAddTerm_in\<close>,_) $ t $ v)) _ =
25.6 if is_rootRatAddTerm_in t v
25.7 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
25.8 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
25.9 + then SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
25.10 + else SOME ((UnparseC.term @{context} p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
25.11 | eval_is_rootRatAddTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
25.12 \<close>
25.13 calculation is_rootRatAddTerm_in = \<open>eval_is_rootRatAddTerm_in ""\<close>
26.1 --- a/src/Tools/isac/Knowledge/Test.thy Sat Feb 04 16:49:08 2023 +0100
26.2 +++ b/src/Tools/isac/Knowledge/Test.thy Sat Feb 04 17:00:25 2023 +0100
26.3 @@ -37,10 +37,10 @@
26.4
26.5 fun bin_op_arg1 ((Const (_,
26.6 (Type (\<^type_name>\<open>fun\<close>, [Type (_, []), Type (\<^type_name>\<open>fun\<close>, [Type _, Type _])])))) $ arg1 $ _) = arg1
26.7 - | bin_op_arg1 t = raise ERROR ("bin_op_arg1: t = " ^ UnparseC.term_in_ctxt @{context} t);
26.8 + | bin_op_arg1 t = raise ERROR ("bin_op_arg1: t = " ^ UnparseC.term @{context} t);
26.9 fun bin_op_arg2 ((Const (_,
26.10 (Type (\<^type_name>\<open>fun\<close>, [Type (_, []),Type (\<^type_name>\<open>fun\<close>, [Type _, Type _])]))))$ _ $ arg2) = arg2
26.11 - | bin_op_arg2 t = raise ERROR ("bin_op_arg1: t = " ^ UnparseC.term_in_ctxt @{context} t);
26.12 + | bin_op_arg2 t = raise ERROR ("bin_op_arg1: t = " ^ UnparseC.term @{context} t);
26.13
26.14 exception NO_EQUATION_TERM;
26.15 fun is_equation ((Const (\<^const_name>\<open>HOL.eq\<close>,
26.16 @@ -95,7 +95,7 @@
26.17 if subset op = (bin_op h, addl)
26.18 then max (deg addl mul v t1 , deg addl mul v t2)
26.19 else (*mul!*)(deg addl mul v t1) + (deg addl mul v t2)
26.20 - | deg _ _ _ t = raise ERROR ("deg: t = " ^ UnparseC.term_in_ctxt @{context} t)
26.21 + | deg _ _ _ t = raise ERROR ("deg: t = " ^ UnparseC.term @{context} t)
26.22 in
26.23 if polynomial (addl @ [mul]) t bdVar
26.24 then SOME (deg addl mul (id_of bdVar) t)
26.25 @@ -255,21 +255,21 @@
26.26 fun eval_contains_root (thmid:string) _
26.27 (t as (Const (\<^const_name>\<open>Test.contains_root\<close>, _) $ arg)) ctxt =
26.28 if member op = (ids_of arg) "sqrt"
26.29 - then SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg)"",
26.30 + then SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg)"",
26.31 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
26.32 - else SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg)"",
26.33 + else SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg)"",
26.34 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
26.35 | eval_contains_root _ _ _ _ = NONE;
26.36
26.37 (*dummy precondition for root-met of x+1=2*)
26.38 fun eval_precond_rootmet (thmid:string) _ (t as (Const (\<^const_name>\<open>Test.precond_rootmet\<close>, _) $ arg)) ctxt =
26.39 - SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg)"",
26.40 + SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg)"",
26.41 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
26.42 | eval_precond_rootmet _ _ _ _ = NONE;
26.43
26.44 (*dummy precondition for root-pbl of x+1=2*)
26.45 fun eval_precond_rootpbl (thmid:string) _ (t as (Const (\<^const_name>\<open>Test.precond_rootpbl\<close>, _) $ arg)) ctxt =
26.46 - SOME (TermC.mk_thmid thmid (UnparseC.term_in_ctxt ctxt arg) "",
26.47 + SOME (TermC.mk_thmid thmid (UnparseC.term ctxt arg) "",
26.48 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
26.49 | eval_precond_rootpbl _ _ _ _ = NONE;
26.50 \<close>
26.51 @@ -319,10 +319,10 @@
26.52 | term_ord' pr ctxt (t, u) =
26.53 (if pr then
26.54 let val (f, ts) = strip_comb t and (g, us) = strip_comb u;
26.55 - val _ = tracing ("t= f@ts= \"" ^ UnparseC.term_in_ctxt ctxt f ^ "\" @ \"[" ^
26.56 - commas (map (UnparseC.term_in_ctxt ctxt) ts) ^ "]\"")
26.57 - val _ = tracing ("u= g@us= \"" ^ UnparseC.term_in_ctxt ctxt g ^"\" @ \"[" ^
26.58 - commas (map (UnparseC.term_in_ctxt ctxt) us) ^"]\"")
26.59 + val _ = tracing ("t= f@ts= \"" ^ UnparseC.term ctxt f ^ "\" @ \"[" ^
26.60 + commas (map (UnparseC.term ctxt) ts) ^ "]\"")
26.61 + val _ = tracing ("u= g@us= \"" ^ UnparseC.term ctxt g ^"\" @ \"[" ^
26.62 + commas (map (UnparseC.term ctxt) us) ^"]\"")
26.63 val _ = tracing ("size_of_term(t,u)= (" ^
26.64 string_of_int (size_of_term' t) ^ ", " ^
26.65 string_of_int (size_of_term' u) ^ ")")
27.1 --- a/src/Tools/isac/MathEngBasic/ctree-basic.sml Sat Feb 04 16:49:08 2023 +0100
27.2 +++ b/src/Tools/isac/MathEngBasic/ctree-basic.sml Sat Feb 04 17:00:25 2023 +0100
27.3 @@ -244,7 +244,7 @@
27.4 (* show hd origin or form only *)
27.5 (**)
27.6 fun pr_short _ p (PblObj _) = pr_pos p ^ " ----- pblobj -----\n"
27.7 - | pr_short ctxt p (PrfObj {form = form, ...}) = pr_pos p ^ UnparseC.term_in_ctxt ctxt form ^ "\n";
27.8 + | pr_short ctxt p (PrfObj {form = form, ...}) = pr_pos p ^ UnparseC.term ctxt form ^ "\n";
27.9 fun pr_ctree ctxt f pt =
27.10 let
27.11 fun pr_pt _ _ EmptyPtree = ""
27.12 @@ -521,11 +521,11 @@
27.13 (*extract a formula or model from ctree for itms2itemppc or model2xml*)
27.14 fun preconds2str bts =
27.15 (strs2str o (map (linefeed o pair2str o
27.16 - (apsnd (UnparseC.term_in_ctxt @{context})) o
27.17 + (apsnd (UnparseC.term @{context})) o
27.18 (apfst bool2str)))) bts;
27.19
27.20 fun ocalhd2str (b, p, hdf, itms, prec, spec) =
27.21 - "(" ^ bool2str b ^ ", " ^ pos_2str p ^ ", " ^ UnparseC.term_in_ctxt @{context} hdf ^
27.22 + "(" ^ bool2str b ^ ", " ^ pos_2str p ^ ", " ^ UnparseC.term @{context} hdf ^
27.23 ", " ^ "\<forall>itms2str itms\<forall>" (*Model_Def.itms2str_ (ThyC.id_to_ctxt "Isac_Knowledge") itms*) ^
27.24 ", " ^ preconds2str prec ^ ", \n" ^ References_Def.to_string spec ^ " )";
27.25 \<close>
28.1 --- a/src/Tools/isac/MathEngBasic/istate-def.sml Sat Feb 04 16:49:08 2023 +0100
28.2 +++ b/src/Tools/isac/MathEngBasic/istate-def.sml Sat Feb 04 17:00:25 2023 +0100
28.3 @@ -59,14 +59,14 @@
28.4 let
28.5 val ctxt = Proof_Context.init_global (Know_Store.get_via_last_thy "Isac_Knowledge")
28.6 in
28.7 - "SOME " ^ UnparseC.term_in_ctxt ctxt t
28.8 + "SOME " ^ UnparseC.term ctxt t
28.9 end;
28.10 fun pstate2str {env, path, eval, form_arg, act_arg, or, found_accept, assoc} =
28.11 let
28.12 val ctxt = Proof_Context.init_global (Know_Store.get_via_last_thy "Isac_Knowledge")
28.13 in
28.14 "(" ^ Env.env2str env ^ ", " ^ TermC.string_of_path path ^ ", " ^ Rule_Set.id eval ^ ", " ^
28.15 - topt2str form_arg ^ ", \n" ^ UnparseC.term_in_ctxt ctxt act_arg ^ ", " ^ asap2str or ^ ", " ^
28.16 + topt2str form_arg ^ ", \n" ^ UnparseC.term ctxt act_arg ^ ", " ^ asap2str or ^ ", " ^
28.17 bool2str found_accept ^ ", " ^ bool2str assoc ^ ")"
28.18 end;
28.19 fun pstate2str' {env, path, eval, form_arg, act_arg, or, found_accept, assoc} =
28.20 @@ -74,7 +74,7 @@
28.21 val ctxt = Proof_Context.init_global (Know_Store.get_via_last_thy "Isac_Knowledge")
28.22 in
28.23 "(" ^ Env.env2str' env ^ ", " ^ TermC.string_of_path path ^ ", " ^ Rule_Set.id eval ^ ", " ^
28.24 - topt2str form_arg ^ ", " ^ UnparseC.term_in_ctxt ctxt act_arg ^ ", " ^ asap2str or ^ ", " ^
28.25 + topt2str form_arg ^ ", " ^ UnparseC.term ctxt act_arg ^ ", " ^ asap2str or ^ ", " ^
28.26 bool2str found_accept ^ ", " ^ bool2str assoc ^ ")"
28.27 end;
28.28
28.29 @@ -86,13 +86,13 @@
28.30 val empty = Pstate e_pstate;
28.31
28.32 fun rta2str ctxt (r, (t, a)) =
28.33 - "\n(" ^ Rule.to_string ctxt r ^ ", (" ^ UnparseC.term_in_ctxt ctxt t ^ ", " ^
28.34 - UnparseC.terms_in_ctxt ctxt a ^ "))";
28.35 + "\n(" ^ Rule.to_string ctxt r ^ ", (" ^ UnparseC.term ctxt t ^ ", " ^
28.36 + UnparseC.terms ctxt a ^ "))";
28.37 fun string_of _ Uistate = "Uistate"
28.38 | string_of _ (Pstate pst) =
28.39 "Pstate " ^ pstate2str pst
28.40 | string_of ctxt (RrlsState (t, t1, rss, rtas)) =
28.41 - "RrlsState (" ^ UnparseC.term_in_ctxt ctxt t ^ ", " ^ UnparseC.term_in_ctxt ctxt t1 ^ ", " ^
28.42 + "RrlsState (" ^ UnparseC.term ctxt t ^ ", " ^ UnparseC.term ctxt t1 ^ ", " ^
28.43 (strs2str o (map (strs2str o (map (Rule.to_string ctxt))))) rss ^ ", " ^
28.44 (strs2str o (map (rta2str ctxt))) rtas ^ ")";
28.45 fun string_of' Uistate = "Uistate"
29.1 --- a/src/Tools/isac/MathEngBasic/model-def.sml Sat Feb 04 16:49:08 2023 +0100
29.2 +++ b/src/Tools/isac/MathEngBasic/model-def.sml Sat Feb 04 17:00:25 2023 +0100
29.3 @@ -70,7 +70,7 @@
29.4
29.5 fun o_model_single_to_string ctxt (i, vs, fi, t, ts) =
29.6 "(" ^ string_of_int i ^ ", " ^ (strs2str o (map string_of_int)) vs ^ ", " ^ fi ^ ", " ^
29.7 - UnparseC.term_in_ctxt ctxt t ^ ", " ^ (strs2str o (map (UnparseC.term_in_ctxt ctxt))) ts ^ ")";
29.8 + UnparseC.term ctxt t ^ ", " ^ (strs2str o (map (UnparseC.term ctxt))) ts ^ ")";
29.9 fun o_model_to_string ctxt o_model =
29.10 (strs2str' o (map (linefeed o (o_model_single_to_string ctxt)))) o_model;
29.11
30.1 --- a/src/Tools/isac/MathEngBasic/rewrite.sml Sat Feb 04 16:49:08 2023 +0100
30.2 +++ b/src/Tools/isac/MathEngBasic/rewrite.sml Sat Feb 04 17:00:25 2023 +0100
30.3 @@ -64,32 +64,32 @@
30.4 if Config.get ctxt rewrite_trace andalso i < Config.get ctxt rewrite_trace_depth
30.5 then tracing (idt "#" i ^ str) else ()
30.6 fun trace_eq1 ctxt i str rrls t =
30.7 - trace ctxt i (" " ^ str ^ ": " ^ Rule_Set.id rrls ^ " on: " ^ UnparseC.term_in_ctxt ctxt t)
30.8 + trace ctxt i (" " ^ str ^ ": " ^ Rule_Set.id rrls ^ " on: " ^ UnparseC.term ctxt t)
30.9 fun trace_eq2 ctxt i str t t' =
30.10 trace ctxt i (" " ^ str ^ ": \"" ^
30.11 - UnparseC.term_in_ctxt ctxt t ^ "\" > \"" ^ UnparseC.term_in_ctxt ctxt t' ^ "\"");
30.12 + UnparseC.term ctxt t ^ "\" > \"" ^ UnparseC.term ctxt t' ^ "\"");
30.13 fun trace1 ctxt i str =
30.14 if Config.get ctxt rewrite_trace andalso i < Config.get ctxt rewrite_trace_depth
30.15 then tracing (idt "#" (i + 1) ^ str) else ()
30.16 fun trace_in1 ctxt i str thmid =
30.17 trace1 ctxt i (" " ^ str ^ ": \"" ^ thmid ^ "\"")
30.18 fun trace_in2 ctxt i str t =
30.19 - trace1 ctxt i (" " ^ str ^ ": \"" ^ UnparseC.term_in_ctxt ctxt t ^ "\"");
30.20 + trace1 ctxt i (" " ^ str ^ ": \"" ^ UnparseC.term ctxt t ^ "\"");
30.21 fun trace_in3 ctxt i str pairopt =
30.22 - trace1 ctxt i (" " ^ str ^ ": " ^ UnparseC.term_in_ctxt ctxt ((fst o the) pairopt));
30.23 + trace1 ctxt i (" " ^ str ^ ": " ^ UnparseC.term ctxt ((fst o the) pairopt));
30.24 fun trace_in4 ctxt i str ts ts' =
30.25 if Config.get ctxt rewrite_trace andalso i < Config.get ctxt rewrite_trace_depth andalso ts <> []
30.26 - then tracing (idt "#" (i + 1) ^ " " ^ str ^ ": " ^ UnparseC.terms_in_ctxt ctxt ts ^
30.27 - " stored: " ^ UnparseC.terms_in_ctxt ctxt ts')
30.28 + then tracing (idt "#" (i + 1) ^ " " ^ str ^ ": " ^ UnparseC.terms ctxt ts ^
30.29 + " stored: " ^ UnparseC.terms ctxt ts')
30.30 else ();
30.31 fun trace_in5 ctxt i str p' =
30.32 if Config.get ctxt rewrite_trace andalso i < Config.get ctxt rewrite_trace_depth
30.33 - then tracing (idt "#" (i + 1) ^ " " ^ str ^ ": " ^ UnparseC.terms_in_ctxt ctxt p')
30.34 + then tracing (idt "#" (i + 1) ^ " " ^ str ^ ": " ^ UnparseC.terms ctxt p')
30.35 else();
30.36 fun msg call ctxt op_ thmC t =
30.37 call ^ ": \n" ^
30.38 "Eval.get_pair for " ^ quote op_ ^ " \<longrightarrow> SOME (_, " ^ quote (ThmC.string_of_thm ctxt thmC) ^ ")\n" ^
30.39 - "but rewrite__ on " ^ quote (UnparseC.term_in_ctxt ctxt t) ^ " \<longrightarrow> NONE";
30.40 + "but rewrite__ on " ^ quote (UnparseC.term ctxt t) ^ " \<longrightarrow> NONE";
30.41
30.42 fun rewrite__ ctxt i bdv tless rls put_asm thm ct =
30.43 let
30.44 @@ -152,7 +152,7 @@
30.45 else chk (indets @ [t] @ a') asms);
30.46 in chk [] asms end
30.47 and rewrite__set_ ctxt (*1*)_ _ _ Rule_Set.Empty t = (* rewrite with a rule set*)
30.48 - raise ERROR ("rewrite__set_ called with 'Erls' for '" ^ UnparseC.term_in_ctxt ctxt t ^ "'")
30.49 + raise ERROR ("rewrite__set_ called with 'Erls' for '" ^ UnparseC.term ctxt t ^ "'")
30.50 | rewrite__set_ (*2*)ctxt i _ _ (rrls as Rule_Set.Rrls _) t = (* rewrite with a 'reverse rule set'*)
30.51 let
30.52 val _= trace_eq1 ctxt i "rls" rrls t;
30.53 @@ -199,7 +199,7 @@
30.54 val pairopt = rewrite__ ctxt (i + 1) bdv ((snd o #rew_ord o Rule_Set.rep) rls)
30.55 ((#asm_rls o Rule_Set.rep) rls) put_asm thm' ct;
30.56 val _ = if pairopt <> NONE then () else raise ERROR ("rewrite_set_, rewrite_ \"" ^
30.57 - ThmC.string_of_thm ctxt thm' ^ "\" " ^ UnparseC.term_in_ctxt ctxt ct ^ " = NONE")
30.58 + ThmC.string_of_thm ctxt thm' ^ "\" " ^ UnparseC.term ctxt ct ^ " = NONE")
30.59 val _ = trace_in3 ctxt i "cal1. to" pairopt;
30.60 in the pairopt end
30.61 end
31.1 --- a/src/Tools/isac/MathEngBasic/state-steps.sml Sat Feb 04 16:49:08 2023 +0100
31.2 +++ b/src/Tools/isac/MathEngBasic/state-steps.sml Sat Feb 04 17:00:25 2023 +0100
31.3 @@ -57,7 +57,7 @@
31.4 Tactic.Rewrite_Set' ("Isac_Knowledge", false, rls, t, (t', a)),
31.5 (Pos.e_pos'(*to be updated before generate tacis!!!*), (Istate_Def.Uistate, ContextC.empty)))
31.6 | make_single ctxt _ _ (t, r, _) = raise ERROR ("State_Steps.make_single: not impl. for " ^
31.7 - Rule.to_string ctxt r ^ " at " ^ UnparseC.term_in_ctxt ctxt t)
31.8 + Rule.to_string ctxt r ^ " at " ^ UnparseC.term ctxt t)
31.9
31.10 (* update pos in tacis for embedding by generate *)
31.11 fun insert_pos (_: Pos.pos) [] = []
32.1 --- a/src/Tools/isac/MathEngBasic/tactic.sml Sat Feb 04 16:49:08 2023 +0100
32.2 +++ b/src/Tools/isac/MathEngBasic/tactic.sml Sat Feb 04 17:00:25 2023 +0100
32.3 @@ -171,9 +171,9 @@
32.4 | Free_Solve => "Free_Solve"
32.5
32.6 | Rewrite_Inst (subs, (id, thm)) => "Rewrite_Inst " ^
32.7 - (pair2str (subs2str subs, spair2str (id, thm |> Thm.prop_of |> UnparseC.term_in_ctxt ctxt)))
32.8 + (pair2str (subs2str subs, spair2str (id, thm |> Thm.prop_of |> UnparseC.term ctxt)))
32.9 | Rewrite (id, thm) => "Rewrite " ^
32.10 - spair2str (id, thm |> Thm.prop_of |> UnparseC.term_in_ctxt ctxt)
32.11 + spair2str (id, thm |> Thm.prop_of |> UnparseC.term ctxt)
32.12 | Rewrite_Set_Inst (subs, rls) =>
32.13 "Rewrite_Set_Inst " ^ pair2str (subs2str subs, quote rls)
32.14 | Rewrite_Set rls => "Rewrite_Set " ^ quote rls
32.15 @@ -394,7 +394,7 @@
32.16
32.17 | Apply_Method' (metID, _, _, _) => "Apply_Method' " ^ strs2str metID
32.18 | Check_Postcond' (pblID, scval) => "Check_Postcond' " ^
32.19 - (spair2str (strs2str pblID, UnparseC.term_in_ctxt ctxt scval))
32.20 + (spair2str (strs2str pblID, UnparseC.term ctxt scval))
32.21
32.22 | Free_Solve' => "Free_Solve'"
32.23
32.24 @@ -402,8 +402,8 @@
32.25 | Rewrite' _(*thm'*) => "Rewrite' "(*^(spair2str thm')*)
32.26 | Rewrite_Set_Inst' _(*subs,thm'*) => "Rewrite_Set_Inst' "(*^(pair2str (subs2str subs, quote rls))*)
32.27 | Rewrite_Set' (thy', pasm, rls', f, (f', asm)) => "Rewrite_Set' (" ^ thy' ^ ", " ^ bool2str pasm ^
32.28 - ", " ^ Rule_Set.id rls' ^ ", " ^ UnparseC.term_in_ctxt ctxt f ^ ",(" ^
32.29 - UnparseC.term_in_ctxt ctxt f' ^ ", " ^ UnparseC.terms_in_ctxt ctxt asm ^ "))"
32.30 + ", " ^ Rule_Set.id rls' ^ ", " ^ UnparseC.term ctxt f ^ ",(" ^
32.31 + UnparseC.term ctxt f' ^ ", " ^ UnparseC.terms ctxt asm ^ "))"
32.32 | End_Detail' _ => "End_Detail' xxx"
32.33
32.34 | Derive' rls => "Derive' " ^ Rule_Set.id rls
32.35 @@ -444,7 +444,7 @@
32.36 | input_from_T _ (Check_elementwise' (_, pred, _)) = Check_elementwise pred
32.37
32.38 | input_from_T _ (Or_to_List' _) = Or_to_List
32.39 - | input_from_T ctxt (Take' term) = Take (UnparseC.term_in_ctxt ctxt term)
32.40 + | input_from_T ctxt (Take' term) = Take (UnparseC.term ctxt term)
32.41 | input_from_T ctxt (Substitute' (_, _, subte, _, _)) = Substitute (Subst.eqs_to_input ctxt subte)
32.42 | input_from_T _ (Tac_ (_, _, id, _)) = Tac id
32.43
33.1 --- a/src/Tools/isac/MathEngBasic/thmC.sml Sat Feb 04 16:49:08 2023 +0100
33.2 +++ b/src/Tools/isac/MathEngBasic/thmC.sml Sat Feb 04 17:00:25 2023 +0100
33.3 @@ -63,7 +63,7 @@
33.4
33.5 \<^isac_test>\<open>
33.6 fun string_of_thm_in_thy thy thm =
33.7 - UnparseC.term_in_ctxt (Proof_Context.init_global thy) (Thm.prop_of thm);
33.8 + UnparseC.term (Proof_Context.init_global thy) (Thm.prop_of thm);
33.9 \<close>
33.10 fun member' thmIDs thm = (member op = thmIDs (Rule.thm_id thm))
33.11 handle ERROR _ => false
34.1 --- a/src/Tools/isac/MathEngine/me-misc.sml Sat Feb 04 16:49:08 2023 +0100
34.2 +++ b/src/Tools/isac/MathEngine/me-misc.sml Sat Feb 04 17:00:25 2023 +0100
34.3 @@ -100,7 +100,7 @@
34.4 else
34.5 if f = Ctree.get_obj Ctree.g_form pt p'
34.6 then SOME (Ctree.get_obj Ctree.g_tac pt p') (*because this Frm ~~~is not on worksheet*)
34.7 - else SOME (Tactic.Take (UnparseC.term_in_ctxt ctxt (Ctree.get_obj Ctree.g_form pt p')))
34.8 + else SOME (Tactic.Take (UnparseC.term ctxt (Ctree.get_obj Ctree.g_form pt p')))
34.9 end
34.10 in (Ctree.Form f, tac, asm) end
34.11 | pt_extract ctxt (pt, (p, p_(*Frm,Pbl*))) =
35.1 --- a/src/Tools/isac/ProgLang/Auto_Prog.thy Sat Feb 04 16:49:08 2023 +0100
35.2 +++ b/src/Tools/isac/ProgLang/Auto_Prog.thy Sat Feb 04 17:00:25 2023 +0100
35.3 @@ -149,14 +149,14 @@
35.4 fun op #>@ sts [s] = SEq $ s $ sts
35.5 | op #>@ sts (s::ss) = op #>@ (SEq $ s $ sts) ss
35.6 | op #>@ t ts =
35.7 - raise ERROR ("fun #>@ not applicable to \"" ^ UnparseC.term_in_ctxt @{context} t ^ "\" \"" ^
35.8 - UnparseC.terms_in_ctxt @{context} ts ^ "\"");
35.9 + raise ERROR ("fun #>@ not applicable to \"" ^ UnparseC.term @{context} t ^ "\" \"" ^
35.10 + UnparseC.terms @{context} ts ^ "\"");
35.11 (*IS NOT*)
35.12 fun op #> [stac] = stac
35.13 | op #> [s1, s2] = SEq $ s1 $ s2
35.14 | op #> stacs = case rev stacs of
35.15 s3 :: s2 :: ss => op #>@ (SEq $ s2 $ s3) ss
35.16 - | ts => raise ERROR ("fun #> not applicable to \"" ^ UnparseC.terms_in_ctxt @{context} ts ^ "\"")
35.17 + | ts => raise ERROR ("fun #> not applicable to \"" ^ UnparseC.terms @{context} ts ^ "\"")
35.18
35.19 val contains_bdv = not o null o filter TermC.is_bdv o TermC.ids2str o Thm.prop_of;
35.20
36.1 --- a/src/Tools/isac/ProgLang/Calc_Binop.thy Sat Feb 04 16:49:08 2023 +0100
36.2 +++ b/src/Tools/isac/ProgLang/Calc_Binop.thy Sat Feb 04 17:00:25 2023 +0100
36.3 @@ -56,7 +56,7 @@
36.4 val opp' = Const (if c1 = \<^const_name>\<open>minus\<close> then \<^const_name>\<open>plus\<close> else c1, T);
36.5 val res = simplify ctxt (opp' $ t1 $ t2);
36.6 val prop = HOLogic.Trueprop $ (HOLogic.mk_eq (t, opp $ v $ res));
36.7 - in SOME ("#: " ^ UnparseC.term_in_ctxt @{context} prop, prop) end
36.8 + in SOME ("#: " ^ UnparseC.term @{context} prop, prop) end
36.9 (* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^anyway to be improved vor PIDE*)
36.10 else NONE
36.11 | (opp as Const (c1, _)) $ t1 $ (Const (c2, _) $ t2 $ v) => (* binary \<circ> n1 \<circ> (n2 \<circ> v) *)
36.12 @@ -67,7 +67,7 @@
36.13 val res = simplify ctxt (opp $ t1 $ t2);
36.14 val prop = HOLogic.Trueprop $ HOLogic.mk_eq (t, opp $ res $ v);
36.15 in
36.16 - SOME ("#: " ^ UnparseC.term_in_ctxt @{context} prop, prop)
36.17 + SOME ("#: " ^ UnparseC.term @{context} prop, prop)
36.18 (* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^anyway to be improved vor PIDE*)
36.19 end
36.20 else NONE
36.21 @@ -77,7 +77,7 @@
36.22 val res = simplify ctxt t;
36.23 val prop = HOLogic.Trueprop $ (HOLogic.mk_eq (t, res));
36.24 in
36.25 - SOME ("#: " ^ UnparseC.term_in_ctxt @{context} prop, prop)
36.26 + SOME ("#: " ^ UnparseC.term @{context} prop, prop)
36.27 (* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^anyway to be improved vor PIDE*)
36.28 end
36.29 else NONE
37.1 --- a/src/Tools/isac/ProgLang/Prog_Expr.thy Sat Feb 04 16:49:08 2023 +0100
37.2 +++ b/src/Tools/isac/ProgLang/Prog_Expr.thy Sat Feb 04 17:00:25 2023 +0100
37.3 @@ -104,11 +104,11 @@
37.4 then
37.5 let
37.6 val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))
37.7 - in SOME (UnparseC.term_in_ctxt ctxt prop, prop) end
37.8 + in SOME (UnparseC.term ctxt prop, prop) end
37.9 else
37.10 let
37.11 val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))
37.12 - in SOME (UnparseC.term_in_ctxt ctxt prop, prop) end
37.13 + in SOME (UnparseC.term ctxt prop, prop) end
37.14 | eval_matches _ _ _ _ = NONE;
37.15
37.16 (*.does a pattern match some subterm ?.*)
37.17 @@ -131,10 +131,10 @@
37.18 if matchsub (Proof_Context.theory_of ctxt) tst pat
37.19 then
37.20 let val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))
37.21 - in SOME (UnparseC.term_in_ctxt ctxt prop, prop) end
37.22 + in SOME (UnparseC.term ctxt prop, prop) end
37.23 else
37.24 let val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))
37.25 - in SOME (UnparseC.term_in_ctxt ctxt prop, prop) end
37.26 + in SOME (UnparseC.term ctxt prop, prop) end
37.27 | eval_matchsub _ _ _ _ = NONE;
37.28
37.29 (*get the variables in an isabelle-term*)
37.30 @@ -142,21 +142,21 @@
37.31 fun eval_var (thmid:string) "Prog_Expr.Vars" (t as (Const _ $ arg)) ctxt =
37.32 let
37.33 val t' = ((TermC.list2isalist HOLogic.realT) o TermC.vars) t;
37.34 - val thmId = thmid ^ UnparseC.term_in_ctxt ctxt arg;
37.35 + val thmId = thmid ^ UnparseC.term ctxt arg;
37.36 in SOME (thmId, HOLogic.Trueprop $ (TermC.mk_equality (t, t'))) end
37.37 | eval_var _ _ _ _ = NONE;
37.38
37.39 (*("lhs" ,("Prog_Expr.lhs" , eval_lhs "")):calc*)
37.40 fun eval_lhs _ "Prog_Expr.lhs" (t as (Const (\<^const_name>\<open>lhs\<close>,_) $ (Const (\<^const_name>\<open>HOL.eq\<close>,_) $ l $ _))) _ =
37.41 - SOME ((UnparseC.term_in_ctxt @{context} t) ^ " = " ^ (UnparseC.term_in_ctxt @{context} l),
37.42 + SOME ((UnparseC.term @{context} t) ^ " = " ^ (UnparseC.term @{context} l),
37.43 HOLogic.Trueprop $ (TermC.mk_equality (t, l)))
37.44 | eval_lhs _ _ _ _ = NONE;
37.45
37.46 fun rhs (Const (\<^const_name>\<open>HOL.eq\<close>,_) $ _ $ r) = r
37.47 - | rhs t = raise ERROR("rhs called with (" ^ UnparseC.term_in_ctxt @{context} t ^ ")");
37.48 + | rhs t = raise ERROR("rhs called with (" ^ UnparseC.term @{context} t ^ ")");
37.49 (*("rhs" ,("Prog_Expr.rhs" , eval_rhs "")):calc*)
37.50 fun eval_rhs _ "Prog_Expr.rhs" (t as (Const (\<^const_name>\<open>rhs\<close>,_) $ (Const (\<^const_name>\<open>HOL.eq\<close>,_) $ _ $ r))) _ =
37.51 - SOME (UnparseC.term_in_ctxt @{context} t ^ " = " ^ UnparseC.term_in_ctxt @{context} r,
37.52 + SOME (UnparseC.term @{context} t ^ " = " ^ UnparseC.term @{context} r,
37.53 HOLogic.Trueprop $ (TermC.mk_equality (t, r)))
37.54 | eval_rhs _ _ _ _ = NONE;
37.55
37.56 @@ -164,12 +164,12 @@
37.57 fun occurs_in v t = member op = (((map strip_thy) o TermC.ids2str) t) (Term.term_name v);
37.58 (*("occurs_in", ("Prog_Expr.occurs_in", Prog_Expr.eval_occurs_in ""))*)
37.59 fun eval_occurs_in _ "Prog_Expr.occurs_in" (p as (Const (\<^const_name>\<open>occurs_in\<close>, _) $ v $ t)) _ =
37.60 - ((*tracing("#>@ eval_occurs_in: v= " ^ UnparseC.term_in_ctxt @{context} v);
37.61 - tracing("#>@ eval_occurs_in: t= " ^ UnparseC.term_in_ctxt @{context} t);*)
37.62 + ((*tracing("#>@ eval_occurs_in: v= " ^ UnparseC.term @{context} v);
37.63 + tracing("#>@ eval_occurs_in: t= " ^ UnparseC.term @{context} t);*)
37.64 if occurs_in v t
37.65 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
37.66 + then SOME ((UnparseC.term @{context} p) ^ " = True",
37.67 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
37.68 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
37.69 + else SOME ((UnparseC.term @{context} p) ^ " = False",
37.70 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))))
37.71 | eval_occurs_in _ _ _ _ = NONE;
37.72
37.73 @@ -183,9 +183,9 @@
37.74 fun eval_some_occur_in _ "Prog_Expr.some_occur_in"
37.75 (p as (Const (\<^const_name>\<open>some_occur_in\<close>,_) $ vs $ t)) _ =
37.76 if some_occur_in (TermC.isalist2list vs) t
37.77 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
37.78 + then SOME ((UnparseC.term @{context} p) ^ " = True",
37.79 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
37.80 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
37.81 + else SOME ((UnparseC.term @{context} p) ^ " = False",
37.82 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
37.83 | eval_some_occur_in _ _ _ _ = NONE;
37.84
37.85 @@ -270,11 +270,11 @@
37.86 ----------- thus needs Rule.Eval !
37.87 > val t = TermC.parse_test @{context} "0 = 0";
37.88 > val SOME (t',_) = rewrite_ thy Rewrite_Ord.function_empty Rule_Set.empty false reflI t;
37.89 -> UnparseC.term_in_ctxt @{context} t';
37.90 +> UnparseC.term @{context} t';
37.91 val it = \<^const_name>\<open>True\<close>
37.92
37.93 val t = TermC.parse_test @{context} "Not (x = 0)";
37.94 -atomt t; UnparseC.term_in_ctxt @{context} t;
37.95 +atomt t; UnparseC.term @{context} t;
37.96 *** -------------
37.97 *** Const ( Not)
37.98 *** . Const ( op =)
37.99 @@ -289,28 +289,28 @@
37.100 (Const _(*op0, t0*) $ t1 $ t2 )) ctxt =
37.101 if t1 = t2
37.102 then SOME (TermC.mk_thmid thmid
37.103 - ("(" ^ (UnparseC.term_in_ctxt ctxt t1) ^ ")")
37.104 - ("(" ^ (UnparseC.term_in_ctxt ctxt t2) ^ ")"),
37.105 + ("(" ^ (UnparseC.term ctxt t1) ^ ")")
37.106 + ("(" ^ (UnparseC.term ctxt t2) ^ ")"),
37.107 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
37.108 else SOME (TermC.mk_thmid thmid
37.109 - ("(" ^ (UnparseC.term_in_ctxt ctxt t1) ^ ")")
37.110 - ("(" ^ (UnparseC.term_in_ctxt ctxt t2) ^ ")"),
37.111 + ("(" ^ (UnparseC.term ctxt t1) ^ ")")
37.112 + ("(" ^ (UnparseC.term ctxt t2) ^ ")"),
37.113 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
37.114 | eval_ident _ _ _ _ = NONE;
37.115 (* TODO
37.116 > val t = TermC.parse_test @{context} "x =!= 0";
37.117 > val SOME (str, t') = eval_ident "ident_" "b" t thy;
37.118 -> UnparseC.term_in_ctxt @{context} t';
37.119 +> UnparseC.term @{context} t';
37.120 val str = "ident_(x)_(0)" : string
37.121 val it = "(x =!= 0) = False" : string
37.122 > val t = TermC.parse_test @{context} "1 =!= 0";
37.123 > val SOME (str, t') = eval_ident "ident_" "b" t thy;
37.124 -> UnparseC.term_in_ctxt @{context} t';
37.125 +> UnparseC.term @{context} t';
37.126 val str = "ident_(1)_(0)" : string
37.127 val it = "(1 =!= 0) = False" : string
37.128 > val t = TermC.parse_test @{context} "0 =!= 0";
37.129 > val SOME (str, t') = eval_ident "ident_" "b" t thy;
37.130 -> UnparseC.term_in_ctxt @{context} t';
37.131 +> UnparseC.term @{context} t';
37.132 val str = "ident_(0)_(0)" : string
37.133 val it = "(0 =!= 0) = True" : string
37.134 *)
37.135 @@ -323,7 +323,7 @@
37.136 if t1 = t2
37.137 then
37.138 SOME (TermC.mk_thmid thmid
37.139 - ("(" ^ UnparseC.term_in_ctxt ctxt t1 ^ ")") ("(" ^ UnparseC.term_in_ctxt ctxt t2 ^ ")"),
37.140 + ("(" ^ UnparseC.term ctxt t1 ^ ")") ("(" ^ UnparseC.term ctxt t2 ^ ")"),
37.141 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
37.142 else
37.143 (case (TermC.is_atom t1, TermC.is_atom t2) of
37.144 @@ -331,7 +331,7 @@
37.145 if TermC.variable_constant_pair (t1, t2)
37.146 then NONE
37.147 else SOME (TermC.mk_thmid thmid
37.148 - ("(" ^ UnparseC.term_in_ctxt ctxt t1 ^ ")") ("(" ^ UnparseC.term_in_ctxt ctxt t2 ^ ")"),
37.149 + ("(" ^ UnparseC.term ctxt t1 ^ ")") ("(" ^ UnparseC.term ctxt t2 ^ ")"),
37.150 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
37.151 | _ => NONE) (* NOT is_atom t1,t2 --> rew_sub *)
37.152 | eval_equal _ _ _ _ = NONE; (* error-exit *)
37.153 @@ -361,7 +361,7 @@
37.154 (t as (Const ("Prog_Expr.argument_in", _) $ (_(*f*) $ arg))) _ =
37.155 if TermC.is_atom arg (*could be something to be simplified before*)
37.156 then
37.157 - SOME (UnparseC.term_in_ctxt @{context} t ^ " = " ^ UnparseC.term_in_ctxt @{context} arg,
37.158 + SOME (UnparseC.term @{context} t ^ " = " ^ UnparseC.term @{context} arg,
37.159 HOLogic.Trueprop $ (TermC.mk_equality (t, arg)))
37.160 else NONE
37.161 | eval_argument_in _ _ _ _ = NONE;
37.162 @@ -372,9 +372,9 @@
37.163 fun eval_sameFunId _ "Prog_Expr.sameFunId"
37.164 (p as Const ("Prog_Expr.sameFunId",_) $ (f1 $ _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ (f2 $ _) $ _)) _ =
37.165 if f1 = f2
37.166 - then SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = True",
37.167 + then SOME ((UnparseC.term @{context} p) ^ " = True",
37.168 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
37.169 - else SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = False",
37.170 + else SOME ((UnparseC.term @{context} p) ^ " = False",
37.171 HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
37.172 | eval_sameFunId _ _ _ _ = NONE;
37.173
37.174 @@ -385,7 +385,7 @@
37.175 this is, because Isabelles filter takes more than 1 sec.*)
37.176 fun same_funid f1 (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ (f2 $ _) $ _) = f1 = f2
37.177 | same_funid f1 t = raise ERROR ("same_funid called with t = ("
37.178 - ^ UnparseC.term_in_ctxt @{context} f1 ^ ") (" ^ UnparseC.term_in_ctxt @{context} t ^ ")");
37.179 + ^ UnparseC.term @{context} f1 ^ ") (" ^ UnparseC.term @{context} t ^ ")");
37.180 (*("filter_sameFunId" ,("Prog_Expr.filter_sameFunId",
37.181 eval_filter_sameFunId "Prog_Expr.filter_sameFunId"))*)
37.182 fun eval_filter_sameFunId _ "Prog_Expr.filter_sameFunId"
37.183 @@ -393,7 +393,7 @@
37.184 (fid $ _) $ fs) _ =
37.185 let val fs' = ((TermC.list2isalist HOLogic.boolT) o
37.186 (filter (same_funid fid))) (TermC.isalist2list fs)
37.187 - in SOME (UnparseC.term_in_ctxt @{context} (TermC.mk_equality (p, fs')),
37.188 + in SOME (UnparseC.term @{context} (TermC.mk_equality (p, fs')),
37.189 HOLogic.Trueprop $ (TermC.mk_equality (p, fs'))) end
37.190 | eval_filter_sameFunId _ _ _ _ = NONE;
37.191
37.192 @@ -418,7 +418,7 @@
37.193 val lhss = map TermC.lhs isal
37.194 val sum = list2sum lhss
37.195 in
37.196 - SOME ((UnparseC.term_in_ctxt @{context} p) ^ " = " ^ (UnparseC.term_in_ctxt @{context} sum),
37.197 + SOME ((UnparseC.term @{context} p) ^ " = " ^ (UnparseC.term @{context} sum),
37.198 HOLogic.Trueprop $ (TermC.mk_equality (p, sum)))
37.199 end
37.200 | eval_boollist2sum _ _ _ _ = NONE;
38.1 --- a/src/Tools/isac/ProgLang/evaluate.sml Sat Feb 04 16:49:08 2023 +0100
38.2 +++ b/src/Tools/isac/ProgLang/evaluate.sml Sat Feb 04 17:00:25 2023 +0100
38.3 @@ -95,7 +95,7 @@
38.4
38.5 (** calculate numerals **)
38.6
38.7 -fun popt2str ctxt (SOME (_, term)) = "SOME " ^ UnparseC.term_in_ctxt ctxt term (*TODO \<longrightarrow> str_of_termopt*)
38.8 +fun popt2str ctxt (SOME (_, term)) = "SOME " ^ UnparseC.term ctxt term (*TODO \<longrightarrow> str_of_termopt*)
38.9 | popt2str _ NONE = "NONE";
38.10
38.11 (* scan a term for applying eval_fn ef
38.12 @@ -116,12 +116,12 @@
38.13 if Config.get ctxt eval_trace then writeln (str1 ^ str2) else ()
38.14 fun trace_calc2 ctxt str term popt =
38.15 if Config.get ctxt eval_trace
38.16 - then writeln (str ^ UnparseC.term_in_ctxt ctxt term ^ " , " ^ popt2str ctxt popt) else ()
38.17 + then writeln (str ^ UnparseC.term ctxt term ^ " , " ^ popt2str ctxt popt) else ()
38.18 fun trace_calc3 ctxt str term =
38.19 - if Config.get ctxt eval_trace then writeln ("### " ^ str ^ UnparseC.term_in_ctxt ctxt term) else ()
38.20 + if Config.get ctxt eval_trace then writeln ("### " ^ str ^ UnparseC.term ctxt term) else ()
38.21 fun trace_calc4 ctxt str t1 t2 =
38.22 if Config.get ctxt eval_trace
38.23 - then writeln ("### " ^ str ^ UnparseC.term_in_ctxt ctxt t1 ^ " $ " ^ UnparseC.term_in_ctxt ctxt t2) else ()
38.24 + then writeln ("### " ^ str ^ UnparseC.term ctxt t1 ^ " $ " ^ UnparseC.term ctxt t2) else ()
38.25
38.26 fun get_pair (*1*)ctxt op_ (ef: ml_fun) (t as (Const (op0, _) $ arg)) = (* unary fns *)
38.27 if op_ = op0 then
39.1 --- a/src/Tools/isac/Specify/i-model.sml Sat Feb 04 16:49:08 2023 +0100
39.2 +++ b/src/Tools/isac/Specify/i-model.sml Sat Feb 04 17:00:25 2023 +0100
39.3 @@ -73,18 +73,18 @@
39.4 type message = string;
39.5
39.6 fun pen2str ctxt (t, ts) =
39.7 - pair2str (UnparseC.term_in_ctxt ctxt t, (strs2str' o map (UnparseC.term_in_ctxt ctxt)) ts);
39.8 + pair2str (UnparseC.term ctxt t, (strs2str' o map (UnparseC.term ctxt)) ts);
39.9
39.10 fun feedback_to_string ctxt (Cor ((d, ts), penv)) =
39.11 - "Cor " ^ UnparseC.term_in_ctxt ctxt (Input_Descript.join (d, ts)) ^ " ," ^ pen2str ctxt penv
39.12 + "Cor " ^ UnparseC.term ctxt (Input_Descript.join (d, ts)) ^ " ," ^ pen2str ctxt penv
39.13 | feedback_to_string _ (Syn c) = "Syn " ^ c
39.14 | feedback_to_string _ (Typ c) = "Typ " ^ c
39.15 | feedback_to_string ctxt (Inc ((d, ts), penv)) =
39.16 - "Inc " ^ UnparseC.term_in_ctxt ctxt (Input_Descript.join (d, ts)) ^ " ," ^ pen2str ctxt penv
39.17 + "Inc " ^ UnparseC.term ctxt (Input_Descript.join (d, ts)) ^ " ," ^ pen2str ctxt penv
39.18 | feedback_to_string ctxt (Sup (d, ts)) =
39.19 - "Sup " ^ UnparseC.term_in_ctxt ctxt (Input_Descript.join (d, ts))
39.20 + "Sup " ^ UnparseC.term ctxt (Input_Descript.join (d, ts))
39.21 | feedback_to_string ctxt (Mis (d, pid)) =
39.22 - "Mis "^ UnparseC.term_in_ctxt ctxt d ^ " " ^ UnparseC.term_in_ctxt ctxt pid
39.23 + "Mis "^ UnparseC.term ctxt d ^ " " ^ UnparseC.term ctxt pid
39.24 | feedback_to_string _ (Par s) = "Trm "^s;
39.25 fun feedback_to_string' t = feedback_to_string (ThyC.id_to_ctxt "Isac_Knowledge") t;
39.26
39.27 @@ -231,7 +231,7 @@
39.28 let val ts' = inter op = (o_model_values itm_) ts
39.29 in
39.30 if subset op = (ts, ts')
39.31 - then (((strs2str' o map (UnparseC.term_in_ctxt ctxt)) ts') ^ " already input", empty_single)
39.32 + then (((strs2str' o map (UnparseC.term ctxt)) ts') ^ " already input", empty_single)
39.33 else ("", ori_2itm itm_ pid all (i, v, f, d, subtract op = ts' ts))
39.34 end
39.35 | NONE => ("", ori_2itm (Inc ((TermC.empty, []), (pid, []))) pid all (i, v, f, d, ts)))
39.36 @@ -290,10 +290,10 @@
39.37 in
39.38 case Model_Pattern.get_field descriptor m_patt of
39.39 NONE => Err ("ERROR I_Model.check_single: unknown descriptor \"" ^
39.40 - UnparseC.term_in_ctxt ctxt descriptor ^ "\"")
39.41 + UnparseC.term ctxt descriptor ^ "\"")
39.42 | SOME m_field' =>
39.43 if m_field <> m_field' then
39.44 - Err ("ERROR I_Model.check_single: \"" ^ UnparseC.term_in_ctxt ctxt t ^ "\"" ^
39.45 + Err ("ERROR I_Model.check_single: \"" ^ UnparseC.term ctxt t ^ "\"" ^
39.46 "\" not for field \"" ^ m_field ^ "\"")
39.47 else
39.48 case O_Model.contains ctxt m_field o_model t of
39.49 @@ -304,7 +304,7 @@
39.50 | (msg, _, _) => Err ("ERROR I_Model.check_single: contains: " ^ msg)
39.51 (* case parseNEW of ..kept for understanding code..
39.52 | SOME t => Err ("ERROR I_Model.check_single: impossible for input \"" ^
39.53 - UnparseC.term_in_ctxt ctxt t ^ "\"")
39.54 + UnparseC.term ctxt t ^ "\"")
39.55 *)
39.56 end
39.57
40.1 --- a/src/Tools/isac/Specify/m-match.sml Sat Feb 04 16:49:08 2023 +0100
40.2 +++ b/src/Tools/isac/Specify/m-match.sml Sat Feb 04 17:00:25 2023 +0100
40.3 @@ -162,7 +162,7 @@
40.4 (tracing (dashs 70 ^ "\n"
40.5 ^ "*** ERROR while creating the items for the model of the ->problem\n"
40.6 ^ "*** from the ->stac with ->typeconstructor in arglist:\n"
40.7 - ^ "*** item (->description ->value): " ^ UnparseC.term_in_ctxt ctxt dsc ^ " " ^ UnparseC.term_in_ctxt ctxt var ^ "\n"
40.8 + ^ "*** item (->description ->value): " ^ UnparseC.term ctxt dsc ^ " " ^ UnparseC.term ctxt var ^ "\n"
40.9 ^ "*** description: " ^ TermC.string_of_detail ctxt dsc
40.10 ^ "*** value: " ^ TermC.string_of_detail ctxt var
40.11 ^ "*** typeconstructor in script: " ^ TermC.string_of_detail ctxt ty
40.12 @@ -174,7 +174,7 @@
40.13 end
40.14 | mtc thy _ t =
40.15 let val ctxt = Proof_Context.init_global thy
40.16 - in raise ERROR ("mtc: uncovered case with" ^ UnparseC.term_in_ctxt ctxt t) end
40.17 + in raise ERROR ("mtc: uncovered case with" ^ UnparseC.term ctxt t) end
40.18
40.19 (* match each pat of the model-pattern with an actual argument;
40.20 precondition: copy-named vars are filtered out *)
40.21 @@ -215,8 +215,8 @@
40.22 val msg = (dots 70 ^ "\n"
40.23 ^ "*** problem " ^ strs2str pI ^ " has the ...\n"
40.24 ^ "*** model-pattern " ^ Model_Pattern.to_string ctxt pats ^ "\n"
40.25 - ^ "*** stac '" ^ UnparseC.term_in_ctxt ctxt stac ^ "' has the ...\n"
40.26 - ^ "*** arg-list " ^ UnparseC.terms_in_ctxt ctxt ags ^ "\n"
40.27 + ^ "*** stac '" ^ UnparseC.term ctxt stac ^ "' has the ...\n"
40.28 + ^ "*** arg-list " ^ UnparseC.terms ctxt ags ^ "\n"
40.29 ^ dashs 70)
40.30 in tracing msg end
40.31
41.1 --- a/src/Tools/isac/Specify/o-model.sml Sat Feb 04 16:49:08 2023 +0100
41.2 +++ b/src/Tools/isac/Specify/o-model.sml Sat Feb 04 17:00:25 2023 +0100
41.3 @@ -199,9 +199,9 @@
41.4 fun values' ctxt oris =
41.5 let
41.6 fun ori2fmz_vals (_, _, _, dsc, ts) =
41.7 - case \<^try>\<open>(((UnparseC.term_in_ctxt ctxt) o Input_Descript.join') (dsc, ts), last_elem ts)\<close> of
41.8 + case \<^try>\<open>(((UnparseC.term ctxt) o Input_Descript.join') (dsc, ts), last_elem ts)\<close> of
41.9 SOME x => x
41.10 - | NONE => raise ERROR ("O_Model.values' called with " ^ UnparseC.terms_in_ctxt ctxt ts)
41.11 + | NONE => raise ERROR ("O_Model.values' called with " ^ UnparseC.terms ctxt ts)
41.12 in (split_list o (map ori2fmz_vals)) oris end
41.13
41.14
41.15 @@ -274,7 +274,7 @@
41.16 (* to an input (_ $ values) find the according O_Model.single and insert the values *)
41.17 fun associate_input ctxt m_field (descript, vals) [] =
41.18 ("associate_input: input ('" ^
41.19 - (UnparseC.term_in_ctxt ctxt (Input_Descript.join (descript, vals))) ^
41.20 + (UnparseC.term ctxt (Input_Descript.join (descript, vals))) ^
41.21 "') not found in oris (typed)", (0, [], m_field, descript, vals), [])
41.22 | associate_input ctxt sel (d, ts) ((id, vat, sel', d', ts') :: oris) =
41.23 if sel = sel' andalso d = d' andalso (inter op = ts ts') <> []
41.24 @@ -283,14 +283,14 @@
41.25
41.26 (* to an input (_ $ values) find the according O_Model.single and insert the values *)
41.27 fun associate_input' ctxt _ vals [] =
41.28 - ("associate_input': input (_, '" ^ strs2str (map (UnparseC.term_in_ctxt ctxt) vals) ^
41.29 + ("associate_input': input (_, '" ^ strs2str (map (UnparseC.term ctxt) vals) ^
41.30 "') not found in oris (typed)", single_empty, [])
41.31 | associate_input' ctxt m_field vals ((id, vat, m_field', descr, vals') :: oris) =
41.32 if m_field = m_field' andalso (inter op = vals vals') <> []
41.33 then
41.34 if m_field = m_field'
41.35 then ("", (id, vat, m_field, descr, inter op = vals vals'), vals')
41.36 - else ((strs2str' o map (UnparseC.term_in_ctxt ctxt)) vals ^
41.37 + else ((strs2str' o map (UnparseC.term ctxt)) vals ^
41.38 " not for " ^ m_field, single_empty, [])
41.39 else associate_input' ctxt m_field vals oris
41.40
41.41 @@ -299,8 +299,8 @@
41.42 val opt = (try Input_Descript.join) (d, ts)
41.43 val msg = case opt of
41.44 SOME _ => ""
41.45 - | NONE => (UnparseC.term_in_ctxt ctxt d ^ " " ^
41.46 - (strs2str' o map (UnparseC.term_in_ctxt ctxt)) ts ^ " is illtyped")
41.47 + | NONE => (UnparseC.term ctxt d ^ " " ^
41.48 + (strs2str' o map (UnparseC.term ctxt)) ts ^ " is illtyped")
41.49 in msg end
41.50
41.51 (* make a term 'typeless' for comparing with another 'typeless' term;
41.52 @@ -328,7 +328,7 @@
41.53 if d = TermC.empty
41.54 then
41.55 if not (subset op = (map make_typeless ts, map make_typeless ots))
41.56 - then ("terms '" ^ (strs2str' o (map (UnparseC.term_in_ctxt ctxt))) ts ^
41.57 + then ("terms '" ^ (strs2str' o (map (UnparseC.term ctxt))) ts ^
41.58 "' not in example (make_typeless)", single_empty, [])
41.59 else
41.60 (case associate_input' ctxt sel ts(*..values*) ori of
41.61 @@ -340,7 +340,7 @@
41.62 else
41.63 if member op = (map #4 ori) d
41.64 then associate_input ctxt sel (d, ts) ori
41.65 - else (UnparseC.term_in_ctxt ctxt d ^ " not in example", (0, [], sel, d, ts), [])
41.66 + else (UnparseC.term ctxt d ^ " not in example", (0, [], sel, d, ts), [])
41.67 end
41.68
41.69 (**)end(**);
42.1 --- a/src/Tools/isac/Specify/p-model.sml Sat Feb 04 16:49:08 2023 +0100
42.2 +++ b/src/Tools/isac/Specify/p-model.sml Sat Feb 04 17:00:25 2023 +0100
42.3 @@ -65,11 +65,11 @@
42.4
42.5 (*val item_to_out: Proof.context -> I_Model.single -> out_element*)
42.6 fun item_to_out ctxt (_, _, _, _, I_Model.Cor (dsc_ts, _)) =
42.7 - (dsc_ts |> Term.list_comb |> UnparseC.term_in_ctxt ctxt, Cor)
42.8 + (dsc_ts |> Term.list_comb |> UnparseC.term ctxt, Cor)
42.9 | item_to_out ctxt (_, _, _, _, I_Model.Inc (dsc_ts, _)) =
42.10 - (dsc_ts |> Term.list_comb |> UnparseC.term_in_ctxt ctxt, Inc)
42.11 + (dsc_ts |> Term.list_comb |> UnparseC.term ctxt, Inc)
42.12 | item_to_out ctxt ((_, _, _, _, I_Model.Sup dsc_ts): I_Model.single) =
42.13 - (dsc_ts |> Term.list_comb |> UnparseC.term_in_ctxt ctxt, Sup)
42.14 + (dsc_ts |> Term.list_comb |> UnparseC.term ctxt, Sup)
42.15 | item_to_out ctxt im =
42.16 raise ERROR ("P_Model.item_to_out called with " ^ I_Model.single_to_string ctxt im)
42.17
42.18 @@ -80,7 +80,7 @@
42.19
42.20 (*val where_to_out: Proof.context -> bool * term -> out_element*)
42.21 fun where_to_out ctxt (bool, t) =
42.22 - (UnparseC.term_in_ctxt ctxt t, if bool then True else False)
42.23 + (UnparseC.term ctxt t, if bool then True else False)
42.24
42.25 (*val wheres_to_out: Proof.context -> (bool * term) list -> field_out*)
42.26 fun wheres_to_out ctxt wheres = ("#Where", map (where_to_out ctxt) wheres)
42.27 @@ -171,8 +171,8 @@
42.28 fun add_where {Given = gi, Where = _, Find = fi, With = wi, Relate = re} wh =
42.29 {Given = gi, Where = wh, Find= fi , With = wi, Relate = re}
42.30
42.31 -fun boolterm2item ctxt (true, term) = Correct (UnparseC.term_in_ctxt ctxt term)
42.32 - | boolterm2item ctxt(false, term) = False (UnparseC.term_in_ctxt ctxt term);
42.33 +fun boolterm2item ctxt (true, term) = Correct (UnparseC.term ctxt term)
42.34 + | boolterm2item ctxt(false, term) = False (UnparseC.term ctxt term);
42.35
42.36 fun from thy itms where_ =
42.37 let
43.1 --- a/src/Tools/isac/Specify/p-spec.sml Sat Feb 04 16:49:08 2023 +0100
43.2 +++ b/src/Tools/isac/Specify/p-spec.sml Sat Feb 04 17:00:25 2023 +0100
43.3 @@ -205,7 +205,7 @@
43.4 | itms2fstr _ (_, _, _, f, I_Model.Typ str) = (f, str)
43.5 | itms2fstr _ (_, _, _, f, I_Model.Inc ((d, ts), _)) = (f, Input_Descript.join''' (d,ts))
43.6 | itms2fstr _ (_, _, _, f, I_Model.Sup (d, ts)) = (f, Input_Descript.join''' (d, ts))
43.7 - | itms2fstr ctxt (_, _, _, f, I_Model.Mis (d, t)) = (f, UnparseC.term_in_ctxt ctxt (d $ t))
43.8 + | itms2fstr ctxt (_, _, _, f, I_Model.Mis (d, t)) = (f, UnparseC.term ctxt (d $ t))
43.9 | itms2fstr ctxt (itm as (_, _, _, _, I_Model.Par _)) =
43.10 raise ERROR ("parsitm (" ^ I_Model.single_to_string ctxt itm ^ "): Par should be internal");
43.11
44.1 --- a/src/Tools/isac/Specify/pre-conditions.sml Sat Feb 04 16:49:08 2023 +0100
44.2 +++ b/src/Tools/isac/Specify/pre-conditions.sml Sat Feb 04 17:00:25 2023 +0100
44.3 @@ -28,7 +28,7 @@
44.4 type unchecked = term list
44.5 type input = TermC.as_string list;
44.6
44.7 -fun to_str ctxt (b, t) = pair2str (bool2str b, UnparseC.term_in_ctxt ctxt t);
44.8 +fun to_str ctxt (b, t) = pair2str (bool2str b, UnparseC.term ctxt t);
44.9 fun to_string ctxt pres = strs2str' (map (linefeed o (to_str ctxt)) pres);
44.10
44.11 fun eval _ _ (false, where_) = (false, where_) (*NOT ALL Free's have been substituted*)
45.1 --- a/src/Tools/isac/Specify/specify-step.sml Sat Feb 04 16:49:08 2023 +0100
45.2 +++ b/src/Tools/isac/Specify/specify-step.sml Sat Feb 04 17:00:25 2023 +0100
45.3 @@ -174,7 +174,7 @@
45.4 val (pt, c') = Ctree.cappend_form pt p l t
45.5 val ctxt = Ctree.get_ctxt pt pos
45.6 in
45.7 - ((p, Frm), c @ c', Test_Out.FormKF (UnparseC.term_in_ctxt ctxt t), pt)
45.8 + ((p, Frm), c @ c', Test_Out.FormKF (UnparseC.term ctxt t), pt)
45.9 end
45.10 | add (Tactic.End_Trans' tasm) l (pt, (p, _)) = (* used at all ? *)
45.11 let
46.1 --- a/src/Tools/isac/Test_Code/test-code.sml Sat Feb 04 16:49:08 2023 +0100
46.2 +++ b/src/Tools/isac/Test_Code/test-code.sml Sat Feb 04 17:00:25 2023 +0100
46.3 @@ -42,7 +42,7 @@
46.4 val (form, _, _) = ME_Misc.pt_extract ctxt ptp
46.5 in
46.6 case form of
46.7 - Ctree.Form t => Test_Out.FormKF (UnparseC.term_in_ctxt ctxt t)
46.8 + Ctree.Form t => Test_Out.FormKF (UnparseC.term ctxt t)
46.9 | Ctree.ModSpec (_, p_, _, gfr, where_, _) =>
46.10 Test_Out.PpcKF (
46.11 (case p_ of Pos.Pbl => Test_Out.Problem []
46.12 @@ -110,7 +110,7 @@
46.13
46.14 fun mk_string (ist, ctxt) =
46.15 ("(" ^ Istate.string_of' ist ^ ",\n"
46.16 - ^ "... ctxt: " ^ (ctxt |> ContextC.get_assumptions |> UnparseC.terms_in_ctxt ctxt) ^ ")")
46.17 + ^ "... ctxt: " ^ (ctxt |> ContextC.get_assumptions |> UnparseC.terms ctxt) ^ ")")
46.18
46.19 fun trace_ist_ctxt (EmptyPtree , ([], Pos.Und)) _ = ()
46.20 | trace_ist_ctxt (pt, (p, _)) tac =
47.1 --- a/src/Tools/isac/Test_Code/test-tool.sml Sat Feb 04 16:49:08 2023 +0100
47.2 +++ b/src/Tools/isac/Test_Code/test-tool.sml Sat Feb 04 17:00:25 2023 +0100
47.3 @@ -52,14 +52,14 @@
47.4
47.5 (** show a whole Calc.T **)
47.6
47.7 -fun posterm2str ctxt (pos, t, _) = "(" ^ Pos.pos'2str pos ^ ", " ^ UnparseC.term_in_ctxt ctxt t ^ ")"
47.8 +fun posterm2str ctxt (pos, t, _) = "(" ^ Pos.pos'2str pos ^ ", " ^ UnparseC.term ctxt t ^ ")"
47.9 fun posterms2str ctxt pfs = (strs2str' o (map (curry op ^ "\n")) o (map (posterm2str ctxt))) pfs
47.10
47.11 fun postermtac2str ctxt (pos, t, SOME tac) =
47.12 - Pos.pos'2str pos ^ ", " ^ UnparseC.term_in_ctxt ctxt t ^ "\n" ^
47.13 + Pos.pos'2str pos ^ ", " ^ UnparseC.term ctxt t ^ "\n" ^
47.14 indent 10 ^ Tactic.input_to_string ctxt tac
47.15 | postermtac2str ctxt (pos, t, NONE) =
47.16 - Pos.pos'2str pos ^ ", " ^ UnparseC.term_in_ctxt ctxt t
47.17 + Pos.pos'2str pos ^ ", " ^ UnparseC.term ctxt t
47.18 fun postermtacs2str ctxt pfts =
47.19 (strs2str' o (map (curry op ^ "\n")) o (map (postermtac2str ctxt))) pfts
47.20
48.1 --- a/test/Tools/isac/ADDTESTS/All_Ctxt.thy Sat Feb 04 16:49:08 2023 +0100
48.2 +++ b/test/Tools/isac/ADDTESTS/All_Ctxt.thy Sat Feb 04 17:00:25 2023 +0100
48.3 @@ -61,7 +61,7 @@
48.4 text \<open>preconditions are known at start of interpretation of (root-)method\<close>
48.5
48.6 ML \<open>
48.7 - if UnparseC.terms_in_ctxt @{context} (Ctree.get_assumptions pt p) = "[precond_rootmet x]"
48.8 + if UnparseC.terms @{context} (Ctree.get_assumptions pt p) = "[precond_rootmet x]"
48.9 then () else error "All_Ctx: asms after start interpretation of root-method";
48.10 \<close>
48.11
49.1 --- a/test/Tools/isac/ADDTESTS/course/CADGME/example_2.thy Sat Feb 04 16:49:08 2023 +0100
49.2 +++ b/test/Tools/isac/ADDTESTS/course/CADGME/example_2.thy Sat Feb 04 17:00:25 2023 +0100
49.3 @@ -12,7 +12,7 @@
49.4 @{term "\<delta> "};
49.5 @{term "\<phi> "};
49.6 @{term "\<rho> "};
49.7 - UnparseC.term_in_ctxt @{context} @{term "\<rho> "};
49.8 + UnparseC.term @{context} @{term "\<rho> "};
49.9 \<close>
49.10
49.11 section\<open>Working with Rulesets\<close>
49.12 @@ -48,9 +48,9 @@
49.13 \<close>
49.14
49.15 ML\<open>
49.16 - UnparseC.term_in_ctxt @{context} t';
49.17 - UnparseC.term_in_ctxt @{context} t' = "z / (z - ?\<delta> [?n]) + z / (z - \<alpha>) + ?\<delta> [?n]";
49.18 - UnparseC.term_in_ctxt @{context} t' = "?u [?n] + \<alpha>\<up>?n u[n] + ?\<delta> [?n]";
49.19 + UnparseC.term @{context} t';
49.20 + UnparseC.term @{context} t' = "z / (z - ?\<delta> [?n]) + z / (z - \<alpha>) + ?\<delta> [?n]";
49.21 + UnparseC.term @{context} t' = "?u [?n] + \<alpha>\<up>?n u[n] + ?\<delta> [?n]";
49.22 \<close>
49.23
49.24 text\<open>Problems: Rule~1 is applied before the expression is checked for Rule~4
50.1 --- a/test/Tools/isac/ADDTESTS/course/CADGME/example_3.thy Sat Feb 04 16:49:08 2023 +0100
50.2 +++ b/test/Tools/isac/ADDTESTS/course/CADGME/example_3.thy Sat Feb 04 17:00:25 2023 +0100
50.3 @@ -40,7 +40,7 @@
50.4 \<close>
50.5
50.6 ML\<open>
50.7 - UnparseC.term_in_ctxt @{context} output;
50.8 + UnparseC.term @{context} output;
50.9 \<close>
50.10
50.11 end
51.1 --- a/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy Sat Feb 04 16:49:08 2023 +0100
51.2 +++ b/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy Sat Feb 04 17:00:25 2023 +0100
51.3 @@ -35,7 +35,7 @@
51.4 @{term "-u [-n - 1]"}; (*[ ] denotes lists !!!*)
51.5 @{term "z /(z - 1) = -u [-n - 1]"};
51.6 @{term "1 < || z || ==> z / (z - 1) = -u [-n - 1]"};
51.7 - UnparseC.term_in_ctxt @{context} @{term "1 < || z || ==> z / (z - 1) = -u [-n - 1]"};
51.8 + UnparseC.term @{context} @{term "1 < || z || ==> z / (z - 1) = -u [-n - 1]"};
51.9 \<close>
51.10 text\<open>\noindent Try which symbols we are able to use and how we generate them.\<close>
51.11 ML \<open>
51.12 @@ -44,7 +44,7 @@
51.13 @{term "\<delta> "};
51.14 @{term "\<phi> "};
51.15 @{term "\<rho> "};
51.16 - UnparseC.term_in_ctxt @{context} @{term "\<rho> "};
51.17 + UnparseC.term @{context} @{term "\<rho> "};
51.18 \<close>
51.19
51.20 subsection \<open>Rules\<close>
51.21 @@ -85,7 +85,7 @@
51.22 val SOME (t', asm) = Rewrite.rewrite_set_ thy true inverse_Z t;
51.23 (*rewrite__set_ called with 'Erls' for '|| z || < 1'*)
51.24 \<close> ML \<open>
51.25 - UnparseC.term_in_ctxt @{context} t' = "z / (z - ?\<delta> [?n]) + z / (z - \<alpha>) + ?\<delta> [?n]";
51.26 + UnparseC.term @{context} t' = "z / (z - ?\<delta> [?n]) + z / (z - \<alpha>) + ?\<delta> [?n]";
51.27 (*
51.28 * Attention rule1 is applied before the expression is
51.29 * checked for rule4 which would be correct!!!
51.30 @@ -97,23 +97,23 @@
51.31 ML \<open>
51.32 val SOME (t, asm1) =
51.33 Rewrite.rewrite_ thy ro er true (ThmC.numerals_to_Free @{thm rule3}) t;
51.34 - UnparseC.term_in_ctxt @{context} t = "- ?u [- ?n - 1] + z / (z - \<alpha>) + 1";
51.35 + UnparseC.term @{context} t = "- ?u [- ?n - 1] + z / (z - \<alpha>) + 1";
51.36 (*- real *)
51.37 - UnparseC.term_in_ctxt @{context} t;
51.38 + UnparseC.term @{context} t;
51.39
51.40 val SOME (t, asm2) =
51.41 Rewrite.rewrite_ thy ro er true (ThmC.numerals_to_Free @{thm rule4}) t;
51.42 - UnparseC.term_in_ctxt @{context} t = "- ?u [- ?n - 1] + \<alpha> \<up> ?n * ?u [?n] + 1";
51.43 + UnparseC.term @{context} t = "- ?u [- ?n - 1] + \<alpha> \<up> ?n * ?u [?n] + 1";
51.44 (*- real *)
51.45 - UnparseC.term_in_ctxt @{context} t;
51.46 + UnparseC.term @{context} t;
51.47
51.48 val SOME (t, asm3) =
51.49 Rewrite.rewrite_ thy ro er true (ThmC.numerals_to_Free @{thm rule1}) t;
51.50 - UnparseC.term_in_ctxt @{context} t = "- ?u [- ?n - 1] + \<alpha> \<up> ?n * ?u [?n] + ?\<delta> [?n]";
51.51 + UnparseC.term @{context} t = "- ?u [- ?n - 1] + \<alpha> \<up> ?n * ?u [?n] + ?\<delta> [?n]";
51.52 (*- real *)
51.53 - UnparseC.term_in_ctxt @{context} t;
51.54 + UnparseC.term @{context} t;
51.55 \<close>
51.56 -ML \<open>UnparseC.terms_in_ctxt @{context} (asm1 @ asm2 @ asm3);\<close>
51.57 +ML \<open>UnparseC.terms @{context} (asm1 @ asm2 @ asm3);\<close>
51.58
51.59 section\<open>Prepare Steps for TP-based programming Language\label{sec:prepstep}\<close>
51.60 text\<open>
51.61 @@ -134,9 +134,9 @@
51.62 (*val ctxt = ContextC.declare_constraints' [@{term "z::real"}] ctxt;*)
51.63
51.64 val fun1 =
51.65 - TermC.parse ctxt "X z = 3 / (z - 1/4 + -1/8 * z \<up> -1)"; UnparseC.term_in_ctxt ctxt fun1;
51.66 + TermC.parse ctxt "X z = 3 / (z - 1/4 + -1/8 * z \<up> -1)"; UnparseC.term ctxt fun1;
51.67 val fun1' =
51.68 - TermC.parse ctxt "X z = 3 / (z - 1/4 + -1/8 * (1/z))"; UnparseC.term_in_ctxt ctxt fun1';
51.69 + TermC.parse ctxt "X z = 3 / (z - 1/4 + -1/8 * (1/z))"; UnparseC.term ctxt fun1';
51.70 \<close>
51.71
51.72 subsubsection \<open>Prepare Numerator and Denominator\<close>
51.73 @@ -151,20 +151,20 @@
51.74 ML \<open>
51.75 val (thy, ro, er) = (@{theory}, tless_true, eval_rls);
51.76 val SOME (fun2, asm1) =
51.77 - Rewrite.rewrite_ thy ro er true @{thm ruleZY} fun1; UnparseC.term_in_ctxt @{context} fun2;
51.78 + Rewrite.rewrite_ thy ro er true @{thm ruleZY} fun1; UnparseC.term @{context} fun2;
51.79 val SOME (fun2', asm1) =
51.80 - Rewrite.rewrite_ thy ro er true @{thm ruleZY} fun1'; UnparseC.term_in_ctxt @{context} fun2';
51.81 + Rewrite.rewrite_ thy ro er true @{thm ruleZY} fun1'; UnparseC.term @{context} fun2';
51.82
51.83 val SOME (fun3,_) =
51.84 Rewrite.rewrite_set_ @{theory} false norm_Rational fun2;
51.85 - UnparseC.term_in_ctxt @{context} fun3;
51.86 + UnparseC.term @{context} fun3;
51.87 (*
51.88 * Fails on x \<up> (-1)
51.89 * We solve this problem by using 1/x as a workaround.
51.90 *)
51.91 val SOME (fun3',_) =
51.92 Rewrite.rewrite_set_ @{theory} false norm_Rational fun2';
51.93 - UnparseC.term_in_ctxt @{context} fun3';
51.94 + UnparseC.term @{context} fun3';
51.95 (*
51.96 * OK - workaround!
51.97 *)
51.98 @@ -183,10 +183,10 @@
51.99
51.100 subsubsection\<open>Decompose the Given Term Into lhs and rhs\<close>
51.101 ML \<open>
51.102 - val (_, expr) = HOLogic.dest_eq fun3'; UnparseC.term_in_ctxt @{context} expr;
51.103 + val (_, expr) = HOLogic.dest_eq fun3'; UnparseC.term @{context} expr;
51.104 val (_, denom) =
51.105 HOLogic.dest_bin \<^const_name>\<open>divide\<close> (type_of expr) expr;
51.106 - UnparseC.term_in_ctxt @{context} denom = "-1 + -2 * z + 8 * z \<up> 2";
51.107 + UnparseC.term @{context} denom = "-1 + -2 * z + 8 * z \<up> 2";
51.108 \<close>
51.109
51.110 text\<open>\noindent We have rhs\footnote{Note: lhs means \em Left Hand Side
51.111 @@ -337,7 +337,7 @@
51.112
51.113 ML \<open>
51.114 val SOME solutions = ParseC.term_opt ctxt "[z=1/2, z=-1/4]";
51.115 - UnparseC.term_in_ctxt @{context} solutions;
51.116 + UnparseC.term @{context} solutions;
51.117 TermC.atom_trace_detail @{context} solutions;
51.118 \<close>
51.119
51.120 @@ -352,8 +352,8 @@
51.121 ML \<open>
51.122 val Const (\<^const_name>\<open>Cons\<close>, _) $ s_1 $ (Const (\<^const_name>\<open>Cons\<close>, _)
51.123 $ s_2 $ Const (\<^const_name>\<open>Nil\<close>, _)) = solutions;
51.124 - UnparseC.term_in_ctxt @{context} s_1;
51.125 - UnparseC.term_in_ctxt @{context} s_2;
51.126 + UnparseC.term @{context} s_1;
51.127 + UnparseC.term @{context} s_2;
51.128 \<close>
51.129
51.130 text\<open>\noindent The ansatz for the \em Partial Fraction Decomposition \normalfont
51.131 @@ -371,8 +371,8 @@
51.132 val s_1' = HOLogic.mk_binop \<^const_name>\<open>minus\<close> xx;
51.133 val xx = HOLogic.dest_eq s_2;
51.134 val s_2' = HOLogic.mk_binop \<^const_name>\<open>minus\<close> xx;
51.135 - UnparseC.term_in_ctxt @{context} s_1';
51.136 - UnparseC.term_in_ctxt @{context} s_2';
51.137 + UnparseC.term @{context} s_1';
51.138 + UnparseC.term @{context} s_2';
51.139 \<close>
51.140
51.141 text \<open>\noindent For the programming language a function collecting all the
51.142 @@ -409,17 +409,17 @@
51.143 (*mk_prod TermC.empty [];*)
51.144
51.145 val prod = mk_prod TermC.empty [parse_test @{context} "x + 123"];
51.146 -UnparseC.term_in_ctxt @{context} prod = "x + 123";
51.147 +UnparseC.term @{context} prod = "x + 123";
51.148
51.149 val sol = parse_test @{context} "[z = 1 / 2, z = -1 / 4]";
51.150 val sols = HOLogic.dest_list sol;
51.151 val facs = map fac_from_sol sols;
51.152 val prod = mk_prod TermC.empty facs;
51.153 -UnparseC.term_in_ctxt @{context} prod = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))";
51.154 +UnparseC.term @{context} prod = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))";
51.155
51.156 val prod =
51.157 mk_prod TermC.empty [parse_test @{context} "x + 1", parse_test @{context} "x + 2", parse_test @{context} "x + 3"];
51.158 -UnparseC.term_in_ctxt @{context} prod = "(x + 1) * (x + 2) * (x + 3)";
51.159 +UnparseC.term @{context} prod = "(x + 1) * (x + 2) * (x + 3)";
51.160 *} *)
51.161 ML \<open>
51.162 fun factors_from_solution sol =
51.163 @@ -429,7 +429,7 @@
51.164 (* ML {*
51.165 val sol = parse_test @{context} "[z = 1 / 2, z = -1 / 4]";
51.166 val fs = factors_from_solution sol;
51.167 -UnparseC.term_in_ctxt @{context} fs = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))"
51.168 +UnparseC.term @{context} fs = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))"
51.169 *} *)
51.170 text \<open>\noindent This function needs to be packed such that it can be evaluated
51.171 by the Lucas-Interpreter. Therefor we moved the function to the
51.172 @@ -592,7 +592,7 @@
51.173
51.174 val expr' = HOLogic.mk_binop
51.175 \<^const_name>\<open>divide\<close> (numerator, denominator');
51.176 - UnparseC.term_in_ctxt @{context} expr';
51.177 + UnparseC.term @{context} expr';
51.178 \<close>
51.179
51.180 subsubsection \<open>Apply the Partial Fraction Decomposion Ansatz\<close>
51.181 @@ -622,9 +622,9 @@
51.182 val SOME (t1,_) =
51.183 rewrite_ @{theory} e_rew_ord Rule_Set.empty false
51.184 @{thm ansatz_2nd_order} expr';
51.185 - UnparseC.term_in_ctxt @{context} t1; TermC.atom_trace_detail @{context} t1;
51.186 + UnparseC.term @{context} t1; TermC.atom_trace_detail @{context} t1;
51.187 val eq1 = HOLogic.mk_eq (expr', t1);
51.188 - UnparseC.term_in_ctxt @{context} eq1;
51.189 + UnparseC.term @{context} eq1;
51.190 \<close>
51.191
51.192 text\<open>\noindent Eliminate the denominators by multiplying the left and the
51.193 @@ -637,7 +637,7 @@
51.194 val SOME (eq2,_) =
51.195 rewrite_ @{theory} e_rew_ord Rule_Set.empty false
51.196 @{thm equival_trans_2nd_order} eq1;
51.197 - UnparseC.term_in_ctxt @{context} eq2;
51.198 + UnparseC.term @{context} eq2;
51.199 \<close>
51.200
51.201 text\<open>\noindent We use the existing ruleset \ttfamily norm\_Rational \normalfont
51.202 @@ -645,7 +645,7 @@
51.203
51.204 ML \<open>
51.205 val SOME (eq3,_) = rewrite_set_ @{theory} false norm_Rational eq2;
51.206 - UnparseC.term_in_ctxt @{context} eq3;
51.207 + UnparseC.term @{context} eq3;
51.208 (*
51.209 * ?A ?B not simplified
51.210 *)
51.211 @@ -664,9 +664,9 @@
51.212 *)
51.213 val SOME (fract2,_) =
51.214 rewrite_set_ @{theory} false norm_Rational fract1;
51.215 - UnparseC.term_in_ctxt @{context} fract2 = "(A + -2 * B + 4 * A * z + 4 * B * z) / 4";
51.216 + UnparseC.term @{context} fract2 = "(A + -2 * B + 4 * A * z + 4 * B * z) / 4";
51.217 (*
51.218 - * UnparseC.term_in_ctxt @{context} fract2 = "A * (1 / 4 + z) + B * (-1 / 2 + z)"
51.219 + * UnparseC.term @{context} fract2 = "A * (1 / 4 + z) + B * (-1 / 2 + z)"
51.220 * would be more traditional...
51.221 *)
51.222 \<close>
51.223 @@ -679,13 +679,13 @@
51.224 (*
51.225 * A B !
51.226 *)
51.227 - UnparseC.term_in_ctxt @{context} eq3';
51.228 + UnparseC.term @{context} eq3';
51.229 (*
51.230 * MANDATORY: simplify (and remove denominator) otherwise 3 = 0
51.231 *)
51.232 val SOME (eq3'' ,_) =
51.233 rewrite_set_ @{theory} false norm_Rational eq3';
51.234 - UnparseC.term_in_ctxt @{context} eq3'';
51.235 + UnparseC.term @{context} eq3'';
51.236 \<close>
51.237
51.238 text\<open>\noindent Still working at {\sisac}\ldots\<close>
51.239 @@ -721,8 +721,8 @@
51.240 text\<open>\noindent And check the output\ldots\<close>
51.241
51.242 ML \<open>
51.243 - UnparseC.term_in_ctxt @{context} expr' = "3 / ((z - 1 / 2) * (z - -1 / 4))";
51.244 - UnparseC.term_in_ctxt @{context} ttttt = "?A / (z - 1 / 2) + ?B / (z - -1 / 4)";
51.245 + UnparseC.term @{context} expr' = "3 / ((z - 1 / 2) * (z - -1 / 4))";
51.246 + UnparseC.term @{context} ttttt = "?A / (z - 1 / 2) + ?B / (z - -1 / 4)";
51.247 \<close>
51.248
51.249 subsubsection \<open>Get the First Coefficient\<close>
51.250 @@ -737,10 +737,10 @@
51.251 ML \<open>
51.252 val SOME (eq4_1,_) =
51.253 rewrite_terms_ @{theory} e_rew_ord Rule_Set.empty [s_1] eq3'';
51.254 - UnparseC.term_in_ctxt @{context} eq4_1;
51.255 + UnparseC.term @{context} eq4_1;
51.256 val SOME (eq4_2,_) =
51.257 rewrite_set_ @{theory} false norm_Rational eq4_1;
51.258 - UnparseC.term_in_ctxt @{context} eq4_2;
51.259 + UnparseC.term @{context} eq4_2;
51.260
51.261 val fmz = ["equality (3=3*A/(4::real))", "solveFor A", "solutions L"];
51.262 val (dI',pI',mI') =("Isac_Knowledge", ["univariate", "equation"], ["no_met"]);
51.263 @@ -817,10 +817,10 @@
51.264 ML \<open>
51.265 val SOME (eq4b_1,_) =
51.266 rewrite_terms_ @{theory} e_rew_ord Rule_Set.empty [s_2] eq3'';
51.267 - UnparseC.term_in_ctxt @{context} eq4b_1;
51.268 + UnparseC.term @{context} eq4b_1;
51.269 val SOME (eq4b_2,_) =
51.270 rewrite_set_ @{theory} false norm_Rational eq4b_1;
51.271 - UnparseC.term_in_ctxt @{context} eq4b_2;
51.272 + UnparseC.term @{context} eq4b_2;
51.273
51.274 val fmz = ["equality (3= -3*B/(4::real))", "solveFor B", "solutions L"];
51.275 val (dI',pI',mI') =("Isac_Knowledge", ["univariate", "equation"], ["no_met"]);
51.276 @@ -1314,7 +1314,7 @@
51.277 (#program o MethodC.from_store ctxt) ["SignalProcessing",
51.278 "Z_Transform",
51.279 "Inverse"];
51.280 - writeln (UnparseC.term_in_ctxt @{context} s);
51.281 + writeln (UnparseC.term @{context} s);
51.282 \end{verbatim}
51.283 \ldots shows the right script. Difference in the arguments.
51.284 \item Test --- Why helpless here ? --- shows: \ttfamily replace
52.1 --- a/test/Tools/isac/ADDTESTS/course/SignalProcess/document/Build_Inverse_Z_Transform.tex Sat Feb 04 16:49:08 2023 +0100
52.2 +++ b/test/Tools/isac/ADDTESTS/course/SignalProcess/document/Build_Inverse_Z_Transform.tex Sat Feb 04 17:00:25 2023 +0100
52.3 @@ -2394,7 +2394,7 @@
52.4 (#program o MethodC.from_store ctxt) ["SignalProcessing",
52.5 "Z_Transform",
52.6 "Inverse"];
52.7 - writeln (UnparseC.term_in_ctxt @{context} s);
52.8 + writeln (UnparseC.term @{context} s);
52.9 \end{verbatim}
52.10 \ldots shows the right script. Difference in the arguments.
52.11 \item Test --- Why helpless here ? --- shows: \ttfamily replace
53.1 --- a/test/Tools/isac/ADDTESTS/course/phst11/T2_Rewriting.thy Sat Feb 04 16:49:08 2023 +0100
53.2 +++ b/test/Tools/isac/ADDTESTS/course/phst11/T2_Rewriting.thy Sat Feb 04 17:00:25 2023 +0100
53.3 @@ -43,11 +43,11 @@
53.4 ML \<open>
53.5 val t = ParseC.parse_test ctxt "d_d x (x\<up>2 + x + y)";
53.6
53.7 -val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_sum t; UnparseC.term_in_ctxt @{context} t;
53.8 -val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_sum t; UnparseC.term_in_ctxt @{context} t;
53.9 -val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_pow t; UnparseC.term_in_ctxt @{context} t;
53.10 -val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_var t; UnparseC.term_in_ctxt @{context} t;
53.11 -val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_const t; UnparseC.term_in_ctxt @{context} t;
53.12 +val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_sum t; UnparseC.term @{context} t;
53.13 +val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_sum t; UnparseC.term @{context} t;
53.14 +val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_pow t; UnparseC.term @{context} t;
53.15 +val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_var t; UnparseC.term @{context} t;
53.16 +val SOME (t, _) = Rewrite.rewrite_inst_ ctxt ro er true inst diff_const t; UnparseC.term @{context} t;
53.17 \<close>
53.18 text \<open>Please, scoll up the Output-window to check the 5 steps of rewriting !
53.19 You might not be satisfied by the result "2 * x \<up> (2 - 1) + 1 + 0".
53.20 @@ -55,7 +55,7 @@
53.21 ISAC has a set of rules called 'make_polynomial', which simplifies the result:
53.22 \<close>
53.23 ML \<open>
53.24 -val SOME (t, _) = Rewrite.rewrite_set_ ctxt true make_polynomial t; UnparseC.term_in_ctxt @{context} t;
53.25 +val SOME (t, _) = Rewrite.rewrite_set_ ctxt true make_polynomial t; UnparseC.term @{context} t;
53.26 \<close>
53.27
53.28 section \<open>Note on bound variables\<close>
53.29 @@ -69,7 +69,7 @@
53.30 \<close>
53.31 ML \<open>
53.32 val t = @{term "%x. x^2 + x + y"};
53.33 -TermC.atom_write_detail @{context} t; UnparseC.term_in_ctxt @{context} t;
53.34 +TermC.atom_write_detail @{context} t; UnparseC.term @{context} t;
53.35 \<close>
53.36 text \<open>Since this notation does not conform to present high-school matheatics
53.37 ISAC introduced the 'bdv' mechanism. This mechanism is also used for equation
53.38 @@ -98,16 +98,16 @@
53.39 \<close>
53.40 ML \<open>
53.41 (*show_brackets := true; TODO*)
53.42 -val t0 = ParseC.parse_test ctxt "2*a + 3*b + 4*a::real"; UnparseC.term_in_ctxt @{context} t0;
53.43 +val t0 = ParseC.parse_test ctxt "2*a + 3*b + 4*a::real"; UnparseC.term @{context} t0;
53.44 (*show_brackets := false;*)
53.45 \<close>
53.46 text \<open>Now we want to bring 4*a close to 2*a in order to get 6*a:
53.47 \<close>
53.48 ML \<open>
53.49 -val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.assoc} t0; UnparseC.term_in_ctxt @{context} t;
53.50 -val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.left_commute} t; UnparseC.term_in_ctxt @{context} t;
53.51 -val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t;
53.52 -val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm real_num_collect} t; UnparseC.term_in_ctxt @{context} t;
53.53 +val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.assoc} t0; UnparseC.term @{context} t;
53.54 +val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.left_commute} t; UnparseC.term @{context} t;
53.55 +val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term @{context} t;
53.56 +val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm real_num_collect} t; UnparseC.term @{context} t;
53.57 \<close>
53.58 text \<open>That is fine, we just need to add 2+4 !!!!! See the next section below.
53.59
53.60 @@ -117,10 +117,10 @@
53.61 as one rule is applicable (that is the way such rulesets work).
53.62 Try to step through the ML-sections without skipping one of them ...
53.63 \<close>
53.64 -ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t\<close>
53.65 -ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t\<close>
53.66 -ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t\<close>
53.67 -ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t\<close>
53.68 +ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term @{context} t\<close>
53.69 +ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term @{context} t\<close>
53.70 +ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term @{context} t\<close>
53.71 +ML \<open>val SOME (t, _) = Rewrite.rewrite_ ctxt ro er true @{thm add.commute} t; UnparseC.term @{context} t\<close>
53.72 text \<open>... you can go forever, the ruleset is 'not terminating'.
53.73 The theory of rewriting makes this kind of rulesets terminate by the use of
53.74 'rewrite orders':
53.75 @@ -148,18 +148,18 @@
53.76 ML \<open>
53.77 (*show_brackets := false; TODO*)
53.78 val t1 = ParseC.parse_test ctxt "(a - b) * (a\<up>2 + a*b + b\<up>2)";
53.79 -val SOME (t, _) = Rewrite.rewrite_set_ ctxt true make_polynomial t1; UnparseC.term_in_ctxt @{context} t;
53.80 +val SOME (t, _) = Rewrite.rewrite_set_ ctxt true make_polynomial t1; UnparseC.term @{context} t;
53.81 \<close>
53.82 ML \<open>
53.83 val t2 = ParseC.parse_test ctxt
53.84 "(2 / (x + 3) + 2 / (x - 3)) / (8 * x / (x \<up> 2 - 9))";
53.85 -val SOME (t, _) = Rewrite.rewrite_set_ ctxt true norm_Rational t2; UnparseC.term_in_ctxt @{context} t;
53.86 +val SOME (t, _) = Rewrite.rewrite_set_ ctxt true norm_Rational t2; UnparseC.term @{context} t;
53.87 \<close>
53.88 text \<open>The simplifiers are quite busy when finding the above results. you can
53.89 watch them at work by setting the switch 'Rewrite.trace_on:\<close>
53.90 ML \<open>
53.91 tracing "+++begin++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
53.92 -val SOME (t, _) = Rewrite.rewrite_set_ ctxt true norm_Rational t2; UnparseC.term_in_ctxt @{context} t;
53.93 +val SOME (t, _) = Rewrite.rewrite_set_ ctxt true norm_Rational t2; UnparseC.term @{context} t;
53.94 tracing "+++end++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
53.95 \<close>
53.96 text \<open>You see what happend when you click the checkbox <Tracing> on the bar
53.97 @@ -187,7 +187,7 @@
53.98 ML \<open>
53.99 val t2 = ParseC.parse_test ctxt
53.100 "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12::real";
53.101 -val SOME (t, _) = Rewrite.rewrite_set_ ctxt true rls_p_33 t2; UnparseC.term_in_ctxt @{context} t;
53.102 +val SOME (t, _) = Rewrite.rewrite_set_ ctxt true rls_p_33 t2; UnparseC.term @{context} t;
53.103 \<close>
53.104 text \<open>Try your own examples !\<close>
53.105
53.106 @@ -227,7 +227,7 @@
53.107 ML \<open>
53.108 val t = ParseC.parse_test ctxt
53.109 "(2*a - 5*b) * (2*a + 5*b)";
53.110 -Rewrite.rewrite_set_ ctxt true rls_p_33 t; UnparseC.term_in_ctxt @{context} t;
53.111 +Rewrite.rewrite_set_ ctxt true rls_p_33 t; UnparseC.term @{context} t;
53.112 \<close>
53.113
53.114 end
54.1 --- a/test/Tools/isac/BaseDefinitions/base-definitions.sml Sat Feb 04 16:49:08 2023 +0100
54.2 +++ b/test/Tools/isac/BaseDefinitions/base-definitions.sml Sat Feb 04 17:00:25 2023 +0100
54.3 @@ -18,7 +18,7 @@
54.4 (* these and other numeral calculations have been accomplished by Simplifier.rewrite so far *)
54.5
54.6 val t = Calc_Binop.simplify @{context} @{term "4 * - 1 * 4 ::real"};
54.7 -if UnparseC.term_in_ctxt @{context} t = "- 16"
54.8 +if UnparseC.term @{context} t = "- 16"
54.9 then () else error "calcul 4 * - 1 * 4 \<longrightarrow> - 16";
54.10
54.11 (*
54.12 @@ -26,19 +26,19 @@
54.13 note: missing cases, defined in lemma realpow_uminus_simps, go via [simp] into simp_ctxt.
54.14 *)
54.15 val t = Calc_Binop.simplify @{context} @{term "4 \<up> 2 ::real"};
54.16 -if UnparseC.term_in_ctxt @{context} t = "16"
54.17 +if UnparseC.term @{context} t = "16"
54.18 then () else error "calcul 4 \<up> 2 \<longrightarrow> 16";
54.19
54.20 val t = Calc_Binop.simplify @{context} @{term "(- 1) \<up> 2"};
54.21 -if UnparseC.term_in_ctxt @{context} t = "1"
54.22 +if UnparseC.term @{context} t = "1"
54.23 then () else error "calcul (- 1) \<up> 2 \<longrightarrow> 1";
54.24
54.25 val t = Calc_Binop.simplify @{context} @{term "3 \<up> (- 2)"};
54.26 -if UnparseC.term_in_ctxt @{context} t = "1 / 9"
54.27 +if UnparseC.term @{context} t = "1 / 9"
54.28 then () else error "calcul 3 \<up> (- 2) \<longrightarrow> 1 / 9";
54.29
54.30 val t = Calc_Binop.simplify @{context} @{term "3 \<up> - 1"};
54.31 -if UnparseC.term_in_ctxt @{context} t = "1 / 3"
54.32 +if UnparseC.term @{context} t = "1 / 3"
54.33 then () else error "calcul 3 \<up> - 1 \<longrightarrow> 1 / 3";
54.34
54.35 (* note on example "4 * - 1 * 4 \<up> 2 \<le> 8 * (- 1) \<up> 2" *)
55.1 --- a/test/Tools/isac/BaseDefinitions/contextC.sml Sat Feb 04 16:49:08 2023 +0100
55.2 +++ b/test/Tools/isac/BaseDefinitions/contextC.sml Sat Feb 04 17:00:25 2023 +0100
55.3 @@ -83,27 +83,27 @@
55.4
55.5 val t = ParseC.parse_test @{context} "[x = 0, x = 6 / 5]";
55.6 val (t', for_asm) = avoid_contradict t preds;
55.7 -if UnparseC.term_in_ctxt @{context} t' = "[x = 6 / 5]" andalso map (UnparseC.term_in_ctxt @{context}) for_asm = ["x = 6 / 5"]
55.8 +if UnparseC.term @{context} t' = "[x = 6 / 5]" andalso map (UnparseC.term @{context}) for_asm = ["x = 6 / 5"]
55.9 then () else error "avoid_contradict [x = 0, x = 6 / 5] CHANGED";
55.10
55.11 val t = ParseC.parse_test @{context} "x = 0";
55.12 val (t', for_asm) = avoid_contradict t preds;
55.13 -if UnparseC.term_in_ctxt @{context} t' = "bool_undef" andalso map (UnparseC.term_in_ctxt @{context}) for_asm = []
55.14 +if UnparseC.term @{context} t' = "bool_undef" andalso map (UnparseC.term @{context}) for_asm = []
55.15 then () else error "avoid_contradict x = 0 CHANGED"; (* "x \<noteq> 0" in preds *)
55.16
55.17 val t = ParseC.parse_test @{context} "x = 1";
55.18 val (t', for_asm) = avoid_contradict t preds;
55.19 -if UnparseC.term_in_ctxt @{context} t' = "x = 1" andalso map (UnparseC.term_in_ctxt @{context}) for_asm = ["x = 1"]
55.20 +if UnparseC.term @{context} t' = "x = 1" andalso map (UnparseC.term @{context}) for_asm = ["x = 1"]
55.21 then () else error "avoid_contradict x = 1 CHANGED"; (* "x \<noteq> 1" NOT in preds *)
55.22
55.23 val t = ParseC.parse_test @{context} "a + b";
55.24 val (t', for_asm) = avoid_contradict t preds;
55.25 -if UnparseC.term_in_ctxt @{context} t' = "a + b" andalso map (UnparseC.term_in_ctxt @{context}) for_asm = []
55.26 +if UnparseC.term @{context} t' = "a + b" andalso map (UnparseC.term @{context}) for_asm = []
55.27 then () else error "avoid_contradict a + b CHANGED"; (* NOT a predicate *)
55.28
55.29 val t = ParseC.parse_test @{context} "[a + b]";
55.30 val (t', for_asm) = avoid_contradict t preds;
55.31 -if UnparseC.term_in_ctxt @{context} t' = "[a + b]" andalso map (UnparseC.term_in_ctxt @{context}) for_asm = []
55.32 +if UnparseC.term @{context} t' = "[a + b]" andalso map (UnparseC.term @{context}) for_asm = []
55.33 then () else error "avoid_contradict [a + b] CHANGED"; (* NOT a predicate *)
55.34
55.35
55.36 @@ -121,7 +121,7 @@
55.37 [ParseC.parse_test @{context} "b < (to::int)", ParseC.parse_test @{context} "c < (to::int)"] ctxt
55.38 val (t, new_ctxt) = subpbl_to_caller sub_ctxt prog_res caller_ctxt;
55.39
55.40 -if UnparseC.term_in_ctxt @{context} t = "[x_1 = 1, x_2 = 2, x_3 = 3]" andalso map (UnparseC.term_in_ctxt @{context}) (get_assumptions new_ctxt) =
55.41 +if UnparseC.term @{context} t = "[x_1 = 1, x_2 = 2, x_3 = 3]" andalso map (UnparseC.term @{context}) (get_assumptions new_ctxt) =
55.42 ["b < fro", "x_1 = 1", "x_2 = 2", "x_3 = 3", "b < to", "c < to"]
55.43 then () else error "fun subpbl_to_caller changed 1";
55.44
55.45 @@ -130,7 +130,7 @@
55.46 [ParseC.parse_test @{context} "b < (to::int)", ParseC.parse_test @{context} "x_2 \<noteq> (2::int)"] ctxt
55.47 val (t, new_ctxt) = subpbl_to_caller sub_ctxt prog_res caller_ctxt;
55.48
55.49 -if UnparseC.term_in_ctxt @{context} t = "[x_1 = 1, x_3 = 3]" andalso map (UnparseC.term_in_ctxt @{context}) (get_assumptions new_ctxt) =
55.50 +if UnparseC.term @{context} t = "[x_1 = 1, x_3 = 3]" andalso map (UnparseC.term @{context}) (get_assumptions new_ctxt) =
55.51 ["b < fro", "x_1 = 1", "x_3 = 3", "b < to", "x_2 \<noteq> 2"]
55.52 then () else error "fun subpbl_to_caller changed 2";
55.53
55.54 @@ -155,7 +155,7 @@
55.55 val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
55.56 val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f = "(3 + - 1 * x + x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)";
55.57
55.58 -(*+*)if (Ctree.get_assumptions pt p |> map (UnparseC.term_in_ctxt @{context})) =
55.59 +(*+*)if (Ctree.get_assumptions pt p |> map (UnparseC.term @{context})) =
55.60 (*+*) ["x \<noteq> 0",
55.61 (*+*) "9 * x + - 6 * x \<up> 2 + x \<up> 3 \<noteq> 0",
55.62 (*+*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x"]
55.63 @@ -201,7 +201,7 @@
55.64 (*[4, 4, 4], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f = "[x = 0, x = 6 / 5]";
55.65 (*[4, 4, 5], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*\<rightarrow>2. Check_Postcond ["bdv_only", "degree_2", "polynomial", "univariate", "equation"]*)
55.66
55.67 -(* *)if eq_set op = ((Ctree.get_assumptions pt p |> map (UnparseC.term_in_ctxt @{context})), [
55.68 +(* *)if eq_set op = ((Ctree.get_assumptions pt p |> map (UnparseC.term @{context})), [
55.69 (*0.where_*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
55.70 (*1.where_*) "\<not> matches (?a = 0)\n ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) \<or>\n"
55.71 (*1.where_*) ^ "\<not> lhs ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) is_poly_in x",
55.72 @@ -247,7 +247,7 @@
55.73 (*NEW*) (Pstate i, c) => (i, c)
55.74 (*NEW*) | _ => error "LI.by_tactic Check_Postcond': uncovered case get_loc";
55.75
55.76 -(* *)if eq_set op = (map (UnparseC.term_in_ctxt @{context}) (get_assumptions ctxt_parent), [
55.77 +(* *)if eq_set op = (map (UnparseC.term @{context}) (get_assumptions ctxt_parent), [
55.78 (*0.where_*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
55.79 (*1.where_*) "\<not> matches (?a = 0)\n ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) \<or>\n"
55.80 (*1.where_*) ^ "\<not> lhs ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) is_poly_in x",
55.81 @@ -258,7 +258,7 @@
55.82
55.83 val (prog_res', ctxt') =
55.84 ContextC.subpbl_to_caller sub_ctxt prog_res ctxt_parent;
55.85 -(* *)if eq_set op = (map (UnparseC.term_in_ctxt @{context}) (get_assumptions ctxt'), [
55.86 +(* *)if eq_set op = (map (UnparseC.term @{context}) (get_assumptions ctxt'), [
55.87 (*0.where_*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
55.88 (*1.where_*) "\<not> matches (?a = 0)\n ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) \<or>\n"
55.89 (*1.where_*) ^ "\<not> lhs ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) is_poly_in x",
55.90 @@ -305,7 +305,7 @@
55.91 (*[], Res*)val (p,_,f,nxt,_,pt) = me nxt''''' p''''' [] pt''''';(*\<rightarrow>End_Proof'*)
55.92
55.93 (*/-------- final test -----------------------------------------------------------------------\*)
55.94 -if f2str f = "[x = 6 / 5]" andalso map (UnparseC.term_in_ctxt @{context}) (Ctree.get_assumptions pt p) = [
55.95 +if f2str f = "[x = 6 / 5]" andalso map (UnparseC.term @{context}) (Ctree.get_assumptions pt p) = [
55.96 "x = 6 / 5",
55.97 "lhs (- 6 * x + 5 * x \<up> 2 = 0) is_poly_in x", "lhs (- 6 * x + 5 * x \<up> 2 = 0) has_degree_in x = 2",
55.98 "\<not> matches (?a = 0)\n ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) \<or>\n\<not> lhs ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)) is_poly_in x",
56.1 --- a/test/Tools/isac/BaseDefinitions/rewrite-order.sml Sat Feb 04 16:49:08 2023 +0100
56.2 +++ b/test/Tools/isac/BaseDefinitions/rewrite-order.sml Sat Feb 04 17:00:25 2023 +0100
56.3 @@ -95,8 +95,8 @@
56.4 (*+*)term_ord' pr (ThyC.get_theory "Isac_Knowledge"): term * term -> order;
56.5 "~~~~~ fun list_ord , args:"; val (elem_ord, (xs, ys)) =
56.6 ((term_ord' pr (ThyC.get_theory "Isac_Knowledge")), (ts, us));
56.7 -(*+*)UnparseC.terms_in_ctxt @{context} xs = "[\"- 2\", \"x\"]"; (*isa == ?*)
56.8 -(*+*)UnparseC.terms_in_ctxt @{context} ys = "[\"x\", \"- 2\"]"; (*isa == ?*)
56.9 +(*+*)UnparseC.terms @{context} xs = "[\"- 2\", \"x\"]"; (*isa == ?*)
56.10 +(*+*)UnparseC.terms @{context} ys = "[\"x\", \"- 2\"]"; (*isa == ?*)
56.11 val EQUAL =
56.12 (*case*) int_ord (length xs, length ys) (*of*);
56.13
57.1 --- a/test/Tools/isac/BaseDefinitions/substitution.sml Sat Feb 04 16:49:08 2023 +0100
57.2 +++ b/test/Tools/isac/BaseDefinitions/substitution.sml Sat Feb 04 17:00:25 2023 +0100
57.3 @@ -99,7 +99,7 @@
57.4
57.5 val SOME tm = scan prog;
57.6 val subst = tm |> subst_atomic env;
57.7 -if UnparseC.term_in_ctxt @{context} tm = "[(''bdv'', v_v)]" then () else error "for_bdv changed 1";
57.8 +if UnparseC.term @{context} tm = "[(''bdv'', v_v)]" then () else error "for_bdv changed 1";
57.9
57.10 if Subst.program_to_input ctxt subst = (["(''bdv'', x)"] : Subst.input) then ()
57.11 else error "for_bdv changed 2";
58.1 --- a/test/Tools/isac/BaseDefinitions/termC.sml Sat Feb 04 16:49:08 2023 +0100
58.2 +++ b/test/Tools/isac/BaseDefinitions/termC.sml Sat Feb 04 17:00:25 2023 +0100
58.3 @@ -182,17 +182,17 @@
58.4 "----------- inst_bdv -----------------------------------";
58.5 "----------- inst_bdv -----------------------------------";
58.6 "----------- inst_bdv -----------------------------------";
58.7 - if (UnparseC.term_in_ctxt @{context} o Thm.prop_of) @{thm d1_isolate_add2} =
58.8 + if (UnparseC.term @{context} o Thm.prop_of) @{thm d1_isolate_add2} =
58.9 "\<not> ?bdv occurs_in ?a \<Longrightarrow>\n(?a + ?bdv = 0) = (?bdv = - 1 * ?a)"
58.10 then ()
58.11 else error "termC.sml d1_isolate_add2";
58.12 val subst = [(ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "x")];
58.13 val t = (Eval.norm o Thm.prop_of) @{thm d1_isolate_add2};
58.14 val t' = TermC.inst_bdv subst t;
58.15 - if UnparseC.term_in_ctxt @{context} t' = "\<not> x occurs_in ?a \<Longrightarrow> (?a + x = 0) = (x = - 1 * ?a)"
58.16 + if UnparseC.term @{context} t' = "\<not> x occurs_in ?a \<Longrightarrow> (?a + x = 0) = (x = - 1 * ?a)"
58.17 then ()
58.18 else error "termC.sml inst_bdv 1";
58.19 -if (UnparseC.term_in_ctxt @{context} o Thm.prop_of) @{thm separate_bdvs_add} =
58.20 +if (UnparseC.term @{context} o Thm.prop_of) @{thm separate_bdvs_add} =
58.21 "[] from [?bdv_1.0, ?bdv_2.0, ?bdv_3.0,\n " ^
58.22 "?bdv_4.0] occur_exactly_in ?a \<Longrightarrow>\n(?a + ?b = ?c) = (?b = ?c + - (1::?'a) * ?a)"
58.23 then () else error "termC.sml separate_bdvs_add";
58.24 @@ -206,7 +206,7 @@
58.25 val t = (Eval.norm o Thm.prop_of) @{thm separate_bdvs_add};
58.26 val t' = TermC.inst_bdv subst t;
58.27
58.28 -if UnparseC.term_in_ctxt @{context} t' = "[] from [c, c_2, c_3, c_4] occur_exactly_in ?a \<Longrightarrow>\n" ^
58.29 +if UnparseC.term @{context} t' = "[] from [c, c_2, c_3, c_4] occur_exactly_in ?a \<Longrightarrow>\n" ^
58.30 "(?a + ?b = ?c) = (?b = ?c + - (1::?'a) * ?a)"
58.31 then () else error "termC.sml inst_bdv 2";
58.32
58.33 @@ -219,13 +219,13 @@
58.34 val (all_Free_subst, t') = TermC.subst_atomic_all env t;
58.35
58.36 if all_Free_subst andalso
58.37 - UnparseC.term_in_ctxt @{context} t' = "tl [c, c_2] from [c, c_2] occur_exactly_in NTH 1 [c_2 = 0, c + c_2 = 1]"
58.38 + UnparseC.term @{context} t' = "tl [c, c_2] from [c, c_2] occur_exactly_in NTH 1 [c_2 = 0, c + c_2 = 1]"
58.39 then ()
58.40 else error "termC.sml subst_atomic_all should be 'true'";
58.41
58.42 val (all_Free_subst, t') = TermC.subst_atomic_all (tl env) t;
58.43 if not all_Free_subst andalso
58.44 - UnparseC.term_in_ctxt @{context} t' = "tl vs_vs from vs_vs occur_exactly_in NTH 1 [c_2 = 0, c + c_2 = 1]" then ()
58.45 + UnparseC.term @{context} t' = "tl vs_vs from vs_vs occur_exactly_in NTH 1 [c_2 = 0, c + c_2 = 1]" then ()
58.46 else error "TermC.subst_atomic_all should be 'false'";
58.47
58.48 "----------- Pattern.match ------------------------------";
58.49 @@ -451,7 +451,7 @@
58.50 val t = (thy, str) |>> Proof_Context.init_global
58.51 |-> Proof_Context.read_term_pattern;
58.52 val t_real = ParseC.adapt_term_to_type ctxt t;
58.53 -if UnparseC.term_in_ctxt ctxt t_real =
58.54 +if UnparseC.term ctxt t_real =
58.55 "\<not> (matchsub ((?a::real) + ((?b::real) + (?c::real))) (t_t::real) \<or>\n "
58.56 ^ "matchsub (?a + (?b - ?c)) t_t \<or>\n "
58.57 ^ "matchsub (?a - (?b + ?c)) t_t \<or> matchsub (?a + (?b - ?c)) t_t)" then ()
58.58 @@ -465,7 +465,7 @@
58.59 val t = @{term "x + 1"};
58.60 val str_markup = (Syntax.string_of_term
58.61 (Proof_Context.init_global (ThyC.get_theory "Isac_Knowledge"))) t;
58.62 - val str = UnparseC.term_in_ctxt @{context} t;
58.63 + val str = UnparseC.term @{context} t;
58.64
58.65 writeln "----------------writeln str_markup---";
58.66 writeln str_markup;
58.67 @@ -503,7 +503,7 @@
58.68 val t = @{term "x + 1"};
58.69 val str_markup = (Syntax.string_of_term
58.70 (Proof_Context.init_global (ThyC.get_theory "Isac_Knowledge"))) t;
58.71 - val str = UnparseC.term_in_ctxt @{context} t;
58.72 + val str = UnparseC.term @{context} t;
58.73
58.74 writeln "----------------writeln str_markup---";
58.75 writeln str_markup;
58.76 @@ -608,11 +608,11 @@
58.77 val t = ParseC.parse_test @{context} "R=(R::real)";
58.78 val T = type_of t;
58.79 val ss = TermC.list2isalist T [t,t,t];
58.80 -if UnparseC.term_in_ctxt @{context} ss = "[R = R, R = R, R = R]" then () else error "list2isalist 1";
58.81 +if UnparseC.term @{context} ss = "[R = R, R = R, R = R]" then () else error "list2isalist 1";
58.82
58.83 val t = ParseC.parse_test @{context} "[a=b,c=d,e=f]";
58.84 val il = TermC.isalist2list t;
58.85 -if UnparseC.terms_in_ctxt @{context} il = "[a = b, c = d, e = f]" then () else error "isalist2list 2";
58.86 +if UnparseC.terms @{context} il = "[a = b, c = d, e = f]" then () else error "isalist2list 2";
58.87
58.88 val t = ParseC.parse_test @{context} "ss___s::bool list";
58.89 (TermC.isalist2list t; error "isalist2list 1") handle TERM ("isalist2list applied to NON-list: ", _) =>();
58.90 @@ -621,7 +621,7 @@
58.91 "----------- fun TermC.strip_imp_prems', fun TermC.ins_concl -----------------------------------------------";
58.92 "----------- fun TermC.strip_imp_prems', fun TermC.ins_concl -----------------------------------------------";
58.93 val prop = Thm.prop_of @{thm real_mult_div_cancel2};
58.94 -UnparseC.term_in_ctxt @{context} prop = "?k \<noteq> 0 \<Longrightarrow> ?m * ?k / (?n * ?k) = ?m / ?n";
58.95 +UnparseC.term @{context} prop = "?k \<noteq> 0 \<Longrightarrow> ?m * ?k / (?n * ?k) = ?m / ?n";
58.96 val t as Const (\<^const_name>\<open>Pure.imp\<close>, _) $
58.97 (Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Var (("k", 0), _) $ Const (\<^const_name>\<open>Groups.zero\<close>, _)))) $
58.98 (Const (\<^const_name>\<open>Trueprop\<close>, _) $
58.99 @@ -630,7 +630,7 @@
58.100 (Const (\<^const_name>\<open>times\<close>, _) $ Var (("n", 0), _) $ Var (("k", 0), _))) $
58.101 (Const (\<^const_name>\<open>divide\<close>, _) $ Var (("m", 0), _) $ Var (("n", 0), _)))) = prop;
58.102 val SOME t' = TermC.strip_imp_prems' t;
58.103 -if UnparseC.term_in_ctxt @{context} t' = "(\<Longrightarrow>) (?k \<noteq> 0)" then () else error "TermC.strip_imp_prems' changed";
58.104 +if UnparseC.term @{context} t' = "(\<Longrightarrow>) (?k \<noteq> 0)" then () else error "TermC.strip_imp_prems' changed";
58.105
58.106 val thm = @{thm frac_sym_conv};
58.107 val prop = Thm.prop_of thm;
58.108 @@ -644,12 +644,12 @@
58.109 "----------- fun mk_factroot, fun mk_num_op_num, -----------------------------------------------";
58.110 val T = type_of (ParseC.term_opt ctxt "12::real" |> the);
58.111 val t = TermC.mk_factroot "SqRoot.sqrt" T 2 3;
58.112 -if UnparseC.term_in_ctxt @{context} t = "2 * ??.SqRoot.sqrt 3" then () else error "mk_factroot";
58.113 +if UnparseC.term @{context} t = "2 * ??.SqRoot.sqrt 3" then () else error "mk_factroot";
58.114
58.115 val t = ParseC.parse_test @{context} "aaa + bbb";
58.116 val op_ as Const (\<^const_name>\<open>plus\<close>, Top) $ Free ("aaa", T1) $ Free ("bbb", T2) = t;
58.117 val t' = TermC.mk_num_op_num T1 T2 (\<^const_name>\<open>plus\<close>, Top) 2 3;
58.118 -if UnparseC.term_in_ctxt @{context} t' = "2 + 3" then () else error "mk_num_op_num";
58.119 +if UnparseC.term @{context} t' = "2 + 3" then () else error "mk_num_op_num";
58.120
58.121 "----------- fun TermC.dest_binop_typ ----------------------------------------------------------------";
58.122 "----------- fun TermC.dest_binop_typ ----------------------------------------------------------------";
59.1 --- a/test/Tools/isac/BridgeLibisabelle/use-cases.sml Sat Feb 04 16:49:08 2023 +0100
59.2 +++ b/test/Tools/isac/BridgeLibisabelle/use-cases.sml Sat Feb 04 17:00:25 2023 +0100
59.3 @@ -155,7 +155,7 @@
59.4 (*8*) autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1); (*<---------------------- orig. test code*)
59.5
59.6 val (ptp as (pt,p), tacis) = States.get_calc 1; States.get_pos 1 1; (*<---------------------- orig. test code*)
59.7 -(*+isa=REP*) if p = ([1], Frm) andalso UnparseC.term_in_ctxt @{context} (get_obj g_form pt [1]) = "1 + - 1 * 2 + x = 0"
59.8 +(*+isa=REP*) if p = ([1], Frm) andalso UnparseC.term @{context} (get_obj g_form pt [1]) = "1 + - 1 * 2 + x = 0"
59.9 andalso Istate.string_of ctxt (get_istate_LI pt p)
59.10 = "Pstate ([\"\n(e_e, 1 + - 1 * 2 + x = 0)\", \"\n(v_v, x)\"], [], empty, NONE, \n??.empty, ORundef, false, true)"
59.11 then () else error "refFormula = 1 + - 1 * 2 + x = 0 changed";
59.12 @@ -258,7 +258,7 @@
59.13
59.14 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, ip);
59.15 (*exception just above means: 'ModSpec' has been returned: error anyway*)
59.16 - if ip = ([], Res) andalso UnparseC.term_in_ctxt @{context} f = "[x = 1]" then () else
59.17 + if ip = ([], Res) andalso UnparseC.term @{context} f = "[x = 1]" then () else
59.18 error "FE-Kernel-interface.sml: diff.behav. in solve_linear as rootpbl";
59.19
59.20
59.21 @@ -407,7 +407,7 @@
59.22 val ip = States.get_pos 1 1;
59.23 val (Form f, tac, asms) = ME_Misc.pt_extract (pt, ip);
59.24 (*exception just above means: 'ModSpec' has been returned: error anyway*)
59.25 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" then () else
59.26 + if UnparseC.term @{context} f = "[x = 1]" then () else
59.27 error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
59.28 (**)-------------------------------------------------------------------------------------------*)
59.29 DEconstrCalcTree 1;
59.30 @@ -459,7 +459,7 @@
59.31 val ((pt,_),_) = States.get_calc 1;
59.32 val p = States.get_pos 1 1;
59.33 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.34 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.35 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.36 error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
59.37 DEconstrCalcTree 1;
59.38
59.39 @@ -484,7 +484,7 @@
59.40 val ((pt,_),_) = States.get_calc 1;
59.41 val p = States.get_pos 1 1;
59.42 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.43 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.44 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.45 error "FE-interface.sml: diff.behav. in solve_linear/rt AUTOCALCULATE ";
59.46 DEconstrCalcTree 1;
59.47
59.48 @@ -535,7 +535,7 @@
59.49 val ((pt,_),_) = States.get_calc 1;
59.50 val p = States.get_pos 1 1;
59.51 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.52 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.53 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.54 error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
59.55 DEconstrCalcTree 1;
59.56
59.57 @@ -597,7 +597,7 @@
59.58 val ((pt,_),_) = States.get_calc 1;
59.59 val p = States.get_pos 1 1;
59.60 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.61 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.62 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.63 error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
59.64 DEconstrCalcTree 1;
59.65
59.66 @@ -625,14 +625,14 @@
59.67 (*setContext 1 p "thy_isac_Test-rls-Test_simplify";*)
59.68 val (((pt,_),_), p) = (States.get_calc 1, States.get_pos 1 1);
59.69 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.70 - if p = ([1], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "x + 1 + - 1 * 2 = 0"
59.71 + if p = ([1], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "x + 1 + - 1 * 2 = 0"
59.72 then () else error "--- setContext..Thy --- autoCalculate 1 (Steps 1) #1";
59.73
59.74 autoCalculate 1 CompleteCalc;
59.75 val (((pt,_),_), p) = (States.get_calc 1, States.get_pos 1 1);
59.76 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.77
59.78 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) then ()
59.79 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) then ()
59.80 else error "--- setContext..Thy --- autoCalculate CompleteCalc";
59.81 DEconstrCalcTree 1;
59.82
59.83 @@ -663,7 +663,7 @@
59.84 val p = States.get_pos 1 1;
59.85
59.86 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.87 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.88 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.89 error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl 1";
59.90 DEconstrCalcTree 1;
59.91
59.92 @@ -751,7 +751,7 @@
59.93 setNextTactic 1 (Check_Postcond ["rational", "univariate", "equation"]);
59.94 val (ptp,_) = States.get_calc 1;
59.95 val (Form t,_,_) = ME_Misc.pt_extract ctxt ptp;
59.96 - if States.get_pos 1 1 = ([], Res) andalso UnparseC.term_in_ctxt @{context} t = "[x = -4 / 3]" then ()
59.97 + if States.get_pos 1 1 = ([], Res) andalso UnparseC.term @{context} t = "[x = -4 / 3]" then ()
59.98 else writeln "FE-inteface.sml: diff.behav. in rat-eq + subpbl: no_met, NO ..";
59.99 DEconstrCalcTree 1;
59.100
59.101 @@ -851,7 +851,7 @@
59.102 Test_Tool.show_pt pt;
59.103 val p = States.get_pos 1 1;
59.104 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.105 - if UnparseC.term_in_ctxt @{context} f = "[x = - 1, x = -3]" andalso p = ([], Res) then () else
59.106 + if UnparseC.term @{context} f = "[x = - 1, x = -3]" andalso p = ([], Res) then () else
59.107 error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
59.108
59.109 (*------------ \<up> -inserted-----------------------------------------------*)
59.110 @@ -874,7 +874,7 @@
59.111 Test_Tool.show_pt pt;
59.112 val p = States.get_pos 1 1;
59.113 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.114 - if UnparseC.term_in_ctxt @{context} f = "[x = - 1, x = -3]" andalso p = ([], Res) then () else
59.115 + if UnparseC.term @{context} f = "[x = - 1, x = -3]" andalso p = ([], Res) then () else
59.116 error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
59.117 DEconstrCalcTree 1;
59.118 ( *\-----ERROR INTRODUCED BY CHILD OF 33913fe24685 --------------------------------------------/*)
59.119 @@ -1048,7 +1048,7 @@
59.120 val ((pt,_),_) = States.get_calc 1;
59.121 val p = States.get_pos 1 1;
59.122 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.123 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) andalso map (UnparseC.term_in_ctxt @{context}) asms = [] then ()
59.124 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) andalso map (UnparseC.term @{context}) asms = [] then ()
59.125 else error "FE-interface.sml: diff.behav. in from pbl -hierarchy 1";
59.126 DEconstrCalcTree 1;
59.127
59.128 @@ -1066,7 +1066,7 @@
59.129 val ((pt,_),_) = States.get_calc 1;
59.130 val p = States.get_pos 1 1;
59.131 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.132 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) andalso map (UnparseC.term_in_ctxt @{context}) asms = [] then ()
59.133 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) andalso map (UnparseC.term @{context}) asms = [] then ()
59.134 else error "FE-interface.sml: diff.behav. in from pbl -hierarchy 2";
59.135 DEconstrCalcTree 1;
59.136 *)
59.137 @@ -1153,18 +1153,18 @@
59.138 val p = States.get_pos 1 1;
59.139 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.140 (*============ inhibit exn WN120316 compare 2002-- 2011 ===========================
59.141 -if map (UnparseC.term_in_ctxt @{context}) asms =
59.142 +if map (UnparseC.term @{context}) asms =
59.143 ["True |\n~ lhs ((3 + - 1 * x + x \<up> 2) * x =\n" ^
59.144 " 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)) is_poly_in x", "-6 * x + 5 * x \<up>\<up> 2 = 0",
59.145 "lhs (-6 * x + 5 * x \<up> 2 = 0) is_poly_in x",
59.146 "lhs (-6 * x + 5 * x \<up>\<up> 2 = 0) has_degree_in x = 2",
59.147 "9 * x + -6 * x \<up> 2 + x \<up> 3 ~= 0"]
59.148 -andalso UnparseC.term_in_ctxt @{context} f = "[-6 * x + 5 * x \<up> 2 = 0]" andalso p = ([], Res) then ()
59.149 +andalso UnparseC.term @{context} f = "[-6 * x + 5 * x \<up> 2 = 0]" andalso p = ([], Res) then ()
59.150 else error "TODO compare 2002-- 2011"; (*...data during test --- x / (x \<up> 2 - 6 * x + 9) - 1...*)
59.151 ============ inhibit exn WN120316 compare 2002-- 2011 ===========================*)
59.152
59.153 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} f = "[x = 6 / 5]"
59.154 -andalso map (UnparseC.term_in_ctxt @{context}) asms = []
59.155 +if p = ([], Res) andalso UnparseC.term @{context} f = "[x = 6 / 5]"
59.156 +andalso map (UnparseC.term @{context}) asms = []
59.157 then () else error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 55b [x = 6 / 5]";
59.158
59.159 (*UC\label{SOLVE:HELP:assumptions} UC 30.3.5.1 p.178*)
59.160 @@ -1222,7 +1222,7 @@
59.161 val ((pt,_),_) = States.get_calc 1;
59.162 val p = States.get_pos 1 1;
59.163 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.164 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.165 + if UnparseC.term @{context} f = "[x = 1]" andalso p = ([], Res) then () else
59.166 error "FE-interface.sml: diff.behav. in combinations of steps";
59.167 DEconstrCalcTree 1;
59.168
59.169 @@ -1246,7 +1246,7 @@
59.170 val ((pt,_),_) = States.get_calc 1;
59.171 val p = States.get_pos 1 1;
59.172 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.173 - if UnparseC.term_in_ctxt @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.174 + if UnparseC.term @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.175 error "FE-interface.sml: diff.behav. in FORMULA:enter} right";
59.176 DEconstrCalcTree 1;
59.177
59.178 @@ -1269,7 +1269,7 @@
59.179 val ((pt,_),_) = States.get_calc 1;
59.180 val p = States.get_pos 1 1;
59.181 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.182 - if UnparseC.term_in_ctxt @{context} f = "x - 1 = 0" andalso p = ([2], Res) then () else
59.183 + if UnparseC.term @{context} f = "x - 1 = 0" andalso p = ([2], Res) then () else
59.184 error "FE-interface.sml: diff.behav. in FORMULA:enter} other";
59.185 DEconstrCalcTree 1;
59.186
59.187 @@ -1293,7 +1293,7 @@
59.188 val ((pt,_),_) = States.get_calc 1;
59.189 val p = States.get_pos 1 1;
59.190 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.191 - if UnparseC.term_in_ctxt @{context} f = "x = 1" andalso p = ([3,2], Res) then () else
59.192 + if UnparseC.term @{context} f = "x = 1" andalso p = ([3,2], Res) then () else
59.193 error "FE-interface.sml: diff.behav. in FORMULA:enter} oth 2";
59.194 DEconstrCalcTree 1;
59.195
59.196 @@ -1314,7 +1314,7 @@
59.197 val ((pt,_),_) = States.get_calc 1;
59.198 val p = States.get_pos 1 1;
59.199 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.200 - if UnparseC.term_in_ctxt @{context} f = "x + 1 + - 1 * 2 = 0" andalso p = ([1], Res) then () else
59.201 + if UnparseC.term @{context} f = "x + 1 + - 1 * 2 = 0" andalso p = ([1], Res) then () else
59.202 error "FE-interface.sml: diff.behav. in FORMULA:enter} NOTok";
59.203 DEconstrCalcTree 1;
59.204
59.205 @@ -1335,7 +1335,7 @@
59.206 val ((pt,_),_) = States.get_calc 1;
59.207 val p = States.get_pos 1 1;
59.208 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.209 - if UnparseC.term_in_ctxt @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.210 + if UnparseC.term @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.211 error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
59.212 if map fst3 (ME_Misc.get_interval ctxt ([2],Res) ([],Res) 9999 pt) =
59.213 [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
59.214 @@ -1356,7 +1356,7 @@
59.215 val ((pt,_),_) = States.get_calc 2;
59.216 val p = States.get_pos 2 1;
59.217 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.218 - if UnparseC.term_in_ctxt @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.219 + if UnparseC.term @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.220 error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
59.221 if map fst3 (ME_Misc.get_interval ctxt ([2],Res) ([],Res) 9999 pt) =
59.222 [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
59.223 @@ -1384,7 +1384,7 @@
59.224 Test_Tool.show_pt pt;
59.225 val p = States.get_pos 1 1;
59.226 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.227 - if UnparseC.term_in_ctxt @{context} f = "x - 1 = 0" andalso p = ([2], Res) then () else
59.228 + if UnparseC.term @{context} f = "x - 1 = 0" andalso p = ([2], Res) then () else
59.229 error "FE-interface.sml: diff.behav. in FORMULA:replace} other 1";
59.230 (* for getting the list in whole length ...
59.231 (*default_print_depth 99*) map fst3 (ME_Misc.get_interval ctxt ([1],Res) ([],Res) 9999 pt); (*default_print_depth 3*)
59.232 @@ -1415,7 +1415,7 @@
59.233
59.234 val ((pt,_),_) = States.get_calc 1;
59.235 Test_Tool.show_pt pt; (*error: ...ME_Misc.get_interval drops ([3,2],Res) ...*)
59.236 - val (t,_) = get_obj g_result pt [3,2]; UnparseC.term_in_ctxt @{context} t;
59.237 + val (t,_) = get_obj g_result pt [3,2]; UnparseC.term @{context} t;
59.238 if map fst3 (ME_Misc.get_interval ctxt ([1],Res) ([],Res) 9999 pt) =
59.239 [([1], Res), ([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res),
59.240 ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
59.241 @@ -1424,7 +1424,7 @@
59.242
59.243 val p = States.get_pos 1 1;
59.244 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.245 - if UnparseC.term_in_ctxt @{context} f = "x = 1" andalso p = ([3,2], Res) then () else
59.246 + if UnparseC.term @{context} f = "x = 1" andalso p = ([3,2], Res) then () else
59.247 error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 2";
59.248 DEconstrCalcTree 1;
59.249
59.250 @@ -1446,7 +1446,7 @@
59.251 Test_Tool.show_pt pt;
59.252 val p = States.get_pos 1 1;
59.253 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.254 - if UnparseC.term_in_ctxt @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.255 + if UnparseC.term @{context} f = "- 1 + x = 0" andalso p = ([2], Res) then () else
59.256 error "FE-interface.sml: diff.behav. in FORMULA:replace} NOTok";
59.257 DEconstrCalcTree 1;
59.258
59.259 @@ -1470,7 +1470,7 @@
59.260 val p = States.get_pos 1 1;
59.261 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.262
59.263 - if p = ([1], Res) andalso UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))"
59.264 + if p = ([1], Res) andalso UnparseC.term @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))"
59.265 then case get_obj g_tac pt (fst p) of Rewrite_Inst (["(''bdv'', x)"],
59.266 ("diff_sum", thm)) => () | _ => error "embed fun fill_form changed 0"
59.267 | _ => error "embed fun fill_form changed 1"
59.268 @@ -1484,7 +1484,7 @@
59.269 val p = States.get_pos 1 1;
59.270
59.271 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.272 - if p = ([1], Res) andalso UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" andalso
59.273 + if p = ([1], Res) andalso UnparseC.term @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" andalso
59.274 get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sum", "Diff.diff_sum"(*?!?*)))
59.275 then ()
59.276 else error "embed fun fill_form changed 2";
59.277 @@ -1498,7 +1498,7 @@
59.278 val p = States.get_pos 1 1;
59.279 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.280 if p = ([1], Res) andalso existpt [2] pt andalso
59.281 - UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up>\<up> 4))" andalso
59.282 + UnparseC.term @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up>\<up> 4))" andalso
59.283 get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sum", "Diff.diff_sum"))
59.284 then () else error "embed fun fill_form changed 3";
59.285
59.286 @@ -1507,7 +1507,7 @@
59.287 val p = States.get_pos 1 1;
59.288 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.289 if p = ([2], Res) andalso
59.290 - UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x (x \<up> 4)" andalso
59.291 + UnparseC.term @{context} f = "d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x (x \<up> 4)" andalso
59.292 get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sin_chain", ""))
59.293 then () else error "inputFillFormula changed 11";
59.294
59.295 @@ -1517,7 +1517,7 @@
59.296 val ((pt, _),_) = States.get_calc 1;
59.297 val p = States.get_pos 1 1;
59.298 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
59.299 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} f = "2 * x + cos (x \<up> 4) * 4 * x \<up> 3"
59.300 +if p = ([], Res) andalso UnparseC.term @{context} f = "2 * x + cos (x \<up> 4) * 4 * x \<up> 3"
59.301 then () else error "inputFillFormula changed 12";
59.302 Test_Tool.show_pt pt;
59.303 (*[
60.1 --- a/test/Tools/isac/Interpret/error-pattern.sml Sat Feb 04 16:49:08 2023 +0100
60.2 +++ b/test/Tools/isac/Interpret/error-pattern.sml Sat Feb 04 17:00:25 2023 +0100
60.3 @@ -49,9 +49,9 @@
60.4 "--------- appendFormula: on Res + equ_nrls ----------------------";
60.5 "--------- appendFormula: on Res + equ_nrls ----------------------";
60.6 val Prog sc = (#program o MethodC.from_store ctxt) ["Test", "squ-equ-test-subpbl1"];
60.7 - (writeln o UnparseC.term_in_ctxt @{context}) sc;
60.8 + (writeln o UnparseC.term @{context}) sc;
60.9 val Prog sc = (#program o MethodC.from_store ctxt) ["Test", "solve_linear"];
60.10 - (writeln o UnparseC.term_in_ctxt @{context}) sc;
60.11 + (writeln o UnparseC.term @{context}) sc;
60.12
60.13 States.reset ();
60.14 CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
60.15 @@ -89,7 +89,7 @@
60.16 moveDown 1 ([2,4],Res); refFormula 1 ([2,5],Res);
60.17 moveDown 1 ([2,5],Res); refFormula 1 ([2,6],Res);
60.18 val ((pt,_),_) = States.get_calc 1;
60.19 - if "- 2 * 1 + (1 + x) = 0" = UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt [2,6])) then()
60.20 + if "- 2 * 1 + (1 + x) = 0" = UnparseC.term @{context} (fst (get_obj g_result pt [2,6])) then()
60.21 else error "inform.sml: diff.behav.appendFormula: on Res + equ 2";
60.22
60.23 fetchProposedTactic 1; (*takes Iterator 1 _1_*)
60.24 @@ -102,7 +102,7 @@
60.25
60.26 autoCalculate 1 CompleteCalc;
60.27 val ((pt,_),_) = States.get_calc 1;
60.28 - if "[x = 1]" = UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt [])) then ()
60.29 + if "[x = 1]" = UnparseC.term @{context} (fst (get_obj g_result pt [])) then ()
60.30 else error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
60.31 (* autoCalculate 1 CompleteCalc;
60.32 val ((pt,p),_) = States.get_calc 1;
60.33 @@ -157,7 +157,7 @@
60.34 moveDown 1 ([1,4],Res); refFormula 1 ([1,5],Res);
60.35 moveDown 1 ([1,5],Res); refFormula 1 ([1,6],Res);
60.36 val ((pt,_),_) = States.get_calc 1;
60.37 - if "2 + - 1 + x = 2" = UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt [1,6])) then()
60.38 + if "2 + - 1 + x = 2" = UnparseC.term @{context} (fst (get_obj g_result pt [1,6])) then()
60.39 else error "inform.sml: diff.behav.appendFormula: on Frm + equ 1";
60.40
60.41 fetchProposedTactic 1; (*takes Iterator 1 _1_*)
60.42 @@ -166,7 +166,7 @@
60.43 | _ => error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
60.44 autoCalculate 1 CompleteCalc;
60.45 val ((pt,_),_) = States.get_calc 1;
60.46 - if "[x = 1]" = UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt [])) then ()
60.47 + if "[x = 1]" = UnparseC.term @{context} (fst (get_obj g_result pt [])) then ()
60.48 else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
60.49 DEconstrCalcTree 1;
60.50
60.51 @@ -196,7 +196,7 @@
60.52 | _ => error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
60.53 autoCalculate 1 CompleteCalc;
60.54 val ((pt,_),_) = States.get_calc 1;
60.55 - if "[x = 1]" = UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt [])) then ()
60.56 + if "[x = 1]" = UnparseC.term @{context} (fst (get_obj g_result pt [])) then ()
60.57 else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
60.58 DEconstrCalcTree 1;
60.59
60.60 @@ -229,7 +229,7 @@
60.61 | _ => error "inform.sml: diff.behav.appendFormula: Res + late d 2";
60.62 autoCalculate 1 CompleteCalc;
60.63 val ((pt,_),_) = States.get_calc 1;
60.64 - if "[x = 1]" = UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt [])) then ()
60.65 + if "[x = 1]" = UnparseC.term @{context} (fst (get_obj g_result pt [])) then ()
60.66 else error "inform.sml: diff.behav.appendFormula: Res + late d 3";
60.67 DEconstrCalcTree 1;
60.68
60.69 @@ -252,7 +252,7 @@
60.70 else error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
60.71 autoCalculate 1 CompleteCalc;
60.72 val ((pt,p),_) = States.get_calc 1;
60.73 - if "[x = 3 + - 2 * 1]" = UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt [])) then ()
60.74 + if "[x = 3 + - 2 * 1]" = UnparseC.term @{context} (fst (get_obj g_result pt [])) then ()
60.75 (* ~~~~~~~~~~ simplify as last step in any script ?!*)
60.76 else error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
60.77 DEconstrCalcTree 1;
60.78 @@ -299,7 +299,7 @@
60.79
60.80 autoCalculate 1 CompleteCalc;
60.81 val ((pt,pos as (p,_)),_) = States.get_calc 1;
60.82 - if pos = ([],Res) andalso "[x = 1]" = (UnparseC.term_in_ctxt @{context} o fst) (get_obj g_result pt p) then()
60.83 + if pos = ([],Res) andalso "[x = 1]" = (UnparseC.term @{context} o fst) (get_obj g_result pt p) then()
60.84 else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
60.85 DEconstrCalcTree 1;
60.86
60.87 @@ -323,7 +323,7 @@
60.88 else error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
60.89 autoCalculate 1 CompleteCalc;
60.90 val ((pt,pos as (p,_)),_) = States.get_calc 1;
60.91 - if pos = ([],Res) andalso "[x = 1]" = (UnparseC.term_in_ctxt @{context} o fst)(get_obj g_result pt p) then()
60.92 + if pos = ([],Res) andalso "[x = 1]" = (UnparseC.term @{context} o fst)(get_obj g_result pt p) then()
60.93 else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
60.94 DEconstrCalcTree 1;
60.95
60.96 @@ -346,7 +346,7 @@
60.97 else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
60.98 autoCalculate 1 CompleteCalc;
60.99 val ((pt,pos as (p,_)),_) = States.get_calc 1;
60.100 - if pos = ([],Res) andalso "[x = 1]" = (UnparseC.term_in_ctxt @{context} o fst)(get_obj g_result pt p) then()
60.101 + if pos = ([],Res) andalso "[x = 1]" = (UnparseC.term @{context} o fst)(get_obj g_result pt p) then()
60.102 else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
60.103 DEconstrCalcTree 1;
60.104
60.105 @@ -615,8 +615,8 @@
60.106 autoCalculate 1 CompleteCalc;
60.107 val ((pt, p), _) = States.get_calc 1;
60.108 val (t, asm) = get_obj g_result pt [];
60.109 -if UnparseC.term_in_ctxt @{context} t = "(a * d * f + b * c * f + b * d * e) / (b * d * f)" andalso
60.110 -UnparseC.terms_in_ctxt @{context} asm =(*"[\"b * d * f \<noteq> 0\",\"d \<noteq> 0\",\"b \<noteq> 0\",\"a * x / (b * x) + c * x / (d * x) + e / f is_ratpolyexp\"]"*)
60.111 +if UnparseC.term @{context} t = "(a * d * f + b * c * f + b * d * e) / (b * d * f)" andalso
60.112 +UnparseC.terms @{context} asm =(*"[\"b * d * f \<noteq> 0\",\"d \<noteq> 0\",\"b \<noteq> 0\",\"a * x / (b * x) + c * x / (d * x) + e / f is_ratpolyexp\"]"*)
60.113 "[]" (*..found broken in child of 33913fe24685, error covered by CAS-command *)
60.114 then () else error "inform [rational,simplification] changed at end";
60.115 (*Test_Tool.show_pt pt;
60.116 @@ -701,7 +701,7 @@
60.117 val Form res = (#1 o ME_Misc.pt_extract) (pt, ([],Res));
60.118 Test_Tool.show_pt pt;
60.119
60.120 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} res = "1 + 2 * x" then ()
60.121 +if p = ([], Res) andalso UnparseC.term @{context} res = "1 + 2 * x" then ()
60.122 else error "diff.sml behav.changed for Diff (x \<up> 2 + x + 1, x)";
60.123 DEconstrCalcTree 1;
60.124 -----------------------------------------------------------------------------------------------*)
60.125 @@ -743,7 +743,7 @@
60.126 autoCalculate 1 (Steps 1);
60.127 val ((pt,p),_) = States.get_calc 1;
60.128 val Form res = (#1 o (ME_Misc.pt_extract ctxt)) (pt, p);
60.129 -if UnparseC.term_in_ctxt @{context} res = "d_d x (x \<up> 2 + x + 1)" then ()
60.130 +if UnparseC.term @{context} res = "d_d x (x \<up> 2 + x + 1)" then ()
60.131 else error "diff.sml Diff (x \<up> 2 + x + 1, x) from exp";
60.132 DEconstrCalcTree 1;
60.133
60.134 @@ -958,7 +958,7 @@
60.135 val subst = [(ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "x")]: subst;
60.136 val t = ParseC.parse_test @{context} "d_d x (x \<up> 2 + sin (x \<up> 4))";
60.137 val SOME (t, _) = rewrite_set_inst_ ctxt false subst norm_diff t;
60.138 -if UnparseC.term_in_ctxt @{context} t = "2 * x + cos (x \<up> 4) * 4 * x \<up> 3" then ()
60.139 +if UnparseC.term @{context} t = "2 * x + cos (x \<up> 4) * 4 * x \<up> 3" then ()
60.140 else error "build fun check_for' ?bdv changed 1";
60.141
60.142 val rls = norm_diff
60.143 @@ -967,19 +967,19 @@
60.144
60.145 val (res', _, _, rewritten) = (*rewritten: the lhs of the pattern TermC.matches in res*)
60.146 rew_sub ctxt 1 subst Rewrite_Ord.function_empty Rule_Set.empty false [] (HOLogic.Trueprop $ pat) res;
60.147 -if UnparseC.term_in_ctxt @{context} res' = "2 * x + cos (d_d x (x \<up> 4))" andalso rewritten then ()
60.148 +if UnparseC.term @{context} res' = "2 * x + cos (d_d x (x \<up> 4))" andalso rewritten then ()
60.149 else error "build fun check_for' ?bdv changed 2";
60.150
60.151 val norm_res = case rewrite_set_inst_ ctxt false subst rls res' of
60.152 NONE => res'
60.153 | SOME (norm_res, _) => norm_res;
60.154 -if UnparseC.term_in_ctxt @{context} norm_res = "2 * x + cos (4 * x \<up> 3)" then ()
60.155 +if UnparseC.term @{context} norm_res = "2 * x + cos (4 * x \<up> 3)" then ()
60.156 else error "build fun check_for' ?bdv changed 3";
60.157
60.158 val norm_inf = case rewrite_set_inst_ ctxt false subst rls inf of
60.159 NONE => inf
60.160 | SOME (norm_inf, _) => norm_inf;
60.161 -if UnparseC.term_in_ctxt @{context} norm_inf = "2 * x + cos (4 * x \<up> 3)" then ()
60.162 +if UnparseC.term @{context} norm_inf = "2 * x + cos (4 * x \<up> 3)" then ()
60.163 else error "build fun check_for' ?bdv changed 4";
60.164
60.165 res' = inf;
60.166 @@ -1058,8 +1058,8 @@
60.167
60.168 val {env, ...} = Ctree.get_istate_LI pt pos |> Istate.the_pstate
60.169 ;
60.170 -(*+*)if UnparseC.term_in_ctxt @{context} f_pred = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" andalso
60.171 -(*+*) UnparseC.term_in_ctxt @{context} f_in = "d_d x (x \<up> 2) + cos (4 * x \<up> 3)"
60.172 +(*+*)if UnparseC.term @{context} f_pred = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" andalso
60.173 +(*+*) UnparseC.term @{context} f_in = "d_d x (x \<up> 2) + cos (4 * x \<up> 3)"
60.174 (*+*)then () else error "inform with (positive) Error_Pattern.check_for broken 2";
60.175
60.176 val SOME "chain-rule-diff-both" = (*case*) Error_Pattern.check_for ctxt (f_pred, f_in) (prog, env) (errpats, rew_rls) (*of*);
60.177 @@ -1160,7 +1160,7 @@
60.178 (* final test ... ----------------------------------------------------------------------------*)
60.179 (*+*)if length return_fill_from_store = 5 then
60.180 (*+*) case return_fill_from_store of
60.181 -(*+*) ("fill-d_d-arg", tm, thm, subsopt) :: _ => if UnparseC.term_in_ctxt @{context} tm =
60.182 +(*+*) ("fill-d_d-arg", tm, thm, subsopt) :: _ => if UnparseC.term @{context} tm =
60.183 (*+*) "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4)) =\nd_d x (x \<up> 2) + cos (x \<up> 4) * d_d x ?_dummy_1"
60.184 (*+*) then () else error "find_fill_patterns changed 2a"
60.185 (*+*) | _ => error "find_fill_patterns changed 2b"
60.186 @@ -1209,7 +1209,7 @@
60.187
60.188 val "fill-d_d-arg" = fill_in_id
60.189 val "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4)) =\nd_d x (x \<up> 2) + cos (x \<up> 4) * d_d x ?_dummy_1" =
60.190 - UnparseC.term_in_ctxt @{context} term
60.191 + UnparseC.term @{context} term
60.192 val "Diff.diff_sin_chain" = Thm.get_name_hint thm
60.193 val "[(''bdv'', x)]" = subst |> the |> Subst.string_of_input;
60.194
60.195 @@ -1235,10 +1235,10 @@
60.196 val p = States.get_pos 1 1;
60.197 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
60.198
60.199 - if p = ([1], Res) andalso UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" then
60.200 + if p = ([1], Res) andalso UnparseC.term @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" then
60.201 case get_obj g_tac pt (fst p) of Rewrite_Inst (["(''bdv'', x)"],
60.202 ("diff_sum", thm)) =>
60.203 - if (UnparseC.term_in_ctxt @{context} o Thm.prop_of) thm = "d_d ?bdv (?u + ?v) = d_d ?bdv ?u + d_d ?bdv ?v" then ()
60.204 + if (UnparseC.term @{context} o Thm.prop_of) thm = "d_d ?bdv (?u + ?v) = d_d ?bdv ?u + d_d ?bdv ?v" then ()
60.205 else error "embed fun fill_form changed 11"
60.206 | _ => error "embed fun fill_form changed 12"
60.207 else error "embed fun fill_form changed 13";
60.208 @@ -1250,10 +1250,10 @@
60.209 val p = States.get_pos 1 1;
60.210
60.211 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
60.212 - if p = ([1], Res) andalso UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" then
60.213 + if p = ([1], Res) andalso UnparseC.term @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" then
60.214 case get_obj g_tac pt (fst p) of Rewrite_Inst (["(''bdv'', x)"],
60.215 ("diff_sum", thm)) =>
60.216 - if (UnparseC.term_in_ctxt @{context} o Thm.prop_of) thm = "d_d ?bdv (?u + ?v) = d_d ?bdv ?u + d_d ?bdv ?v" then ()
60.217 + if (UnparseC.term @{context} o Thm.prop_of) thm = "d_d ?bdv (?u + ?v) = d_d ?bdv ?u + d_d ?bdv ?v" then ()
60.218 else error "embed fun fill_form changed 21"
60.219 | _ => error "embed fun fill_form changed 22"
60.220 else error "embed fun fill_form changed 23";
60.221 @@ -1264,10 +1264,10 @@
60.222 val p = States.get_pos 1 1;
60.223 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
60.224 if p = ([1], Res) andalso existpt [2] pt
60.225 - andalso UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))"
60.226 + andalso UnparseC.term @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))"
60.227 then case get_obj g_tac pt (fst p) of Rewrite_Inst (["(''bdv'', x)"],
60.228 ("diff_sum", thm)) =>
60.229 - if (UnparseC.term_in_ctxt @{context} o Thm.prop_of) thm = "d_d ?bdv (?u + ?v) = d_d ?bdv ?u + d_d ?bdv ?v" then ()
60.230 + if (UnparseC.term @{context} o Thm.prop_of) thm = "d_d ?bdv (?u + ?v) = d_d ?bdv ?u + d_d ?bdv ?v" then ()
60.231 else error "embed fun fill_form changed 31"
60.232 | _ => error "embed fun fill_form changed 32"
60.233 else error "embed fun fill_form changed 33";
60.234 @@ -1287,7 +1287,7 @@
60.235 val p' = lev_on p;
60.236 val tac = get_obj g_tac pt p';
60.237 val Rewrite_Inst ([bbb as "(''bdv'', x)"], ("diff_sin_chain", ttt)) = tac;
60.238 -if (UnparseC.term_in_ctxt @{context} o Thm.prop_of) ttt = "d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u" then ()
60.239 +if (UnparseC.term @{context} o Thm.prop_of) ttt = "d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u" then ()
60.240 else error "inputFillFormula changed 10";
60.241 val Applicable.Yes rew = Step.check tac (pt, pos);
60.242 val Rewrite_Inst' (_, _, _, _, _, _, _, (res, _)) = rew;
60.243 @@ -1302,10 +1302,10 @@
60.244 val ((pt, _),_) = States.get_calc 1;
60.245 val p = States.get_pos 1 1;
60.246 val (Form f, _, asms) = ME_Misc.pt_extract ctxt (pt, p);
60.247 - if p = ([2], Res) andalso UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x (x \<up> 4)"
60.248 + if p = ([2], Res) andalso UnparseC.term @{context} f = "d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x (x \<up> 4)"
60.249 then case get_obj g_tac pt (fst p) of Rewrite_Inst (["(''bdv'', x)"],
60.250 ("diff_sin_chain", thm)) =>
60.251 - if (UnparseC.term_in_ctxt @{context} o Thm.prop_of) thm = "d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u" then ()
60.252 + if (UnparseC.term @{context} o Thm.prop_of) thm = "d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u" then ()
60.253 else error "inputFillFormula changed 111"
60.254 | _ => error "inputFillFormula changed 112"
60.255 else error "inputFillFormula changed 113";
61.1 --- a/test/Tools/isac/Interpret/lucas-interpreter.sml Sat Feb 04 16:49:08 2023 +0100
61.2 +++ b/test/Tools/isac/Interpret/lucas-interpreter.sml Sat Feb 04 17:00:25 2023 +0100
61.3 @@ -118,7 +118,7 @@
61.4 (*+*)pt (*Output isa == isa2*);
61.5 (*+*)val "([\"\n(f_f, x \<up> 2 + 1)\", \"\n(v_v, x)\"], [R, L, R], empty, NONE, \n??.empty, ORundef, false, false)"
61.6 = Istate.pstate2str ist (*isa == isa2*)
61.7 -(*+*)val "Take (Integral x \<up> 2 + 1 D x)" = UnparseC.term_in_ctxt @{context} prog_tac (*isa == isa2*)
61.8 +(*+*)val "Take (Integral x \<up> 2 + 1 D x)" = UnparseC.term @{context} prog_tac (*isa == isa2*)
61.9 (*+*)val NONE = form_arg (*isa == isa2*)
61.10 (* args of tac_from_prog: ---------------------------------/*)
61.11 (* return value ------------------------------------------\*)
61.12 @@ -195,7 +195,7 @@
61.13 "~~~~~ fun scan_dn1 , args:"; val (xxx, ist, (Const (\<^const_name>\<open>Let\<close>, _) $ e $ (Abs (id, T, b))))
61.14 = (cctt, (ist |> set_path [R] |> set_or ORundef), (Program.body_of prog));
61.15
61.16 -(*+*) if UnparseC.term_in_ctxt @{context} e = "Take (Integral f_f D v_v)" then () else error "scan_dn1 Integral changed";
61.17 +(*+*) if UnparseC.term @{context} e = "Take (Integral f_f D v_v)" then () else error "scan_dn1 Integral changed";
61.18
61.19 (*case*)
61.20 scan_dn1 xxx (ist |> path_down [L, R]) e (*of*);
61.21 @@ -605,7 +605,7 @@
61.22
61.23 (*/--- final test ---------------------------------------------------------------------------\\*)
61.24 val (res, asm) = (get_obj g_result pt (fst p));
61.25 -if UnparseC.term_in_ctxt @{context} res = "2 * a" andalso map (UnparseC.term_in_ctxt @{context}) asm = []
61.26 +if UnparseC.term @{context} res = "2 * a" andalso map (UnparseC.term @{context}) asm = []
61.27 andalso p = ([], Und) andalso msg = "end-of-calculation"
61.28 andalso pr_ctree ctxt pr_short pt = ". ----- pblobj -----\n1. a + a\n"
61.29 then
62.1 --- a/test/Tools/isac/Interpret/step-solve.sml Sat Feb 04 16:49:08 2023 +0100
62.2 +++ b/test/Tools/isac/Interpret/step-solve.sml Sat Feb 04 17:00:25 2023 +0100
62.3 @@ -40,5 +40,5 @@
62.4
62.5 (*/--------- final test ----------------------------------------------------------------------\*)
62.6 val (res, asm) = (get_obj g_result pt (fst p));
62.7 -if UnparseC.term_in_ctxt @{context} res = "c + x + 1 / 3 * x \<up> 3" then ()
62.8 +if UnparseC.term @{context} res = "c + x + 1 / 3 * x \<up> 3" then ()
62.9 else error "Apply_Method with explicit Take CHANGED";
63.1 --- a/test/Tools/isac/Knowledge/algein.sml Sat Feb 04 16:49:08 2023 +0100
63.2 +++ b/test/Tools/isac/Knowledge/algein.sml Sat Feb 04 17:00:25 2023 +0100
63.3 @@ -91,7 +91,7 @@
63.4 moveActiveRoot 1;
63.5 autoCalculate 1 CompleteCalc;
63.6 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
63.7 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "L = 104" then()
63.8 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "L = 104" then()
63.9 else error "algein.sml: 'Berechnung' 'erstSymbolisch' changed";
63.10
63.11 "----------- Widerspruch 3 = 777 ---------------------------------";
63.12 @@ -104,18 +104,18 @@
63.13 val thm = ThmC.thm_from_thy thy "sym_mult_zero_right";
63.14 val t = ParseC.parse_test @{context} "0 = (0::real)";
63.15 val SOME (t',_) = rewrite_ ctxt rew_ord asm_rls false thm t;
63.16 -UnparseC.term_in_ctxt @{context} t' = "0 = ?a1 * 0"; (* = true*)
63.17 +UnparseC.term @{context} t' = "0 = ?a1 * 0"; (* = true*)
63.18
63.19 val sube = ["?a1 = (3::real)"];
63.20 (*----------------vvvvvvvvvvvvvv ERROR Unbound schematic variable: ?a1
63.21 --------------- review together with development of Widerspruch 3 = 77* )
63.22 val subte = Subst.input_to_terms @{context} sube;
63.23 -UnparseC.terms_in_ctxt @{context} subte = "[?a1 = 3]"; (* = true*)
63.24 +UnparseC.terms @{context} subte = "[?a1 = 3]"; (* = true*)
63.25 val subst = Subst.T_from_string_eqs thy sube;
63.26 foldl and_ (true, map TermC.contains_Var subte);
63.27
63.28 val t'' = subst_atomic subst t';
63.29 -UnparseC.term_in_ctxt @{context} t'' = "0 = 3 * 0"; (* = true*)
63.30 +UnparseC.term @{context} t'' = "0 = 3 * 0"; (* = true*)
63.31
63.32 val thm = ThmC.thm_from_thy thy "sym";
63.33 (*----- STOPPED.WN0x?: Widerspruch 3 = 777: sym contains "==>" instead of "=" !!!
64.1 --- a/test/Tools/isac/Knowledge/biegelinie-1.sml Sat Feb 04 16:49:08 2023 +0100
64.2 +++ b/test/Tools/isac/Knowledge/biegelinie-1.sml Sat Feb 04 17:00:25 2023 +0100
64.3 @@ -29,7 +29,7 @@
64.4
64.5 val thy = @{theory "Biegelinie"};
64.6 val ctxt = Proof_Context.init_global thy;
64.7 -fun term2s t = UnparseC.term_in_ctxt ctxt t;
64.8 +fun term2s t = UnparseC.term ctxt t;
64.9 fun rewrit thm str = fst (the (rewrite_ ctxt tless_true Rule_Set.empty true thm str));
64.10
64.11 "----------- the rules -------------------------------------------";
64.12 @@ -74,10 +74,10 @@
64.13 val M__ = ParseC.parse_test @{context}"M_b x = - 1 * x \<up> 2 / 2 + x * c + c_2";
64.14 val SOME (e1__,_) = rewrite_set_ ctxt false prog_rls
64.15 (ParseC.parse_test @{context} "(NTH::[real,bool list]=>bool) 1 " $ rm_);
64.16 -if UnparseC.term_in_ctxt @{context} e1__ = "M_b 0 = 0" then () else error "biegelinie.sml simplify NTH 1 rm_";
64.17 +if UnparseC.term @{context} e1__ = "M_b 0 = 0" then () else error "biegelinie.sml simplify NTH 1 rm_";
64.18
64.19 val SOME (x1__,_) = rewrite_set_ ctxt false prog_rls (ParseC.parse_test @{context} "argument_in (lhs (M_b 0 = 0))");
64.20 -if UnparseC.term_in_ctxt @{context} x1__ = "0" then ()
64.21 +if UnparseC.term @{context} x1__ = "0" then ()
64.22 else error "biegelinie.sml simplify argument_in (lhs (M_b 0 = 0)";
64.23
64.24
65.1 --- a/test/Tools/isac/Knowledge/biegelinie-2.sml Sat Feb 04 16:49:08 2023 +0100
65.2 +++ b/test/Tools/isac/Knowledge/biegelinie-2.sml Sat Feb 04 17:00:25 2023 +0100
65.3 @@ -33,7 +33,7 @@
65.4 val ((pt, p),_) = States.get_calc 1;
65.5 (* ERROR: THIS TEST WAS BROKEN BEFORE CS "eliminate ThmC.numerals_to_Free",
65.6 UNDETECTED BY Test_Isac_Short.thy ===========================================================\\
65.7 -if p = ([], Res) andalso (get_obj g_res pt (fst p) |> UnparseC.term_in_ctxt @{context}) =
65.8 +if p = ([], Res) andalso (get_obj g_res pt (fst p) |> UnparseC.term @{context}) =
65.9 "[Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n dy x =\n c_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]"
65.10 then () else error "auto SubProblem (_,[vonBelastungZu,Biegelinien] changed";
65.11 ===============================================================================================//*)
66.1 --- a/test/Tools/isac/Knowledge/biegelinie-3.sml Sat Feb 04 16:49:08 2023 +0100
66.2 +++ b/test/Tools/isac/Knowledge/biegelinie-3.sml Sat Feb 04 17:00:25 2023 +0100
66.3 @@ -31,7 +31,7 @@
66.4 autoCalculate 1 CompleteCalc;
66.5
66.6 val ((pt, p),_) = States.get_calc 1;
66.7 -if p = ([], Res) andalso (get_obj g_res pt (fst p) |> UnparseC.term_in_ctxt @{context}) =
66.8 +if p = ([], Res) andalso (get_obj g_res pt (fst p) |> UnparseC.term @{context}) =
66.9 "[0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]"
66.10 (*"[0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 * EI + - 24 * L * c_3 * EI + 12 * L \<up> 2 * c_2 +\n 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n (- 24 * EI),\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]"
66.11 ^^^ BEFORE fun Calc_Binop.simplify IS EVALUATEDO BY Simplifier.rewrite *)
67.1 --- a/test/Tools/isac/Knowledge/biegelinie-4.sml Sat Feb 04 16:49:08 2023 +0100
67.2 +++ b/test/Tools/isac/Knowledge/biegelinie-4.sml Sat Feb 04 17:00:25 2023 +0100
67.3 @@ -64,7 +64,7 @@
67.4 val (Form f, tac, asms) = ME_Misc.pt_extract (pt, ip);
67.5
67.6 if ip = ([3, 8, 1], Res) andalso
67.7 -UnparseC.term_in_ctxt @{context} f = "[- 1 * c_4 / - 1 = 0,\n (6 * c_4 * EI + 6 * L * c_3 * EI + -3 * L \<up> 2 * c_2 + - 1 * L \<up> 3 * c) /\n (6 * EI) =\n L \<up> 4 * q_0 / (- 24 * EI),\n c_2 = 0, c_2 + L * c = L \<up> 2 * q_0 / 2]"
67.8 +UnparseC.term @{context} f = "[- 1 * c_4 / - 1 = 0,\n (6 * c_4 * EI + 6 * L * c_3 * EI + -3 * L \<up> 2 * c_2 + - 1 * L \<up> 3 * c) /\n (6 * EI) =\n L \<up> 4 * q_0 / (- 24 * EI),\n c_2 = 0, c_2 + L * c = L \<up> 2 * q_0 / 2]"
67.9 then
67.10 case tac of
67.11 SOME (Check_Postcond ["normalise", "4x4", "LINEAR", "system"]) => ()
67.12 @@ -124,7 +124,7 @@
67.13 val (tac as Substitute ["x = (argument_in lhs (NTH 1 [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]))"], (pt, p as ([2, 1, 1], Frm))) =
67.14 (tac, (pt, p)) |> me' |> me' |> me' |> me' |> me' |> me' |> me' |> me';
67.15
67.16 -if p = ([2, 1, 1], Frm) andalso (Calc.current_formula (pt, p) |> UnparseC.term_in_ctxt @{context}) =
67.17 +if p = ([2, 1, 1], Frm) andalso (Calc.current_formula (pt, p) |> UnparseC.term @{context}) =
67.18 "y x =\nc_4 + c_3 * x +\n1 / (- 1 * EI) *\n(c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)"
67.19 then () else error "";
67.20
68.1 --- a/test/Tools/isac/Knowledge/diff-app.sml Sat Feb 04 16:49:08 2023 +0100
68.2 +++ b/test/Tools/isac/Knowledge/diff-app.sml Sat Feb 04 17:00:25 2023 +0100
68.3 @@ -487,11 +487,11 @@
68.4 (*--- 1.line in script ---*)
68.5 val t = ParseC.parse_test @{context} "(hd o (filterVar m_m)) (r_s::bool list)";
68.6 val s = subst_atomic env t;
68.7 -UnparseC.term_in_ctxt @{context} s;
68.8 +UnparseC.term @{context} s;
68.9 "(hd o filterVar A) [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]";
68.10 (*=== inhibit exn 110726=============================================================
68.11 val SOME (s',_) = rewrite_set_ thy false prog_expr s;
68.12 -val s'' = UnparseC.term_in_ctxt @{context} s';
68.13 +val s'' = UnparseC.term @{context} s';
68.14 if s''="A = a * b" then () else error "new behaviour with prog_expr 1.1.";
68.15 === inhibit exn 110726=============================================================*)
68.16 val env = env @ [(ParseC.parse_test @{context} "e_e::bool",ParseC.parse_test @{context} "A = a * b")];
68.17 @@ -499,11 +499,11 @@
68.18 (*--- 2.line: condition alone ---*)
68.19 val t = ParseC.parse_test @{context} "1 < length_h (r_s::bool list)";
68.20 val s = subst_atomic env t;
68.21 -UnparseC.term_in_ctxt @{context} s;
68.22 +UnparseC.term @{context} s;
68.23 "1 < length_h [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]";
68.24 (*=== inhibit exn 110726=============================================================
68.25 val SOME (s',_) = rewrite_set_ thy false prog_expr s;
68.26 -val s'' = UnparseC.term_in_ctxt @{context} s';
68.27 +val s'' = UnparseC.term @{context} s';
68.28 if s''=\<^const_name>\<open>True\<close> then () else error "new behaviour with prog_expr 1.2.";
68.29 === inhibit exn 110726=============================================================*)
68.30
68.31 @@ -514,7 +514,7 @@
68.32 \ [REAL m_m, REAL v_v, BOOL_LIST r_s])\
68.33 \ else (hd r_s))";
68.34 val s = subst_atomic env t;
68.35 -UnparseC.term_in_ctxt @{context} s;
68.36 +UnparseC.term @{context} s;
68.37 "if 1 < length_h [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]\
68.38 \then SubProblem (Reals_s, [make, function], [no_met])\
68.39 \ [REAL A, REAL b,\
68.40 @@ -522,7 +522,7 @@
68.41 \else hd [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]";
68.42 (*=== inhibit exn 110726=============================================================
68.43 val SOME (s',_) = rewrite_set_ thy false prog_expr s;
68.44 -val s'' = UnparseC.term_in_ctxt @{context} s';
68.45 +val s'' = UnparseC.term @{context} s';
68.46 if s'' =
68.47 "SubProblem (Reals_s, [make, function], [no_met])\n\
68.48 \ [REAL A, REAL b,\n\
68.49 @@ -558,11 +558,11 @@
68.50 (*--- 1.line in script ---*)
68.51 val t = ParseC.parse_test @{context} "(hd o (filterVar v_v)) (eqs::bool list)";
68.52 val s = subst_atomic env t;
68.53 -UnparseC.term_in_ctxt @{context} s;
68.54 +UnparseC.term @{context} s;
68.55 val t = ParseC.parse_test @{context}
68.56 "(hd o filterVar b) [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]";
68.57 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
68.58 -val s' = UnparseC.term_in_ctxt @{context} t';
68.59 +val s' = UnparseC.term @{context} t';
68.60 (*=== inhibit exn 110726=============================================================
68.61 if s' = "A = a * b" then () else error "new behaviour with prog_expr 2.1";
68.62 === inhibit exn 110726=============================================================*)
68.63 @@ -571,7 +571,7 @@
68.64 (*--- 2.line in script ---*)
68.65 val t = ParseC.parse_test @{context} "hd (dropWhile (ident h_h) (eqs::bool list))";
68.66 val s = subst_atomic env t;
68.67 -UnparseC.term_in_ctxt @{context} s;
68.68 +UnparseC.term @{context} s;
68.69 val t = ParseC.parse_test @{context}
68.70 "hd (dropWhile (ident (A = a * b))\
68.71 \ [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2])";
68.72 @@ -579,7 +579,7 @@
68.73 mem_rls "dropWhile_Cons" prog_expr;
68.74 mem_rls "Prog_Expr.ident" prog_expr;
68.75 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.76 -val s' = UnparseC.term_in_ctxt @{context} t';
68.77 +val s' = UnparseC.term @{context} t';
68.78 if s' = "(a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2" then ()
68.79 else error "new behaviour with prog_expr 2.2";
68.80 === inhibit exn 110726=============================================================*)
68.81 @@ -588,11 +588,11 @@
68.82 (*--- 3.line in script ---*)
68.83 val t = ParseC.parse_test @{context} "dropWhile (ident f_f) (Vars (h_h::bool))";
68.84 val s = subst_atomic env t;
68.85 -UnparseC.term_in_ctxt @{context} s;
68.86 +UnparseC.term @{context} s;
68.87 val t = ParseC.parse_test @{context} "dropWhile (ident A) (Vars (A = a * b))";
68.88 (*=== inhibit exn 110726=============================================================
68.89 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.90 -val s' = UnparseC.term_in_ctxt @{context} t';
68.91 +val s' = UnparseC.term @{context} t';
68.92 if s' = "[a, b]" then () else error "new behaviour with prog_expr 2.3";
68.93 === inhibit exn 110726=============================================================*)
68.94 val env = env @ [(ParseC.parse_test @{context} "vs_s::real list", ParseC.parse_test @{context} s')];
68.95 @@ -600,11 +600,11 @@
68.96 (*--- 4.line in script ---*)
68.97 val t = ParseC.parse_test @{context} "hd (dropWhile (ident v_v) v_s)";
68.98 val s = subst_atomic env t;
68.99 -UnparseC.term_in_ctxt @{context} s;
68.100 +UnparseC.term @{context} s;
68.101 val t = ParseC.parse_test @{context} "hd (dropWhile (ident b) [a, b])";
68.102 (*=== inhibit exn 110726=============================================================
68.103 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.104 -val s' = UnparseC.term_in_ctxt @{context} t';
68.105 +val s' = UnparseC.term @{context} t';
68.106 if s' = "a" then () else error "new behaviour with prog_expr 2.4.";
68.107 === inhibit exn 110726=============================================================*)
68.108 val env = env @ [(ParseC.parse_test @{context} "v_1::real", ParseC.parse_test @{context} s')];
68.109 @@ -613,7 +613,7 @@
68.110 val t = ParseC.parse_test @{context} "(SubProblem(Reals_s,[univar,equation],[no_met])\
68.111 \ [BOOL e_1, REAL v_1])";
68.112 val s = subst_atomic env t;
68.113 -UnparseC.term_in_ctxt @{context} s;
68.114 +UnparseC.term @{context} s;
68.115 "SubProblem (Reals_s, [univar, equation], [no_met])\n\
68.116 \ [BOOL ((a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2), REAL a]";
68.117 val env = env @ [(ParseC.parse_test @{context} "s_1::bool list",
68.118 @@ -622,14 +622,14 @@
68.119 (*--- 6.line in script ---*)
68.120 val t = ParseC.parse_test @{context} "Substitute [(v_1 = (rhs o hd) (s_1::bool list))] (h_h::bool)";
68.121 val s = subst_atomic env t;
68.122 -UnparseC.term_in_ctxt @{context} s;
68.123 +UnparseC.term @{context} s;
68.124 val t = ParseC.parse_test @{context}
68.125 "Substitute [(a = (rhs o hd) [a = 2 * sqrt (r \<up> 2 - (b / 2) \<up> 2)])]\n\
68.126 \ (A = a * b)";
68.127 (*=== inhibit exn 110726=============================================================
68.128 mem_rls "Prog_Expr.rhs" prog_expr;
68.129 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.130 -val s' = UnparseC.term_in_ctxt @{context} t';
68.131 +val s' = UnparseC.term @{context} t';
68.132 if s' = "Substitute [a = 2 * sqrt (r \<up> 2 - (b / 2) \<up> 2)] (A = a * b)"
68.133 then () else error "new behaviour with prog_expr 2.6.";
68.134 === inhibit exn 110726=============================================================*)
68.135 @@ -664,11 +664,11 @@
68.136 (*--- 1.line in script ---*)
68.137 val t = ParseC.parse_test @{context} "(hd o (filterVar (f_f::real))) (eqs::bool list)";
68.138 val s = subst_atomic env t;
68.139 -UnparseC.term_in_ctxt @{context} s;
68.140 +UnparseC.term @{context} s;
68.141 val t = ParseC.parse_test @{context}
68.142 "(hd o filterVar A) [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
68.143 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
68.144 -val s' = UnparseC.term_in_ctxt @{context} t';
68.145 +val s' = UnparseC.term @{context} t';
68.146 (*=== inhibit exn 110726=============================================================
68.147 if s' = "A = a * b" then() else error "new behaviour with prog_expr 3.1.";
68.148 val env = env @ [(ParseC.parse_test @{context} "h_h::bool", ParseC.parse_test @{context} s')];
68.149 @@ -677,13 +677,13 @@
68.150 (*--- 2.line in script ---*)
68.151 val t = ParseC.parse_test @{context} "dropWhile (ident (h_h::bool)) (eqs::bool list)";
68.152 val s = subst_atomic env t;
68.153 -UnparseC.term_in_ctxt @{context} s;
68.154 +UnparseC.term @{context} s;
68.155 val t = ParseC.parse_test @{context}
68.156 "dropWhile (ident (A = a * b))\
68.157 \ [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
68.158 (*=== inhibit exn 110726=============================================================
68.159 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.160 -val s' = UnparseC.term_in_ctxt @{context} t';
68.161 +val s' = UnparseC.term @{context} t';
68.162 if s' = "[a / 2 = r * sin alpha, b / 2 = r * cos alpha]"
68.163 then () else error "new behaviour with prog_expr 3.2.";
68.164 === inhibit exn 110726=============================================================*)
68.165 @@ -692,11 +692,11 @@
68.166 (*--- 3.line in script ---*)
68.167 val t = ParseC.parse_test @{context} "dropWhile (ident (f_f::real)) (Vars (h_h::bool))";
68.168 val s = subst_atomic env t;
68.169 -UnparseC.term_in_ctxt @{context} s;
68.170 +UnparseC.term @{context} s;
68.171 val t = ParseC.parse_test @{context} "dropWhile (ident A) (Vars (A = a * b))";
68.172 (*=== inhibit exn 110726=============================================================
68.173 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.174 -val s' = UnparseC.term_in_ctxt @{context} t';
68.175 +val s' = UnparseC.term @{context} t';
68.176 if s' = "[a, b]" then () else error "new behaviour with prog_expr 3.3.";
68.177 === inhibit exn 110726=============================================================*)
68.178 val env = env @ [(ParseC.parse_test @{context} "vs_s::real list", ParseC.parse_test @{context} s')];
68.179 @@ -704,11 +704,11 @@
68.180 (*--- 4.line in script ---*)
68.181 val t = ParseC.parse_test @{context} "nth_h 1 v_s";
68.182 val s = subst_atomic env t;
68.183 -UnparseC.term_in_ctxt @{context} s;
68.184 +UnparseC.term @{context} s;
68.185 val t = ParseC.parse_test @{context} "nth_h 1 [a, b]";
68.186 (*=== inhibit exn 110726=============================================================
68.187 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.188 -val s' = UnparseC.term_in_ctxt @{context} t';
68.189 +val s' = UnparseC.term @{context} t';
68.190 if s' = "a" then () else error "new behaviour with prog_expr 3.4.";
68.191 === inhibit exn 110726=============================================================*)
68.192 val env = env @ [(ParseC.parse_test @{context} "v_1", ParseC.parse_test @{context} s')];
68.193 @@ -716,11 +716,11 @@
68.194 (*--- 5.line in script ---*)
68.195 val t = ParseC.parse_test @{context} "nth_h 2 v_s";
68.196 val s = subst_atomic env t;
68.197 -UnparseC.term_in_ctxt @{context} s;
68.198 +UnparseC.term @{context} s;
68.199 val t = ParseC.parse_test @{context} "nth_h 2 [a, b]";
68.200 (*=== inhibit exn 110726=============================================================
68.201 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
68.202 -val s' = UnparseC.term_in_ctxt @{context} t';
68.203 +val s' = UnparseC.term @{context} t';
68.204 if s' = "b" then () else error "new behaviour with prog_expr 3.5.";
68.205 === inhibit exn 110726=============================================================*)
68.206 val env = env @ [(ParseC.parse_test @{context} "v_2", ParseC.parse_test @{context} s')];
68.207 @@ -728,11 +728,11 @@
68.208 (*--- 6.line in script ---*)
68.209 val t = ParseC.parse_test @{context} "(hd o (filterVar v_1)) (es_s::bool list)";
68.210 val s = subst_atomic env t;
68.211 -UnparseC.term_in_ctxt @{context} s;
68.212 +UnparseC.term @{context} s;
68.213 val t = ParseC.parse_test @{context}
68.214 "(hd o filterVar a) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
68.215 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
68.216 -val s' = UnparseC.term_in_ctxt @{context} t';
68.217 +val s' = UnparseC.term @{context} t';
68.218 (*=== inhibit exn 110726=============================================================
68.219 if s' = "a / 2 = r * sin alpha" then ()
68.220 else error "new behaviour with prog_expr 3.6.";
68.221 @@ -743,11 +743,11 @@
68.222 (*--- 7.line in script ---*)
68.223 val t = ParseC.parse_test @{context} "(hd o (filterVar v_2)) (es_s::bool list)";
68.224 val s = subst_atomic env t;
68.225 -UnparseC.term_in_ctxt @{context} s;
68.226 +UnparseC.term @{context} s;
68.227 val t = ParseC.parse_test @{context}
68.228 "(hd o filterVar b) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
68.229 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
68.230 -val s' = UnparseC.term_in_ctxt @{context} t';
68.231 +val s' = UnparseC.term @{context} t';
68.232 (*=== inhibit exn 110726=============================================================
68.233 if s' = "b / 2 = r * cos alpha" then ()
68.234 else error "new behaviour with prog_expr 3.7.";
68.235 @@ -758,7 +758,7 @@
68.236 val t = ParseC.parse_test @{context} "(SubProblem (Reals_s,[univar,equation],[no_met])\
68.237 \ [BOOL e_1, REAL v_1])";
68.238 val s = subst_atomic env t;
68.239 -UnparseC.term_in_ctxt @{context} s;
68.240 +UnparseC.term @{context} s;
68.241 "SubProblem (Reals_s, [univar, equation], [no_met])\
68.242 \ [BOOL (a / 2 = r * sin alpha), REAL a]";
68.243 val s_1 = ParseC.parse_test @{context} "[a = 2*r*sin alpha]";
68.244 @@ -768,7 +768,7 @@
68.245 val t = ParseC.parse_test @{context} "(SubProblem (Reals_s,[univar,equation],[no_met])\
68.246 \ [BOOL e_2, REAL v_2])";
68.247 val s = subst_atomic env t;
68.248 -UnparseC.term_in_ctxt @{context} s;
68.249 +UnparseC.term @{context} s;
68.250 "SubProblem (Reals_s, [univar, equation], [no_met])\
68.251 \ [BOOL (b / 2 = r * cos alpha), REAL b]";
68.252 val s_2 = ParseC.parse_test @{context} "[b = 2*r*cos alpha]";
68.253 @@ -778,11 +778,11 @@
68.254 val t = ParseC.parse_test @{context}
68.255 "Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] (h_h::bool)";
68.256 val s = subst_atomic env t;
68.257 -UnparseC.term_in_ctxt @{context} s;
68.258 +UnparseC.term @{context} s;
68.259 "Substitute\n [(a = (rhs o hd) [a = 2 * r * sin alpha]),\
68.260 \ (b = (rhs o hd) [b = 2 * r * cos alpha])] (A = a * b)";
68.261 val SOME (s',_) = rewrite_set_ ctxt false prog_expr s;
68.262 -val s'' = UnparseC.term_in_ctxt @{context} s';
68.263 +val s'' = UnparseC.term @{context} s';
68.264 (*=== inhibit exn 110726=============================================================
68.265 if s'' =
68.266 "Substitute [a = 2 * r * sin alpha, b = 2 * r * cos alpha] (A = a * b)"
69.1 --- a/test/Tools/isac/Knowledge/diff.sml Sat Feb 04 16:49:08 2023 +0100
69.2 +++ b/test/Tools/isac/Knowledge/diff.sml Sat Feb 04 17:00:25 2023 +0100
69.3 @@ -100,14 +100,14 @@
69.4 "--- 6 ---";
69.5 val thm = @{thm "diff_var"};
69.6 val (ct, _) = the (rewrite_inst_ ctxt tless_true erls_diff true subst thm ct);
69.7 -if UnparseC.term_in_ctxt @{context} ct = "2 * x \<up> (2 - 1) + 3 * 1 + 0" then ()
69.8 +if UnparseC.term @{context} ct = "2 * x \<up> (2 - 1) + 3 * 1 + 0" then ()
69.9 else error "diff.sml diff.behav. in rewrite 1";
69.10 "--- 7 ---";
69.11 "--- 7 ---";
69.12 val rls = Test_simplify;
69.13 val ct = ParseC.parse_test ctxt "2 * x \<up> (2 - 1) + 3 * 1 + 0";
69.14 val (ct, _) = the (rewrite_set_ ctxt true rls ct);
69.15 -if UnparseC.term_in_ctxt @{context} ct = "3 + 2 * x" then () else error "rewrite_set_ Test_simplify 2 changed";
69.16 +if UnparseC.term @{context} ct = "3 + 2 * x" then () else error "rewrite_set_ Test_simplify 2 changed";
69.17
69.18 "----------- differentiate: me (*+ tacs input*) ---------";
69.19 "----------- differentiate: me (*+ tacs input*) ---------";
69.20 @@ -226,11 +226,11 @@
69.21 TermC.atom_trace_detail @{context} screxp0;
69.22
69.23 val screxp1 = subst_atomic [(f_, f), (v_, v)] screxp0;
69.24 -UnparseC.term_in_ctxt @{context} screxp1;
69.25 +UnparseC.term @{context} screxp1;
69.26 TermC.atom_trace_detail @{context} screxp1;
69.27
69.28 val SOME (f'_,_) = rewrite_set_ ctxt false srls_diff screxp1;
69.29 -if UnparseC.term_in_ctxt @{context} f'_= "Take (A' = d_d s (s * (a - s)))" then ()
69.30 +if UnparseC.term @{context} f'_= "Take (A' = d_d s (s * (a - s)))" then ()
69.31 else error "diff.sml: diff.behav. in 'primed'";
69.32 TermC.atom_trace_detail @{context} f'_;
69.33
69.34 @@ -272,30 +272,30 @@
69.35 val rls = diff_conv;
69.36
69.37 val t = ParseC.parse_test @{context} "2/x \<up> 2";
69.38 -val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term_in_ctxt @{context} t;
69.39 -if UnparseC.term_in_ctxt @{context} t = "2 * x \<up> - 2" then () else error "diff.sml 1/x";
69.40 +val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term @{context} t;
69.41 +if UnparseC.term @{context} t = "2 * x \<up> - 2" then () else error "diff.sml 1/x";
69.42
69.43 val t = ParseC.parse_test @{context} "sqrt (x \<up> 3)";
69.44 -val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term_in_ctxt @{context} t;
69.45 -if UnparseC.term_in_ctxt @{context} t = "x \<up> (3 / 2)" then () else error "diff.sml x \<up> 1/2";
69.46 +val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term @{context} t;
69.47 +if UnparseC.term @{context} t = "x \<up> (3 / 2)" then () else error "diff.sml x \<up> 1/2";
69.48
69.49 val t = ParseC.parse_test @{context} "2 / sqrt x \<up> 3";
69.50 -val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term_in_ctxt @{context} t;
69.51 -if UnparseC.term_in_ctxt @{context} t = "2 * x \<up> (- 3 / 2)" then () else error "diff.sml x \<up> - 1/2";
69.52 +val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term @{context} t;
69.53 +if UnparseC.term @{context} t = "2 * x \<up> (- 3 / 2)" then () else error "diff.sml x \<up> - 1/2";
69.54
69.55 val rls = diff_sym_conv;
69.56
69.57 val t = ParseC.parse_test @{context} "2 * x \<up> - 2";
69.58 -val SOME (t, _) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term_in_ctxt @{context} t;
69.59 -if UnparseC.term_in_ctxt @{context} t = "2 / x \<up> 2" then () else error "diff.sml sym 1/x";
69.60 +val SOME (t, _) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term @{context} t;
69.61 +if UnparseC.term @{context} t = "2 / x \<up> 2" then () else error "diff.sml sym 1/x";
69.62
69.63 val t = ParseC.parse_test @{context} "x \<up> (3 / 2)";
69.64 -val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term_in_ctxt @{context} t;
69.65 -if UnparseC.term_in_ctxt @{context} t = "sqrt (x \<up> 3)" then ((*..wrong rewrite*)) else error"diff.sml sym x \<up> 1/x";
69.66 +val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term @{context} t;
69.67 +if UnparseC.term @{context} t = "sqrt (x \<up> 3)" then ((*..wrong rewrite*)) else error"diff.sml sym x \<up> 1/x";
69.68
69.69 val t = ParseC.parse_test @{context} "2 * x \<up> (-3 / 2)";
69.70 -val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term_in_ctxt @{context} t;
69.71 -if UnparseC.term_in_ctxt @{context} t ="2 / sqrt (x \<up> 3)"then()else error"diff.sml sym x \<up> - 1/x";
69.72 +val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term @{context} t;
69.73 +if UnparseC.term @{context} t ="2 / sqrt (x \<up> 3)"then()else error"diff.sml sym x \<up> - 1/x";
69.74
69.75
69.76 "----------- autoCalculate differentiate_on_R 2/x \<up> 2 -----";
69.77 @@ -312,7 +312,7 @@
69.78 moveActiveRoot 1;
69.79 autoCalculate 1 CompleteCalc;
69.80 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
69.81 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) =
69.82 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) =
69.83 "1 + 2 * x + - 1 / x \<up> 2 + - 4 / x \<up> 3" then ()
69.84 else error "diff.sml: differentiate_on_R 2/x \<up> 2 changed";
69.85
69.86 @@ -331,7 +331,7 @@
69.87 *)
69.88 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
69.89
69.90 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) =
69.91 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) =
69.92 "8 * x \<up> 7" then ()
69.93 else error "diff.sml: differentiate_on_R (x \<up> 3 * x \<up> 5) changed";
69.94
69.95 @@ -354,7 +354,7 @@
69.96 LItool.trace_on := false;
69.97 *)
69.98 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
69.99 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "8 * x \<up> 7"
69.100 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "8 * x \<up> 7"
69.101 then () else error "biegelinie.sml: 1st biegelin.7.27 changed";
69.102
69.103 "--------------------------------------------------------";
69.104 @@ -368,7 +368,7 @@
69.105 moveActiveRoot 1;
69.106 autoCalculate 1 CompleteCalc;
69.107 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
69.108 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "15 * x \<up> 14"
69.109 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "15 * x \<up> 14"
69.110 then () else error "biegelinie.sml: 1st biegelin.7.27 changed";
69.111
69.112 "----------- autoCalculate differentiate_equality -------";
70.1 --- a/test/Tools/isac/Knowledge/diophanteq.sml Sat Feb 04 16:49:08 2023 +0100
70.2 +++ b/test/Tools/isac/Knowledge/diophanteq.sml Sat Feb 04 17:00:25 2023 +0100
70.3 @@ -34,13 +34,13 @@
70.4 | NONE => error "diophanteq.sml: syntax error in rewriting for usecase1";
70.5
70.6 val SOME (t,_) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.empty true subst
70.7 - @{thm "int_isolate_add"} t; UnparseC.term_in_ctxt @{context} t;
70.8 + @{thm "int_isolate_add"} t; UnparseC.term @{context} t;
70.9
70.10 val SOME (thmID,thm) = adhoc_thm ctxt (the(LibraryC.assoc(Know_Store.get_calcs @{theory},"TIMES"))) t;
70.11 -val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term_in_ctxt @{context} t;
70.12 +val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term @{context} t;
70.13
70.14 val SOME (thmID,thm) = adhoc_thm ctxt (the(LibraryC.assoc(Know_Store.get_calcs @{theory},"PLUS"))) t;
70.15 -val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term_in_ctxt @{context} t;
70.16 +val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term @{context} t;
70.17
70.18 "----------- mathengine with usecase1 -------------------";
70.19 "----------- mathengine with usecase1 -------------------";
70.20 @@ -72,10 +72,10 @@
70.21 | NONE => error "diophanteq.sml: syntax error in rewriting for usecase2";
70.22
70.23 val SOME (thmID,thm) = adhoc_thm ctxt (the(LibraryC.assoc(Know_Store.get_calcs @{theory},"TIMES"))) t;
70.24 -val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term_in_ctxt @{context} t;
70.25 +val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term @{context} t;
70.26
70.27 val SOME (thmID,thm) = adhoc_thm ctxt (the(LibraryC.assoc(Know_Store.get_calcs @{theory},"PLUS"))) t;
70.28 -val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term_in_ctxt @{context} t;
70.29 +val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term @{context} t;
70.30
70.31
70.32 "----------- mathengine with usecase2 -------------------";
71.1 --- a/test/Tools/isac/Knowledge/eqsystem-1.sml Sat Feb 04 16:49:08 2023 +0100
71.2 +++ b/test/Tools/isac/Knowledge/eqsystem-1.sml Sat Feb 04 17:00:25 2023 +0100
71.3 @@ -89,7 +89,7 @@
71.4 Eval (\<^const_name>\<open>HOL.eq\<close>,eval_equal "#equal_")
71.5 ];
71.6 val SOME (t',_) = rewrite_set_ ctxt false testrls t;
71.7 -if UnparseC.term_in_ctxt @{context} t' = "True" then ()
71.8 +if UnparseC.term @{context} t' = "True" then ()
71.9 else error "eqsystem.sml: length_ [x+y=1,y=2] = 2";
71.10
71.11 val SOME t = ParseC.term_opt ctxt "solution LL";
71.12 @@ -158,20 +158,20 @@
71.13 val bdvs = [(ParseC.parse_test @{context}"bdv_1",ParseC.parse_test @{context}"c"),
71.14 (ParseC.parse_test @{context}"bdv_2",ParseC.parse_test @{context}"c_2")];
71.15 val SOME (t,_) = rewrite_set_inst_ ctxt true bdvs simplify_System_parenthesized t;
71.16 -if UnparseC.term_in_ctxt @{context} t = "[0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2), 0 = c_2]"
71.17 +if UnparseC.term @{context} t = "[0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2), 0 = c_2]"
71.18 then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.1";
71.19
71.20 val SOME (t,_) = rewrite_set_inst_ ctxt true bdvs isolate_bdvs t;
71.21 -if UnparseC.term_in_ctxt @{context} t = "[L * c + c_2 = 0 + - 1 * (- 1 * q_0 * L \<up> 2 / 2), c_2 = 0]"
71.22 +if UnparseC.term @{context} t = "[L * c + c_2 = 0 + - 1 * (- 1 * q_0 * L \<up> 2 / 2), c_2 = 0]"
71.23 then () else error "eqsystem.sml rewrite in 2x2 isolate_bdvs";
71.24
71.25 val SOME (t,_)= rewrite_set_inst_ ctxt true bdvs simplify_System t;
71.26 -if UnparseC.term_in_ctxt @{context} t = "[L * c + c_2 = q_0 * L \<up> 2 / 2, c_2 = 0]"
71.27 +if UnparseC.term @{context} t = "[L * c + c_2 = q_0 * L \<up> 2 / 2, c_2 = 0]"
71.28 then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.2";
71.29
71.30 "--- 3--- see EqSystem.thy (*..if replaced by 'and' ...*)";
71.31 val SOME (t,_) = rewrite_set_ ctxt true order_system t;
71.32 -if UnparseC.term_in_ctxt @{context} t = "[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]"
71.33 +if UnparseC.term @{context} t = "[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]"
71.34 then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.3";
71.35
71.36
71.37 @@ -186,25 +186,25 @@
71.38 \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L \<up> 3 + \
71.39 \ - 1 * q_0 / 24 * L \<up> 4)]";
71.40 val SOME (t, _) = rewrite_set_ ctxt true norm_Rational t;
71.41 -if UnparseC.term_in_ctxt @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.42 +if UnparseC.term @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.43 "[c_2 = 0, 0 = q_0 * L \<up> 4 / (24 * EI) + (L * c + c_2)]"*)
71.44 "[0 = c_2, 0 = (24 * c_2 + 24 * L * c + L \<up> 4 * q_0) / 24]"
71.45 then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.0b";
71.46
71.47 val SOME(t, _)= rewrite_set_inst_ ctxt true bdvs simplify_System_parenthesized t;
71.48 -if UnparseC.term_in_ctxt @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.49 +if UnparseC.term @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.50 "[c_2 = 0, 0 = q_0 * L \<up> 4 / (24 * EI) + (L * c + c_2)]"*)
71.51 "[0 = c_2, 0 = q_0 * L \<up> 4 / 24 + (L * c + c_2)]"
71.52 then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.1b";
71.53
71.54 val SOME (t,_) = rewrite_set_inst_ ctxt true bdvs isolate_bdvs t;
71.55 -if UnparseC.term_in_ctxt @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.56 +if UnparseC.term @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.57 "[c_2 = 0, L * c + c_2 = 0 + - 1 * (q_0 * L \<up> 4 / (24 * EI))]"*)
71.58 "[c_2 = 0, L * c + c_2 = 0 + - 1 * (q_0 * L \<up> 4 / 24)]"
71.59 then () else error "eqsystem.sml rewrite in 2x2 isolate_bdvs b";
71.60
71.61 val SOME(t,_)= rewrite_set_inst_ ctxt true bdvs simplify_System t;
71.62 -if UnparseC.term_in_ctxt @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.63 +if UnparseC.term @{context} t = (*BEFORE "eliminate ThmC.numerals_to_Free"..
71.64 "[c_2 = 0, L * c + c_2 = - 1 * q_0 * L \<up> 4 / (24 * EI)]"*)
71.65 "[c_2 = 0, L * c + c_2 = - 1 * q_0 * L \<up> 4 / 24]"
71.66 then () else error "eqsystem.sml rewrite in 2x2 simplify_System.2b";
71.67 @@ -222,21 +222,21 @@
71.68 val bdvs = [(ParseC.parse_test @{context}"bdv_1",ParseC.parse_test @{context}"c"),
71.69 (ParseC.parse_test @{context}"bdv_2",ParseC.parse_test @{context}"c_2")];
71.70 val SOME (e2__,_) = rewrite_terms_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty [e1__] e2__;
71.71 -if UnparseC.term_in_ctxt @{context} e2__ = "L * c + 77 = q_0 * L \<up> 2 / 2" then ()
71.72 +if UnparseC.term @{context} e2__ = "L * c + 77 = q_0 * L \<up> 2 / 2" then ()
71.73 else error "eqsystem.sml top_down_substitution,2x2] subst";
71.74
71.75 val SOME (e2__,_) =
71.76 rewrite_set_inst_ ctxt true bdvs simplify_System_parenthesized e2__;
71.77 -if UnparseC.term_in_ctxt @{context} e2__ = "77 + L * c = q_0 * L \<up> 2 / 2" then ()
71.78 +if UnparseC.term @{context} e2__ = "77 + L * c = q_0 * L \<up> 2 / 2" then ()
71.79 else error "eqsystem.sml top_down_substitution,2x2] simpl_par";
71.80
71.81 val SOME (e2__,_) = rewrite_set_inst_ ctxt true bdvs isolate_bdvs e2__;
71.82 -if UnparseC.term_in_ctxt @{context} e2__ = "c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L" then ()
71.83 +if UnparseC.term @{context} e2__ = "c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L" then ()
71.84 else error "eqsystem.sml top_down_substitution,2x2] isolate";
71.85
71.86 val t = ParseC.parse_test @{context} "[c_2 = 77, c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L]";
71.87 val SOME (t,_) = rewrite_set_ ctxt true order_system t;
71.88 -if UnparseC.term_in_ctxt @{context} t = "[c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L, c_2 = 77]" then ()
71.89 +if UnparseC.term @{context} t = "[c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L, c_2 = 77]" then ()
71.90 else error "eqsystem.sml top_down_substitution,2x2] order_system";
71.91
71.92 if not (ord_simplify_System
71.93 @@ -261,24 +261,24 @@
71.94 (ParseC.parse_test @{context}"bdv_4::real",ParseC.parse_test @{context}"c_4::real")];
71.95 val SOME (t, _) =
71.96 rewrite_set_inst_ ctxt true bdvs simplify_System_parenthesized t;
71.97 -if UnparseC.term_in_ctxt @{context} t = "[0 = c_4, 0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c_3 + c_4),\n c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
71.98 +if UnparseC.term @{context} t = "[0 = c_4, 0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c_3 + c_4),\n c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
71.99 then () else error "eqsystem.sml rewrite in 4x4 simplify_System_paren";
71.100
71.101 val SOME (t, _) = rewrite_set_inst_ ctxt true bdvs isolate_bdvs t;
71.102 -if UnparseC.term_in_ctxt @{context} t = "[c_4 = 0, \
71.103 +if UnparseC.term @{context} t = "[c_4 = 0, \
71.104 \L * c_3 + c_4 = 0 + - 1 * (- 1 * q_0 * L \<up> 2 / 2),\n \
71.105 \c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
71.106 then () else error "eqsystem.sml rewrite in 4x4 isolate_bdvs";
71.107
71.108 val SOME(t, _)= rewrite_set_inst_ ctxt true bdvs simplify_System_parenthesized t;
71.109 -if UnparseC.term_in_ctxt @{context} t = "[c_4 = 0,\
71.110 +if UnparseC.term @{context} t = "[c_4 = 0,\
71.111 \ L * c_3 + c_4 = q_0 * L \<up> 2 / 2,\
71.112 \ c + (c_2 + (c_3 + c_4)) = 0,\n\
71.113 \ c_2 + (c_3 + c_4) = 0]"
71.114 then () else error "eqsystem.sml rewrite in 4x4 simplify_System_p..2";
71.115
71.116 val SOME (t, _) = rewrite_set_ ctxt true order_system t;
71.117 -if UnparseC.term_in_ctxt @{context} t = "[c_4 = 0,\
71.118 +if UnparseC.term @{context} t = "[c_4 = 0,\
71.119 \ L * c_3 + c_4 = q_0 * L \<up> 2 / 2,\
71.120 \ c_2 + (c_3 + c_4) = 0,\n\
71.121 \ c + (c_2 + (c_3 + c_4)) = 0]"
71.122 @@ -443,7 +443,7 @@
71.123 (rev ["LINEAR", "system"], fmz, [(*match list*)],
71.124 ((Store.Node ("2x2",[Problem.from_store ["2x2", "LINEAR", "system"]],[])):pbt Store.store));
71.125 *)
71.126 -> show_types:=true; UnparseC.term_in_ctxt @{context} (hd where_); show_types:=false;
71.127 +> show_types:=true; UnparseC.term @{context} (hd where_); show_types:=false;
71.128 val it = "length_ (es_::real list) = (2::real)" : string
71.129
71.130 =========================================================================\
71.131 @@ -461,12 +461,12 @@
71.132 > val [("#Given", [equalities_es_, "solveForVars v_s"])] = gi;
71.133 val equalities_es_ = "equalities es_" : string
71.134 > val (dd, ii) = ((Model_Pattern.split_descriptor ctxt) o Thm.term_of o the o (TermC.parse thy)) equalities_es_;
71.135 -> show_types:=true; UnparseC.term_in_ctxt @{context} ii; show_types:=false;
71.136 +> show_types:=true; UnparseC.term @{context} ii; show_types:=false;
71.137 val it = "es_::bool list" : string
71.138 ~~~~~~~~~~~~~~~ \<up> \<up> \<up> OK~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71.139
71.140 > val {where_,...} = Problem.from_store ["2x2", "LINEAR", "system"];
71.141 -> show_types:=true; UnparseC.term_in_ctxt @{context} (hd where_); show_types:=false;
71.142 +> show_types:=true; UnparseC.term @{context} (hd where_); show_types:=false;
71.143
71.144 =========================================================================/
71.145
72.1 --- a/test/Tools/isac/Knowledge/eqsystem-1a.sml Sat Feb 04 16:49:08 2023 +0100
72.2 +++ b/test/Tools/isac/Knowledge/eqsystem-1a.sml Sat Feb 04 17:00:25 2023 +0100
72.3 @@ -152,7 +152,7 @@
72.4 (Take' ttt, iii, _) =
72.5 (*case*) scan_to_tactic (prog, (ptp, ctxt)) (Pstate ist) (*of*);
72.6
72.7 -(*+isa==isa2*)val "c_2 = 0" = (ttt |> UnparseC.term_in_ctxt @{context});
72.8 +(*+isa==isa2*)val "c_2 = 0" = (ttt |> UnparseC.term @{context});
72.9 val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \nc_2 = 0, ORundef, true, false)" =
72.10 (*+isa==isa2*)(Pstate iii |> Istate.string_of ctxt);
72.11
72.12 @@ -298,7 +298,7 @@
72.13
72.14 val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\", \"\n(e_1, c_2 = 0)\"], [R, R, D, R, D, L, R], srls_top_down_2x2, NONE, \nL * c + c_2 = q_0 * L \<up> 2 / 2, ORundef, true, false)" =
72.15 (*+isa==isa2*)Pstate ist |> Istate.string_of ctxt;
72.16 -(*+isa==isa2*)val "L * c + c_2 = q_0 * L \<up> 2 / 2" = act_arg |> UnparseC.term_in_ctxt @{context};
72.17 +(*+isa==isa2*)val "L * c + c_2 = q_0 * L \<up> 2 / 2" = act_arg |> UnparseC.term @{context};
72.18
72.19 (*if*) path = [R] (*root of the program body*) (*else*);
72.20
72.21 @@ -330,7 +330,7 @@
72.22 val stac' = Rewrite.eval_prog_expr ctxt prog_rls
72.23 (subst_atomic (Env.update_opt E (a, v)) stac)
72.24
72.25 -(*+*)val "Substitute [c_2 = 0] (L * c + c_2 = q_0 * L \<up> 2 / 2)" = stac' |> UnparseC.term_in_ctxt @{context};
72.26 +(*+*)val "Substitute [c_2 = 0] (L * c + c_2 = q_0 * L \<up> 2 / 2)" = stac' |> UnparseC.term @{context};
72.27
72.28 val return =
72.29 (Program.Tac stac', a');
72.30 @@ -357,8 +357,8 @@
72.31 val ro = get_rew_ord ctxt rew_ord;
72.32 (*if*) foldl and_ (true, map TermC.contains_Var subte) (*else*);
72.33
72.34 -(*+isa==isa2*)val "L * c + c_2 = q_0 * L \<up> 2 / 2" = f |> UnparseC.term_in_ctxt @{context}
72.35 -(*+isa<>isa2*)val (** )["c_2 = (0::'a)"]( **)["c_2 = 0"](**) = subte |> map (UnparseC.term_in_ctxt @{context})
72.36 +(*+isa==isa2*)val "L * c + c_2 = q_0 * L \<up> 2 / 2" = f |> UnparseC.term @{context}
72.37 +(*+isa<>isa2*)val (** )["c_2 = (0::'a)"]( **)["c_2 = 0"](**) = subte |> map (UnparseC.term @{context})
72.38
72.39 val SOME ttt =
72.40 (*case*) Rewrite.rewrite_terms_ ctxt ro asm_rls subte f (*of*);
73.1 --- a/test/Tools/isac/Knowledge/eqsystem-2.sml Sat Feb 04 16:49:08 2023 +0100
73.2 +++ b/test/Tools/isac/Knowledge/eqsystem-2.sml Sat Feb 04 17:00:25 2023 +0100
73.3 @@ -128,7 +128,7 @@
73.4 "0 = c_2, " ^
73.5 "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]");
73.6 val SOME (t, _) = rewrite_set_ ctxt false isolate_bdvs_4x4 t;
73.7 -if UnparseC.term_in_ctxt @{context} t =
73.8 +if UnparseC.term @{context} t =
73.9 "[c_4 = 0,\n (12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) /\n (- 24 * EI) =\n - 1 * (c_4 + L * c_3) + 0,\n c_2 = 0, (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2 = 0]"
73.10 then () else error "Bsp 7.27";
73.11
73.12 @@ -137,17 +137,17 @@
73.13 val NONE = rewrite_set_ ctxt false norm_Rational t;
73.14 val SOME (t,_) =
73.15 rewrite_set_inst_ ctxt false subst simplify_System_parenthesized t;
73.16 -if UnparseC.term_in_ctxt @{context} t = "0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2)"
73.17 +if UnparseC.term @{context} t = "0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2)"
73.18 then () else error "Bsp 7.27 go through the rewrites in met_eqsys_norm_4x4";
73.19
73.20 "--- isolate_bdvs_4x4";
73.21 (*
73.22 val SOME (t,_) = rewrite_set_inst_ ctxt false subst isolate_bdvs_4x4 t;
73.23 -UnparseC.term_in_ctxt @{context} t;
73.24 +UnparseC.term @{context} t;
73.25 val SOME (t,_) = rewrite_set_inst_ ctxt false subst simplify_System t;
73.26 -UnparseC.term_in_ctxt @{context} t;
73.27 +UnparseC.term @{context} t;
73.28 val SOME (t,_) = rewrite_set_ ctxt false order_system t;
73.29 -UnparseC.term_in_ctxt @{context} t;
73.30 +UnparseC.term @{context} t;
73.31 *)
73.32
73.33 "------- Bsp 7.28 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
73.34 @@ -208,27 +208,27 @@
73.35 val SOME (t,_) = rewrite_ ctxt Rewrite_Ord.function_empty Rule_Set.empty false @{thm commute_0_equality} t;
73.36 val SOME (t,_) = rewrite_ ctxt Rewrite_Ord.function_empty Rule_Set.empty false @{thm commute_0_equality} t;
73.37 val SOME (t,_) = rewrite_ ctxt Rewrite_Ord.function_empty Rule_Set.empty false @{thm commute_0_equality} t;
73.38 -if UnparseC.term_in_ctxt @{context} t =
73.39 +if UnparseC.term @{context} t =
73.40 "[L * q_0 = c, (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2 = 0,\n c_4 = 0, c_3 = 0]"
73.41 then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 1";
73.42
73.43 val SOME (t,_) = rewrite_set_inst_ ctxt false subst simplify_System_parenthesized t;
73.44 -if UnparseC.term_in_ctxt @{context} t = "[L * q_0 = c, - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2) = 0, c_4 = 0,\n c_3 = 0]"
73.45 +if UnparseC.term @{context} t = "[L * q_0 = c, - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2) = 0, c_4 = 0,\n c_3 = 0]"
73.46 then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 2";
73.47
73.48 val SOME (t,_) = rewrite_set_inst_ ctxt false subst isolate_bdvs_4x4 t;
73.49 -if UnparseC.term_in_ctxt @{context} t =
73.50 +if UnparseC.term @{context} t =
73.51 "[c = (- 1 * (L * q_0) + 0) / - 1,\n" ^
73.52 " L * c + c_2 = - 1 * (- 1 * q_0 * L \<up> 2 / 2) + 0, c_4 = 0, c_3 = 0]"
73.53 then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 3";
73.54
73.55 val SOME (t,_) = rewrite_set_inst_ ctxt false subst simplify_System_parenthesized t;
73.56 -if UnparseC.term_in_ctxt @{context} t =
73.57 +if UnparseC.term @{context} t =
73.58 "[c = - 1 * L * q_0 / - 1, L * c + c_2 = q_0 * L \<up> 2 / 2, c_4 = 0,\n c_3 = 0]"
73.59 then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 4";
73.60
73.61 val SOME (t, _) = rewrite_set_ ctxt false order_system t;
73.62 -if UnparseC.term_in_ctxt @{context} t =
73.63 +if UnparseC.term @{context} t =
73.64 "[c = - 1 * L * q_0 / - 1, L * c + c_2 = q_0 * L \<up> 2 / 2, c_3 = 0,\n c_4 = 0]"
73.65 then () else error "eqsystem.sml: exp 7.70 normalise 4x4 by rewrite changed";
73.66
74.1 --- a/test/Tools/isac/Knowledge/equation.sml Sat Feb 04 16:49:08 2023 +0100
74.2 +++ b/test/Tools/isac/Knowledge/equation.sml Sat Feb 04 17:00:25 2023 +0100
74.3 @@ -27,7 +27,7 @@
74.4 val ((pt,p),_) = States.get_calc 1;
74.5 val Form res = (#1 o ME_Misc.pt_extract) (pt, ([],Res));
74.6 Test_Tool.show_pt pt;
74.7 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} res = "[x = 1]" then ()
74.8 +if p = ([], Res) andalso UnparseC.term @{context} res = "[x = 1]" then ()
74.9 else error "equation.sml behav.changed for CAS solve (x+1=2, x))";
74.10 ============ inhibit exn 130719 Isabelle2013 =================================*)
74.11
75.1 --- a/test/Tools/isac/Knowledge/inssort.sml Sat Feb 04 16:49:08 2023 +0100
75.2 +++ b/test/Tools/isac/Knowledge/inssort.sml Sat Feb 04 17:00:25 2023 +0100
75.3 @@ -38,62 +38,62 @@
75.4 val SOME t = ParseC.term_opt ctxt "sort {|| 1, 3, 2 ||}";
75.5
75.6 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm sort_deff} t;
75.7 -UnparseC.term_in_ctxt @{context} t' = "xfoldr ins {|| 1, 3, 2 ||} {|| ||}";
75.8 +UnparseC.term @{context} t' = "xfoldr ins {|| 1, 3, 2 ||} {|| ||}";
75.9
75.10 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm xfoldr_Cons} t';
75.11 -UnparseC.term_in_ctxt @{context} t' = "(ins 1 o xfoldr ins {|| 3, 2 ||}) {|| ||}";
75.12 +UnparseC.term @{context} t' = "(ins 1 o xfoldr ins {|| 3, 2 ||}) {|| ||}";
75.13
75.14 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm xfoldr_Cons} t';
75.15 -UnparseC.term_in_ctxt @{context} t' = "(ins 1 o (ins 3 o xfoldr ins {|| 2 ||})) {|| ||}";
75.16 +UnparseC.term @{context} t' = "(ins 1 o (ins 3 o xfoldr ins {|| 2 ||})) {|| ||}";
75.17
75.18 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm xfoldr_Cons} t';
75.19 -UnparseC.term_in_ctxt @{context} t' = "(ins 1 o (ins 3 o (ins 2 o xfoldr ins {|| ||}))) {|| ||}";
75.20 +UnparseC.term @{context} t' = "(ins 1 o (ins 3 o (ins 2 o xfoldr ins {|| ||}))) {|| ||}";
75.21
75.22 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm xfoldr_Nil} t';
75.23 -UnparseC.term_in_ctxt @{context} t' = "(ins 1 o (ins 3 o (ins 2 o id))) {|| ||}";
75.24 +UnparseC.term @{context} t' = "(ins 1 o (ins 3 o (ins 2 o id))) {|| ||}";
75.25
75.26 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm o_id} t';
75.27 -UnparseC.term_in_ctxt @{context} t' = "(ins 1 o (ins 3 o ins 2)) {|| ||}";
75.28 +UnparseC.term @{context} t' = "(ins 1 o (ins 3 o ins 2)) {|| ||}";
75.29
75.30 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm o_assoc} t';
75.31 -UnparseC.term_in_ctxt @{context} t' = "(ins 1 o ins 3 o ins 2) {|| ||}";
75.32 +UnparseC.term @{context} t' = "(ins 1 o ins 3 o ins 2) {|| ||}";
75.33
75.34 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm o_apply} t';
75.35 -UnparseC.term_in_ctxt @{context} t' = "(ins 1 o ins 3) (ins 2 {|| ||})";
75.36 +UnparseC.term @{context} t' = "(ins 1 o ins 3) (ins 2 {|| ||})";
75.37
75.38 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm o_apply} t';
75.39 -UnparseC.term_in_ctxt @{context} t' = "ins 1 (ins 3 (ins 2 {|| ||}))";
75.40 +UnparseC.term @{context} t' = "ins 1 (ins 3 (ins 2 {|| ||}))";
75.41
75.42 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm ins_Nil} t';
75.43 -UnparseC.term_in_ctxt @{context} t' = "ins 1 (ins 3 {|| 2 ||})";
75.44 +UnparseC.term @{context} t' = "ins 1 (ins 3 {|| 2 ||})";
75.45
75.46 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm ins_Cons} t';
75.47 -UnparseC.term_in_ctxt @{context} t' = "ins 1 (if 3 < 2 then {|| 3, 2 ||} else 2 @# ins 3 {|| ||})";
75.48 +UnparseC.term @{context} t' = "ins 1 (if 3 < 2 then {|| 3, 2 ||} else 2 @# ins 3 {|| ||})";
75.49
75.50 val SOME (t', _) = calculate_ ctxt (\<^const_name>\<open>less\<close>, eval_equ "#less_") t';
75.51 -UnparseC.term_in_ctxt @{context} t' = "ins 1 (if False then {|| 3, 2 ||} else 2 @# ins 3 {|| ||})";
75.52 +UnparseC.term @{context} t' = "ins 1 (if False then {|| 3, 2 ||} else 2 @# ins 3 {|| ||})";
75.53
75.54 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm if_False} t';
75.55 -UnparseC.term_in_ctxt @{context} t' = "ins 1 (2 @# ins 3 {|| ||})";
75.56 +UnparseC.term @{context} t' = "ins 1 (2 @# ins 3 {|| ||})";
75.57
75.58 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm ins_Nil} t';
75.59 -UnparseC.term_in_ctxt @{context} t' = "ins 1 {|| 2, 3 ||}";
75.60 +UnparseC.term @{context} t' = "ins 1 {|| 2, 3 ||}";
75.61
75.62 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm ins_Cons} t';
75.63 -UnparseC.term_in_ctxt @{context} t' = "if 1 < 2 then {|| 1, 2, 3 ||} else 2 @# ins 1 {|| 3 ||}";
75.64 +UnparseC.term @{context} t' = "if 1 < 2 then {|| 1, 2, 3 ||} else 2 @# ins 1 {|| 3 ||}";
75.65
75.66 val SOME (t', _) = calculate_ ctxt (\<^const_name>\<open>less\<close>, eval_equ "#less_") t';
75.67 -UnparseC.term_in_ctxt @{context} t' = "if True then {|| 1, 2, 3 ||} else 2 @# ins 1 {|| 3 ||}";
75.68 +UnparseC.term @{context} t' = "if True then {|| 1, 2, 3 ||} else 2 @# ins 1 {|| 3 ||}";
75.69
75.70 val SOME (t', _) = rewrite_ ctxt tless_true eval_rls false @{thm if_True} t';
75.71 -if UnparseC.term_in_ctxt @{context} t' = "{|| 1, 2, 3 ||}" then () else error "CHANGED RESULT FOR sort by rewrite stepwise";
75.72 +if UnparseC.term @{context} t' = "{|| 1, 2, 3 ||}" then () else error "CHANGED RESULT FOR sort by rewrite stepwise";
75.73
75.74 "----------- insertion sort with ruleset -------------------------------------";
75.75 "----------- insertion sort with ruleset -------------------------------------";
75.76 "----------- insertion sort with ruleset -------------------------------------";
75.77 -if UnparseC.term_in_ctxt @{context} t = "InsSort.sort {|| 1, 3, 2 ||}" then () else error "CHANGED START FOR sort with ruleset";
75.78 +if UnparseC.term @{context} t = "InsSort.sort {|| 1, 3, 2 ||}" then () else error "CHANGED START FOR sort with ruleset";
75.79 val SOME (t', _) = rewrite_set_ ctxt false ins_sort t;
75.80 -if UnparseC.term_in_ctxt @{context} t' = "{|| 1, 2, 3 ||}" then () else error "CHANGED RESULT FOR sort with ruleset";
75.81 +if UnparseC.term @{context} t' = "{|| 1, 2, 3 ||}" then () else error "CHANGED RESULT FOR sort with ruleset";
75.82
75.83 "----------- insertion sort with MathEngine ----------------------------------";
75.84 "----------- insertion sort with MathEngine ----------------------------------";
75.85 @@ -175,6 +175,6 @@
75.86
75.87 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
75.88
75.89 -if p = ([], Res)andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "{|| 1, 2, 3 ||}"
75.90 +if p = ([], Res)andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "{|| 1, 2, 3 ||}"
75.91 andalso length (ME_Misc.get_interval ctxt ([], Pbl) ([], Res) 1 pt) = 23 then ()
75.92 else error "met_Prog_sort_ins_steps CHANGED"
76.1 --- a/test/Tools/isac/Knowledge/integrate.sml Sat Feb 04 16:49:08 2023 +0100
76.2 +++ b/test/Tools/isac/Knowledge/integrate.sml Sat Feb 04 17:00:25 2023 +0100
76.3 @@ -27,7 +27,7 @@
76.4 val ctxt = Proof_Context.init_global thy;
76.5
76.6 fun str2t str = ParseC.term_opt ctxt str |> the;
76.7 -fun term2s t = UnparseC.term_in_ctxt ctxt t;
76.8 +fun term2s t = UnparseC.term ctxt t;
76.9
76.10 val conditions_in_integration_rules =
76.11 Rule_Set.Repeat {id="conditions_in_integration_rules",
76.12 @@ -95,22 +95,22 @@
76.13 "----------- test add_new_c, TermC.is_f_x ---------------------";
76.14 val term = ParseC.parse_test @{context} "x \<up> 2 * c + c_2";
76.15 val cc = new_c term;
76.16 -if UnparseC.term_in_ctxt @{context} cc = "c_3" then () else error "integrate.sml: new_c ???";
76.17 +if UnparseC.term @{context} cc = "c_3" then () else error "integrate.sml: new_c ???";
76.18
76.19 val SOME (id,t') = eval_add_new_c "" "Integrate.add_new_c" term ctxt;
76.20 -if UnparseC.term_in_ctxt @{context} t' = "x \<up> 2 * c + c_2 = x \<up> 2 * c + c_2 + c_3" then ()
76.21 +if UnparseC.term @{context} t' = "x \<up> 2 * c + c_2 = x \<up> 2 * c + c_2 + c_3" then ()
76.22 else error "intergrate.sml: diff. eval_add_new_c";
76.23
76.24 val cc = ("Integrate.add_new_c", eval_add_new_c "add_new_c_");
76.25 val SOME (thmstr, thm) = adhoc_thm1_ @{context} cc term;
76.26
76.27 val SOME (t',_) = rewrite_set_ ctxt true add_new_c term;
76.28 -if UnparseC.term_in_ctxt @{context} t' = "x \<up> 2 * c + c_2 + c_3" then ()
76.29 +if UnparseC.term @{context} t' = "x \<up> 2 * c + c_2 + c_3" then ()
76.30 else error "intergrate.sml: diff. rewrite_set add_new_c 1";
76.31
76.32 val term = ParseC.parse_test @{context} "ff x = x \<up> 2*c + c_2";
76.33 val SOME (t',_) = rewrite_set_ ctxt true add_new_c term;
76.34 -if UnparseC.term_in_ctxt @{context} t' = "ff x = x \<up> 2 * c + c_2 + c_3" then ()
76.35 +if UnparseC.term @{context} t' = "ff x = x \<up> 2 * c + c_2 + c_3" then ()
76.36 else error "intergrate.sml: diff. rewrite_set add_new_c 2";
76.37
76.38
76.39 @@ -186,13 +186,13 @@
76.40 "===== test 2";
76.41 val rls = order_add_mult_in;
76.42 val SOME (t, []) = rewrite_set_inst_ ctxt true subst rls t;
76.43 -if UnparseC.term_in_ctxt @{context} t = "1 / EI * (L * (q_0 * x) / 2 + - 1 * (q_0 * x \<up> 2) / 2)" then()
76.44 +if UnparseC.term @{context} t = "1 / EI * (L * (q_0 * x) / 2 + - 1 * (q_0 * x \<up> 2) / 2)" then()
76.45 else error "integrate.sml simplify by ruleset order_add_mult_in #2";
76.46
76.47 "===== test 3";
76.48 val rls = discard_parentheses;
76.49 val SOME (t, []) = rewrite_set_ ctxt true rls t;
76.50 -if UnparseC.term_in_ctxt @{context} t = "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" then ()
76.51 +if UnparseC.term @{context} t = "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" then ()
76.52 else error "integrate.sml simplify by ruleset discard_parenth.. #3";
76.53
76.54 "===== test 4";
76.55 @@ -217,7 +217,7 @@
76.56 (*show_types := false; --- do we need type-constraint in thms? YES ?!?!?!*)
76.57
76.58 val SOME (t, []) = rewrite_set_inst_ ctxt true subs rls t;
76.59 -if UnparseC.term_in_ctxt @{context} t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
76.60 +if UnparseC.term @{context} t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
76.61 else error "integrate.sml simplify by ruleset separate_bdv.. #4";
76.62
76.63 "===== test 5";
76.64 @@ -225,7 +225,7 @@
76.65 val rls = simplify_Integral;
76.66 val SOME (t,[]) = rewrite_set_inst_ ctxt true subs rls t;
76.67 (* given was: "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" *)
76.68 -if UnparseC.term_in_ctxt @{context} t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
76.69 +if UnparseC.term @{context} t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
76.70 else error "integrate.sml, simplify_Integral #99";
76.71
76.72 "........... 2nd integral ........................................";
76.73 @@ -239,12 +239,12 @@
76.74
76.75 val rls = simplify_Integral;
76.76 val SOME (t,[]) = rewrite_set_inst_ ctxt true subs rls t;
76.77 -if UnparseC.term_in_ctxt @{context} t = "Integral 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3) D x"
76.78 +if UnparseC.term @{context} t = "Integral 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3) D x"
76.79 then () else raise error "integrate.sml, simplify_Integral #198";
76.80
76.81 val rls = integration_rules;
76.82 val SOME (t, []) = rewrite_set_ ctxt true rls t;
76.83 -if UnparseC.term_in_ctxt @{context} t = "1 / EI * (L * q_0 / 4 * (x \<up> 3 / 3) + - 1 * q_0 / 6 * (x \<up> 4 / 4))"
76.84 +if UnparseC.term @{context} t = "1 / EI * (L * q_0 / 4 * (x \<up> 3 / 3) + - 1 * q_0 / 6 * (x \<up> 4 / 4))"
76.85 then () else error "integrate.sml, simplify_Integral #199";
76.86
76.87
76.88 @@ -258,52 +258,52 @@
76.89
76.90 val t = ParseC.parse_test ctxt "Integral x D x";
76.91 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.92 -if UnparseC.term_in_ctxt @{context} res = "x \<up> 2 / 2" then () else error "Integral x D x changed";
76.93 +if UnparseC.term @{context} res = "x \<up> 2 / 2" then () else error "Integral x D x changed";
76.94
76.95 val t = ParseC.parse_test ctxt "Integral c * x \<up> 2 + c_2 D x";
76.96 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.97 -if UnparseC.term_in_ctxt @{context} res = "c * (x \<up> 3 / 3) + c_2 * x" then () else error "Integral c * x \<up> 2 + c_2 D x";
76.98 +if UnparseC.term @{context} res = "c * (x \<up> 3 / 3) + c_2 * x" then () else error "Integral c * x \<up> 2 + c_2 D x";
76.99
76.100 val rls = add_new_c;
76.101 val t = ParseC.parse_test ctxt "c * (x \<up> 3 / 3) + c_2 * x";
76.102 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.103 -if UnparseC.term_in_ctxt @{context} res = "c * (x \<up> 3 / 3) + c_2 * x + c_3" then ()
76.104 +if UnparseC.term @{context} res = "c * (x \<up> 3 / 3) + c_2 * x + c_3" then ()
76.105 else error "integrate.sml: diff.behav. in add_new_c simpl.";
76.106
76.107 val t = ParseC.parse_test ctxt "F x = x \<up> 3 / 3 + x";
76.108 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.109 -if UnparseC.term_in_ctxt @{context} res = "F x = x \<up> 3 / 3 + x + c"(*not "F x + c =..."*) then ()
76.110 +if UnparseC.term @{context} res = "F x = x \<up> 3 / 3 + x + c"(*not "F x + c =..."*) then ()
76.111 else error "integrate.sml: diff.behav. in add_new_c equation";
76.112
76.113 val rls = simplify_Integral;
76.114 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
76.115 val t = ParseC.parse_test ctxt "ff x = c * x + - 1 * q_0 * (x \<up> 2 / 2) + c_2";
76.116 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.117 -if UnparseC.term_in_ctxt @{context} res = "ff x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2"
76.118 +if UnparseC.term @{context} res = "ff x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2"
76.119 then () else error "integrate.sml: diff.behav. in simplify_I #1";
76.120
76.121 val rls = integration;
76.122 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
76.123 val t = ParseC.parse_test ctxt "Integral c * x \<up> 2 + c_2 D x";
76.124 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.125 -if UnparseC.term_in_ctxt @{context} res = "c_3 + c_2 * x + c / 3 * x \<up> 3"
76.126 +if UnparseC.term @{context} res = "c_3 + c_2 * x + c / 3 * x \<up> 3"
76.127 then () else error "integrate.sml: diff.behav. in integration #1";
76.128
76.129 val t = ParseC.parse_test ctxt "Integral 3*x \<up> 2 + 2*x + 1 D x";
76.130 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.131 -if UnparseC.term_in_ctxt @{context} res = "c + x + x \<up> 2 + x \<up> 3" then ()
76.132 +if UnparseC.term @{context} res = "c + x + x \<up> 2 + x \<up> 3" then ()
76.133 else error "integrate.sml: diff.behav. in integration #2";
76.134
76.135 val t = ParseC.parse_test ctxt
76.136 "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x";
76.137 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.138 "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x";
76.139 -if UnparseC.term_in_ctxt @{context} res = "c + 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"
76.140 +if UnparseC.term @{context} res = "c + 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"
76.141 then () else error "integrate.sml: diff.behav. in integration #3";
76.142
76.143 -val t = ParseC.parse_test ctxt ("Integral " ^ UnparseC.term_in_ctxt @{context} res ^ " D x");
76.144 +val t = ParseC.parse_test ctxt ("Integral " ^ UnparseC.term @{context} res ^ " D x");
76.145 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
76.146 -if UnparseC.term_in_ctxt @{context} res = "c_2 + c * x +\n1 / EI * (L * q_0 / 12 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)"
76.147 +if UnparseC.term @{context} res = "c_2 + c * x +\n1 / EI * (L * q_0 / 12 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)"
76.148 then () else error "integrate.sml: diff.behav. in integration #4";
76.149
76.150 "----------- rewrite 3rd integration in 7.27 ------------";
76.151 @@ -311,12 +311,12 @@
76.152 "----------- rewrite 3rd integration in 7.27 ------------";
76.153 val t = ParseC.parse_test @{context} "Integral 1 / EI * ((L * q_0 * x + - 1 * q_0 * x \<up> 2) / 2) D x";
76.154 val SOME(t, _)= rewrite_set_inst_ ctxt true subs simplify_Integral t;
76.155 -if UnparseC.term_in_ctxt @{context} t =
76.156 +if UnparseC.term @{context} t =
76.157 "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x"
76.158 then () else error "integrate.sml 3rd integration in 7.27, simplify_Integral";
76.159
76.160 val SOME(t, _) = rewrite_set_inst_ ctxt true subs integration t;
76.161 -if UnparseC.term_in_ctxt @{context} t =
76.162 +if UnparseC.term @{context} t =
76.163 "c + 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"
76.164 then () else error "integrate.sml 3rd integration in 7.27, integration";
76.165
76.166 @@ -415,7 +415,7 @@
76.167 autoCalculate 1 CompleteCalc;
76.168 val ((pt,p),_) = States.get_calc 1; @{make_string} p; Test_Tool.show_pt pt;
76.169 val (Form t,_,_) = ME_Misc.pt_extract ctxt (pt, p);
76.170 -if UnparseC.term_in_ctxt @{context} t = "c + x + 1 / 3 * x \<up> 3" then ()
76.171 +if UnparseC.term @{context} t = "c + x + 1 / 3 * x \<up> 3" then ()
76.172 else error "integrate.sml -- interSteps [diff,integration] -- result";
76.173
76.174
77.1 --- a/test/Tools/isac/Knowledge/inverse_z_transform.sml Sat Feb 04 16:49:08 2023 +0100
77.2 +++ b/test/Tools/isac/Knowledge/inverse_z_transform.sml Sat Feb 04 17:00:25 2023 +0100
77.3 @@ -192,6 +192,6 @@
77.4
77.5 val ((pt,_),_) = States.get_calc 1; val p = States.get_pos 1 1;
77.6 val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
77.7 -if UnparseC.term_in_ctxt @{context} f = "X_z = 4 * (1 / 2) \<up> ?n * ?u [?n] + -4 * (- 1 / 4) \<up> ?n * ?u [?n]"
77.8 +if UnparseC.term @{context} f = "X_z = 4 * (1 / 2) \<up> ?n * ?u [?n] + -4 * (- 1 / 4) \<up> ?n * ?u [?n]"
77.9 andalso p = ([], Res) then ()
77.10 else error "inv Z, exp 1 autoCalculate changed";
78.1 --- a/test/Tools/isac/Knowledge/partial_fractions.sml Sat Feb 04 16:49:08 2023 +0100
78.2 +++ b/test/Tools/isac/Knowledge/partial_fractions.sml Sat Feb 04 17:00:25 2023 +0100
78.3 @@ -80,7 +80,7 @@
78.4 val ctxt = Proof_Context.init_global @{theory Isac_Knowledge};
78.5 val SOME t = ParseC.term_opt ctxt "factors_from_solution [(z::real) = 1 / 2, z = - 1 / 4]";
78.6 val SOME (_, t') = eval_factors_from_solution "" 0 t thy;
78.7 -if UnparseC.term_in_ctxt @{context} t' =
78.8 +if UnparseC.term @{context} t' =
78.9 "factors_from_solution [z = 1 / 2, z = - 1 / 4] = (z - 1 / 2) * (z - - 1 / 4)"
78.10 then () else error "factors_from_solution broken";
78.11
78.12 @@ -97,7 +97,7 @@
78.13 (HOLogic.mk_binop \<^const_name>\<open>divide\<close> (A_var, denom1),
78.14 HOLogic.mk_binop \<^const_name>\<open>divide\<close> (B_var, denom2));
78.15
78.16 -if UnparseC.term_in_ctxt @{context} test = "?A / (z + - 1 * (1 / 2)) + ?B / (z + - 1 * (- 1 / 4))" then ()
78.17 +if UnparseC.term @{context} test = "?A / (z + - 1 * (1 / 2)) + ?B / (z + - 1 * (- 1 / 4))" then ()
78.18 else error "HOLogic.mk_binop broken ?";
78.19
78.20 (* Logic.unvarify_global test
78.21 @@ -257,8 +257,8 @@
78.22 else error "autoCalculate for met_partial_fraction changed: final pos'";
78.23
78.24 val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
78.25 -if UnparseC.term_in_ctxt @{context} f = "4 / (z - 1 / 2) + -4 / (z - - 1 / 4)" andalso
78.26 - UnparseC.terms_in_ctxt @{context} asms =
78.27 +if UnparseC.term @{context} f = "4 / (z - 1 / 2) + -4 / (z - - 1 / 4)" andalso
78.28 + UnparseC.terms @{context} asms =
78.29 "[BB = -4,BB is_polyexp,AA is_polyexp,AA = 4," ^
78.30 "lhs (- 1 + - 2 * z + 8 * z \<up> 2 = 0) has_degree_in z = 2," ^
78.31 "lhs (- 1 + - 2 * z + 8 * z \<up> 2 = 0) is_poly_in z,z = 1 / 2,z = - 1 / 4,z is_polyexp]"
78.32 @@ -274,14 +274,14 @@
78.33 (*test for outcommented 3 lines in script: is norm_Rational strong enough?*)
78.34 val t = ParseC.parse_test @{context} "(3 / ((- 1 + - 2 * z + 8 * z \<up> 2) *3/24)) = (3 / ((z - 1 / 2) * (z - - 1 / 4)))";
78.35 val SOME (t', _) = rewrite_set_ @{theory Isac_Knowledge} true ansatz_rls t;
78.36 -UnparseC.term_in_ctxt @{context} t' = "3 / ((- 1 + - 2 * z + 8 * z \<up> 2) * 3 / 24) =\n?A / (z - 1 / 2) + ?B / (z - - 1 / 4)";
78.37 +UnparseC.term @{context} t' = "3 / ((- 1 + - 2 * z + 8 * z \<up> 2) * 3 / 24) =\n?A / (z - 1 / 2) + ?B / (z - - 1 / 4)";
78.38
78.39 val SOME (t'', _) = rewrite_set_ @{theory Isac_Knowledge} true multiply_ansatz t'; (*true*)
78.40 -UnparseC.term_in_ctxt @{context} t'' = "(z - 1 / 2) * (z - - 1 / 4) * 3 / ((- 1 + - 2 * z + 8 * z \<up> 2) * 3 / 24) =\n" ^
78.41 +UnparseC.term @{context} t'' = "(z - 1 / 2) * (z - - 1 / 4) * 3 / ((- 1 + - 2 * z + 8 * z \<up> 2) * 3 / 24) =\n" ^
78.42 "?A * (z - - 1 / 4) + ?B * (z - 1 / 2)"; (*true*)
78.43
78.44 val SOME (t''', _) = rewrite_set_ @{theory Isac_Knowledge} true norm_Rational t'';
78.45 -if UnparseC.term_in_ctxt @{context} t''' = "3 = (AA + - 2 * BB + 4 * z * AA + 4 * z * BB) / 4" then ()
78.46 +if UnparseC.term @{context} t''' = "3 = (AA + - 2 * BB + 4 * z * AA + 4 * z * BB) / 4" then ()
78.47 else error "ansatz_rls - multiply_ansatz - norm_Rational broken";
78.48
78.49 (*test for outcommented 3 lines in script: empower asm_rls for x = a*b ==> ...*)
79.1 --- a/test/Tools/isac/Knowledge/poly-1.sml Sat Feb 04 16:49:08 2023 +0100
79.2 +++ b/test/Tools/isac/Knowledge/poly-1.sml Sat Feb 04 17:00:25 2023 +0100
79.3 @@ -189,13 +189,13 @@
79.4 (*--------------vvvvvvvvvvvvvvv-----------------------------------------------------------------*)
79.5 val t = @{term "3 * b + a * 2"}; (*------------------------------------------------------------*)
79.6 val t' = sort_variables t;
79.7 -if UnparseC.term_in_ctxt @{context} t' = "(3::'a) * b + (2::'a) * a" then ()
79.8 +if UnparseC.term @{context} t' = "(3::'a) * b + (2::'a) * a" then ()
79.9 else error "sort_variables 3 * b + a * 2 CHANGED";
79.10
79.11 "~~~~~~~ fun sort_variables , args:"; val (t) = (t);
79.12 val ll = map monom2list (poly2list t);
79.13
79.14 -(*+*)UnparseC.terms_in_ctxt @{context} (poly2list t) = "[\"(3::'a) * b\", \"a * (2::'a)\"]";
79.15 +(*+*)UnparseC.terms @{context} (poly2list t) = "[\"(3::'a) * b\", \"a * (2::'a)\"]";
79.16 (*+*)val [ [(Const (\<^const_name>\<open>numeral\<close>, _) $ _), Free ("b", _)],
79.17 (*+*) [Free ("a", _), (Const (\<^const_name>\<open>numeral\<close>, _) $ _)]
79.18 (*+*) ] = map monom2list (poly2list t);
79.19 @@ -222,14 +222,14 @@
79.20
79.21 val xxx = (*in*) create_polynom T ls (*end*);
79.22
79.23 -(*+*)if UnparseC.term_in_ctxt @{context} xxx = "(3::'a) * b + (2::'a) * a" then ()
79.24 +(*+*)if UnparseC.term @{context} xxx = "(3::'a) * b + (2::'a) * a" then ()
79.25 (*+*)else error "create_polynom CHANGED";
79.26 (* done by rewriting> 2 * a + 3 * b ? *)
79.27
79.28 (*---------------vvvvvvvvvvvvvvvvvvvvvv---------------------------------------------------------*)
79.29 val t = @{term "3 * a + - 2 * a ::real"}; (*---------------------------------------------------*)
79.30 val t' = sort_variables t;
79.31 -if UnparseC.term_in_ctxt @{context} t' = "3 * a + - 2 * a" then ()
79.32 +if UnparseC.term @{context} t' = "3 * a + - 2 * a" then ()
79.33 else error "sort_variables 3 * a + - 2 * a CHANGED";
79.34
79.35 "~~~~~~~ fun sort_variables , args:"; val (t) = (t);
79.36 @@ -250,13 +250,13 @@
79.37 "~~~~~ val sort_varList , args:"; val (ts) = (nth 2 ll);
79.38 val sorted = sort var_ord ts;
79.39
79.40 -(*+*)if UnparseC.terms_in_ctxt @{context} ts = "[- 2, a]" andalso UnparseC.terms_in_ctxt @{context} sorted = "[- 2, a]"
79.41 +(*+*)if UnparseC.terms @{context} ts = "[- 2, a]" andalso UnparseC.terms @{context} sorted = "[- 2, a]"
79.42 (*+*)then () else error "sort var_ord [\"- 2\", \"a\"] CHANGED";
79.43
79.44
79.45 -(*+*)if UnparseC.term_in_ctxt @{context} (nth 1 ts) = "- 2" andalso get_basStr (nth 1 ts) = "-2"
79.46 +(*+*)if UnparseC.term @{context} (nth 1 ts) = "- 2" andalso get_basStr (nth 1 ts) = "-2"
79.47 (*+*)then () else error "get_basStr - 2 CHANGED";
79.48 -(*+*)if UnparseC.term_in_ctxt @{context} (nth 2 ts) = "a" andalso get_basStr (nth 2 ts) = "a"
79.49 +(*+*)if UnparseC.term @{context} (nth 2 ts) = "a" andalso get_basStr (nth 2 ts) = "a"
79.50 (*+*)then () else error "get_basStr a CHANGED";
79.51
79.52
79.53 @@ -265,9 +265,9 @@
79.54 "-------- fun is_addUnordered (x \<up> 2 * y \<up> 2 + x \<up> 3 * y) --------------------------------------";
79.55 val ctxt = Proof_Context.init_global @{theory}
79.56 val t = ParseC.parse_test @{context} "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y";
79.57 -val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.58 - UnparseC.term_in_ctxt @{context} t = "x \<up> 2 * y \<up> 2 + x \<up> 3 * y";
79.59 -if UnparseC.term_in_ctxt @{context} t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then ()
79.60 +val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.61 + UnparseC.term @{context} t = "x \<up> 2 * y \<up> 2 + x \<up> 3 * y";
79.62 +if UnparseC.term @{context} t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then ()
79.63 else error "poly.sml: diff.behav. in make_polynomial 23";
79.64
79.65 (** )
79.66 @@ -292,12 +292,12 @@
79.67 val ll = map monom2list (poly2list t);
79.68 val lls = sort_monList ll;
79.69
79.70 -(*+*)map (UnparseC.terms_in_ctxt @{context}) lls = ["[x \<up> 3, y]", "[x \<up> 2, y \<up> 2]"];
79.71 +(*+*)map (UnparseC.terms @{context}) lls = ["[x \<up> 3, y]", "[x \<up> 2, y \<up> 2]"];
79.72
79.73 "~~~~~~~~~~~ fun koeff_degree_ord , args:"; val () = ();
79.74 (* we check all elements at once..*)
79.75 -val eee1 = ll |> nth 1; UnparseC.terms_in_ctxt @{context} eee1 = "[\"x \<up> 2\", \"y \<up> 2\"]";
79.76 -val eee2 = ll |> nth 2; UnparseC.terms_in_ctxt @{context} eee2 = "[\"x \<up> 3\", \"y\"]";
79.77 +val eee1 = ll |> nth 1; UnparseC.terms @{context} eee1 = "[\"x \<up> 2\", \"y \<up> 2\"]";
79.78 +val eee2 = ll |> nth 2; UnparseC.terms @{context} eee2 = "[\"x \<up> 3\", \"y\"]";
79.79
79.80 (*1*)if koeff_degree_ord (eee1, eee1) = EQUAL then () else error "(eee1, eee1) CHANGED";
79.81 (*2*)if koeff_degree_ord (eee1, eee2) = GREATER then () else error "(eee1, eee2) CHANGED";
79.82 @@ -366,7 +366,7 @@
79.83 (*if*) (is_nums x) (*else*);
79.84 val (Const (\<^const_name>\<open>realpow\<close>, _) $ Free _ $ t) =
79.85 (*case*) x (*of*);
79.86 -(*+*)UnparseC.term_in_ctxt @{context} x = "x \<up> 2";
79.87 +(*+*)UnparseC.term @{context} x = "x \<up> 2";
79.88 (*if*) TermC.is_num t (*then*);
79.89
79.90 counter (t |> HOLogic.dest_number |> snd |> curry op + n, xs);
79.91 @@ -374,7 +374,7 @@
79.92 (*if*) (is_nums x) (*else*);
79.93 val (Const (\<^const_name>\<open>realpow\<close>, _) $ Free _ $ t) =
79.94 (*case*) x (*of*);
79.95 -(*+*)UnparseC.term_in_ctxt @{context} x = "y \<up> 2";
79.96 +(*+*)UnparseC.term @{context} x = "y \<up> 2";
79.97 (*if*) TermC.is_num t (*then*);
79.98
79.99 val return =
79.100 @@ -389,7 +389,7 @@
79.101 (*if*) (is_nums x) (*else*);
79.102 val (Const (\<^const_name>\<open>realpow\<close>, _) $ Free _ $ t) =
79.103 (*case*) x (*of*);
79.104 -(*+*)UnparseC.term_in_ctxt @{context} x = "x \<up> 3";
79.105 +(*+*)UnparseC.term @{context} x = "x \<up> 3";
79.106 (*if*) TermC.is_num t (*then*);
79.107
79.108 counter (t |> HOLogic.dest_number |> snd |> curry op + n, xs);
79.109 @@ -413,32 +413,32 @@
79.110 "----- check 1 ---";
79.111 val t = ParseC.parse_test @{context} "2*3*a";
79.112 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
79.113 -if UnparseC.term_in_ctxt @{context} t = "6 * a" then () else error "check make_polynomial 1";
79.114 +if UnparseC.term @{context} t = "6 * a" then () else error "check make_polynomial 1";
79.115
79.116 "----- check 2 ---";
79.117 val t = ParseC.parse_test @{context} "2*a + 3*a";
79.118 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
79.119 -if UnparseC.term_in_ctxt @{context} t = "5 * a" then () else error "check make_polynomial 2";
79.120 +if UnparseC.term @{context} t = "5 * a" then () else error "check make_polynomial 2";
79.121
79.122 "----- check 3 ---";
79.123 val t = ParseC.parse_test @{context} "2*a + 3*a + 3*a";
79.124 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
79.125 -if UnparseC.term_in_ctxt @{context} t = "8 * a" then () else error "check make_polynomial 3";
79.126 +if UnparseC.term @{context} t = "8 * a" then () else error "check make_polynomial 3";
79.127
79.128 "----- check 4 ---";
79.129 val t = ParseC.parse_test @{context} "3*a - 2*a";
79.130 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
79.131 -if UnparseC.term_in_ctxt @{context} t = "a" then () else error "check make_polynomial 4";
79.132 +if UnparseC.term @{context} t = "a" then () else error "check make_polynomial 4";
79.133
79.134 "----- check 5 ---";
79.135 val t = ParseC.parse_test @{context} "4*(3*a - 2*a)";
79.136 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
79.137 -if UnparseC.term_in_ctxt @{context} t = "4 * a" then () else error "check make_polynomial 5";
79.138 +if UnparseC.term @{context} t = "4 * a" then () else error "check make_polynomial 5";
79.139
79.140 "----- check 6 ---";
79.141 val t = ParseC.parse_test @{context} "4*(3*a \<up> 2 - 2*a \<up> 2)";
79.142 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
79.143 -if UnparseC.term_in_ctxt @{context} t = "4 * a \<up> 2" then () else error "check make_polynomial 6";
79.144 +if UnparseC.term @{context} t = "4 * a \<up> 2" then () else error "check make_polynomial 6";
79.145
79.146 "-------- fun is_multUnordered (x \<up> 2 * x) -----------------------------------------------------";
79.147 "-------- fun is_multUnordered (x \<up> 2 * x) -----------------------------------------------------";
79.148 @@ -447,7 +447,7 @@
79.149 "===== works for a simple example, see rewrite.sml -- fun app_rev ===";
79.150 val t = ParseC.parse_test @{context} "x \<up> 2 * x";
79.151 val SOME (t', _) = rewrite_set_ ctxt true order_mult_ t;
79.152 -if UnparseC.term_in_ctxt @{context} t' = "x * x \<up> 2" then ()
79.153 +if UnparseC.term @{context} t' = "x * x \<up> 2" then ()
79.154 else error "poly.sml Poly.is_multUnordered doesn't work";
79.155
79.156 (* 100928 Rewrite.trace_on shows the first occurring difference in 267b:
79.157 @@ -461,7 +461,7 @@
79.158
79.159 "----- is_multUnordered ---";
79.160 val tsort = sort_variables t;
79.161 -UnparseC.term_in_ctxt @{context} tsort = "2 * (5 * (x \<up> 2 * x \<up> 7)) + 3 * (5 * x \<up> 2) + 6 * x \<up> 7 + 9 +\n- 1 * (3 * (6 * (x \<up> 4 * x \<up> 5))) +\n- 1 * (- 1 * (3 * x \<up> 5)) +\n-48 * x \<up> 4 +\n8";
79.162 +UnparseC.term @{context} tsort = "2 * (5 * (x \<up> 2 * x \<up> 7)) + 3 * (5 * x \<up> 2) + 6 * x \<up> 7 + 9 +\n- 1 * (3 * (6 * (x \<up> 4 * x \<up> 5))) +\n- 1 * (- 1 * (3 * x \<up> 5)) +\n-48 * x \<up> 4 +\n8";
79.163 is_polyexp t;
79.164 tsort = t;
79.165 is_polyexp t andalso not (t = sort_variables t);
79.166 @@ -478,7 +478,7 @@
79.167
79.168 "----- rewrite_set_ STILL DIDN'T WORK";
79.169 val SOME (t, _) = rewrite_set_ ctxt true order_mult_ t;
79.170 -UnparseC.term_in_ctxt @{context} t;
79.171 +UnparseC.term @{context} t;
79.172
79.173
79.174 "-------- fun is_multUnordered (3 * a + - 2 * a) -----------------------------------------------";
79.175 @@ -487,7 +487,7 @@
79.176 val thy = @{theory "Isac_Knowledge"};
79.177 val t as (_ $ arg) = ParseC.parse_test @{context} "(3 * a + - 2 * a) is_multUnordered";
79.178
79.179 -(*+*)if UnparseC.term_in_ctxt @{context} (sort_variables arg) = "3 * a + - 2 * a" andalso is_polyexp arg = true
79.180 +(*+*)if UnparseC.term @{context} (sort_variables arg) = "3 * a + - 2 * a" andalso is_polyexp arg = true
79.181 (*+*) andalso not (is_multUnordered arg)
79.182 (*+*)then () else error "sort_variables 3 * a + - 2 * a CHANGED";
79.183
79.184 @@ -502,7 +502,7 @@
79.185 "----- is_multUnordered --- (- 2 * a) is_multUnordered = False";
79.186 val t as (_ $ arg) = ParseC.parse_test @{context} "(- 2 * a) is_multUnordered";
79.187
79.188 -(*+*)if UnparseC.term_in_ctxt @{context} (sort_variables arg) = "- 2 * a" andalso is_polyexp arg = true
79.189 +(*+*)if UnparseC.term @{context} (sort_variables arg) = "- 2 * a" andalso is_polyexp arg = true
79.190 (*+*) andalso not (is_multUnordered arg)
79.191 (*+*)then () else error "sort_variables - 2 * a CHANGED";
79.192
79.193 @@ -516,7 +516,7 @@
79.194 "----- is_multUnordered --- (a) is_multUnordered = False";
79.195 val t as (_ $ arg) = ParseC.parse_test @{context} "(a) is_multUnordered";
79.196
79.197 -(*+*)if UnparseC.term_in_ctxt @{context} (sort_variables arg) = "a" andalso is_polyexp arg = true
79.198 +(*+*)if UnparseC.term @{context} (sort_variables arg) = "a" andalso is_polyexp arg = true
79.199 (*+*) andalso not (is_multUnordered arg)
79.200 (*+*)then () else error "sort_variables a CHANGED";
79.201
79.202 @@ -530,7 +530,7 @@
79.203 "----- is_multUnordered --- (- 2) is_multUnordered = False";
79.204 val t as (_ $ arg) = ParseC.parse_test @{context} "(- 2) is_multUnordered";
79.205
79.206 -(*+*)if UnparseC.term_in_ctxt @{context} (sort_variables arg) = "- 2" andalso is_polyexp arg = true
79.207 +(*+*)if UnparseC.term @{context} (sort_variables arg) = "- 2" andalso is_polyexp arg = true
79.208 (*+*) andalso not (is_multUnordered arg)
79.209 (*+*)then () else error "sort_variables - 2 CHANGED";
79.210
79.211 @@ -577,7 +577,7 @@
79.212
79.213 val return =
79.214 sort_variables t;
79.215 -(*+*)if UnparseC.term_in_ctxt @{context} return =
79.216 +(*+*)if UnparseC.term @{context} return =
79.217 (*+*) "x \<up> 3 + - 1 * (3 * (a * x \<up> 2)) +\n(- 1) \<up> 2 * (3 * (a \<up> 2 * x)) +\n(- 1) \<up> 3 * a \<up> 3"
79.218 (*+*)then () else error "sort_variables x \<up> 3 + - 1 * (3 * (a * x \<up> 2)) .. CHANGED";
79.219
79.220 @@ -588,21 +588,21 @@
79.221 (*+*)val ori3 = nth 3 ll;
79.222 (*+*)val mon3 = nth 3 lls;
79.223
79.224 -(*+*)if UnparseC.terms_in_ctxt @{context} (nth 1 ll) = "[x \<up> 3]" then () else error "nth 1 ll";
79.225 -(*+*)if UnparseC.terms_in_ctxt @{context} (nth 2 ll) = "[3, x \<up> 2, - 1, a]" then () else error "nth 3 ll";
79.226 -(*+*)if UnparseC.terms_in_ctxt @{context} ori3 = "[3, x, (- 1) \<up> 2, a \<up> 2]" then () else error "nth 3 ll";
79.227 -(*+*)if UnparseC.terms_in_ctxt @{context} (nth 4 ll) = "[(- 1) \<up> 3, a \<up> 3]" then () else error "nth 4 ll";
79.228 +(*+*)if UnparseC.terms @{context} (nth 1 ll) = "[x \<up> 3]" then () else error "nth 1 ll";
79.229 +(*+*)if UnparseC.terms @{context} (nth 2 ll) = "[3, x \<up> 2, - 1, a]" then () else error "nth 3 ll";
79.230 +(*+*)if UnparseC.terms @{context} ori3 = "[3, x, (- 1) \<up> 2, a \<up> 2]" then () else error "nth 3 ll";
79.231 +(*+*)if UnparseC.terms @{context} (nth 4 ll) = "[(- 1) \<up> 3, a \<up> 3]" then () else error "nth 4 ll";
79.232
79.233 -(*+*)if UnparseC.terms_in_ctxt @{context} (nth 1 lls) = "[x \<up> 3]" then () else error "nth 1 lls";
79.234 -(*+*)if UnparseC.terms_in_ctxt @{context} (nth 2 lls) = "[- 1, 3, a, x \<up> 2]" then () else error "nth 2 lls";
79.235 -(*+*)if UnparseC.terms_in_ctxt @{context} mon3 = "[(- 1) \<up> 2, 3, a \<up> 2, x]" then () else error "nth 3 lls";
79.236 -(*+*)if UnparseC.terms_in_ctxt @{context} (nth 4 lls) = "[(- 1) \<up> 3, a \<up> 3]" then () else error "nth 4 lls";
79.237 +(*+*)if UnparseC.terms @{context} (nth 1 lls) = "[x \<up> 3]" then () else error "nth 1 lls";
79.238 +(*+*)if UnparseC.terms @{context} (nth 2 lls) = "[- 1, 3, a, x \<up> 2]" then () else error "nth 2 lls";
79.239 +(*+*)if UnparseC.terms @{context} mon3 = "[(- 1) \<up> 2, 3, a \<up> 2, x]" then () else error "nth 3 lls";
79.240 +(*+*)if UnparseC.terms @{context} (nth 4 lls) = "[(- 1) \<up> 3, a \<up> 3]" then () else error "nth 4 lls";
79.241
79.242 "~~~~~~~~~ val sort_varList , args:"; val (ori3) = (ori3);
79.243 (* Output below with:
79.244 val sort_varList = sort var_ord;
79.245 fun var_ord (a,b: term) =
79.246 -(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term_in_ctxt @{context} a ^ ", " ^ UnparseC.term_in_ctxt @{context} b ^ ")",
79.247 +(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term @{context} a ^ ", " ^ UnparseC.term @{context} b ^ ")",
79.248 sort_args = "(" ^ get_basStr a ^ ", " ^ get_potStr a ^ "), (" ^ get_basStr b ^ ", " ^ get_potStr b ^ ")"};
79.249 prod_ord string_ord string_ord
79.250 ((get_basStr a, get_potStr a), (get_basStr b, get_potStr b))
79.251 @@ -636,8 +636,8 @@
79.252 "-------- fun is_multUnordered b * a * a ------------------------------------------------------";
79.253 "-------- fun is_multUnordered b * a * a ------------------------------------------------------";
79.254 val t = ParseC.parse_test @{context} "b * a * a";
79.255 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.256 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 2 * b" then ()
79.257 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.258 +if UnparseC.term @{context} t = "a \<up> 2 * b" then ()
79.259 else error "poly.sml: diff.behav. in make_polynomial 21";
79.260
79.261 "~~~~~ fun is_multUnordered , args:"; val (t) = (@{term "b * a * a::real"});
79.262 @@ -652,7 +652,7 @@
79.263 (*if*) TermC.is_variable num (*then*);
79.264
79.265 val xxx = sort_variables t;
79.266 -(*+*)if UnparseC.term_in_ctxt @{context} xxx = "a * (a * b)" then () else error "sort_variables a \<up> 2 * b CHANGED";
79.267 +(*+*)if UnparseC.term @{context} xxx = "a * (a * b)" then () else error "sort_variables a \<up> 2 * b CHANGED";
79.268
79.269
79.270 "-------- fun is_multUnordered 2*3*a -----------------------------------------------------------";
79.271 @@ -660,7 +660,7 @@
79.272 "-------- fun is_multUnordered 2*3*a -----------------------------------------------------------";
79.273 val t = ParseC.parse_test @{context} "2*3*a";
79.274 val SOME (t', _) = rewrite_set_ ctxt false make_polynomial t;
79.275 -(*+*)if UnparseC.term_in_ctxt @{context} t' = "6 * a" then () else error "rewrite_set_ 2*3*a CHANGED";
79.276 +(*+*)if UnparseC.term @{context} t' = "6 * a" then () else error "rewrite_set_ 2*3*a CHANGED";
79.277 (*
79.278 ## try calc: "Groups.times_class.times"
79.279 ## rls: order_mult_rls_ on: 6 * a
79.280 @@ -676,7 +676,7 @@
79.281 val SOME
79.282 (_, t') =
79.283 eval_is_multUnordered "xxx" () t @{context};
79.284 -(*+*)if UnparseC.term_in_ctxt @{context} t' = "6 * a is_multUnordered = False" then ()
79.285 +(*+*)if UnparseC.term @{context} t' = "6 * a is_multUnordered = False" then ()
79.286 (*+*)else error "6 * a is_multUnordered = False CHANGED";
79.287
79.288 "~~~~~ fun eval_is_multUnordered , args:"; val ((thmid:string), _,
79.289 @@ -692,7 +692,7 @@
79.290 (*+*) not (t = sort_variables t) = false; (*isa*)
79.291
79.292 val xxx = sort_variables t;
79.293 -(*+*)if UnparseC.term_in_ctxt @{context} xxx = "6 * a" then () else error "2*3*a is_multUnordered CHANGED";
79.294 +(*+*)if UnparseC.term @{context} xxx = "6 * a" then () else error "2*3*a is_multUnordered CHANGED";
79.295
79.296 "-------- norm_Poly with AlgEin ----------------------------------------------------------------";
79.297 "-------- norm_Poly with AlgEin ----------------------------------------------------------------";
79.298 @@ -702,7 +702,7 @@
79.299
79.300 val SOME (f',_) = rewrite_set_ ctxt false norm_Poly
79.301 (ParseC.parse_test @{context} "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben");
79.302 -if UnparseC.term_in_ctxt @{context} f' = "L = 2 * 2 * k + 2 * - 4 * q + senkrecht + oben"
79.303 +if UnparseC.term @{context} f' = "L = 2 * 2 * k + 2 * - 4 * q + senkrecht + oben"
79.304 then ((*norm_Poly NOT COMPLETE -- TODO MG*))
79.305 else error "norm_Poly changed behavior";
79.306 (* isa:
79.307 @@ -722,45 +722,45 @@
79.308 (ParseC.parse_test @{context} "L = k + k + k + k + - 2 * q + - 2 * q + - 2 * q + - 2 * q + senkrecht + oben");
79.309 (*+*)val t' =
79.310 sort_monoms t;
79.311 -(*+*)UnparseC.term_in_ctxt @{context} t' = "L = k + k + k + k + - 2 * q + - 2 * q + - 2 * q + - 2 * q + senkrecht + oben"; (*isa*)
79.312 +(*+*)UnparseC.term @{context} t' = "L = k + k + k + k + - 2 * q + - 2 * q + - 2 * q + - 2 * q + senkrecht + oben"; (*isa*)
79.313
79.314
79.315 "-------- complex examples from textbook Schalk I ----------------------------------------------";
79.316 "-------- complex examples from textbook Schalk I ----------------------------------------------";
79.317 "-------- complex examples from textbook Schalk I ----------------------------------------------";
79.318 val t = ParseC.parse_test @{context} "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8";
79.319 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.320 -if (UnparseC.term_in_ctxt @{context} t) = "1 + - 2 * x \<up> 4 + x \<up> 8"
79.321 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.322 +if (UnparseC.term @{context} t) = "1 + - 2 * x \<up> 4 + x \<up> 8"
79.323 then () else error "poly.sml: diff.behav. in make_polynomial 9b";
79.324
79.325 "-----SPB Schalk I p.64 No.296a ---";
79.326 val t = ParseC.parse_test @{context} "(x - a) \<up> 3";
79.327 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.328 -if (UnparseC.term_in_ctxt @{context} t) = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3"
79.329 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.330 +if (UnparseC.term @{context} t) = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3"
79.331 then () else error "poly.sml: diff.behav. in make_polynomial 10";
79.332
79.333 "-----SPB Schalk I p.64 No.296c ---";
79.334 val t = ParseC.parse_test @{context} "(-3*x - 4*y) \<up> 3";
79.335 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.336 -if (UnparseC.term_in_ctxt @{context} t) = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3"
79.337 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.338 +if (UnparseC.term @{context} t) = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3"
79.339 then () else error "poly.sml: diff.behav. in make_polynomial 11";
79.340
79.341 "-----SPB Schalk I p.62 No.242c ---";
79.342 val t = ParseC.parse_test @{context} "x \<up> (- 4)*(x \<up> (- 4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)";
79.343 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.344 -if (UnparseC.term_in_ctxt @{context} t) = "1"
79.345 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.346 +if (UnparseC.term @{context} t) = "1"
79.347 then () else error "poly.sml: diff.behav. in make_polynomial 12";
79.348
79.349 "-----SPB Schalk I p.60 No.209a ---";
79.350 val t = ParseC.parse_test @{context} "a \<up> (7-x) * a \<up> x";
79.351 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.352 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 7"
79.353 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.354 +if UnparseC.term @{context} t = "a \<up> 7"
79.355 then () else error "poly.sml: diff.behav. in make_polynomial 13";
79.356
79.357 "-----SPB Schalk I p.60 No.209d ---";
79.358 val t = ParseC.parse_test @{context} "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)";
79.359 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.360 -if UnparseC.term_in_ctxt @{context} t = "d \<up> 3"
79.361 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.362 +if UnparseC.term @{context} t = "d \<up> 3"
79.363 then () else error "poly.sml: diff.behav. in make_polynomial 14";
79.364
79.365
79.366 @@ -769,28 +769,28 @@
79.367 "-------- complex Eigene Beispiele (Mathias Goldgruber) ----------------------------------------";
79.368 "-----SPO ---";
79.369 val t = ParseC.parse_test @{context} "a \<up> 2*a \<up> (- 2)";
79.370 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.371 -if UnparseC.term_in_ctxt @{context} t = "1" then ()
79.372 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.373 +if UnparseC.term @{context} t = "1" then ()
79.374 else error "poly.sml: diff.behav. in make_polynomial 15";
79.375
79.376 "-----SPO ---";
79.377 val t = ParseC.parse_test @{context} "a \<up> 2*b*b \<up> (- 1)";
79.378 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.379 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 2" then ()
79.380 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.381 +if UnparseC.term @{context} t = "a \<up> 2" then ()
79.382 else error "poly.sml: diff.behav. in make_polynomial 18";
79.383 "-----SPO ---";
79.384 val t = ParseC.parse_test @{context} "a \<up> 2*a \<up> (- 2)";
79.385 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.386 -if (UnparseC.term_in_ctxt @{context} t) = "1" then ()
79.387 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.388 +if (UnparseC.term @{context} t) = "1" then ()
79.389 else error "poly.sml: diff.behav. in make_polynomial 19";
79.390 "-----SPO ---";
79.391 val t = ParseC.parse_test @{context} "b + a - b";
79.392 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.393 -if (UnparseC.term_in_ctxt @{context} t) = "a" then ()
79.394 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.395 +if (UnparseC.term @{context} t) = "a" then ()
79.396 else error "poly.sml: diff.behav. in make_polynomial 20";
79.397
79.398 "-----SPO ---";
79.399 val t = ParseC.parse_test ctxt "a \<up> 2 * (-a) \<up> 2";
79.400 -val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
79.401 -if (UnparseC.term_in_ctxt @{context} t) = "a \<up> 4" then ()
79.402 +val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term @{context} t;
79.403 +if (UnparseC.term @{context} t) = "a \<up> 4" then ()
79.404 else error "poly.sml: diff.behav. in make_polynomial 24";
80.1 --- a/test/Tools/isac/Knowledge/poly-2.sml Sat Feb 04 16:49:08 2023 +0100
80.2 +++ b/test/Tools/isac/Knowledge/poly-2.sml Sat Feb 04 17:00:25 2023 +0100
80.3 @@ -60,26 +60,26 @@
80.4 Int.compare (i1, i2)
80.5 );
80.6 fun var_ord (a, b) =
80.7 -(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term_in_ctxt @{context} a ^ ", " ^ UnparseC.term_in_ctxt @{context} b ^ ")",
80.8 +(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term @{context} a ^ ", " ^ UnparseC.term @{context} b ^ ")",
80.9 sort_args = "(" ^ get_basStr a ^ ", " ^ get_potStr a ^ "), (" ^ get_basStr b ^ ", " ^ get_potStr b ^ ")"};
80.10 prod_ord string_ord string_ord
80.11 ((get_basStr a, get_potStr a), (get_basStr b, get_potStr b))
80.12 );
80.13 fun var_ord_revPow (a, b: term) =
80.14 -(@{print} {a = "var_ord_revPow ", at_bt = "(" ^ UnparseC.term_in_ctxt @{context} a ^ ", " ^ UnparseC.term_in_ctxt @{context} b ^ ")",
80.15 +(@{print} {a = "var_ord_revPow ", at_bt = "(" ^ UnparseC.term @{context} a ^ ", " ^ UnparseC.term @{context} b ^ ")",
80.16 sort_args = "(" ^ get_basStr a ^ ", " ^ get_potStr a ^ "), (" ^ get_basStr b ^ ", " ^ get_potStr b ^ ")"};
80.17 prod_ord string_ord string_ord_rev
80.18 ((get_basStr a, get_potStr a), (get_basStr b, get_potStr b))
80.19 );
80.20 fun sort_varList ts =
80.21 -(@{print} {a = "sort_varList", args = UnparseC.terms_in_ctxt @{context} ts};
80.22 +(@{print} {a = "sort_varList", args = UnparseC.terms @{context} ts};
80.23 sort var_ord ts
80.24 );
80.25 fun dict_cond_ord _ _ ([], []) = (@{print} {a = "dict_cond_ord ([], [])"}; EQUAL)
80.26 | dict_cond_ord _ _ ([], _ :: _) = (@{print} {a = "dict_cond_ord ([], _ :: _)"}; LESS)
80.27 | dict_cond_ord _ _ (_ :: _, []) = (@{print} {a = "dict_cond_ord (_ :: _, [])"}; GREATER)
80.28 | dict_cond_ord elem_ord cond (x :: xs, y :: ys) =
80.29 - (@{print} {a = "dict_cond_ord", args = "(" ^ UnparseC.terms_in_ctxt @{context} (x :: xs) ^ ", " ^ UnparseC.terms_in_ctxt @{context} (y :: ys) ^ ")",
80.30 + (@{print} {a = "dict_cond_ord", args = "(" ^ UnparseC.terms @{context} (x :: xs) ^ ", " ^ UnparseC.terms @{context} (y :: ys) ^ ")",
80.31 is_nums = "(" ^ LibraryC.bool2str (cond x) ^ ", " ^ LibraryC.bool2str (cond y) ^ ")"};
80.32 case (cond x, cond y) of
80.33 (false, false) =>
80.34 @@ -91,14 +91,14 @@
80.35 | (true, true) => dict_cond_ord elem_ord cond (xs, ys)
80.36 );
80.37 fun compare_koeff_ord (xs, ys) =
80.38 -(@{print} {a = "compare_koeff_ord ", ats_bts = "(" ^ UnparseC.terms_in_ctxt @{context} xs ^ ", " ^ UnparseC.terms_in_ctxt @{context} ys ^ ")",
80.39 +(@{print} {a = "compare_koeff_ord ", ats_bts = "(" ^ UnparseC.terms @{context} xs ^ ", " ^ UnparseC.terms @{context} ys ^ ")",
80.40 sort_args = "(" ^ (koeff2ordStr o get_koeff_of_mon) xs ^ ", " ^ (koeff2ordStr o get_koeff_of_mon) ys ^ ")"};
80.41 string_ord
80.42 ((koeff2ordStr o get_koeff_of_mon) xs,
80.43 (koeff2ordStr o get_koeff_of_mon) ys)
80.44 );
80.45 fun var_ord (a,b: term) =
80.46 -(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term_in_ctxt @{context} a ^ ", " ^ UnparseC.term_in_ctxt @{context} b ^ ")",
80.47 +(@{print} {a = "var_ord ", a_b = "(" ^ UnparseC.term @{context} a ^ ", " ^ UnparseC.term @{context} b ^ ")",
80.48 sort_args = "(" ^ get_basStr a ^ ", " ^ get_potStr a ^ "), (" ^ get_basStr b ^ ", " ^ get_potStr b ^ ")"};
80.49 prod_ord string_ord string_ord
80.50 ((get_basStr a, get_potStr a), (get_basStr b, get_potStr b))
80.51 @@ -117,7 +117,7 @@
80.52 val SOME t_isac = ParseC.term_opt @{context} "3 * a + - 1 * (2 * a):: real";
80.53
80.54 val SOME (t', []) = rewrite_ @{context} tless_true Rule_Set.empty true thm_isac t_isac;
80.55 -if UnparseC.term_in_ctxt @{context} t' = "3 * a + - 1 * 1 * (2 * a)" then ((*thm did NOT apply to Free ("- 1", _)*))
80.56 +if UnparseC.term @{context} t' = "3 * a + - 1 * 1 * (2 * a)" then ((*thm did NOT apply to Free ("- 1", _)*))
80.57 else error "thm - ?z = - 1 * ?z loops with new numerals";
80.58
80.59
80.60 @@ -136,7 +136,7 @@
80.61 "-------- eval_ for is_expanded_in, is_poly_in, has_degree_in ----------------------------------";
80.62 val t = ParseC.parse_test thy "(-8 - 2*x + x \<up> 2) is_expanded_in x";
80.63 val SOME (id, t') = eval_is_expanded_in 0 0 t 0;
80.64 -if UnparseC.term_in_ctxt @{context} t' = "- 8 - 2 * x + x \<up> 2 is_expanded_in x = True"
80.65 +if UnparseC.term @{context} t' = "- 8 - 2 * x + x \<up> 2 is_expanded_in x = True"
80.66 andalso id = "- 8 - 2 * x + x \<up> 2 is_expanded_in x = True"
80.67 then () else error "eval_is_expanded_in x ..changed";
80.68
80.69 @@ -146,19 +146,19 @@
80.70 (*new ERROR id =
80.71 "- 8 - 2 * ??.Partial_Fractions.AA +\n??.Partial_Fractions.AA \<up> 2 is_expanded_in ??.Partial_Fractions.AA = True"*)
80.72 (*/----------- eval_is_expanded_in needs ctxt in order to know ??.Partial_Fractions -----------\* )
80.73 -if UnparseC.term_in_ctxt @{context} t' = "- 8 - 2 * AA + AA \<up> 2 is_expanded_in AA = True"
80.74 +if UnparseC.term @{context} t' = "- 8 - 2 * AA + AA \<up> 2 is_expanded_in AA = True"
80.75 andalso id = "- 8 - 2 * AA + AA \<up> 2 is_expanded_in AA = True"
80.76 then () else error "eval_is_expanded_in AA ..changed";
80.77
80.78 val t = ParseC.parse_test thy "(8 + 2*x + x \<up> 2) is_poly_in x";
80.79 val SOME (id, t') = eval_is_poly_in 0 0 t 0;
80.80 -if UnparseC.term_in_ctxt @{context} t' = "8 + 2 * x + x \<up> 2 is_poly_in x = True"
80.81 +if UnparseC.term @{context} t' = "8 + 2 * x + x \<up> 2 is_poly_in x = True"
80.82 andalso id = "8 + 2 * x + x \<up> 2 is_poly_in x = True"
80.83 then () else error "is_poly_in x ..changed";
80.84
80.85 val t = ParseC.parse_test thy "(8 + 2*AA + AA \<up> 2) is_poly_in AA";
80.86 val SOME (id, t') = eval_is_poly_in 0 0 t 0;
80.87 -if UnparseC.term_in_ctxt @{context} t' = "8 + 2 * AA + AA \<up> 2 is_poly_in AA = True"
80.88 +if UnparseC.term @{context} t' = "8 + 2 * AA + AA \<up> 2 is_poly_in AA = True"
80.89 andalso id = "8 + 2 * AA + AA \<up> 2 is_poly_in AA = True"
80.90 then () else error "is_poly_in AA ..changed";
80.91 ( *\----------- eval_is_expanded_in needs ctxt in order to know ??.Partial_Fractions -----------/*)
80.92 @@ -287,10 +287,10 @@
80.93 val eee3 = ll |> nth 3;
80.94 val eee4 = ll |> nth 4;
80.95
80.96 -if UnparseC.terms_in_ctxt @{context} eee1 = "[1]" then () else error "eee1 CHANGED";
80.97 -if UnparseC.terms_in_ctxt @{context} eee2 = "[2, x \<up> 4]" then () else error "eee2 CHANGED";
80.98 -if UnparseC.terms_in_ctxt @{context} eee3 = "[- 4, x \<up> 4]" then () else error "eee3 CHANGED";
80.99 -if UnparseC.terms_in_ctxt @{context} eee4 = "[x \<up> 8]" then () else error "eee4 CHANGED";
80.100 +if UnparseC.terms @{context} eee1 = "[1]" then () else error "eee1 CHANGED";
80.101 +if UnparseC.terms @{context} eee2 = "[2, x \<up> 4]" then () else error "eee2 CHANGED";
80.102 +if UnparseC.terms @{context} eee3 = "[- 4, x \<up> 4]" then () else error "eee3 CHANGED";
80.103 +if UnparseC.terms @{context} eee4 = "[x \<up> 8]" then () else error "eee4 CHANGED";
80.104
80.105 if koeff_degree_ord (eee1, eee1) = EQUAL then () else error "(eee1, eee1) CHANGED";
80.106 if koeff_degree_ord (eee1, eee2) = LESS then () else error "(eee1, eee2) CHANGED";
80.107 @@ -342,7 +342,7 @@
80.108 val xxx = dict_cond_ord var_ord_revPow is_nums;
80.109 (* output from:
80.110 fun var_ord_revPow (a,b: term) =
80.111 - (@ {print} {a = "var_ord_revPow ", ab = "(" ^ UnparseC.term_in_ctxt @{context} a ^ ", " ^ UnparseC.term_in_ctxt @{context} b ^ ")"};
80.112 + (@ {print} {a = "var_ord_revPow ", ab = "(" ^ UnparseC.term @{context} a ^ ", " ^ UnparseC.term @{context} b ^ ")"};
80.113 @ {print} {z = "(" ^ get_basStr a ^ ", " ^ get_potStr a ^ "), (" ^ get_basStr b ^ ", " ^ get_potStr b ^ ")"};
80.114 prod_ord string_ord string_ord_rev
80.115 ((get_basStr a, get_potStr a), (get_basStr b, get_potStr b)));
80.116 @@ -406,9 +406,9 @@
80.117 val SOME xxx3 = get_koeff_of_mon eee3;
80.118 val NONE = get_koeff_of_mon eee4;
80.119
80.120 -if UnparseC.term_in_ctxt @{context} xxx1 = "1" then () else error "get_koeff_of_mon eee1 CHANGED";
80.121 -if UnparseC.term_in_ctxt @{context} xxx2 = "2" then () else error "get_koeff_of_mon eee2 CHANGED";
80.122 -if UnparseC.term_in_ctxt @{context} xxx3 = "- 4" then () else error "get_koeff_of_mon eee3 CHANGED";
80.123 +if UnparseC.term @{context} xxx1 = "1" then () else error "get_koeff_of_mon eee1 CHANGED";
80.124 +if UnparseC.term @{context} xxx2 = "2" then () else error "get_koeff_of_mon eee2 CHANGED";
80.125 +if UnparseC.term @{context} xxx3 = "- 4" then () else error "get_koeff_of_mon eee3 CHANGED";
80.126
80.127 "~~~~~~~~~~~~~~~~~ fun koeff2ordStr , args:"; val () = ();
80.128 koeff2ordStr: term option -> string;
80.129 @@ -423,21 +423,21 @@
80.130 "-------- examples from textbook Schalk I ------------------------------------------------------";
80.131 "-----SPB Schalk I p.63 No.267b ---";
80.132 val t = ParseC.parse_test @{context} "(5*x \<up> 2 + 3) * (2*x \<up> 7 + 3) - (3*x \<up> 5 + 8) * (6*x \<up> 4 - 1)";
80.133 -val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.134 -if UnparseC.term_in_ctxt @{context} t = "17 + 15 * x \<up> 2 + - 48 * x \<up> 4 + 3 * x \<up> 5 + 6 * x \<up> 7 +\n- 8 * x \<up> 9"
80.135 +val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.136 +if UnparseC.term @{context} t = "17 + 15 * x \<up> 2 + - 48 * x \<up> 4 + 3 * x \<up> 5 + 6 * x \<up> 7 +\n- 8 * x \<up> 9"
80.137 then () else error "poly.sml: diff.behav. in make_polynomial 1";
80.138
80.139 "-----SPB Schalk I p.63 No.275b ---";
80.140 val t = ParseC.parse_test @{context} "(3*x \<up> 2 - 2*x*y + y \<up> 2) * (x \<up> 2 - 2*y \<up> 2)";
80.141 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
80.142 -if UnparseC.term_in_ctxt @{context} t =
80.143 +if UnparseC.term @{context} t =
80.144 "3 * x \<up> 4 + - 2 * x \<up> 3 * y + - 5 * x \<up> 2 * y \<up> 2 +\n4 * x * y \<up> 3 +\n- 2 * y \<up> 4"
80.145 then () else error "poly.sml: diff.behav. in make_polynomial 2";
80.146
80.147 "-----SPB Schalk I p.63 No.279b ---";
80.148 val t = ParseC.parse_test @{context} "(x-a)*(x-b)*(x-c)*(x-d)";
80.149 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
80.150 -if UnparseC.term_in_ctxt @{context} t =
80.151 +if UnparseC.term @{context} t =
80.152 ("a * b * c * d + - 1 * a * b * c * x + - 1 * a * b * d * x +\na * b * x \<up> 2 +\n" ^
80.153 "- 1 * a * c * d * x +\na * c * x \<up> 2 +\na * d * x \<up> 2 +\n- 1 * a * x \<up> 3 +\n" ^
80.154 "- 1 * b * c * d * x +\nb * c * x \<up> 2 +\nb * d * x \<up> 2 +\n- 1 * b * x \<up> 3 +\nc" ^
80.155 @@ -448,80 +448,80 @@
80.156 "-----SPB Schalk I p.63 No.291 ---";
80.157 val t = ParseC.parse_test @{context} "(5+96*x \<up> 3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (- 15*x*(-8*x- 5)))";
80.158 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
80.159 -if UnparseC.term_in_ctxt @{context} t = "50 + - 770 * x + 4520 * x \<up> 2 + - 16320 * x \<up> 3 +\n- 26880 * x \<up> 4"
80.160 +if UnparseC.term @{context} t = "50 + - 770 * x + 4520 * x \<up> 2 + - 16320 * x \<up> 3 +\n- 26880 * x \<up> 4"
80.161 then () else error "poly.sml: diff.behav. in make_polynomial 4";
80.162
80.163 "-----SPB Schalk I p.64 No.295c ---";
80.164 val t = ParseC.parse_test @{context} "(13*a \<up> 4*b \<up> 9*c - 12*a \<up> 3*b \<up> 6*c \<up> 9) \<up> 2";
80.165 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
80.166 -if UnparseC.term_in_ctxt @{context} t =
80.167 +if UnparseC.term @{context} t =
80.168 "169 * a \<up> 8 * b \<up> 18 * c \<up> 2 +\n- 312 * a \<up> 7 * b \<up> 15 * c \<up> 10 +\n144 * a \<up> 6 * b \<up> 12 * c \<up> 18"
80.169 then ()else error "poly.sml: diff.behav. in make_polynomial 5";
80.170
80.171 "-----SPB Schalk I p.64 No.299a ---";
80.172 val t = ParseC.parse_test @{context} "(x - y)*(x + y)";
80.173 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
80.174 -if UnparseC.term_in_ctxt @{context} t = "x \<up> 2 + - 1 * y \<up> 2"
80.175 +if UnparseC.term @{context} t = "x \<up> 2 + - 1 * y \<up> 2"
80.176 then () else error "poly.sml: diff.behav. in make_polynomial 6";
80.177
80.178 "-----SPB Schalk I p.64 No.300c ---";
80.179 val t = ParseC.parse_test @{context} "(3*x \<up> 2*y - 1)*(3*x \<up> 2*y + 1)";
80.180 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
80.181 -if UnparseC.term_in_ctxt @{context} t = "- 1 + 9 * x \<up> 4 * y \<up> 2"
80.182 +if UnparseC.term @{context} t = "- 1 + 9 * x \<up> 4 * y \<up> 2"
80.183 then () else error "poly.sml: diff.behav. in make_polynomial 7";
80.184
80.185 "-----SPB Schalk I p.64 No.302 ---";
80.186 val t = ParseC.parse_test @{context}
80.187 "(13*x \<up> 2 + 5)*(13*x \<up> 2 - 5) - (5*x \<up> 2 + 3)*(5*x \<up> 2 - 3) - (12*x \<up> 2 + 4)*(12*x \<up> 2 - 4)";
80.188 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
80.189 -if UnparseC.term_in_ctxt @{context} t = "0"
80.190 +if UnparseC.term @{context} t = "0"
80.191 then () else error "poly.sml: diff.behav. in make_polynomial 8";
80.192 (* RL?MG?: Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *)
80.193
80.194 "-----SPB Schalk I p.64 No.306a ---";
80.195 val t = ParseC.parse_test @{context} "((x \<up> 2 + 1)*(x \<up> 2 - 1)) \<up> 2";
80.196 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.197 -if UnparseC.term_in_ctxt @{context} t = "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8" then ()
80.198 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.199 +if UnparseC.term @{context} t = "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8" then ()
80.200 else error "poly.sml: diff.behav. in 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 = - 2 * x \<up> 4";
80.201
80.202 (*WN071729 when reducing "rls reduce_012_" for Schaerding,
80.203 the above resulted in the term below ... but reduces from then correctly*)
80.204 val t = ParseC.parse_test @{context} "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8";
80.205 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.206 -if UnparseC.term_in_ctxt @{context} t = "1 + - 2 * x \<up> 4 + x \<up> 8"
80.207 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.208 +if UnparseC.term @{context} t = "1 + - 2 * x \<up> 4 + x \<up> 8"
80.209 then () else error "poly.sml: diff.behav. in make_polynomial 9b";
80.210
80.211 "-----SPB Schalk I p.64 No.296a ---";
80.212 val t = ParseC.parse_test @{context} "(x - a) \<up> 3";
80.213 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.214 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.215
80.216 val NONE = eval_is_even "aaa" "bbb" (ParseC.parse_test @{context} "3::real") "ccc";
80.217
80.218 -if UnparseC.term_in_ctxt @{context} t = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3"
80.219 +if UnparseC.term @{context} t = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3"
80.220 then () else error "poly.sml: diff.behav. in make_polynomial 10";
80.221
80.222 "-----SPB Schalk I p.64 No.296c ---";
80.223 val t = ParseC.parse_test @{context} "(-3*x - 4*y) \<up> 3";
80.224 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.225 -if UnparseC.term_in_ctxt @{context} t = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3"
80.226 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.227 +if UnparseC.term @{context} t = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3"
80.228 then () else error "poly.sml: diff.behav. in make_polynomial 11";
80.229
80.230 "-----SPB Schalk I p.62 No.242c ---";
80.231 val t = ParseC.parse_test @{context} "x \<up> (-4)*(x \<up> (-4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)";
80.232 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.233 -if UnparseC.term_in_ctxt @{context} t = "1"
80.234 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.235 +if UnparseC.term @{context} t = "1"
80.236 then () else error "poly.sml: diff.behav. in make_polynomial 12";
80.237
80.238 "-----SPB Schalk I p.60 No.209a ---";
80.239 val t = ParseC.parse_test @{context} "a \<up> (7-x) * a \<up> x";
80.240 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.241 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 7"
80.242 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.243 +if UnparseC.term @{context} t = "a \<up> 7"
80.244 then () else error "poly.sml: diff.behav. in make_polynomial 13";
80.245
80.246 "-----SPB Schalk I p.60 No.209d ---";
80.247 val t = ParseC.parse_test @{context} "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)";
80.248 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.249 -if UnparseC.term_in_ctxt @{context} t = "d \<up> 3"
80.250 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.251 +if UnparseC.term @{context} t = "d \<up> 3"
80.252 then () else error "poly.sml: diff.behav. in make_polynomial 14";
80.253
80.254 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------";
80.255 @@ -530,8 +530,8 @@
80.256 "-----Schalk I p.64 No.303 ---";
80.257 val t = ParseC.parse_test @{context} "(a + 2*b)*(a \<up> 2 + 4*b \<up> 2)*(a - 2*b) - (a - 6*b)*(a \<up> 2 + 36*b \<up> 2)*(a + 6*b)";
80.258 (*SOMETIMES LOOPS---------------------------------------------------------------------------\\*)
80.259 -val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.260 -if UnparseC.term_in_ctxt @{context} t = "1280 * b \<up> 4"
80.261 +val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.262 +if UnparseC.term @{context} t = "1280 * b \<up> 4"
80.263 then () else error "poly.sml: diff.behav. in make_polynomial 14b";
80.264 (* Richtig - aber Binomische Formel wurde nicht verwendet! *)
80.265 (*SOMETIMES LOOPS--------------------------------------------------------------------------//*)
80.266 @@ -541,50 +541,50 @@
80.267 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------";
80.268 "-----SPO ---";
80.269 val t = ParseC.parse_test @{context} "a + a + a";
80.270 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.271 -if UnparseC.term_in_ctxt @{context} t = "3 * a" then ()
80.272 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.273 +if UnparseC.term @{context} t = "3 * a" then ()
80.274 else error "poly.sml: diff.behav. in make_polynomial 16";
80.275 "-----SPO ---";
80.276 val t = ParseC.parse_test @{context} "a + b + b + b";
80.277 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.278 -if UnparseC.term_in_ctxt @{context} t = "a + 3 * b" then ()
80.279 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.280 +if UnparseC.term @{context} t = "a + 3 * b" then ()
80.281 else error "poly.sml: diff.behav. in make_polynomial 17";
80.282 "-----SPO ---";
80.283 val t = ParseC.parse_test @{context} "b * a * a";
80.284 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.285 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 2 * b" then ()
80.286 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.287 +if UnparseC.term @{context} t = "a \<up> 2 * b" then ()
80.288 else error "poly.sml: diff.behav. in make_polynomial 21";
80.289 "-----SPO ---";
80.290 val t = ParseC.parse_test @{context} "(a \<up> 2) \<up> 3";
80.291 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.292 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 6" then ()
80.293 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.294 +if UnparseC.term @{context} t = "a \<up> 6" then ()
80.295 else error "poly.sml: diff.behav. in make_polynomial 22";
80.296 "-----SPO ---";
80.297 val t = ParseC.parse_test @{context} "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y";
80.298 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.299 -if UnparseC.term_in_ctxt @{context} t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then ()
80.300 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term @{context} t;
80.301 +if UnparseC.term @{context} t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then ()
80.302 else error "poly.sml: diff.behav. in make_polynomial 23";
80.303 "-----SPO ---";
80.304 val t = ParseC.parse_test @{context} "a * b * b \<up> (- 1) + a";
80.305 -val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.306 -if UnparseC.term_in_ctxt @{context} t = "2 * a" then ()
80.307 +val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term @{context} t;
80.308 +if UnparseC.term @{context} t = "2 * a" then ()
80.309 else error "poly.sml: diff.behav. in make_polynomial 25";
80.310 "-----SPO ---";
80.311 val t = ParseC.parse_test @{context} "a*c*b \<up> (2*n) + 3*a + 5*b \<up> (2*n)*c*b";
80.312 -val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term_in_ctxt @{context} t;
80.313 -if UnparseC.term_in_ctxt @{context} t = "3 * a + 5 * b \<up> (1 + 2 * n) * c + a * b \<up> (2 * n) * c"
80.314 +val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term @{context} t;
80.315 +if UnparseC.term @{context} t = "3 * a + 5 * b \<up> (1 + 2 * n) * c + a * b \<up> (2 * n) * c"
80.316 then () else error "poly.sml: diff.behav. in make_polynomial 26";
80.317
80.318 (*MG030627 -------------vvv-: Verschachtelte Terme -----------*)
80.319 "-----SPO ---";
80.320 val t = ParseC.parse_test @{context} "(1 + (x*y*a) + x) \<up> (1 + (x*y*a) + x)";
80.321 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t;
80.322 -if UnparseC.term_in_ctxt @{context} t = "(1 + x + a * x * y) \<up> (1 + x + a * x * y)"
80.323 +if UnparseC.term @{context} t = "(1 + x + a * x * y) \<up> (1 + x + a * x * y)"
80.324 then () else error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*)
80.325
80.326 val t = ParseC.parse_test @{context} "(1 + x*(y*z)*zz) \<up> (1 + x*(y*z)*zz)";
80.327 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t;
80.328 -if UnparseC.term_in_ctxt @{context} t = "(1 + x * y * z * zz) \<up> (1 + x * y * z * zz)"
80.329 +if UnparseC.term @{context} t = "(1 + x * y * z * zz) \<up> (1 + x * y * z * zz)"
80.330 then () else error "poly.sml: diff.behav. in make_polynomial 28";
80.331
80.332 "-------- check pbl 'polynomial simplification' -----------------------------------------------";
81.1 --- a/test/Tools/isac/Knowledge/polyeq-1.sml Sat Feb 04 16:49:08 2023 +0100
81.2 +++ b/test/Tools/isac/Knowledge/polyeq-1.sml Sat Feb 04 17:00:25 2023 +0100
81.3 @@ -55,54 +55,54 @@
81.4
81.5 val t1 = ParseC.parse_test ctxt "lhs (-8 - 2*x + x \<up> 2 = 0)";
81.6 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t1;
81.7 - if ((UnparseC.term_in_ctxt @{context} t) = "- 8 - 2 * x + x \<up> 2") then ()
81.8 + if ((UnparseC.term @{context} t) = "- 8 - 2 * x + x \<up> 2") then ()
81.9 else error "polyeq.sml: diff.behav. in lhs";
81.10
81.11 val t2 = ParseC.parse_test ctxt "(-8 - 2*x + x \<up> 2) is_expanded_in x";
81.12 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t2;
81.13 - if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
81.14 + if (UnparseC.term @{context} t) = "True" then ()
81.15 else error "polyeq.sml: diff.behav. 1 in is_expended_in";
81.16
81.17 val t0 = ParseC.parse_test ctxt "(sqrt(x)) is_poly_in x";
81.18 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t0;
81.19 - if (UnparseC.term_in_ctxt @{context} t) = "False" then ()
81.20 + if (UnparseC.term @{context} t) = "False" then ()
81.21 else error "polyeq.sml: diff.behav. 2 in is_poly_in";
81.22
81.23 val t3 = ParseC.parse_test ctxt "(-8 + (- 1)*2*x + x \<up> 2) is_poly_in x";
81.24 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t3;
81.25 - if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
81.26 + if (UnparseC.term @{context} t) = "True" then ()
81.27 else error "polyeq.sml: diff.behav. 3 in is_poly_in";
81.28
81.29 val t4 = ParseC.parse_test ctxt "(lhs (-8 + (- 1)*2*x + x \<up> 2 = 0)) is_expanded_in x";
81.30 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t4;
81.31 - if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
81.32 + if (UnparseC.term @{context} t) = "True" then ()
81.33 else error "polyeq.sml: diff.behav. 4 in is_expended_in";
81.34
81.35 val t6 = ParseC.parse_test ctxt "(lhs (-8 - 2*x + x \<up> 2 = 0)) is_expanded_in x";
81.36 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t6;
81.37 - if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
81.38 + if (UnparseC.term @{context} t) = "True" then ()
81.39 else error "polyeq.sml: diff.behav. 5 in is_expended_in";
81.40
81.41 val t3 = ParseC.parse_test ctxt"((-8 - 2*x + x \<up> 2) has_degree_in x) = 2";
81.42 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t3;
81.43 - if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
81.44 + if (UnparseC.term @{context} t) = "True" then ()
81.45 else error "polyeq.sml: diff.behav. in has_degree_in_in";
81.46
81.47 val t3 = ParseC.parse_test ctxt "((sqrt(x)) has_degree_in x) = 2";
81.48 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t3;
81.49 - if (UnparseC.term_in_ctxt @{context} t) = "False" then ()
81.50 + if (UnparseC.term @{context} t) = "False" then ()
81.51 else error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
81.52
81.53 val t4 = ParseC.parse_test ctxt
81.54 "((-8 - 2*x + x \<up> 2) has_degree_in x) = 1";
81.55 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t4;
81.56 - if (UnparseC.term_in_ctxt @{context} t) = "False" then ()
81.57 + if (UnparseC.term @{context} t) = "False" then ()
81.58 else error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
81.59
81.60 val t5 = ParseC.parse_test ctxt
81.61 "((-8 - 2*x + x \<up> 2) has_degree_in x) = 2";
81.62 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_prls t5;
81.63 - if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
81.64 + if (UnparseC.term @{context} t) = "True" then ()
81.65 else error "polyeq.sml: diff.behav. 8 in has_degree_in_in";
81.66
81.67 "----------- test matching problems --------------------------0---";
81.68 @@ -137,24 +137,24 @@
81.69 val t = ParseC.parse_test ctxt "a*b - (a+b)*x + x \<up> 2 = 0";
81.70 (*ein 'ruleset' aus Poly.ML wird angewandt...*)
81.71 val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
81.72 - UnparseC.term_in_ctxt @{context} t;
81.73 + UnparseC.term @{context} t;
81.74 "a * b + (- 1 * (a * x) + (- 1 * (b * x) + x \<up> 2)) = 0";
81.75 val SOME (t,_) =
81.76 rewrite_set_inst_ thy Poly_erls false [("bdv", "a")] make_polynomial_in t;
81.77 - UnparseC.term_in_ctxt @{context} t;
81.78 + UnparseC.term @{context} t;
81.79 "x \<up> 2 + (- 1 * (b * x) + (- 1 * (x * a) + b * a)) = 0";
81.80 (* bei Verwendung von "size_of-term" nach MG :*)
81.81 (*"x \<up> 2 + (- 1 * (b * x) + (b * a + - 1 * (x * a))) = 0" !!! *)
81.82
81.83 (*wir holen 'a' wieder aus der Klammerung heraus...*)
81.84 val SOME (t,_) = rewrite_set_ thy Poly_erls false discard_parentheses t;
81.85 - UnparseC.term_in_ctxt @{context} t;
81.86 + UnparseC.term @{context} t;
81.87 "x \<up> 2 + - 1 * b * x + - 1 * x * a + b * a = 0";
81.88 (* "x \<up> 2 + - 1 * b * x + b * a + - 1 * x * a = 0" !!! *)
81.89
81.90 val SOME (t,_) =
81.91 rewrite_set_inst_ thy Poly_erls false [("bdv", "a")] make_polynomial_in t;
81.92 - UnparseC.term_in_ctxt @{context} t;
81.93 + UnparseC.term @{context} t;
81.94 "x \<up> 2 + (- 1 * (b * x) + a * (b + - 1 * x)) = 0";
81.95 (*da sind wir fast am Ziel: make_polynomial_in 'a' sollte ergeben
81.96 "x \<up> 2 + (- 1 * (b * x)) + (b + - 1 * x) * a = 0"*)
81.97 @@ -172,28 +172,28 @@
81.98 (* Anwenden einer Regelmenge aus Termorder.ML: *)
81.99 val SOME (t,_) =
81.100 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
81.101 - UnparseC.term_in_ctxt @{context} t;
81.102 + UnparseC.term @{context} t;
81.103 val SOME (t,_) =
81.104 rewrite_set_ thy false discard_parentheses t;
81.105 - UnparseC.term_in_ctxt @{context} t;
81.106 + UnparseC.term @{context} t;
81.107 "1 + b * x + x * a";
81.108
81.109 val t = ParseC.parse_test ctxt "1 + a * (x + b * x) + a \<up> 2";
81.110 val SOME (t,_) =
81.111 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
81.112 - UnparseC.term_in_ctxt @{context} t;
81.113 + UnparseC.term @{context} t;
81.114 val SOME (t,_) =
81.115 rewrite_set_ thy false discard_parentheses t;
81.116 - UnparseC.term_in_ctxt @{context} t;
81.117 + UnparseC.term @{context} t;
81.118 "1 + (x + b * x) * a + a \<up> 2";
81.119
81.120 val t = ParseC.parse_test ctxt "1 + a \<up> 2 * x + b * a + 7*a \<up> 2";
81.121 val SOME (t,_) =
81.122 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
81.123 - UnparseC.term_in_ctxt @{context} t;
81.124 + UnparseC.term @{context} t;
81.125 val SOME (t,_) =
81.126 rewrite_set_ thy false discard_parentheses t;
81.127 - UnparseC.term_in_ctxt @{context} t;
81.128 + UnparseC.term @{context} t;
81.129 "1 + b * a + (7 + x) * a \<up> 2";
81.130
81.131 (* MG2003
81.132 @@ -210,10 +210,10 @@
81.133 val t = ParseC.parse_test ctxt "a \<up> 2 * x + 7 * a \<up> 2";
81.134 val SOME (t,_) =
81.135 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
81.136 - UnparseC.term_in_ctxt @{context} t;
81.137 + UnparseC.term @{context} t;
81.138 val SOME (t,_) =
81.139 rewrite_set_ thy false discard_parentheses t;
81.140 - UnparseC.term_in_ctxt @{context} t;
81.141 + UnparseC.term @{context} t;
81.142 "(7 + x) * a \<up> 2";
81.143
81.144 val t = (Thm.term_of o the o (TermC.parse Termorder.thy)) "Pi";
81.145 @@ -245,26 +245,26 @@
81.146
81.147 fun size_of_term' i pr x (t as Const (\<^const_name>\<open>realpow\<close>, _) $
81.148 Free (var, _) $ Free (pot, _)) =
81.149 - (if pr then tracing (idt "#" i ^ "size_of_term' realpow: " ^ UnparseC.term_in_ctxt @{context} t) else ();
81.150 + (if pr then tracing (idt "#" i ^ "size_of_term' realpow: " ^ UnparseC.term @{context} t) else ();
81.151 case x of (*WN*)
81.152 (Free (xstr, _)) =>
81.153 if xstr = var
81.154 then (if pr then tracing (idt "#" i ^ "xstr = var --> " ^ string_of_int (1000 * (the (TermC.int_opt_of_string pot)))) else ();
81.155 1000 * (the (TermC.int_opt_of_string pot)))
81.156 else (if pr then tracing (idt "#" i ^ "x <> Free --> " ^ "3") else (); 3)
81.157 - | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term_in_ctxt @{context} x))
81.158 + | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term @{context} x))
81.159 | size_of_term' i pr x (t as Abs (_, _, body)) =
81.160 - (if pr then tracing (idt "#" i ^ "size_of_term' Abs: " ^ UnparseC.term_in_ctxt @{context} t) else ();
81.161 + (if pr then tracing (idt "#" i ^ "size_of_term' Abs: " ^ UnparseC.term @{context} t) else ();
81.162 1 + size_of_term' (i + 1) pr x body)
81.163 | size_of_term' i pr x (f $ t) =
81.164 let
81.165 - val _ = if pr then tracing (idt "#" i ^ "size_of_term' $$$: " ^ UnparseC.term_in_ctxt @{context} f ^ " $$$ " ^ UnparseC.term_in_ctxt @{context} t) else ();
81.166 + val _ = if pr then tracing (idt "#" i ^ "size_of_term' $$$: " ^ UnparseC.term @{context} f ^ " $$$ " ^ UnparseC.term @{context} t) else ();
81.167 val s1 = size_of_term' (i + 1) pr x f
81.168 val s2 = size_of_term' (i + 1) pr x t
81.169 val _ = if pr then tracing (idt "#" i ^ "size_of_term' $$$-->: " ^ string_of_int s1 ^ " + " ^ string_of_int s2 ^ " = " ^ string_of_int(s1 + s2)) else ();
81.170 in (s1 + s2) end
81.171 | size_of_term' i pr x t =
81.172 - (if pr then tracing (idt "#" i ^ "size_of_term' bot: " ^ UnparseC.term_in_ctxt @{context} t) else ();
81.173 + (if pr then tracing (idt "#" i ^ "size_of_term' bot: " ^ UnparseC.term @{context} t) else ();
81.174 case t of
81.175 Free (subst, _) =>
81.176 (case x of
81.177 @@ -272,7 +272,7 @@
81.178 if xstr = subst
81.179 then (if pr then tracing (idt "#" i ^ "xstr = var --> " ^ "1000") else (); 1000)
81.180 else (if pr then tracing (idt "#" i ^ "x <> Free --> " ^ "1") else (); 1)
81.181 - | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term_in_ctxt @{context} x))
81.182 + | _ => raise ERROR ("size_of_term' called with subst = " ^ UnparseC.term @{context} x))
81.183 | _ => (if pr then tracing (idt "#" i ^ "bot --> " ^ "1") else (); 1));
81.184
81.185 fun term_ord' i pr x thy (Abs (_, T, t), Abs(_, U, u)) = (* ~ term.ML *)
81.186 @@ -284,7 +284,7 @@
81.187 in ord end
81.188 | term_ord' i pr x _ (t, u) =
81.189 let
81.190 - val _ = if pr then tracing (idt "#" i ^ "term_ord' bot (" ^ UnparseC.term_in_ctxt @{context} t ^ ", " ^ UnparseC.term_in_ctxt @{context} u ^ ")") else ();
81.191 + val _ = if pr then tracing (idt "#" i ^ "term_ord' bot (" ^ UnparseC.term @{context} t ^ ", " ^ UnparseC.term @{context} u ^ ")") else ();
81.192 val ord =
81.193 case int_ord (size_of_term' (i + 1) pr x t, size_of_term' (i + 1) pr x u) of
81.194 EQUAL =>
81.195 @@ -299,7 +299,7 @@
81.196 in ord end
81.197 and hd_ord i pr x (f, g) = (* ~ term.ML *)
81.198 let
81.199 - val _ = if pr then tracing (idt "#" i ^ "hd_ord (" ^ UnparseC.term_in_ctxt @{context} f ^ ", " ^ UnparseC.term_in_ctxt @{context} g ^ ")") else ();
81.200 + val _ = if pr then tracing (idt "#" i ^ "hd_ord (" ^ UnparseC.term @{context} f ^ ", " ^ UnparseC.term @{context} g ^ ")") else ();
81.201 val ord = prod_ord
81.202 (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord
81.203 (dest_hd' x f, dest_hd' x g)
81.204 @@ -307,7 +307,7 @@
81.205 in ord end
81.206 and terms_ord x i pr (ts, us) =
81.207 let
81.208 - val _ = if pr then tracing (idt "#" i ^ "terms_ord (" ^ UnparseC.terms_in_ctxt @{context} ts ^ ", " ^ UnparseC.terms_in_ctxt @{context} us ^ ")") else ();
81.209 + val _ = if pr then tracing (idt "#" i ^ "terms_ord (" ^ UnparseC.terms @{context} ts ^ ", " ^ UnparseC.terms @{context} us ^ ")") else ();
81.210 val ord = list_ord (term_ord' (i + 1) pr x (ThyC.get_theory "Isac_Knowledge"))(ts, us);
81.211 val _ = if pr then tracing (idt "#" i ^ "terms_ord --> " ^ pr_ord ord) else ();
81.212 in ord end
81.213 @@ -375,29 +375,29 @@
81.214 val a = ParseC.parse_test ctxt "a ::real";
81.215 val b = ParseC.parse_test ctxt "b ::real";
81.216 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,a)] make_polynomial_in x2;
81.217 -if UnparseC.term_in_ctxt @{context} t' = "b + x + a" then ()
81.218 +if UnparseC.term @{context} t' = "b + x + a" then ()
81.219 else error "termorder.sml diff.behav ord_make_polynomial_in #11";
81.220
81.221 val NONE = rewrite_set_inst_ ctxt false [(bdv,b)] make_polynomial_in x2;
81.222
81.223 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,x)] make_polynomial_in x2;
81.224 -if UnparseC.term_in_ctxt @{context} t' = "a + b + x" then ()
81.225 +if UnparseC.term @{context} t' = "a + b + x" then ()
81.226 else error "termorder.sml diff.behav ord_make_polynomial_in #13";
81.227
81.228 val ppp' = "-6 + -5*x + x \<up> 3 + - 1*x \<up> 2 + - 1*x \<up> 3 + - 14*x \<up> 2";
81.229 val ppp = ParseC.parse_test ctxt ppp';
81.230 val SOME (t', _) = rewrite_set_inst_ ctxt false [(bdv,x)] make_polynomial_in ppp;
81.231 -if UnparseC.term_in_ctxt @{context} t' = "- 6 + - 5 * x + - 15 * x \<up> 2" then ()
81.232 +if UnparseC.term @{context} t' = "- 6 + - 5 * x + - 15 * x \<up> 2" then ()
81.233 else error "termorder.sml diff.behav ord_make_polynomial_in #15";
81.234
81.235 val ttt' = "(3*x + 5)/18 ::real";
81.236 val ttt = ParseC.parse_test ctxt ttt';
81.237 val SOME (uuu,_) = rewrite_set_inst_ ctxt false [(bdv,x)] make_polynomial_in ttt;
81.238 -if UnparseC.term_in_ctxt @{context} uuu = "(5 + 3 * x) / 18" then ()
81.239 +if UnparseC.term @{context} uuu = "(5 + 3 * x) / 18" then ()
81.240 else error "termorder.sml diff.behav ord_make_polynomial_in #16a";
81.241
81.242 val SOME (uuu,_) = rewrite_set_ ctxt false make_polynomial ttt;
81.243 -if UnparseC.term_in_ctxt @{context} uuu = "(5 + 3 * x) / 18" then ()
81.244 +if UnparseC.term @{context} uuu = "(5 + 3 * x) / 18" then ()
81.245 else error "termorder.sml diff.behav ord_make_polynomial_in #16b";
81.246
81.247 "----------- lin.eq degree_0 -------------------------------------";
81.248 @@ -487,7 +487,7 @@
81.249 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
81.250 val asm = Ctree.get_assumptions pt p;
81.251 if f2str f = "[]" andalso
81.252 - UnparseC.terms_in_ctxt @{context} asm = "[lhs (2 + - 1 * x + x \<up> 2 = 0) is_poly_in x, " ^
81.253 + UnparseC.terms @{context} asm = "[lhs (2 + - 1 * x + x \<up> 2 = 0) is_poly_in x, " ^
81.254 "lhs (2 + - 1 * x + x \<up> 2 = 0) has_degree_in x = 2]" then ()
81.255 else error "polyeq.sml: diff.behav. in 2 +(- 1)*x + x \<up> 2 = 0";
81.256
81.257 @@ -1014,46 +1014,46 @@
81.258
81.259 val rls = complete_square;
81.260 val SOME (t,asm) = rewrite_set_inst_ ctxt true inst rls t;
81.261 -if UnparseC.term_in_ctxt @{context} t = "- 8 + (2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2"
81.262 +if UnparseC.term @{context} t = "- 8 + (2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2"
81.263 then () else error "rls complete_square CHANGED";
81.264
81.265 val thm = @{thm square_explicit1};
81.266 val SOME (t,asm) = rewrite_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty true thm t;
81.267 -if UnparseC.term_in_ctxt @{context} t = "(2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2 - - 8"
81.268 +if UnparseC.term @{context} t = "(2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2 - - 8"
81.269 then () else error "thm square_explicit1 CHANGED";
81.270
81.271 val thm = @{thm root_plus_minus};
81.272 val SOME (t,asm) = rewrite_ ctxt Rewrite_Ord.function_empty PolyEq_erls true thm t;
81.273 -if UnparseC.term_in_ctxt @{context} t =
81.274 +if UnparseC.term @{context} t =
81.275 "2 / 2 - x = sqrt ((2 / 2) \<up> 2 - - 8) \<or>\n2 / 2 - x = - 1 * sqrt ((2 / 2) \<up> 2 - - 8)"
81.276 then () else error "thm root_plus_minus CHANGED";
81.277
81.278 (*the thm bdv_explicit2* here required to be constrained to ::real*)
81.279 val thm = @{thm bdv_explicit2};
81.280 val SOME (t,asm) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty true inst thm t;
81.281 -if UnparseC.term_in_ctxt @{context} t =
81.282 +if UnparseC.term @{context} t =
81.283 "2 / 2 - x = sqrt ((2 / 2) \<up> 2 - - 8) \<or>\n- 1 * x = - (2 / 2) + - 1 * sqrt ((2 / 2) \<up> 2 - - 8)"
81.284 then () else error "thm bdv_explicit2 CHANGED";
81.285
81.286 val thm = @{thm bdv_explicit3};
81.287 val SOME (t,asm) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty true inst thm t;
81.288 -if UnparseC.term_in_ctxt @{context} t =
81.289 +if UnparseC.term @{context} t =
81.290 "2 / 2 - x = sqrt ((2 / 2) \<up> 2 - - 8) \<or>\nx = - 1 * (- (2 / 2) + - 1 * sqrt ((2 / 2) \<up> 2 - - 8))"
81.291 then () else error "thm bdv_explicit3 CHANGED";
81.292
81.293 val thm = @{thm bdv_explicit2};
81.294 val SOME (t,asm) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty true inst thm t;
81.295 -if UnparseC.term_in_ctxt @{context} t =
81.296 +if UnparseC.term @{context} t =
81.297 "- 1 * x = - (2 / 2) + sqrt ((2 / 2) \<up> 2 - - 8) \<or>\nx = - 1 * (- (2 / 2) + - 1 * sqrt ((2 / 2) \<up> 2 - - 8))"
81.298 then () else error "thm bdv_explicit2 CHANGED";
81.299
81.300 val rls = calculate_RootRat;
81.301 val SOME (t,asm) = rewrite_set_ ctxt true rls t;
81.302 -if UnparseC.term_in_ctxt @{context} t =
81.303 +if UnparseC.term @{context} t =
81.304 "- 1 * x = - 1 + sqrt (2 \<up> 2 / 2 \<up> 2 - - 8) \<or>\nx = - 1 * - 1 + - 1 * (- 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - - 8))"
81.305 (*"- 1 * x = - 1 + sqrt (2 \<up> 2 / 2 \<up> 2 - -8) |\nx = - 1 * - 1 + - 1 * (- 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - -8))"..isabisac15*)
81.306 then () else error "(-8 - 2*x + x \<up> 2 = 0), by rewriting -- ERROR INDICATES IMPROVEMENT";
81.307 -(*SHOULD BE: UnparseC.term_in_ctxt @{context} = "x = - 2 | x = 4;*)
81.308 +(*SHOULD BE: UnparseC.term @{context} = "x = - 2 | x = 4;*)
81.309
81.310
81.311 "-------------------- (3 - 10*x + 3*x \<up> 2 = 0), ----------------------";
81.312 @@ -1062,7 +1062,7 @@
81.313 "---- test the asm_rls ----";
81.314 val t1 = ParseC.parse_test ctxt "0 <= (10/3/2) \<up> 2 - 1";
81.315 val SOME (t,_) = rewrite_set_ ctxt false PolyEq_erls t1;
81.316 - val t' = UnparseC.term_in_ctxt @{context} t;
81.317 + val t' = UnparseC.term @{context} t;
81.318 (*if t'= \<^const_name>\<open>True\<close> then ()
81.319 else error "polyeq.sml: diff.behav. in 'rewrite_set_.. PolyEq_erls";*)
81.320 (* *)
82.1 --- a/test/Tools/isac/Knowledge/polyeq-2.sml Sat Feb 04 16:49:08 2023 +0100
82.2 +++ b/test/Tools/isac/Knowledge/polyeq-2.sml Sat Feb 04 17:00:25 2023 +0100
82.3 @@ -221,7 +221,7 @@
82.4 (*3(b)*)val (bdv,v) = (ParseC.parse_test @{context} "''bdv''", ParseC.parse_test @{context} "R1");
82.5 val t = ParseC.parse_test @{context} "- 1 * (R * R2) + R2 * R1 + - 1 * (R * R1) = 0";
82.6 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,v)] make_polynomial_in t;
82.7 -if UnparseC.term_in_ctxt @{context} t' = "- 1 * R * R2 + R2 * R1 + - 1 * R * R1 = 0" then ()
82.8 +if UnparseC.term @{context} t' = "- 1 * R * R2 + R2 * R1 + - 1 * R * R1 = 0" then ()
82.9 else error "make_polynomial_in (- 1 * (R * R2) + R2 * R1 + - 1 * (R * R1) = 0)";
82.10 "- 1 * R * R2 + (R2 + - 1 * R) * R1 = 0";
82.11 (*WN.19.3.03 ---^-*)
82.12 @@ -229,21 +229,21 @@
82.13 (*3(c)*)val (bdv,v) = (ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "p");
82.14 val t = ParseC.parse_test @{context} "y \<up> 2 + - 2 * (x * p) = 0";
82.15 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,v)] make_polynomial_in t;
82.16 -if UnparseC.term_in_ctxt @{context} t' = "y \<up> 2 + - 2 * x * p = 0" then ()
82.17 +if UnparseC.term @{context} t' = "y \<up> 2 + - 2 * x * p = 0" then ()
82.18 else error "make_polynomial_in (y \<up> 2 + - 2 * (x * p) = 0)";
82.19
82.20 (*3(d)*)val (bdv,v) = (ParseC.parse_test @{context} "''bdv''", ParseC.parse_test @{context} "x2");
82.21 val t = ParseC.parse_test @{context}
82.22 "A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + - 1 * (x1 * (y2 * (1 / 2))) + - 1 * (x3 * (y1 * (1 / 2 ))) + y1 * (1 / 2 * x2) + - 1 * (y3 * (1 / 2 * x2)) = 0";
82.23 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,v)] make_polynomial_in t;
82.24 -if UnparseC.term_in_ctxt @{context} t' =
82.25 +if UnparseC.term @{context} t' =
82.26 "A + x1 * y3 * (1 / 2) + x3 * y2 * (1 / 2) + - 1 * x1 * y2 * (1 / 2) +\n- 1 * x3 * y1 * (1 / 2) +\ny1 * (1 / 2) * x2 +\n- 1 * y3 * (1 / 2) * x2 =\n0"
82.27 then ()
82.28 else error "make_polynomial_in (A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + - 1...";
82.29 "A + x1 * y3 * (1 / 2) + x3 * y2 * (1 / 2) + - x1 * y2 * (1 / 2) + - x3 * y1 * (1 / 2) + (y1 * (1 / 2) + - y3 * (1 / 2)) * x2 = 0";
82.30
82.31 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,v)] make_ratpoly_in t;
82.32 -if UnparseC.term_in_ctxt @{context} t' =
82.33 +if UnparseC.term @{context} t' =
82.34 "A / 1 + x1 * y3 / 2 + x3 * y2 / 2 + - 1 * x1 * y2 / 2 + - 1 * x3 * y1 / 2 +\ny1 * x2 / 2 +\n- 1 * y3 * x2 / 2 =\n0"
82.35 then ()
82.36 else error "make_ratpoly_in (A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + - 1...";
82.37 @@ -284,19 +284,19 @@
82.38 (* steps in rls d2_polyeq_bdv_only_simplify:*)
82.39
82.40 (*-6 * x + 5 * x ^ 2 = 0 : Rewrite_Inst (["(''bdv'',x)"],("d2_prescind1", "")) --> x * (-6 + 5 * x) = 0*)
82.41 -t |> UnparseC.term_in_ctxt @{context}; t |> TermC.atom_trace_detail @{context};
82.42 +t |> UnparseC.term @{context}; t |> TermC.atom_trace_detail @{context};
82.43 val thm = @{thm d2_prescind1};
82.44 -thm |> Thm.prop_of |> UnparseC.term_in_ctxt @{context}; thm |> Thm.prop_of |> TermC.atom_trace_detail @{context};
82.45 -val SOME (t', _) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.empty true subst thm t; UnparseC.term_in_ctxt @{context} t';
82.46 +thm |> Thm.prop_of |> UnparseC.term @{context}; thm |> Thm.prop_of |> TermC.atom_trace_detail @{context};
82.47 +val SOME (t', _) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.empty true subst thm t; UnparseC.term @{context} t';
82.48
82.49 (*x * (-6 + 5 * x) = 0 : Rewrite_Inst (["(''bdv'',x)"],("d2_reduce_equation1", ""))
82.50 --> x = 0 | -6 + 5 * x = 0*)
82.51 -t' |> UnparseC.term_in_ctxt @{context}; t' |> TermC.atom_trace_detail @{context};
82.52 +t' |> UnparseC.term @{context}; t' |> TermC.atom_trace_detail @{context};
82.53 val thm = @{thm d2_reduce_equation1};
82.54 -thm |> Thm.prop_of |> UnparseC.term_in_ctxt @{context}; thm |> Thm.prop_of |> TermC.atom_trace_detail @{context};
82.55 -val SOME (t'', _) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.empty true subst thm t'; UnparseC.term_in_ctxt @{context} t'';
82.56 +thm |> Thm.prop_of |> UnparseC.term @{context}; thm |> Thm.prop_of |> TermC.atom_trace_detail @{context};
82.57 +val SOME (t'', _) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.empty true subst thm t'; UnparseC.term @{context} t'';
82.58 (* NONE with d2_reduce_equation1: "(bdv*(a +b*bdv)=0) = ((bdv=0)|(a+b*bdv=0))"
82.59 instead d2_reduce_equation1: "(bdv*(a +b*bdv)=0) = ((bdv=0)|(a+b*bdv=(0::real)))"
82.60 *)
82.61 -if UnparseC.term_in_ctxt @{context} t'' = "x = 0 \<or> - 6 + 5 * x = 0" then ()
82.62 +if UnparseC.term @{context} t'' = "x = 0 \<or> - 6 + 5 * x = 0" then ()
82.63 else error "rls d2_polyeq_bdv_only_simplify broken";
83.1 --- a/test/Tools/isac/Knowledge/polyminus.sml Sat Feb 04 16:49:08 2023 +0100
83.2 +++ b/test/Tools/isac/Knowledge/polyminus.sml Sat Feb 04 17:00:25 2023 +0100
83.3 @@ -171,47 +171,47 @@
83.4 "----- with these simple variables it works...";
83.5 val ctxt = @{context};
83.6 val t = ParseC.parse_test ctxt "((a + d) + c) + b";
83.7 -val SOME (t,_) = rewrite_set_ ctxt false order_add_mult t; UnparseC.term_in_ctxt @{context} t;
83.8 -if UnparseC.term_in_ctxt @{context} t = "a + (b + (c + d))" then ()
83.9 +val SOME (t,_) = rewrite_set_ ctxt false order_add_mult t; UnparseC.term @{context} t;
83.10 +if UnparseC.term @{context} t = "a + (b + (c + d))" then ()
83.11 else error "polyminus.sml 1 watch order_add_mult";
83.12
83.13 "----- the same stepwise...";
83.14 val od = ord_make_polynomial true
83.15 val t = ParseC.parse_test @{context} "((a + d) + c) + b";
83.16 "((a + d) + c) + b";
83.17 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t;
83.18 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.commute} t; UnparseC.term @{context} t;
83.19 "b + ((a + d) + c)";
83.20 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t;
83.21 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.commute} t; UnparseC.term @{context} t;
83.22 "b + (c + (a + d))";
83.23 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term_in_ctxt @{context} t;
83.24 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term @{context} t;
83.25 "b + (a + (c + d))";
83.26 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term_in_ctxt @{context} t;
83.27 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term @{context} t;
83.28 "a + (b + (c + d))";
83.29 -if UnparseC.term_in_ctxt @{context} t = "a + (b + (c + d))" then ()
83.30 +if UnparseC.term @{context} t = "a + (b + (c + d))" then ()
83.31 else error "polyminus.sml 2 watch order_add_mult";
83.32
83.33 "----- if parentheses are right, left_commute is (almost) sufficient...";
83.34 val t = ParseC.parse_test @{context} "a + (d + (c + b))";
83.35 "a + (d + (c + b))";
83.36 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term_in_ctxt @{context} t;
83.37 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term @{context} t;
83.38 "a + (c + (d + b))";
83.39 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.commute} t;UnparseC.term_in_ctxt @{context} t;
83.40 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.commute} t;UnparseC.term @{context} t;
83.41 "a + (c + (b + d))";
83.42 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term_in_ctxt @{context} t;
83.43 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term @{context} t;
83.44 "a + (b + (c + d))";
83.45
83.46 "----- but we do not want the parentheses at right; thus: cond.rew.";
83.47 "WN0712707 complicated monomials do not yet work ...";
83.48 val t = ParseC.parse_test @{context} "((5*a + 4*d) + 3*c) + 2*b";
83.49 -val SOME (t,_) = rewrite_set_ ctxt false order_add_mult t; UnparseC.term_in_ctxt @{context} t;
83.50 -if UnparseC.term_in_ctxt @{context} t = "2 * b + (3 * c + (4 * d + 5 * a))" then ()
83.51 +val SOME (t,_) = rewrite_set_ ctxt false order_add_mult t; UnparseC.term @{context} t;
83.52 +if UnparseC.term @{context} t = "2 * b + (3 * c + (4 * d + 5 * a))" then ()
83.53 else error "polyminus.sml: order_add_mult changed";
83.54
83.55 "----- here we see rew_sub going into subterm with ord.rew....";
83.56 val od = ord_make_polynomial false;
83.57 val t = ParseC.parse_test @{context} "b + a + c + d";
83.58 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty false @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t;
83.59 -val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty false @{thm add.commute} t; UnparseC.term_in_ctxt @{context} t;
83.60 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty false @{thm add.commute} t; UnparseC.term @{context} t;
83.61 +val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty false @{thm add.commute} t; UnparseC.term @{context} t;
83.62 (*@@@ rew_sub gosub: t = d + (b + a + c)
83.63 @@@ rew_sub begin: t = b + a + c*)
83.64
83.65 @@ -261,54 +261,54 @@
83.66
83.67 val asm_rls = erls_ordne_alphabetisch;
83.68 val t = ParseC.parse_test @{context} "b + a";
83.69 -val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm tausche_plus} t; UnparseC.term_in_ctxt @{context} t;
83.70 -if UnparseC.term_in_ctxt @{context} t = "a + b" then ()
83.71 +val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm tausche_plus} t; UnparseC.term @{context} t;
83.72 +if UnparseC.term @{context} t = "a + b" then ()
83.73 else error "polyminus.sml: ordne_alphabetisch1 b + a";
83.74
83.75 val asm_rls = Atools_erls;
83.76 val t = ParseC.parse_test @{context} "2*a + 3*a";
83.77 -val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm real_num_collect} t; UnparseC.term_in_ctxt @{context} t;
83.78 +val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm real_num_collect} t; UnparseC.term @{context} t;
83.79
83.80 "======= test rewrite_, rewrite_set_";
83.81 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
83.82 val asm_rls = erls_ordne_alphabetisch;
83.83 val t = ParseC.parse_test @{context} "b + a";
83.84 -val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term_in_ctxt @{context} t;
83.85 -if UnparseC.term_in_ctxt @{context} t = "a + b" then ()
83.86 +val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term @{context} t;
83.87 +if UnparseC.term @{context} t = "a + b" then ()
83.88 else error "polyminus.sml: ordne_alphabetisch a + b";
83.89
83.90 val t = ParseC.parse_test @{context} "2*b + a";
83.91 -val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term_in_ctxt @{context} t;
83.92 -if UnparseC.term_in_ctxt @{context} t = "a + 2 * b" then ()
83.93 +val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term @{context} t;
83.94 +if UnparseC.term @{context} t = "a + 2 * b" then ()
83.95 else error "polyminus.sml: ordne_alphabetisch a + 2 * b";
83.96
83.97 val t = ParseC.parse_test @{context} "a + c + b";
83.98 -val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term_in_ctxt @{context} t;
83.99 -if UnparseC.term_in_ctxt @{context} t = "a + b + c" then ()
83.100 +val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term @{context} t;
83.101 +if UnparseC.term @{context} t = "a + b + c" then ()
83.102 else error "polyminus.sml: ordne_alphabetisch a + b + c";
83.103
83.104 "======= rewrite goes into subterms";
83.105 val t = ParseC.parse_test @{context} "a + c + b + d ::real";
83.106 -val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm tausche_plus_plus} t; UnparseC.term_in_ctxt @{context} t;
83.107 -if UnparseC.term_in_ctxt @{context} t = "a + b + c + d" then ()
83.108 +val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm tausche_plus_plus} t; UnparseC.term @{context} t;
83.109 +if UnparseC.term @{context} t = "a + b + c + d" then ()
83.110 else error "polyminus.sml: ordne_alphabetisch1 a + b + c + d";
83.111
83.112 val t = ParseC.parse_test @{context} "a + c + d + b";
83.113 -val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term_in_ctxt @{context} t;
83.114 -if UnparseC.term_in_ctxt @{context} t = "a + b + c + d" then ()
83.115 +val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term @{context} t;
83.116 +if UnparseC.term @{context} t = "a + b + c + d" then ()
83.117 else error "polyminus.sml: ordne_alphabetisch2 a + b + c + d";
83.118
83.119 "======= here we see rew_sub going into subterm with cond.rew....";
83.120 val t = ParseC.parse_test @{context} "b + a + c + d";
83.121 -val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm tausche_plus} t; UnparseC.term_in_ctxt @{context} t;
83.122 -if UnparseC.term_in_ctxt @{context} t = "a + b + c + d" then ()
83.123 +val SOME (t,_) = rewrite_ ctxt od asm_rls false @{thm tausche_plus} t; UnparseC.term @{context} t;
83.124 +if UnparseC.term @{context} t = "a + b + c + d" then ()
83.125 else error "polyminus.sml: ordne_alphabetisch3 a + b + c + d";
83.126
83.127 "======= compile rls for the most complicated terms";
83.128 val t = ParseC.parse_test @{context} "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12";
83.129 "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12";
83.130 val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t;
83.131 -if UnparseC.term_in_ctxt @{context} t = "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g"
83.132 +if UnparseC.term @{context} t = "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g"
83.133 then () else error "polyminus.sml: ordne_alphabetisch finished";
83.134
83.135
83.136 @@ -318,7 +318,7 @@
83.137 "----------- build fasse_zusammen --------------------------------";
83.138 val t = ParseC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g";
83.139 val SOME (t,_) = rewrite_set_ ctxt false fasse_zusammen t;
83.140 -if UnparseC.term_in_ctxt @{context} t = "3 + - 2 * e + 2 * f + 2 * g" then ()
83.141 +if UnparseC.term @{context} t = "3 + - 2 * e + 2 * f + 2 * g" then ()
83.142 else error "polyminus.sml: fasse_zusammen finished";
83.143
83.144 "----------- build verschoenere ----------------------------------";
83.145 @@ -326,7 +326,7 @@
83.146 "----------- build verschoenere ----------------------------------";
83.147 val t = ParseC.parse_test @{context} "3 + - 2 * e + 2 * f + 2 * g";
83.148 val SOME (t,_) = rewrite_set_ ctxt false verschoenere t;
83.149 -if UnparseC.term_in_ctxt @{context} t = "3 - 2 * e + 2 * f + 2 * g" then ()
83.150 +if UnparseC.term @{context} t = "3 - 2 * e + 2 * f + 2 * g" then ()
83.151 else error "polyminus.sml: verschoenere 3 + - 2 * e ...";
83.152
83.153
83.154 @@ -380,7 +380,7 @@
83.155 autoCalculate 1 CompleteCalc;
83.156 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.157 if p = ([], Res) andalso
83.158 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "3 - 2 * e + 2 * f + 2 * g"
83.159 + UnparseC.term @{context} (get_obj g_res pt (fst p)) = "3 - 2 * e + 2 * f + 2 * g"
83.160 then () else error "polyminus.sml: Vereinfache (3 - 2 * e + 2 * f...";
83.161
83.162 "======= 140 d ---";
83.163 @@ -393,7 +393,7 @@
83.164 autoCalculate 1 CompleteCalc;
83.165 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.166 if p = ([], Res) andalso
83.167 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "3 + 3 * r + 6 * s - 8 * t"
83.168 + UnparseC.term @{context} (get_obj g_res pt (fst p)) = "3 + 3 * r + 6 * s - 8 * t"
83.169 then () else error "polyminus.sml: Vereinfache 140 d)";
83.170
83.171 "======= 139 c ---";
83.172 @@ -406,7 +406,7 @@
83.173 autoCalculate 1 CompleteCalc;
83.174 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.175 if p = ([], Res) andalso
83.176 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "- (3 * f)"
83.177 + UnparseC.term @{context} (get_obj g_res pt (fst p)) = "- (3 * f)"
83.178 then () else error "polyminus.sml: Vereinfache 139 c)";
83.179
83.180 "======= 139 b ---";
83.181 @@ -419,7 +419,7 @@
83.182 autoCalculate 1 CompleteCalc;
83.183 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.184 if p = ([], Res) andalso
83.185 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "- 3 * u - v"
83.186 + UnparseC.term @{context} (get_obj g_res pt (fst p)) = "- 3 * u - v"
83.187 then () else error "polyminus.sml: Vereinfache 139 b)";
83.188
83.189 "======= 138 a ---";
83.190 @@ -432,7 +432,7 @@
83.191 autoCalculate 1 CompleteCalc;
83.192 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.193 if p = ([], Res) andalso
83.194 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "- 4 * u + 2 * v"
83.195 + UnparseC.term @{context} (get_obj g_res pt (fst p)) = "- 4 * u + 2 * v"
83.196 then () else error "polyminus.sml: Vereinfache 138 a)";
83.197
83.198 "----------- met probe fuer_polynom ------------------------------";
83.199 @@ -463,11 +463,11 @@
83.200 (* autoCalculate 1 CompleteCalcHead;
83.201 autoCalculate 1 (Steps 1);
83.202 autoCalculate 1 (Steps 1);
83.203 - val ((pt,p),_) = States.get_calc 1; UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p));
83.204 + val ((pt,p),_) = States.get_calc 1; UnparseC.term @{context} (get_obj g_res pt (fst p));
83.205 @@@@@WN081114 gives "??.empty", all "Pruefe" are the same,
83.206 although analogies work in interface.sml: FIXME.WN081114 in "Pruefe"*)
83.207 val ((pt,p),_) = States.get_calc 1;
83.208 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "11 = 11"
83.209 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "11 = 11"
83.210 then () else error "polyminus.sml: Probe 11 = 11";
83.211 Test_Tool.show_pt pt;
83.212
83.213 @@ -484,7 +484,7 @@
83.214 autoCalculate 1 CompleteCalc;
83.215 val ((pt,p),_) = States.get_calc 1;
83.216 if p = ([], Res) andalso
83.217 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "1 + 14 * u"
83.218 + UnparseC.term @{context} (get_obj g_res pt (fst p)) = "1 + 14 * u"
83.219 then () else error "polyminus.sml: Vereinfache (2*u - 5 - (3 - ...";
83.220 Test_Tool.show_pt pt;
83.221
83.222 @@ -498,7 +498,7 @@
83.223 moveActiveRoot 1;
83.224 autoCalculate 1 CompleteCalc;
83.225 val ((pt,p),_) = States.get_calc 1;
83.226 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "29 = 29"
83.227 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "29 = 29"
83.228 then () else error "polyminus.sml: Probe 29 = 29";
83.229 Test_Tool.show_pt pt;
83.230
83.231 @@ -527,7 +527,7 @@
83.232 val t = ParseC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
83.233 val SOME (t',_) =
83.234 rewrite_ ctxt Rewrite_Ord.function_empty asm_rls false @{thm tausche_minus} t;
83.235 -UnparseC.term_in_ctxt @{context} t'; "- 9 + 12 + 5 * e - 7 * e + (- 4 + 6) * f - 8 * g + 10 * g";
83.236 +UnparseC.term @{context} t'; "- 9 + 12 + 5 * e - 7 * e + (- 4 + 6) * f - 8 * g + 10 * g";
83.237
83.238 val t = ParseC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
83.239 val NONE =
83.240 @@ -536,7 +536,7 @@
83.241 val t = ParseC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
83.242 val SOME (t',_) =
83.243 rewrite_set_ ctxt false ordne_alphabetisch t;
83.244 -UnparseC.term_in_ctxt @{context} t'; "- 9 + 12 + 5 * e - 7 * e - 8 * g + 10 * g + (- 4 + 6) * f";
83.245 +UnparseC.term @{context} t'; "- 9 + 12 + 5 * e - 7 * e - 8 * g + 10 * g + (- 4 + 6) * f";
83.246
83.247
83.248 applyTactic 1 p (hd (specific_from_prog pt p)) (*tausche_minus*);
83.249 @@ -564,7 +564,7 @@
83.250 (([], Res), - (8 * g) + 10 * g + (3 - 2 * e + 2 * f))]
83.251 ~~~~~~~~~~~###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
83.252 val ([], Res) = p;
83.253 -val "2 * g + (3 - 2 * e + 2 * f)" = get_obj g_res pt (fst p) |> UnparseC.term_in_ctxt @{context};
83.254 +val "2 * g + (3 - 2 * e + 2 * f)" = get_obj g_res pt (fst p) |> UnparseC.term @{context};
83.255 (* ---------^^^--- not quite perfect*)
83.256
83.257
83.258 @@ -577,7 +577,7 @@
83.259 moveActiveRoot 1;
83.260 autoCalculate 1 CompleteCalc;
83.261 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.262 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "2 * g + h"
83.263 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "2 * g + h"
83.264 then () else error "polyminus.sml: addiere_vor_minus";
83.265
83.266
83.267 @@ -590,7 +590,7 @@
83.268 moveActiveRoot 1;
83.269 autoCalculate 1 CompleteCalc;
83.270 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.271 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "f + 2 * g"
83.272 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "f + 2 * g"
83.273 then () else error "polyminus.sml: tausche_vor_plus";
83.274
83.275 "----------- pbl binom polynom vereinfachen p.39 -----------------";
83.276 @@ -599,31 +599,31 @@
83.277 val thy = @{theory};
83.278 val rls = klammern_ausmultiplizieren;
83.279 val t = ParseC.parse_test @{context} "(3 * a + 2) * (4 * a - 1::real)";
83.280 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.281 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.282 "3 * a * (4 * a) - 3 * a * 1 + (2 * (4 * a) - 2 * 1)";
83.283 val rls = discard_parentheses;
83.284 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.285 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.286 "3 * a * 4 * a - 3 * a * 1 + (2 * 4 * a - 2 * 1)";
83.287 val rls = ordne_monome;
83.288 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.289 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.290 "3 * 4 * a * a - 1 * 3 * a + (2 * 4 * a - 1 * 2)";
83.291 (*
83.292 val t = ParseC.parse_test @{context} "3 * a * 4 * a";
83.293 val rls = ordne_monome;
83.294 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.295 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.296 *)
83.297 val rls = klammern_aufloesen;
83.298 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.299 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.300 "3 * 4 * a * a - 1 * 3 * a + 2 * 4 * a - 1 * 2";
83.301 val rls = ordne_alphabetisch;
83.302 (*TODO: make is_monom more general, a*a=a^2, ...*)
83.303 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.304 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.305 "3 * 4 * a * a - 1 * 2 - 1 * 3 * a + 2 * 4 * a";
83.306 (*STOPPED.WN080104
83.307 val rls = fasse_zusammen;
83.308 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.309 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.310 val rls = verschoenere;
83.311 -val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term_in_ctxt @{context} t;
83.312 +val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term @{context} t;
83.313 *)
83.314
83.315 (*@@@@@@@*)
83.316 @@ -637,7 +637,7 @@
83.317 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.318
83.319 if p = ([], Res) andalso
83.320 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) =(*"- 2 + 12 * a \<up> 2 + 5 * a" with OLD numerals*)
83.321 + UnparseC.term @{context} (get_obj g_res pt (fst p)) =(*"- 2 + 12 * a \<up> 2 + 5 * a" with OLD numerals*)
83.322 "- 2 + 5 * a + 12 * a \<up> 2"
83.323 then () else error "polyminus.sml: Vereinfache (2*u - 5 - (3 - ...";
83.324
83.325 @@ -651,7 +651,7 @@
83.326 moveActiveRoot 1;
83.327 autoCalculate 1 CompleteCalc;
83.328 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
83.329 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) = "12 * a - 16 * q"
83.330 +if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) = "12 * a - 16 * q"
83.331 then () else error "pbl binom polynom vereinfachen: cube";
83.332
83.333 "----------- Refine.refine Vereinfache ----------------------------------";
83.334 @@ -695,7 +695,7 @@
83.335 \ matchsub ((?b - ?c) * ?a) (8 * (a - q) + a - 2 * q) )";
83.336 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
83.337 val SOME (t', _) = rewrite_set_ ctxt false where_rls t;
83.338 -if UnparseC.term_in_ctxt @{context} t' = "False" then ()
83.339 +if UnparseC.term @{context} t' = "False" then ()
83.340 else error "polyminus.sml Not (matchsub (?a * (?b + ?c)) (8 ...";
83.341
83.342 "----------- *** Problem.prep_input: syntax error in '#Where' of [v";
83.343 @@ -708,10 +708,10 @@
83.344 " matchsub (?a - (?b + ?c)) t_t | " ^
83.345 " matchsub (?a + (?b - ?c)) t_t )");
83.346 (*show_types := true;
83.347 -if UnparseC.term_in_ctxt @{context} t = "~ (matchsub ((?a::real) + ((?b::real) + (?c::real))) (t_t::real) |\n matchsub (?a + (?b - ?c)) t_t |\n matchsub (?a - (?b + ?c)) t_t | matchsub (?a + (?b - ?c)) t_t)"
83.348 +if UnparseC.term @{context} t = "~ (matchsub ((?a::real) + ((?b::real) + (?c::real))) (t_t::real) |\n matchsub (?a + (?b - ?c)) t_t |\n matchsub (?a - (?b + ?c)) t_t | matchsub (?a + (?b - ?c)) t_t)"
83.349 then () else error "polyminus.sml type-structure of \"?a :: real\" changed 1";
83.350 show_types := false;*)
83.351 -if UnparseC.term_in_ctxt @{context} t =
83.352 +if UnparseC.term @{context} t =
83.353 "\<not> (matchsub (?a + (?b + ?c)) t_t \<or>\n " ^
83.354 "matchsub (?a + (?b - ?c)) t_t \<or>\n " ^
83.355 "matchsub (?a - (?b + ?c)) t_t \<or> " ^
84.1 --- a/test/Tools/isac/Knowledge/rateq.sml Sat Feb 04 16:49:08 2023 +0100
84.2 +++ b/test/Tools/isac/Knowledge/rateq.sml Sat Feb 04 17:00:25 2023 +0100
84.3 @@ -22,22 +22,22 @@
84.4 "------------ pbl: rational, univariate, equation ----------------";
84.5 val t = ParseC.parse_test ctxt "(1/b+1/x=1) is_ratequation_in x";
84.6 val SOME (t_, _) = rewrite_set_ ctxt false RatEq_prls t;
84.7 -val result = UnparseC.term_in_ctxt @{context} t_;
84.8 +val result = UnparseC.term @{context} t_;
84.9 if result <> "True" then error "rateq.sml: new behaviour 1:" else ();
84.10
84.11 val t = ParseC.parse_test ctxt "(sqrt(x)=1) is_ratequation_in x";
84.12 val SOME (t_, _) = rewrite_set_ ctxt false RatEq_prls t;
84.13 -val result = UnparseC.term_in_ctxt @{context} t_;
84.14 +val result = UnparseC.term @{context} t_;
84.15 if result <> "False" then error "rateq.sml: new behaviour 2:" else ();
84.16
84.17 val t = ParseC.parse_test ctxt "(x=- 1) is_ratequation_in x";
84.18 val SOME (t_,_) = rewrite_set_ ctxt false RatEq_prls t;
84.19 -val result = UnparseC.term_in_ctxt @{context} t_;
84.20 +val result = UnparseC.term @{context} t_;
84.21 if result <> "False" then error "rateq.sml: new behaviour 3:" else ();
84.22
84.23 val t = ParseC.parse_test ctxt "(3 + x \<up> 2 + 1/(x \<up> 2+3)=1) is_ratequation_in x";
84.24 val SOME (t_,_) = rewrite_set_ ctxt false RatEq_prls t;
84.25 -val result = UnparseC.term_in_ctxt @{context} t_;
84.26 +val result = UnparseC.term @{context} t_;
84.27 if result <> "True" then error "rateq.sml: new behaviour 4:" else ();
84.28
84.29 val result = M_Match.match_pbl ["equality (x=(1::real))", "solveFor x", "solutions L"]
84.30 @@ -126,11 +126,11 @@
84.31 "~~~~~ fun eval_leaf, args:"; val (E, a, v,
84.32 (t as (Const (\<^const_name>\<open>Check_elementwise\<close>,_) $ _ $ _ ))) = (E, a, v, t);
84.33 val Program.Tac tm = Program.Tac (subst_atomic E t);
84.34 -UnparseC.term_in_ctxt @{context} tm = "Check_elementwise [x = 1 / 5] {v_v. Assumptions}";
84.35 +UnparseC.term @{context} tm = "Check_elementwise [x = 1 / 5] {v_v. Assumptions}";
84.36 (* ------ \<up> ----- ? "x" ?*)
84.37 "~~~~~ to check_leaf return val:"; val ((Program.Tac stac, a')) = ((Program.Tac (subst_atomic E t), NONE));
84.38 val stac' = eval_prog_expr (ThyC.get_theory thy) prog_rls (subst_atomic (upd_env_opt E (a,v)) stac);
84.39 -UnparseC.term_in_ctxt @{context} stac' = "Check_elementwise [x = 1 / 5] {v_v. Assumptions}";
84.40 +UnparseC.term @{context} stac' = "Check_elementwise [x = 1 / 5] {v_v. Assumptions}";
84.41 "~~~~~ to scan_dn return val:"; val ((a', Program.Tac stac)) = ((a', Program.Tac stac'));
84.42 val m = LItool.tac_from_prog pt (ThyC.get_theory th) stac;
84.43 case m of Check_elementwise "Assumptions" => () | _ => (); (*m' = Empty_Tac_ ???!??? *);
84.44 @@ -144,12 +144,12 @@
84.45 val {crls,...} = MethodC.from_store ctxt metID
84.46 val (f,asm) = case p_ of Frm => (get_obj g_form pt p , [])
84.47 | Res => get_obj g_result pt p;
84.48 -UnparseC.term_in_ctxt @{context} f = "[x = 1 / 5]"; (*the current formula*)
84.49 +UnparseC.term @{context} f = "[x = 1 / 5]"; (*the current formula*)
84.50 val vp = (Proof_Context.init_global thy, pred) |-> ParseC.term_opt |> the |> mk_set thy pt p f;
84.51 val (bdv, asms) = vp;
84.52
84.53 -UnparseC.term_in_ctxt @{context} bdv = "x";
84.54 -UnparseC.terms_in_ctxt @{context} asms = (* asms from rewriting are missing : vvv *)
84.55 +UnparseC.term @{context} bdv = "x";
84.56 +UnparseC.terms @{context} asms = (* asms from rewriting are missing : vvv *)
84.57 ("[\"~ (matches (?a = 0) (1 = 5 * x)) | ~ lhs (1 = 5 * x) is_poly_in x\",\"x = 1 / 5\", " ^
84.58 "\"lhs (1 + -5 * x = 0) is_poly_in x\",\"lhs (1 + -5 * x = 0) has_degree_in x = 1\", " ^
84.59 "\"1 / x = 5 is_ratequation_in x\"]");
84.60 @@ -158,7 +158,7 @@
84.61 *)
84.62
84.63 val Applicable.Yes (Check_elementwise' (curr_form, pred, (res, asms))) = check p''''' pt''''' m''''';
84.64 -UnparseC.term_in_ctxt @{context} curr_form = "[x = 1 / 5]";
84.65 +UnparseC.term @{context} curr_form = "[x = 1 / 5]";
84.66 pred = "Assumptions";
84.67 res = ParseC.parse_test @{context} "[]::bool list";
84.68 asms = [];
85.1 --- a/test/Tools/isac/Knowledge/rational-1.sml Sat Feb 04 16:49:08 2023 +0100
85.2 +++ b/test/Tools/isac/Knowledge/rational-1.sml Sat Feb 04 17:00:25 2023 +0100
85.3 @@ -88,10 +88,10 @@
85.4 "~~~~~ fun cancel_p_, args:"; val (t) = (t);
85.5 val opt = check_fraction t;
85.6 val SOME (numerator, denominator) = opt;
85.7 -(*+*)UnparseC.term_in_ctxt @{context} numerator = "- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)"; (*isa -- isa2*);
85.8 -(*+*)UnparseC.term_in_ctxt @{context} denominator = "- 18 + - 9 * x + 2 * y \<up> 2 + x * y \<up> 2"; (*isa -- isa2*);
85.9 +(*+*)UnparseC.term @{context} numerator = "- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)"; (*isa -- isa2*);
85.10 +(*+*)UnparseC.term @{context} denominator = "- 18 + - 9 * x + 2 * y \<up> 2 + x * y \<up> 2"; (*isa -- isa2*);
85.11 val vs = TermC.vars_of t;
85.12 -(*+*)UnparseC.terms_in_ctxt @{context} vs = "[\"x\", \"y\"]";
85.13 +(*+*)UnparseC.terms @{context} vs = "[\"x\", \"y\"]";
85.14 val baseT = type_of numerator
85.15 val expT = HOLogic.realT;
85.16 val (SOME _, SOME _) = (poly_of_term vs numerator, poly_of_term vs denominator); (*isa <> isa2*)
85.17 @@ -127,7 +127,7 @@
85.18 val vs = TermC.vars_of (the (ParseC.term_opt ctxt "12 * x \<up> 3 * y \<up> 4 * z \<up> 6"))
85.19 (*precondition for [(c, es),...]: legth es = length vs*)
85.20 ;
85.21 -if UnparseC.term_in_ctxt @{context} (term_of_poly baseT expT vs p) = "1 + 7 * y \<up> 8 + 2 * x \<up> 3 * y \<up> 4 * z \<up> 5"
85.22 +if UnparseC.term @{context} (term_of_poly baseT expT vs p) = "1 + 7 * y \<up> 8 + 2 * x \<up> 3 * y \<up> 4 * z \<up> 5"
85.23 then () else error "term_of_poly 1 changed";
85.24
85.25 "-------- fun cancel_p special cases -----------------------------------------------------------";
85.26 @@ -154,7 +154,7 @@
85.27 val nomin = term_of_poly baseT expT vs
85.28 (((the (poly_of_term vs n1)) %%*%% b') %%+%% ((the (poly_of_term vs n2)) %%*%% a'));
85.29
85.30 -(*+*)val "5" = UnparseC.term_in_ctxt @{context} nomin; (* = "3" ERROR*)
85.31 +(*+*)val "5" = UnparseC.term @{context} nomin; (* = "3" ERROR*)
85.32
85.33 (*+*)val [(2, [])] = the (poly_of_term vs n1); (*---v----------------------v----*)
85.34 (*+*)val [(4, [])] = ((the (poly_of_term vs n1)) %%*%% b'); (* = 2 * _2_ new nomin for 2 / 3*)
85.35 @@ -167,10 +167,10 @@
85.36
85.37 val denom = (* = 3 * 1 * 2 new denom for sum *)
85.38 term_of_poly baseT expT vs ((c %%*%% a') %%*%% b');
85.39 -(*+*)val "6" = UnparseC.term_in_ctxt @{context} denom;
85.40 +(*+*)val "6" = UnparseC.term @{context} denom;
85.41
85.42 val t' = HOLogic.mk_binop \<^const_name>\<open>divide\<close> (nomin, denom);
85.43 -(*+*)val "5 / 6" = UnparseC.term_in_ctxt @{context} t'
85.44 +(*+*)val "5 / 6" = UnparseC.term @{context} t'
85.45
85.46
85.47 (*------- 0 / m + 0 / n
85.48 @@ -193,7 +193,7 @@
85.49 ### rls: rat_mult_div_pow on: 0 = c_2 + 1 / EI * (3 / 24)
85.50 :
85.51 *)
85.52 -if UnparseC.term_in_ctxt @{context} t' = "0 = c_2" then () else error "norm_Rational CHANGED"; (*isa2*)
85.53 +if UnparseC.term @{context} t' = "0 = c_2" then () else error "norm_Rational CHANGED"; (*isa2*)
85.54
85.55 val t = ParseC.parse_test @{context} "0 / 12 + 0 / 24 ::real";
85.56 add_fraction_p_ @{theory} t;
85.57 @@ -221,7 +221,7 @@
85.58 val nomin = term_of_poly baseT expT vs
85.59 (((the (poly_of_term vs n1)) %%*%% b') %%+%% ((the (poly_of_term vs n2)) %%*%% a'));
85.60
85.61 -(*+*)UnparseC.term_in_ctxt @{context} nomin; (* = "3" ERROR*)
85.62 +(*+*)UnparseC.term @{context} nomin; (* = "3" ERROR*)
85.63 (* correct ERROR ------------------------------------------------------------------\\*)
85.64 (*+*)val SOME [(0, [])] = poly_of_term vs n1 (* ERROR WAS [(1, [])] *)
85.65 (* correct ERROR ------------------------------------------------------------------//*)
85.66 @@ -237,10 +237,10 @@
85.67
85.68 val denom = (* = 12 * 1 * 2 new denom for sum *)
85.69 term_of_poly baseT expT vs ((c %%*%% a') %%*%% b');
85.70 -(*+*)val "24" = UnparseC.term_in_ctxt @{context} denom;
85.71 +(*+*)val "24" = UnparseC.term @{context} denom;
85.72
85.73 val t' = HOLogic.mk_binop \<^const_name>\<open>divide\<close> (nomin, denom);
85.74 -(*+*)val "0 / 24" = UnparseC.term_in_ctxt @{context} t'
85.75 +(*+*)val "0 / 24" = UnparseC.term @{context} t'
85.76
85.77 (*---------- fun cancel_p with Const AA *)
85.78 val thy = @{theory Partial_Fractions};
85.79 @@ -257,7 +257,7 @@
85.80 val opt = check_fraction t
85.81 val SOME (numerator, denominator) = (*case*) opt (*of*);
85.82
85.83 -if UnparseC.term_in_ctxt @{context} numerator = "2 * AA" andalso UnparseC.term_in_ctxt @{context} denominator = "2"
85.84 +if UnparseC.term @{context} numerator = "2 * AA" andalso UnparseC.term @{context} denominator = "2"
85.85 then () else error "check_fraction (2 * AA / 2) changed";
85.86 val vs = TermC.vars_of t;
85.87 case vs of
85.88 @@ -269,17 +269,17 @@
85.89 "-------- complex examples: rls norm_Rational --------------------------------------------------";
85.90 "-------- complex examples: rls norm_Rational --------------------------------------------------";
85.91 val t = ParseC.parse_test @{context} "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
85.92 -val SOME (t', _) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
85.93 -if UnparseC.term_in_ctxt @{context} t' = "1 / 18 = 0" then () else error "rational.sml 1";
85.94 +val SOME (t', _) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
85.95 +if UnparseC.term @{context} t' = "1 / 18 = 0" then () else error "rational.sml 1";
85.96
85.97 val t = ParseC.parse_test @{context} "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
85.98 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
85.99 -if UnparseC.term_in_ctxt @{context} t' = "(237 + 65 * x) / 36 = 0" then ()
85.100 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
85.101 +if UnparseC.term @{context} t' = "(237 + 65 * x) / 36 = 0" then ()
85.102 else error "rational.sml 2";
85.103
85.104 val t = ParseC.parse_test @{context} "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 - (6*x) \<up> 2 + 29";
85.105 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
85.106 -if UnparseC.term_in_ctxt @{context} t' = "23 + 35 * x + - 72 * x \<up> 2" then ()
85.107 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
85.108 +if UnparseC.term @{context} t' = "23 + 35 * x + - 72 * x \<up> 2" then ()
85.109 else error "rational.sml 3";
85.110
85.111 "-------- complex examples cancellation from: Mathematik 1 Schalk ------------------------------";
85.112 @@ -288,19 +288,19 @@
85.113 (*Schalk I, p.60 Nr. 215c *)
85.114 val t = ParseC.parse_test @{context} "(a + b) \<up> 4 * (x - y) / ((x - y) \<up> 3 * (a + b) \<up> 2)";
85.115 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
85.116 -if UnparseC.term_in_ctxt @{context} t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
85.117 +if UnparseC.term @{context} t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
85.118 then () else error "rational.sml: diff.behav. in norm_Rational_mg 7";
85.119
85.120 (*SRC Schalk I, p.66 Nr. 381b *)
85.121 val t = ParseC.parse_test @{context}
85.122 "(4*x \<up> 2 - 20*x + 25)/(2*x - 5) \<up> 3";
85.123 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
85.124 -if UnparseC.term_in_ctxt @{context} t = "1 / (- 5 + 2 * x)"
85.125 +if UnparseC.term @{context} t = "1 / (- 5 + 2 * x)"
85.126 then () else error "rational.sml: diff.behav. in norm_Rational_mg 9";
85.127
85.128 (*Schalk I, p.60 Nr. 215c *)
85.129 val t = ParseC.parse_test @{context} "(a + b) \<up> 4 * (x - y) / ((x - y) \<up> 3 * (a + b) \<up> 2)";
85.130 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
85.131 -if UnparseC.term_in_ctxt @{context} t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
85.132 +if UnparseC.term @{context} t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
85.133 then () else error "Schalk I, p.60 Nr. 215c: with Isabelle2002 cancellation incomplete, changed";
85.134
86.1 --- a/test/Tools/isac/Knowledge/rational-2.sml Sat Feb 04 16:49:08 2023 +0100
86.2 +++ b/test/Tools/isac/Knowledge/rational-2.sml Sat Feb 04 17:00:25 2023 +0100
86.3 @@ -46,10 +46,10 @@
86.4 "-------- integration lev.1 fun factout_p_ -----------------------------------";
86.5 val t = ParseC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
86.6 val SOME (t', asm) = factout_p_ thy t;
86.7 -if UnparseC.term_in_ctxt @{context} t' = "(x + y) * (x + - 1 * y) / (x * (x + - 1 * y))"
86.8 -then () else error ("factout_p_ term 1 changed: " ^ UnparseC.term_in_ctxt @{context} t')
86.9 +if UnparseC.term @{context} t' = "(x + y) * (x + - 1 * y) / (x * (x + - 1 * y))"
86.10 +then () else error ("factout_p_ term 1 changed: " ^ UnparseC.term @{context} t')
86.11 ;
86.12 -if UnparseC.terms_in_ctxt @{context} asm = "[x \<noteq> 0, x + - 1 * y \<noteq> 0]"
86.13 +if UnparseC.terms @{context} asm = "[x \<noteq> 0, x + - 1 * y \<noteq> 0]"
86.14 then () else error "factout_p_ asm 1 changed"
86.15 ;
86.16 val t = ParseC.parse_test @{context} "nothing + to_cancel ::real";
86.17 @@ -57,8 +57,8 @@
86.18 ;
86.19 val t = ParseC.parse_test @{context} "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
86.20 val SOME (t', asm) = factout_p_ thy t;
86.21 -if UnparseC.term_in_ctxt @{context} t' = "(3 + 3 * x) * (1 + x) / (2 * (1 + x))" andalso
86.22 - UnparseC.terms_in_ctxt @{context} asm = "[1 + x \<noteq> 0]"
86.23 +if UnparseC.term @{context} t' = "(3 + 3 * x) * (1 + x) / (2 * (1 + x))" andalso
86.24 + UnparseC.terms @{context} asm = "[1 + x \<noteq> 0]"
86.25 then () else error "factout_p_ 1 changed";
86.26
86.27 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
86.28 @@ -66,15 +66,15 @@
86.29 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
86.30 val t = ParseC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
86.31 val SOME (t', asm) = cancel_p_ thy t;
86.32 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("(x + y) / x", "[x \<noteq> 0]")
86.33 -then () else error ("cancel_p_ (t', asm) 1 changed: " ^ UnparseC.term_in_ctxt @{context} t')
86.34 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("(x + y) / x", "[x \<noteq> 0]")
86.35 +then () else error ("cancel_p_ (t', asm) 1 changed: " ^ UnparseC.term @{context} t')
86.36 ;
86.37 val t = ParseC.parse_test @{context} "nothing + to_cancel ::real";
86.38 if NONE = cancel_p_ thy t then () else error "cancel_p_ doesn't report non-applicable";
86.39 ;
86.40 val t = ParseC.parse_test @{context} "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
86.41 val SOME (t', asm) = cancel_p_ thy t;
86.42 -if UnparseC.term_in_ctxt @{context} t' = "(3 + 3 * x) / 2" andalso UnparseC.terms_in_ctxt @{context} asm = "[]"
86.43 +if UnparseC.term @{context} t' = "(3 + 3 * x) / 2" andalso UnparseC.terms @{context} asm = "[]"
86.44 then () else error "cancel_p_ 1 changed";
86.45
86.46 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
86.47 @@ -85,23 +85,23 @@
86.48 "+ a / (x*y)");
86.49 (* n2 d2 *)
86.50 val SOME (t', asm) = common_nominator_p_ thy t;
86.51 -if UnparseC.term_in_ctxt @{context} t' =
86.52 +if UnparseC.term @{context} t' =
86.53 ("y * y / (x * ((a + b + c) * y)) " ^
86.54 (* n1 *d2'/ (c'* ( d1' *d2')) *)
86.55 "+ a * (a + b + c) / (x * ((a + b + c) * y))")
86.56 (* n2 * d1' / (c'* ( d1' *d2')) *)
86.57 then () else error "common_nominator_p_ term 1 changed";
86.58 -if UnparseC.terms_in_ctxt @{context} asm = "[a + b + c \<noteq> 0, y \<noteq> 0, x \<noteq> 0]"
86.59 +if UnparseC.terms @{context} asm = "[a + b + c \<noteq> 0, y \<noteq> 0, x \<noteq> 0]"
86.60 then () else error "common_nominator_p_ asm 1 changed"
86.61
86.62 "-------- example in mail Nipkow";
86.63 val t = ParseC.parse_test @{context} "x/(x \<up> 2 + - 1*y \<up> 2) + y/(x \<up> 2 + - 1*x*y)";
86.64 val SOME (t', asm) = common_nominator_p_ thy t;
86.65 -if UnparseC.term_in_ctxt @{context} t' =
86.66 +if UnparseC.term @{context} t' =
86.67 "x * x / ((x + - 1 * y) * ((x + y) * x)) +\ny * (x + y) / ((x + - 1 * y) * ((x + y) * x))"
86.68 then () else error "common_nominator_p_ term 2 changed"
86.69 ;
86.70 -if UnparseC.terms_in_ctxt @{context} asm = "[x + y \<noteq> 0, x \<noteq> 0, x + - 1 * y \<noteq> 0]"
86.71 +if UnparseC.terms @{context} asm = "[x + y \<noteq> 0, x \<noteq> 0, x + - 1 * y \<noteq> 0]"
86.72 then () else error "common_nominator_p_ asm 2 changed"
86.73
86.74 "-------- example: applicable tested by SML code";
86.75 @@ -110,9 +110,9 @@
86.76 ;
86.77 val t = ParseC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
86.78 val SOME (t', asm) = common_nominator_p_ thy t;
86.79 -if UnparseC.term_in_ctxt @{context} t' =
86.80 +if UnparseC.term @{context} t' =
86.81 "(x + - 1) * (- 1 + x) / ((1 + x) * (- 1 + x)) +\n(x + 1) * (1 + x) / ((1 + x) * (- 1 + x))"
86.82 - andalso UnparseC.terms_in_ctxt @{context} asm = "[1 + x \<noteq> 0, - 1 + x \<noteq> 0]"
86.83 + andalso UnparseC.terms @{context} asm = "[1 + x \<noteq> 0, - 1 + x \<noteq> 0]"
86.84 then () else error "common_nominator_p_ 3 changed";
86.85
86.86 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
86.87 @@ -120,10 +120,10 @@
86.88 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
86.89 val t = ParseC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
86.90 val SOME (t', asm) = add_fraction_p_ thy t;
86.91 -if UnparseC.term_in_ctxt @{context} t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)"
86.92 +if UnparseC.term @{context} t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)"
86.93 then () else error "add_fraction_p_ 3 changed";
86.94 ;
86.95 -if UnparseC.terms_in_ctxt @{context} asm = "[- 1 + x \<up> 2 \<noteq> 0]"
86.96 +if UnparseC.terms @{context} asm = "[- 1 + x \<up> 2 \<noteq> 0]"
86.97 then () else error "add_fraction_p_ 3 changed";
86.98 ;
86.99 val t = ParseC.parse_test @{context} "nothing / to_add";
86.100 @@ -131,8 +131,8 @@
86.101 ;
86.102 val t = ParseC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
86.103 val SOME (t', asm) = add_fraction_p_ thy t;
86.104 -if UnparseC.term_in_ctxt @{context} t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)" andalso
86.105 - UnparseC.terms_in_ctxt @{context} asm = "[- 1 + x \<up> 2 \<noteq> 0]"
86.106 +if UnparseC.term @{context} t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)" andalso
86.107 + UnparseC.terms @{context} asm = "[- 1 + x \<up> 2 \<noteq> 0]"
86.108 then () else error "add_fraction_p_ 3 changed";
86.109
86.110 "-------- and app_rev ...traced down from rewrite_set_ until prepats ---------";
86.111 @@ -167,7 +167,7 @@
86.112 (* apply the normal_form of a rev-set *)
86.113 fun app_rev' thy (Rrls{asm_rls,prepat,program=Rfuns{normal_form,...},...}) t =
86.114 if chk_prepat thy asm_rls prepat t
86.115 - then ((*tracing("### app_rev': t = "^UnparseC.term_in_ctxt @{context} t);*) normal_form t)
86.116 + then ((*tracing("### app_rev': t = "^UnparseC.term @{context} t);*) normal_form t)
86.117 else NONE;
86.118 (* val opt = app_rev' thy rrls t ..NONE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
86.119 "~~~~~ and app_rev', args:"; val (thy, (Rrls{asm_rls,prepat,program=Rfuns{normal_form,...},...}), t) =
86.120 @@ -191,9 +191,9 @@
86.121 "~~~~~ fun , args:"; val (f, (pp::pps)) = (chk, prepat);
86.122 f;
86.123 val ([t1, t2], t) = pp;
86.124 -UnparseC.term_in_ctxt @{context} t1 = "?r is_expanded";
86.125 -UnparseC.term_in_ctxt @{context} t2 = "?s is_expanded";
86.126 -UnparseC.term_in_ctxt @{context} t = "?r / ?s";
86.127 +UnparseC.term @{context} t1 = "?r is_expanded";
86.128 +UnparseC.term @{context} t2 = "?s is_expanded";
86.129 +UnparseC.term @{context} t = "?r / ?s";
86.130 (* f pp = false!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
86.131 "~~~~~ fun chk, args:"; val (pres, pat) = (pp);
86.132 val subst: Type.tyenv * Envir.tenv =
86.133 @@ -205,14 +205,14 @@
86.134 snd (eval__true thy (i + 1) (map (Envir.subst_term subst) pres) [] asm_rls)
86.135 "~~~~~ fun eval__true, args:"; val (thy, i, asms, bdv, rls) =
86.136 (thy, (i + 1), (map (Envir.subst_term subst) pres), [], asm_rls);
86.137 -UnparseC.terms_in_ctxt @{context} asms; (* = "[\"?r is_expanded\",\"?s is_expanded\"]"*)
86.138 +UnparseC.terms @{context} asms; (* = "[\"?r is_expanded\",\"?s is_expanded\"]"*)
86.139 asms = [@{term True}] orelse asms = []; (* = false*)
86.140 asms = [@{term False}] ; (* = false*)
86.141 "~~~~~ fun chk, args:"; val (indets, (a::asms)) = ([], asms);
86.142 bdv (*= []: _a list*);
86.143 val bdv : Subst.T = [];
86.144 rewrite__set_ thy (i+1) false;
86.145 -UnparseC.term_in_ctxt @{context} a = "?r is_expanded"; (*hier m"usste doch der Numerator eingesetzt sein ??????????????*)
86.146 +UnparseC.term @{context} a = "?r is_expanded"; (*hier m"usste doch der Numerator eingesetzt sein ??????????????*)
86.147 val SOME (Const (\<^const_name>\<open>False\<close>, _), []) = rewrite__set_ thy (i+1) false bdv rls a
86.148 ============ inhibit exn WN130823: prepat is empty ===================================*)
86.149
86.150 @@ -337,7 +337,7 @@
86.151 (* apply the normal_form of a rev-set *)
86.152 fun app_rev' thy (Rrls{asm_rls,prepat,program=Rfuns{normal_form,...},...}) t =
86.153 if chk_prepat thy asm_rls prepat t
86.154 - then ((*tracing("### app_rev': t = "^UnparseC.term_in_ctxt @{context} t);*) normal_form t)
86.155 + then ((*tracing("### app_rev': t = "^UnparseC.term @{context} t);*) normal_form t)
86.156 else NONE;
86.157 (* val opt = app_rev' thy rrls t;
86.158 exception Div raised*)
86.159 @@ -353,7 +353,7 @@
86.160 exception Div raised*)
86.161 "~~~~~ fun add_fraction_p_, args:"; val ((_: theory), t) = (thy, t);
86.162 val SOME ((n1, d1), (n2, d2)) = check_frac_sum t;
86.163 -UnparseC.term_in_ctxt @{context} n1; UnparseC.term_in_ctxt @{context} d1; UnparseC.term_in_ctxt @{context} n2; UnparseC.term_in_ctxt @{context} d2;
86.164 +UnparseC.term @{context} n1; UnparseC.term @{context} d1; UnparseC.term @{context} n2; UnparseC.term @{context} d2;
86.165 val vs = TermC.vars_of t;
86.166 (*default_print_depth 3; 999*)
86.167 val (SOME _, SOME a, SOME _, SOME b) =
86.168 @@ -393,8 +393,8 @@
86.169 "A / 4 + (B / 2 + - 1 * B / (2::real))";
86.170 "~~~~~ fun add_fraction_p_ , ad-hoc args:"; val (t) = (t);
86.171 val SOME ((n1, d1), (n2, d2)) = (*case*) check_frac_sum t (*of*);
86.172 -(*+*)if (UnparseC.term_in_ctxt @{context} n1, UnparseC.term_in_ctxt @{context} d1) = ("A" , "4") andalso
86.173 -(*+*) (UnparseC.term_in_ctxt @{context} n2, UnparseC.term_in_ctxt @{context} d2) = ("B / 2 + - 1 * B / 2", "1")
86.174 +(*+*)if (UnparseC.term @{context} n1, UnparseC.term @{context} d1) = ("A" , "4") andalso
86.175 +(*+*) (UnparseC.term @{context} n2, UnparseC.term @{context} d2) = ("B / 2 + - 1 * B / 2", "1")
86.176 (*+*)then () else error "check_frac_sum (A / 4 + (B / 2 + - 1 * B / (2::real))) changed";
86.177
86.178 val vs = TermC.vars_of t;
86.179 @@ -433,8 +433,8 @@
86.180 "AA / 4 + (BB / 2 + - 1 * BB / 2)";
86.181 "~~~~~ fun add_fraction_p_ , ad-hoc args:"; val (t) = (t);
86.182 val SOME ((n1, d1), (n2, d2)) = (*case*) check_frac_sum t (*of*);
86.183 -(*+*)if (UnparseC.term_in_ctxt @{context} n1, UnparseC.term_in_ctxt @{context} d1) = ("AA" , "4") andalso
86.184 -(*+*) (UnparseC.term_in_ctxt @{context} n2, UnparseC.term_in_ctxt @{context} d2) = ("BB / 2 + - 1 * BB / 2", "1")
86.185 +(*+*)if (UnparseC.term @{context} n1, UnparseC.term @{context} d1) = ("AA" , "4") andalso
86.186 +(*+*) (UnparseC.term @{context} n2, UnparseC.term @{context} d2) = ("BB / 2 + - 1 * BB / 2", "1")
86.187 (*+*)then () else error "check_frac_sum (AA / 4 + (BB / 2 + - 1 * BB / 2)) changed";
86.188
86.189 val vs = TermC.vars_of t;
86.190 @@ -465,19 +465,19 @@
86.191 is_expanded (ParseC.parse_test @{context} "14 * x * y");
86.192 is_expanded (ParseC.parse_test @{context} "x * y");
86.193 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.194 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("14 / 1", "[]")
86.195 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("14 / 1", "[]")
86.196 then () else error "rational.sml cancel Schalk 186a";
86.197
86.198 "-------- example 186b";
86.199 val t = ParseC.parse_test @{context} "(60 * a * b) / ( 15 * a * b )";
86.200 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.201 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("4 / 1", "[]")
86.202 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("4 / 1", "[]")
86.203 then () else error "rational.sml cancel Schalk 186b";
86.204
86.205 "-------- example 186c";
86.206 val t = ParseC.parse_test @{context} "(144 * a \<up> 2 * b * c) / (12 * a * b * c)";
86.207 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.208 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("12 * a / 1", "[]")
86.209 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("12 * a / 1", "[]")
86.210 then () else error "rational.sml cancel Schalk 186c";
86.211
86.212 (* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! exception Div raised !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
86.213 @@ -485,7 +485,7 @@
86.214 "-------- example 187a";
86.215 val t = ParseC.parse_test @{context} "(12 * x * y) / (8 * y \<up> 2 )";
86.216 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.217 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("3 * x / (2 * y)", "[\"4 * y ~= 0\"]")
86.218 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("3 * x / (2 * y)", "[\"4 * y ~= 0\"]")
86.219 then () else error "rational.sml cancel Schalk 187a";
86.220 *)
86.221
86.222 @@ -494,7 +494,7 @@
86.223 "-------- example 187b";
86.224 val t = ParseC.parse_test @{context} "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
86.225 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.226 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("4 * x / (9 * y)", "[\"2 * (z * (y * x)) ~= 0\"]")
86.227 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("4 * x / (9 * y)", "[\"2 * (z * (y * x)) ~= 0\"]")
86.228 then () else error "rational.sml cancel Schalk 187b";
86.229 *)
86.230
86.231 @@ -503,7 +503,7 @@
86.232 "-------- example 187c";
86.233 val t = ParseC.parse_test @{context} "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
86.234 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.235 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.236 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.237 ("3 * z \<up> 3 / (5 * (y * x))", "[\"3 * (z * (y \<up> 2 * x \<up> 5)) ~= 0\"]")
86.238 then () else error "rational.sml cancel Schalk 187c";
86.239 *)
86.240 @@ -512,43 +512,43 @@
86.241 val t = ParseC.parse_test @{context} "(-8 + 8 * x) / (-9 + 9 * x)";
86.242 is_expanded (ParseC.parse_test @{context} "8 * x + -8");
86.243 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.244 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("8 / 9", "[]")
86.245 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("8 / 9", "[]")
86.246 then () else error "rational.sml cancel Schalk 188a";
86.247
86.248 val t = ParseC.parse_test @{context} "(8*((- 1) + x))/(9*((- 1) + x))";
86.249 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
86.250 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("8 / 9", "[]")
86.251 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("8 / 9", "[]")
86.252 then () else error "rational.sml cancel Schalk make_polynomial 1";
86.253
86.254 "-------- example 188b";
86.255 val t = ParseC.parse_test @{context} "(- 15 + 5 * x) / (- 18 + 6 * x)";
86.256 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.257 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("5 / 6", "[]")
86.258 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("5 / 6", "[]")
86.259 then () else error "rational.sml cancel Schalk 188b";
86.260
86.261 "-------- example 188c";
86.262 val t = ParseC.parse_test @{context} "(a + - 1 * b) / (b + - 1 * a)";
86.263 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.264 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("- 1 / 1", "[]")
86.265 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("- 1 / 1", "[]")
86.266 then () else error "rational.sml cancel Schalk 188c";
86.267
86.268 is_expanded (ParseC.parse_test @{context} "a + - 1 * b") = true;
86.269 val t = ParseC.parse_test @{context} "((- 1)*(b + (- 1) * a))/(1*(b + (- 1) * a))";
86.270 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
86.271 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("(a + - 1 * b) / (- 1 * a + b)", "[]")
86.272 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("(a + - 1 * b) / (- 1 * a + b)", "[]")
86.273 then () else error "rational.sml cancel Schalk make_polynomial 2";
86.274
86.275 "-------- example 190a";
86.276 val t = ParseC.parse_test @{context} "( 27 * a \<up> 3 + 9 * a \<up> 2 + 3 * a + 1 ) / ( 27 * a \<up> 3 + 18 * a \<up> 2 + 3 * a )";
86.277 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.278 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.279 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.280 ("(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)", "[3 * a + 9 * a \<up> 2 \<noteq> 0]")
86.281 then () else error "rational.sml cancel Schalk 190a";
86.282
86.283 "-------- example 190c";
86.284 val t = ParseC.parse_test @{context} "((1 + 9 * a \<up> 2)*(1 + 3 * a))/((3 * a + 9 * a \<up> 2)*(1 + 3 * a))";
86.285 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
86.286 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.287 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.288 ("(1 + 3 * a + 9 * a \<up> 2 + 27 * a \<up> 3) /\n(3 * a + 18 * a \<up> 2 + 27 * a \<up> 3)", "[]")
86.289 then () else error "rational.sml make_polynomial Schalk 190c";
86.290
86.291 @@ -557,13 +557,13 @@
86.292 is_expanded (ParseC.parse_test @{context} "x \<up> 2 + - 1 * y \<up> 2") = false; (*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
86.293 is_expanded (ParseC.parse_test @{context} "x + y") = true;
86.294 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.295 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("(x + - 1 * y) / 1", "[]")
86.296 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("(x + - 1 * y) / 1", "[]")
86.297 then () else error "rational.sml make_polynomial Schalk 191a";
86.298
86.299 "-------- example 191b";
86.300 val t = ParseC.parse_test @{context} "((x + (- 1) * y)*(x + y))/((1)*(x + y))";
86.301 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
86.302 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("(x \<up> 2 + - 1 * y \<up> 2) / (x + y)", "[]")
86.303 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("(x \<up> 2 + - 1 * y \<up> 2) / (x + y)", "[]")
86.304 then () else error "rational.sml make_polynomial Schalk 191b";
86.305
86.306 "-------- example 191c";
86.307 @@ -574,51 +574,51 @@
86.308
86.309 val t = ParseC.parse_test @{context} "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
86.310 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
86.311 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.312 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.313 ("(25 + - 30 * x + 9 * x \<up> 2) / (- 25 + 9 * x \<up> 2)", "[]")
86.314 then () else error "rational.sml make_polynomial Schalk 191c";
86.315
86.316 "-------- example 192b";
86.317 val t = ParseC.parse_test @{context} "( 7 * x \<up> 3 + - 1 * x \<up> 2 * y ) / ( 7 * x * y \<up> 2 + - 1 * y \<up> 3 )";
86.318 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.319 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("x \<up> 2 / y \<up> 2", "[y \<up> 2 \<noteq> 0]")
86.320 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("x \<up> 2 / y \<up> 2", "[y \<up> 2 \<noteq> 0]")
86.321 then () else error "rational.sml cancel_p Schalk 192b";
86.322
86.323 val t = ParseC.parse_test @{context} "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
86.324 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
86.325 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.326 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.327 ("(7 * x \<up> 3 + - 1 * x \<up> 2 * y) /\n(7 * x * y \<up> 2 + - 1 * y \<up> 3)", "[]")
86.328 then () else error "rational.sml make_polynomial Schalk 192b";
86.329
86.330 val t = ParseC.parse_test @{context} "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
86.331 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
86.332 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.333 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.334 ("(7 * x \<up> 3 + - 1 * x \<up> 2 * y) /\n(7 * x * y \<up> 2 + - 1 * y \<up> 3)", "[]")
86.335 then () else error "rational.sml make_polynomial Schalk WN050929 not working";
86.336
86.337 "-------- example 193a";
86.338 val t = ParseC.parse_test @{context} "( x \<up> 2 + -6 * x + 9 ) / ( x \<up> 2 + -9 )";
86.339 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.340 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("(- 3 + x) / (3 + x)", "[3 + x \<noteq> 0]")
86.341 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("(- 3 + x) / (3 + x)", "[3 + x \<noteq> 0]")
86.342 then () else error "rational.sml cancel_p Schalk 193a";
86.343
86.344 "-------- example 193b";
86.345 val t = ParseC.parse_test @{context} "( x \<up> 2 + -8 * x + 16 ) / ( 2 * x \<up> 2 + -32 )";
86.346 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.347 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) = ("(- 4 + x) / (8 + 2 * x)", "[8 + 2 * x \<noteq> 0]")
86.348 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) = ("(- 4 + x) / (8 + 2 * x)", "[8 + 2 * x \<noteq> 0]")
86.349 then () else error "rational.sml cancel_p Schalk 193b";
86.350
86.351 "-------- example 193c";
86.352 val t = ParseC.parse_test @{context} "( 2 * x + -50 * x \<up> 3 ) / ( 25 * x \<up> 2 + - 10 * x + 1 )";
86.353 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.354 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.355 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.356 ("(2 * x + 10 * x \<up> 2) / (1 + - 5 * x)", "[1 + - 5 * x \<noteq> 0]")
86.357 then () else error "rational.sml cancel_p Schalk 193c";
86.358
86.359 (*WN: improved with new numerals*)
86.360 val t = ParseC.parse_test @{context} "(- 25 + 9*x \<up> 2)/(5 + 3*x)";
86.361 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.362 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.363 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.364 ("(- 5 + 3 * x) / 1", "[]")
86.365 then () else error "rational.sml cancel WN 1";
86.366
86.367 @@ -626,7 +626,7 @@
86.368 val t = ParseC.parse_test @{context} ("(x \<up> 4 + x * y + x \<up> 3 * y + y \<up> 2) / " ^
86.369 "(x + 5 * x \<up> 2 + y + 5 * x * y + x \<up> 2 * y \<up> 3 + x * y \<up> 4)");
86.370 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.371 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.372 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.373 ("(x \<up> 3 + y) / (1 + 5 * x + x * y \<up> 3)", "[1 + 5 * x + x * y \<up> 3 \<noteq> 0]")
86.374 then () else error "rational.sml cancel_p heuberger";
86.375
86.376 @@ -645,18 +645,18 @@
86.377
86.378 "-------- gcd_poly integration level 2: picks out ONE appropriate subterm";
86.379 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
86.380 -if UnparseC.term_in_ctxt @{context} t' = "123 = a * x / (b * x) + c * x / (d * x) + e / f"
86.381 +if UnparseC.term @{context} t' = "123 = a * x / (b * x) + c * x / (d * x) + e / f"
86.382 then () else error "level 2, rewrite_set_ cancel_p: changed";
86.383 val SOME (t', asm) = rewrite_set_ ctxt false add_fractions_p t;
86.384 -if UnparseC.term_in_ctxt @{context} t' = "123 = (b * c * x + a * d * x) / (b * d * x) + e * x / (f * x)"
86.385 +if UnparseC.term @{context} t' = "123 = (b * c * x + a * d * x) / (b * d * x) + e * x / (f * x)"
86.386 then () else error "level 2, rewrite_set_ add_fractions_p: changed";
86.387
86.388 "-------- gcd_poly integration level 3: rewrites all appropriate subterms";
86.389 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p_rls t;
86.390 -if UnparseC.term_in_ctxt @{context} t' = "123 = a / b + c / d + e / f"
86.391 +if UnparseC.term @{context} t' = "123 = a / b + c / d + e / f"
86.392 then () else error "level 3, rewrite_set_ cancel_p_rls: changed";
86.393 val SOME (t', asm) = rewrite_set_ ctxt false add_fractions_p_rls t; (*CREATE add_fractions_p_rls*)
86.394 -if UnparseC.term_in_ctxt @{context} t' = "123 = (b * d * e * x + b * c * f * x + a * d * f * x) / (b * d * f * x)"
86.395 +if UnparseC.term @{context} t' = "123 = (b * d * e * x + b * c * f * x + a * d * f * x) / (b * d * f * x)"
86.396 then () else error "level 3, rewrite_set_ add_fractions_p_rls: changed";
86.397
86.398 "-------- gcd_poly integration level 4: iteration cancel_p -- add_fraction_p";
86.399 @@ -671,7 +671,7 @@
86.400 ## rls: add_fractions_p on: 123 = (b * c + a * d) / (b * d) + e / f
86.401 ## rls: cancel_p on: 123 = (b * d * e + b * c * f + a * d * f) / (b * d * f)
86.402 ## rls: add_fractions_p on: 123 = (b * d * e + b * c * f + a * d * f) / (b * d * f) *)
86.403 -if UnparseC.term_in_ctxt @{context} t' = "123 = (b * d * e + b * c * f + a * d * f) / (b * d * f)"
86.404 +if UnparseC.term @{context} t' = "123 = (b * d * e + b * c * f + a * d * f) / (b * d * f)"
86.405 then () else error "level 4, rewrite_set_ *_p: changed";
86.406
86.407 (* complicated variant *)
86.408 @@ -691,12 +691,12 @@
86.409 ### rls: cancel_p on: 123 = (b * d * e + b * c * f + a * d * f) / (b * d * f)
86.410 ## rls: add_fractions_p_rls on: 123 = (b * d * e + b * c * f + a * d * f) / (b * d * f)
86.411 ### rls: add_fractions_p on: 123 = (b * d * e + b * c * f + a * d * f) / (b * d * f) *)
86.412 -if UnparseC.term_in_ctxt @{context} t' = "123 = (b * d * e + b * c * f + a * d * f) / (b * d * f)"
86.413 +if UnparseC.term @{context} t' = "123 = (b * d * e + b * c * f + a * d * f) / (b * d * f)"
86.414 then () else error "level 4, rewrite_set_ *_p_rls: changed"
86.415
86.416 "-------- gcd_poly integration level 5: cancel_p & add_fraction_p within norm_Rational";
86.417 val SOME (t', asm) = rewrite_set_ ctxt false norm_Rational t;
86.418 -if UnparseC.term_in_ctxt @{context} t' = "123 = (a * d * f + b * c * f + b * d * e) / (b * d * f)"
86.419 +if UnparseC.term @{context} t' = "123 = (a * d * f + b * c * f + b * d * e) / (b * d * f)"
86.420 then () else error "level 5, rewrite_set_ norm_Rational: changed"
86.421
86.422 "-------- reverse rewrite ----------------------------------------------------";
86.423 @@ -709,7 +709,7 @@
86.424
86.425 (** normal_form produces the result in ONE step **)
86.426 val SOME (t', _) = nor t;
86.427 -if UnparseC.term_in_ctxt @{context} t' = "(3 + - 1 * x) / (3 + x)" then ()
86.428 +if UnparseC.term @{context} t' = "(3 + - 1 * x) / (3 + x)" then ()
86.429 else error "rational.sml normal_form (9 - x \<up> 2) / (9 - 6 * x + x \<up> 2)";
86.430
86.431 (** initialize the interpreter state used by the 'me' **)
86.432 @@ -764,7 +764,7 @@
86.433 we don't repair this, because interaction within "reverse rewriting" never worked properly:
86.434
86.435 val (r, (t, asm))::_ = loc revsets t r;
86.436 -if UnparseC.term_in_ctxt @{context} t = "(9 - x \<up> 2) / (3 \<up> 2 + 6 * x + x \<up> 2)" andalso asm = []
86.437 +if UnparseC.term @{context} t = "(9 - x \<up> 2) / (3 \<up> 2 + 6 * x + x \<up> 2)" andalso asm = []
86.438 then () else error "rational.sml locate_rule (9 - x \<up> 2) / (9 - 6 * x + x \<up> 2)";
86.439
86.440 (* find the next rule to apply *)
86.441 @@ -776,29 +776,29 @@
86.442
86.443 (*check the next rule*)
86.444 val (r, (t, asm)) :: _ = loc revsets t r;
86.445 -if UnparseC.term_in_ctxt @{context} t = "(3 \<up> 2 - x \<up> 2) / (3 \<up> 2 + 6 * x + x \<up> 2)" then ()
86.446 +if UnparseC.term @{context} t = "(3 \<up> 2 - x \<up> 2) / (3 \<up> 2 + 6 * x + x \<up> 2)" then ()
86.447 else error "rational.sml locate_rule (9 - x \<up> 2) / (9 - 6 * x + x \<up> 2) II";
86.448
86.449 (*find and check the next rules, rewrite*)
86.450 val SOME r = nex revsets t;
86.451 val (r,(t,asm))::_ = loc revsets t r;
86.452 -if UnparseC.term_in_ctxt @{context} t = "(3 \<up> 2 - x \<up> 2) / (3 \<up> 2 + 2 * 3 * x + x \<up> 2)" then ()
86.453 +if UnparseC.term @{context} t = "(3 \<up> 2 - x \<up> 2) / (3 \<up> 2 + 2 * 3 * x + x \<up> 2)" then ()
86.454 else error "rational.sml locate_rule II";
86.455
86.456 val SOME r = nex revsets t;
86.457 val (r,(t,asm))::_ = loc revsets t r;
86.458 -if UnparseC.term_in_ctxt @{context} t = "(3 - x) * (3 + x) / (3 \<up> 2 + 2 * 3 * x + x \<up> 2)" then ()
86.459 +if UnparseC.term @{context} t = "(3 - x) * (3 + x) / (3 \<up> 2 + 2 * 3 * x + x \<up> 2)" then ()
86.460 else error "rational.sml next_rule II";
86.461
86.462 val SOME r = nex revsets t;
86.463 val (r,(t,asm))::_ = loc revsets t r;
86.464 -if UnparseC.term_in_ctxt @{context} t = "(3 - x) * (3 + x) / ((3 + x) * (3 + x))" then ()
86.465 +if UnparseC.term @{context} t = "(3 - x) * (3 + x) / ((3 + x) * (3 + x))" then ()
86.466 else error "rational.sml next_rule III";
86.467
86.468 val SOME r = nex revsets t;
86.469 val (r, (t, asm)) :: _ = loc revsets t r;
86.470 - val ss = UnparseC.term_in_ctxt @{context} t;
86.471 -if ss = "(3 - x) / (3 + x)" andalso UnparseC.terms_in_ctxt @{context} asm = "[\"3 + x ~= 0\"]" then ()
86.472 + val ss = UnparseC.term @{context} t;
86.473 +if ss = "(3 - x) / (3 + x)" andalso UnparseC.terms @{context} asm = "[\"3 + x ~= 0\"]" then ()
86.474 else error "rational.sml: new behav. in rev-set cancel";
86.475 \--------------------------------------------------------------------------------------/*)
86.476
86.477 @@ -815,12 +815,12 @@
86.478
86.479 (*normal_form produces the result in ONE step*)
86.480 val SOME (t', _) = nor t;
86.481 -if UnparseC.term_in_ctxt @{context} t' = "(3 + x) / (3 + - 1 * x)"
86.482 +if UnparseC.term @{context} t' = "(3 + x) / (3 + - 1 * x)"
86.483 then () else error "cancel_p normal_form CHANGED";;
86.484
86.485 (*initialize the interpreter state used by the 'me'*)
86.486 val SOME (t', asm) = cancel_p_ thy t;
86.487 -if (UnparseC.term_in_ctxt @{context} t', UnparseC.terms_in_ctxt @{context} asm) =
86.488 +if (UnparseC.term @{context} t', UnparseC.terms @{context} asm) =
86.489 ("(3 + x) / (3 + - 1 * x)", "[3 + - 1 * x \<noteq> 0]")
86.490 then () else error "cancel_p CHANGED";;
86.491
86.492 @@ -839,58 +839,58 @@
86.493 ( *WN060831 *** id_of_thm
86.494 Exception- ERROR raised ...
86.495 val (r,(t,asm))::_ = loc revsets t r;
86.496 -UnparseC.term_in_ctxt @{context} t;
86.497 +UnparseC.term @{context} t;
86.498
86.499 val SOME r = nex revsets t;
86.500 val (r,(t,asm))::_ = loc revsets t r;
86.501 - UnparseC.term_in_ctxt @{context} t;
86.502 + UnparseC.term @{context} t;
86.503 *)
86.504
86.505 "-------- examples: rls norm_Rational ----------------------------------------";
86.506 "-------- examples: rls norm_Rational ----------------------------------------";
86.507 "-------- examples: rls norm_Rational ----------------------------------------";
86.508 val t = ParseC.parse_test @{context} "Not (6*x is_atom)";
86.509 -val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term_in_ctxt @{context} t';
86.510 +val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term @{context} t';
86.511 "HOL.True";
86.512 val t = ParseC.parse_test @{context} "1 < 2";
86.513 -val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term_in_ctxt @{context} t';
86.514 +val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term @{context} t';
86.515 "HOL.True";
86.516
86.517 val t = ParseC.parse_test @{context} "(6*x) \<up> 2";
86.518 val SOME (t',_) = rewrite_ ctxt Rewrite_Ord.function_empty powers_erls false @{thm realpow_def_atom} t;
86.519 -if UnparseC.term_in_ctxt @{context} t' = "6 * x * (6 * x) \<up> (2 + - 1)" then ()
86.520 +if UnparseC.term @{context} t' = "6 * x * (6 * x) \<up> (2 + - 1)" then ()
86.521 else error "rational.sml powers_erls (6*x) \<up> 2";
86.522
86.523 val t = ParseC.parse_test @{context} "- 1 * (- 2 * (5 / 2 * (13 * x / 2)))";
86.524 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
86.525 -if UnparseC.term_in_ctxt @{context} t' = "65 * x / 2" then () else error "rational.sml 4";
86.526 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
86.527 +if UnparseC.term @{context} t' = "65 * x / 2" then () else error "rational.sml 4";
86.528
86.529 val t = ParseC.parse_test @{context} "1 - ((13*x)/2 - 5/2) \<up> 2";
86.530 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
86.531 -if UnparseC.term_in_ctxt @{context} t' = "(- 21 + 130 * x + - 169 * x \<up> 2) / 4" then ()
86.532 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
86.533 +if UnparseC.term @{context} t' = "(- 21 + 130 * x + - 169 * x \<up> 2) / 4" then ()
86.534 else error "rational.sml 5";
86.535
86.536 (*SRAM Schalk I, p.92 Nr. 609a*)
86.537 val t = ParseC.parse_test @{context} "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
86.538 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
86.539 -if UnparseC.term_in_ctxt @{context} t' = "(- 255 + 112 * x) / 135" then ()
86.540 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
86.541 +if UnparseC.term @{context} t' = "(- 255 + 112 * x) / 135" then ()
86.542 else error "rational.sml 6";
86.543
86.544 (*SRAM Schalk I, p.92 Nr. 610c*)
86.545 val t = ParseC.parse_test @{context} "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
86.546 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
86.547 -if UnparseC.term_in_ctxt @{context} t' = "(3 + x) / - 2" then () else error "rational.sml 7";
86.548 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
86.549 +if UnparseC.term @{context} t' = "(3 + x) / - 2" then () else error "rational.sml 7";
86.550
86.551 (*SRAM Schalk I, p.92 Nr. 476a*)
86.552 val t = ParseC.parse_test @{context} "(x \<up> 2/(1 - x \<up> 2) + 1)/(x/(1 - x) + 1) * (1 + x)";
86.553 (*. a/b : c/d translated to a/b * d/c .*)
86.554 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
86.555 -if UnparseC.term_in_ctxt @{context} t' = "1" then () else error "rational.sml 8";
86.556 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
86.557 +if UnparseC.term @{context} t' = "1" then () else error "rational.sml 8";
86.558
86.559 (*Schalk I, p.92 Nr. 472a*)
86.560 val t = ParseC.parse_test @{context} "((8*x \<up> 2 - 32*y \<up> 2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
86.561 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
86.562 -if UnparseC.term_in_ctxt @{context} t' = "x + y" then () else error "rational.sml p.92 Nr. 472a";
86.563 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
86.564 +if UnparseC.term @{context} t' = "x + y" then () else error "rational.sml p.92 Nr. 472a";
86.565
86.566 (*Schalk I, p.70 Nr. 480b: SEE rational.sml --- nonterminating rls norm_Rational ---*)
86.567
86.568 @@ -912,13 +912,13 @@
86.569 (*SRA Schalk I, p.40 Nr. 164b *)
86.570 val t = ParseC.parse_test @{context} "(47/6 - 76/9 + 13/4)/(35/12)";
86.571 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.572 -if UnparseC.term_in_ctxt @{context} t = "19 / 21" then ()
86.573 +if UnparseC.term @{context} t = "19 / 21" then ()
86.574 else error "rational.sml: diff.behav. in norm_Rational_mg 1";
86.575
86.576 (*SRA Schalk I, p.40 Nr. 166a *)
86.577 val t = ParseC.parse_test @{context} "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
86.578 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.579 -if UnparseC.term_in_ctxt @{context} t = "45 / 2" then ()
86.580 +if UnparseC.term @{context} t = "45 / 2" then ()
86.581 else error "rational.sml: diff.behav. in norm_Rational_mg 2";
86.582
86.583 "-------- examples cancellation from: Mathematik 1 Schalk --------------------";
86.584 @@ -927,49 +927,49 @@
86.585 (* e190c Stefan K.*)
86.586 val t = ParseC.parse_test @{context} "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3*a))";
86.587 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.588 -if UnparseC.term_in_ctxt @{context} t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
86.589 +if UnparseC.term @{context} t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
86.590 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
86.591
86.592 (* e192b Stefan K.*)
86.593 val t = ParseC.parse_test @{context} "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
86.594 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.595 -if UnparseC.term_in_ctxt @{context} t = "x \<up> 2 / y \<up> 2"
86.596 +if UnparseC.term @{context} t = "x \<up> 2 / y \<up> 2"
86.597 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
86.598
86.599 (*SRC Schalk I, p.66 Nr. 379c *)
86.600 val t = ParseC.parse_test @{context} "(a - b)/(b - a)";
86.601 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.602 -if UnparseC.term_in_ctxt @{context} t = "- 1"
86.603 +if UnparseC.term @{context} t = "- 1"
86.604 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
86.605
86.606 (*SRC Schalk I, p.66 Nr. 380b *)
86.607 val t = ParseC.parse_test @{context} "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
86.608 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.609 -if UnparseC.term_in_ctxt @{context} t = "(27 + 12 * x) / (28 + 8 * x)"
86.610 +if UnparseC.term @{context} t = "(27 + 12 * x) / (28 + 8 * x)"
86.611 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
86.612
86.613 (* e190c Stefan K.*)
86.614 val t = ParseC.parse_test @{context} "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3 * a))";
86.615 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.616 -if UnparseC.term_in_ctxt @{context} t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
86.617 +if UnparseC.term @{context} t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
86.618 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
86.619
86.620 (* e192b Stefan K.*)
86.621 val t = ParseC.parse_test @{context} "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
86.622 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.623 -if UnparseC.term_in_ctxt @{context} t = "x \<up> 2 / y \<up> 2"
86.624 +if UnparseC.term @{context} t = "x \<up> 2 / y \<up> 2"
86.625 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
86.626
86.627 (*SRC Schalk I, p.66 Nr. 379c *)
86.628 val t = ParseC.parse_test @{context} "(a - b) / (b - a)";
86.629 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.630 -if UnparseC.term_in_ctxt @{context} t = "- 1"
86.631 +if UnparseC.term @{context} t = "- 1"
86.632 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
86.633
86.634 (*SRC Schalk I, p.66 Nr. 380b *)
86.635 val t = ParseC.parse_test @{context} "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
86.636 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.637 -if UnparseC.term_in_ctxt @{context} t = "(27 + 12 * x) / (28 + 8 * x)"
86.638 +if UnparseC.term @{context} t = "(27 + 12 * x) / (28 + 8 * x)"
86.639 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
86.640
86.641 (* extreme example from somewhere *)
86.642 @@ -981,32 +981,32 @@
86.643 "2*a * b * x \<up> 3 + -6*a * b * x \<up> 2 * y + 6*a * b * x * y \<up> 2 + - 2*a * b * y \<up> 3 + " ^
86.644 "b \<up> 2 * x \<up> 3 + -3*b \<up> 2 * x \<up> 2 * y + 3*b \<up> 2 * x * y \<up> 2 + - 1*b \<up> 2 * y \<up> 3)")
86.645 val SOME (t, _) = rewrite_set_ ctxt false cancel_p t;
86.646 -if UnparseC.term_in_ctxt @{context} t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
86.647 +if UnparseC.term @{context} t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
86.648 then () else error "with Isabelle2002: NONE -- now SOME changed";
86.649
86.650 (*Schalk I, p.66 Nr. 381a *)
86.651 (* ATTENTION: here the rls is very slow. In Isabelle2002 this required 2 min *)
86.652 val t = ParseC.parse_test @{context} "18*(a + b) \<up> 3 * (a - b) \<up> 2 / (72*(a - b) \<up> 3 * (a + b) \<up> 2)";
86.653 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.654 -if UnparseC.term_in_ctxt @{context} t = "(a + b) / (4 * a + - 4 * b)"
86.655 +if UnparseC.term @{context} t = "(a + b) / (4 * a + - 4 * b)"
86.656 then () else error "rational.sml: diff.behav. in norm_Rational_mg 8";
86.657
86.658 (*SRC Schalk I, p.66 Nr. 381b *)
86.659 val t = ParseC.parse_test @{context} "(4*x \<up> 2 - 20*x + 25) / (2*x - 5) \<up> 3";
86.660 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.661 -if UnparseC.term_in_ctxt @{context} t = "1 / (- 5 + 2 * x)"
86.662 +if UnparseC.term @{context} t = "1 / (- 5 + 2 * x)"
86.663 then () else error "rational.sml: diff.behav. in norm_Rational_mg 9";
86.664
86.665 (*SRC Schalk I, p.66 Nr. 381c *)
86.666 val t = ParseC.parse_test @{context} "(27*a \<up> 3 + 9*a \<up> 2+3*a+1) / (27*a \<up> 3 + 18*a \<up> 2+3*a)";
86.667 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.668 -if UnparseC.term_in_ctxt @{context} t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
86.669 +if UnparseC.term @{context} t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
86.670 then () else error "rational.sml: diff.behav. in norm_Rational_mg 10";
86.671
86.672 (*SRC Schalk I, p.66 Nr. 383a *)
86.673 val t = ParseC.parse_test @{context} "(5*a \<up> 2 - 5*a*b) / (a - b) \<up> 2";
86.674 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.675 -if UnparseC.term_in_ctxt @{context} t = "- 5 * a / (- 1 * a + b)"
86.676 +if UnparseC.term @{context} t = "- 5 * a / (- 1 * a + b)"
86.677 then () else error "rational.sml: diff.behav. in norm_Rational_mg 11";
86.678
86.679 "----- NOT TERMINATING ?: worked before 0707xx";
86.680 @@ -1016,7 +1016,7 @@
86.681 "(- 1 + - 1 * a + b \<up> 2 + a * b \<up> 2)"))
86.682
86.683 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.684 -if UnparseC.term_in_ctxt @{context} t = "(1 + - 1 * a) / (1 + - 1 * b)" then ()
86.685 +if UnparseC.term @{context} t = "(1 + - 1 * a) / (1 + - 1 * b)" then ()
86.686 else error "rational.sml MG tests 3e";
86.687 *)
86.688
86.689 @@ -1026,12 +1026,12 @@
86.690 (*SRA Schalk I, p.67 Nr. 403a *)
86.691 val t = ParseC.parse_test @{context} "4/x - 3/y - 1";
86.692 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.693 -if UnparseC.term_in_ctxt @{context} t = "(- 3 * x + 4 * y + - 1 * x * y) / (x * y)"
86.694 +if UnparseC.term @{context} t = "(- 3 * x + 4 * y + - 1 * x * y) / (x * y)"
86.695 then () else error "rational.sml: diff.behav. in norm_Rational_mg 12";
86.696
86.697 val t = ParseC.parse_test @{context} "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a \<up> 2+3*b*c)/(a*b*c)";
86.698 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.699 -if UnparseC.term_in_ctxt @{context} t = "4 / c"
86.700 +if UnparseC.term @{context} t = "4 / c"
86.701 then () else error "rational.sml: diff.behav. in norm_Rational_mg 13";
86.702
86.703 (*SRA Schalk I, p.67 Nr. 410b *)
86.704 @@ -1040,20 +1040,20 @@
86.705 cancel_p_ thy (ParseC.parse_test @{context} "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)")
86.706
86.707 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.708 -if UnparseC.term_in_ctxt @{context} t = "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)"
86.709 +if UnparseC.term @{context} t = "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)"
86.710 then () else error "rational.sml: diff.behav. in norm_Rational_mg 14";
86.711 *)
86.712
86.713 (*SRA Schalk I, p.67 Nr. 413b *)
86.714 val t = ParseC.parse_test @{context} "(1 + x)/(1 - x) - (1 - x)/(1 + x) + 2*x/(1 - x \<up> 2)";
86.715 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.716 -if UnparseC.term_in_ctxt @{context} t = "6 * x / (1 + - 1 * x \<up> 2)"
86.717 +if UnparseC.term @{context} t = "6 * x / (1 + - 1 * x \<up> 2)"
86.718 then () else error "rational.sml: diff.behav. in norm_Rational_mg 15";
86.719
86.720 (*SRA Schalk I, p.68 Nr. 414a *)
86.721 val t = ParseC.parse_test @{context} "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
86.722 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.723 -if UnparseC.term_in_ctxt @{context} t ="(- 2 + - 5 * x + 2 * x \<up> 2) / (2 + - 3 * x + x \<up> 2)"
86.724 +if UnparseC.term @{context} t ="(- 2 + - 5 * x + 2 * x \<up> 2) / (2 + - 3 * x + x \<up> 2)"
86.725 then () else error "rational.sml: diff.behav. in norm_Rational_mg 16";
86.726
86.727 (*SRA Schalk I, p.68 Nr. 428b *)
86.728 @@ -1063,7 +1063,7 @@
86.729 cancel_p_ thy (ParseC.parse_test @{context} "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
86.730
86.731 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.732 -if UnparseC.term_in_ctxt @{context} t = "4 / (a \<up> 4 + - 2 * a \<up> 2 * b \<up> 2 + b \<up> 4)"
86.733 +if UnparseC.term @{context} t = "4 / (a \<up> 4 + - 2 * a \<up> 2 * b \<up> 2 + b \<up> 4)"
86.734 then () else error "rational.sml: diff.behav. in norm_Rational_mg 18";
86.735 *)
86.736
86.737 @@ -1071,7 +1071,7 @@
86.738 val t = ParseC.parse_test @{context}
86.739 "a \<up> 2/(a - 3*b) - 108*a*b \<up> 3/((a+3*b)*(a \<up> 2 - 9*b \<up> 2)) - 9*b \<up> 2*(a - 3*b)/(a+3*b) \<up> 2";
86.740 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.741 -if UnparseC.term_in_ctxt @{context} t = "a + 3 * b"
86.742 +if UnparseC.term @{context} t = "a + 3 * b"
86.743 then () else error "rational.sml: diff.behav. in norm_Rational_mg 19";
86.744
86.745 (*SRA Schalk I, p.68 Nr. 432 *)
86.746 @@ -1080,13 +1080,13 @@
86.747 "a \<up> 2*(a - b) / (a \<up> 3 - a \<up> 2*b) - 2*a*(a \<up> 2 - b \<up> 2) / (a \<up> 3 - a*b \<up> 2) - " ^
86.748 "2*b \<up> 2 / (a \<up> 2 - b \<up> 2)");
86.749 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.750 -if UnparseC.term_in_ctxt @{context} t = (*"0" ..isabisac15 | Isabelle2017..*) "0 / (a \<up> 2 + - 1 * b \<up> 2)"
86.751 +if UnparseC.term @{context} t = (*"0" ..isabisac15 | Isabelle2017..*) "0 / (a \<up> 2 + - 1 * b \<up> 2)"
86.752 then () else error "rational.sml: diff.behav. in norm_Rational_mg 20";
86.753
86.754 (* some example *)
86.755 val t = ParseC.parse_test @{context} "3*a / (a*b) + x/y";
86.756 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.757 -if UnparseC.term_in_ctxt @{context} t = "(3 * y + b * x) / (b * y)"
86.758 +if UnparseC.term @{context} t = "(3 * y + b * x) / (b * y)"
86.759 then () else error "rational.sml: diff.behav. in norm_Rational_mg 21";
86.760
86.761
86.762 @@ -1096,13 +1096,13 @@
86.763 (*------- SRM Schalk I, p.68 Nr. 436a *)
86.764 val t = ParseC.parse_test @{context} "3*(x+y) / (15*(x - y)) * 25*(x - y) \<up> 2 / (18*(x + y) \<up> 2)";
86.765 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.766 -if UnparseC.term_in_ctxt @{context} t = "(- 5 * x + 5 * y) / (- 18 * x + - 18 * y)"
86.767 +if UnparseC.term @{context} t = "(- 5 * x + 5 * y) / (- 18 * x + - 18 * y)"
86.768 then () else error "rational.sml: diff.behav. in norm_Rational_mg 22";
86.769
86.770 (*------- SRM.test Schalk I, p.68 Nr. 436b *)
86.771 val t = ParseC.parse_test @{context} "5*a*(a - b) \<up> 2*(a + b) \<up> 3/(7*b*(a - b) \<up> 3) * 7*b/(a + b) \<up> 3";
86.772 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.773 -if UnparseC.term_in_ctxt @{context} t = "5 * a / (a + - 1 * b)"
86.774 +if UnparseC.term @{context} t = "5 * a / (a + - 1 * b)"
86.775 then () else error "rational.sml: diff.behav. in norm_Rational_mg 23";
86.776
86.777 (*------- Schalk I, p.68 Nr. 437a *)
86.778 @@ -1120,14 +1120,14 @@
86.779 "(9 * a \<up> 2 + - 16 * b \<up> 2)");
86.780 NONE = cancel_p_ thy t;
86.781
86.782 -if UnparseC.term_in_ctxt @{context} t = "1 / (4 * c + 3 * e)" then ()
86.783 +if UnparseC.term @{context} t = "1 / (4 * c + 3 * e)" then ()
86.784 else error "rational.sml: diff.behav. in norm_Rational_mg 24";
86.785 *)
86.786
86.787 "----- S.K. corrected non-termination 060904";
86.788 val t = ParseC.parse_test @{context} "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a \<up> 2 - 16*b \<up> 2))";
86.789 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
86.790 -if UnparseC.term_in_ctxt @{context} t =
86.791 +if UnparseC.term @{context} t =
86.792 "(9 * a \<up> 2 + - 16 * b \<up> 2) /\n(36 * a \<up> 2 * c + 27 * a \<up> 2 * e + - 64 * b \<up> 2 * c +\n - 48 * b \<up> 2 * e)"
86.793 then () else error "rational.sml: S.K.8..corrected 060904-6";
86.794
86.795 @@ -1136,7 +1136,7 @@
86.796 "(36 * a \<up> 2 * c + (27 * a \<up> 2 * e + (-64 * b \<up> 2 * c + -48 * b \<up> 2 * e)))");
86.797 (* /--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------\
86.798 val SOME (t',_) = rewrite_set_ ctxt false cancel_p t'';
86.799 -if UnparseC.term_in_ctxt @{context} t' = "1 / (4 * c + 3 * e)"
86.800 +if UnparseC.term @{context} t' = "1 / (4 * c + 3 * e)"
86.801 then () else error "rational.sml: diff.behav. in cancel_p S.K.8";
86.802 \--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------/*)
86.803
86.804 @@ -1155,19 +1155,19 @@
86.805 (*------- SRM Schalk I, p.68 Nr. 438a *)
86.806 val t = ParseC.parse_test @{context} "x*y / (x*y - y \<up> 2) * (x \<up> 2 - x*y)";
86.807 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.808 -if UnparseC.term_in_ctxt @{context} t = "x \<up> 2"
86.809 +if UnparseC.term @{context} t = "x \<up> 2"
86.810 then () else error "rational.sml: diff.behav. in norm_Rational_mg 24";
86.811
86.812 (*------- SRM Schalk I, p.68 Nr. 439b *)
86.813 val t = ParseC.parse_test @{context} "(4*x \<up> 2 + 4*x + 1) * ((x \<up> 2 - 2*x \<up> 3) / (4*x \<up> 2 + 2*x))";
86.814 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.815 -if UnparseC.term_in_ctxt @{context} t = "(x + - 4 * x \<up> 3) / 2"
86.816 +if UnparseC.term @{context} t = "(x + - 4 * x \<up> 3) / 2"
86.817 then () else error "rational.sml: diff.behav. in norm_Rational_mg 25";
86.818
86.819 (*------- SRM Schalk I, p.68 Nr. 440a *)
86.820 val t = ParseC.parse_test @{context} "(x \<up> 2 - 2*x) / (x \<up> 2 - 3*x) * (x - 3) \<up> 2 / (x \<up> 2 - 4)";
86.821 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.822 -if UnparseC.term_in_ctxt @{context} t = "(- 3 + x) / (2 + x)"
86.823 +if UnparseC.term @{context} t = "(- 3 + x) / (2 + x)"
86.824 then () else error "rational.sml: diff.behav. in norm_Rational_mg 26";
86.825
86.826 "----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx";
86.827 @@ -1188,7 +1188,7 @@
86.828 AS
86.829 NONE = cancel_p_ thy t;
86.830
86.831 -if UnparseC.term_in_ctxt @{context} t = "(-3 * a + a \<up> 2) / (a + - 1 * b)" then ()
86.832 +if UnparseC.term @{context} t = "(-3 * a + a \<up> 2) / (a + - 1 * b)" then ()
86.833 else error "rational.sml: diff.behav. in norm_Rational 27";
86.834 *)
86.835
86.836 @@ -1198,7 +1198,7 @@
86.837 cancel_p_ thy (ParseC.parse_test @{context} "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
86.838
86.839 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.840 -if UnparseC.term_in_ctxt @{context} t' = "(-3 * a + a \<up> 2) / (a + - 1 * b)" then ()
86.841 +if UnparseC.term @{context} t' = "(-3 * a + a \<up> 2) / (a + - 1 * b)" then ()
86.842 else error "rational.sml: diff.behav. in norm_Rational 28";
86.843 *)
86.844
86.845 @@ -1208,32 +1208,32 @@
86.846 (*------- SRAM Schalk I, p.69 Nr. 441b *)
86.847 val t = ParseC.parse_test @{context} "(4*a/3 + 3*b \<up> 2/a \<up> 3 + b/(4*a))*(4*b/(3*a))";
86.848 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.849 -if UnparseC.term_in_ctxt @{context} t = "(36 * b \<up> 3 + 3 * a \<up> 2 * b \<up> 2 + 16 * a \<up> 4 * b) /\n(9 * a \<up> 4)"
86.850 +if UnparseC.term @{context} t = "(36 * b \<up> 3 + 3 * a \<up> 2 * b \<up> 2 + 16 * a \<up> 4 * b) /\n(9 * a \<up> 4)"
86.851 then () else error "rational.sml: diff.behav. in norm_Rational_mg 28";
86.852
86.853 (*------- SRAM Schalk I, p.69 Nr. 442b *)
86.854 val t = ParseC.parse_test @{context} ("(15*a \<up> 2/x \<up> 3 - 5*b \<up> 4/x \<up> 2 + 25*c \<up> 2/x) * " ^
86.855 "(x \<up> 3/(5*a*b \<up> 3*c \<up> 3)) + 1/c \<up> 3 * (b*x/a - 3*a/b \<up> 3)");
86.856 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.857 -if UnparseC.term_in_ctxt @{context} t = "5 * x \<up> 2 / (a * b \<up> 3 * c)"
86.858 +if UnparseC.term @{context} t = "5 * x \<up> 2 / (a * b \<up> 3 * c)"
86.859 then () else error "rational.sml: diff.behav. in norm_Rational_mg 29";
86.860
86.861 (*------- SRAM Schalk I, p.69 Nr. 443b *)
86.862 val t = ParseC.parse_test @{context} "(a/2 + b/3) * (b/3 - a/2)";
86.863 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.864 -if UnparseC.term_in_ctxt @{context} t = "(- 9 * a \<up> 2 + 4 * b \<up> 2) / 36"
86.865 +if UnparseC.term @{context} t = "(- 9 * a \<up> 2 + 4 * b \<up> 2) / 36"
86.866 then () else error "rational.sml: diff.behav. in norm_Rational_mg 30";
86.867
86.868 (*------- SRAM Schalk I, p.69 Nr. 445b *)
86.869 val t = ParseC.parse_test @{context} "(a \<up> 2/9 + 2*a/(3*b) + 4/b \<up> 2)*(a/3 - 2/b) + 8/b \<up> 3";
86.870 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.871 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 3 / 27"
86.872 +if UnparseC.term @{context} t = "a \<up> 3 / 27"
86.873 then () else error "rational.sml: diff.behav. in norm_Rational_mg 31";
86.874
86.875 (*------- SRAM Schalk I, p.69 Nr. 446b *)
86.876 val t = ParseC.parse_test @{context} "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x \<up> 2 - 16*y \<up> 2)";
86.877 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.878 -if UnparseC.term_in_ctxt @{context} t = (*"30 * x \<up> 2 + -9 * x * y + - 20 * y \<up> 2" ..isabisac15 | Isabelle2017..*)
86.879 +if UnparseC.term @{context} t = (*"30 * x \<up> 2 + -9 * x * y + - 20 * y \<up> 2" ..isabisac15 | Isabelle2017..*)
86.880 "(- 30 * x \<up> 2 + 9 * x * y + 20 * y \<up> 2) / - 1"
86.881 then () else error "rational.sml: diff.behav. in norm_Rational_mg 32";
86.882
86.883 @@ -1241,14 +1241,14 @@
86.884 val t = ParseC.parse_test @{context}
86.885 "(2*x \<up> 2/(3*y)+x/y \<up> 2)*(4*x \<up> 4/(9*y \<up> 2)+x \<up> 2/y \<up> 4)*(2*x \<up> 2/(3*y) - x/y \<up> 2)";
86.886 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.887 -if UnparseC.term_in_ctxt @{context} t = "(- 81 * x \<up> 4 + 16 * x \<up> 8 * y \<up> 4) / (81 * y \<up> 8)"
86.888 +if UnparseC.term @{context} t = "(- 81 * x \<up> 4 + 16 * x \<up> 8 * y \<up> 4) / (81 * y \<up> 8)"
86.889 then () else error "rational.sml: diff.behav. in norm_Rational_mg 33";
86.890
86.891 (*------- SRAM Schalk I, p.69 Nr. 450a *)
86.892 val t = ParseC.parse_test @{context}
86.893 "(4*x/(3*y)+2*y/(3*x)) \<up> 2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)";
86.894 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.895 -if UnparseC.term_in_ctxt @{context} t = "(52 * x \<up> 2 + 16 * y \<up> 2) / (9 * y \<up> 2)"
86.896 +if UnparseC.term @{context} t = "(52 * x \<up> 2 + 16 * y \<up> 2) / (9 * y \<up> 2)"
86.897 then () else error "rational.sml: diff.behav. in norm_Rational_mg 34";
86.898
86.899 (*------- SRAM Schalk I, p.69 Nr. 442b --- abgewandelt*)
86.900 @@ -1256,7 +1256,7 @@
86.901 ("(15*a \<up> 4/(a*x \<up> 3) - 5*a*((b \<up> 4 - 5*c \<up> 2*x) / x \<up> 2)) * " ^
86.902 "(x \<up> 3/(5*a*b \<up> 3*c \<up> 3)) + a/c \<up> 3 * (x*(b/a) - 3*b*(a/b \<up> 4))");
86.903 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.904 -if UnparseC.term_in_ctxt @{context} t = "5 * x \<up> 2 / (b \<up> 3 * c)"
86.905 +if UnparseC.term @{context} t = "5 * x \<up> 2 / (b \<up> 3 * c)"
86.906 then () else error "rational.sml: diff.behav. in norm_Rational_mg 53";
86.907
86.908
86.909 @@ -1266,13 +1266,13 @@
86.910 "----- SRD Schalk I, p.69 Nr. 454b";
86.911 val t = ParseC.parse_test @{context} "((2 - x)/(2*a)) / (2*a/(x - 2))";
86.912 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.913 -if UnparseC.term_in_ctxt @{context} t = "(- 4 + 4 * x + - 1 * x \<up> 2) / (4 * a \<up> 2)"
86.914 +if UnparseC.term @{context} t = "(- 4 + 4 * x + - 1 * x \<up> 2) / (4 * a \<up> 2)"
86.915 then () else error "rational.sml: diff.behav. in norm_Rational_mg 35";
86.916
86.917 "----- SRD Schalk I, p.69 Nr. 455a";
86.918 val t = ParseC.parse_test @{context} "(a \<up> 2 + 1)/(a \<up> 2 - 1) / ((a+1)/(a - 1))";
86.919 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.920 -if UnparseC.term_in_ctxt @{context} t = "(1 + a \<up> 2) / (1 + 2 * a + a \<up> 2)" then ()
86.921 +if UnparseC.term @{context} t = "(1 + a \<up> 2) / (1 + 2 * a + a \<up> 2)" then ()
86.922 else error "rational.sml: diff.behav. in norm_Rational_mg 36";
86.923
86.924 "----- Schalk I, p.69 Nr. 455b";
86.925 @@ -1282,7 +1282,7 @@
86.926 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)"))
86.927
86.928 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.929 -if UnparseC.term_in_ctxt @{context} t = "(2 + - 1 * x) / (3 + y)" then ()
86.930 +if UnparseC.term @{context} t = "(2 + - 1 * x) / (3 + y)" then ()
86.931 else error "rational.sml: diff.behav. in norm_Rational_mg 37";
86.932 *)
86.933
86.934 @@ -1293,26 +1293,26 @@
86.935 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)"))
86.936
86.937 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.938 -if UnparseC.term_in_ctxt @{context} t = "(2 + - 1 * x) / (3 + y)" then ()
86.939 +if UnparseC.term @{context} t = "(2 + - 1 * x) / (3 + y)" then ()
86.940 else error "rational.sml: diff.behav. in norm_Rational_mg 37b";
86.941 *)
86.942
86.943 "----- ?: worked before 0707xx";
86.944 val t = ParseC.parse_test @{context} "(3 + - 1 * y) / (-9 + y \<up> 2)";
86.945 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.946 -if UnparseC.term_in_ctxt @{context} t = "- 1 / (3 + y)"
86.947 +if UnparseC.term @{context} t = "- 1 / (3 + y)"
86.948 then () else error "rational.sml: - 1 / (3 + y) norm_Rational";
86.949
86.950 "----- SRD Schalk I, p.69 Nr. 456b";
86.951 val t = ParseC.parse_test @{context} "(b \<up> 3 - b \<up> 2) / (b \<up> 2+b) / (b \<up> 2 - 1)";
86.952 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.953 -if UnparseC.term_in_ctxt @{context} t = "b / (1 + 2 * b + b \<up> 2)"
86.954 +if UnparseC.term @{context} t = "b / (1 + 2 * b + b \<up> 2)"
86.955 then () else error "rational.sml: diff.behav. in norm_Rational_mg 38";
86.956
86.957 "----- SRD Schalk I, p.69 Nr. 457b";
86.958 val t = ParseC.parse_test @{context} "(16*a \<up> 2 - 9*b \<up> 2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a \<up> 2 - 9*a \<up> 2*b \<up> 2))";
86.959 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.960 -if UnparseC.term_in_ctxt @{context} t = "8 * a \<up> 2 + - 6 * a * b + - 12 * a \<up> 2 * b + 9 * a * b \<up> 2"
86.961 +if UnparseC.term @{context} t = "8 * a \<up> 2 + - 6 * a * b + - 12 * a \<up> 2 * b + 9 * a * b \<up> 2"
86.962 then () else error "rational.sml: diff.behav. in norm_Rational_mg 39";
86.963
86.964 "----- Schalk I, p.69 Nr. 458b works since 0707";
86.965 @@ -1329,14 +1329,14 @@
86.966 "((- 1 * b \<up> 2 + 2 * (b \<up> 2 * x)) / (a * x + - 1 * (b * x)))");
86.967 NONE = cancel_p_ thy t;
86.968
86.969 -if UnparseC.term_in_ctxt @{context} t = "a \<up> 2 / b \<up> 2" then ()
86.970 +if UnparseC.term @{context} t = "a \<up> 2 / b \<up> 2" then ()
86.971 else error "rational.sml: diff.behav. in norm_Rational_mg 39b";
86.972 *)
86.973
86.974 "----- SRD Schalk I, p.69 Nr. 459b";
86.975 val t = ParseC.parse_test @{context} "(a \<up> 2 - b \<up> 2)/(a*b) / (4*(a+b) \<up> 2/a)";
86.976 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.977 -if UnparseC.term_in_ctxt @{context} t = "(a + - 1 * b) / (4 * a * b + 4 * b \<up> 2)" then ()
86.978 +if UnparseC.term @{context} t = "(a + - 1 * b) / (4 * a * b + 4 * b \<up> 2)" then ()
86.979 else error "rational.sml: diff.behav. in norm_Rational_mg 41";
86.980
86.981 "----- Schalk I, p.69 Nr. 460b nonterm.SK";
86.982 @@ -1350,39 +1350,39 @@
86.983 "((- 12 + 3 * x) / (- 16 + 16 * y))");
86.984 NONE = cancel_p_ thy t;
86.985
86.986 -if UnparseC.term_in_ctxt @{context} t = !!!!!!!!!!!!!!!!!!!!!!!!!
86.987 +if UnparseC.term @{context} t = !!!!!!!!!!!!!!!!!!!!!!!!!
86.988 then () else error "rational.sml: diff.behav. in norm_Rational_mg 42";
86.989 *)
86.990
86.991 "----- some variant of the above; was non-terminating before";
86.992 val t = ParseC.parse_test @{context} "9*(x \<up> 2 - 8*x+16)*(16*y - 16)/(4*(y \<up> 2 - 2*y+1)*(3*x - 12))";
86.993 val SOME (t , _) = rewrite_set_ ctxt false norm_Rational t;
86.994 -if UnparseC.term_in_ctxt @{context} t = "(48 + - 12 * x) / (1 + - 1 * y)"
86.995 +if UnparseC.term @{context} t = "(48 + - 12 * x) / (1 + - 1 * y)"
86.996 then () else error "some variant of the above; was non-terminating before";
86.997
86.998 "----- SRD Schalk I, p.70 Nr. 472a";
86.999 val t = ParseC.parse_test @{context} ("((8*x \<up> 2 - 32*y \<up> 2) / (2*x + 4*y)) / ((4*x - 8*y) / (x + y))");
86.1000 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1001 -if UnparseC.term_in_ctxt @{context} t = "x + y"
86.1002 +if UnparseC.term @{context} t = "x + y"
86.1003 then () else error "rational.sml: diff.behav. in norm_Rational_mg 43";
86.1004
86.1005 "----- Schalk I, p.70 Nr. 478b ----- Rechenzeit: 5 sec";
86.1006 val t = ParseC.parse_test @{context} ("(a - (a*b + b \<up> 2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / " ^
86.1007 "((a - a \<up> 2/(a+b))/(a+(a*b)/(a - b)))");
86.1008 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1009 -if UnparseC.term_in_ctxt @{context} t = "(2 * a \<up> 3 + 2 * a \<up> 2 * b) / (a \<up> 2 * b + b \<up> 3)"
86.1010 +if UnparseC.term @{context} t = "(2 * a \<up> 3 + 2 * a \<up> 2 * b) / (a \<up> 2 * b + b \<up> 3)"
86.1011 then () else error "rational.sml: diff.behav. in norm_Rational_mg 51";
86.1012
86.1013 (*SRD Schalk I, p.69 Nr. 461a *)
86.1014 val t = ParseC.parse_test @{context} "(2/(x+3) + 2/(x - 3)) / (8*x/(x \<up> 2 - 9))";
86.1015 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1016 -if UnparseC.term_in_ctxt @{context} t = "1 / 2"
86.1017 +if UnparseC.term @{context} t = "1 / 2"
86.1018 then () else error "rational.sml: diff.behav. in norm_Rational_mg 44";
86.1019
86.1020 (*SRD Schalk I, p.69 Nr. 464b *)
86.1021 val t = ParseC.parse_test @{context} "(a - a/(a - 2)) / (a + a/(a - 2))";
86.1022 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1023 -if UnparseC.term_in_ctxt @{context} t = "(- 3 + a) / (- 1 + a)"
86.1024 +if UnparseC.term @{context} t = "(- 3 + a) / (- 1 + a)"
86.1025 then () else error "rational.sml: diff.behav. in norm_Rational_mg 45";
86.1026
86.1027 (*SRD Schalk I, p.69 Nr. 465b *)
86.1028 @@ -1393,21 +1393,21 @@
86.1029 "(576 * x \<up> 2 + 864 * (x * y) + 1296 * (x * z))"))
86.1030
86.1031 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1032 -if UnparseC.term_in_ctxt @{context} t = "(4 * x + 6 * y + -9 * z) / (4 * x)"
86.1033 +if UnparseC.term @{context} t = "(4 * x + 6 * y + -9 * z) / (4 * x)"
86.1034 then () else error "rational.sml: diff.behav. in norm_Rational_mg 46";
86.1035 *)
86.1036
86.1037 (*SRD Schalk I, p.69 Nr. 466b *)
86.1038 val t = ParseC.parse_test @{context} "((1 - 7*(x - 2)/(x \<up> 2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x \<up> 2 - 25))";
86.1039 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1040 -if UnparseC.term_in_ctxt @{context} t = "(25 + - 10 * x + x \<up> 2) / 18"
86.1041 +if UnparseC.term @{context} t = "(25 + - 10 * x + x \<up> 2) / 18"
86.1042 then () else error "rational.sml: diff.behav. in norm_Rational_mg 47";
86.1043
86.1044 (*SRD Schalk I, p.70 Nr. 469 *)
86.1045 val t = ParseC.parse_test @{context} ("3*b \<up> 2 / (4*a \<up> 2 - 8*a*b + 4*b \<up> 2) / " ^
86.1046 "(a / (a \<up> 2*b - b \<up> 3) + (a - b) / (4*a*b \<up> 2 + 4*b \<up> 3) - 1 / (4*b \<up> 2))");
86.1047 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1048 -if UnparseC.term_in_ctxt @{context} t = "- 3 * b \<up> 3 / (- 2 * a + 2 * b)"
86.1049 +if UnparseC.term @{context} t = "- 3 * b \<up> 3 / (- 2 * a + 2 * b)"
86.1050 then () else error "rational.sml: diff.behav. in norm_Rational_mg 48";
86.1051
86.1052
86.1053 @@ -1473,10 +1473,10 @@
86.1054 (([], Res), (-4 + 4 * x + - 1 * x \<up> 2) / (4 * a \<up> 2))]
86.1055 *)
86.1056 val (t, asm) = get_obj g_result pt [1, 1];
86.1057 -if UnparseC.term_in_ctxt @{context} t = "(2 - x) / (2 * a) / (2 * a / (x + - 1 * 2))" andalso UnparseC.terms_in_ctxt @{context} asm = "[]"
86.1058 +if UnparseC.term @{context} t = "(2 - x) / (2 * a) / (2 * a / (x + - 1 * 2))" andalso UnparseC.terms @{context} asm = "[]"
86.1059 then () else error "2nd interSteps ..Simp_Rat_Double_No- 1 changed on [1, 1]";
86.1060 val (t, asm) = get_obj g_result pt [1, 2];
86.1061 -if UnparseC.term_in_ctxt @{context} t = "(2 + - 1 * x) / (2 * a) / (2 * a / (x + - 1 * 2))" andalso UnparseC.terms_in_ctxt @{context} asm = "[]"
86.1062 +if UnparseC.term @{context} t = "(2 + - 1 * x) / (2 * a) / (2 * a / (x + - 1 * 2))" andalso UnparseC.terms @{context} asm = "[]"
86.1063 then () else error "3rd interSteps ..Simp_Rat_Double_No- 1 changed on [1, 2]";
86.1064
86.1065
86.1066 @@ -1566,14 +1566,14 @@
86.1067
86.1068 "----- with rewrite_set_";
86.1069 val SOME (tt',asm) = rewrite_set_ ctxt false make_polynomial tt;
86.1070 -if UnparseC.term_in_ctxt @{context} tt'= "a \<up> 2 + - 1 * b \<up> 2" then () else error "rls chancel_p 1";
86.1071 +if UnparseC.term @{context} tt'= "a \<up> 2 + - 1 * b \<up> 2" then () else error "rls chancel_p 1";
86.1072 val tt = ParseC.parse_test @{context} "((1 * a + - 1 * b) * (1 * a + - 1 * b))"(*denominator only*);
86.1073 val SOME (tt',asm) = rewrite_set_ ctxt false make_polynomial tt;
86.1074 -if UnparseC.term_in_ctxt @{context} tt' = "a \<up> 2 + - 2 * a * b + b \<up> 2" then () else error "rls chancel_p 2";
86.1075 +if UnparseC.term @{context} tt' = "a \<up> 2 + - 2 * a * b + b \<up> 2" then () else error "rls chancel_p 2";
86.1076
86.1077 "----- with Derive.do_one; WN1130912 not investigated further, will be discontinued";
86.1078 val SOME (tt, _) = factout_p_ thy t;
86.1079 -if UnparseC.term_in_ctxt @{context} tt = "(a + b) * (a + - 1 * b) / ((a + - 1 * b) * (a + - 1 * b))"
86.1080 +if UnparseC.term @{context} tt = "(a + b) * (a + - 1 * b) / ((a + - 1 * b) * (a + - 1 * b))"
86.1081 then () else error "rls chancel_p 3";
86.1082
86.1083 "--- with simpler ruleset";
86.1084 @@ -1582,10 +1582,10 @@
86.1085 if length der = 12 then () else error "WN1130912 rls chancel_p 4";
86.1086 (*default_print_depth 99;*) writeln (Derive.deriv2str ctxt der); (*default_print_depth 3;*)
86.1087
86.1088 -(*default_print_depth 99;*) map ((UnparseC.term_in_ctxt ctxt) o #1) der; (*default_print_depth 3;*)
86.1089 +(*default_print_depth 99;*) map ((UnparseC.term ctxt) o #1) der; (*default_print_depth 3;*)
86.1090 "...,(- 1 * b \<up> 2 + a \<up> 2) / (- 2 * (a * b) + a \<up> 2 + (- 1 * b) \<up> 2) ]";
86.1091 (*default_print_depth 99;*) map ((Rule.to_string ctxt) o #2) der; (*default_print_depth 3;*)
86.1092 -(*default_print_depth 99;*) map ((UnparseC.term_in_ctxt ctxt) o #1 o #3) der; (*default_print_depth 3;*)
86.1093 +(*default_print_depth 99;*) map ((UnparseC.term ctxt) o #1 o #3) der; (*default_print_depth 3;*)
86.1094
86.1095 val der = Derive.do_one ctxt Atools_erls rules ro NONE
86.1096 (ParseC.parse_test @{context} "(1 * a + 1 * b) * (1 * a + - 1 * b)");
86.1097 @@ -1595,7 +1595,7 @@
86.1098 val der = Derive.do_one ctxt Atools_erls rules ro NONE
86.1099 (ParseC.parse_test @{context} "(1 * a + - 1 * b) * (1 * a + - 1 * b)");
86.1100 (*default_print_depth 99;*) writeln (Derive.deriv2str ctxt der); (*default_print_depth 3;*)
86.1101 -(*default_print_depth 99;*) map ((UnparseC.term_in_ctxt ctxt) o #1) der; (*default_print_depth 3;*)
86.1102 +(*default_print_depth 99;*) map ((UnparseC.term ctxt) o #1) der; (*default_print_depth 3;*)
86.1103 (*WN060829 ...postponed*)
86.1104
86.1105
86.1106 @@ -1606,7 +1606,7 @@
86.1107 val ctxt = Proof_Context.init_global thy;
86.1108 val t = ParseC.parse_test ctxt "get_denominator ((a +x)/b)";
86.1109 val SOME (_, t') = eval_get_denominator "" 0 t ctxt;
86.1110 -if UnparseC.term_in_ctxt @{context} t' = "get_denominator ((a + x) / b) = b"
86.1111 +if UnparseC.term @{context} t' = "get_denominator ((a + x) / b) = b"
86.1112 then () else error "get_denominator ((a + x) / b) = b"
86.1113
86.1114
86.1115 @@ -1648,11 +1648,11 @@
86.1116 (*1st factor separately simplified *)
86.1117 val t = ParseC.parse_test @{context} "((12*x*y / (9*x \<up> 2 - y \<up> 2)) / (1 / (3*x - y) \<up> 2 - 1 / (3*x + y) \<up> 2))";
86.1118 val SOME (t', _) = rewrite_set_ ctxt false norm_Rational t;
86.1119 -if UnparseC.term_in_ctxt @{context} t' = "(- 9 * x \<up> 2 + y \<up> 2) / - 1" then () else error "Nr. 480b lhs changed";
86.1120 +if UnparseC.term @{context} t' = "(- 9 * x \<up> 2 + y \<up> 2) / - 1" then () else error "Nr. 480b lhs changed";
86.1121 (*2nd factor separately simplified *)
86.1122 val t = ParseC.parse_test @{context} "((1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2) / (20*x*y / (x \<up> 2 - 25*y \<up> 2)))";
86.1123 -val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term_in_ctxt @{context} t';
86.1124 -if UnparseC.term_in_ctxt @{context} t' = "- 1 / (- 1 * x \<up> 2 + 25 * y \<up> 2)" then () else error "Nr. 480b rhs changed";
86.1125 +val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term @{context} t';
86.1126 +if UnparseC.term @{context} t' = "- 1 / (- 1 * x \<up> 2 + 25 * y \<up> 2)" then () else error "Nr. 480b rhs changed";
86.1127
86.1128 "-------- Schalk I, p.70 Nr. 477a: terms are exploding ?!?";
86.1129 val t = ParseC.parse_test @{context} ("b*y/(b - 2*y)/((b \<up> 2 - y \<up> 2)/(b+2*y)) /" ^
86.1130 @@ -1702,7 +1702,7 @@
86.1131 -4 * (a \<up> 2 * b \<up> 8) +
86.1132 - 2 * (a * b \<up> 9))
86.1133
86.1134 -if UnparseC.term_in_ctxt @{context} t = "1 / (a \<up> 2 + - 1 * b \<up> 2)" then ()
86.1135 +if UnparseC.term @{context} t = "1 / (a \<up> 2 + - 1 * b \<up> 2)" then ()
86.1136 else error "rational.sml: diff.behav. in norm_Rational_mg 49";
86.1137 *)
86.1138
86.1139 @@ -1730,11 +1730,11 @@
86.1140
86.1141 val t = ParseC.parse_test @{context} "(a-b) \<up> 3 * (x+y) \<up> 4";
86.1142 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1143 -UnparseC.term_in_ctxt @{context} t;
86.1144 +UnparseC.term @{context} t;
86.1145 "a \<up> 3 * x \<up> 4 + 4 * a \<up> 3 * x \<up> 3 * y +6 * a \<up> 3 * x \<up> 2 * y \<up> 2 +4 * a \<up> 3 * x * y \<up> 3 +a \<up> 3 * y \<up> 4 +-3 * a \<up> 2 * b * x \<up> 4 +- 12 * a \<up> 2 * b * x \<up> 3 * y +- 18 * a \<up> 2 * b * x \<up> 2 * y \<up> 2 +- 12 * a \<up> 2 * b * x * y \<up> 3 +-3 * a \<up> 2 * b * y \<up> 4 +3 * a * b \<up> 2 * x \<up> 4 +12 * a * b \<up> 2 * x \<up> 3 * y +18 * a * b \<up> 2 * x \<up> 2 * y \<up> 2 +12 * a * b \<up> 2 * x * y \<up> 3 +3 * a * b \<up> 2 * y \<up> 4 +- 1 * b \<up> 3 * x \<up> 4 +-4 * b \<up> 3 * x \<up> 3 * y +-6 * b \<up> 3 * x \<up> 2 * y \<up> 2 +-4 * b \<up> 3 * x * y \<up> 3 +- 1 * b \<up> 3 * y \<up> 4";
86.1146 val t = ParseC.parse_test @{context} "((x+y) \<up> 2 * (a-b) \<up> 5)";
86.1147 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
86.1148 -UnparseC.term_in_ctxt @{context} t;
86.1149 +UnparseC.term @{context} t;
86.1150 "a \<up> 5 * x \<up> 2 + 2 * a \<up> 5 * x * y + a \<up> 5 * y \<up> 2 +-5 * a \<up> 4 * b * x \<up> 2 +- 10 * a \<up> 4 * b * x * y +-5 * a \<up> 4 * b * y \<up> 2 +10 * a \<up> 3 * b \<up> 2 * x \<up> 2 +20 * a \<up> 3 * b \<up> 2 * x * y +10 * a \<up> 3 * b \<up> 2 * y \<up> 2 +- 10 * a \<up> 2 * b \<up> 3 * x \<up> 2 +- 20 * a \<up> 2 * b \<up> 3 * x * y +- 10 * a \<up> 2 * b \<up> 3 * y \<up> 2 +5 * a * b \<up> 4 * x \<up> 2 +10 * a * b \<up> 4 * x * y +5 * a * b \<up> 4 * y \<up> 2 +- 1 * b \<up> 5 * x \<up> 2 +- 2 * b \<up> 5 * x * y +- 1 * b \<up> 5 * y \<up> 2";
86.1151
86.1152 anscheinend macht dem Rechner das Krzen diese Bruches keinen Spass mehr ...*)
87.1 --- a/test/Tools/isac/Knowledge/rational-old.sml Sat Feb 04 16:49:08 2023 +0100
87.2 +++ b/test/Tools/isac/Knowledge/rational-old.sml Sat Feb 04 17:00:25 2023 +0100
87.3 @@ -603,7 +603,7 @@
87.4 val t = (Thm.term_of o the o (TermC.parse thy))
87.5 "(9 - x \<up> 2) / (9 - 6 * x + x \<up> 2)";
87.6 val SOME (t',_) = factor_expanded_ thy t;
87.7 - UnparseC.term_in_ctxt @{context} t';
87.8 + UnparseC.term @{context} t';
87.9
87.10 "((-3) - x) * ((-3) + x) / (((-3) + x) * ((-3) + x))"
87.11 "(3 + x) * (3 - x) / ((3 - x) * (3 - x))"
87.12 @@ -623,7 +623,7 @@
87.13
87.14 (*normal_form produces the result in ONE step*)
87.15 val SOME (t',_) = nor t;
87.16 - UnparseC.term_in_ctxt @{context} t';
87.17 + UnparseC.term @{context} t';
87.18
87.19 (*initialize the interpreter state used by the 'me'*)
87.20 val (t,_,revsets,_) = ini t;
87.21 @@ -637,7 +637,7 @@
87.22 there might be several rule applications inbetween,
87.23 which are listed after the thead in reverse order*)
87.24 val (r,(t,asm))::_ = loc revsets t r;
87.25 - UnparseC.term_in_ctxt @{context} t;
87.26 + UnparseC.term @{context} t;
87.27 "(9 - x \<up> 2) / (3 \<up> 2 + 6 * x + x \<up> 2)";
87.28
87.29 (*find the next rule to apply*)
87.30 @@ -646,31 +646,31 @@
87.31
87.32 (*check the next rule*)
87.33 val (r,(t,asm))::_ = loc revsets t r;
87.34 - UnparseC.term_in_ctxt @{context} t;
87.35 + UnparseC.term @{context} t;
87.36 "(3 \<up> 2 - x \<up> 2) / (3 \<up> 2 + 6 * x + x \<up> 2)";
87.37
87.38 (*find and check the next rules, rewrite*)
87.39 val SOME r = nex revsets t;
87.40 val (r,(t,asm))::_ = loc revsets t r;
87.41 - UnparseC.term_in_ctxt @{context} t;
87.42 + UnparseC.term @{context} t;
87.43 "(3 \<up> 2 - x \<up> 2) / (3 \<up> 2 + 2 * 3 * x + x \<up> 2)";
87.44
87.45 val SOME r = nex revsets t;
87.46 val (r,(t,asm))::_ = loc revsets t r;
87.47 - UnparseC.term_in_ctxt @{context} t;
87.48 + UnparseC.term @{context} t;
87.49 "(3 - x) * (3 + x) / (3 \<up> 2 + 2 * 3 * x + x \<up> 2)";
87.50
87.51 val SOME r = nex revsets t;
87.52 val (r,(t,asm))::_ = loc revsets t r;
87.53 - UnparseC.term_in_ctxt @{context} t;
87.54 + UnparseC.term @{context} t;
87.55 "(3 - x) * (3 + x) / ((3 + x) * (3 + x))";
87.56
87.57 val SOME r = nex revsets t;
87.58 val (r,(t,asm))::_ = loc revsets t r;
87.59 - val ss = UnparseC.term_in_ctxt @{context} t;
87.60 + val ss = UnparseC.term @{context} t;
87.61 if ss = "(3 - x) / (3 + x)" then ()
87.62 else error "rational.sml: new behav. in rev-set cancel";
87.63 - UnparseC.terms_in_ctxt @{context} asm;
87.64 + UnparseC.terms @{context} asm;
87.65
87.66
87.67
87.68 @@ -683,7 +683,7 @@
87.69 next_rule=nex,normal_form=nor,...},...} = cancel;
87.70 (*normal_form produces the result in ONE step*)
87.71 val SOME (t',_) = nor t;
87.72 - UnparseC.term_in_ctxt @{context} t';
87.73 + UnparseC.term @{context} t';
87.74 (*initialize the interpreter state used by the 'me'*)
87.75 val (t,_,revsets,_) = ini t;
87.76 (*
87.77 @@ -695,11 +695,11 @@
87.78 10.10.02: dieser Fall terminiert nicht (make_poly enth"alt zu viele rules)
87.79 val SOME r = nex revsets t;
87.80 val (r,(t,asm))::_ = loc revsets t r;
87.81 - UnparseC.term_in_ctxt @{context} t;
87.82 + UnparseC.term @{context} t;
87.83
87.84 val SOME r = nex revsets t;
87.85 val (r,(t,asm))::_ = loc revsets t r;
87.86 - UnparseC.term_in_ctxt @{context} t;
87.87 + UnparseC.term @{context} t;
87.88
87.89 ------ revset ----------------------------------------------------
87.90 /// [Thm ("sym_real_add_zero_left", "?z = 0 + ?z"),
87.91 @@ -737,7 +737,7 @@
87.92 val thm = (mk_thm thy "(-6) * x = 2 * ((-3) * x)")
87.93 handle e => OldGoals.print_exn e;
87.94 val SOME (t',_) = rewrite_ thy e_rew_ord Rule_Set.empty false thm t;
87.95 - UnparseC.term_in_ctxt @{context} t';
87.96 + UnparseC.term @{context} t';
87.97 ----------------------------------------------------------------------*)
87.98
87.99
87.100 @@ -747,52 +747,52 @@
87.101 val t1 = (Thm.term_of o the o (TermC.parse thy)) "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
87.102 val SOME (t1',rest)= cancel_ thy t1;
87.103 val SOME (t1'',_)= factor_out_gcd_ thy t1;
87.104 -print(UnparseC.term_in_ctxt @{context} t1'^" + Einschr\"ankung: "^UnparseC.term_in_ctxt @{context} (hd(rest)));
87.105 -UnparseC.term_in_ctxt @{context} t1'';
87.106 +print(UnparseC.term @{context} t1'^" + Einschr\"ankung: "^UnparseC.term @{context} (hd(rest)));
87.107 +UnparseC.term @{context} t1'';
87.108
87.109 val t1 = (Thm.term_of o the o (TermC.parse thy)) "((-3 * x \<up> 2 + 6 *x - 3) / (2*x - 2))";
87.110 val SOME (t1',_)= cancel_ thy t1;
87.111 val SOME (t1'',_)= factor_expanded_ thy t1;
87.112 -UnparseC.term_in_ctxt @{context} t1';
87.113 -UnparseC.term_in_ctxt @{context} t1'';
87.114 +UnparseC.term @{context} t1';
87.115 +UnparseC.term @{context} t1'';
87.116
87.117 val t2 = (Thm.term_of o the o (TermC.parse thy)) "((x+ (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
87.118 val SOME (t2',_) = add_fractions_ thy t2;
87.119 val SOME (t2'',_) = common_nominators_ thy t2;
87.120 -UnparseC.term_in_ctxt @{context} t2';
87.121 -UnparseC.term_in_ctxt @{context} t2'';
87.122 +UnparseC.term @{context} t2';
87.123 +UnparseC.term @{context} t2'';
87.124
87.125 val t2 = (Thm.term_of o the o (TermC.parse thy)) "((x - 1) / (x + 1)) + ((x + 1) / (x - 1))";
87.126 val SOME (t2',_) = add_expanded_frac_ thy t2;
87.127 val SOME (t2'',_) = common_expanded_nom_ thy t2;
87.128 -UnparseC.term_in_ctxt @{context} t2';
87.129 -UnparseC.term_in_ctxt @{context} t2'';
87.130 +UnparseC.term @{context} t2';
87.131 +UnparseC.term @{context} t2'';
87.132
87.133
87.134 val t3 = (Thm.term_of o the o (TermC.parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x + (- 2))) + ((1) / ( x \<up> 2 + (- 1)))+((1) / (x \<up> 2 + (- 2)*x + 1))";
87.135 val SOME (t3',_) = common_nominators_ thy t3;
87.136 val SOME (t3'',_) = add_fractions_ thy t3;
87.137 -(UnparseC.term_in_ctxt @{context} t3');
87.138 -(UnparseC.term_in_ctxt @{context} t3'');
87.139 +(UnparseC.term @{context} t3');
87.140 +(UnparseC.term @{context} t3'');
87.141
87.142 val t3 = (Thm.term_of o the o (TermC.parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x - 2)) + ((1) / ( x \<up> 2 - 1))+((1) / (x \<up> 2 - 2 * x + 1))";
87.143 val SOME (t3',_) = common_expanded_nom_ thy t3;
87.144 val SOME (t3'',_) = add_expanded_frac_ thy t3;
87.145 -(UnparseC.term_in_ctxt @{context} t3');
87.146 -(UnparseC.term_in_ctxt @{context} t3'');
87.147 +(UnparseC.term @{context} t3');
87.148 +(UnparseC.term @{context} t3'');
87.149 -------------------------------*)
87.150
87.151 (*
87.152 val SOME(t4,t5) = norm_rational_ thy t3;
87.153 -UnparseC.term_in_ctxt @{context} t4;
87.154 -UnparseC.term_in_ctxt @{context} (hd(t5));*)
87.155 +UnparseC.term @{context} t4;
87.156 +UnparseC.term @{context} (hd(t5));*)
87.157
87.158 (*val test1 = (Thm.term_of o the o (TermC.parse thy)) "1 - x \<up> 2 - 5 * x \<up> 5";
87.159 val test2 = (Thm.term_of o the o (TermC.parse thy)) "1 + (- 1) * x \<up> 2 + (-5) * x \<up> 5";
87.160 val test2 = (Thm.term_of o the o (TermC.parse thy)) "1 - x";
87.161 val test2 = (Thm.term_of o the o (TermC.parse thy)) "1 + (- 1) * x";
87.162 -UnparseC.term_in_ctxt @{context}(expanded2term(test1));
87.163 -UnparseC.term_in_ctxt @{context}(term2expanded(test2)); *)
87.164 +UnparseC.term @{context}(expanded2term(test1));
87.165 +UnparseC.term @{context}(term2expanded(test2)); *)
87.166
87.167
87.168
87.169 @@ -801,8 +801,8 @@
87.170 val t=(Thm.term_of o the o (TermC.parse thy)) "(9 - x \<up> 2)/(9 - 6*x + x \<up> 2)";
87.171 val SOME (t',_) = factout_ thy t;
87.172 val SOME (t'',_) = cancel_ thy t;
87.173 - UnparseC.term_in_ctxt @{context} t';
87.174 - UnparseC.term_in_ctxt @{context} t'';
87.175 + UnparseC.term @{context} t';
87.176 + UnparseC.term @{context} t'';
87.177 "(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
87.178 "(3 + x) / (3 - x)";
87.179
87.180 @@ -810,8 +810,8 @@
87.181 "(9 - x \<up> 2) / (9 - 6*x + x \<up> 2) + 1 / (3 - x)";
87.182 val SOME (t',_) = common_nominator_ thy t;
87.183 val SOME (t'',_) = add_fraction_ thy t;
87.184 - UnparseC.term_in_ctxt @{context} t';
87.185 - UnparseC.term_in_ctxt @{context} t'';
87.186 + UnparseC.term @{context} t';
87.187 + UnparseC.term @{context} t'';
87.188 "(9 - x \<up> 2) / ((3 - x) * (3 - x)) + 1 * (3 - x) / ((3 - x) * (3 - x))";
87.189 "(4 + x) / (3 - x)";
87.190
87.191 @@ -820,8 +820,8 @@
87.192 "(9 - x \<up> 2) / (9 - 6*x + x \<up> 2) + 1";
87.193 val SOME (t',_) = common_nominator_ thy t;
87.194 val SOME (t'',_) = add_fraction_ thy t;
87.195 - UnparseC.term_in_ctxt @{context} t';
87.196 - UnparseC.term_in_ctxt @{context} t'';
87.197 + UnparseC.term @{context} t';
87.198 + UnparseC.term @{context} t'';
87.199 "(9 - x \<up> 2) / (9 - 6 * x + x \<up> 2) +\
87.200 \1 * (9 - 6 * x + x \<up> 2) / (9 - 6 * x + x \<up> 2)";
87.201 "6 / (3 - x)";
87.202 @@ -830,8 +830,8 @@
87.203 "1 + (9 - x \<up> 2) / (9 - 6*x + x \<up> 2)";
87.204 val SOME (t',_) = common_nominator_ thy t;
87.205 val SOME (t'',_) = add_fraction_ thy t;
87.206 - UnparseC.term_in_ctxt @{context} t';
87.207 - UnparseC.term_in_ctxt @{context} t'';
87.208 + UnparseC.term @{context} t';
87.209 + UnparseC.term @{context} t'';
87.210 "1 * (9 - 6 * x + x \<up> 2) / (9 - 6 * x + x \<up> 2) +\
87.211 \(9 - x \<up> 2) / (9 - 6 * x + x \<up> 2)";
87.212 "6 / (3 - x)";
87.213 @@ -841,8 +841,8 @@
87.214 "(y \<up> 2 - x \<up> 2)/(y \<up> 2 - 2*y*x + x \<up> 2)";
87.215 val SOME (t',_) = factout_ thy t;
87.216 val SOME (t'',_) = cancel_ thy t;
87.217 - UnparseC.term_in_ctxt @{context} t';
87.218 - UnparseC.term_in_ctxt @{context} t'';
87.219 + UnparseC.term @{context} t';
87.220 + UnparseC.term @{context} t'';
87.221 "(y + x) * (y - x) / ((y - x) * (y - x))";
87.222 "(y + x) / (y - x)";
87.223
87.224 @@ -850,8 +850,8 @@
87.225 "(y \<up> 2 - x \<up> 2)/(y \<up> 2 - 2*y*x + x \<up> 2) + 1 / (y - x)";
87.226 val SOME (t',_) = common_nominator_ thy t;
87.227 val SOME (t'',_) = add_fraction_ thy t;
87.228 - UnparseC.term_in_ctxt @{context} t';
87.229 - UnparseC.term_in_ctxt @{context} t'';
87.230 + UnparseC.term @{context} t';
87.231 + UnparseC.term @{context} t'';
87.232 "((- 1) * x \<up> 2 + y \<up> 2) / (((- 1) * x + y) * ((- 1) * x + y)) +\
87.233 \1 * ((- 1) * x + y) / (((- 1) * x + y) * ((- 1) * x + y))";
87.234 "((- 1) - x - y) / (x - y)";
87.235 @@ -861,8 +861,8 @@
87.236 "(x \<up> 2 - y \<up> 2)/(x \<up> 2 - 2*x*y + y \<up> 2) + 1 / (x - y)";
87.237 val SOME (t',_) = common_nominator_ thy t;
87.238 val SOME (t'',_) = add_fraction_ thy t;
87.239 - UnparseC.term_in_ctxt @{context} t';
87.240 - UnparseC.term_in_ctxt @{context} t'';
87.241 + UnparseC.term @{context} t';
87.242 + UnparseC.term @{context} t'';
87.243 "((- 1) * y \<up> 2 + x \<up> 2) / (((- 1) * y + x) * ((- 1) * y + x)) +\
87.244 \1 * ((- 1) * y + x) / (((- 1) * y + x) * ((- 1) * y + x))";
87.245 "((- 1) - y - x) / (y - x)";
87.246 @@ -871,20 +871,20 @@
87.247 val t=(Thm.term_of o the o (TermC.parse thy))
87.248 "(y \<up> 2 - x \<up> 2)/(y \<up> 2 - 2*y*x + x \<up> 2)";
87.249 val SOME (t',_) = norm_expanded_rat_ thy t;
87.250 - UnparseC.term_in_ctxt @{context} t';
87.251 + UnparseC.term @{context} t';
87.252 "(y + x) / (y - x)";
87.253 (*val SOME (t'',_) = norm_rational_ thy t;
87.254 - UnparseC.term_in_ctxt @{context} t'';
87.255 + UnparseC.term @{context} t'';
87.256 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
87.257 WN.16.10.02 ?!*)
87.258
87.259 val t=(Thm.term_of o the o (TermC.parse thy))
87.260 "(9 - x \<up> 2)/(9 - 6*x + x \<up> 2) + (1)/(3 + x)";
87.261 val SOME (t',_) = norm_expanded_rat_ thy t;
87.262 - UnparseC.term_in_ctxt @{context} t';
87.263 + UnparseC.term @{context} t';
87.264 "(12 + 5 * x + x \<up> 2) / (9 - x \<up> 2)";
87.265 (*val SOME (t'',_) = norm_rational_ thy t;
87.266 - UnparseC.term_in_ctxt @{context} t'';
87.267 + UnparseC.term @{context} t'';
87.268 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
87.269 WN.16.10.02 ?!*)
87.270
87.271 @@ -892,8 +892,8 @@
87.272 "(9 + (- 1)* x \<up> 2)/(9 + (- 1)* 6*x + x \<up> 2) + (1)/(3 + x)";
87.273 val SOME (t',_) = norm_expanded_rat_ thy t;
87.274 val SOME (t'',_) = norm_rational_ thy t;
87.275 - UnparseC.term_in_ctxt @{context} t';
87.276 - UnparseC.term_in_ctxt @{context} t'';
87.277 + UnparseC.term @{context} t';
87.278 + UnparseC.term @{context} t'';
87.279 "(12 + 5 * x + x \<up> 2) / (9 - x \<up> 2)";
87.280 "(12 + 5 * x + x \<up> 2) / (9 + (- 1) * x \<up> 2)";
87.281 (* WN kopiert 16.10.02 Rational.ML -> rational.sml----- \<up> ---*)
88.1 --- a/test/Tools/isac/Knowledge/rlang.sml Sat Feb 04 16:49:08 2023 +0100
88.2 +++ b/test/Tools/isac/Knowledge/rlang.sml Sat Feb 04 17:00:25 2023 +0100
88.3 @@ -191,12 +191,12 @@
88.4 val t = (Thm.term_of o the o (TermC.parse thy)) "3 * x / 5";
88.5 val SOME (t',_) = rewrite_set_inst_ PolyEq.thy true
88.6 [ (bdv, v) ] make_ratpoly_in t;
88.7 -if UnparseC.term_in_ctxt @{context} t' = "3 / 5 * x" then () else error "rlang.sml: 1";
88.8 +if UnparseC.term @{context} t' = "3 / 5 * x" then () else error "rlang.sml: 1";
88.9
88.10 val t = ParseC.parse_test @{context} "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
88.11 val subst = [(ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "x")];
88.12 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
88.13 -if UnparseC.term_in_ctxt @{context} t' = "1 / 18 = 0" then () else error "rlang.sml: 2";
88.14 +if UnparseC.term @{context} t' = "1 / 18 = 0" then () else error "rlang.sml: 2";
88.15 (*WN---^ *)
88.16
88.17 (*----------------- Schalk I s.87 Bsp 36b ------------------------*)
88.18 @@ -229,8 +229,8 @@
88.19 val t = ParseC.parse_test @{context} "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
88.20 val subst = [(ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "x")];
88.21 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
88.22 -UnparseC.term_in_ctxt @{context} t';
88.23 -if UnparseC.term_in_ctxt @{context} t' = "79 / 12 + 65 / 36 * x = 0" then ()
88.24 +UnparseC.term @{context} t';
88.25 +if UnparseC.term @{context} t' = "79 / 12 + 65 / 36 * x = 0" then ()
88.26 else error "rlang.sml: 3";
88.27 (*WN---^ *)
88.28
88.29 @@ -341,13 +341,13 @@
88.30 val t = ParseC.parse_test @{context} "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 - (6*x) \<up> 2 + 29";
88.31 val subst = [(ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "x")];
88.32 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
88.33 -if UnparseC.term_in_ctxt @{context} t' = "23 + 35 * x + -72 * x \<up> 2" then ()
88.34 +if UnparseC.term @{context} t' = "23 + 35 * x + -72 * x \<up> 2" then ()
88.35 else error "rlang.sml: 4";
88.36
88.37 val t = ParseC.parse_test @{context} "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 + (6*x) \<up> 2 - 29";
88.38 val subst = [(ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "x")];
88.39 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
88.40 -if UnparseC.term_in_ctxt @{context} t' = "-35 + 35 * x" then ()
88.41 +if UnparseC.term @{context} t' = "-35 + 35 * x" then ()
88.42 else error "rlang.sml: 4.1";
88.43 (*WN---^ *)
88.44
88.45 @@ -669,8 +669,8 @@
88.46 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;Ctree.get_assumptions pt p;
88.47 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;Ctree.get_assumptions pt p;
88.48 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;Ctree.get_assumptions pt p;
88.49 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;UnparseC.terms_in_ctxt @{context} (*WN1104changed*) (Ctree.get_assumptions pt p);
88.50 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;UnparseC.terms_in_ctxt @{context} (*WN1104changed*) (Ctree.get_assumptions pt p);
88.51 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;UnparseC.terms @{context} (*WN1104changed*) (Ctree.get_assumptions pt p);
88.52 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;UnparseC.terms @{context} (*WN1104changed*) (Ctree.get_assumptions pt p);
88.53
88.54 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;Ctree.get_assumptions pt p;
88.55 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;Ctree.get_assumptions pt p;
88.56 @@ -814,7 +814,7 @@
88.57 then writeln "only [x = 4] !\nonly [x = 4] !\nonly [x = 4] !\n"
88.58 else error "rlang.sml: diff.behav. in II 68a";
88.59 val asms = Ctree.get_assumptions pt p;
88.60 -if UnparseC.terms_in_ctxt @{context} (*WN1104changed*) asms =
88.61 +if UnparseC.terms @{context} (*WN1104changed*) asms =
88.62 "[0 <= (25 * (1 / 9) + - 1 * (16 + 49 * (1 / 9))) * -56,\
88.63 \0 <= 1 / 9,\
88.64 \0 <= 1 / 9,\
88.65 @@ -1332,7 +1332,7 @@
88.66 val t = ParseC.parse_test @{context}"(a + b * x) / (a + - 1 * (b * x)) + - 1 * (a + - 1 * (b * x)) / (a + b * x) =\n4 * a * b / (a \<up> 2 + - 1 * b \<up> 2)";
88.67 Rewrite.trace_on := false; (*true false*)
88.68 val SOME (t',asm) = rewrite_set_ thy false norm_Rational t;
88.69 -UnparseC.term_in_ctxt @{context} t';
88.70 +UnparseC.term @{context} t';
88.71 Rewrite.trace_on:=false; (*true false*)
88.72
88.73 # rls: norm_Rational on: (a + b * x) / (a + - 1 * (b * x)) + - 1 * (a + - 1 * (b * x)) / (a + b * x) = 4 * a * b / (a \<up> 2 + - 1 * b \<up> 2)
88.74 @@ -1526,7 +1526,7 @@
88.75 val t = ParseC.parse_test @{context} "(2*x+1)*x \<up> 2 = 0";
88.76 val subst = [(ParseC.parse_test @{context} "bdv", ParseC.parse_test @{context} "x")];
88.77 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
88.78 -if UnparseC.term_in_ctxt @{context} t' = "x \<up> 2 + 2 * x \<up> 3 = 0" then ()
88.79 +if UnparseC.term @{context} t' = "x \<up> 2 + 2 * x \<up> 3 = 0" then ()
88.80 else error "rlang.sml: 7";
88.81 *)
88.82 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
88.83 @@ -1551,7 +1551,7 @@
88.84 "(3 + - 1 * x + 1 * x \<up> 2) / (9 * x + -6 * x \<up> 2 + 1 * x \<up> 3) = 1 / x";
88.85 > val SOME (t',asm) =
88.86 rewrite_ thy dummy_ord rateq_erls true rat_mult_denominator_both t;
88.87 -> UnparseC.term_in_ctxt @{context} t'; UnparseC.terms_in_ctxt @{context} asm;
88.88 +> UnparseC.term @{context} t'; UnparseC.terms @{context} asm;
88.89 "(3 + - 1 * x + 1 * x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + 1 * x \<up> 3)"
88.90 "[\"9 * x + -6 * x \<up> 2 + 1 * x \<up> 3 ~= 0\",\"x ~= 0\"]"
88.91 > Rewrite.trace_on:=false; (*true false*)
88.92 @@ -1597,7 +1597,7 @@
88.93 val asms = Ctree.get_assumptions pt p;
88.94 (*if asms = [ParseC.parse_test @{context}"0 <= -4 * (b \<up> 2 / 4 + -4 * r \<up> 2 / 4)",
88.95 ParseC.parse_test @{context}"0 <= -4 * (b \<up> 2 / 4 + -4 * r \<up> 2 / 4)"]*)
88.96 -if UnparseC.terms_in_ctxt @{context} (*WN1104changed*) asms =
88.97 +if UnparseC.terms @{context} (*WN1104changed*) asms =
88.98 "[0 <= -4 * (b \<up> 2 / 4 + - 1 * r \<up> 2 / 1),\
88.99 \0 <= -4 * (b \<up> 2 / 4 + - 1 * r \<up> 2 / 1)]"
88.100 then writeln"simplify result\nsimplify result\nsimplify result"
89.1 --- a/test/Tools/isac/Knowledge/root.sml Sat Feb 04 16:49:08 2023 +0100
89.2 +++ b/test/Tools/isac/Knowledge/root.sml Sat Feb 04 17:00:25 2023 +0100
89.3 @@ -17,12 +17,12 @@
89.4 "----------- rls Root_erls ------------------------------";
89.5 val t = ParseC.parse_test @{context} "sqrt 1";
89.6 val SOME (t',_) = rewrite_set_ ctxt false Root_erls t;
89.7 -if UnparseC.term_in_ctxt @{context} t' = "1" then () else error "root.sml: diff.behav. sqrt 1";
89.8 +if UnparseC.term @{context} t' = "1" then () else error "root.sml: diff.behav. sqrt 1";
89.9
89.10 val t = ParseC.parse_test @{context} "sqrt (- 1)";
89.11 val NONE = rewrite_set_ ctxt false Root_erls t;
89.12
89.13 val t = ParseC.parse_test @{context} "sqrt 0";
89.14 val SOME (t',_) = rewrite_set_ ctxt false Root_erls t;
89.15 -if UnparseC.term_in_ctxt @{context} t' = "0" then () else error "root.sml: diff.behav. sqrt 1";
89.16 +if UnparseC.term @{context} t' = "0" then () else error "root.sml: diff.behav. sqrt 1";
89.17
90.1 --- a/test/Tools/isac/Knowledge/rooteq.sml Sat Feb 04 16:49:08 2023 +0100
90.2 +++ b/test/Tools/isac/Knowledge/rooteq.sml Sat Feb 04 17:00:25 2023 +0100
90.3 @@ -24,62 +24,62 @@
90.4
90.5 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
90.6 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.7 -val result = UnparseC.term_in_ctxt @{context} t_;
90.8 +val result = UnparseC.term @{context} t_;
90.9 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.10
90.11 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
90.12 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.13 -val result = UnparseC.term_in_ctxt @{context} t_;
90.14 +val result = UnparseC.term @{context} t_;
90.15 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.16
90.17 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(nroot 5 (x+4)) is_rootTerm_in x";
90.18 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.19 -val result = UnparseC.term_in_ctxt @{context} t_;
90.20 +val result = UnparseC.term @{context} t_;
90.21 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.22
90.23 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(2+x+3)) is_sqrtTerm_in x";
90.24 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.25 -val result = UnparseC.term_in_ctxt @{context} t_;
90.26 +val result = UnparseC.term @{context} t_;
90.27 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.28
90.29 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(25)) is_sqrtTerm_in x";
90.30 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.31 -val result = UnparseC.term_in_ctxt @{context} t_;
90.32 +val result = UnparseC.term @{context} t_;
90.33 if result <> \<^const_name>\<open>False\<close> then error "rooteq.sml: new behaviour:" else ();
90.34
90.35 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "sqrt(1 + x) is_normSqrtTerm_in x";
90.36 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.37 -val result = UnparseC.term_in_ctxt @{context} t_;
90.38 +val result = UnparseC.term @{context} t_;
90.39 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.40
90.41 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(3+3*sqrt(x)) is_normSqrtTerm_in x";
90.42 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.43 -val result = UnparseC.term_in_ctxt @{context} t_;
90.44 +val result = UnparseC.term @{context} t_;
90.45 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.46
90.47 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(x+1)+1) is_normSqrtTerm_in x";
90.48 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.49 -val result = UnparseC.term_in_ctxt @{context} t_;
90.50 +val result = UnparseC.term @{context} t_;
90.51 if result <> \<^const_name>\<open>False\<close> then error "rooteq.sml: new behaviour:" else ();
90.52
90.53 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(1 - u/(sqrt(r - u))) is_normSqrtTerm_in u";
90.54 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.55 -val result = UnparseC.term_in_ctxt @{context} t_;
90.56 +val result = UnparseC.term @{context} t_;
90.57 if result <> \<^const_name>\<open>False\<close> then error "rooteq.sml: new behaviour:" else ();
90.58
90.59 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(x*(1+x)/(sqrt(x+1))) is_normSqrtTerm_in x";
90.60 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.61 -val result = UnparseC.term_in_ctxt @{context} t_;
90.62 +val result = UnparseC.term @{context} t_;
90.63 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.64
90.65 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(1 - (sqrt(2+x+3) \<up> 3)) is_normSqrtTerm_in x";
90.66 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.67 -val result = UnparseC.term_in_ctxt @{context} t_;
90.68 +val result = UnparseC.term @{context} t_;
90.69 if result <> \<^const_name>\<open>False\<close> then error "rooteq.sml: new behaviour:" else ();
90.70
90.71 val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(1 + (sqrt(2+x+3) \<up> 3)) is_normSqrtTerm_in x";
90.72 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
90.73 -val result = UnparseC.term_in_ctxt @{context} t_;
90.74 +val result = UnparseC.term @{context} t_;
90.75 if result <> \<^const_name>\<open>True\<close> then error "rooteq.sml: new behaviour:" else ();
90.76
90.77
90.78 @@ -134,7 +134,7 @@
90.79 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
90.80 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 25]")) => ()
90.81 | _ => error "rooteq.sml: diff.behav. [x = 1 / 25]";
90.82 -if UnparseC.terms_in_ctxt @{context} (*WN1104changed*) (Ctree.get_assumptions pt p) = "[0 <= 1 / 25]"
90.83 +if UnparseC.terms @{context} (*WN1104changed*) (Ctree.get_assumptions pt p) = "[0 <= 1 / 25]"
90.84 (*WN050916 before correction 'rewrite__set_ called with 'Rule_Set.Empty' for ..:
90.85 [(ParseC.parse_test @{context}"25 ~= 0",[])] *)
90.86 then writeln "should be True\n\
90.87 @@ -549,7 +549,7 @@
90.88 ("Test",["sqroot-test", "univariate", "equation", "test"],
90.89 ["Test", "square_equation2"]);
90.90 val Prog sc = (#program o MethodC.from_store ctxt) ["Test", "square_equation2"];
90.91 -(writeln o UnparseC.term_in_ctxt @{context}) sc;
90.92 +(writeln o UnparseC.term @{context}) sc;
90.93
90.94 val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
90.95 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
90.96 @@ -686,7 +686,7 @@
90.97 ("Test",["squareroot", "univariate", "equation", "test"],
90.98 ["Test", "square_equation"]);
90.99 val Prog sc = (#program o MethodC.from_store ctxt) ["Test", "square_equation"];
90.100 - (writeln o UnparseC.term_in_ctxt @{context}) sc;
90.101 + (writeln o UnparseC.term @{context}) sc;
90.102
90.103 val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
90.104 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
91.1 --- a/test/Tools/isac/Knowledge/rootrat.sml Sat Feb 04 16:49:08 2023 +0100
91.2 +++ b/test/Tools/isac/Knowledge/rootrat.sml Sat Feb 04 17:00:25 2023 +0100
91.3 @@ -27,14 +27,14 @@
91.4
91.5 val rls = calculate_Rational;
91.6 val SOME (t', asm) = rewrite_set_ ctxt true rls t;
91.7 -if UnparseC.term_in_ctxt @{context} t' =
91.8 +if UnparseC.term @{context} t' =
91.9 "- 1 * x = - 1 + sqrt (2 \<up> 2 / 2 \<up> 2 - - 8) \<or>\nx = - 1 * (- 1 + - 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - - 8))"
91.10 (*"- 1 * x = - 1 + sqrt (1 \<up> 2 - -8) | x = - 1 * (- 1 + - 1 * sqrt (1 \<up> 2 - -8))" (*1*)*)
91.11 then () else error "rls calculate_Rational CHANGED";
91.12
91.13 val rls = calculate_RootRat;
91.14 val SOME (t, asm) = rewrite_set_ ctxt true rls t;
91.15 -if UnparseC.term_in_ctxt @{context} t =
91.16 +if UnparseC.term @{context} t =
91.17 "- 1 * x = - 1 + sqrt (2 \<up> 2 / 2 \<up> 2 - - 8) \<or>\nx = - 1 * - 1 + - 1 * (- 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - - 8))"
91.18 then () else error "rls calculate_RootRat CHANGED";
91.19
92.1 --- a/test/Tools/isac/Knowledge/rootrateq.sml Sat Feb 04 16:49:08 2023 +0100
92.2 +++ b/test/Tools/isac/Knowledge/rootrateq.sml Sat Feb 04 17:00:25 2023 +0100
92.3 @@ -30,37 +30,37 @@
92.4 "------------ tests on predicates -------------------------------";
92.5 val t1 = ParseC.parse_test ctxt "(-8 - sqrt(x) + x \<up> 2) is_rootRatAddTerm_in x";
92.6 val SOME (t,_) = rewrite_set_ ctxt false RootRatEq_prls t1;
92.7 -if (UnparseC.term_in_ctxt @{context} t) = "False" then ()
92.8 +if (UnparseC.term @{context} t) = "False" then ()
92.9 else error "rootrateq.sml: diff.behav. 1 in is_rootRatAddTerm_in";
92.10
92.11 val t1 = ParseC.parse_test ctxt "(1/x) is_rootRatAddTerm_in x";
92.12 val SOME (t,_) = rewrite_set_ ctxt false RootRatEq_prls t1;
92.13 -if (UnparseC.term_in_ctxt @{context} t) = "False" then ()
92.14 +if (UnparseC.term @{context} t) = "False" then ()
92.15 else error "rootrateq.sml: diff.behav. 2 in is_rootRatAddTerm_in";
92.16
92.17 val t1 = ParseC.parse_test ctxt "(1/sqrt(x)) is_rootRatAddTerm_in x";
92.18 val SOME (t,_) = rewrite_set_ ctxt false RootRatEq_prls t1;
92.19 -if (UnparseC.term_in_ctxt @{context} t) = "False" then ()
92.20 +if (UnparseC.term @{context} t) = "False" then ()
92.21 else error "rootrateq.sml: diff.behav. 3 in is_rootRatAddTerm_in";
92.22
92.23 val t1 = ParseC.parse_test ctxt "(1/(sqrt(x)+1)) is_rootRatAddTerm_in x";
92.24 val SOME (t,_) = rewrite_set_ ctxt false RootRatEq_prls t1;
92.25 -if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
92.26 +if (UnparseC.term @{context} t) = "True" then ()
92.27 else error "rootrateq.sml: diff.behav. 4 in is_rootRatAddTerm_in";
92.28
92.29 val t1 = ParseC.parse_test ctxt "(3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
92.30 val SOME (t,_) = rewrite_set_ ctxt false RootRatEq_prls t1;
92.31 -if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
92.32 +if (UnparseC.term @{context} t) = "True" then ()
92.33 else error "rootrateq.sml: diff.behav. 5 in is_rootRatAddTerm_in";
92.34
92.35 val t1 = ParseC.parse_test ctxt "(1/(1+sqrt(y)) + 3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
92.36 val SOME (t,_) = rewrite_set_ ctxt false RootRatEq_prls t1;
92.37 -if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
92.38 +if (UnparseC.term @{context} t) = "True" then ()
92.39 else error "rootrateq.sml: diff.behav. 6 in is_rootRatAddTerm_in";
92.40
92.41 val t1 = ParseC.parse_test ctxt "(1/(1+sqrt(x)) + 3 + 1/(1+sqrt(y))) is_rootRatAddTerm_in x";
92.42 val SOME (t,_) = rewrite_set_ ctxt false RootRatEq_prls t1;
92.43 -if (UnparseC.term_in_ctxt @{context} t) = "True" then ()
92.44 +if (UnparseC.term @{context} t) = "True" then ()
92.45 else error "rootrateq.sml: diff.behav. 7 in is_rootRatAddTerm_in";
92.46
92.47 "------------ test thm rootrat_equation_left_1 -------------------";
92.48 @@ -98,7 +98,7 @@
92.49 (*... these ar the step's arguments; from these we do directly ...*)
92.50 val SOME t = ParseC.term_opt ctxt "1 = 2 * (1 + - 1 * sqrt x)"
92.51 val SOME (t, _) = rewrite_set_ thy true make_rooteq t;
92.52 -UnparseC.term_in_ctxt @{context} t = "1 = 2 + - 2 * sqrt x";
92.53 +UnparseC.term @{context} t = "1 = 2 + - 2 * sqrt x";
92.54 (*... which works; thus error must be in script interpretation*)
92.55
92.56 "~~~~~ fun me, args:"; val (tac, (p:pos'), _, (pt:ctree)) = (nxt, p, c, pt);
92.57 @@ -118,7 +118,7 @@
92.58 val t = ParseC.parse_test @{context} ("((lhs (1 = 2 * (1 + - 1 * sqrt x))) is_sqrtTerm_in x) |" ^
92.59 " ((rhs (1 = 2 * (1 + - 1 * sqrt x))) is_sqrtTerm_in x)");
92.60 val SOME (t, _) = rewrite_set_ thy true rooteq_srls t;
92.61 -UnparseC.term_in_ctxt @{context} t = "True | True"; (*...was same in 2002 (NOT "True"); so program seems to take
92.62 +UnparseC.term @{context} t = "True | True"; (*...was same in 2002 (NOT "True"); so program seems to take
92.63 [univariate,equation] and to refine to ["sq", "rootX", "univariate", "equation"] in 2002*)
92.64
92.65 (*(*these are the errors during stepping into the code:*)
93.1 --- a/test/Tools/isac/Knowledge/simplify.sml Sat Feb 04 16:49:08 2023 +0100
93.2 +++ b/test/Tools/isac/Knowledge/simplify.sml Sat Feb 04 17:00:25 2023 +0100
93.3 @@ -31,8 +31,8 @@
93.4 autoCalculate 1 (Steps 1);
93.5 autoCalculate 1 CompleteCalc;
93.6 val ((pt,p),_) = States.get_calc 1;
93.7 - val Form res = (#1 o ME_Misc.pt_extract) (pt, ([],Res)); Test_Tool.show_pt pt; UnparseC.term_in_ctxt @{context} res;
93.8 - if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} res = "5 * a" then ()
93.9 + val Form res = (#1 o ME_Misc.pt_extract) (pt, ([],Res)); Test_Tool.show_pt pt; UnparseC.term @{context} res;
93.10 + if p = ([], Res) andalso UnparseC.term @{context} res = "5 * a" then ()
93.11 else error "simplify.sml: diff.behav. CAScmd: Simplify (2*a + 3*a)";
93.12 *)
93.13
93.14 @@ -148,6 +148,6 @@
93.15 (([], Res), 14)] *)
93.16 val Form res = (#1 o (ME_Misc.pt_extract ctxt)) (pt, ([],Res));
93.17
93.18 -if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} res = "14" then ()
93.19 +if p = ([], Res) andalso UnparseC.term @{context} res = "14" then ()
93.20 else error "simplify.sml: append inform with final result changed";
93.21
94.1 --- a/test/Tools/isac/Knowledge/system.sml Sat Feb 04 16:49:08 2023 +0100
94.2 +++ b/test/Tools/isac/Knowledge/system.sml Sat Feb 04 17:00:25 2023 +0100
94.3 @@ -22,14 +22,14 @@
94.4 val t = ParseC.parse_test @{context} "[0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
94.5 \ 0 = c*L + - 1*q_0*(L \<up> 2 / 2) + c_2]";
94.6 val SOME (t,_) = rewrite_set_ thy false norm_Poly t;
94.7 -if UnparseC.term_in_ctxt @{context} t =
94.8 +if UnparseC.term @{context} t =
94.9 "[0 = - 1 * q_0 * (0 / 2) + c_2, 0 = L * c + - 1 * q_0 * (L \<up> 2 / 2) + c_2]"
94.10 then () else error "system.sml, diff.behav. in norm_Poly";
94.11
94.12 val t = ParseC.parse_test @{context} "[0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
94.13 \ 0 = c*L + - 1*q_0*(L \<up> 2 / 2) + c_2]";
94.14 val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
94.15 -if UnparseC.term_in_ctxt @{context} t =
94.16 +if UnparseC.term @{context} t =
94.17 "[0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]"
94.18 then () else error "system.sml, diff.behav. in norm_Rational";
94.19
94.20 @@ -37,7 +37,7 @@
94.21 val t = ParseC.parse_test @{context} "nth_ 1 [0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
94.22 \ 0 = c*L + - 1*q_0*(L \<up> 2 / 2) + c_2]";
94.23 val SOME (t,_) = rewrite_set_ thy false prog_expr t;
94.24 -if UnparseC.term_in_ctxt @{context} t = "0 = c * 0 + - 1 * q_0 * (0 \<up> 2 / 2) + c_2"
94.25 +if UnparseC.term @{context} t = "0 = c * 0 + - 1 * q_0 * (0 \<up> 2 / 2) + c_2"
94.26 then () else error "system.sml, prog_expr";
94.27
94.28
95.1 --- a/test/Tools/isac/MathEngBasic/ctree.sml Sat Feb 04 16:49:08 2023 +0100
95.2 +++ b/test/Tools/isac/MathEngBasic/ctree.sml Sat Feb 04 17:00:25 2023 +0100
95.3 @@ -225,7 +225,7 @@
95.4 val (res,asm) = get_obj g_result pt' [];
95.5
95.6 (*============ inhibit exn AK110726 ==============================================
95.7 -if UnparseC.term_in_ctxt @{context} res = "[x = 1]" (*WN050219 TermC.empty in cut_tree!!!*) then () else
95.8 +if UnparseC.term @{context} res = "[x = 1]" (*WN050219 TermC.empty in cut_tree!!!*) then () else
95.9 error "ctree.sml: diff:behav. in cut_level 1ab";
95.10 ============ inhibit exn AK110726 ==============================================*)
95.11 (*============ inhibit exn AK110726 ==============================================
95.12 @@ -288,7 +288,7 @@
95.13
95.14 (*============ inhibit exn AK110726 ==============================================
95.15 val form = get_obj g_form pt' [2];
95.16 -if UnparseC.term_in_ctxt @{context} form = "x + 1 + - 1 * 2 = 0" (*remained !!!*) then () else
95.17 +if UnparseC.term @{context} form = "x + 1 + - 1 * 2 = 0" (*remained !!!*) then () else
95.18 error "ctree.sml: diff:behav. in cut_tree 1ab";
95.19 ============ inhibit exn AK110726 ==============================================*)
95.20 (* AK110727 Debuging
95.21 @@ -394,7 +394,7 @@
95.22 val ((pt,_),_) = States.get_calc 1;
95.23 Test_Tool.show_pt pt;
95.24
95.25 -if (UnparseC.term_in_ctxt @{context} o fst) (get_obj g_result pt [3,2,1]) = "x = 0 + 1" then ()
95.26 +if (UnparseC.term @{context} o fst) (get_obj g_result pt [3,2,1]) = "x = 0 + 1" then ()
95.27 else error "mini-subpbl interSteps broken";
95.28
95.29 "-------------- cut_tree (intermedi.ctree: 3rd level)-------------";
95.30 @@ -428,9 +428,9 @@
95.31 ([4], Res),
95.32 ([], Res)]
95.33 then () else error "ctree.sml: diff:behav. in cappend_form";
95.34 -if UnparseC.term_in_ctxt @{context} (get_obj g_form pt' [3,2,1]) = "newnew" andalso
95.35 +if UnparseC.term @{context} (get_obj g_form pt' [3,2,1]) = "newnew" andalso
95.36 get_obj g_tac pt' [3,2,1] = Empty_Tac andalso
95.37 - UnparseC.term_in_ctxt @{context} (fst (get_obj g_result pt' [3,2,1])) = "??.empty"
95.38 + UnparseC.term @{context} (fst (get_obj g_result pt' [3,2,1])) = "??.empty"
95.39 then () else error "ctree.sml: diff:behav. in cappend 1";
95.40
95.41 val (pt',cuts) = cappend_atomic pt [3,2,1] Istate.empty (ParseC.parse_test @{context} "newform")
95.42 @@ -475,7 +475,7 @@
95.43 val (pt,cuts) = cappend_form pt (fst p) Istate.empty (ParseC.parse_test @{context} "x + 1 = 2");
95.44 val form = get_obj g_form pt (fst p);
95.45 val (res,_) = get_obj g_result pt (fst p);
95.46 -if UnparseC.term_in_ctxt @{context} form = "x + 1 = 2" andalso res = TermC.empty then () else
95.47 +if UnparseC.term @{context} form = "x + 1 = 2" andalso res = TermC.empty then () else
95.48 error "ctree.sml, diff.behav. cappend minisubpbl ([1],Frm)";
95.49 if not (existpt ((lev_on o fst) p) pt) then () else
95.50 error "ctree.sml, diff.behav. cappend minisubpbl ([1],Frm) nxt";
95.51 @@ -487,7 +487,7 @@
95.52 Empty_Tac (ParseC.parse_test @{context} "x + 1 + - 1 * 2 = 0",[]) Incomplete;
95.53 val form = get_obj g_form pt (fst p);
95.54 val (res,_) = get_obj g_result pt (fst p);
95.55 -if UnparseC.term_in_ctxt @{context} form = "x + 1 = 2" andalso UnparseC.term_in_ctxt @{context} res = "x + 1 + - 1 * 2 = 0"
95.56 +if UnparseC.term @{context} form = "x + 1 = 2" andalso UnparseC.term @{context} res = "x + 1 + - 1 * 2 = 0"
95.57 then () else error "ctree.sml, diff.behav. cappend minisubpbl ([1],Res)";
95.58 if not (existpt ((lev_on o fst) p) pt) then () else
95.59 error "ctree.sml, diff.behav. cappend minisubpbl ([1],Res) nxt";
95.60 @@ -499,7 +499,7 @@
95.61 Empty_Tac (ParseC.parse_test @{context} "- 1 + x = 0",[]) Incomplete;
95.62 val form = get_obj g_form pt (fst p);
95.63 val (res,_) = get_obj g_result pt (fst p);
95.64 -if UnparseC.term_in_ctxt @{context} form = "x + 1 + - 1 * 2 = 0" andalso UnparseC.term_in_ctxt @{context} res = "- 1 + x = 0"
95.65 +if UnparseC.term @{context} form = "x + 1 + - 1 * 2 = 0" andalso UnparseC.term @{context} res = "- 1 + x = 0"
95.66 then () else error "ctree.sml, diff.behav. cappend minisubpbl ([2],Res)";
95.67 if not (existpt ((lev_on o fst) p) pt) then () else
95.68 error "ctree.sml, diff.behav. cappend minisubpbl ([2],Res) nxt";
95.69 @@ -520,7 +520,7 @@
95.70 val (pt,cuts) = cappend_form pt (fst p) Istate.empty (ParseC.parse_test @{context} "- 1 + x = 0");
95.71 val form = get_obj g_form pt (fst p);
95.72 val (res,_) = get_obj g_result pt (fst p);
95.73 -if UnparseC.term_in_ctxt @{context} form = "- 1 + x = 0" andalso res = TermC.empty then () else
95.74 +if UnparseC.term @{context} form = "- 1 + x = 0" andalso res = TermC.empty then () else
95.75 error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Frm)";
95.76 if not (existpt ((lev_on o fst) p) pt) then () else
95.77 error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Frm) nxt";
95.78 @@ -532,7 +532,7 @@
95.79 Empty_Tac (ParseC.parse_test @{context} "x = 0 + - 1 * - 1",[]) Incomplete;
95.80 val form = get_obj g_form pt (fst p);
95.81 val (res,_) = get_obj g_result pt (fst p);
95.82 -if UnparseC.term_in_ctxt @{context} form = "- 1 + x = 0" andalso UnparseC.term_in_ctxt @{context} res = "x = 0 + - 1 * - 1" then()
95.83 +if UnparseC.term @{context} form = "- 1 + x = 0" andalso UnparseC.term @{context} res = "x = 0 + - 1 * - 1" then()
95.84 else error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Res)";
95.85 if not (existpt ((lev_on o fst) p) pt) then () else
95.86 error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Res) nxt";
95.87 @@ -571,8 +571,8 @@
95.88 val p = move_dn [] pt p (*-> ([3,1],Res)*);
95.89 val p = move_dn [] pt p (*-> ([3,2],Res)*);
95.90 val p = move_dn [] pt p (*-> ([3],Res)*);
95.91 -(* UnparseC.term_in_ctxt @{context} (get_obj g_res pt [3]);
95.92 - UnparseC.term_in_ctxt @{context} (get_obj g_form pt [4]);
95.93 +(* UnparseC.term @{context} (get_obj g_res pt [3]);
95.94 + UnparseC.term @{context} (get_obj g_form pt [4]);
95.95 *)
95.96 val p = move_dn [] pt p (*-> ([4],Res)*);
95.97 val p = move_dn [] pt p (*-> ([],Res)*);
95.98 @@ -769,13 +769,13 @@
95.99 fun tlq [] = [99999] | tlq [_] = [99999] | tlq x = tl x;
95.100
95.101 (*see modspec.sml#pt_form
95.102 -fun pt_form (PrfObj {form,...}) = UnparseC.term_in_ctxt @{context} form
95.103 +fun pt_form (PrfObj {form,...}) = UnparseC.term @{context} form
95.104 | pt_form (PblObj {probl,spec,origin=(_,spec',_),...}) =
95.105 let val (dI, pI, _) = get_somespec' spec spec'
95.106 val {cas,...} = Problem.from_store pI
95.107 in case cas of
95.108 - NONE => UnparseC.term_in_ctxt @{context} (pblterm dI pI)
95.109 - | SOME t => UnparseC.term_in_ctxt @{context} (subst_atomic (I_Model.environment probl) t)
95.110 + NONE => UnparseC.term @{context} (pblterm dI pI)
95.111 + | SOME t => UnparseC.term @{context} (subst_atomic (I_Model.environment probl) t)
95.112 end;
95.113 *)
95.114 (*.get an 'interval' from ctree down to a certain level
95.115 @@ -888,7 +888,7 @@
95.116 "-------------- ME_Misc.pt_extract form, tac, asm<>[] --------------------";
95.117 "-------------- ME_Misc.pt_extract form, tac, asm<>[] --------------------";
95.118 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([3], Res));
95.119 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.120 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.121 ("(3 + - 1 * x + x \<up> 2) * x = 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)",
95.122 Subproblem
95.123 ("PolyEq",
95.124 @@ -898,7 +898,7 @@
95.125 (*WN060717 unintentionally changed some rls/ord while
95.126 completing knowl. for thes2file...
95.127
95.128 - case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.129 + case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.130 ((*"(3 + (- 1 * x + x \<up> 2)) * x = 1 * (9 * x + (x \<up> 3 + -6 * x \<up> 2))",
95.131 *)Subproblem
95.132 ("PolyEq",
95.133 @@ -926,65 +926,65 @@
95.134 "-------------- ME_Misc.pt_extract form, tac, asm ------------------------";
95.135 "-------------- ME_Misc.pt_extract form, tac, asm ------------------------";
95.136 val (ModSpec (_,_,form,_,_,_), SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([], Frm));
95.137 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.138 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.139 ("solve (x + 1 = 2, x)",
95.140 Apply_Method ["Test", "squ-equ-test-subpbl1"],
95.141 []) => ()
95.142 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([], Pbl)";
95.143
95.144 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([1], Frm));
95.145 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.146 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.147 ("x + 1 = 2", Rewrite_Set "norm_equation", []) => ()
95.148 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([1], Frm)";
95.149
95.150 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([1], Res));
95.151 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.152 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.153 ("x + 1 + - 1 * 2 = 0", Rewrite_Set "Test_simplify", []) => ()
95.154 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([1], Res)";
95.155
95.156 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([2], Res));
95.157 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.158 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.159 ("- 1 + x = 0",
95.160 Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]),
95.161 []) => ()
95.162 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([2], Res)";
95.163
95.164 val (ModSpec (_,_,form,_,_,_), SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([3], Pbl));
95.165 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.166 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.167 ("solve (- 1 + x = 0, x)", Apply_Method ["Test", "solve_linear"], []) => ()
95.168 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([3], Pbl)";
95.169
95.170 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([3,1], Frm));
95.171 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.172 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.173 ("- 1 + x = 0", Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv"), []) => ()
95.174 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([3,1], Frm)";
95.175
95.176 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([3,1], Res));
95.177 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.178 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.179 ("x = 0 + - 1 * - 1", Rewrite_Set "Test_simplify", []) => ()
95.180 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([3,1], Res)";
95.181
95.182 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([3,2], Res));
95.183 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.184 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.185 ("x = 1", Check_Postcond ["LINEAR", "univariate", "equation", "test"],
95.186 []) => ()
95.187 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([3,2], Res)";
95.188
95.189 (*========== inhibit exn AK110719 ==============================================
95.190 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([3], Res));
95.191 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.192 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.193 ("[x = 1]", Check_elementwise "Assumptions", []) => ()
95.194 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([3], Res)";
95.195
95.196 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([4], Res));
95.197 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.198 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.199 ("[x = 1]",
95.200 Check_Postcond ["sqroot-test", "univariate", "equation", "test"],
95.201 []) => ()
95.202 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([4], Res)";
95.203
95.204 val (Form form, tac, asm) = ME_Misc.pt_extract ctxt (pt, ([], Res));
95.205 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.206 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
95.207 ("[x = 1]", NONE, []) => ()
95.208 | _ => error "diff.behav.in ctree.sml: ME_Misc.pt_extract ctxt ([], Res)";
95.209 ========== inhibit exn AK110719 ==============================================*)
95.210 @@ -1214,8 +1214,8 @@
95.211 val p = move_dn [] pt' p (*-> ([2],Frm)*);
95.212 val p = move_dn [] pt' p (*-> ([2],Res)*);
95.213
95.214 - UnparseC.term_in_ctxt @{context} (get_obj g_form pt' [2]);
95.215 - UnparseC.term_in_ctxt @{context} (get_obj g_res pt' [2]);
95.216 + UnparseC.term @{context} (get_obj g_form pt' [2]);
95.217 + UnparseC.term @{context} (get_obj g_res pt' [2]);
95.218 ostate2str (get_obj g_ostate pt' [2]);
95.219 *)
95.220
95.221 @@ -1268,7 +1268,7 @@
95.222 ([3, 1], Frm), ([3, 1], Res)] then () else
95.223 error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] insrtd";
95.224
95.225 -if UnparseC.term_in_ctxt @{context} (get_obj g_form pt' [3,1]) = "Inform [3, 1]" then () else
95.226 +if UnparseC.term @{context} (get_obj g_form pt' [3,1]) = "Inform [3, 1]" then () else
95.227 error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] Inform";
95.228
95.229 "---(6) on S(606)..S(608)--------";
95.230 @@ -1292,7 +1292,7 @@
95.231 then () else
95.232 error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] insrtd";
95.233
95.234 -if UnparseC.term_in_ctxt @{context} (get_obj g_form pt' [3,2]) = "Inform [3, 2]" then () else
95.235 +if UnparseC.term @{context} (get_obj g_form pt' [3,2]) = "Inform [3, 2]" then () else
95.236 error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] Inform";
95.237
95.238 "---(6++) on S(606)..S(608)--------";
95.239 @@ -1317,7 +1317,7 @@
95.240 ([3, 1], Frm), ([3, 1], Res),
95.241 ([3, 2, 1], Frm), ([3, 2, 1], Res)] then () else
95.242 error "ctree.sml: diff:behav. in complete pt: append_atom[3,2,1] insrtd";
95.243 -if UnparseC.term_in_ctxt @{context} (get_obj g_form pt' [3,2,1]) = "Inform [3, 2, 1]" then () else
95.244 +if UnparseC.term @{context} (get_obj g_form pt' [3,2,1]) = "Inform [3, 2, 1]" then () else
95.245 error "ctree.sml: diff:behav. complete pt: append_atomic[3,2,1] Inform";
95.246 (*
95.247 Test_Tool.show_pt pt';
96.1 --- a/test/Tools/isac/MathEngBasic/rewrite.sml Sat Feb 04 16:49:08 2023 +0100
96.2 +++ b/test/Tools/isac/MathEngBasic/rewrite.sml Sat Feb 04 17:00:25 2023 +0100
96.3 @@ -134,13 +134,13 @@
96.4 val prems' = (fst o Logic.strip_prems) (Logic.count_prems rule', [], rule');
96.5 val RHS' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Logic.strip_imp_concl) rule';
96.6
96.7 -(rule' |> UnparseC.term_in_ctxt @{context}) = "x \<noteq> 0 \<Longrightarrow> x / (2 * x) = 1 / 2";
96.8 +(rule' |> UnparseC.term @{context}) = "x \<noteq> 0 \<Longrightarrow> x / (2 * x) = 1 / 2";
96.9 rule';
96.10
96.11 -(rule' |> Logic.strip_imp_concl |> UnparseC.term_in_ctxt @{context}) = "x / (2 * x) = 1 / 2";
96.12 +(rule' |> Logic.strip_imp_concl |> UnparseC.term @{context}) = "x / (2 * x) = 1 / 2";
96.13 rule' |> Logic.strip_imp_concl;
96.14
96.15 -(rule' |> Logic.strip_imp_concl |> UnparseC.term_in_ctxt @{context}) = "x / (2 * x) = 1 / 2";
96.16 +(rule' |> Logic.strip_imp_concl |> UnparseC.term @{context}) = "x / (2 * x) = 1 / 2";
96.17 rule' |> Logic.strip_imp_concl;
96.18
96.19
96.20 @@ -185,14 +185,14 @@
96.21 "~~~~~ fun rew_sub , args:"; val (thy, i, bdv, tless, rls, put_asm, lrd, r, t) =
96.22 (thy, i, bdv, tless, rls, put_asm, ([(*root of the term*)]: TermC.path),
96.23 (TermC.inst_bdv bdv (Eval.norm (Thm.prop_of thm))), ct);
96.24 -(*+*)UnparseC.term_in_ctxt @{context} r = "?b \<noteq> (0::?'a) \<Longrightarrow> ?b / (?a * ?b) = (1::?'a) / ?a";
96.25 +(*+*)UnparseC.term @{context} r = "?b \<noteq> (0::?'a) \<Longrightarrow> ?b / (?a * ?b) = (1::?'a) / ?a";
96.26
96.27 val (lhs, rhs) = (HOLogic.dest_eq o HOLogic.dest_Trueprop o Logic.strip_imp_concl) r;
96.28 -(*+*)(UnparseC.term_in_ctxt @{context} lhs, UnparseC.term_in_ctxt @{context} rhs) = ("?b / (?a * ?b)", "(1::?'a) / ?a");
96.29 +(*+*)(UnparseC.term @{context} lhs, UnparseC.term @{context} rhs) = ("?b / (?a * ?b)", "(1::?'a) / ?a");
96.30 val r' = (Envir.subst_term (Pattern.match thy (lhs, t) (Vartab.empty, Vartab.empty)) r)
96.31 handle Pattern.MATCH => raise NO_REWRITE;
96.32 val p' = map HOLogic.dest_Trueprop ((fst o Logic.strip_prems) (Logic.count_prems r', [], r'));
96.33 -(*+*)UnparseC.term_in_ctxt @{context} r' = "x \<noteq> 0 \<Longrightarrow> x / (2 * x) = 1 / 2";
96.34 +(*+*)UnparseC.term @{context} r' = "x \<noteq> 0 \<Longrightarrow> x / (2 * x) = 1 / 2";
96.35 (*+*)r';
96.36 val t' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Logic.strip_imp_concl) r'
96.37 val _ = trace_in2 ctxt i "eval asms" r';
96.38 @@ -201,7 +201,7 @@
96.39 val (t'', p'') = (trace_in4 ctxt i "asms accepted" p' simpl_p'; (t',simpl_p'));
96.40 (*## asms accepted: [x \<noteq> 0] stored: [x \<noteq> 0] *)
96.41
96.42 -(*+*)if (UnparseC.term_in_ctxt @{context} t'', map (UnparseC.term_in_ctxt @{context}) p'') = ("1 / 2", ["x \<noteq> 0"]) then ()
96.43 +(*+*)if (UnparseC.term @{context} t'', map (UnparseC.term @{context}) p'') = ("1 / 2", ["x \<noteq> 0"]) then ()
96.44 (*+*)else error "conditional rewriting x \<noteq> 0 \<Longrightarrow> x / (2 * x) = 1 / 2 CHANGED";
96.45
96.46
96.47 @@ -218,15 +218,15 @@
96.48 "----- step 1: LHS, RHS of rule";
96.49 val (LHS, RHS) = (HOLogic.dest_eq o HOLogic.dest_Trueprop
96.50 o Logic.strip_imp_concl) r;
96.51 -UnparseC.term_in_ctxt @{context} r = "?b \<noteq> (0::?'a) \<Longrightarrow> ?b / (?a * ?b) = (1::?'a) / ?a";
96.52 -UnparseC.term_in_ctxt @{context} LHS = "?b / (?a * ?b)"; UnparseC.term_in_ctxt @{context} RHS = "(1::?'a) / ?a";
96.53 +UnparseC.term @{context} r = "?b \<noteq> (0::?'a) \<Longrightarrow> ?b / (?a * ?b) = (1::?'a) / ?a";
96.54 +UnparseC.term @{context} LHS = "?b / (?a * ?b)"; UnparseC.term @{context} RHS = "(1::?'a) / ?a";
96.55 "----- step 2: the rule instantiated";
96.56 val r' = Envir.subst_term
96.57 (Pattern.match thy (LHS, t) (Vartab.empty, Vartab.empty)) r;
96.58 -UnparseC.term_in_ctxt @{context} r' = "x \<noteq> 0 \<Longrightarrow> x / (2 * x) = 1 / 2";
96.59 +UnparseC.term @{context} r' = "x \<noteq> 0 \<Longrightarrow> x / (2 * x) = 1 / 2";
96.60 "----- step 3: get the (instantiated) assumption(s)";
96.61 val p' = (fst o Logic.strip_prems) (Logic.count_prems r', [], r');
96.62 -UnparseC.term_in_ctxt @{context} (hd p') = "x \<noteq> 0";
96.63 +UnparseC.term @{context} (hd p') = "x \<noteq> 0";
96.64 "=====vvv make asms without Trueprop ---vvv";
96.65 val p' = map HOLogic.dest_Trueprop ((fst o Logic.strip_prems)
96.66 (Logic.count_prems r', [], r'));
96.67 @@ -238,7 +238,7 @@
96.68 "----- step 4: get the (instantiated) RHS";
96.69 val t' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop
96.70 o Logic.strip_imp_concl) r';
96.71 -UnparseC.term_in_ctxt @{context} t' = "1 / 2";
96.72 +UnparseC.term @{context} t' = "1 / 2";
96.73
96.74 "----------- step through 'fun rewrite_terms_' ------------------------------------------------";
96.75 "----------- step through 'fun rewrite_terms_' ------------------------------------------------";
96.76 @@ -256,21 +256,21 @@
96.77
96.78 val SOME (t', _) = rewrite_terms_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty equs t;
96.79 writeln "---------- rewrite_terms_ 1---------------------------";
96.80 -if UnparseC.term_in_ctxt @{context} t' = "M_b 0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
96.81 +if UnparseC.term @{context} t' = "M_b 0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
96.82 else error "rewrite.sml rewrite_terms_ [x = 0]";
96.83
96.84 val equs = [ParseC.parse_test @{context} "M_b 0 = 0"];
96.85 val t = ParseC.parse_test @{context} "M_b 0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2";
96.86 val SOME (t', _) = rewrite_terms_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty equs t;
96.87 writeln "---------- rewrite_terms_ 2---------------------------";
96.88 -if UnparseC.term_in_ctxt @{context} t' = "0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
96.89 +if UnparseC.term @{context} t' = "0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
96.90 else error "rewrite.sml rewrite_terms_ [M_b 0 = 0]";
96.91
96.92 val equs = [ParseC.parse_test @{context} "x = 0", ParseC.parse_test @{context}"M_b 0 = 0"];
96.93 val t = ParseC.parse_test @{context} "M_b x = - 1 * q_0 * x \<up> 2 / 2 + x * c + c_2";
96.94 val SOME (t', _) = rewrite_terms_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty equs t;
96.95 writeln "---------- rewrite_terms_ 3---------------------------";
96.96 -if UnparseC.term_in_ctxt @{context} t' = "0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
96.97 +if UnparseC.term @{context} t' = "0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
96.98 else error "rewrite.sml rewrite_terms_ [x = 0, M_b 0 = 0]";
96.99
96.100
96.101 @@ -292,8 +292,8 @@
96.102 "#eval_occur_exactly_in_"))
96.103 ])
96.104 false bdvs (ThmC.numerals_to_Free @{separate_bdvs_add) t;
96.105 -(writeln o UnparseC.term_in_ctxt @{context}) t;
96.106 -if UnparseC.term_in_ctxt @{context} t = "L * c_3 + c_4 = 0 + -1 * (-1 * (q_0 * L \<up> 2) / 2)"
96.107 +(writeln o UnparseC.term @{context}) t;
96.108 +if UnparseC.term @{context} t = "L * c_3 + c_4 = 0 + -1 * (-1 * (q_0 * L \<up> 2) / 2)"
96.109 then () else error "rewrite.sml rewrite_inst_ bdvs";
96.110 > Rewrite.trace_on:=true;false
96.111 Rewrite.trace_on:=false;--------------------------------------------*)
96.112 @@ -310,7 +310,7 @@
96.113
96.114 val inst = Pattern.match thy (pat, t) (Vartab.empty, Vartab.empty);
96.115 val preinst = Envir.subst_term inst precond;
96.116 -UnparseC.term_in_ctxt @{context} preinst;
96.117 +UnparseC.term @{context} preinst;
96.118
96.119 "===== Rational.thy: cancel ===";
96.120 (* pat matched with the current term gives an environment
96.121 @@ -326,7 +326,7 @@
96.122
96.123 val subst = Pattern.match thy (pat, t) (Vartab.empty, Vartab.empty);
96.124 val asms = map (Envir.subst_term subst) pres;
96.125 -if UnparseC.terms_in_ctxt @{context} asms = "[a + b is_expanded, c is_expanded]"
96.126 +if UnparseC.terms @{context} asms = "[a + b is_expanded, c is_expanded]"
96.127 then () else error "rewrite.sml: prepat cancel subst";
96.128
96.129 if ([], true) = eval__true ctxt 0 asms [] asm_rls
96.130 @@ -359,7 +359,7 @@
96.131
96.132 val subst = Pattern.match thy (pat, t) (Vartab.empty, Vartab.empty);
96.133 val asms = map (Envir.subst_term subst) pres;
96.134 -if UnparseC.terms_in_ctxt @{context} asms = "[x \<up> 2 * x is_multUnordered]"
96.135 +if UnparseC.terms @{context} asms = "[x \<up> 2 * x is_multUnordered]"
96.136 then () else error "rewrite.sml: prepat order_mult_ subst";
96.137
96.138 if ([], true) = eval__true ctxt 0 asms [] asm_rls
96.139 @@ -399,7 +399,7 @@
96.140 tracing "----- begin rewrite x \<up> 2 * x ---";
96.141 val SOME (t', _) = rewrite_set_ ctxt true order_mult_ t;
96.142 tracing "----- end rewrite x \<up> 2 * x ---";
96.143 -if UnparseC.term_in_ctxt @{context} t' = "x * x \<up> 2" then ()
96.144 +if UnparseC.term @{context} t' = "x * x \<up> 2" then ()
96.145 else error "rewrite.sml Poly.is_multUnordered doesn't work";
96.146
96.147 (* for achieving the previous result, the following code was taken apart *)
96.148 @@ -427,7 +427,7 @@
96.149 (*.apply the normal_form of a rev-set.*)
96.150 fun app_rev' thy (Rrls{asm_rls,prepat,program=Rfuns{normal_form,...},...}) t =
96.151 if chk_prepat thy asm_rls prepat t
96.152 - then ((*tracing("### app_rev': t = "^(UnparseC.term_in_ctxt @{context} t));*)
96.153 + then ((*tracing("### app_rev': t = "^(UnparseC.term @{context} t));*)
96.154 normal_form t)
96.155 else NONE;
96.156 (*fixme val NONE = app_rev' thy rrls t;*)
96.157 @@ -462,7 +462,7 @@
96.158 (*fixme: asms = ["p is_multUnordered"]...instantiate*)
96.159 "----- eval__true ---";
96.160 val asms = (map (Envir.subst_term subst) pres);
96.161 -if UnparseC.terms_in_ctxt @{context} asms = "[x \<up> 2 * x is_multUnordered]" then ()
96.162 +if UnparseC.terms @{context} asms = "[x \<up> 2 * x is_multUnordered]" then ()
96.163 else error "rewrite.sml: diff. is_multUnordered, asms";
96.164 val (thy, i, asms, bdv, rls) =
96.165 (thy, (i+1), [ParseC.parse_test @{context} "(x \<up> 2 * x) is_multUnordered"],
96.166 @@ -572,7 +572,7 @@
96.167 val (lhs, rhs) = (HOLogic.dest_eq o HOLogic.dest_Trueprop o Logic.strip_imp_concl) r
96.168 val r' = Envir.subst_term (Pattern.match thy (lhs, t) (Vartab.empty, Vartab.empty)) r
96.169 ;
96.170 -(*+*)if UnparseC.term_in_ctxt @{context} r' =
96.171 +(*+*)if UnparseC.term @{context} r' =
96.172 (*+*) "\<lbrakk>9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0; x \<noteq> 0\<rbrakk>\n" ^
96.173 (*+*) "\<Longrightarrow> ((3 + -1 * x + x \<up> 2) /\n" ^
96.174 (*+*) " (9 * x + -6 * x \<up> 2 + x \<up> 3) =\n" ^
96.175 @@ -583,12 +583,12 @@
96.176
96.177 val p' = map HOLogic.dest_Trueprop ((fst o Logic.strip_prems) (Logic.count_prems r', [], r'))
96.178 ;
96.179 -(*+*)if map (UnparseC.term_in_ctxt @{context}) p' = ["x \<noteq> 0", "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"]
96.180 +(*+*)if map (UnparseC.term @{context}) p' = ["x \<noteq> 0", "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"]
96.181 (*+*)then () else error "stored assumptions CHANGED";
96.182
96.183 val t' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Logic.strip_imp_concl) r'
96.184 ;
96.185 -(*+*)if UnparseC.term_in_ctxt @{context} t' = "(3 + -1 * x + x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)"
96.186 +(*+*)if UnparseC.term @{context} t' = "(3 + -1 * x + x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)"
96.187 (*+*)then () else error "rewritten term (an equality) CHANGED";
96.188
96.189 val (simpl_p', nofalse) =
96.190 @@ -596,7 +596,7 @@
96.191 "~~~~~ and eval__true , args:"; val (thy, i, asms, bdv, rls) = (thy, (i + 1), p', bdv, rls);
96.192 (*if*) asms = [@{term True}] orelse asms = [] (*else*);
96.193
96.194 -(*+*)if map (UnparseC.term_in_ctxt @{context}) asms = ["x \<noteq> 0", "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"]
96.195 +(*+*)if map (UnparseC.term @{context}) asms = ["x \<noteq> 0", "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"]
96.196 (*+*)then () else error "asms before chk CHANGED";
96.197
96.198 fun chk indets [] = (indets, true) (*return asms<>True until false*)
96.199 @@ -635,7 +635,7 @@
96.200 val (* SOME (t, a') *)NONE = (*case*)
96.201 rewrite__set_ thy (i + 1) false bdv rls a (*of*);
96.202
96.203 -(*+*)UnparseC.term_in_ctxt @{context} a = "x \<noteq> 0"; (* rewrite__set_ \<rightarrow> @{term True} ----------------- SHOULD BE indet !*)
96.204 +(*+*)UnparseC.term @{context} a = "x \<noteq> 0"; (* rewrite__set_ \<rightarrow> @{term True} ----------------- SHOULD BE indet !*)
96.205 (*
96.206 :
96.207 #### rls: rateq_erls on: x \<noteq> 0
96.208 @@ -668,10 +668,10 @@
96.209 val p' = map HOLogic.dest_Trueprop ((fst o Logic.strip_prems) (Logic.count_prems r', [], r'))
96.210 val t' = (snd o HOLogic.dest_eq o Logic.strip_imp_concl o HOLogic.dest_Trueprop) r'
96.211 ;
96.212 -if UnparseC.term_in_ctxt @{context} lhss = "?a * (?b + ?c)" andalso UnparseC.term_in_ctxt @{context} t = "x * (y + z)" then ()
96.213 +if UnparseC.term @{context} lhss = "?a * (?b + ?c)" andalso UnparseC.term @{context} t = "x * (y + z)" then ()
96.214 else error "ARGS FOR Pattern.match CHANGED";
96.215 val match = Pattern.match thy (lhss, t) (Vartab.empty, Vartab.empty);
96.216 -if (Envir.subst_term match r |> UnparseC.term_in_ctxt @{context}) = "x * (y + z) = x * y + x * z" then ()
96.217 +if (Envir.subst_term match r |> UnparseC.term @{context}) = "x * (y + z) = x * y + x * z" then ()
96.218 else error "Pattern.match CHANGED";
96.219
96.220 "----------- fun rewrite_set_ .. norm_equation, ~~~~~ fun rewrite_set_ -------------------------";
96.221 @@ -687,7 +687,7 @@
96.222 exception TERM raised (line 271 of "~~/src/HOL/Tools/hologic.ML"):
96.223 dest_eq
96.224 0 \<le> ?a \<Longrightarrow> (0 \<le> sqrt ?a) = True( **)
96.225 -if UnparseC.term_in_ctxt @{context} t = "x + 1 + - 1 * 2 = 0" then () else error "rewrite_set_ norm_equation CHANGED";
96.226 +if UnparseC.term @{context} t = "x + 1 + - 1 * 2 = 0" then () else error "rewrite_set_ norm_equation CHANGED";
96.227
96.228 "~~~~~ fun rewrite_set_ , args:"; val (thy, bool, rls, term) = (thy, false, rls, term);
96.229 "~~~~~ and rewrite__set_ , args:"; val (thy, i, put_asm, bdv, rls, ct) =
97.1 --- a/test/Tools/isac/MathEngBasic/tactic.sml Sat Feb 04 16:49:08 2023 +0100
97.2 +++ b/test/Tools/isac/MathEngBasic/tactic.sml Sat Feb 04 17:00:25 2023 +0100
97.3 @@ -22,8 +22,8 @@
97.4 Rewrite': ThyC.id * Rewrite_Ord.id * Rule_Set.T * bool * ThmC.T * term * Calc.result -> Tactic.T;
97.5 val tac = Rewrite' ("Diff", "dummy_ord", Rule_Set.empty, true, thm'', f, res)
97.6 ;
97.7 -if (Tactic.result ctxt tac |> UnparseC.term_in_ctxt @{context}) = "a / b" then () else error "creates_assms CHANGED";
97.8 -if (Tactic.creates_assms ctxt tac |> UnparseC.terms_in_ctxt @{context}) = "[k \<noteq> 0]" then () else error "creates_assms CHANGED";
97.9 +if (Tactic.result ctxt tac |> UnparseC.term @{context}) = "a / b" then () else error "creates_assms CHANGED";
97.10 +if (Tactic.creates_assms ctxt tac |> UnparseC.terms @{context}) = "[k \<noteq> 0]" then () else error "creates_assms CHANGED";
97.11
97.12
97.13 "----------- fun subst_adapt_to_type -----------------------------------------------------------";
98.1 --- a/test/Tools/isac/MathEngine/detail-step.sml Sat Feb 04 16:49:08 2023 +0100
98.2 +++ b/test/Tools/isac/MathEngine/detail-step.sml Sat Feb 04 17:00:25 2023 +0100
98.3 @@ -50,7 +50,7 @@
98.4
98.5 autoCalculate 1 CompleteCalc;
98.6 val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
98.7 -val (Form t,_,_) = ME_Misc.pt_extract (pt, p); UnparseC.term_in_ctxt @{context} t;
98.8 -if existpt' ([3], Res) pt andalso UnparseC.term_in_ctxt @{context} t = "c + x + 1 / 3 * x \<up> 3" then ()
98.9 +val (Form t,_,_) = ME_Misc.pt_extract (pt, p); UnparseC.term @{context} t;
98.10 +if existpt' ([3], Res) pt andalso UnparseC.term @{context} t = "c + x + 1 / 3 * x \<up> 3" then ()
98.11 else error "integrate.sml: test-script doesnt work";
98.12
99.1 --- a/test/Tools/isac/MathEngine/mathengine-stateless.sml Sat Feb 04 16:49:08 2023 +0100
99.2 +++ b/test/Tools/isac/MathEngine/mathengine-stateless.sml Sat Feb 04 17:00:25 2023 +0100
99.3 @@ -252,7 +252,7 @@
99.4 "~~~~~ fun thm'2xml, args:"; val (j, ((ID, form) : thm'')) = ((j+i), thm');
99.5 ID = "rnorm_equation_add";
99.6 @{thm rnorm_equation_add};
99.7 -(UnparseC.term_in_ctxt @{context} o Thm.prop_of) form = "~ ?b =!= 0 ==> (?a = ?b) = (?a + - 1 * ?b = 0)"
99.8 +(UnparseC.term @{context} o Thm.prop_of) form = "~ ?b =!= 0 ==> (?a = ?b) = (?a + - 1 * ?b = 0)"
99.9 (*?!? should be "\<not> ?b =!= 0 \<Longrightarrow> (?a = ?b) = (?a + - 1 * ?b = 0)"*)
99.10 (*thmstr2xml (j+i) form;
99.11 ERROR Undeclared constant: "Test.rnorm_equation_add" \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> ^*)
100.1 --- a/test/Tools/isac/MathEngine/solve.sml Sat Feb 04 16:49:08 2023 +0100
100.2 +++ b/test/Tools/isac/MathEngine/solve.sml Sat Feb 04 17:00:25 2023 +0100
100.3 @@ -53,10 +53,10 @@
100.4 getTactic 1 ([6,1,1], Frm); (*WN130909 <ERROR> syserror in getTactic </ERROR>*)
100.5 val ((pt,_),_) = States.get_calc 1; Test_Tool.show_pt pt;
100.6 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([6], Res));
100.7 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
100.8 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
100.9 ("1 / 2", Check_Postcond ["rational", "simplification"], []) => ()
100.10 | _ => error "solve.sml: interSteps on norm_Rational 2";
100.11 get_obj g_res pt [];
100.12 val (t, asm) = get_obj g_result pt [];
100.13 -if map (UnparseC.term_in_ctxt @{context}) asm = []
100.14 +if map (UnparseC.term @{context}) asm = []
100.15 then () else error "solve.sml: interSteps on norm_Rational 2, asms";
101.1 --- a/test/Tools/isac/MathEngine/states.sml Sat Feb 04 16:49:08 2023 +0100
101.2 +++ b/test/Tools/isac/MathEngine/states.sml Sat Feb 04 17:00:25 2023 +0100
101.3 @@ -42,7 +42,7 @@
101.4 fun check i = let
101.5 val ((pt, p), _) = States.get_calc i; (*retrieve result, e.g. no.1*)
101.6 in
101.7 - if p = ([], Res) andalso UnparseC.term_in_ctxt @{context} (get_obj g_res pt (fst p)) =(*check result correct*)
101.8 + if p = ([], Res) andalso UnparseC.term @{context} (get_obj g_res pt (fst p)) =(*check result correct*)
101.9 "y x =\n-6 * q_0 * L \<up> 2 / (-24 * EI) * x \<up> 2 +\n4 * L * q_0 / " ^
101.10 "(-24 * EI) * x \<up> 3 +\n-1 * q_0 / (-24 * EI) * x \<up> 4"
101.11 then ()
102.1 --- a/test/Tools/isac/MathEngine/step.sml Sat Feb 04 16:49:08 2023 +0100
102.2 +++ b/test/Tools/isac/MathEngine/step.sml Sat Feb 04 17:00:25 2023 +0100
102.3 @@ -226,7 +226,7 @@
102.4 val pos' as (p', _) = (lev_on p, Res);
102.5
102.6 if pos = ([1], Res) then () else error "Step.inconsistent changed 2a";
102.7 -if UnparseC.term_in_ctxt @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))"
102.8 +if UnparseC.term @{context} f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))"
102.9 then () else error "Step.inconsistent changed 2b";
102.10
102.11 val (pt,c) =
102.12 @@ -252,7 +252,7 @@
102.13 val (Form f, _, asms) = ME_Misc.pt_extract (pt, p);
102.14 if p = ([2], Res) andalso
102.15 get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sin_chain", "")) andalso
102.16 - UnparseC.term_in_ctxt @{context} f =
102.17 + UnparseC.term @{context} f =
102.18 "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4)) =\nd_d x (x \<up> 2) + cos ?u * d_d x ?_dummy_2"
102.19 (*WAS with old findFillpatterns:
102.20 "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4)) =\nd_d x (x \<up> 2) + cos ?_dummy_2 * d_d x ?_dummy_3"
103.1 --- a/test/Tools/isac/Minisubpbl/100-init-rootpbl.sml Sat Feb 04 16:49:08 2023 +0100
103.2 +++ b/test/Tools/isac/Minisubpbl/100-init-rootpbl.sml Sat Feb 04 17:00:25 2023 +0100
103.3 @@ -87,8 +87,8 @@
103.4 | _ => raise ERROR ("add_sel_ppc tried to select by \"" ^ sel ^ "\"")
103.5 fun add_where {Given = gi, Where = _, Find = fi, With = wi, Relate = re} wh =
103.6 {Given = gi, Where = wh, Find= fi ,With = wi, Relate = re}
103.7 -fun boolterm2item ctxt (true, term) = P_Model.Correct (UnparseC.term_in_ctxt ctxt term)
103.8 - | boolterm2item ctxt(false, term) = P_Model.False (UnparseC.term_in_ctxt ctxt term);
103.9 +fun boolterm2item ctxt (true, term) = P_Model.Correct (UnparseC.term ctxt term)
103.10 + | boolterm2item ctxt(false, term) = P_Model.False (UnparseC.term ctxt term);
103.11 (*\\------------------ inserted hidden code ------------------------------------------------//*)
103.12
103.13 fun coll model [] = model
104.1 --- a/test/Tools/isac/Minisubpbl/150a-add-given-Maximum.sml Sat Feb 04 16:49:08 2023 +0100
104.2 +++ b/test/Tools/isac/Minisubpbl/150a-add-given-Maximum.sml Sat Feb 04 17:00:25 2023 +0100
104.3 @@ -145,7 +145,7 @@
104.4 (ctxt, m_field, oris, i_model, m_patt, ct);
104.5 (*new*) val (t as (descriptor $ _)) = Syntax.read_term ctxt str
104.6
104.7 -(*+*)val "Constants [r = 7]" = UnparseC.term_in_ctxt @{context} t;
104.8 +(*+*)val "Constants [r = 7]" = UnparseC.term @{context} t;
104.9
104.10 (*new*)val SOME m_field' =
104.11 (*new*) (*case*) Model_Pattern.get_field descriptor m_patt (*of*);
104.12 @@ -157,7 +157,7 @@
104.13 (*new*) (*case*) O_Model.contains ctxt m_field o_model t (*of*);
104.14
104.15 (*+*)val (_, _, _, _, vals) = hd o_model;
104.16 -(*+*)val "Constants [r = 7]" = UnparseC.term_in_ctxt @{context} (@{term Constants} $ (hd vals));
104.17 +(*+*)val "Constants [r = 7]" = UnparseC.term @{context} (@{term Constants} $ (hd vals));
104.18 (*+*) if "[\n(1, [\"1\", \"2\", \"3\"], #Given, Constants, [\"[r = 7]\"]), " ^
104.19 (*+*) "\n(2, [\"1\", \"2\", \"3\"], #Find, Maximum, [\"A\"]), " ^
104.20 (*+*) "\n(3, [\"1\", \"2\", \"3\"], #Find, AdditionalValues, [\"[u]\", \"[v]\"]), " ^
105.1 --- a/test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml Sat Feb 04 16:49:08 2023 +0100
105.2 +++ b/test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml Sat Feb 04 17:00:25 2023 +0100
105.3 @@ -62,7 +62,7 @@
105.4 val pt = Ctree.update_branch pt p Ctree.TransitiveB
105.5
105.6 val return =
105.7 - ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term_in_ctxt ctxt f'), pt)
105.8 + ((p, Pos.Res), c, Test_Out.FormKF (UnparseC.term ctxt f'), pt)
105.9 (*-------------------- stop step into Apply_Method -------------------------------------------*)
105.10 (*\\------------------ step into Apply_Method ----------------------------------------------//*)
105.11
106.1 --- a/test/Tools/isac/Minisubpbl/200-start-method.sml Sat Feb 04 16:49:08 2023 +0100
106.2 +++ b/test/Tools/isac/Minisubpbl/200-start-method.sml Sat Feb 04 17:00:25 2023 +0100
106.3 @@ -111,7 +111,7 @@
106.4 val (form, _, _) = ME_Misc.pt_extract ctxt ptp
106.5 val Ctree.Form t =
106.6 (*case*) form (*of*);
106.7 - Test_Out.FormKF (UnparseC.term_in_ctxt ctxt t);
106.8 + Test_Out.FormKF (UnparseC.term ctxt t);
106.9 (*-------------------- stop step into Rewrite_Set --------------------------------------------*)
106.10 (*\\------------------ step into Rewrite_Set -----------------------------------------------//*)
106.11
107.1 --- a/test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml Sat Feb 04 16:49:08 2023 +0100
107.2 +++ b/test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml Sat Feb 04 17:00:25 2023 +0100
107.3 @@ -67,7 +67,7 @@
107.4 "~~~~~ fun scan_dn1, args:"; val (xxx, ist, (Const (\<^const_name>\<open>Try\<close>(*1*),_) $ e)) =
107.5 (xxx, (ist |> path_down_form ([L, L, R], a)), e1);
107.6
107.7 -(*+*)UnparseC.term_in_ctxt ctxt e1 = "Try (Rewrite_Set ''norm_equation'')" (*in isabisac*);
107.8 +(*+*)UnparseC.term ctxt e1 = "Try (Rewrite_Set ''norm_equation'')" (*in isabisac*);
107.9
107.10 val Accept_Tac1 _ = (*case*)
107.11 scan_dn1 xxx (ist |> path_down_form ([L, R], a)) e (*of*);
108.1 --- a/test/Tools/isac/Minisubpbl/300-init-subpbl.sml Sat Feb 04 16:49:08 2023 +0100
108.2 +++ b/test/Tools/isac/Minisubpbl/300-init-subpbl.sml Sat Feb 04 17:00:25 2023 +0100
108.3 @@ -105,7 +105,7 @@
108.4 "~~~~~ fun scan_dn , args:"; val ((cc as (_, ctxt)), (ist as {eval, ...}), t (*fall-through*)) =
108.5 (cc, (ist |> path_down [L, R]), e);
108.6 (*+*)val "SubProblem\n (''Test'', [''LINEAR'', ''univariate'', ''equation'', ''test''],\n [''Test'', ''solve_linear''])\n [BOOL e_e, REAL v_v]" =
108.7 -(*+*) UnparseC.term_in_ctxt @{context} e;
108.8 +(*+*) UnparseC.term @{context} e;
108.9 (*if*) Tactical.contained_in t (*else*);
108.10 val (Program.Tac prog_tac, form_arg) =
108.11 (*case*) LItool.check_leaf "next " ctxt eval (get_subst ist) t (*of*);
109.1 --- a/test/Tools/isac/Minisubpbl/400-start-meth-subpbl.sml Sat Feb 04 16:49:08 2023 +0100
109.2 +++ b/test/Tools/isac/Minisubpbl/400-start-meth-subpbl.sml Sat Feb 04 17:00:25 2023 +0100
109.3 @@ -51,13 +51,13 @@
109.4
109.5 (*+*)val PblObj {ctxt, ...} = get_obj I pt [3];
109.6 (*+isa==isa2*)ContextC.get_assumptions ctxt = [];
109.7 -(*+isa==isa2*)(Ctree.get_assumptions pt p |> map (UnparseC.term_in_ctxt @{context})) = [];
109.8 +(*+isa==isa2*)(Ctree.get_assumptions pt p |> map (UnparseC.term @{context})) = [];
109.9
109.10 LI.by_tactic tac (get_istate_LI pt p, get_ctxt_LI pt p) ptp;
109.11 "~~~~~ fun by_tactic , args:"; val (Tactic.Apply_Method' (mI, _, _, _), (_, ctxt), (pt, (pos as (p, _))))
109.12 = (tac, (get_istate_LI pt p, get_ctxt_LI pt p), (pt, p));
109.13
109.14 -(*+isa==isa2*)if (ContextC.get_assumptions ctxt |> map (UnparseC.term_in_ctxt ctxt))
109.15 +(*+isa==isa2*)if (ContextC.get_assumptions ctxt |> map (UnparseC.term ctxt))
109.16 (*+*) = ["precond_rootmet x"]
109.17 (*+*)then () else error "assumptions 7 from Apply_Method'";
109.18
109.19 @@ -66,7 +66,7 @@
109.20 PblObj {meth = itms, origin = (oris, _, _), probl(*, ctxt*), ...} => (itms, oris, probl(*, ctxt*))
109.21 | _ => raise ERROR "LI.by_tactic Apply_Method': uncovered case get_obj";
109.22
109.23 -(*+isa==isa2*)if (ContextC.get_assumptions ctxt |> map (UnparseC.term_in_ctxt ctxt))
109.24 +(*+isa==isa2*)if (ContextC.get_assumptions ctxt |> map (UnparseC.term ctxt))
109.25 (*+*) = ["precond_rootmet x"]
109.26 (*+*)then () else error "assumptions 8";
109.27
109.28 @@ -77,7 +77,7 @@
109.29 (is as Pstate {env, ...}, ctxt, program) => (is, env, ctxt, program)
109.30 | _ => raise ERROR "LI.by_tactic Apply_Method': uncovered case init_pstate";
109.31
109.32 -(*+*)(ContextC.get_assumptions ctxt |> map (UnparseC.term_in_ctxt ctxt))
109.33 +(*+*)(ContextC.get_assumptions ctxt |> map (UnparseC.term ctxt))
109.34 (*+isa==isa2*) = ["matches (?a = ?b) (- 1 + x = 0)", "precond_rootmet x"];
109.35
109.36 val ini = LItool.implicit_take ctxt prog env;
109.37 @@ -87,7 +87,7 @@
109.38 val show_add = Tactic.Apply_Method' (mI, SOME t, is, ctxt);
109.39 val (pos, c, _, pt) = Solve_Step.add show_add (is, ctxt) (pt, pos);
109.40
109.41 -(*+*)if (ContextC.get_assumptions ctxt |> map (UnparseC.term_in_ctxt ctxt))
109.42 +(*+*)if (ContextC.get_assumptions ctxt |> map (UnparseC.term ctxt))
109.43 (*+isa==isa2*) = ["matches (?a = ?b) (- 1 + x = 0)", "precond_rootmet x"]
109.44 (*+*)then () else error "assumptions 9";
109.45
109.46 @@ -196,7 +196,7 @@
109.47 then () else error "Minisubpbl/400-start-meth-subpbl changed";
109.48
109.49 (*+*)val p_frm = ([3], Frm);
109.50 -(*+*)if (Ctree.get_assumptions pt p_frm |> map (UnparseC.term_in_ctxt @{context}))
109.51 +(*+*)if (Ctree.get_assumptions pt p_frm |> map (UnparseC.term @{context}))
109.52 (*+*) = ["precond_rootmet x"]
109.53 (*+*)then () else error "p_frm BEFORE Apply_Method at Subproblem CHANGED";
109.54
109.55 @@ -206,11 +206,11 @@
109.56 (*+*)then () else error "assumptions<>[] before Apply_Method of Subproblem";
109.57
109.58 (*+*)val ([3, 1], Frm) = p'''';
109.59 -(*+*)if (Ctree.get_assumptions pt p'''' |> map (UnparseC.term_in_ctxt @{context}))
109.60 +(*+*)if (Ctree.get_assumptions pt p'''' |> map (UnparseC.term @{context}))
109.61 (*+*) = ["matches (?a = ?b) (- 1 + x = 0)", "precond_rootmet x"]
109.62 (*+*)then () else error "FALSE: 2 assumptions recorded Apply_Method of Subproblem";
109.63
109.64 (*+*)val p_res = ([3], Res);
109.65 -(*+*)if (Ctree.get_assumptions pt p_res |> map (UnparseC.term_in_ctxt @{context}))
109.66 +(*+*)if (Ctree.get_assumptions pt p_res |> map (UnparseC.term @{context}))
109.67 (*+*) = ["precond_rootmet x"]
109.68 (*+*)then () else error "p_res AFTER Apply_Method at Subproblem CHANGED";
110.1 --- a/test/Tools/isac/Minisubpbl/470-Check_elementwise-NEXT_STEP.sml Sat Feb 04 16:49:08 2023 +0100
110.2 +++ b/test/Tools/isac/Minisubpbl/470-Check_elementwise-NEXT_STEP.sml Sat Feb 04 17:00:25 2023 +0100
110.3 @@ -28,7 +28,7 @@
110.4 (*[3, 2], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Rewrite_Set "Test_simplify"*)
110.5 (*[3], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Check_Postcond ["LINEAR", "univariate", "equation", "test"]*)
110.6
110.7 -(*+*)if ((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms_in_ctxt @{context}) = "[]"
110.8 +(*+*)if ((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms @{context}) = "[]"
110.9 (*+*)then () else error "470-Check_elementwise-NEXT_STEP: Rewrite_Set changed asms";
110.10
110.11 (*+*)case tac of Rewrite_Set "Test_simplify" => (
110.12 @@ -94,8 +94,8 @@
110.13
110.14 (*+*)val (res, asm) = (get_obj g_result pt (fst p));
110.15 (*+*)if p = ([], Res) andalso
110.16 -(*+*) UnparseC.term_in_ctxt ctxt res = "[x = 1]" andalso
110.17 -(*+*) map (UnparseC.term_in_ctxt @{context}) asm = []
110.18 +(*+*) UnparseC.term ctxt res = "[x = 1]" andalso
110.19 +(*+*) map (UnparseC.term @{context}) asm = []
110.20 (*+*)then () else error "Minisubpbl/470-Check_elementwise-NEXT_STEP.sml CHANGED";
110.21
110.22 Proof_Context.theory_of (Ctree.get_ctxt pt p); (*"Test"*)
111.1 --- a/test/Tools/isac/Minisubpbl/790-complete-NEXT_STEP.sml Sat Feb 04 16:49:08 2023 +0100
111.2 +++ b/test/Tools/isac/Minisubpbl/790-complete-NEXT_STEP.sml Sat Feb 04 17:00:25 2023 +0100
111.3 @@ -29,27 +29,27 @@
111.4 (*[3, 2], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Rewrite_Set "Test_simplify"*)
111.5 (*[3], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Check_Postcond ["LINEAR", "univariate", "equation", "test"]*)
111.6
111.7 -((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms_in_ctxt @{context}) = "[]";(*isa*)
111.8 -((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms_in_ctxt @{context}) = "[\"matches (?a = ?b) (-1 + x = 0)\"]";(*REP*)
111.9 +((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms @{context}) = "[]";(*isa*)
111.10 +((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms @{context}) = "[\"matches (?a = ?b) (-1 + x = 0)\"]";(*REP*)
111.11 (* there are questionable assumptions either --------- \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> ^^*)
111.12
111.13 (*[4], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Check_elementwise "Assumptions"*)
111.14
111.15 -((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms_in_ctxt @{context}) = "[]";(*isa*)
111.16 -((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms_in_ctxt @{context}) = "[\"precond_rootmet 1\"]";(*REP*)
111.17 +((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms @{context}) = "[]";(*isa*)
111.18 +((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms @{context}) = "[\"precond_rootmet 1\"]";(*REP*)
111.19
111.20 (*[], Res*)val ("ok", ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Check_Postcond ["sqroot-test", "univariate", "equation", "test"]*)
111.21
111.22 -((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms_in_ctxt @{context}) = "[]";(*isa*)
111.23 -((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms_in_ctxt @{context}) = "[\"precond_rootmet 1\"]";(*REP*)
111.24 +((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms @{context}) = "[]";(*isa*)
111.25 +((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms @{context}) = "[\"precond_rootmet 1\"]";(*REP*)
111.26
111.27 (*[], Res*)val ("end-of-calculation", ([], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(**)
111.28
111.29 (*/--------------------- final test ----------------------------------\\*)
111.30 val (res, asm) = (get_obj g_result pt (fst p));
111.31
111.32 -if UnparseC.term_in_ctxt @{context} res = "[x = 1]" andalso
111.33 - map (UnparseC.term_in_ctxt @{context}) asm = [] (* assumptions have gone to the ctxt *)
111.34 +if UnparseC.term @{context} res = "[x = 1]" andalso
111.35 + map (UnparseC.term @{context}) asm = [] (* assumptions have gone to the ctxt *)
111.36 then () else error "Minisubpbl/790-complete-NEXT_STEP.sml, find_next_step CHANGED";
111.37
111.38 if p = ([], Und)
112.1 --- a/test/Tools/isac/Minisubpbl/800-append-on-Frm.sml Sat Feb 04 16:49:08 2023 +0100
112.2 +++ b/test/Tools/isac/Minisubpbl/800-append-on-Frm.sml Sat Feb 04 17:00:25 2023 +0100
112.3 @@ -195,15 +195,15 @@
112.4 val pt = Ctree.update_branch pt p Ctree.TransitiveB
112.5 val p = (Pos.lev_on o Pos.lev_dn (* starts with [...,0] *)) p
112.6 val (pt, c') = Ctree.cappend_form pt p l t
112.7 -val return = ((p, Frm), c @ c', Test_Out.FormKF (UnparseC.term_in_ctxt ctxt t), pt)
112.8 +val return = ((p, Frm), c @ c', Test_Out.FormKF (UnparseC.term ctxt t), pt)
112.9
112.10 (*/--------------------- final test ----------------------------------------------------------\*)
112.11 val (SOME (Uistate, ctxt_frm), SOME (ist_res, ctxt_res)) = get_obj g_loc (fst ptp''''') (fst (snd ptp'''''))
112.12 ;
112.13 if
112.14 - (ctxt_frm |> ContextC.get_assumptions |> UnparseC.terms_in_ctxt ctxt) = "[precond_rootmet x]"
112.15 + (ctxt_frm |> ContextC.get_assumptions |> UnparseC.terms ctxt) = "[precond_rootmet x]"
112.16 andalso
112.17 - (ctxt_res |> ContextC.get_assumptions |> UnparseC.terms_in_ctxt ctxt) = "[precond_rootmet x]"
112.18 + (ctxt_res |> ContextC.get_assumptions |> UnparseC.terms ctxt) = "[precond_rootmet x]"
112.19 andalso
112.20 Istate.string_of ctxt ist_res =
112.21 "Pstate ([\"\n(e_e, x + 1 = 2)\", \"\n(v_v, x)\"], [], empty, NONE, \n2 + - 1 + x = 2, ORundef, false, true)"
113.1 --- a/test/Tools/isac/OLDTESTS/root-equ.sml Sat Feb 04 16:49:08 2023 +0100
113.2 +++ b/test/Tools/isac/OLDTESTS/root-equ.sml Sat Feb 04 17:00:25 2023 +0100
113.3 @@ -190,7 +190,7 @@
113.4 val (t,_) = the (rewrite_set_inst_ thy false subst rls t);
113.5 val rls = Test_simplify;
113.6 val (t,_) = the (rewrite_set_ thy false rls t);
113.7 -val t' = UnparseC.term_in_ctxt @{context} t;
113.8 +val t' = UnparseC.term @{context} t;
113.9 if t' = "x = 4" then ()
113.10 else error "root-equ.sml: new behav. in rewrite_ x+4";
113.11
113.12 @@ -289,7 +289,7 @@
113.13
113.14 val pos = (lev_on o lev_dn) pos;
113.15 val thm = ("square_equation_left", ""); val ctold = ct;
113.16 -val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") true thm (UnparseC.term_in_ctxt @{context} ct));
113.17 +val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") true thm (UnparseC.term @{context} ct));
113.18 val (pt,_) = cappend_atomic pt pos loc ctold (Tac (fst thm)) (ParseC.parse_test @{context} ct,[])Complete;
113.19 (*val pt = union_asm pt [] (map (rpair []) asm);*)
113.20
113.21 @@ -531,7 +531,7 @@
113.22 (*.9.6.03
113.23 val t = ParseC.parse_test @{context} "sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x)";
113.24 val SOME (t',asm) = rewrite_set_ thy false rls t;
113.25 - UnparseC.term_in_ctxt @{context} t';
113.26 + UnparseC.term @{context} t';
113.27 Rewrite.trace_on:=false; (*true false*)
113.28 *)
113.29
113.30 @@ -615,6 +615,6 @@
113.31 else ();
113.32
113.33 writeln (pr_ctree ctxt pr_short pt);
113.34 -writeln("result: "^((UnparseC.term_in_ctxt @{context} o fst o (get_obj g_result pt)) [])^
113.35 +writeln("result: "^((UnparseC.term @{context} o fst o (get_obj g_result pt)) [])^
113.36 "\n==============================================================");
113.37
114.1 --- a/test/Tools/isac/OLDTESTS/tacis.sml Sat Feb 04 16:49:08 2023 +0100
114.2 +++ b/test/Tools/isac/OLDTESTS/tacis.sml Sat Feb 04 17:00:25 2023 +0100
114.3 @@ -74,7 +74,7 @@
114.4 val ((pt,p),tacis) = States.get_calc 1;
114.5 val ip = States.get_pos 1 1;
114.6 val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
114.7 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]"andalso p = ([],Res) andalso ip = ([],Res)then()else
114.8 + if UnparseC.term @{context} f = "[x = 1]"andalso p = ([],Res) andalso ip = ([],Res)then()else
114.9 error "tacis.sml: diff.behav. in fetchProposedTactic autoCalculate";
114.10
114.11
114.12 @@ -154,7 +154,7 @@
114.13 val ((pt,p),tacis) = States.get_calc 1;
114.14 val ip = States.get_pos 1 1;
114.15 val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
114.16 - if UnparseC.term_in_ctxt @{context} f = "[x = 1]"andalso p = ([],Res) andalso ip = ([],Res)then()else
114.17 + if UnparseC.term @{context} f = "[x = 1]"andalso p = ([],Res) andalso ip = ([],Res)then()else
114.18 error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (4)";
114.19
114.20
115.1 --- a/test/Tools/isac/ProgLang/auto_prog.sml Sat Feb 04 16:49:08 2023 +0100
115.2 +++ b/test/Tools/isac/ProgLang/auto_prog.sml Sat Feb 04 17:00:25 2023 +0100
115.3 @@ -37,7 +37,7 @@
115.4 | Rule_Set.Sequence {rules, ...} => rules2scr_Seq thy rules
115.5 val auto_script = subst_typs prog (type_of t) (TermC.guess_bdv_typ t) (*return from generate*);
115.6
115.7 -if UnparseC.term_in_ctxt @{context} auto_script =
115.8 +if UnparseC.term @{context} auto_script =
115.9 "auto_generated_inst t_t v =\n" ^
115.10 "(Try (Rewrite_Set_Inst [(''bdv'', v)] ''integration_rules'') #>\n" ^
115.11 " Try (Rewrite_Set_Inst [(''bdv'', v)] ''add_new_c'') #>\n" ^
115.12 @@ -48,7 +48,7 @@
115.13 if contain_bdv (get_rules rls) then ()
115.14 else error "scrtools.sml: contain_bdv doesnt work for 'integration'";
115.15
115.16 -if UnparseC.terms_in_ctxt @{context} (formal_args auto_script) = "[t_t, v]"
115.17 +if UnparseC.terms @{context} (formal_args auto_script) = "[t_t, v]"
115.18 then () else error "formal_args of auto-gen.script changed";
115.19
115.20 Istate.init_detail ctxt (Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")) (ParseC.parse_test @{context} "someTermWithBdv");
115.21 @@ -68,7 +68,7 @@
115.22 val t = @{term "ttt :: real"}
115.23 val auto_script = Auto_Prog.gen thy' t rls;
115.24
115.25 -if UnparseC.term_in_ctxt @{context} auto_script =
115.26 +if UnparseC.term @{context} auto_script =
115.27 "auto_generated t_t =\n" ^
115.28 "(Try (Rewrite_Set ''discard_minus'') #>\n" ^
115.29 " Try (Rewrite_Set ''expand_poly_'') #>\n" ^
115.30 @@ -151,7 +151,7 @@
115.31 val ctxt = Proof_Context.init_global thy
115.32 val auto_script =
115.33 Auto_Prog.gen thy @{term "ttt :: real"} (get_rls ctxt "norm_Rational");
115.34 -writeln(UnparseC.term_in_ctxt @{context} auto_script);
115.35 +writeln(UnparseC.term @{context} auto_script);
115.36 TermC.atom_trace_detail @{context} auto_script;
115.37 (***
115.38 *** Const (Program.Stepwise, 'z => 'z => 'z)
115.39 @@ -201,7 +201,7 @@
115.40 val (Form form, SOME tac, asm) = ME_Misc.pt_extract (pt, ([1], Res));
115.41 *)
115.42 val (Form form, SOME tac, asm) = ME_Misc.pt_extract ctxt (pt, ([2], Res));
115.43 -case (UnparseC.term_in_ctxt @{context} form, tac, UnparseC.asms_test @{context} asm) of
115.44 +case (UnparseC.term @{context} form, tac, UnparseC.asms_test @{context} asm) of
115.45 ("a", Check_Postcond ["polynomial", "simplification"], []) => ()
115.46 | _ => error "scrtools.sml: auto-generated norm_Rational doesnt work";
115.47
115.48 @@ -212,7 +212,7 @@
115.49 val rules = (#rules o Rule_Set.rep) isolate_root;
115.50 val rs = map (rule2stac @{theory}) rules;
115.51 val t = #> rs;
115.52 -if UnparseC.term_in_ctxt @{context} t = "Try (Repeat (Rewrite ''rroot_to_lhs'')) #>\n" ^
115.53 +if UnparseC.term @{context} t = "Try (Repeat (Rewrite ''rroot_to_lhs'')) #>\n" ^
115.54 "Try (Repeat (Rewrite ''rroot_to_lhs_mult'')) #>\n" ^
115.55 "Try (Repeat (Rewrite ''rroot_to_lhs_add_mult'')) #>\n" ^
115.56 "Try (Repeat (Rewrite ''risolate_root_add'')) #>\n" ^
115.57 @@ -246,19 +246,19 @@
115.58 "-------- fun rule2stac, fun rule2stac_inst ----------------------------------------------------";
115.59 "-------- fun rule2stac, fun rule2stac_inst ----------------------------------------------------";
115.60 val t = rule2stac @{theory} (Thm ("real_diff_minus", @{thm real_diff_minus}));
115.61 -if UnparseC.term_in_ctxt @{context} t = "Try (Repeat (Rewrite ''real_diff_minus''))" then ()
115.62 +if UnparseC.term @{context} t = "Try (Repeat (Rewrite ''real_diff_minus''))" then ()
115.63 else error "rule2stac Thm.. changed";
115.64
115.65 val t = rule2stac @{theory} (Eval (\<^const_name>\<open>plus\<close>, Calc_Binop.numeric "#add_"));
115.66 -if UnparseC.term_in_ctxt @{context} t = "Try (Repeat (Calculate ''PLUS''))" then ()
115.67 +if UnparseC.term @{context} t = "Try (Repeat (Calculate ''PLUS''))" then ()
115.68 else error "rule2stac Eval.. changed";
115.69
115.70 val t = rule2stac @{theory} (Rls_ rearrange_assoc);
115.71 -if UnparseC.term_in_ctxt @{context} t = "Try (Rewrite_Set ''rearrange_assoc'')" then ()
115.72 +if UnparseC.term @{context} t = "Try (Rewrite_Set ''rearrange_assoc'')" then ()
115.73 else error "rule2stac Rls_.. changed";
115.74
115.75 val t = rule2stac_inst @{theory} (Thm ("risolate_bdv_add", @{thm risolate_bdv_add}));
115.76 -if UnparseC.term_in_ctxt @{context} t = "Try (Repeat (Rewrite_Inst [(''bdv'', v)] ''risolate_bdv_add''))" then ()
115.77 +if UnparseC.term @{context} t = "Try (Repeat (Rewrite_Inst [(''bdv'', v)] ''risolate_bdv_add''))" then ()
115.78 else error "rule2stac_inst Thm.. changed";
115.79 case t of
115.80 (Const (\<^const_name>\<open>Try\<close>, _) $
115.81 @@ -334,7 +334,7 @@
115.82 val thy = @{theory "Isac_Knowledge"}
115.83 val ctxt = Proof_Context.init_global thy
115.84 val prog = Auto_Prog.gen thy t (get_rls ctxt "isolate_bdv");
115.85 -(* UnparseC.term_in_ctxt @{context} prog |> writeln
115.86 +(* UnparseC.term @{context} prog |> writeln
115.87 auto_generated_inst t_t v =
115.88 Repeat
115.89 ((Try (Repeat (Rewrite_Inst [(''bdv'', v)] ''risolate_bdv_add'')) #>
116.1 --- a/test/Tools/isac/ProgLang/evaluate.sml Sat Feb 04 16:49:08 2023 +0100
116.2 +++ b/test/Tools/isac/ProgLang/evaluate.sml Sat Feb 04 17:00:25 2023 +0100
116.3 @@ -58,22 +58,22 @@
116.4 "~~~~~ fun calculate_ , args:"; val (thy, isa_fn, t) = (thy, plus, t);
116.5 val SOME ("#: 1 + 2 = 3", adh_thm) = adhoc_thm @{context} isa_fn t;
116.6 val SOME (t', []) = rewrite__ ctxt 0 [] Rewrite_Ord.function_empty Rule_Set.empty true adh_thm t;
116.7 -if UnparseC.term_in_ctxt @{context} t' = "(3 * 4 / 3) \<up> 2" then () else error "calculate_ 1 + 2 = 3 changed";
116.8 +if UnparseC.term @{context} t' = "(3 * 4 / 3) \<up> 2" then () else error "calculate_ 1 + 2 = 3 changed";
116.9
116.10 "~~~~~ fun calculate_, args:"; val (thy, isa_fn, t) = (thy, times, t');
116.11 val SOME ("#: 3 * 4 = 12", adh_thm) = adhoc_thm @{context} isa_fn t';
116.12 val SOME (t'', []) = rewrite__ ctxt 0 [] Rewrite_Ord.function_empty Rule_Set.empty true adh_thm t;
116.13 -if UnparseC.term_in_ctxt @{context} t'' = "(12 / 3) \<up> 2" then () else error "calculate_ 3 * 4 = 12 changed";
116.14 +if UnparseC.term @{context} t'' = "(12 / 3) \<up> 2" then () else error "calculate_ 3 * 4 = 12 changed";
116.15
116.16 "~~~~~ fun calculate_, args:"; val (thy, isa_fn, t) = (thy, divide, t'');
116.17 val SOME ("#divide_e12_3", adh_thm) = adhoc_thm @{context} isa_fn t;
116.18 val SOME (t''', []) = rewrite__ ctxt 0 [] Rewrite_Ord.function_empty Rule_Set.empty true adh_thm t;
116.19 -if UnparseC.term_in_ctxt @{context} t''' = "4 \<up> 2" then () else error "calculate_ 12 / 3 = 4 changed";
116.20 +if UnparseC.term @{context} t''' = "4 \<up> 2" then () else error "calculate_ 12 / 3 = 4 changed";
116.21
116.22 "~~~~~ fun calculate_, args:"; val (thy, isa_fn, t) = (thy, pow, t''');
116.23 val SOME ("#: 4 \<up> 2 = 16", adh_thm) = adhoc_thm @{context} isa_fn t;
116.24 val SOME (t'''', []) = rewrite__ ctxt 0 [] Rewrite_Ord.function_empty Rule_Set.empty true adh_thm t;
116.25 -if UnparseC.term_in_ctxt @{context} t'''' = "16" then () else error "calculate_ 12 / 3 = 4 changed";
116.26 +if UnparseC.term @{context} t'''' = "16" then () else error "calculate_ 12 / 3 = 4 changed";
116.27
116.28 "----------- calculate from Prog --------------------------------- -----------------------------";
116.29 "----------- calculate from Prog --------------------------------- -----------------------------";
116.30 @@ -163,14 +163,14 @@
116.31 val SOME t = ParseC.term_opt ctxt "(3+5)/(2::real)";
116.32 case rewrite_set_ ctxt false rls t of
116.33 SOME (t', []) =>
116.34 - if UnparseC.term_in_ctxt @{context} t' = "4" then ()
116.35 + if UnparseC.term @{context} t' = "4" then ()
116.36 else error "rewrite_set_ (3+5)/2 changed 1"
116.37 | _ => error "rewrite_set_ (3+5)/2 changed 2";
116.38
116.39 val SOME t = ParseC.term_opt ctxt "(3+1+2*x)/(2::real)";
116.40 case rewrite_set_ ctxt false rls t of
116.41 SOME (t', _) =>
116.42 - if UnparseC.term_in_ctxt @{context} t' = "2 + x" then () else error "rewrite_set_ (3+1+2*x)/2 changed 1"
116.43 + if UnparseC.term @{context} t' = "2 + x" then () else error "rewrite_set_ (3+1+2*x)/2 changed 1"
116.44 | _ => error "rewrite_set_ (3+1+2*x)/2 changed 2";
116.45
116.46 (*--- trace_rewrite before correction of ... --------------------
116.47 @@ -204,7 +204,7 @@
116.48 (*===================*)
116.49 val SOME t = ParseC.term_opt ctxt "x + (- 1 + -3) / (2::real)";
116.50 val SOME (res, []) = rewrite_set_ ctxt false rls t;
116.51 -if UnparseC.term_in_ctxt @{context} res = "- 2 + x" then () else error "rewrite_set_ x + (- 1 + -3) / 2 changed";
116.52 +if UnparseC.term @{context} res = "- 2 + x" then () else error "rewrite_set_ x + (- 1 + -3) / 2 changed";
116.53 "x + (-4) / 2";
116.54 (*
116.55 ### trying calc. 'cancel'
116.56 @@ -238,22 +238,22 @@
116.57 val SOME (thmID,thm) = adhoc_thm ctxt (the(LibraryC.assoc(Know_Store.get_calcs @{theory},"PLUS"))) t;
116.58 "1 + 2 = 3";
116.59 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t;
116.60 - UnparseC.term_in_ctxt @{context} t;
116.61 + UnparseC.term @{context} t;
116.62 "(3 * 4 / 3) \<up> 2";
116.63 val SOME (thmID,thm) = adhoc_thm ctxt (the(LibraryC.assoc(Know_Store.get_calcs @{theory},"TIMES")))t;
116.64 "3 * 4 = 12";
116.65 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t;
116.66 - UnparseC.term_in_ctxt @{context} t;
116.67 + UnparseC.term @{context} t;
116.68 "(12 / 3) \<up> 2";
116.69 val SOME (thmID,thm) =adhoc_thm ctxt(the(LibraryC.assoc(Know_Store.get_calcs @{theory},"DIVIDE")))t;
116.70 "12 / 3 = 4";
116.71 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t;
116.72 - UnparseC.term_in_ctxt @{context} t;
116.73 + UnparseC.term @{context} t;
116.74 "4 \<up> 2";
116.75 val SOME (thmID,thm) = adhoc_thm ctxt(the(LibraryC.assoc(Know_Store.get_calcs @{theory},"POWER")))t;
116.76 "4 \<up> 2 = 16";
116.77 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t;
116.78 - UnparseC.term_in_ctxt @{context} t;
116.79 + UnparseC.term @{context} t;
116.80 "16";
116.81 if it <> "16" then error "evaluate.sml: new behaviour in calculate_"
116.82 else ();
116.83 @@ -283,7 +283,7 @@
116.84 val SOME (id, t') = Calc_Binop.numeric thmid op_ t ctxt;
116.85 (*** calc: operator = pow not defined*)
116.86
116.87 -if UnparseC.term_in_ctxt @{context} t' = "3 \<up> 2 = 9" then () else error "eval_binop 3 \<up> 2 = 9 CHANGED";
116.88 +if UnparseC.term @{context} t' = "3 \<up> 2 = 9" then () else error "eval_binop 3 \<up> 2 = 9 CHANGED";
116.89
116.90
116.91 "----------- fun cancel_int --------------------------------------------------------------------";
116.92 @@ -335,11 +335,11 @@
116.93 val t = ParseC.parse_test @{context} "(2::real) * x is_num";
116.94
116.95 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t @{theory Test};
116.96 -if UnparseC.term_in_ctxt @{context} t' = "(2 * x is_num) = False" then ()
116.97 +if UnparseC.term @{context} t' = "(2 * x is_num) = False" then ()
116.98 else error "is_num 2 * x is_num CHANGED";
116.99
116.100 val SOME (t',_) = rewrite_set_ ctxt false tval_rls t;
116.101 -if UnparseC.term_in_ctxt @{context} t' = "False" then ()
116.102 +if UnparseC.term @{context} t' = "False" then ()
116.103 else error "rewrite_set_ 2 * x is_num CHANGED";
116.104
116.105 "----------- fun get_pair: examples ------------------------------------------------------------";
116.106 @@ -352,36 +352,36 @@
116.107
116.108 val t = @{term "3 + 4 :: real"};
116.109 val SOME (str, term) = get_pair ctxt isa_str eval_fn t;
116.110 -(*+*)if str = "#: 3 + 4 = 7" andalso UnparseC.term_in_ctxt @{context} term = "3 + 4 = 7"
116.111 +(*+*)if str = "#: 3 + 4 = 7" andalso UnparseC.term @{context} term = "3 + 4 = 7"
116.112 (*+*)then () else error "get_pair 3 + 4 changed";
116.113
116.114 val t = @{term "(a + 3) + 4 :: real"};
116.115 val SOME (str, term) = get_pair ctxt isa_str eval_fn t;
116.116 -if str = "#: a + 3 + 4 = a + 7" andalso UnparseC.term_in_ctxt @{context} term = "a + 3 + 4 = a + 7"
116.117 +if str = "#: a + 3 + 4 = a + 7" andalso UnparseC.term @{context} term = "a + 3 + 4 = a + 7"
116.118 then () else error "get_pair (a + 3) + 4 changed";
116.119
116.120 val t = @{term "(a + 3) + 4 :: real"};
116.121 val SOME (str, term) = get_pair ctxt isa_str eval_fn t;
116.122 -if str = "#: a + 3 + 4 = a + 7" andalso UnparseC.term_in_ctxt @{context} term = "a + 3 + 4 = a + 7"
116.123 +if str = "#: a + 3 + 4 = a + 7" andalso UnparseC.term @{context} term = "a + 3 + 4 = a + 7"
116.124 then () else error "get_pair (a + 3) + 4 changed";
116.125
116.126 val t = @{term "x = 5 * (3 + (4 + a) :: real)"};
116.127 val SOME (str, term) = get_pair ctxt isa_str eval_fn t;
116.128 -if str = "#: 3 + (4 + a) = 7 + a" andalso UnparseC.term_in_ctxt @{context} term = "3 + (4 + a) = 7 + a"
116.129 +if str = "#: 3 + (4 + a) = 7 + a" andalso UnparseC.term @{context} term = "3 + (4 + a) = 7 + a"
116.130 then ((* !!! gets subterm !!!*)) else error "get_pair x = 5 * (3 + (4 + a)) (subterm) changed";
116.131
116.132 val SOME (isa_str, eval_fn) = LibraryC.assoc (Know_Store.get_calcs @{theory}, "DIVIDE");
116.133
116.134 val t = @{term "-4 / - 2 :: real"};
116.135 val SOME (str, term) = get_pair ctxt isa_str eval_fn t;
116.136 -if str = "#divide_e~4_~2" andalso UnparseC.term_in_ctxt @{context} term = "- 4 / - 2 = 2"
116.137 +if str = "#divide_e~4_~2" andalso UnparseC.term @{context} term = "- 4 / - 2 = 2"
116.138 then () else error "get_pair -4 / - 2 changed";
116.139
116.140 val SOME (isa_str, eval_fn) = LibraryC.assoc (Know_Store.get_calcs @{theory}, "POWER");
116.141
116.142 val t = @{term "2 \<up> 3 :: real"};
116.143 val SOME (str, term) = get_pair ctxt isa_str eval_fn t;
116.144 -if str = "#: 2 \<up> 3 = 8" andalso UnparseC.term_in_ctxt @{context} term = "2 \<up> 3 = 8"
116.145 +if str = "#: 2 \<up> 3 = 8" andalso UnparseC.term @{context} term = "2 \<up> 3 = 8"
116.146 then () else error "get_pair 2 \<up> 3 changed";
116.147
116.148 "----------- fun adhoc_thm: examples -----------------------------------------------------------";
116.149 @@ -480,7 +480,7 @@
116.150
116.151 val SOME (thmid, t) =
116.152 (*case*) get_pair ctxt op_ eval_fn ct (*of*);
116.153 -(*+*)val "sqrt 4 = 2" = UnparseC.term_in_ctxt @{context} t;
116.154 +(*+*)val "sqrt 4 = 2" = UnparseC.term @{context} t;
116.155
116.156 (** )
116.157 Skip_Proof.make_thm thy t;
117.1 --- a/test/Tools/isac/ProgLang/listC.sml Sat Feb 04 16:49:08 2023 +0100
117.2 +++ b/test/Tools/isac/ProgLang/listC.sml Sat Feb 04 17:00:25 2023 +0100
117.3 @@ -52,7 +52,7 @@
117.4 val thm = Thm.prop_of @{thm NTH_NIL};
117.5 TermC.atom_trace_detail @{context} thm;
117.6 val SOME (t', _) = rewrite_ ctxt Rewrite_Ord.function_empty prog_expr false @{thm NTH_NIL} t;
117.7 -if UnparseC.term_in_ctxt @{context} t' = "a" then ()
117.8 +if UnparseC.term @{context} t' = "a" then ()
117.9 else error "NTH 1 [a,b,c,d,e] = a ..changed";
117.10
117.11 val t = ParseC.parse_test @{context} "NTH 3 [a,b,c,d,e]";
117.12 @@ -67,7 +67,7 @@
117.13 val thm = Thm.prop_of @{thm NTH_CONS};
117.14 TermC.atom_trace_detail @{context} thm;
117.15 val SOME (t', _) = rewrite_ ctxt Rewrite_Ord.function_empty prog_expr false @{thm NTH_CONS} t;
117.16 -if UnparseC.term_in_ctxt @{context} t' = "NTH (3 + - 1) [b, c, d, e]" then ()
117.17 +if UnparseC.term @{context} t' = "NTH (3 + - 1) [b, c, d, e]" then ()
117.18 else error "NTH 3 [a,b,c,d,e] = NTH (3 + - 1) [b, c, d, e] ..changed";
117.19
117.20 (* now the argument "(3 + - 1)" etc needs to be evaluated in the assumption of NTH_CONS *)
117.21 @@ -75,7 +75,7 @@
117.22 TermC.atom_trace_detail @{context} t;
117.23
117.24 val SOME (t', _) = rewrite_set_ ctxt false prog_expr t;
117.25 -if UnparseC.term_in_ctxt @{context} t' = "c" then ()
117.26 +if UnparseC.term @{context} t' = "c" then ()
117.27 else error "NTH 3 [a,b,c,d,e] = c ..changed";
117.28
117.29 "--------------------- Length ------------------------------------------------";
117.30 @@ -86,20 +86,20 @@
117.31 val thy = @{theory ListC};
117.32 val t = ParseC.parse_test @{context} "Length [1, 1, 1]";
117.33 val SOME (t, asm) = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_CONS} t;
117.34 -UnparseC.term_in_ctxt @{context} t = "1 + Length [1, 1]";
117.35 +UnparseC.term @{context} t = "1 + Length [1, 1]";
117.36 val SOME (t, asm) = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_CONS} t;
117.37 -UnparseC.term_in_ctxt @{context} t = "1 + (1 + Length [1])";
117.38 +UnparseC.term @{context} t = "1 + (1 + Length [1])";
117.39 val SOME (t, asm) = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_CONS} t;
117.40 -UnparseC.term_in_ctxt @{context} t = "1 + (1 + (1 + Length []))";
117.41 +UnparseC.term @{context} t = "1 + (1 + (1 + Length []))";
117.42 val NONE = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_CONS} t;
117.43 val SOME (t, asm) = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_NIL} t;
117.44 val NONE = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_NIL} t;
117.45 -if UnparseC.term_in_ctxt @{context} t = "1 + (1 + (1 + 0))" then ()
117.46 +if UnparseC.term @{context} t = "1 + (1 + (1 + 0))" then ()
117.47 else error "Length [1, 1, 1] = 1 + (1 + (1 + 0)) ..changed";
117.48
117.49 val t = ParseC.parse_test @{context} "Length [1, 1, 1]";
117.50 val SOME (t, asm) = rewrite_set_ ctxt false prog_expr t;
117.51 -if UnparseC.term_in_ctxt @{context} t = "3" then ()
117.52 +if UnparseC.term @{context} t = "3" then ()
117.53 else error "Length [1, 1, 1] = 3 ..prog_expr changed";
117.54
117.55 val t = ParseC.parse_test @{context} "Length [1, 1, 1]";
118.1 --- a/test/Tools/isac/ProgLang/prog_expr.sml Sat Feb 04 16:49:08 2023 +0100
118.2 +++ b/test/Tools/isac/ProgLang/prog_expr.sml Sat Feb 04 17:00:25 2023 +0100
118.3 @@ -68,13 +68,13 @@
118.4 val SOME ("aaa1_", t') =
118.5 SOME (TermC.mk_thmid thmid (string_of_int n) "",
118.6 HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})));
118.7 -if UnparseC.term_in_ctxt @{context} t' = "(2 is_even) = True" then () else error "(2 is_even) = True CHANGED";
118.8 +if UnparseC.term @{context} t' = "(2 is_even) = True" then () else error "(2 is_even) = True CHANGED";
118.9
118.10
118.11 val t = ParseC.parse_test @{context} "3 is_even";
118.12 case eval_is_even "aaa" "Prog_Expr.is_even" t "ccc" of
118.13 SOME (str, t') =>
118.14 - if str = "aaa_" andalso UnparseC.term_in_ctxt @{context} t' = "(3 is_even) = False" then ()
118.15 + if str = "aaa_" andalso UnparseC.term @{context} t' = "(3 is_even) = False" then ()
118.16 else error "eval_is_even (3 is_even) CHANGED 1"
118.17 | NONE => error "eval_is_even (3 is_even) CHANGED 2";
118.18
118.19 @@ -97,27 +97,27 @@
118.20
118.21 val t = ParseC.parse_test @{context} "2 * x is_num";
118.22 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
118.23 -if UnparseC.term_in_ctxt @{context} t' = "(2 * x is_num) = False" then ()
118.24 +if UnparseC.term @{context} t' = "(2 * x is_num) = False" then ()
118.25 else error "(2 * x is_num) = False CHANGED";
118.26
118.27 val t = ParseC.parse_test @{context} "- 2 is_num";
118.28 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
118.29 -if UnparseC.term_in_ctxt @{context} t' = "(- 2 is_num) = True" then ()
118.30 +if UnparseC.term @{context} t' = "(- 2 is_num) = True" then ()
118.31 else error "(- 2 is_num) = False CHANGED";
118.32
118.33 val t = ParseC.parse_test @{context} "- 1 is_num";
118.34 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
118.35 -if UnparseC.term_in_ctxt @{context} t' = "(- 1 is_num) = True" then ()
118.36 +if UnparseC.term @{context} t' = "(- 1 is_num) = True" then ()
118.37 else error "(- 1 is_num) = False CHANGED";
118.38
118.39 val t = ParseC.parse_test @{context} "0 is_num";
118.40 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
118.41 -if UnparseC.term_in_ctxt @{context} t' = "(0 is_num) = True" then ()
118.42 +if UnparseC.term @{context} t' = "(0 is_num) = True" then ()
118.43 else error "(0 is_num) = False CHANGED";
118.44
118.45 val t = ParseC.parse_test @{context} "AA is_num";
118.46 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
118.47 -if UnparseC.term_in_ctxt @{context} t' = "(AA is_num) = False" then ()
118.48 +if UnparseC.term @{context} t' = "(AA is_num) = False" then ()
118.49 else error "(0 is_num) = False CHANGED";
118.50
118.51
118.52 @@ -145,28 +145,28 @@
118.53 val t = @{term "6 / 4 :: real"};
118.54 case eval_cancel "cancel_" "Rings.divide_class.divide" t "" of
118.55 SOME ("cancel_6_4", t') =>
118.56 - if UnparseC.term_in_ctxt @{context} t' = "6 / 4 = 3 / 2" then ()
118.57 + if UnparseC.term @{context} t' = "6 / 4 = 3 / 2" then ()
118.58 else error "eval_cancel - 6 / 4 = - 3 / 2 CHANGED 1"
118.59 | _ => error "eval_cancel - 6 / 4 = - 3 / 2 CHANGED 2";
118.60
118.61 val t = @{term "- 6 / 4 :: real"};
118.62 case eval_cancel "cancel_" "Rings.divide_class.divide" t "" of
118.63 SOME ("cancel_~6_4", t') =>
118.64 - if UnparseC.term_in_ctxt @{context} t' = "- 6 / 4 = - 3 / 2" then ()
118.65 + if UnparseC.term @{context} t' = "- 6 / 4 = - 3 / 2" then ()
118.66 else error "eval_cancel - 6 / 4 = - 3 / 2 CHANGED 1"
118.67 | _ => error "eval_cancel - 6 / 4 = - 3 / 2 CHANGED 2";
118.68
118.69 val t = @{term "6 / - 4 :: real"};
118.70 case eval_cancel "cancel_" "Rings.divide_class.divide" t "" of
118.71 SOME ("cancel_6_~4", t') =>
118.72 - if UnparseC.term_in_ctxt @{context} t' = "6 / - 4 = - 3 / 2" then ()
118.73 + if UnparseC.term @{context} t' = "6 / - 4 = - 3 / 2" then ()
118.74 else error "eval_cancel 6 / - 4 = - 3 / 2 CHANGED 1"
118.75 | _ => error "eval_cancel 6 / - 4 = - 3 / 2 CHANGED 2";
118.76
118.77 val t = @{term "- 6 /- 4 :: real"};
118.78 case eval_cancel "cancel_" "Rings.divide_class.divide" t "" of
118.79 SOME ("cancel_~6_~4", t') =>
118.80 - if UnparseC.term_in_ctxt @{context} t' = "- 6 / - 4 = 3 / 2" then ()
118.81 + if UnparseC.term @{context} t' = "- 6 / - 4 = 3 / 2" then ()
118.82 else error "eval_cancel - 6 / - 4 = 3 / 2 CHANGED 1"
118.83 | _ => error "eval_cancel - 6 / - 4 = 3 / 2 CHANGED 2";
118.84
118.85 @@ -210,16 +210,16 @@
118.86 val t = ParseC.parse_test @{context} "(x + 1) = (x + 1)";
118.87 val (Const _(*op0,t0*) $ t1 $ t2 ) = t
118.88 val SOME ("equal_(x + 1)_(x + 1)", t') = eval_equal "equal_" \<^const_name>\<open>HOL.eq\<close> t ctxt;
118.89 -if UnparseC.term_in_ctxt @{context} t' = "(x + 1 = x + 1) = True" then () else error "(x + 1) = (x + 1) CHANGED";
118.90 +if UnparseC.term @{context} t' = "(x + 1 = x + 1) = True" then () else error "(x + 1) = (x + 1) CHANGED";
118.91
118.92 val t as Const _ $ v $ c = ParseC.parse_test @{context} "1 = 0";
118.93 val false = variable_constant_pair (v, c);
118.94 val SOME ("equal_(1)_(0)", t') = eval_equal "equal_" \<^const_name>\<open>HOL.eq\<close> t ctxt;
118.95 -if UnparseC.term_in_ctxt @{context} t' = "(1 = 0) = False" then () else error "1 = 0 CHANGED";
118.96 +if UnparseC.term @{context} t' = "(1 = 0) = False" then () else error "1 = 0 CHANGED";
118.97
118.98 val t = ParseC.parse_test @{context} "0 = 0";
118.99 val SOME ("equal_(0)_(0)", t') = eval_equal "equal_" \<^const_name>\<open>HOL.eq\<close> t ctxt;
118.100 -if UnparseC.term_in_ctxt @{context} t' = "(0 = 0) = True" then () else error "0 = 0 CHANGED";
118.101 +if UnparseC.term @{context} t' = "(0 = 0) = True" then () else error "0 = 0 CHANGED";
118.102
118.103
118.104 "-------- occurs_in ----------------------------------------------------------------------------";
118.105 @@ -230,7 +230,7 @@
118.106
118.107 val t = ParseC.parse_test @{context} "x occurs_in x";
118.108 val SOME (str, t') = eval_occurs_in 0 "Prog_Expr.occurs_in" t 0;
118.109 -if UnparseC.term_in_ctxt @{context} t' = "x occurs_in x = True" then ()
118.110 +if UnparseC.term @{context} t' = "x occurs_in x = True" then ()
118.111 else error "x occurs_in x = True ..changed";
118.112
118.113 "------- some_occur_in";
118.114 @@ -239,13 +239,13 @@
118.115
118.116 val t = @{term "some_of [c, c_2, c_3, c_4] occur_in -1 * q_0 * L \<up> 2 / 2 + L * c + c_2"};
118.117 val SOME (str, t') = eval_some_occur_in 0 "Prog_Expr.some_occur_in" t 0;
118.118 -if UnparseC.term_in_ctxt @{context} t' =
118.119 +if UnparseC.term @{context} t' =
118.120 "some_of [c, c_2, c_3,\n c_4] occur_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 =\nTrue" then ()
118.121 else error "atools.sml: some_occur_in true";
118.122
118.123 val t = @{term "some_of [c_3, c_4] occur_in -1 * q_0 * L \<up> 2 / 2 + L * c + c_2"};
118.124 val SOME (str,t') = eval_some_occur_in 0 "Prog_Expr.some_occur_in" t 0;
118.125 -if UnparseC.term_in_ctxt @{context} t' =
118.126 +if UnparseC.term @{context} t' =
118.127 "some_of [c_3, c_4] occur_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 = False" then ()
118.128 else error "atools.sml: some_occur_in false";
118.129
118.130 @@ -339,7 +339,7 @@
118.131 "---------fun eval_argument_of -----------------------------------------------------------------";
118.132 val t = ParseC.parse_test @{context} "argument_in (M_b x)";
118.133 val SOME (str, t') = eval_argument_in "0" "Prog_Expr.argument_in" t 0;
118.134 -if UnparseC.term_in_ctxt @{context} t' = "(argument_in M_b x) = x" then ()
118.135 +if UnparseC.term @{context} t' = "(argument_in M_b x) = x" then ()
118.136 else error "atools.sml:(argument_in M_b x) = x ???";
118.137
118.138
118.139 @@ -375,7 +375,7 @@
118.140 val (p as Const (\<^const_name>\<open>filter_sameFunId\<close>,_) $ (fid $ _) $ fs) =
118.141 @{term "filter_sameFunId (y' L) [M_b x = c + L*x, y' x = c + L*x, y x = c + L*x]"};
118.142 val SOME (str, es) = eval_filter_sameFunId "" "Prog_Expr.filter_sameFunId" p "";
118.143 -if UnparseC.term_in_ctxt @{context} es = "(filter_sameFunId y' L [M_b x = c + L * x, y' x = c + L * x,\n y x = c + L * x]) =\n[y' x = c + L * x]" then ()
118.144 +if UnparseC.term @{context} es = "(filter_sameFunId y' L [M_b x = c + L * x, y' x = c + L * x,\n y x = c + L * x]) =\n[y' x = c + L * x]" then ()
118.145 else error "atools.slm diff.behav. in filter_sameFunId";
118.146
118.147
118.148 @@ -383,7 +383,7 @@
118.149 "---------fun eval_boollist2sum ----------------------------------------------------------------";
118.150 "---------fun eval_boollist2sum ----------------------------------------------------------------";
118.151 fun lhs (Const (\<^const_name>\<open>HOL.eq\<close>,_) $ l $ _) = l
118.152 - | lhs t = error("lhs called with (" ^ UnparseC.term_in_ctxt @{context} t ^ ")");
118.153 + | lhs t = error("lhs called with (" ^ UnparseC.term @{context} t ^ ")");
118.154 "----------- \<up> redefined due to overwritten identifier -----------";
118.155 val u_ = @{term "[]"};
118.156 val u_ = @{term "[b1 = k - 2*q]"};
118.157 @@ -391,7 +391,7 @@
118.158 val ut_ = isalist2list u_;
118.159 val sum_ = map lhs ut_;
118.160 val t = list2sum sum_;
118.161 -UnparseC.term_in_ctxt @{context} t;
118.162 +UnparseC.term @{context} t;
118.163
118.164 val t = @{term "boollist2sum [b1 = k - 2*(q::real), b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]"};
118.165 case t of
118.166 @@ -407,7 +407,7 @@
118.167 Const (\<^const_name>\<open>Nil\<close>, _))))) => ()
118.168 | _ => error "boollist2sum CHANGED";
118.169 val SOME (str, pred) = eval_boollist2sum "" "Prog_Expr.boollist2sum" t "";
118.170 -if UnparseC.term_in_ctxt @{context} pred = "boollist2sum\n [b1 = k - 2 * q, b2 = k - 2 * q, b3 = k - 2 * q, b4 = k - 2 * q] =\nb1 + b2 + b3 + b4" then ()
118.171 +if UnparseC.term @{context} pred = "boollist2sum\n [b1 = k - 2 * q, b2 = k - 2 * q, b3 = k - 2 * q, b4 = k - 2 * q] =\nb1 + b2 + b3 + b4" then ()
118.172 else error "atools.sml diff.behav. in eval_boollist2sum";
118.173
118.174 val srls_ = Rule_Set.append_rules "srls_..Berechnung-erstSymbolisch" Rule_Set.empty
118.175 @@ -437,13 +437,13 @@
118.176 (*if*) Calc_Binop.is c andalso is_num t1 andalso is_num t2 (*then*);
118.177 val res = Calc_Binop.simplify ctxt t;
118.178 val prop = HOLogic.Trueprop $ (HOLogic.mk_eq (t, res));
118.179 - SOME ("#: " ^ UnparseC.term_in_ctxt @{context} prop, prop) (*return value*);
118.180 + SOME ("#: " ^ UnparseC.term @{context} prop, prop) (*return value*);
118.181 ;
118.182 -if "#: " ^ UnparseC.term_in_ctxt @{context} prop = "#: 2 * 3 = 6" andalso UnparseC.term_in_ctxt @{context} prop = "2 * 3 = 6" then ()
118.183 +if "#: " ^ UnparseC.term @{context} prop = "#: 2 * 3 = 6" andalso UnparseC.term @{context} prop = "2 * 3 = 6" then ()
118.184 else error "eval_binop changed"
118.185 ;
118.186 val SOME (thmid, tm) = Calc_Binop.numeric "#mult_" op_ t ctxt;
118.187 -if thmid = "#: 2 * 3 = 6" andalso UnparseC.term_in_ctxt @{context} prop = "2 * 3 = 6" then ()
118.188 +if thmid = "#: 2 * 3 = 6" andalso UnparseC.term @{context} prop = "2 * 3 = 6" then ()
118.189 else error "eval_binop changed 2"
118.190
118.191
118.192 @@ -466,8 +466,8 @@
118.193 case or2list @{term False} of Const (\<^const_name>\<open>Nil\<close>, _) => ()
118.194 | _ => error "TermC.UniversalList changed 2";
118.195 val t = (ParseC.parse_test @{context} "x=3");
118.196 -if UnparseC.term_in_ctxt @{context} (or2list t) = "[x = 3]" then ()
118.197 +if UnparseC.term @{context} (or2list t) = "[x = 3]" then ()
118.198 else error "or2list changed";
118.199 val t = (ParseC.parse_test @{context} "x=3 | x=-3 | x=0");
118.200 -if UnparseC.term_in_ctxt @{context} (or2list t) = "[x = 3, x = - 3, x = 0]" then ()
118.201 +if UnparseC.term @{context} (or2list t) = "[x = 3, x = - 3, x = 0]" then ()
118.202 else error "HOL.eq ? HOL.disj ? changed";
119.1 --- a/test/Tools/isac/Specify/refine.sml Sat Feb 04 16:49:08 2023 +0100
119.2 +++ b/test/Tools/isac/Specify/refine.sml Sat Feb 04 17:00:25 2023 +0100
119.3 @@ -529,7 +529,7 @@
119.4 val ((pt, _), _) = States.get_calc 1;
119.5 val p = States.get_pos 1 1;
119.6 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p);
119.7 -if UnparseC.term_in_ctxt @{context} f = "[x = 6 / 5]" then () else error "equation for timing CHANGED"
119.8 +if UnparseC.term @{context} f = "[x = 6 / 5]" then () else error "equation for timing CHANGED"
119.9
119.10 "----------- refine ad-hoc equation for timing: with/out adapt_to_type -------------------------";
119.11 "----------- refine ad-hoc equation for timing: with/out adapt_to_type -------------------------";
120.1 --- a/test/Tools/isac/Specify/specify.sml Sat Feb 04 16:49:08 2023 +0100
120.2 +++ b/test/Tools/isac/Specify/specify.sml Sat Feb 04 17:00:25 2023 +0100
120.3 @@ -244,9 +244,9 @@
120.4 "~~~~~ fun values' , args:"; val (ctxt, oris) = (ctxt, f_model);
120.5 (*//------------------ inserted hidden code ------------------------------------------------\\*)
120.6 fun ori2fmz_vals (_, _, _, dsc, ts) =
120.7 - case \<^try>\<open>(((UnparseC.term_in_ctxt ctxt) o Input_Descript.join') (dsc, ts), last_elem ts)\<close> of
120.8 + case \<^try>\<open>(((UnparseC.term ctxt) o Input_Descript.join') (dsc, ts), last_elem ts)\<close> of
120.9 SOME x => x
120.10 - | NONE => raise ERROR ("O_Model.values' called with " ^ UnparseC.terms_in_ctxt ctxt ts);
120.11 + | NONE => raise ERROR ("O_Model.values' called with " ^ UnparseC.terms ctxt ts);
120.12 (*\\------------------ inserted hidden code ------------------------------------------------//*)
120.13 (split_list o (map
120.14 ori2fmz_vals)) oris;
120.15 @@ -968,8 +968,8 @@
120.16 "(#Given, (AbleitungBiegelinie, id_der))\", \"" ^
120.17 "(#Find, (Funktionen, fun_s))\"]"
120.18 (*+*)then () else error "associate_input' Model_Pattern CHANGED";
120.19 -(*+*)if UnparseC.term_in_ctxt @{context} d = "Biegelinie" andalso UnparseC.terms_in_ctxt @{context} ts = "[y]"
120.20 -(*+*) andalso UnparseC.terms_in_ctxt @{context} ts' = "[y]"
120.21 +(*+*)if UnparseC.term @{context} d = "Biegelinie" andalso UnparseC.terms @{context} ts = "[y]"
120.22 +(*+*) andalso UnparseC.terms @{context} ts' = "[y]"
120.23 (*+*)then
120.24 (*+*) (case (inter op = ts ts') of [Free ("y", _(*"real \<Rightarrow> real"*))] => ()
120.25 (*+*) | _ => error "check within associate_input' CHANGED 1")
121.1 --- a/test/Tools/isac/Specify/step-specify.sml Sat Feb 04 16:49:08 2023 +0100
121.2 +++ b/test/Tools/isac/Specify/step-specify.sml Sat Feb 04 17:00:25 2023 +0100
121.3 @@ -93,5 +93,5 @@
121.4
121.5 val (Form t,_,_) = ME_Misc.pt_extract ctxt ptp;
121.6
121.7 -if UnparseC.term_in_ctxt @{context} t = "c + x + 1 / 3 * x \<up> 3" andalso p = ([], Res) then ()
121.8 +if UnparseC.term @{context} t = "c + x + 1 / 3 * x \<up> 3" andalso p = ([], Res) then ()
121.9 else error "mathengine.sml -- fun autoCalculate -- end";
122.1 --- a/test/Tools/isac/Test_Code/test-code.sml Sat Feb 04 16:49:08 2023 +0100
122.2 +++ b/test/Tools/isac/Test_Code/test-code.sml Sat Feb 04 17:00:25 2023 +0100
122.3 @@ -46,7 +46,7 @@
122.4 (*[], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*End_Proof'*)
122.5
122.6 if p = ([], Res) andalso f2str t = "[x = 1]" andalso
122.7 - eq_set op = (get_ctxt pt p |> ContextC.get_assumptions |> map (UnparseC.term_in_ctxt @{context}),
122.8 + eq_set op = (get_ctxt pt p |> ContextC.get_assumptions |> map (UnparseC.term @{context}),
122.9 ["precond_rootmet x", "matches (?a = ?b) (- 1 + x = 0)", "x = 1"])
122.10 then case nxt of End_Proof' => () | _ => error "fun me_trace all Minisubpbl CHANGED 1"
122.11 else error "fun me_trace all Minisubpbl CHANGED 2";