2 theory example_2 imports Isac.Isac_Knowledge
5 section\<open>Symbol Representation\<close>
15 UnparseC.term @{term "\<rho> "};
18 section\<open>Working with Rulesets\<close>
21 rule1: "1 = \<delta>[n]" and
22 rule2: "|| z || > 1 ==> z / (z - 1) = u [n]" and
23 rule3: "|| z || < 1 ==> z / (z - 1) = -u [-n - 1]" and
24 rule4: "|| z || > || \<alpha> || ==> z / (z - \<alpha>) = \<alpha>\<up>n * u [n]"
33 text\<open>Create Ruleset and insert rules\<close>
36 val transform = Rule_Set.append_rules "transform" Rule_Set.empty
37 [ Thm ("rule3",ThmC.numerals_to_Free @{thm rule3}),
38 Thm ("rule4",ThmC.numerals_to_Free @{thm rule4}),
39 Thm ("rule1",ThmC.numerals_to_Free @{thm rule1})
43 text\<open>Apply the Ruleset to a term\<close>
46 val t = parse_test @{context} "z / (z - 1) + z / (z - \<alpha>) + 1::real";
47 val SOME (t', asm) = rewrite_set_ thy true transform t;
52 UnparseC.term t' = "z / (z - ?\<delta> [?n]) + z / (z - \<alpha>) + ?\<delta> [?n]";
53 UnparseC.term t' = "?u [?n] + \<alpha>\<up>?n u[n] + ?\<delta> [?n]";
56 text\<open>Problems: Rule~1 is applied before the expression is checked for Rule~4
57 which would be the correct one. Rule~1 only matches a part of the