101 | NONE => ((* tracing "### get_pair: t1 $ t2 -> NONE"; *) get_pair thy op_ ef t2) |
101 | NONE => ((* tracing "### get_pair: t1 $ t2 -> NONE"; *) get_pair thy op_ ef t2) |
102 end |
102 end |
103 | get_pair _ _ _ _ = NONE |
103 | get_pair _ _ _ _ = NONE |
104 |
104 |
105 (* |
105 (* |
106 > val t = (term_of o the o (parse thy)) "#3 + #4"; |
106 > val t = (Thm.term_of o the o (parse thy)) "#3 + #4"; |
107 > val eval_fn = the (assoc (!eval_list, "Groups.plus_class.plus")); |
107 > val eval_fn = the (assoc (!eval_list, "Groups.plus_class.plus")); |
108 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
108 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
109 > term2str t'; |
109 > term2str t'; |
110 > atomty t'; |
110 > atomty t'; |
111 > |
111 > |
112 > val t = (term_of o the o (parse thy)) "(a + #3) + #4"; |
112 > val t = (Thm.term_of o the o (parse thy)) "(a + #3) + #4"; |
113 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
113 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
114 > term2str t'; |
114 > term2str t'; |
115 > |
115 > |
116 > val t = (term_of o the o (parse thy)) "#3 + (#4 + (a::real))"; |
116 > val t = (Thm.term_of o the o (parse thy)) "#3 + (#4 + (a::real))"; |
117 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
117 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
118 > term2str t'; |
118 > term2str t'; |
119 > |
119 > |
120 > val t = (term_of o the o (parse thy)) "x = #5 * (#3 + (#4 + a))"; |
120 > val t = (Thm.term_of o the o (parse thy)) "x = #5 * (#3 + (#4 + a))"; |
121 > atomty t; |
121 > atomty t; |
122 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
122 > val (SOME (id,t')) = get_pair thy "Groups.plus_class.plus" eval_fn t; |
123 > term2str t'; |
123 > term2str t'; |
124 > val it = "#3 + (#4 + a) = #7 + a" : string |
124 > val it = "#3 + (#4 + a) = #7 + a" : string |
125 > |
125 > |
126 > |
126 > |
127 > val t = (term_of o the o (parse thy)) "#-4//#-2"; |
127 > val t = (Thm.term_of o the o (parse thy)) "#-4//#-2"; |
128 > val eval_fn = the (assoc (!eval_list, "cancel")); |
128 > val eval_fn = the (assoc (!eval_list, "cancel")); |
129 > val (SOME (id,t')) = get_pair thy "cancel" eval_fn t; |
129 > val (SOME (id,t')) = get_pair thy "cancel" eval_fn t; |
130 > term2str t'; |
130 > term2str t'; |
131 > |
131 > |
132 > val t = (term_of o the o (parse thy)) "#2^^^#3"; |
132 > val t = (Thm.term_of o the o (parse thy)) "#2^^^#3"; |
133 > eval_binop "xxx" "pow" t thy; |
133 > eval_binop "xxx" "pow" t thy; |
134 > val eval_fn = (eval_binop "xxx") |
134 > val eval_fn = (eval_binop "xxx") |
135 > : string -> term -> theory -> (string * term) option; |
135 > : string -> term -> theory -> (string * term) option; |
136 > val SOME (id,t') = get_pair thy "pow" eval_fn t; |
136 > val SOME (id,t') = get_pair thy "pow" eval_fn t; |
137 > term2str t'; |
137 > term2str t'; |
138 > val eval_fn = the (assoc (!eval_list, "pow")); |
138 > val eval_fn = the (assoc (!eval_list, "pow")); |
139 > val (SOME (id,t')) = get_pair thy "pow" eval_fn t; |
139 > val (SOME (id,t')) = get_pair thy "pow" eval_fn t; |
140 > term2str t'; |
140 > term2str t'; |
141 > |
141 > |
142 > val t = (term_of o the o (parse thy)) "x = #0 + #-1 * #-4"; |
142 > val t = (Thm.term_of o the o (parse thy)) "x = #0 + #-1 * #-4"; |
143 > val eval_fn = the (assoc (!eval_list, "Groups.times_class.times")); |
143 > val eval_fn = the (assoc (!eval_list, "Groups.times_class.times")); |
144 > val (SOME (id,t')) = get_pair thy "Groups.times_class.times" eval_fn t; |
144 > val (SOME (id,t')) = get_pair thy "Groups.times_class.times" eval_fn t; |
145 > term2str t'; |
145 > term2str t'; |
146 > |
146 > |
147 > val t = (term_of o the o (parse thy)) "#0 < #4"; |
147 > val t = (Thm.term_of o the o (parse thy)) "#0 < #4"; |
148 > val eval_fn = the (assoc (!eval_list, "Orderings.ord_class.less")); |
148 > val eval_fn = the (assoc (!eval_list, "Orderings.ord_class.less")); |
149 > val (SOME (id,t')) = get_pair thy "Orderings.ord_class.less" eval_fn t; |
149 > val (SOME (id,t')) = get_pair thy "Orderings.ord_class.less" eval_fn t; |
150 > term2str t'; |
150 > term2str t'; |
151 > val t = (term_of o the o (parse thy)) "#0 < #-4"; |
151 > val t = (Thm.term_of o the o (parse thy)) "#0 < #-4"; |
152 > val (SOME (id,t')) = get_pair thy "Orderings.ord_class.less" eval_fn t; |
152 > val (SOME (id,t')) = get_pair thy "Orderings.ord_class.less" eval_fn t; |
153 > term2str t'; |
153 > term2str t'; |
154 > |
154 > |
155 > val t = (term_of o the o (parse thy)) "#3 is_const"; |
155 > val t = (Thm.term_of o the o (parse thy)) "#3 is_const"; |
156 > val eval_fn = the (assoc (!eval_list, "is'_const")); |
156 > val eval_fn = the (assoc (!eval_list, "is'_const")); |
157 > val (SOME (id,t')) = get_pair thy "is'_const" eval_fn t; |
157 > val (SOME (id,t')) = get_pair thy "is'_const" eval_fn t; |
158 > term2str t'; |
158 > term2str t'; |
159 > val t = (term_of o the o (parse thy)) "a is_const"; |
159 > val t = (Thm.term_of o the o (parse thy)) "a is_const"; |
160 > val (SOME (id,t')) = get_pair thy "is'_const" eval_fn t; |
160 > val (SOME (id,t')) = get_pair thy "is'_const" eval_fn t; |
161 > term2str t'; |
161 > term2str t'; |
162 > |
162 > |
163 > val t = (term_of o the o (parse thy)) "#6//(#8::real)"; |
163 > val t = (Thm.term_of o the o (parse thy)) "#6//(#8::real)"; |
164 > val eval_fn = the (assoc (!eval_list, "cancel")); |
164 > val eval_fn = the (assoc (!eval_list, "cancel")); |
165 > val (SOME (id,t')) = get_pair thy "cancel" eval_fn t; |
165 > val (SOME (id,t')) = get_pair thy "cancel" eval_fn t; |
166 > term2str t'; |
166 > term2str t'; |
167 > |
167 > |
168 > val t = (term_of o the o (parse thy)) "sqrt #12"; |
168 > val t = (Thm.term_of o the o (parse thy)) "sqrt #12"; |
169 > val eval_fn = the (assoc (!eval_list, "SqRoot.sqrt")); |
169 > val eval_fn = the (assoc (!eval_list, "SqRoot.sqrt")); |
170 > val (SOME (id,t')) = get_pair thy "SqRoot.sqrt" eval_fn t; |
170 > val (SOME (id,t')) = get_pair thy "SqRoot.sqrt" eval_fn t; |
171 > term2str t'; |
171 > term2str t'; |
172 > val it = "sqrt #12 = #2 * sqrt #3 " : string |
172 > val it = "sqrt #12 = #2 * sqrt #3 " : string |
173 > |
173 > |
174 > val t = (term_of o the o (parse thy)) "sqrt #9"; |
174 > val t = (Thm.term_of o the o (parse thy)) "sqrt #9"; |
175 > val (SOME (id,t')) = get_pair thy "SqRoot.sqrt" eval_fn t; |
175 > val (SOME (id,t')) = get_pair thy "SqRoot.sqrt" eval_fn t; |
176 > term2str t'; |
176 > term2str t'; |
177 > |
177 > |
178 > val t = (term_of o the o (parse thy)) "Nth #2 [#11,#22,#33]"; |
178 > val t = (Thm.term_of o the o (parse thy)) "Nth #2 [#11,#22,#33]"; |
179 > val eval_fn = the (assoc (!eval_list, "Tools.Nth")); |
179 > val eval_fn = the (assoc (!eval_list, "Tools.Nth")); |
180 > val (SOME (id,t')) = get_pair thy "Tools.Nth" eval_fn t; |
180 > val (SOME (id,t')) = get_pair thy "Tools.Nth" eval_fn t; |
181 > term2str t'; |
181 > term2str t'; |
182 *) |
182 *) |
183 |
183 |
215 > get_calculation_ thy ("Orderings.ord_class.less_eq",the (assoc(!eval_list,"Orderings.ord_class.less_eq"))) ct; |
215 > get_calculation_ thy ("Orderings.ord_class.less_eq",the (assoc(!eval_list,"Orderings.ord_class.less_eq"))) ct; |
216 val it = SOME ("less_equal_5_4","(5 <= 4) = False [(5 <= 4) = False]") |
216 val it = SOME ("less_equal_5_4","(5 <= 4) = False [(5 <= 4) = False]") |
217 |
217 |
218 -------------------------------------------------------------------6.8.02: |
218 -------------------------------------------------------------------6.8.02: |
219 val thy = SqRoot.thy; |
219 val thy = SqRoot.thy; |
220 val t = (term_of o the o (parse thy)) "1+2"; |
220 val t = (Thm.term_of o the o (parse thy)) "1+2"; |
221 get_calculation_ thy (the(assoc(!calc_list,"PLUS"))) t; |
221 get_calculation_ thy (the(assoc(!calc_list,"PLUS"))) t; |
222 val it = SOME ("add_3_4","3 + 4 = 7 [3 + 4 = 7]") : (string * thm) option |
222 val it = SOME ("add_3_4","3 + 4 = 7 [3 + 4 = 7]") : (string * thm) option |
223 -------------------------------------------------------------------6.8.02: |
223 -------------------------------------------------------------------6.8.02: |
224 val t = (term_of o the o (parse thy)) "-1"; |
224 val t = (Thm.term_of o the o (parse thy)) "-1"; |
225 atomty t; |
225 atomty t; |
226 val t = (term_of o the o (parse thy)) "0"; |
226 val t = (Thm.term_of o the o (parse thy)) "0"; |
227 atomty t; |
227 atomty t; |
228 val t = (term_of o the o (parse thy)) "1"; |
228 val t = (Thm.term_of o the o (parse thy)) "1"; |
229 atomty t; |
229 atomty t; |
230 val t = (term_of o the o (parse thy)) "2"; |
230 val t = (Thm.term_of o the o (parse thy)) "2"; |
231 atomty t; |
231 atomty t; |
232 val t = (term_of o the o (parse thy)) "999999999"; |
232 val t = (Thm.term_of o the o (parse thy)) "999999999"; |
233 atomty t; |
233 atomty t; |
234 -------------------------------------------------------------------6.8.02: |
234 -------------------------------------------------------------------6.8.02: |
235 |
235 |
236 > val ct = (the o (parse thy)) "a+#3+#4"; |
236 > val ct = (the o (parse thy)) "a+#3+#4"; |
237 > get_calculation_ thy ("Groups.plus_class.plus",the (assoc(!eval_list,"Groups.plus_class.plus"))) ct; |
237 > get_calculation_ thy ("Groups.plus_class.plus",the (assoc(!eval_list,"Groups.plus_class.plus"))) ct; |