test/Tools/isac/ProgLang/prog-tools.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 02 Oct 2019 16:02:17 +0200
changeset 59637 8881c5d28f82
parent 59635 9fc1bb69813c
child 59688 f45ccbb87ea3
permissions -rw-r--r--
lucin: use #> in Program in analogy to #> in Isabelle/ML
walther@59603
     1
(* Title: "ProgLang/scrtools.sml"
walther@59603
     2
           tests on tools for scripts
walther@59603
     3
   Author: Walther Neuper 060605
walther@59603
     4
   (c) due to copyright terms
walther@59603
     5
*)
walther@59603
     6
"-----------------------------------------------------------------";
walther@59603
     7
"table of contents -----------------------------------------------";
walther@59603
     8
"-----------------------------------------------------------------";
walther@59603
     9
"-------- test the same called by interSteps norm_Poly -----------";
walther@59603
    10
"-------- test the same called by interSteps norm_Rational -------";
walther@59603
    11
"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
walther@59603
    12
"-------- distinguish input to Model -----------------------------------------";
walther@59603
    13
"-------- fun subpbl, fun pblterm --------------------------------------------";
walther@59603
    14
"-------- fun stacpbls, fun subst_stacexpr -----------------------------------";
walther@59603
    15
"-------- fun is_calc, fun op_of_calc ----------------------------------------";
walther@59603
    16
"-------- fun rule2stac, fun rule2stac_inst ----------------------------------";
walther@59637
    17
"-------- fun op #> ----------------------------------------------------------";
walther@59603
    18
"-------- fun get_fun_id -----------------------------------------------------";
walther@59603
    19
"-------- fun rules2scr_Rls --------------------------------------------------";
walther@59603
    20
"-----------------------------------------------------------------------------";
walther@59603
    21
"-----------------------------------------------------------------------------";
walther@59603
    22
"-----------------------------------------------------------------------------";
walther@59603
    23
walther@59603
    24
"-------- test the same called by interSteps norm_Poly -----------";
walther@59603
    25
"-------- test the same called by interSteps norm_Poly -----------";
walther@59603
    26
"-------- test the same called by interSteps norm_Poly -----------";
walther@59603
    27
val Seq {scr = Prog auto_script,...} = assoc_rls "norm_Poly";
walther@59603
    28
writeln(term2str auto_script);
walther@59603
    29
(*Program Stepwise t_t   =
walther@59637
    30
 (Try (Rewrite_Set discard_minus) #>
walther@59637
    31
  Try (Rewrite_Set expand_poly_) #>
walther@59637
    32
  Try (Repeat (Calculate TIMES)) #>
walther@59637
    33
  Try (Rewrite_Set order_mult_rls_) #>
walther@59637
    34
  Try (Rewrite_Set simplify_power_) #>
walther@59637
    35
  Try (Rewrite_Set calc_add_mult_pow_) #>
walther@59637
    36
  Try (Rewrite_Set reduce_012_mult_) #>
walther@59637
    37
  Try (Rewrite_Set order_add_rls_) #>
walther@59637
    38
  Try (Rewrite_Set collect_numerals_) #>
walther@59637
    39
  Try (Rewrite_Set reduce_012_) #>
walther@59635
    40
  Try (Rewrite_Set discard_parentheses1))
walther@59603
    41
  ??.empty                                          ..WORKS, NEVERTHELESS *)
walther@59603
    42
atomty auto_script;
walther@59603
    43
walther@59603
    44
reset_states (); (*<-- evaluate, if ML-blocks are edited below*)
walther@59603
    45
CalcTree
walther@59603
    46
[(["Term (b + a - b)", "normalform N"], 
walther@59603
    47
  ("Poly",["polynomial","simplification"],
walther@59603
    48
  ["simplification","for_polynomials"]))];
walther@59603
    49
Iterator 1;
walther@59603
    50
moveActiveRoot 1;
walther@59603
    51
walther@59603
    52
autoCalculate 1 CompleteCalc;
walther@59603
    53
val ((pt,p),_) = get_calc 1;
walther@59603
    54
show_pt pt;
walther@59603
    55
(* isabisac17 = 15 [
walther@59603
    56
(([], Frm), Simplify (b + a - b)),
walther@59603
    57
(([1], Frm), b + a - b),
walther@59603
    58
(([1], Res), a),
walther@59603
    59
(([], Res), a)] *)
walther@59603
    60
walther@59603
    61
interSteps 1 ([], Res);
walther@59603
    62
val ((pt,p),_) = get_calc 1; show_pt pt;
walther@59603
    63
show_pt pt;
walther@59603
    64
(* isabisac17 = 15 [
walther@59603
    65
(([], Frm), Simplify (b + a - b)),
walther@59603
    66
(([1], Frm), b + a - b),
walther@59603
    67
(([1], Res), a),
walther@59603
    68
(([], Res), a)] *)
walther@59603
    69
walther@59603
    70
interSteps 1 ([1], Res);(*<SYSERROR><CALCID>1</CALCID><ERROR>error in kernel 8</ERROR></SYSERROR>*)
walther@59603
    71
"~~~~~ fun interSteps, args:"; val (cI, ip) = (1, ([1], Res));
walther@59603
    72
 val ((pt, p), tacis) = get_calc cI;
walther@59603
    73
(*if*) (not o is_interpos) ip = false;
walther@59603
    74
val ip' = lev_pred' pt ip;
walther@59603
    75
walther@59603
    76
(*Math_Engine.detailstep pt ip      ..ERROR interSteps>..>init_istate: "norm_Poly" has EmptyScr*)
walther@59603
    77
val ("donesteps", ctree_BEFORE_step_into, pos'_BEFORE_step_into) = Math_Engine.detailstep pt ip;
walther@59603
    78
"~~~~~ fun detailstep, args:"; val (pt, (pos as (p, _))) = (pt, ip);
walther@59603
    79
    val nd = Ctree.get_nd pt p
walther@59603
    80
    val cn = Ctree.children nd;
walther@59603
    81
(*if*) null cn = false;
walther@59603
    82
walther@59603
    83
"~~~~~ to detailrls return val:";
walther@59603
    84
(*else*) 
walther@59603
    85
val return_val = ("donesteps", pt, (p @ [length (Ctree.children (Ctree.get_nd pt p))], Ctree.Res));
walther@59603
    86
if p @ [length (Ctree.children (Ctree.get_nd pt p))] = [1, 4]
walther@59603
    87
then () else error "detailrls: auto-generated norm_Poly doesnt work";
walther@59603
    88
walther@59603
    89
val ((pt,p),_) = get_calc 1; show_pt pt;
walther@59603
    90
show_pt pt; (*[
walther@59603
    91
(([], Frm), Simplify (b + a - b)),
walther@59603
    92
(([1], Frm), b + a - b),
walther@59603
    93
(([1,1], Frm), b + a - b),
walther@59603
    94
(([1,1], Res), b + a + -1 * b),
walther@59603
    95
(([1,2], Res), a + b + -1 * b),
walther@59603
    96
(([1,3], Res), a + 0 * b),
walther@59603
    97
(([1,4], Res), a),
walther@59603
    98
(([1], Res), a),
walther@59603
    99
(([], Res), a)]  *)
walther@59603
   100
if existpt' ([1,4], Res) pt then ()
walther@59603
   101
else error  "auto-generated norm_Poly doesnt work";
walther@59603
   102
walther@59603
   103
walther@59603
   104
"-------- test the same called by interSteps norm_Rational -------";
walther@59603
   105
"-------- test the same called by interSteps norm_Rational -------";
walther@59603
   106
"-------- test the same called by interSteps norm_Rational -------";
walther@59603
   107
walther@59603
   108
val Seq {scr = Prog auto_script,...} = assoc_rls "norm_Rational";
walther@59603
   109
writeln(term2str auto_script);
walther@59603
   110
atomty auto_script;
walther@59603
   111
(*** 
walther@59603
   112
*** Const (Program.Stepwise, 'z => 'z => 'z)
walther@59603
   113
*** . Free (t_t, 'z)
walther@59603
   114
*** . Const (Program.Seq, ('a => 'a) => ('a => 'a) => 'a => 'a)
walther@59603
   115
*** . . Const (Program.Try, ('a => 'a) => 'a => 'a)
walther@59603
   116
*** . . . Const (Program.Rewrite'_Set, ID => bool => 'a => 'a)
walther@59603
   117
*** . . . . Free (discard_minus, ID)
walther@59603
   118
*** . . Const (Program.Seq, ('a => 'a) => ('a => 'a) => 'a => 'a)
walther@59603
   119
*** . . . Const (Program.Try, ('a => 'a) => 'a => 'a)
walther@59603
   120
*** . . . . Const (Program.Rewrite'_Set, ID => bool => 'a => 'a)
walther@59603
   121
*** . . . . . Free (rat_mult_poly, ID)
walther@59603
   122
*** . . . Const (Program.Seq, ('a => 'a) => ('a => 'a) => 'a => 'a)
walther@59603
   123
*** . . . . Const (Program.Try, ('a => 'a) => 'a => 'a)
walther@59603
   124
*** . . . . . Const (Program.Rewrite'_Set, ID => bool => 'a => 'a)
walther@59603
   125
*** . . . . . . Free (make_rat_poly_with_parentheses, ID)
walther@59603
   126
*** . . . . Const (Program.Seq, ('a => 'a) => ('a => 'a) => 'a => 'a)
walther@59603
   127
*** . . . . . Const (Program.Try, ('a => 'a) => 'a => 'a)
walther@59603
   128
*** . . . . . . Const (Program.Rewrite'_Set, ID => bool => 'a => 'a)
walther@59603
   129
*** . . . . . . . Free (cancel_p_rls, ID)
walther@59603
   130
*** . . . . . Const (Program.Seq, ('a => 'a) => ('a => 'a) => 'a => 'a)
walther@59603
   131
*** . . . . . . Const (Program.Try, ('a => 'a) => 'a => 'a)
walther@59603
   132
*** . . . . . . . Const (Program.Rewrite'_Set, ID => bool => 'a => 'a)
walther@59603
   133
*** . . . . . . . . Free (norm_Rational_rls, ID)
walther@59603
   134
*** . . . . . . Const (Program.Try, ('a => 'a) => 'a => 'a)
walther@59603
   135
*** . . . . . . . Const (Program.Rewrite'_Set, ID => bool => 'a => 'a)
walther@59603
   136
*** . . . . . . . . Free (discard_parentheses1, ID)
walther@59603
   137
*** . . Const (empty, 'a)
walther@59603
   138
***)
walther@59603
   139
reset_states ();
walther@59603
   140
CalcTree
walther@59603
   141
[(["Term (b + a - b)", "normalform N"], 
walther@59603
   142
  ("Poly",["polynomial","simplification"],
walther@59603
   143
  ["simplification","of_rationals"]))];
walther@59603
   144
Iterator 1;
walther@59603
   145
moveActiveRoot 1;
walther@59603
   146
autoCalculate 1 CompleteCalc;
walther@59603
   147
walther@59603
   148
interSteps 1 ([], Res);
walther@59603
   149
val ((pt,p),_) = get_calc 1; show_pt pt;
walther@59603
   150
walther@59603
   151
interSteps 1 ([1], Res);
walther@59603
   152
val ((pt,p),_) = get_calc 1; show_pt pt;
walther@59603
   153
walther@59603
   154
(*with "Program SimplifyScript (t_::real) =                \
walther@59635
   155
       \  ((Rewrite_Set norm_Rational) t_)"
walther@59603
   156
val (Form form, SOME tac, asm) = pt_extract (pt, ([1], Res));
walther@59603
   157
*)
walther@59603
   158
val (Form form, SOME tac, asm) = pt_extract (pt, ([2], Res));
walther@59603
   159
case (term2str form, tac, terms2strs asm) of
walther@59603
   160
    ("a", Check_Postcond ["polynomial", "simplification"], []) => ()
walther@59603
   161
  | _ => error "scrtools.sml: auto-generated norm_Rational doesnt work";
walther@59603
   162
walther@59603
   163
"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
walther@59603
   164
"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
walther@59603
   165
"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
walther@59603
   166
val rls = assoc_rls "integration";
walther@59603
   167
val Seq {scr = Prog auto_script,...} = rls;
walther@59603
   168
writeln(term2str auto_script);
walther@59603
   169
walther@59603
   170
if contain_bdv (get_rules rls) then ()
walther@59603
   171
else error "scrtools.sml: contain_bdv doesnt work for 'integration'";
walther@59603
   172
walther@59603
   173
if terms2str (formal_args auto_script) = "[\"t_t\",\"v\"]"
walther@59603
   174
then () else error "formal_args of auto-gen.script changed";
walther@59603
   175
init_istate (Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")) 
walther@59603
   176
			      (str2term "someTermWithBdv");
walther@59603
   177
walther@59603
   178
"-------- fun stacpbls, fun subst_stacexpr -----------------------------------";
walther@59603
   179
"-------- fun stacpbls, fun subst_stacexpr -----------------------------------";
walther@59603
   180
"-------- fun stacpbls, fun subst_stacexpr -----------------------------------";
walther@59603
   181
val {scr, ...} = get_met ["Test","sqrt-equ-test"]; val Prog sc = scr; val ts = stacpbls sc;
walther@59603
   182
case stacpbls sc of
walther@59635
   183
  [Const ("Prog_Tac.Rewrite", _) $ square_equation_left,
walther@59635
   184
   Const ("Prog_Tac.Rewrite'_Set", _) $ Test_simplify,
walther@59635
   185
   Const ("Prog_Tac.Rewrite'_Set", _) $ rearrange_assoc,
walther@59635
   186
   Const ("Prog_Tac.Rewrite'_Set", _) $ isolate_root,
walther@59635
   187
   Const ("Prog_Tac.Rewrite'_Set", _) $ norm_equation,
walther@59603
   188
   Const ("Prog_Tac.Rewrite'_Set'_Inst", _) $
walther@59603
   189
     (Const ("List.list.Cons", _) $ (Const ("Product_Type.Pair", _) $ bdv $ Free ("v_v", _)) $
walther@59635
   190
       Const ("List.list.Nil", _))] => 
walther@59603
   191
     if HOLogic.dest_string square_equation_left = "square_equation_left" andalso
walther@59603
   192
       HOLogic.dest_string Test_simplify = "Test_simplify" andalso
walther@59603
   193
       HOLogic.dest_string rearrange_assoc = "rearrange_assoc" andalso
walther@59603
   194
       HOLogic.dest_string isolate_root = "isolate_root" andalso
walther@59603
   195
       HOLogic.dest_string norm_equation = "norm_equation" andalso
walther@59603
   196
       HOLogic.dest_string bdv = "bdv" andalso
walther@59603
   197
       HOLogic.dest_string isolate_bdv = "isolate_bdv"
walther@59603
   198
     then () else error "stacpbls (Test.Solve_root_equation) changed 2"
walther@59603
   199
| _  => error "stacpbls (Test.Solve_root_equation) changed 1";
walther@59603
   200
walther@59603
   201
(* inappropriate input is skipped *)
walther@59603
   202
val t = @{term "(a::real) = (rhs (NTH 1 sol_a))"};
walther@59603
   203
case stacpbls t of [] => () | _ => error "stacpbls rhs (NTH 1 sol_a) changed";
walther@59603
   204
walther@59603
   205
@{term "(SubProblem (BiegelinieX,[vonBelastungZu,Biegelinien], [Biegelinien,ausBelastung]) [REAL q__q, REAL v_v])"};
walther@59603
   206
case stacpbls t of [] => () | _ => error "stacpbls (SubProblem ...) changed";
walther@59603
   207
walther@59603
   208
(* --- fun subst_stacexpr *)
walther@59603
   209
case  subst_stacexpr [] NONE e_term  sc of
walther@59603
   210
(NONE, Expr (Const ("HOL.eq", _) $
walther@59603
   211
 (Const ("Test.solve_root_equ", _) $ Free ("e_e", _) $ Free ("v_v", _)) $
walther@59603
   212
  (Const ("HOL.Let", _) $
walther@59603
   213
    (Const ("Tactical.Seq", _) $
walther@59603
   214
      (Const ("Tactical.While", _) $ _ $
walther@59603
   215
        _ ) $
walther@59603
   216
      (_) $
walther@59603
   217
      Free ("e_e", _)) $
walther@59603
   218
    Abs ("e_e", _, Const ("List.list.Cons", _) $ Free ("e_e", _) $ Const ("List.list.Nil", _)) )
walther@59603
   219
)) => ()
walther@59603
   220
| _ => error "subst_stacexpr [] NONE e_term";
walther@59603
   221
walther@59603
   222
"-------- fun is_calc, fun op_of_calc ----------------------------------------";
walther@59603
   223
"-------- fun is_calc, fun op_of_calc ----------------------------------------";
walther@59603
   224
"-------- fun is_calc, fun op_of_calc ----------------------------------------";
walther@59603
   225
val rls = prep_rls @{theory} Test_simplify; (* adds the Program *)
walther@59603
   226
val Prog sc = (#scr o rep_rls) rls;
walther@59603
   227
val stacs = stacpbls sc;
walther@59603
   228
walther@59603
   229
val calcs = filter is_calc stacs;
walther@59603
   230
val ids = map op_of_calc calcs;
walther@59603
   231
case ids of
walther@59603
   232
  ["PLUS", "TIMES", "DIVIDE", "POWER"] => ()
walther@59603
   233
| _ => error "op_of_calc";
walther@59603
   234
walther@59603
   235
val calcs = ((assoc_calc' @{theory} |> map) o (map LTool.op_of_calc) o
walther@59603
   236
  (filter LTool.is_calc) o LTool.stacpbls) sc;
walther@59603
   237
case calcs of
walther@59603
   238
  [("PLUS", ("Groups.plus_class.plus", _)), ("TIMES", ("Groups.times_class.times", _)), 
walther@59603
   239
  ("DIVIDE", ("Rings.divide_class.divide", _)), ("POWER", ("Prog_Expr.pow", _))] => ()
walther@59603
   240
| _ => error "get_calcs changed"
walther@59603
   241
walther@59603
   242
"-------- fun rule2stac, fun rule2stac_inst ----------------------------------";
walther@59603
   243
"-------- fun rule2stac, fun rule2stac_inst ----------------------------------";
walther@59603
   244
"-------- fun rule2stac, fun rule2stac_inst ----------------------------------";
walther@59603
   245
val t = rule2stac @{theory} (Thm ("real_diff_minus", num_str @{thm real_diff_minus}));
walther@59635
   246
if term2str t = "Try (Repeat (Rewrite ''real_diff_minus''))" then ()
walther@59603
   247
else error "rule2stac Thm.. changed";
walther@59603
   248
walther@59603
   249
val t = rule2stac @{theory} (Calc ("Groups.plus_class.plus", eval_binop "#add_"));
walther@59603
   250
if term2str t = "Try (Repeat (Calculate ''PLUS''))" then ()
walther@59603
   251
else error "rule2stac Calc.. changed";
walther@59603
   252
walther@59603
   253
val t = rule2stac @{theory} (Rls_ rearrange_assoc);
walther@59635
   254
if term2str t = "Try (Rewrite_Set ''rearrange_assoc'')" then ()
walther@59603
   255
else error "rule2stac Rls_.. changed";
walther@59603
   256
walther@59603
   257
val t = rule2stac_inst @{theory} (Thm ("risolate_bdv_add", num_str @{thm risolate_bdv_add}));
walther@59635
   258
if term2str t = "Try (Repeat (Rewrite_Inst [(''bdv'', v)] ''risolate_bdv_add''))" then ()
walther@59603
   259
else error "rule2stac_inst Thm.. changed";
walther@59603
   260
case t of
walther@59603
   261
  (Const ("Tactical.Try", _) $
walther@59603
   262
    (Const ("Tactical.Repeat", _) $
walther@59603
   263
      (Const ("Prog_Tac.Rewrite'_Inst", _) $
walther@59603
   264
        (Const ("List.list.Cons", _) $
walther@59603
   265
          (Const ("Product_Type.Pair", _) $
walther@59603
   266
            bdv $
walther@59603
   267
            Free ("v", _)) $
walther@59603
   268
          Const ("List.list.Nil", _)) $
walther@59635
   269
        risolate_bdv_add))) => 
walther@59603
   270
      (if HOLogic.dest_string bdv = "bdv" andalso 
walther@59603
   271
        HOLogic.dest_string risolate_bdv_add = "risolate_bdv_add" then ()
walther@59603
   272
      else error "rule2stac_inst changed 1")
walther@59603
   273
| _ => error "rule2stac_inst changed 2"
walther@59603
   274
walther@59637
   275
"-------- fun op #> ----------------------------------------------------------";
walther@59637
   276
"-------- fun op #> ----------------------------------------------------------";
walther@59637
   277
"-------- fun op #> ----------------------------------------------------------";
walther@59603
   278
 val rules = (#rules o rep_rls) isolate_root;
walther@59603
   279
 val rs = map (rule2stac @{theory}) rules;
walther@59637
   280
 val t = #> rs;
walther@59637
   281
if term2str t = "Try (Repeat (Rewrite ''rroot_to_lhs'')) #>\n" ^ 
walther@59637
   282
  "Try (Repeat (Rewrite ''rroot_to_lhs_mult'')) #>\n" ^ 
walther@59637
   283
  "Try (Repeat (Rewrite ''rroot_to_lhs_add_mult'')) #>\n" ^ 
walther@59637
   284
  "Try (Repeat (Rewrite ''risolate_root_add'')) #>\n" ^ 
walther@59637
   285
  "Try (Repeat (Rewrite ''risolate_root_mult'')) #>\n" ^ 
walther@59635
   286
  "Try (Repeat (Rewrite ''risolate_root_div''))"
walther@59637
   287
then () else error "fun #> changed"
walther@59603
   288
walther@59603
   289
"-------- fun get_fun_id -----------------------------------------------------";
walther@59603
   290
"-------- fun get_fun_id -----------------------------------------------------";
walther@59603
   291
"-------- fun get_fun_id -----------------------------------------------------";
walther@59603
   292
(* fun_id is nested into arguments, compare ... *)
walther@59603
   293
val Const ("HOL.Trueprop", _) $ (Const ("HOL.eq", _) $
walther@59603
   294
      (((((((Const (const_id, const_typ) $ _) $ _) $ _) $ _) $ _) $ _) $ _) $ _) =
walther@59603
   295
  Thm.prop_of @{thm biegelinie.simps};
walther@59603
   296
(* ... to: *)
walther@59603
   297
val Const ("HOL.Trueprop", _) $ (Const ("HOL.eq", _) $
walther@59603
   298
      (Const (const_id, const_typ) $ _) $ _) =
walther@59603
   299
  Thm.prop_of @{thm simplify.simps};
walther@59603
   300
walther@59603
   301
(* get fun_id out of nesting *)
walther@59603
   302
val Const ("HOL.Trueprop", _) $ (Const ("HOL.eq", _) $
walther@59603
   303
      nested $ _) =
walther@59603
   304
  Thm.prop_of @{thm biegelinie.simps};
walther@59603
   305
val (Const ("Biegelinie.biegelinie", _) $ 
walther@59603
   306
      Var (("l", 0), _) $
walther@59603
   307
        Var (("q", 0), _) $
walther@59603
   308
          Var (("v", 0), _) $
walther@59603
   309
            Var (("b", 0), _) $
walther@59603
   310
              Var (("s", 0), _) $
walther@59603
   311
                Var (("vs", 0), _) $
walther@59603
   312
                Var (("id_abl", 0), _)) = nested;
walther@59603
   313
strip_comb nested;
walther@59603
   314
(*val it =
walther@59603
   315
   (Const ("Biegelinie.biegelinie", "real \<Rightarrow> real \<Rightarrow> real \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> bool list \<Rightarrow> bool")
walther@59603
   316
    ,
walther@59603
   317
    [Var (("l", 0), "real"), Var (("q", 0), "real"), Var (("v", 0), "real"),
walther@59603
   318
     Var (("b", 0), "real \<Rightarrow> real"), Var (("s", 0), "bool list")]):
walther@59603
   319
   term * term list*)
walther@59603
   320
walther@59603
   321
case get_fun_id (prep_program @{thm biegelinie.simps}) of
walther@59603
   322
  ("Biegelinie.biegelinie", _) => ()
walther@59603
   323
| _ => error "get_fun_id changed";
walther@59603
   324
case get_fun_id (prep_program @{thm simplify.simps}) of
walther@59603
   325
  ("PolyMinus.simplify", _) => ()
walther@59603
   326
| _ => error "get_fun_id changed";
walther@59603
   327
walther@59603
   328
"-------- fun rules2scr_Rls --------------------------------------------------";
walther@59603
   329
"-------- fun rules2scr_Rls --------------------------------------------------";
walther@59603
   330
"-------- fun rules2scr_Rls --------------------------------------------------";
walther@59603
   331
(*compare Prog_Expr.*)
walther@59603
   332
val prog = LTool.rules2scr_Rls @{theory} [Rule.Thm ("thm111", @{thm thm111}), Rule.Thm ("refl", @{thm refl})]
walther@59603
   333
;
walther@59603
   334
writeln (t2str @{theory} prog);
walther@59603
   335
(*auto_generated t_t =
walther@59603
   336
Repeat
walther@59637
   337
 ((Try (Repeat (Rewrite ''thm111'')) #>
walther@59635
   338
   Try (Repeat (Rewrite ''refl'')))
walther@59603
   339
   ??.empty)*)
walther@59603
   340
;
walther@59603
   341
if t2str @{theory} prog =
walther@59637
   342
"auto_generated t_t =\nRepeat\n ((Try (Repeat (Rewrite ''thm111'')) #>\n   Try (Repeat (Rewrite ''refl'')))\n   ??.empty)"
walther@59603
   343
then () else error "rules2scr_Rls auto_generated changed"