33 val pbt = {Given =["functionTerm f_f", "differentiateFor v_v"], |
33 val pbt = {Given =["functionTerm f_f", "differentiateFor v_v"], |
34 Where =[], |
34 Where =[], |
35 Find =["derivative f_f'"], |
35 Find =["derivative f_f'"], |
36 With =[], |
36 With =[], |
37 Relate=[]}:string model; |
37 Relate=[]}:string model; |
38 val chkpbt = ((map (TermC.parseNEW' ctxt)) o P_Model.to_list) pbt; |
38 val chkpbt = ((map (ParseC.parse_test ctxt)) o P_Model.to_list) pbt; |
39 |
39 |
40 val org = ["functionTerm (d_d x (x \<up> 2 + 3 * x + 4))", |
40 val org = ["functionTerm (d_d x (x \<up> 2 + 3 * x + 4))", |
41 "differentiateFor x", "derivative f_f'"]; |
41 "differentiateFor x", "derivative f_f'"]; |
42 val chkorg = map (TermC.parseNEW' ctxt) org; |
42 val chkorg = map (ParseC.parse_test ctxt) org; |
43 |
43 |
44 Problem.from_store @{context} ["derivative_of", "function"]; |
44 Problem.from_store @{context} ["derivative_of", "function"]; |
45 MethodC.from_store ctxt ["diff", "differentiate_on_R"]; |
45 MethodC.from_store ctxt ["diff", "differentiate_on_R"]; |
46 |
46 |
47 "----------- for correction of diff_const ---------------"; |
47 "----------- for correction of diff_const ---------------"; |
48 "----------- for correction of diff_const ---------------"; |
48 "----------- for correction of diff_const ---------------"; |
49 "----------- for correction of diff_const ---------------"; |
49 "----------- for correction of diff_const ---------------"; |
50 val ctxt = Proof_Context.init_global @{theory}; |
50 val ctxt = Proof_Context.init_global @{theory}; |
51 (*re-evaluate this file, otherwise > *** ME_Isa: 'asm_rls' not known*) |
51 (*re-evaluate this file, otherwise > *** ME_Isa: 'asm_rls' not known*) |
52 val t = TermC.parseNEW' ctxt "Not (x =!= a)"; |
52 val t = ParseC.parse_test ctxt "Not (x =!= a)"; |
53 case rewrite_set_ ctxt false erls_diff t of |
53 case rewrite_set_ ctxt false erls_diff t of |
54 SOME (Const (\<^const_name>\<open>True\<close>, _), []) => () |
54 SOME (Const (\<^const_name>\<open>True\<close>, _), []) => () |
55 | _ => error "rewrite_set_ Not (x =!= a) changed"; |
55 | _ => error "rewrite_set_ Not (x =!= a) changed"; |
56 |
56 |
57 val t = TermC.parseNEW' ctxt "2 is_num"; |
57 val t = ParseC.parse_test ctxt "2 is_num"; |
58 case rewrite_set_ ctxt false erls_diff t of |
58 case rewrite_set_ ctxt false erls_diff t of |
59 SOME (Const (\<^const_name>\<open>True\<close>, _), []) => () |
59 SOME (Const (\<^const_name>\<open>True\<close>, _), []) => () |
60 | _ => error "rewrite_set_ 2 is_num changed"; |
60 | _ => error "rewrite_set_ 2 is_num changed"; |
61 |
61 |
62 val thm = @{thm diff_const}; |
62 val thm = @{thm diff_const}; |
63 val ct = TermC.parseNEW' ctxt "d_d x x"; |
63 val ct = ParseC.parse_test ctxt "d_d x x"; |
64 val subst = [(@{term "bdv::real"}, @{term "x::real"})]; |
64 val subst = [(@{term "bdv::real"}, @{term "x::real"})]; |
65 val NONE = (rewrite_inst_ ctxt tless_true erls_diff false subst thm ct); |
65 val NONE = (rewrite_inst_ ctxt tless_true erls_diff false subst thm ct); |
66 |
66 |
67 "----------- for correction of diff_quot ----------------"; |
67 "----------- for correction of diff_quot ----------------"; |
68 "----------- for correction of diff_quot ----------------"; |
68 "----------- for correction of diff_quot ----------------"; |
69 "----------- for correction of diff_quot ----------------"; |
69 "----------- for correction of diff_quot ----------------"; |
70 val thy = @{theory "Diff"}; |
70 val thy = @{theory "Diff"}; |
71 val ctxt = Proof_Context.init_global thy; |
71 val ctxt = Proof_Context.init_global thy; |
72 val ct = TermC.parseNEW' ctxt "Not (x = 0)"; |
72 val ct = ParseC.parse_test ctxt "Not (x = 0)"; |
73 rewrite_set_ ctxt false erls_diff ct; |
73 rewrite_set_ ctxt false erls_diff ct; |
74 |
74 |
75 val ct = TermC.parseNEW' ctxt "d_d x ((x+1) / (x - 1))"; |
75 val ct = ParseC.parse_test ctxt "d_d x ((x+1) / (x - 1))"; |
76 val thm = @{thm diff_quot}; |
76 val thm = @{thm diff_quot}; |
77 val SOME (ctt,_) = |
77 val SOME (ctt,_) = |
78 (rewrite_inst_ ctxt tless_true erls_diff true subst thm ct); |
78 (rewrite_inst_ ctxt tless_true erls_diff true subst thm ct); |
79 |
79 |
80 "----------- differentiate by rewrite -------------------"; |
80 "----------- differentiate by rewrite -------------------"; |
81 "----------- differentiate by rewrite -------------------"; |
81 "----------- differentiate by rewrite -------------------"; |
82 "----------- differentiate by rewrite -------------------"; |
82 "----------- differentiate by rewrite -------------------"; |
83 val thy = @{theory "Diff"}; |
83 val thy = @{theory "Diff"}; |
84 val ctxt = Proof_Context.init_global thy; |
84 val ctxt = Proof_Context.init_global thy; |
85 val ct = TermC.parseNEW' ctxt "d_d x (x \<up> 2 + 3 * x + 4)"; |
85 val ct = ParseC.parse_test ctxt "d_d x (x \<up> 2 + 3 * x + 4)"; |
86 "--- 1 ---"; |
86 "--- 1 ---"; |
87 val thm = @{thm "diff_sum"}; |
87 val thm = @{thm "diff_sum"}; |
88 val (ct, _) = the (rewrite_inst_ ctxt tless_true erls_diff true subst thm ct); |
88 val (ct, _) = the (rewrite_inst_ ctxt tless_true erls_diff true subst thm ct); |
89 "--- 2 ---"; |
89 "--- 2 ---"; |
90 val (ct, _) = the (rewrite_inst_ ctxt tless_true erls_diff true subst thm ct); |
90 val (ct, _) = the (rewrite_inst_ ctxt tless_true erls_diff true subst thm ct); |