neuper@37906
|
1 |
(* use"test-coil-kernel.sml";
|
neuper@37906
|
2 |
W.N.22.11.99
|
neuper@37906
|
3 |
|
neuper@37906
|
4 |
*)
|
neuper@37906
|
5 |
|
neuper@37906
|
6 |
(* vvv--- geht nicht wegen fun-types
|
neuper@37906
|
7 |
parse thy "case maxmin of is_max => (m' <= m) | is_min => (m <= m')";
|
neuper@37906
|
8 |
parse thy "if maxmin = is_max then (m' <= m) else (m <= m')";
|
neuper@37906
|
9 |
parse thy "if a=b then a else b";
|
neuper@37906
|
10 |
parse thy "maxmin = is_max";
|
neuper@37906
|
11 |
parse thy "maxmin =!= is_max";
|
neuper@37906
|
12 |
^^^--- geht nicht wegen fun-types *)
|
neuper@37906
|
13 |
|
neuper@37906
|
14 |
"pbltyp --- maximum ---";
|
neuper@37906
|
15 |
val pbltyp = {given=["fixedValues (cs::bool list)"],
|
neuper@37906
|
16 |
where_=[(*"foldl (op &) True (map is_equality cs)",
|
neuper@37906
|
17 |
"foldl (op &) True (map (Not o ((op <=) #0) o Rhs) cs)"*)],
|
neuper@37906
|
18 |
find=["maximum m","values_for (ms::real list)"],
|
neuper@37906
|
19 |
with_=[(*"Ex_frees ((foldl (op &) True (r#rs)) & \
|
neuper@37906
|
20 |
\ (ALL m'. (subst (m,m') (foldl (op &) True (r#rs)) \
|
neuper@37906
|
21 |
\ --> m' <= m)))"*)],
|
neuper@37906
|
22 |
relate=["max_relation r","additionalRels rs"]}:string ppc;
|
neuper@37906
|
23 |
val chkpbltyp = ((map (the o (parse thy))) o ppc2list) pbltyp;
|
neuper@37906
|
24 |
"coil";
|
neuper@37906
|
25 |
val org = ["fixedValues [R=(R::real)]",
|
neuper@37906
|
26 |
"boundVariable a","boundVariable b","boundVariable alpha",
|
neuper@37906
|
27 |
"domain {x::real. #0 <= x & x <= #2*R}",
|
neuper@37906
|
28 |
"domain {x::real. #0 <= x & x <= #2*R}",
|
neuper@37906
|
29 |
"domain {x::real. #0 <= x & x <= pi}",
|
neuper@37906
|
30 |
"errorBound (eps = #1//#1000)",
|
neuper@37906
|
31 |
"maximum A",
|
neuper@37906
|
32 |
(*"max_relation A=#2*a*b - a^^^#2",*)
|
neuper@37906
|
33 |
"relations [A=#2*a*b - a^^^#2, (a//#2)^^^#2 + (b//#2)^^^#2 = R^^^#2]",
|
neuper@37906
|
34 |
"relations [A=#2*a*b - a^^^#2, (a//#2)^^^#2 + (b//#2)^^^#2 = R^^^#2]",
|
neuper@37906
|
35 |
"relations [A=#2*a*b - a^^^#2, a=#2*R*sin alpha, b=#2*R*cos alpha]"];
|
neuper@37906
|
36 |
val chkorg = map (the o (parse thy)) org;
|
neuper@37906
|
37 |
val pbl = {given=["fixedValues [R=(R::real)]"],where_=[],
|
neuper@37906
|
38 |
find=["maximum A","values_for [a,b]"],
|
neuper@37906
|
39 |
with_=[(* incompat.w. parse, ok with parseold
|
neuper@37906
|
40 |
"EX alpha. A=#2*a*b - a^^^#2 & \
|
neuper@37906
|
41 |
\ a=#2*R*sin alpha & b=#2*R*cos alpha & \
|
neuper@37906
|
42 |
\ (ALL A'. A'=#2*a*b - a^^^#2 & a=#2*R*sin alpha \
|
neuper@37906
|
43 |
\ & b=#2*R*cos alpha \
|
neuper@37906
|
44 |
\ --> A' <= A)"*)],
|
neuper@37906
|
45 |
relate=["relations [A=#2*a*b - a^^^#2, a=#2*R*sin alpha, b=#2*R*cos alpha]"]
|
neuper@37906
|
46 |
}: string ppc;
|
neuper@37906
|
47 |
val chkpbl = ((map (the o (parse thy))) o ppc2list) pbl;
|
neuper@37906
|
48 |
|
neuper@37906
|
49 |
"met --- maximum_by_differentiation ---";
|
neuper@37906
|
50 |
val met = {given=["fixedValues (cs::bool list)","boundVariable v",
|
neuper@37906
|
51 |
"domain {x::real. lower_bound <= x & x<=upper_bound}",
|
neuper@37906
|
52 |
"errorBound epsilon"],
|
neuper@37906
|
53 |
where_=[],
|
neuper@37906
|
54 |
find=["maximum m","valuesFor (ms::bool list)",
|
neuper@37906
|
55 |
"function_term t","max_argument mx"],
|
neuper@37906
|
56 |
with_=[(* incompat.w. parse, ok with parseold
|
neuper@37906
|
57 |
"Ex_frees ((foldl (op &) True (mr#ars)) & \
|
neuper@37906
|
58 |
\ (ALL m'. (subst (m,m') (foldl (op &) True (mr#ars))\
|
neuper@37906
|
59 |
\ --> m' <= m))) & \
|
neuper@37906
|
60 |
\m = (%v. t) mx & \
|
neuper@37906
|
61 |
\( ALL x. lower_bound <= x & x <= upper_bound \
|
neuper@37906
|
62 |
\ --> (%v. t) x <= m)"*)],
|
neuper@37906
|
63 |
relate=["max_relation mr",
|
neuper@37906
|
64 |
"additionalRels ars"]}: string ppc;
|
neuper@37906
|
65 |
val chkpbl = ((map (the o (parse thy))) o ppc2list) met;
|
neuper@37906
|
66 |
|
neuper@37906
|
67 |
"data --- maximum_by_differentiation ---";
|
neuper@37906
|
68 |
val met = {given=["fixedValues [R=(R::real)]","boundVariable alpha",
|
neuper@37906
|
69 |
"domain {x::real. #0 <= x & x <= pi//#2}",
|
neuper@37906
|
70 |
"errorBound (eps = #1//#1000)"],
|
neuper@37906
|
71 |
where_=[],
|
neuper@37906
|
72 |
find=["maximum A","valuesFor [a=Undef]",
|
neuper@37906
|
73 |
"function_term t","max_argument mx"],
|
neuper@37906
|
74 |
with_=[(* incompat.w. parse, ok with parseold
|
neuper@37906
|
75 |
"EX b alpha. A = #2*a*b - a^^^#2 & \
|
neuper@37906
|
76 |
\ a = #2*R*sin alpha & \
|
neuper@37906
|
77 |
\ b = #2*R*cos alpha & \
|
neuper@37906
|
78 |
\ (ALL A'. A'= #2*a*b - a^^^#2 & \
|
neuper@37906
|
79 |
\ a = #2*R*sin alpha & \
|
neuper@37906
|
80 |
\ b = #2*R*cos alpha --> A' <= A) & \
|
neuper@37906
|
81 |
\ A = (%alpha. t) mx & \
|
neuper@37906
|
82 |
\ (ALL x. #0 <= x & x <= pi --> \
|
neuper@37906
|
83 |
\ (%alpha. t) x <= A)"*)],
|
neuper@37906
|
84 |
relate=["max_relation mr",
|
neuper@37906
|
85 |
"additionalRels ars"]}: string ppc;
|
neuper@37906
|
86 |
val chkpbl = ((map (the o (parse thy))) o ppc2list) met;
|
neuper@37906
|
87 |
|
neuper@37926
|
88 |
val (SOME ct) = parseold thy "EX b. (EX alpha. A = #2*a*b - a^^^#2)";
|
neuper@37906
|
89 |
|
neuper@37906
|
90 |
"pbltyp --- make_fun ---";
|
neuper@37906
|
91 |
(* subproblem [(hd #relate root, equality),
|
neuper@37906
|
92 |
(boundVariable formalization, boundVariable),
|
neuper@37906
|
93 |
(tl #relate root, equalities)] *)
|
neuper@37906
|
94 |
val pbltyp = {given=["equality e","boundVariable v", "equalities es"],
|
neuper@37906
|
95 |
where_=[],
|
neuper@37906
|
96 |
find=["functionTerm t"],with_=[(*???*)],
|
neuper@37906
|
97 |
relate=[(*???*)]}: string ppc;
|
neuper@37906
|
98 |
val chkpbltyp = ((map (the o (parse thy))) o ppc2list) pbltyp;
|
neuper@37906
|
99 |
"coil";
|
neuper@37906
|
100 |
val pbl = {given=["equality (A=#2*a*b - a^^^#2)","boundVariable alpha",
|
neuper@37906
|
101 |
"equalities [a=#2*R*sin alpha, b=#2*R*cos alpha]"],
|
neuper@37906
|
102 |
where_=[],
|
neuper@37906
|
103 |
find=["functionTerm t"],
|
neuper@37906
|
104 |
with_=[],relate=[]}: string ppc;
|
neuper@37906
|
105 |
val chkpbl = ((map (the o (parse thy))) o ppc2list) pbl;
|
neuper@37906
|
106 |
|
neuper@37906
|
107 |
"met --- make_explicit_and_substitute ---";
|
neuper@37906
|
108 |
val met = {given=["equality e","boundVariable v", "equalities es"],
|
neuper@37906
|
109 |
where_=[],
|
neuper@37906
|
110 |
find=["functionTerm t"],with_=[(*???*)],
|
neuper@37906
|
111 |
relate=[(*???*)]}: string ppc;
|
neuper@37906
|
112 |
val chkmet = ((map (the o (parse thy))) o ppc2list) met;
|
neuper@37906
|
113 |
"met --- introduce_a_new_variable ---";
|
neuper@37906
|
114 |
val met = {given=["equality e","boundVariable v", "substitutions es"],
|
neuper@37906
|
115 |
where_=[],
|
neuper@37906
|
116 |
find=["functionTerm t"],with_=[(*???*)],
|
neuper@37906
|
117 |
relate=[(*???*)]}: string ppc;
|
neuper@37906
|
118 |
val chkmet = ((map (the o (parse thy))) o ppc2list) met;
|
neuper@37906
|
119 |
|
neuper@37906
|
120 |
|
neuper@37906
|
121 |
"pbltyp --- max_of_fun_on_interval ---";
|
neuper@37906
|
122 |
val pbltyp = {given=["functionTerm t","boundVariable v",
|
neuper@37906
|
123 |
"domain {x::real. lower_bound <= x & x <= upper_bound}"],
|
neuper@37906
|
124 |
where_=[],
|
neuper@37906
|
125 |
find=["maximums ms"],
|
neuper@37906
|
126 |
with_=[(* incompat.w. parse, ok with parseold
|
neuper@37906
|
127 |
"ALL m. m : ms --> \
|
neuper@37906
|
128 |
\ (ALL x::real. lower_bound <= x & x <= upper_bound \
|
neuper@37906
|
129 |
\ --> (%v. t) x <= m)"*)],
|
neuper@37906
|
130 |
relate=[]}: string ppc;
|
neuper@37906
|
131 |
val chkpbltyp = ((map (the o (parse thy))) o ppc2list) pbltyp;
|
neuper@37906
|
132 |
"coil";
|
neuper@37906
|
133 |
val pbl = {given=["functionTerm (f = #2*(#2*R*sin alpha)*(#2*R*cos alpha) - \
|
neuper@37906
|
134 |
\ (#2*R*sin alpha)^^^#2)","boundVariable alpha",
|
neuper@37906
|
135 |
"domain {x::real. #0 <= x & x <= pi}"],where_=[],
|
neuper@37906
|
136 |
find=["maximums [#1234]"],with_=[],relate=[]}: string ppc;
|
neuper@37906
|
137 |
val chkpbl = ((map (the o (parse thy))) o ppc2list) pbl;
|
neuper@37906
|
138 |
|
neuper@37906
|
139 |
|
neuper@37906
|
140 |
(* pbltyp --- max_of_fun --- *)
|
neuper@37906
|
141 |
(*
|
neuper@37906
|
142 |
{given=[],where_=[],find=[],with_=[],relate=[]}: string ppc;
|
neuper@37926
|
143 |
val (SOME ct) = parse thy ;
|
neuper@37906
|
144 |
atomty (term_of ct);
|
neuper@37906
|
145 |
*)
|
neuper@37906
|
146 |
|
neuper@37906
|
147 |
|
neuper@37906
|
148 |
(* --- 14.1.00 ev. nicht ganz up to date bzg. oberem --- *)
|
neuper@37906
|
149 |
"p.114";
|
neuper@37906
|
150 |
val org = {given=["[u=(#12::real)]"],where_=[],
|
neuper@37906
|
151 |
find=["[a,(b::real)]"],with_=[],
|
neuper@37906
|
152 |
relate=["[is_max A=a*(b::real), #2*a+#2*b=(u::real)]"]}: string ppc;
|
neuper@37906
|
153 |
val chkorg = ((map (the o (parse thy))) o ppc2list) org;
|
neuper@37906
|
154 |
"p.116";
|
neuper@37906
|
155 |
val org = {given=["[c=#10, h=(#4::real)]"],where_=[],
|
neuper@37906
|
156 |
find=["[x,(y::real)]"],with_=[],
|
neuper@37906
|
157 |
relate=["[A=x*(y::real), c//h=x//(h-(y::real))]"]}: string ppc;
|
neuper@37906
|
158 |
val chkorg = ((map (the o (parse thy))) o ppc2list) org;
|
neuper@37906
|
159 |
"p.117";
|
neuper@37906
|
160 |
val org = {given=["[r=#5]"],where_=[],
|
neuper@37906
|
161 |
find=["[x,(y::real)]"],with_=[],
|
neuper@37906
|
162 |
relate=["[is_max #0=pi*x^^^#2 + pi*x*(r::real)]"]}: string ppc;
|
neuper@37906
|
163 |
val chkorg = ((map (the o (parse thy))) o ppc2list) org;
|
neuper@37906
|
164 |
"#241";
|
neuper@37906
|
165 |
val org = {given=["[s=(#10::real)]"],where_=[],
|
neuper@37906
|
166 |
find=["[p::real]"],with_=[],
|
neuper@37906
|
167 |
relate=["[is_max p=n*m, s=n+(m::real)]"]}: string ppc;
|
neuper@37906
|
168 |
val chkorg = ((map (the o (parse thy))) o ppc2list) org;
|
neuper@37906
|
169 |
|
neuper@37906
|
170 |
|
neuper@37906
|
171 |
|
neuper@37906
|
172 |
(* -------------- coil-kernel -------------- vor 19.1.00 *)
|
neuper@37906
|
173 |
(* --- subproblem: make-function-by-subst ~~~~~~~~~~~ *)
|
neuper@37906
|
174 |
(* --- subproblem: max-of-function *)
|
neuper@37906
|
175 |
(* --- subproblem: derivative *)
|
neuper@37906
|
176 |
(* --- subproblem: tan-quadrat-equation *)
|
neuper@37906
|
177 |
"-------------- coil-kernel --------------";
|
neuper@37906
|
178 |
val origin = ["A=#2*a*b - a^^^#2",
|
neuper@37906
|
179 |
"a::real","b::real","{x. #0<x & x<R//#2}",
|
neuper@37906
|
180 |
"{(a//#2)^^^#2 + (b//#2)^^^#2 = (R//#2)^^^#2}",
|
neuper@37906
|
181 |
"alpha::real","{alpha::real. #0<alpha & alpha<pi//#2}",
|
neuper@37906
|
182 |
"{a//#2 = R*(sin alpha), b//#2 = R*(cos alpha)}",
|
neuper@37906
|
183 |
"{R::real}"];
|
neuper@37906
|
184 |
(* --- for a isa-users-mail --- FIXME
|
neuper@37906
|
185 |
Goal "{x. x < a} = ?z";
|
neuper@37906
|
186 |
{x::'a. x < a} = ?z
|
neuper@37906
|
187 |
Goal "{x. x < #3} = {a}";
|
neuper@37906
|
188 |
{x::'a. x < (#3::'a)} = {a}
|
neuper@37906
|
189 |
Goal "{x. #3 < x} = ?z";
|
neuper@37906
|
190 |
Collect (op < (#3::'a)) = ?z
|
neuper@37906
|
191 |
---------------------------- *)
|
neuper@37906
|
192 |
|
neuper@37906
|
193 |
val formals = map (the o (parse thy)) origin;
|
neuper@37906
|
194 |
|
neuper@37906
|
195 |
val given = ["formula_for_max (lhs=rhs)","boundVariable bdv",
|
neuper@37906
|
196 |
"interval {x. low < x & x < high}",
|
neuper@37906
|
197 |
"additional_conds ac","constants cs"];
|
neuper@37906
|
198 |
val where_ = ["lhs is_const","bdv is_const","low is_const","high is_const",
|
neuper@37906
|
199 |
"||| Vars equ ||| = ||| VarsSet ac ||| - ||| ac ||| + #1"];
|
neuper@37906
|
200 |
val find = ["f::real => real","maxs::real set"];
|
neuper@37906
|
201 |
val with_ = [(* incompat.w. parse, ok with parseold
|
neuper@37906
|
202 |
"maxs = {m. low < m & m < high & \
|
neuper@37906
|
203 |
\ (m is_local_max_of (%bdv. f))}"*)];
|
neuper@37906
|
204 |
val chkpbl = map (the o (parse thy)) (given @ where_ @ find @ with_);
|
neuper@37906
|
205 |
val givens = map (the o (parse thy)) given;
|
neuper@37906
|
206 |
|
neuper@37906
|
207 |
"------- 1.1 -------";
|
neuper@37906
|
208 |
(* 5.3.00
|
neuper@37906
|
209 |
val formals = map (the o (parse thy)) ["A=#2*a*b - a^^^#2",
|
neuper@37906
|
210 |
"a::real","{x. #0<x & x<R//#2}",
|
neuper@37906
|
211 |
"{(a//#2)^^^#2 + (b//#2)^^^#2 = (R//#2)^^^#2}",
|
neuper@37906
|
212 |
"{R::real}"];
|
neuper@37906
|
213 |
val tag__forms = chktyps thy (formals, givens);
|
neuper@37906
|
214 |
map ((atomty) o term_of) tag__forms;
|
neuper@37906
|
215 |
|
neuper@37906
|
216 |
val formals = map (the o (parse thy)) ["A=#2*a*b - a^^^#2",
|
neuper@37906
|
217 |
"alpha::real","{alpha. #0<alpha & alpha<pi//#2}",
|
neuper@37906
|
218 |
"{a//#2 = R*(sin alpha), b//#2 = R*(cos alpha)}",
|
neuper@37906
|
219 |
"{R::real}"];
|
neuper@37906
|
220 |
val tag__forms = chktyps thy (formals, givens);
|
neuper@37906
|
221 |
map ((atomty) o term_of) tag__forms;
|
neuper@37906
|
222 |
*)
|
neuper@37906
|
223 |
|
neuper@37906
|
224 |
" --- subproblem: make-function-by-subst --- ";
|
neuper@37906
|
225 |
val origin = ["A=#2*a*b - a^^^#2",
|
neuper@37906
|
226 |
"{a//#2 = R*(sin alpha), b//#2 = R*(cos alpha)}",
|
neuper@37906
|
227 |
"{R::real}"];
|
neuper@37906
|
228 |
val formals = map (the o (parse thy)) origin;
|
neuper@37906
|
229 |
|
neuper@37906
|
230 |
val given = ["equation (lhs=rhs)","substitutions ss",
|
neuper@37906
|
231 |
"constants cs"];
|
neuper@37906
|
232 |
val where_ = [];
|
neuper@37906
|
233 |
val find = ["t::real"];
|
neuper@37906
|
234 |
val with_ = ["||| Vars t ||| = #1"];
|
neuper@37906
|
235 |
val chkpbl = map (the o (parse thy)) (given @ where_ @ find @ with_);
|
neuper@37906
|
236 |
val givens = map (the o (parse thy)) given;
|
neuper@37906
|
237 |
(* 5.3.00
|
neuper@37906
|
238 |
val tag__forms = chktyps thy (formals, givens);
|
neuper@37906
|
239 |
map ((atomty) o term_of) tag__forms;
|
neuper@37906
|
240 |
*)
|
neuper@37906
|
241 |
" --- subproblem: max-of-function --- ";
|
neuper@37906
|
242 |
val origin = ["A = #2*(#2*R*(sin alpha))*(#2*R*(sin alpha)) - \
|
neuper@37906
|
243 |
\ (#2*R*(sin alpha))^^^#2",
|
neuper@37906
|
244 |
"{alpha. #0<alpha & alpha<pi//#2}",
|
neuper@37906
|
245 |
"{R::real}"];
|
neuper@37906
|
246 |
val formals = map (the o (parse thy)) origin;
|
neuper@37906
|
247 |
|
neuper@37906
|
248 |
val given = ["equation (lhs=rhs)",
|
neuper@37906
|
249 |
"interval {x. low < x & x < high}",
|
neuper@37906
|
250 |
"constants cs"];
|
neuper@37906
|
251 |
val where_ = ["lhs is_const","low is_const","high is_const"];
|
neuper@37906
|
252 |
val find = ["t::real"];
|
neuper@37906
|
253 |
val with_ = ["||| Vars t ||| = #1"];
|
neuper@37906
|
254 |
val chkpbl = map (the o (parse thy)) (given @ where_ @ find @ with_);
|
neuper@37906
|
255 |
val givens = map (the o (parse thy)) given;
|
neuper@37906
|
256 |
(* 5.3.00
|
neuper@37906
|
257 |
val tag__forms = chktyps thy (formals, givens);
|
neuper@37906
|
258 |
map ((atomty) o term_of) tag__forms;
|
neuper@37906
|
259 |
*)
|
neuper@37906
|
260 |
" --- subproblem: derivative --- ";
|
neuper@37906
|
261 |
val origin = ["x^^^#3-y^^^#3+#-3*x+#12*y+#10","x::real"];
|
neuper@37906
|
262 |
val formals = map (the o (parse thy)) origin;
|
neuper@37906
|
263 |
|
neuper@37906
|
264 |
val given = ["functionTerm t",
|
neuper@37906
|
265 |
"boundVariable bdv"];
|
neuper@37906
|
266 |
val where_ = ["bdv is_const"];
|
neuper@37906
|
267 |
val find = ["t'::real"];
|
neuper@37906
|
268 |
val with_ = ["t' is_derivative_of (%bdv. t)"];
|
neuper@37906
|
269 |
val chkpbl = map (the o (parse thy)) (given @ where_ @ find @ with_);
|
neuper@37906
|
270 |
val givens = map (the o (parse thy)) given;
|
neuper@37906
|
271 |
(*
|
neuper@37906
|
272 |
val tag__forms = chktyps thy (formals, givens);
|
neuper@37906
|
273 |
map ((atomty) o term_of) tag__forms;
|
neuper@37906
|
274 |
*)
|
neuper@37906
|
275 |
" --- subproblem: tan-quadrat-equation --- ";
|
neuper@37906
|
276 |
val origin = ["#8*R^^^#2*(cos alpha)^^^#2 + #-8*R^^^#2* \
|
neuper@37906
|
277 |
\ (cos alpha)*(sin alpha) + #8*R^^^#2*(sin alpha)^^^#2 = #0",
|
neuper@37906
|
278 |
"alpha::real","#1//#1000"];
|
neuper@37906
|
279 |
val formals = map (the o (parse thy)) origin;
|
neuper@37906
|
280 |
|
neuper@37906
|
281 |
val given = ["equation (a*(cos bdv)^^^#2 + b*(cos bdv)*(sin bdv) + \
|
neuper@37906
|
282 |
\ c*(sin bdv) = #0)",
|
neuper@37906
|
283 |
"boundVariable bdv","errorBound epsilon"];
|
neuper@37906
|
284 |
val where_ = ["bdv is_const","epsilon is_const_expr"];
|
neuper@37906
|
285 |
val find = ["L::real set"];
|
neuper@37906
|
286 |
val with_ = ["L = {x. || (%bdv. a*(cos bdv)^^^#2 + b*(cos bdv)*(sin bdv) + \
|
neuper@37906
|
287 |
\ c*(sin bdv)) x || < epsilon}"];
|
neuper@37906
|
288 |
(* 5.3.00
|
neuper@37906
|
289 |
val chkpbl = map (the o (parse thy)) (given @ where_ @ find @ with_);
|
neuper@37906
|
290 |
val givens = map (the o (parse thy)) given;
|
neuper@37906
|
291 |
val tag__forms = chktyps thy (formals, givens);
|
neuper@37906
|
292 |
map ((atomty) o term_of) tag__forms;
|
neuper@37906
|
293 |
*)
|
neuper@37906
|
294 |
(* use"test-coil-kernel.sml";
|
neuper@37906
|
295 |
*)
|
neuper@37906
|
296 |
|
neuper@37906
|
297 |
|
neuper@37906
|
298 |
" #################################################### ";
|
neuper@37906
|
299 |
" test specify ";
|
neuper@37906
|
300 |
" #################################################### ";
|
neuper@37906
|
301 |
|
neuper@37906
|
302 |
|
neuper@37906
|
303 |
val cts =
|
neuper@37906
|
304 |
["fixedValues [R=(R::real)]",
|
neuper@37906
|
305 |
"boundVariable a", "boundVariable b",
|
neuper@37906
|
306 |
"boundVariable alpha",
|
neuper@37906
|
307 |
"domain {x::real. #0 <= x & x <= #2*R}",
|
neuper@37906
|
308 |
"domain {x::real. #0 <= x & x <= #2*R}",
|
neuper@37906
|
309 |
"domain {x::real. #0 <= x & x <= pi//#2}",
|
neuper@37906
|
310 |
"errorBound (eps = #1//#1000)",
|
neuper@37906
|
311 |
"maximum A","valuesFor [a=Undef]",
|
neuper@37906
|
312 |
(*"functionTerm t","max_argument mx",
|
neuper@37906
|
313 |
"max_relation (A=#2*a*b - a^^^#2)", *)
|
neuper@37906
|
314 |
"additionalRels [A=#2*a*b - a^^^#2,(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
|
neuper@37906
|
315 |
"additionalRels [A=#2*a*b - a^^^#2,(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
|
neuper@37906
|
316 |
"additionalRels [A=#2*a*b - a^^^#2,a=#2*R*sin alpha, b=#2*R*cos alpha]"];
|
neuper@37906
|
317 |
val (dI',pI',mI')=
|
neuper@37991
|
318 |
("DiffAppl",["Script","maximum_of","function"],e_metID);
|
neuper@37906
|
319 |
val c = []:cid;
|
neuper@37906
|
320 |
|
neuper@37906
|
321 |
(*
|
neuper@37906
|
322 |
val pbl = {given=["fixedValues [R=(R::real)]","boundVariable alpha",
|
neuper@37906
|
323 |
"domain {x::real. #0 <= x & x <= pi//#2}",
|
neuper@37906
|
324 |
"errorBound (eps = #1//#1000)"],
|
neuper@37906
|
325 |
where_=[],
|
neuper@37906
|
326 |
find=["maximum A","valuesFor [a=Undef]"(*,
|
neuper@37906
|
327 |
"functionTerm t","max_argument mx"*)],
|
neuper@37906
|
328 |
with_=[],
|
neuper@37906
|
329 |
relate=["max_relation (A=#2*a*b - a^^^#2)",
|
neuper@37906
|
330 |
"additionalRels [(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
|
neuper@37906
|
331 |
"additionalRels [(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
|
neuper@37906
|
332 |
"additionalRels [a=#2*R*sin alpha, b=#2*R*cos alpha]"]
|
neuper@37906
|
333 |
}: string ppc;
|
neuper@37906
|
334 |
*)
|
neuper@37906
|
335 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) =
|
neuper@37906
|
336 |
specify (Init_Proof (cts,(dI',pI',mI'))) e_pos' [] EmptyPtree;
|
neuper@37906
|
337 |
|
neuper@37906
|
338 |
val ct = "fixedValues [R=(R::real)]";
|
neuper@37906
|
339 |
(*l(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify(Add_Given ct) p c pt*)
|
neuper@37906
|
340 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
341 |
|
neuper@37906
|
342 |
val ct = "boundVariable a";
|
neuper@37906
|
343 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
344 |
val ct = "boundVariable alpha";
|
neuper@37906
|
345 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
346 |
|
neuper@37906
|
347 |
val ct = "domain {x::real. #0 <= x & x <= pi//#2}";
|
neuper@37906
|
348 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
349 |
|
neuper@37906
|
350 |
val ct = "errorBound (eps = (#1::real) // #1000)";
|
neuper@37906
|
351 |
val ct = "maximum A";
|
neuper@37906
|
352 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
353 |
|
neuper@37906
|
354 |
val ct = "valuesFor [a=Undef]";
|
neuper@37906
|
355 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
356 |
|
neuper@37906
|
357 |
val ct = "max_relation ()";
|
neuper@37906
|
358 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
359 |
|
neuper@37906
|
360 |
val ct = "relations [A=#2*a*b - a^^^#2,(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]";
|
neuper@37906
|
361 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
362 |
|
neuper@37906
|
363 |
(* ... nxt = Specify_Domain ...
|
neuper@37906
|
364 |
val ct = "additionalRels [b=#2*R*cos alpha]";
|
neuper@37906
|
365 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) =
|
neuper@37906
|
366 |
specify(Add_Relation ct) p c pt;
|
neuper@37906
|
367 |
(*
|
neuper@37906
|
368 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
369 |
*)
|
neuper@37906
|
370 |
val ct = "additionalRels [a=#2*R*sin alpha]";
|
neuper@37906
|
371 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) =
|
neuper@37906
|
372 |
specify(Add_Relation ct) p c pt;
|
neuper@37906
|
373 |
(*
|
neuper@37906
|
374 |
val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
375 |
*)
|
neuper@37906
|
376 |
*)
|
neuper@37906
|
377 |
(* --- tricky case (termlist interleaving variants):
|
neuper@37906
|
378 |
> val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) =
|
neuper@37906
|
379 |
specify (Init_Proof (cts,(dI,pI,mI))) [] [] EmptyPtree;
|
neuper@37906
|
380 |
|
neuper@37906
|
381 |
> val ct = "additionalRels [(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2, b=#2*R*cos alpha]";
|
neuper@37906
|
382 |
> val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
383 |
*)
|
neuper@37906
|
384 |
|
neuper@37906
|
385 |
(* --- incomplete input ---
|
neuper@37906
|
386 |
> val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) =
|
neuper@37906
|
387 |
specify (Init_Proof (cts,(dI,pI,mI))) [] [] EmptyPtree;
|
neuper@37906
|
388 |
|
neuper@37906
|
389 |
> val ct = "[R=(R::real)]";
|
neuper@37906
|
390 |
> val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
391 |
|
neuper@37906
|
392 |
> val ct = "R=(R::real)";
|
neuper@37906
|
393 |
> val(p,_,Form'(PpcKF(_,_,ppc)),nxt,_,pt) = specify nxt p c pt;
|
neuper@37906
|
394 |
|
neuper@37906
|
395 |
> val ct = "(R::real)";
|
neuper@37906
|
396 |
> specify nxt p c pt;
|
neuper@37906
|
397 |
*)
|
neuper@37906
|
398 |
|
neuper@37906
|
399 |
|
neuper@37906
|
400 |
" #################################################### ";
|
neuper@37906
|
401 |
" test do_ specify ";
|
neuper@37906
|
402 |
" #################################################### ";
|
neuper@37906
|
403 |
|
neuper@37906
|
404 |
|
neuper@37906
|
405 |
val cts = ["fixedValues [R=(R::real)]",
|
neuper@37906
|
406 |
"boundVariable a", "boundVariable b",
|
neuper@37906
|
407 |
"boundVariable alpha",
|
neuper@37906
|
408 |
"domain {x::real. #0 <= x & x <= #2*R}",
|
neuper@37906
|
409 |
"domain {x::real. #0 <= x & x <= #2*R}",
|
neuper@37906
|
410 |
"domain {x::real. #0 <= x & x <= pi//#2}",
|
neuper@37906
|
411 |
"errorBound (eps=#1//#1000)",
|
neuper@37906
|
412 |
"maximum A","valuesFor [a=Undef]",
|
neuper@37906
|
413 |
(*"functionTerm t","max_argument mx", *)
|
neuper@37906
|
414 |
"max_relation (A=#2*a*b - a^^^#2)",
|
neuper@37906
|
415 |
"additionalRels [(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
|
neuper@37906
|
416 |
"additionalRels [(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
|
neuper@37906
|
417 |
"additionalRels [a=#2*R*sin alpha, b=#2*R*cos alpha]"];
|
neuper@37906
|
418 |
val (dI',pI',mI')=
|
neuper@37991
|
419 |
("DiffAppl",["DiffAppl","test_maximum"],e_metID);
|
neuper@37906
|
420 |
val p = e_pos'; val c = [];
|
neuper@37906
|
421 |
|
neuper@37906
|
422 |
val (mI,m) = ("Init_Proof",Init_Proof (cts, (dI',pI',mI')));
|
neuper@37906
|
423 |
val (pst as (sc,pt,cl):pstate) = (EmptyScr, e_ptree, []);
|
neuper@37906
|
424 |
val (p,_,f,nxt,_,(_,pt,_)) = do_ (mI,m) p c pst;
|
neuper@37906
|
425 |
(*val nxt = ("Add_Given",Add_Given "fixedValues [R = R]")*)
|
neuper@37906
|
426 |
|
neuper@37906
|
427 |
val (p,_,Form' (PpcKF (_,_,ppc)),nxt,_,(_,pt,_)) =
|
neuper@37906
|
428 |
do_ nxt p c (EmptyScr,pt,[]);
|
neuper@37906
|
429 |
(*val nxt = ("Add_Given",Add_Given "boundVariable a") *)
|