test/Tools/isac/ProgLang/rewrite.sml
changeset 52105 2786cc9704c8
parent 52101 c3f399ce32af
child 59110 57739650f9b4
equal deleted inserted replaced
52104:83166e7c7e52 52105:2786cc9704c8
   368 if terms2str asms = "[\"a + b is_expanded\",\"c is_expanded\"]"
   368 if terms2str asms = "[\"a + b is_expanded\",\"c is_expanded\"]"
   369 then () else error "rewrite.sml: prepat cancel subst";
   369 then () else error "rewrite.sml: prepat cancel subst";
   370 if ([], true) = eval__true thy 0 asms [] erls
   370 if ([], true) = eval__true thy 0 asms [] erls
   371 then () else error "rewrite.sml: prepat cancel eval__true";
   371 then () else error "rewrite.sml: prepat cancel eval__true";
   372 
   372 
   373 "===== Rational.thy: common_nominator_p ===";
   373 "===== Rational.thy: add_fractions_p ===";
   374 (* if each pat* matches with the current term, the Rrls is applied
   374 (* if each pat* matches with the current term, the Rrls is applied
   375    (there are no preconditions to be checked, they are @{term True}) *)
   375    (there are no preconditions to be checked, they are @{term True}) *)
   376 val t = str2term "a / b + 1 / 2";
   376 val t = str2term "a / b + 1 / 2";
   377 val pat = parse_patt thy "?r / ?s + ?u / ?v";
   377 val pat = parse_patt thy "?r / ?s + ?u / ?v";
   378 val pres = [@{term True}];
   378 val pres = [@{term True}];
   380 val erls = rational_erls;
   380 val erls = rational_erls;
   381 (* erls got from Rrls {erls, prepat, scr = Rfuns {normal_form, ...}, ...} *)
   381 (* erls got from Rrls {erls, prepat, scr = Rfuns {normal_form, ...}, ...} *)
   382 
   382 
   383 val subst = Pattern.match thy (pat, t) (Vartab.empty, Vartab.empty);
   383 val subst = Pattern.match thy (pat, t) (Vartab.empty, Vartab.empty);
   384 if ([], true) = eval__true thy 0 (map (Envir.subst_term subst) pres) [] erls
   384 if ([], true) = eval__true thy 0 (map (Envir.subst_term subst) pres) [] erls
   385 then () else error "rewrite.sml: prepat common_nominator_p";
   385 then () else error "rewrite.sml: prepat add_fractions_p";
   386 
   386 
   387 "===== Poly.thy: order_mult_ ===";
   387 "===== Poly.thy: order_mult_ ===";
   388           (* ?p matched with the current term gives an environment,
   388           (* ?p matched with the current term gives an environment,
   389              which evaluates (the instantiated) "p is_multUnordered" to true*)
   389              which evaluates (the instantiated) "p is_multUnordered" to true*)
   390 val t = str2term "x^^^2 * x";
   390 val t = str2term "x^^^2 * x";