
neuper@42256: (* Title:  Test_Z_Transform
neuper@42256:    Author: Jan Rocnik
neuper@42256:    (c) copyright due to lincense terms.
neuper@42256: 12345678901234567890123456789012345678901234567890123456789012345678901234567890
neuper@42256:         10        20        30        40        50        60        70        80
neuper@42256: *)
neuper@42256: 
neuper@42256: theory Test_Z_Transform imports Isac begin
neuper@42256: 
neuper@42256: section {*trials towards Z transform *}
neuper@42256: text{*===============================*}
neuper@42256: subsection {*terms*}
neuper@42256: ML {*
neuper@42256: @{term "1 < || z ||"};
neuper@42256: @{term "z / (z - 1)"};
neuper@42256: @{term "-u -n - 1"};
neuper@42256: @{term "-u [-n - 1]"}; (*[ ] denotes lists !!!*)
neuper@42256: @{term "z /(z - 1) = -u [-n - 1]"};Isac
neuper@42256: @{term "1 < || z || ==> z / (z - 1) = -u [-n - 1]"};
neuper@42256: term2str @{term "1 < || z || ==> z / (z - 1) = -u [-n - 1]"};
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: (*alpha -->  "</alpha>" *)
neuper@42256: 
neuper@42256: @{term "\<alpha> "};
neuper@42256: @{term "\<delta> "};
neuper@42256: @{term "\<phi> "};
neuper@42256: @{term "\<rho> "};
neuper@42256: term2str @{term "\<rho> "};
neuper@42256: *}
neuper@42256: 
neuper@42256: subsection {*rules*}
neuper@42256: (*axiomatization "z / (z - 1) = -u [-n - 1]" Illegal variable name: "z / (z - 1) = -u [-n - 1]" *)
neuper@42256: (*definition     "z / (z - 1) = -u [-n - 1]" Bad head of lhs: existing constant "op /"*)
neuper@42256: axiomatization where 
neuper@42256:   rule1: "1 = \<delta>[n]" and
neuper@42256:   rule2: "|| z || > 1 ==> z / (z - 1) = u [n]" and
neuper@42256:   rule3: "|| z || < 1 ==> z / (z - 1) = -u [-n - 1]" and 
neuper@42256:   rule4: "|| z || > || \<alpha> || ==> z / (z - \<alpha>) = \<alpha>^^^n * u [n]" and
neuper@42256:   rule5: "|| z || < || \<alpha> || ==> z / (z - \<alpha>) = -(\<alpha>^^^n) * u [-n - 1]" and
neuper@42256:   rule6: "|| z || > 1 ==> z/(z - 1)^^^2 = n * u [n]"
neuper@42256: ML {*
neuper@42256: @{thm rule1};
neuper@42256: @{thm rule2};
neuper@42256: @{thm rule3};
neuper@42256: @{thm rule4};
neuper@42256: *}
neuper@42256: 
neuper@42256: subsection {*apply rules*}
neuper@42256: ML {*
neuper@42256: val inverse_Z = append_rls "inverse_Z" e_rls
neuper@42256:   [ Thm  ("rule3",num_str @{thm rule3}),
neuper@42256:     Thm  ("rule4",num_str @{thm rule4}),
neuper@42256:     Thm  ("rule1",num_str @{thm rule1})   
neuper@42256:   ];
neuper@42256: 
neuper@42256: val t = str2term "z / (z - 1) + z / (z - \<alpha>) + 1";
neuper@42256: val SOME (t', asm) = rewrite_set_ thy true inverse_Z t;
neuper@42256: term2str t' = "z / (z - ?\<delta> [?n]) + z / (z - \<alpha>) + ?\<delta> [?n]"; (*attention rule1 !!!*)
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val (thy, ro, er) = (@{theory}, tless_true, eval_rls);
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val SOME (t, asm1) = rewrite_ thy ro er true (num_str @{thm rule3}) t;
neuper@42256: term2str t = "- ?u [- ?n - 1] + z / (z - \<alpha>) + 1"; (*- real *)
neuper@42256: term2str t;
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val SOME (t, asm2) = rewrite_ thy ro er true (num_str @{thm rule4}) t;
neuper@42256: term2str t = "- ?u [- ?n - 1] + \<alpha> ^^^ ?n * ?u [?n] + 1"; (*- real *)
neuper@42256: term2str t;
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val SOME (t, asm3) = rewrite_ thy ro er true (num_str @{thm rule1}) t;
neuper@42256: term2str t = "- ?u [- ?n - 1] + \<alpha> ^^^ ?n * ?u [?n] + ?\<delta> [?n]"; (*- real *)
neuper@42256: term2str t;
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: terms2str (asm1 @ asm2 @ asm3);
neuper@42256: *}
neuper@42256: 
neuper@42256: section {*Prepare steps in CTP-based programming language*}
neuper@42256: text{*===================================================*}
neuper@42256: subsection {*prepare expression*}
neuper@42256: ML {*
neuper@42256: val ctxt = ProofContext.init_global @{theory};
neuper@42256: val ctxt = declare_constraints' [@{term "z::real"}] ctxt;
neuper@42256: 
neuper@42256: val SOME fun1 = parseNEW ctxt "X z = 3 / (z - 1/4 + -1/8 * z ^^^ -1)"; term2str fun1;
neuper@42256: val SOME fun1' = parseNEW ctxt "X z = 3 / (z - 1/4 + -1/8 * (1/z))"; term2str fun1';
neuper@42256: *}
neuper@42256: 
neuper@42256: axiomatization where
neuper@42256:   ruleZY: "(X z = a / b) = (X' z = a / (z * b))"
neuper@42256: 
neuper@42256: ML {*
neuper@42256: val (thy, ro, er) = (@{theory}, tless_true, eval_rls);
neuper@42256: val SOME (fun2, asm1) = rewrite_ thy ro er true  @{thm ruleZY} fun1; term2str fun2;
neuper@42256: val SOME (fun2', asm1) = rewrite_ thy ro er true  @{thm ruleZY} fun1'; term2str fun2';
neuper@42256: 
neuper@42256: val SOME (fun3,_) = rewrite_set_ @{theory Isac} false norm_Rational fun2;
neuper@42256: term2str fun3; (*fails on x^^^(-1) TODO*)
neuper@42256: val SOME (fun3',_) = rewrite_set_ @{theory Isac} false norm_Rational fun2';
neuper@42256: term2str fun3'; (*OK*)
neuper@42256: 
neuper@42256: val (_, expr) = HOLogic.dest_eq fun3'; term2str expr;
neuper@42256: *}
neuper@42256: 
neuper@42256: subsection {*solve equation*}
neuper@42256: text {*this type of equation if too general for the present program*}
neuper@42256: ML {*
neuper@42256: "----------- Minisubplb/100-init-rootp (*OK*)bl.sml ---------------------";
neuper@42256: val denominator = parseNEW ctxt "z^^^2 - 1/4*z - 1/8 = 0";
neuper@42256: val fmz = ["equality (z^^^2 - 1/4*z - 1/8 = (0::real))", "solveFor z","solutions L"];
neuper@42256: val (dI',pI',mI') =("Isac", ["univariate","equation"], ["no_met"]);
neuper@42256: (*                           ^^^^^^^^^^^^^^^^^^^^^^ TODO: ISAC determines type of eq*)
neuper@42256: *}
neuper@42256: text {*Does the Equation Match the Specification ?*}
neuper@42256: ML {*
neuper@42256: match_pbl fmz (get_pbt ["univariate","equation"]);
neuper@42256: *}
neuper@42256: 
neuper@42256: ML {*
neuper@42256: val denominator = parseNEW ctxt "-1/8 + -1/4*z + z^^^2 = 0";
neuper@42256: val fmz =                                            (*specification*)
neuper@42256:   ["equality (-1/8 + (-1/4)*z + z^^^2 = (0::real))", (*equality*)
neuper@42256:    "solveFor z",                                     (*bound variable*)
neuper@42256:    "solutions L"];                                   (*identifier for solution*)
neuper@42256: (*liste der theoreme die zum lösen benötigt werden, aus isac, keine spezielle methode (no met)*)
neuper@42256: val (dI',pI',mI') =
neuper@42256:   ("Isac", ["pqFormula","degree_2","polynomial","univariate","equation"], ["no_met"]);
neuper@42256: *}
neuper@42256: text {*Does the Other Equation Match the Specification ?*}
neuper@42256: ML {*
neuper@42256: match_pbl fmz (get_pbt ["pqFormula","degree_2","polynomial","univariate","equation"]);
neuper@42256: *}
neuper@42256: text {*Solve Equation Stepwise*}
neuper@42256: ML {*
neuper@42256: val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;         
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt =..,Check_elementwise "Assumptions")*)
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt;         
neuper@42256: val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f;
neuper@42256: (*[z = 1 / 8 + sqrt (9 / 16) / 2, z = 1 / 8 + -1 * sqrt (9 / 16) / 2] TODO sqrt*)
neuper@42256: show_pt pt; 
neuper@42256: val SOME f = parseNEW ctxt "[z = 1 / 8 + 3 / 8, z = 1 / 8 + -3 / 8]";
neuper@42256: *}
neuper@42256: 
neuper@42256: subsection {*partial fraction decomposition*}
neuper@42256: subsubsection {*solution of the equation*}
neuper@42256: ML {*
neuper@42256: val SOME solutions = parseNEW ctxt "[z=1/2, z=-1/4]";
neuper@42256: term2str solutions;
neuper@42256: atomty solutions;
neuper@42256: *}
neuper@42256: 
neuper@42256: subsubsection {*get solutions out of list*}
neuper@42256: text {*in isac's CTP-based programming language: let s_1 = NTH 1 solutions; s_2 = NTH 2...*}
neuper@42256: ML {*
neuper@42256: val Const ("List.list.Cons", _) $ s_1 $ (Const ("List.list.Cons", _) $
neuper@42256:       s_2 $ Const ("List.list.Nil", _)) = solutions;
neuper@42256: term2str s_1;
neuper@42256: term2str s_2;
neuper@42256: *}
neuper@42256: 
neuper@42256: ML {* (*Solutions as Denominator --> Denominator1 = z - Zeropoint1, Denominator2 = z-Zeropoint2,...*)
neuper@42256: val xx = HOLogic.dest_eq s_1;
neuper@42256: val s_1' = HOLogic.mk_binop "Groups.minus_class.minus" xx;
neuper@42256: val xx = HOLogic.dest_eq s_2;
neuper@42256: val s_2' = HOLogic.mk_binop "Groups.minus_class.minus" xx;
neuper@42256: term2str s_1';
neuper@42256: term2str s_2';
neuper@42256: *}
neuper@42256: 
neuper@42256: subsubsection {*build expression*}
neuper@42256: text {*in isac's CTP-based programming language: let s_1 = Take numerator / (s_1 * s_2)*}
neuper@42256: ML {*
neuper@42256: (*The Main Denominator is the multiplikation of the partial fraction denominators*)
neuper@42256: val denominator' = HOLogic.mk_binop "Groups.times_class.times" (s_1', s_2') ;
neuper@42256: val SOME numerator = parseNEW ctxt "3::real";
neuper@42256: 
neuper@42256: val expr' = HOLogic.mk_binop "Rings.inverse_class.divide" (numerator, denominator');
neuper@42256: term2str expr';
neuper@42256: *}
neuper@42256: 
neuper@42256: subsubsection {*Ansatz - create partial fractions out of our expression*}
neuper@42256: 
neuper@42256: axiomatization where
neuper@42256:   ansatz2: "n / (a*b) = A/a + B/(b::real)" and
neuper@42256:   multiply_eq2: "(n / (a*b) = A/a + B/b) = (a*b*(n  / (a*b)) = a*b*(A/a + B/b))"
neuper@42256: 
neuper@42256: ML {*
neuper@42256: (*we use our ansatz2 to rewrite our expression and get an equilation with our expression on the left and the partial fractions of it on the right side*)
neuper@42256: val SOME (t1,_) = rewrite_ @{theory Isac} e_rew_ord e_rls false @{thm ansatz2} expr';
neuper@42256: term2str t1; atomty t1;
neuper@42256: val eq1 = HOLogic.mk_eq (expr', t1);
neuper@42256: term2str eq1;
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: (*eliminate the demoninators by multiplying the left and the right side with the main denominator*)
neuper@42256: val SOME (eq2,_) = rewrite_ @{theory Isac} e_rew_ord e_rls false @{thm multiply_eq2} eq1;
neuper@42256: term2str eq2;
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: (*simplificatoin*)
neuper@42256: val SOME (eq3,_) = rewrite_set_ @{theory Isac} false norm_Rational eq2;
neuper@42256: term2str eq3; (*?A ?B not simplified*)
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val SOME fract1 =
neuper@42256:   parseNEW ctxt "(z - 1 / 2) * (z - -1 / 4) * (A / (z - 1 / 2) + B / (z - -1 / 4))"; (*A B !*)
neuper@42256: val SOME (fract2,_) = rewrite_set_ @{theory Isac} false norm_Rational fract1;
neuper@42256: term2str fract2 = "(A + -2 * B + 4 * A * z + 4 * B * z) / 4";
neuper@42256: (*term2str fract2 = "A * (1 / 4 + z) + B * (-1 / 2 + z)" would be more traditional*)
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val (numerator, denominator) = HOLogic.dest_eq eq3;
neuper@42256: val eq3' = HOLogic.mk_eq (numerator, fract1); (*A B !*)
neuper@42256: term2str eq3';
neuper@42256: (*MANDATORY: simplify (and remove denominator) otherwise 3 = 0*)
neuper@42256: val SOME (eq3'' ,_) = rewrite_set_ @{theory Isac} false norm_Rational eq3';
neuper@42256: term2str eq3'';
neuper@42256: *}
neuper@42256: 
neuper@42256: subsubsection {*get first koeffizient*}
neuper@42256: 
neuper@42256: ML {*
neuper@42256: (*substitude z with the first zeropoint to get A*)
neuper@42256: val SOME (eq4_1,_) = rewrite_terms_ @{theory Isac} e_rew_ord e_rls [s_1] eq3'';
neuper@42256: term2str eq4_1;
neuper@42256: 
neuper@42256: val SOME (eq4_2,_) = rewrite_set_ @{theory Isac} false norm_Rational eq4_1;
neuper@42256: term2str eq4_2;
neuper@42256: 
neuper@42256: val fmz = ["equality (3 = 3 * A / (4::real))", "solveFor A","solutions L"];
neuper@42256: val (dI',pI',mI') =("Isac", ["univariate","equation"], ["no_met"]);
neuper@42256: (*solve the simple linear equilation for A TODO: return eq, not list of eq*)
neuper@42256: val (p,_,fa,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fa,nxt,_,pt) = me nxt p [] pt; 
neuper@42256: f2str fa;
neuper@42256: *}
neuper@42256: 
neuper@42256: subsubsection {*get second koeffizient*}
neuper@42256: 
neuper@42256: ML {*
neuper@42256: (*substitude z with the second zeropoint to get B*)
neuper@42256: val SOME (eq4b_1,_) = rewrite_terms_ @{theory Isac} e_rew_ord e_rls [s_2] eq3'';
neuper@42256: term2str eq4b_1;
neuper@42256: 
neuper@42256: val SOME (eq4b_2,_) = rewrite_set_ @{theory Isac} false norm_Rational eq4b_1;
neuper@42256: term2str eq4b_2;
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: (*solve the simple linear equilation for B TODO: return eq, not list of eq*)
neuper@42256: val fmz = ["equality (3 = -3 * B / (4::real))", "solveFor B","solutions L"];
neuper@42256: val (dI',pI',mI') =("Isac", ["univariate","equation"], ["no_met"]);
neuper@42256: val (p,_,fb,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
neuper@42256: val (p,_,fb,nxt,_,pt) = me nxt p [] pt; 
neuper@42256: f2str fb;
neuper@42256: *}
neuper@42256: 
neuper@42256: ML {* (*check koeffizients*)
neuper@42256: if f2str fa = "[A = 4]" then () else error "part.fract. eq4_1";
neuper@42256: if f2str fb = "[B = -4]" then () else error "part.fract. eq4_1";
neuper@42256: *}
neuper@42256: 
neuper@42256: subsubsection {*substitute expression with solutions*}
neuper@42256: ML {*
neuper@42256: *}
neuper@42256: 
neuper@42256: section {*Implement the Specification and the Method*}
neuper@42256: text{*==============================================*}
neuper@42256: subsection{*Define the Specification*}
neuper@42256: ML {*
neuper@42256: val thy = @{theory};
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: store_pbt
neuper@42256:  (prep_pbt thy "pbl_SP" [] e_pblID
neuper@42256:  (["SignalProcessing"], [], e_rls, NONE, []));
neuper@42256: store_pbt
neuper@42256:  (prep_pbt thy "pbl_SP_Ztrans" [] e_pblID
neuper@42256:  (["Z_Transform","SignalProcessing"], [], e_rls, NONE, []));
neuper@42256: store_pbt
neuper@42256:  (prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID
neuper@42256:  (["inverse", "Z_Transform", "SignalProcessing"],
neuper@42256:   [("#Given" ,["equality X_eq"]),
neuper@42256:    ("#Find"  ,["equality n_eq"])
neuper@42256:   ],
neuper@42256:   append_rls "e_rls" e_rls [(*for preds in where_*)], NONE, 
neuper@42256:   [["TODO: path to method"]]));
neuper@42256: 
neuper@42256: show_ptyps();
neuper@42256: get_pbt ["inverse","Z_Transform","SignalProcessing"];
neuper@42256: *}
neuper@42256: 
neuper@42256: subsection{*Define the (Dummy-)Method*}
neuper@42256: subsection {*Define Name and Signature for the Method*}
neuper@42256: consts
neuper@42256:   InverseZTransform :: "[bool, bool] => bool"
neuper@42256:     ("((Script InverseZTransform (_ =))// (_))" 9)
neuper@42256: 
neuper@42256: ML {*
neuper@42256: store_met
neuper@42256:  (prep_met thy "met_SP" [] e_metID
neuper@42256:  (["SignalProcessing"], [],
neuper@42256:    {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls,
neuper@42256:     crls = e_rls, nrls = e_rls}, "empty_script"));
neuper@42256: store_met
neuper@42256:  (prep_met thy "met_SP_Ztrans" [] e_metID
neuper@42256:  (["SignalProcessing", "Z_Transform"], [],
neuper@42256:    {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls,
neuper@42256:     crls = e_rls, nrls = e_rls}, "empty_script"));
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: store_met
neuper@42256:  (prep_met thy "met_SP_Ztrans_inv" [] e_metID
neuper@42256:  (["SignalProcessing", "Z_Transform", "inverse"], [],
neuper@42256:    {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls,
neuper@42256:     crls = e_rls, nrls = e_rls}, 
neuper@42256:   "empty_script"
neuper@42256:  ));
neuper@42256: val thy = @{theory}; (*latest version of thy required*)
neuper@42256: store_met
neuper@42256:  (prep_met thy "met_SP_Ztrans_inv" [] e_metID
neuper@42256:  (["SignalProcessing", "Z_Transform", "inverse"], 
neuper@42256:   [("#Given" ,["equality X_eq"]),
neuper@42256:    ("#Find"  ,["equality n_eq"])
neuper@42256:   ],
neuper@42256:    {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls,
neuper@42256:     crls = e_rls, nrls = e_rls},
neuper@42256:   "Script InverseZTransform (Xeq::bool) =" ^
neuper@42256:   " (let X = Take Xeq;" ^
neuper@42256:   "      X = Rewrite ruleZY False X" ^
neuper@42256:   "  in X)"
neuper@42256:  ));
neuper@42256: 
neuper@42256: show_mets();
neuper@42256: get_met ["SignalProcessing","Z_Transform","inverse"];
neuper@42256: *}
neuper@42256: 
neuper@42256: 
neuper@42256: section {*Program in CTP-based language*}
neuper@42256: text{*=================================*}
neuper@42256: subsection {*Stepwise extend Program*}
neuper@42256: ML {*
neuper@42256: val str = 
neuper@42256: "Script InverseZTransform (Xeq::bool) =" ^
neuper@42256: " Xeq";
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val str = 
neuper@42256: "Script InverseZTransform (Xeq::bool) =" ^
neuper@42256: " (let X = Take Xeq;" ^
neuper@42256: "      X = Rewrite ruleZY False X" ^
neuper@42256: "  in X)";
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: val thy = @{theory};
neuper@42256: val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
neuper@42256: *}
neuper@42256: ML {*
neuper@42256: term2str sc;
neuper@42256: atomty sc
neuper@42256: *}
neuper@42256: 
neuper@42256: 
neuper@42256: subsection {*Store Final Version of Program for Execution*}
neuper@42256: ML {*
neuper@42256: store_met
neuper@42256:  (prep_met thy "met_SP_Ztrans_inv" [] e_metID
neuper@42256:  (["SignalProcessing", "Z_Transform", "inverse"], 
neuper@42256:   [("#Given" ,["equality X_eq"]),
neuper@42256:    ("#Find"  ,["equality n_eq"])
neuper@42256:   ],
neuper@42256:    {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls,
neuper@42256:     crls = e_rls, nrls = e_rls},
neuper@42256:   "Script InverseZTransform (Xeq::bool) =" ^
neuper@42256:   " (let X = Take Xeq;" ^
neuper@42256:   "      X = Rewrite ruleZY False X" ^
neuper@42256:   "  in X)"
neuper@42256:  ));
neuper@42256: *}
neuper@42256: 
neuper@42256: 
neuper@42256: subsection {*Stepwise Execute the Program*}
neuper@42256: 
neuper@42256: 
neuper@42256: 
neuper@42256: 
neuper@42256: 
neuper@42256: 
neuper@42256: 
neuper@42256: 
neuper@42256: section {*Write Tests for Crucial Details*}
neuper@42256: text{*===================================*}
neuper@42256: ML {*
neuper@42256: 
neuper@42256: *}
neuper@42256: 
neuper@42256: section {*Integrate Program into Knowledge*}
neuper@42256: ML {*
neuper@42256: 
neuper@42256: *}
neuper@42256: 
neuper@42256: end
neuper@42256: 




