114 |
106 |
115 section \<open>===================================================================================\<close> |
107 section \<open>===================================================================================\<close> |
116 section \<open>===== ============================================================================\<close> |
108 section \<open>===== ============================================================================\<close> |
117 ML \<open> |
109 ML \<open> |
118 \<close> ML \<open> |
110 \<close> ML \<open> |
119 \<close> ML \<open> |
111 |
120 \<close> ML \<open> |
112 \<close> ML \<open> |
121 \<close> |
113 \<close> |
122 |
114 |
123 section \<open>===================================================================================\<close> |
115 section \<open>===================================================================================\<close> |
124 section \<open>===== simplify.sml ================================================================\<close> |
116 section \<open>===== biegelinie-2.sml ============================================================\<close> |
125 ML \<open> |
117 ML \<open> |
126 \<close> ML \<open> |
118 \<close> ML \<open> |
127 |
119 (* Title: Knowledge/biegelinie-2.sml |
128 \<close> ML \<open> |
120 author: Walther Neuper 190515 |
129 \<close> ML \<open> |
121 (c) due to copyright terms |
130 \<close> |
122 *) |
131 |
|
132 section \<open>===================================================================================\<close> |
|
133 section \<open>===== Interpret/li-tool.sml =======================================================\<close> |
|
134 ML \<open> |
|
135 \<close> ML \<open> |
|
136 (* Title: Interpret/li-tool.sml |
|
137 Author: Walther Neuper 050908 |
|
138 (c) copyright due to lincense terms. |
|
139 *) |
|
140 "-----------------------------------------------------------------"; |
|
141 "table of contents -----------------------------------------------"; |
123 "table of contents -----------------------------------------------"; |
142 "-----------------------------------------------------------------"; |
124 "-----------------------------------------------------------------"; |
143 "----------- fun implicit_take, fun get_first_argument -------------------------"; |
125 "----------- auto SubProblem (_,[vonBelastungZu,Biegelinien] -----"; |
144 "----------- fun from_prog ---------------------------------------"; |
126 "----------- me SubProblem (_,[vonBelastungZu,Biegelinien] -------"; |
145 "----------- fun specific_from_prog ----------------------------"; |
|
146 "----------- fun de_esc_underscore -------------------------------"; |
|
147 "----------- fun go ----------------------------------------------"; |
|
148 "----------- fun formal_args -------------------------------------"; |
|
149 "----------- fun dsc_valT ----------------------------------------"; |
|
150 "----------- fun arguments_from_model ---------------------------------------"; |
|
151 "----------- fun init_pstate -----------------------------------------------------------------"; |
|
152 "-----------------------------------------------------------------"; |
127 "-----------------------------------------------------------------"; |
153 "-----------------------------------------------------------------"; |
128 "-----------------------------------------------------------------"; |
154 "-----------------------------------------------------------------"; |
129 "-----------------------------------------------------------------"; |
155 |
130 |
156 val thy = @{theory Isac_Knowledge}; |
131 |
157 |
132 "----------- auto SubProblem (_,[vonBelastungZu,Biegelinien] -----"; |
158 \<close> ML \<open> |
133 "----------- auto SubProblem (_,[vonBelastungZu,Biegelinien] -----"; |
159 "----------- fun init_pstate -----------------------------------------------------------------"; |
134 "----------- auto SubProblem (_,[vonBelastungZu,Biegelinien] -----"; |
160 "----------- fun init_pstate -----------------------------------------------------------------"; |
135 val fmz = |
161 "----------- fun init_pstate -----------------------------------------------------------------"; |
136 ["Streckenlast q_0", "FunktionsVariable x", |
162 (* |
137 "Funktionen [Q x = c + - 1 * q_0 * x, \ |
163 This test is deeply nested (down into details of creating environments). |
138 \M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\ |
164 In order to make Sidekick show the structure add to each |
139 \ y' x = c_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\ |
165 * (*/...\*) and (*\.../*) |
140 \ y x = c_4 + c_3 * x + 1 / (- 1 * EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]", |
166 * a companion > ML < (*/...\*) and > ML < (*\.../*) |
141 "AbleitungBiegelinie dy"]; |
167 Note the wrong ^----^ delimiters. |
142 val (dI',pI',mI') = ("Biegelinie", ["vonBelastungZu", "Biegelinien"], |
168 *) |
143 ["Biegelinien", "ausBelastung"]); |
169 val fmz = ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y", |
144 |
170 "Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", |
145 States.reset (); |
171 "FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]", |
146 CalcTree @{context} [(fmz, (dI',pI',mI'))]; |
172 "AbleitungBiegelinie dy"]; |
147 Iterator 1; |
173 val (dI',pI',mI') = ("Biegelinie", ["Biegelinien"], |
148 moveActiveRoot 1; |
174 ["IntegrierenUndKonstanteBestimmen2"]); |
149 autoCalculate 1 CompleteCalc; |
|
150 |
|
151 val ((pt, p),_) = States.get_calc 1; |
|
152 (* ERROR: THIS TEST WAS BROKEN BEFORE CS "eliminate ThmC.numerals_to_Free", |
|
153 UNDETECTED BY Test_Isac_Short.thy ===========================================================\\ |
|
154 if p = ([], Res) andalso (get_obj g_res pt (fst p) |> UnparseC.term @{context}) = |
|
155 "[Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n dy x =\n c_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]" |
|
156 then () else error "auto SubProblem (_,[vonBelastungZu,Biegelinien] changed"; |
|
157 ===============================================================================================//*) |
|
158 |
|
159 |
|
160 \<close> ML \<open> |
|
161 "----------- me SubProblem (_,[vonBelastungZu,Biegelinien] -------"; |
|
162 "----------- me SubProblem (_,[vonBelastungZu,Biegelinien] -------"; |
|
163 "----------- me SubProblem (_,[vonBelastungZu,Biegelinien] -------"; |
|
164 val fmz = |
|
165 ["Streckenlast q_0", "FunktionsVariable x", |
|
166 "Funktionen [Q x = c + - 1 * q_0 * x, \ |
|
167 \M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\ |
|
168 \ y' x = c_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\ |
|
169 \ y x = c_4 + c_3 * x + 1 / (- 1 * EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]", |
|
170 "AbleitungBiegelinie dy"]; |
|
171 val (dI',pI',mI') = ("Biegelinie", ["vonBelastungZu", "Biegelinien"], |
|
172 ["Biegelinien", "ausBelastung"]); |
175 val p = e_pos'; val c = []; |
173 val p = e_pos'; val c = []; |
176 (*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; val Model_Problem = nxt |
174 val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; val Model_Problem = nxt |
177 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Traegerlaenge L" = nxt |
175 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Streckenlast q_0" = nxt |
178 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Streckenlast q_0" = nxt |
176 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "FunktionsVariable x" = nxt |
179 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "Biegelinie y" = nxt |
177 \<close> ML \<open> (*isa*) |
180 \<close> ML \<open> |
178 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "Funktionen\n [Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]" = nxt |
181 (*/---broken elementwise input to lists---\* ) |
179 \<close> text \<open> (*isa2* ) |
182 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Relation "Randbedingungen [y 0 = 0]", ERROR MISSING step: M_b 0 = 0*) |
180 (*/---broken elementwise input to lists---\*) |
183 (*isa* ) val Add_Relation "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]" = nxt |
181 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "Funktionen [Q x = c + - 1 * q_0 * x]" = nxt |
184 ( *isa2*) val Add_Relation "Randbedingungen [y 0 = 0]" = nxt |
182 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "Funktionen\n [M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]" = nxt |
185 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Relation "Randbedingungen [y L = 0, M_b 0 = 0, M_b L = 0]"*) |
|
186 (*isa*) val Specify_Theory "Biegelinie" = nxt |
|
187 (*isa2* ) val Add_Relation "Randbedingungen [y L = 0, M_b 0 = 0, M_b L = 0]" = nxt( **) |
|
188 ( *\---broken elementwise input to lists---/*) |
183 ( *\---broken elementwise input to lists---/*) |
189 \<close> ML \<open> |
184 \<close> ML \<open> |
190 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Relation "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]" = nxt |
185 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
191 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
186 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["vonBelastungZu", "Biegelinien"] = nxt |
192 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["Biegelinien"] = nxt |
187 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["Biegelinien", "ausBelastung"] = nxt |
193 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["IntegrierenUndKonstanteBestimmen2"] = nxt |
188 val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "AbleitungBiegelinie dy" = nxt |
194 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "FunktionsVariable x" = nxt |
189 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
195 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "GleichungsVariablen [c, c_2, c_3, c_4]" = nxt |
190 val return_me_Add_Given_AbleitungBiegelinie |
196 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "AbleitungBiegelinie dy" = nxt |
191 = me nxt p c pt; |
197 |
192 \<close> ML \<open> (*//----------- step into me_Add_Given_AbleitungBiegelinie --------------------------\\*) |
198 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
193 (*//------------------ step into me_Add_Given_AbleitungBiegelinie --------------------------\\*) |
199 (*[], Met*)val return_Add_Given_AbleitungBieg |
194 \<close> ML \<open> |
200 = me nxt p c pt; |
|
201 \<close> ML \<open> (*/------------ step into me_Add_Given_AbleitungBieg --------------------------------\\*) |
|
202 (*/------------------- step into me_Add_Given_AbleitungBieg --------------------------------\\*) |
|
203 |
|
204 "~~~~~ fun me , args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, c, pt); |
195 "~~~~~ fun me , args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, c, pt); |
|
196 \<close> ML \<open> |
205 val ctxt = Ctree.get_ctxt pt p |
197 val ctxt = Ctree.get_ctxt pt p |
206 val ("ok", (_, _, ptp as (pt, p))) = |
198 val (pt, p) = |
207 (*case*) Step.by_tactic tac (pt, p) (*of*); |
199 (*Step.by_tactic is here for testing by me; do_next would suffice in me*) |
208 |
200 case Step.by_tactic tac (pt, p) of |
209 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
201 ("ok", (_, _, ptp)) => ptp |
210 (*case*) |
202 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
203 (*case*) |
211 Step.do_next p ((pt, Pos.e_pos'), []) (*of*); |
204 Step.do_next p ((pt, Pos.e_pos'), []) (*of*); |
212 \<close> ML \<open> |
205 \<close> ML \<open> |
213 "~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = |
206 "~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = |
214 (p, ((pt, Pos.e_pos'), []) ); |
207 (p, ((pt, Pos.e_pos'), [])); |
|
208 \<close> ML \<open> |
|
209 (*if*) Pos.on_calc_end ip (*else*); |
|
210 \<close> ML \<open> |
|
211 val (_, probl_id, _) = Calc.references (pt, p); |
|
212 \<close> ML \<open> |
|
213 val _ = |
|
214 (*case*) tacis (*of*); |
|
215 \<close> ML \<open> |
|
216 (*if*) probl_id = Problem.id_empty (*else*); |
|
217 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
218 switch_specify_solve p_ (pt, ip); |
|
219 \<close> ML \<open> |
|
220 "~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip)); |
|
221 \<close> ML \<open> |
|
222 (*if*) Pos.on_specification ([], state_pos) (*then*); |
|
223 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
224 specify_do_next (pt, input_pos); |
|
225 \<close> ML \<open> |
|
226 "~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos); |
|
227 \<close> ML \<open> |
|
228 val (_, (p_', tac)) = Specify.find_next_step ptp |
|
229 val ist_ctxt = Ctree.get_loc pt (p, p_) |
|
230 \<close> ML \<open> |
|
231 val Tactic.Apply_Method mI = |
|
232 (*case*) tac (*of*); |
|
233 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
234 LI.by_tactic (Tactic.Apply_Method' (mI, NONE, Istate.empty, ContextC.empty)) |
|
235 ist_ctxt (pt, (p, p_')); |
|
236 \<close> ML \<open> |
|
237 "~~~~~ fun by_tactic , args:"; val ((Tactic.Apply_Method' (mI, _, _, _)), (_, ctxt), (pt, pos as (p, _))) = |
|
238 ((Tactic.Apply_Method' (mI, NONE, Istate.empty, ContextC.empty)), ist_ctxt, (pt, (p, p_'))); |
|
239 \<close> ML \<open> |
|
240 val (itms, oris, probl) = case get_obj I pt p of |
|
241 PblObj {meth = itms, origin = (oris, _, _), probl, ...} => (itms, oris, probl) |
|
242 | _ => raise ERROR "LI.by_tactic Apply_Method': uncovered case get_obj" |
|
243 val {model, ...} = MethodC.from_store ctxt mI; |
|
244 \<close> ML \<open> |
|
245 (*+*)val "Biegelinien/ausBelastung" = mI |> References.implode_id |
|
246 \<close> ML \<open> |
|
247 (*+* ===== current MethodC i_model ==============================================================*) |
|
248 (*+*)if (itms |> I_Model.to_string @{context}) = "[\n" ^ |
|
249 "(1 ,[1] ,true ,#Given ,Cor Streckenlast q_0 ,(q_q, [q_0])), \n" ^ |
|
250 "(2 ,[1] ,true ,#Given ,Cor FunktionsVariable x ,(v_v, [x])), \n" ^ |
|
251 "(3 ,[1] ,true ,#Find ,Cor Funktionen\n [Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)] ,(funs''', [[Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]])), \n" ^ |
|
252 (* ...................... Cor Biegemoment M_b, |
|
253 ...................... Cor Querkraft Q , *) |
|
254 "(4 ,[1] ,true ,#Given ,Cor AbleitungBiegelinie dy ,(id_der, [dy]))]" |
|
255 (* ...................... Cor Biegelinie y , *) |
|
256 then () else error "by_tactic: parent " |
|
257 \<close> ML \<open> |
|
258 (*+* ===== current o_model created from Formalise.model of SubProblem ===========================*) |
|
259 (*+*)(oris |> O_Model.to_string @{context}) = "[\n" ^ |
|
260 "(1, [\"1\"], #Given, Streckenlast, [\"q_0\"]), \n" ^ |
|
261 "(2, [\"1\"], #Given, FunktionsVariable, [\"x\"]), \n" ^ |
|
262 "(3, [\"1\"], #Find, Funktionen, [\"[Q x = c + - 1 * q_0 * x]\", \"[M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2]\", \"[y' x =\n c_3 +\n 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)]\", \"[y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]\"]), \n" ^ |
|
263 "(4, [\"1\"], #Given, AbleitungBiegelinie, [\"dy\"])]" |
|
264 \<close> ML \<open> |
|
265 (*+* ===== parent Problem i_model ===============================================================*) |
|
266 (*+*)(probl |> I_Model.to_string @{context}) = "[\n" ^ |
|
267 "(1 ,[1] ,true ,#Given ,Cor Streckenlast q_0 ,(q_q, [q_0])), \n" ^ |
|
268 "(2 ,[1] ,true ,#Given ,Cor FunktionsVariable x ,(v_v, [x])), \n" ^ |
|
269 "(3 ,[1] ,true ,#Find ,Cor Funktionen\n [Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)] ,(funs''', [[Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]]))]" |
|
270 \<close> ML \<open> |
|
271 val itms = if itms <> [] then itms else I_Model.complete oris probl [] model |
|
272 \<close> ML \<open> |
|
273 (*+* ===== current MethodC i_model complete'd ===================================================*) |
|
274 (*+*)(itms |> I_Model.to_string @{context}) = "[\n" ^ |
|
275 "(1 ,[1] ,true ,#Given ,Cor Streckenlast q_0 ,(q_q, [q_0])), \n" ^ |
|
276 "(2 ,[1] ,true ,#Given ,Cor FunktionsVariable x ,(v_v, [x])), \n" ^ |
|
277 "(3 ,[1] ,true ,#Find ,Cor Funktionen\n [Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)] ,(funs''', [[Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]])), \n" ^ |
|
278 "(4 ,[1] ,true ,#Given ,Cor AbleitungBiegelinie dy ,(id_der, [dy]))]" |
|
279 \<close> ML \<open> |
|
280 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
281 val (is, env, ctxt, prog) = case |
|
282 LItool.init_pstate ctxt (I_Model.OLD_to_TEST itms) mI of |
|
283 (is as Pstate {env, ...}, ctxt, program) => (is, env, ctxt, program) |
|
284 \<close> ML \<open> |
|
285 "~~~~~ fun init_pstate , args:"; val (ctxt, i_model, met_id) = (ctxt, (I_Model.OLD_to_TEST itms), mI); |
|
286 \<close> ML \<open> |
|
287 val (model_patt, program, prog, prog_rls, where_, where_rls) = |
|
288 case MethodC.from_store ctxt met_id of |
|
289 {model = model_patt, program = program as Rule.Prog prog, prog_rls, where_, where_rls,...}=> |
|
290 (model_patt, program, prog, prog_rls, where_, where_rls) |
|
291 \<close> ML \<open> |
|
292 (*+* ===== MethodC model_patt ===================================================================*) |
|
293 (*+*)if (model_patt |> Model_Pattern.to_string @{context}) = "[\"" ^ |
|
294 (*5 elements ------------------------------------------ ERROR: -------------CORRECT: *) |
|
295 "(#Given, (Streckenlast, q__q))\", \"" ^ |
|
296 "(#Given, (FunktionsVariable, v_v))\", \"" ^ |
|
297 "(#Given, (Biegelinie, b_b))\", \"" ^ (*\<longrightarrow> (b_b, dy) (b_b, y) *) |
|
298 "(#Given, (AbleitungBiegelinie, id_der))\", \"" ^ (*\<longrightarrow> (id_der, [Q x =..]) (id_der, dy) *) |
|
299 "(#Find, (Funktionen, fun_s))\"]" (* (fun_s, [Q x =..])*) |
|
300 then () else error "init_pstate initial model_patt CHANGED" |
|
301 \<close> ML \<open> |
|
302 (*+*)if (i_model |> I_Model.to_string_TEST @{context}) = "[\n" ^ |
|
303 "(1, [1], true ,#Given, (Cor_TEST Streckenlast q_0 , pen2str, Position.T)), \n" ^ |
|
304 "(2, [1], true ,#Given, (Cor_TEST FunktionsVariable x , pen2str, Position.T)), \n" ^ |
|
305 "(3, [1], true ,#Find, (Cor_TEST Funktionen\n [" ^ |
|
306 "Q x = c + - 1 * q_0 * x, " ^ |
|
307 "M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n " ^ |
|
308 "y' x =\n c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n " ^ |
|
309 "y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)] , pen2str, Position.T)), \n" ^ |
|
310 "(4, [1], true ,#Given, (Cor_TEST AbleitungBiegelinie dy , pen2str, Position.T))]" |
|
311 (*MISSING: ------------------------------------------------------------------- (b_b, y) *) |
|
312 then () else error "init_pstate initial i_model CHANGED"; |
|
313 \<close> ML \<open> (*isa*) |
|
314 val (_, env_model, (env_subst, env_eval)) = I_Model.of_max_variant model_patt i_model; |
|
315 (*?! complete with Met.i_model ?!*) |
|
316 \<close> ML \<open> (*isa*) |
|
317 (*+*)if (env_model |> Subst.to_string @{context}) = "[\"\n" ^ |
|
318 "(q__q, q_0)\", \"\n" ^ |
|
319 "(v_v, x)\", \"\n" ^ |
|
320 "(id_der, dy)\", \"\n" ^ |
|
321 "(fun_s, [Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)])\"]" |
|
322 then () else error "init_pstate: env_model CHANGED"; |
|
323 \<close> ML \<open> (*isa*) |
|
324 val actuals = map snd env_model |
|
325 \<close> text \<open> (*isa2*) |
|
326 val (_, env_subst, env_eval) = I_Model.of_max_variant model_patt i_model; |
|
327 val actuals = map snd env_subst |
|
328 \<close> ML \<open> (*isa==isa2*) |
|
329 (*+*)val "[q_0, x, dy, [Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]]" |
|
330 = actuals |> UnparseC.terms @{context} |
|
331 \<close> ML \<open> (*isa==isa2*) |
|
332 val formals = Program.formal_args prog |
|
333 \<close> ML \<open> (*isa==isa2*) |
|
334 (*+*)val "[q__q, v_v, b_b, id_der]" = formals |> UnparseC.terms @{context} (*From fun. belastung_zu_biegelinie*) |
|
335 \<close> ML \<open> (*isa*) |
|
336 val preconds = Pre_Conds.check_envs_TEST ctxt where_rls where_ (env_model, (env_subst, env_eval)) |
|
337 val ctxt = ctxt |> ContextC.insert_assumptions (map snd (snd preconds)); |
|
338 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
339 val ist = Istate.e_pstate |
|
340 |> Istate.set_eval prog_rls |
|
341 |> Istate.set_env_true (relate_args [] formals actuals ctxt prog met_id formals actuals) |
|
342 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
343 (relate_args [] formals actuals ctxt prog met_id formals actuals); |
|
344 \<close> ML \<open> |
|
345 "~~~~~ fun relate_args , args:"; val (env, (f::ff), (aas as (a::aa)), ctxt, prog, met_id, formals, actuals) = |
|
346 ([], formals, actuals, ctxt, prog, met_id, formals, actuals); |
|
347 |
|
348 (*if*) type_of f = type_of a (*then*); |
|
349 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
350 relate_args (env @ [(f, a)]) ff aa ctxt prog met_id formals actuals; |
|
351 \<close> ML \<open> |
|
352 (*+*)val "q__q" = f |> UnparseC.term @{context} |
|
353 (*+*)val "q_0" = a |> UnparseC.term @{context}; |
|
354 \<close> ML \<open> |
|
355 (*if*) type_of f = type_of a (*then*); |
|
356 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
357 relate_args (env @ [(f, a)]) ff aa ctxt prog met_id formals actuals; |
|
358 \<close> ML \<open> |
|
359 "~~~~~ fun relate_args , args:"; val (env, (f::ff), (aas as (a::aa)), ctxt, prog, met_id, formals, actuals) = |
|
360 ((env @ [(f, a)]), ff, aa, ctxt, prog, met_id, formals, actuals) |
|
361 \<close> ML \<open> |
|
362 (*+*)val "v_v" = f |> UnparseC.term @{context} |
|
363 (*+*)val "x" = a |> UnparseC.term @{context} |
|
364 \<close> ML \<open> |
|
365 (*if*) type_of f = type_of a (*then*); |
|
366 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
367 relate_args (env @ [(f, a)]) ff aa ctxt prog met_id formals actuals; |
|
368 \<close> ML \<open> |
|
369 "~~~~~ fun relate_args , args:"; val (env, (f::ff), (aas as (a::aa)), ctxt, prog, met_id, formals, actuals) = |
|
370 ((env @ [(f, a)]), ff, aa, ctxt, prog, met_id, formals, actuals) |
|
371 \<close> ML \<open> |
|
372 (*+*)val "b_b" = f |> UnparseC.term @{context} (*ERROR: IS Biegelinie*) |
|
373 (*+*)val "dy" = a |> UnparseC.term @{context} (*ERROR: IS AbleitungBiegelinie*) |
|
374 (*CONCLUSION: if the type is equal, then the sequence decides the pairing for env |
|
375 (q__q, q_0) |
|
376 (v_v, x) |
|
377 *) |
|
378 \<close> ML \<open> |
|
379 (*if*) type_of f = type_of a (*then*); |
|
380 \<close> ML \<open> |
|
381 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
382 relate_args (env @ [(f, a)]) ff aa ctxt prog met_id formals actuals; |
|
383 \<close> ML \<open> |
|
384 "~~~~~ fun relate_args , args:"; val (env, (f::ff), (aas as (a::aa)), ctxt, prog, met_id, formals, actuals) = |
|
385 ((env @ [(f, a)]), ff, aa, ctxt, prog, met_id, formals, actuals) |
|
386 \<close> ML \<open> |
|
387 (*+*)val "id_der" = f |> UnparseC.term @{context} (*ERROR IS AbleitungBiegelinie*) |
|
388 (*+*)val "[Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n y' x =\n c_3 +\n 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]" |
|
389 = a |> UnparseC.term @{context} (*ERROR IS FROM Pbl.i_model*) |
|
390 \<close> ML \<open> |
|
391 (*if*) type_of f = type_of a (*else*); |
|
392 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
393 val (f, a) = |
|
394 assoc_by_type ctxt f aas prog met_id formals actuals; |
|
395 \<close> ML \<open> |
|
396 "~~~~~ fun assoc_by_type , args:"; val (ctxt, f, aa, prog, met_id, formals, actuals) = |
|
397 (ctxt, f, aas, prog, met_id, formals, actuals); |
|
398 \<close> ML \<open> |
|
399 val [] = |
|
400 (*case*) filter (curry (fn (f, a) => type_of f = type_of a) f) aa (*of*); |
|
401 \<close> ML \<open> |
|
402 (*+*)val Free ("id_der", Type ("fun", [Type ("Real.real", []), Type ("Real.real", [])])) = f |
|
403 \<close> ML \<open> |
|
404 (*+*)val [Const ("List.list.Cons", _) $ _ $ |
|
405 (Const ("List.list.Cons", _) $ _ $ |
|
406 (Const ("List.list.Cons", _) $ _ $ |
|
407 (Const ("List.list.Cons", _) $ _ $ |
|
408 Const ("List.list.Nil", list_elem_type))))] = aa |
|
409 (*+*)val Type ("List.list", [Type ("HOL.bool", [])]) = list_elem_type |
|
410 \<close> ML \<open> |
|
411 \<close> ML \<open> |
|
412 \<close> ML \<open> |
|
413 \<close> ML \<open> |
|
414 \<close> ML \<open> |
|
415 \<close> ML \<open> |
|
416 \<close> ML \<open> |
|
417 \<close> ML \<open> |
|
418 \<close> ML \<open> |
|
419 \<close> ML \<open> (*||----------- continuing me_Add_Given_AbleitungBiegelinie ---------------------------*) |
|
420 (*||------------------ continuing me_Add_Given_AbleitungBiegelinie ---------------------------*) |
|
421 (*\\------------------ step into XXXXX -----------------------------------------------------//*) |
|
422 \<close> ML \<open> (*\\----------- step into XXXXX -----------------------------------------------------//*) |
|
423 \<close> text \<open> (*ERROR in creating the environment from formal args*) |
|
424 val (p,_,f,nxt,_,pt) = return_me_Add_Given_AbleitungBiegelinie; |
|
425 \<close> ML \<open> |
|
426 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ...(**) |
|
427 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
428 *) |
|
429 (* ERROR: THIS TEST WAS BROKEN BEFORE CS "eliminate ThmC.numerals_to_Free", |
|
430 UNDETECTED BY Test_Isac_Short.thy |
|
431 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
432 arguments_from_model: 'Biegelinie' not in itms: |
|
433 itms: |
|
434 [ |
|
435 (1 ,[1] ,true ,#Given ,Cor ??.Biegelinie.Streckenlast q_0 ,(q_q, [q_0])), |
|
436 (2 ,[1] ,true ,#Given ,Cor ??.Biegelinie.FunktionsVariable x ,(v_v, [x])), |
|
437 (3 ,[1] ,true ,#Find ,Cor ??.Biegelinie.Funktionen [ |
|
438 ??.Biegelinie.Q x = c + - 1 * q_0 * x, |
|
439 ??.Biegelinie.M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2, |
|
440 ??.Biegelinie.y' x = c_3 + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3), |
|
441 y x = c_4 + c_3 * x + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)], |
|
442 (funs''', [[ |
|
443 ??.Biegelinie.Q x = c + - 1 * q_0 * x, |
|
444 ??.Biegelinie.M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2, |
|
445 ??.Biegelinie.y' x = c_3 + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3), |
|
446 y x = c_4 + c_3 * x + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]]) ), |
|
447 (4 ,[1] ,true ,#Given ,Cor ??.Biegelinie.AbleitungBiegelinie dy ,(id_der, [dy]))] |
|
448 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
449 CORRECTION: |
|
450 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
451 Const ("Biegelinie.Biegelinie", _) MUST BE IN itms OF THE model, |
|
452 BECAUSE REQUIRED BY GUARD OF MethodC. |
|
453 *) |
|
454 (*//---------------- adhoc inserted ------------------------------------------------\\*) |
|
455 \<close> ML \<open> |
|
456 "~~~~~ fun me , args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, c, pt); |
|
457 val (pt, p) = |
|
458 (*Step.by_tactic is here for testing by me; do_next would suffice in me*) |
|
459 case Step.by_tactic tac (pt, p) of |
|
460 ("ok", (_, _, ptp)) => ptp |
|
461 | ("unsafe-ok", (_, _, ptp)) => ptp |
|
462 | ("not-applicable",_) => (pt, p) |
|
463 | ("end-of-calculation", (_, _, ptp)) => ptp |
|
464 | ("failure", _) => raise ERROR "sys-raise ERROR by Step.by_tactic" |
|
465 | _ => raise ERROR "me: uncovered case Step.by_tactic"; |
|
466 \<close> ML \<open> |
|
467 |
|
468 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ...(**) |
|
469 (*case*) |
|
470 Step.do_next p ((pt, Pos.e_pos'), []) (*of*); |
|
471 *) |
|
472 "~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = |
|
473 (p, ((pt, Pos.e_pos'), [])); |
215 (*if*) Pos.on_calc_end ip (*else*); |
474 (*if*) Pos.on_calc_end ip (*else*); |
216 val (_, probl_id, _) = Calc.references (pt, p); |
475 val (_, probl_id, _) = Calc.references (pt, p); |
217 val _ = |
476 val _ = |
218 (*case*) tacis (*of*); |
477 (*case*) tacis (*of*); |
219 (*if*) probl_id = Problem.id_empty (*else*); |
478 (*if*) probl_id = Problem.id_empty (*else*); |
220 |
479 |
221 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
480 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ...(**) |
222 switch_specify_solve p_ (pt, ip); |
481 switch_specify_solve p_ (pt, ip) |
223 \<close> ML \<open> |
482 *) |
224 "~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip)); |
483 "~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip)); |
225 (*if*) Pos.on_specification ([], state_pos) (*then*); |
484 (*if*) Pos.on_specification ([], state_pos) (*then*); |
226 |
485 |
227 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
486 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ...(**) |
228 specify_do_next (pt, input_pos); |
487 specify_do_next (pt, input_pos) |
229 \<close> ML \<open> |
488 *) |
230 "~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos); |
489 "~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos); |
231 val (_, (p_', tac)) = Specify.find_next_step ptp |
490 val (_, (p_', tac)) = Specify.find_next_step ptp |
232 val ist_ctxt = Ctree.get_loc pt (p, p_) |
491 val ist_ctxt = Ctree.get_loc pt (p, p_) |
233 val Tactic.Apply_Method mI = |
492 val Tactic.Apply_Method mI = |
234 (*case*) tac (*of*); |
493 (*case*) tac (*of*); |
235 |
494 |
236 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
495 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ...(**) |
237 LI.by_tactic (Tactic.Apply_Method' (mI, NONE, Istate.empty, ContextC.empty)) |
496 LI.by_tactic (Tactic.Apply_Method' (mI, NONE, Istate.empty, ContextC.empty)) ist_ctxt (pt, (p, p_')) |
238 ist_ctxt (pt, (p, p_')); |
497 *) |
239 \<close> ML \<open> |
|
240 "~~~~~ fun by_tactic , args:"; val ((Tactic.Apply_Method' (mI, _, _, _)), (_, ctxt), (pt, pos as (p, _))) = |
498 "~~~~~ fun by_tactic , args:"; val ((Tactic.Apply_Method' (mI, _, _, _)), (_, ctxt), (pt, pos as (p, _))) = |
241 ((Tactic.Apply_Method' (mI, NONE, Istate.empty, ContextC.empty)), ist_ctxt, (pt, (p, p_'))); |
499 ((Tactic.Apply_Method' (mI, NONE, Istate.empty, ContextC.empty)), ist_ctxt, (pt, (p, p_'))); |
242 val (itms, oris, probl) = case get_obj I pt p of (*STILL asms=[]*) |
500 val (itms, (*l..*)oris, probl(*..l*)) = case get_obj I pt p of |
243 PblObj {meth = itms, origin = (oris, _, _), probl, ...} => (itms, oris, probl) |
501 PblObj {meth = itms, origin = (oris, _, _), probl, ...} => (itms, oris, probl) |
244 | _ => raise ERROR "LI.by_tactic Apply_Method': uncovered case get_obj" |
502 | _ => raise ERROR "LI.by_tactic Apply_Method': uncovered case get_obj" |
245 val {model, ...} = MethodC.from_store ctxt mI; |
503 val {model, ...} = MethodC.from_store ctxt mI; |
246 val itms = if itms <> [] then itms else I_Model.complete oris probl [] model |
504 val itms = if itms <> [] then itms else I_Model.complete oris probl [] model |
247 ; |
505 val prog_rls = LItool.get_simplifier (pt, pos); |
248 (*+*)if (itms |> I_Model.to_string @{context}) = "[\n" ^ |
506 |
249 "(1 ,[1] ,true ,#Given ,Cor Traegerlaenge L ,(l_l, [L])), \n" ^ |
507 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ...(**) |
250 "(2 ,[1] ,true ,#Given ,Cor Streckenlast q_0 ,(q_q, [q_0])), \n" ^ |
508 (*case*) |
251 "(3 ,[1] ,true ,#Find ,Cor Biegelinie y ,(b_b, [y])), \n" ^ |
509 LItool.init_pstate prog_rls ctxt itms mI (*of*); |
252 "(4 ,[1] ,true ,#Relate ,Cor Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0] ,(r_b, [[y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]])), \n" ^ |
510 *) |
253 "(5 ,[1] ,true ,#Given ,Cor FunktionsVariable x ,(fun_var, [x])), \n" ^ |
511 "~~~~~ fun init_pstate , args:"; val (prog_rls, ctxt, itms, metID) = (prog_rls, ctxt, itms, mI); |
254 "(6 ,[1] ,true ,#Given ,Cor GleichungsVariablen [c, c_2, c_3, c_4] ,(vs, [[c, c_2, c_3, c_4]])), \n" ^ |
512 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ... (**) |
255 "(7 ,[1] ,true ,#Given ,Cor AbleitungBiegelinie dy ,(id_der, [dy]))]" |
513 val actuals = |
256 (*+*)then () else error "init_pstate: initial i_model changed"; |
514 arguments_from_model metID itms |
257 (*+*)if (itms |> I_Model.penv_to_string @{context}) = "[" ^ (*to be eliminated*) |
515 *) |
258 (*1*)"(l_l, [L]), " ^ |
516 \<close> ML \<open> |
259 (*2*)"(q_q, [q_0]), " ^ |
517 "~~~~~ fun arguments_from_model , args:"; val (mI, itms) = (metID, itms); |
260 (*3*)"(b_b, [y]), " ^ |
518 val mvat = Pre_Conds.max_variant itms |
261 (*4*)"(r_b, [[y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]]), " ^ |
519 fun okv mvat (_, vats, b, _, _) = member op = vats mvat andalso b |
262 (*5*)"(fun_var, [x]), " ^ |
520 val itms = filter (okv mvat) itms; |
263 (*6*)"(vs, [[c, c_2, c_3, c_4]]), " ^ |
521 |
264 (*7*)"(id_der, [dy])]" |
522 I_Model.to_string @{context} itms |> writeln; |
265 (*+*)then () else error "init_pstate: initial penv changed"; |
523 (*[ |
266 |
524 (1 ,[1] ,true ,#Given ,Cor ??.Biegelinie.Streckenlast q_0 ,(q_q, [q_0])), |
267 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
525 (2 ,[1] ,true ,#Given ,Cor ??.Biegelinie.FunktionsVariable x ,(v_v, [x])), |
268 (*case*) |
526 (3 ,[1] ,true ,#Find ,Cor ??.Biegelinie.Funktionen [ |
269 LItool.init_pstate ctxt (I_Model.OLD_to_TEST itms) mI (*of*); |
527 ??.Biegelinie.Q x = c + - 1 * q_0 * x, |
270 \<close> ML \<open>(*//------------ step into init_pstate -----------------------------------------------\\*) |
528 ??.Biegelinie.M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2, |
271 (*//------------------ step into init_pstate -----------------------------------------------\\*) |
529 ??.Biegelinie.y' x = c_3 + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3), |
272 "~~~~~ fun init_pstate , args:"; val (ctxt, i_model, met_id) = (ctxt, (I_Model.OLD_to_TEST itms), mI); |
530 y x = c_4 + c_3 * x + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)], |
273 val (model_patt, program, prog, prog_rls, where_, where_rls) = |
531 (funs''', [[ |
274 case MethodC.from_store ctxt met_id of |
532 ??.Biegelinie.Q x = c + - 1 * q_0 * x, |
275 {model = model_patt, program = program as Rule.Prog prog, prog_rls, where_, where_rls,...}=> |
533 ??.Biegelinie.M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2, |
276 (model_patt, program, prog, prog_rls, where_, where_rls) |
534 ??.Biegelinie.y' x = c_3 + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3), |
277 |
535 y x = c_4 + c_3 * x + 1 / (- 1 * ??.Biegelinie.EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]]) ), |
278 \<close> ML \<open> |
536 (4 ,[1] ,true ,#Given ,Cor ??.Biegelinie.AbleitungBiegelinie dy ,(id_der, [dy]))] |
279 val return_of_max_variant = |
537 *) |
280 I_Model.of_max_variant model_patt i_model; |
538 fun test_dsc d (_, _, _, _, itm_) = (d = I_Model.descriptor itm_) |
281 \<close> ML \<open>(*///----------- step into of_max_variant --------------------------------------------\\*) |
539 fun itm2arg itms (_, (d, _)) = |
282 (*///----------------- step into of_max_variant --------------------------------------------\\*) |
540 case find_first (test_dsc d) itms of |
283 "~~~~~ fun of_max_variant , args:"; val (model_patt, i_model) = (model_patt, i_model); |
541 NONE => raise ERROR "arguments_from_model ..."(*error_msg_2 d itms*) |
284 val all_variants = |
542 | SOME (_, _, _, _, itm_) => I_Model.penvval_in itm_ |
285 map (fn (_, variants, _, _, _) => variants) i_model |
543 |
286 |> flat |
544 val pats = (#model o MethodC.from_store ctxt) mI; |
287 |> distinct op = |
545 (*[("#Given", (Const ("Biegelinie.Streckenlast", "real \<Rightarrow> una"), Free ("q__q", "real"))), |
288 val variants_separated = map (filter_variants' i_model) all_variants |
546 ("#Given", (Const ("Biegelinie.FunktionsVariable", "real \<Rightarrow> una"), Free ("v_v", "real"))), |
289 val sums_corr = map (cnt_corrects) variants_separated |
547 ("#Given", (Const ("Biegelinie.Biegelinie", "(real \<Rightarrow> real) \<Rightarrow> una"), Free ("b_b", "real \<Rightarrow> real"))), |
290 val sum_variant_s = arrange_args1 sums_corr (1, all_variants) |
548 ("#Given", (Const ("Biegelinie.AbleitungBiegelinie", "(real \<Rightarrow> real) \<Rightarrow> una"), Free ("id_der", "real \<Rightarrow> real"))), |
291 val (_, max_variant) = hd (*..crude decision, up to improvement *) |
549 ("#Find", (Const ("Biegelinie.Funktionen", "bool list \<Rightarrow> una"), Free ("fun_s", "bool list")))]: |
292 (sort (fn ((i, _), (j, _)) => int_ord (i, j)) sum_variant_s) |
550 Model_Pattern.T*) |
293 val i_model_max = |
551 (*ERROR arguments_from_model: 'Biegelinie' not in itms: ... (**) |
294 filter (fn (_, variants, _ , _ ,_) => member (op =) variants max_variant) i_model |
552 (flat o (map ( |
295 val equal_descr_pairs = map (get_equal_descr i_model) model_patt |> flat |
553 itm2arg itms))) pats |
296 ; |
554 *) |
297 (*+*)if (equal_descr_pairs |> descr_pairs_to_string @{context}) = "[" ^ |
555 "~~~~~ fun itm2arg , args:"; val (itms, (_, (d, _))) = (itms, nth 1 pats); |
298 (*defined: in program+model--vvvv--,----------------------------------------- in problem ---vvv*) |
556 val SOME (1, [1], true, "#Given", Cor ((Const ("Biegelinie.Streckenlast", _), [Free ("q_0", _)]), (Free ("q_q", _), [Free ("q_0", _)]))) = |
299 "((#Given, (Traegerlaenge, l_l)), (1, [1], true ,#Given, " ^ "(Cor_TEST Traegerlaenge L ,(l_l, [L]), Position.T))), " ^ |
557 find_first (test_dsc d) itms; |
300 "((#Given, (Streckenlast, q_q)), (2, [1], true ,#Given, " ^ |
558 |
301 "(Cor_TEST Streckenlast q_0 ,(q_q, [q_0]), Position.T))), " ^ |
559 "~~~~~ fun itm2arg , args:"; val (itms, (_, (d, _))) = (itms, nth 2 pats); |
302 "((#Given, (FunktionsVariable, fun_var)), (5, [1], true ,#Given, " ^ |
560 val SOME (2, [1], true, "#Given", Cor ((Const ("Biegelinie.FunktionsVariable", _), [Free ("x", _)]), (Free ("v_v", _), [Free ("x", _)]))) = |
303 "(Cor_TEST FunktionsVariable x ,(fun_var, [x]), Position.T))), " ^ |
561 find_first (test_dsc d) itms; |
304 "((#Given, (GleichungsVariablen, vs)), (6, [1], true ,#Given, " ^ |
562 |
305 "(Cor_TEST GleichungsVariablen [c, c_2, c_3, c_4] ,(vs, [[c, c_2, c_3, c_4]]), Position.T))), " ^ |
563 "~~~~~ fun itm2arg , args:"; val (itms, (_, (d, _))) = (itms, nth 3 pats); |
306 "((#Given, (AbleitungBiegelinie, id_der)), (7, [1], true ,#Given, " ^ |
564 val Const ("Biegelinie.Biegelinie", _) = d |
307 "(Cor_TEST AbleitungBiegelinie dy ,(id_der, [dy]), Position.T))), " ^ |
565 val NONE = |
308 "((#Find, (Biegelinie, b_b)), (3, [1], true ,#Find, (Cor_TEST Biegelinie y ,(b_b, [y]), Position.T))), " ^ |
566 find_first (test_dsc d) itms; |
309 "((#Relate, (Randbedingungen, r_b)), (4, [1], true ,#Relate, " ^ |
567 |
310 "(Cor_TEST Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0] ,(r_b, [[y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]]), Position.T)))]" |
568 "~~~~~ fun itm2arg , args:"; val (itms, (_, (d, _))) = (itms, nth 4 pats); |
311 then () else error "of_max_variant: equal_descr_pairs CHANGED"; |
569 val SOME (4, [1], true, "#Given", Cor ((Const ("Biegelinie.AbleitungBiegelinie", _), [Free ("dy", _)]), (Free ("id_der", _), [Free ("dy", _)]))) = |
312 (*/////############### old test code ##################################################\\\\\\* ) |
570 find_first (test_dsc d) itms; |
313 |
571 |
314 val env_subst = |
572 "~~~~~ fun itm2arg , args:"; val (itms, (_, (d, _))) = (itms, nth 5 pats); |
315 mk_env_subst_DEL equal_descr_pairs; |
573 val SOME (3, [1], true, "#Find", Cor ((Const ("Biegelinie.Funktionen", _), _), (Free ("funs'''", _), _))) = |
316 (*/------------------- ERRORs to remove in CS subsequent to "prepare 1 PIDE turn 11"-000----\* ) |
574 find_first (test_dsc d) itms |
317 (*+*)if ( env_subst |> Subst.to_string @{context}) = "[\"\n" ^ |
575 |
318 (*ERRORs------^^^^^^^^^----------isa2: penv ---vvv----------------------..isa2, thus "correct"*) |
576 (*\\---------------- adhoc inserted ------------------------------------------------//*) |
319 (*1*)"(l_l, L)\", \"\n" ^ (* (l_l, [L]) *) |
577 \<close> ML \<open> |
320 (*2*)"(q_q, q_0)\", \"\n" ^ (* (q_q, [q_0]) *) |
578 (* ERROR: THIS TEST WAS BROKEN BEFORE CS "eliminate ThmC.numerals_to_Free", |
321 (*3*)"(fun_var, x)\", \"\n" ^ (* (fun_var, [x]) *) |
579 UNDETECTED BY Test_Isac_Short.thy ===========================================================\\ |
322 (*4*)"(vs, GleichungsVariablen)\", \"\n" ^ (* (vs, [[c, c_2, c_3, c_4]]) *) |
580 case nxt of ("Apply_Method", Apply_Method ["Biegelinien", "ausBelastung"]) => () |
323 (*5*)"(id_der, dy)\", \"\n" ^ (* (id_der, [dy]) *) |
581 | _ => error "biegelinie.sml met2 b"; |
324 (*6*)"(b_b, y)\"]" (* (b_b, [y]) *) |
582 |
325 (*7 missing*) (* (r_b, [[y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]]) *) |
583 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "q_ x = q_0"; |
326 (*+*)then () else error "of_max_variant: env_subst BETTER ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " |
584 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "- q_ x = - q_0"; |
327 ( *\------------------- ERRORs to remove ..--------------------------------------------------/*) |
585 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q' x = - q_0"; |
328 |
586 case nxt of (_, Subproblem (_, ["named", "integrate", "function"])) => () |
329 (*///----------------- step into mk_env_subst_DEL ------------------------------------------\\*) |
587 | _ => error "biegelinie.sml met2 c"; |
330 "~~~~~ fun mk_env_subst_DEL , args:"; val (equal_descr_pairs) = (equal_descr_pairs); |
588 |
331 |
589 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
332 (*///################# nth 1 equal_descr_pairs ############################################=\\*) |
590 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
333 val xxx = (fn ((_, (_, id)), (_, _, _, _, (feedb, _))) |
591 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
334 => (Pre_Conds.discern_feedback_subst id feedb) (*|> map fst (*rhs dropped*)|> map (pair id)*) ) (nth 1 equal_descr_pairs); |
592 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
335 "~~~~~ fun xxx , args:"; val ((_, (_, id)), (_, _, _, _, (feedb, _))) = (nth 1 equal_descr_pairs); |
593 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
336 (*--------------------------------------------------------------------------^^^----------------*) |
594 |
337 |
595 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q x = c + - 1 * q_0 * x"; |
338 Pre_Conds.discern_feedback_subst id feedb; |
596 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q x = c + - 1 * q_0 * x"; |
339 "~~~~~ fun discern_feedback_subst , args:"; val (id, Cor_TEST ((descr, [ts]), _)) = (id, feedb); |
597 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b' x = c + - 1 * q_0 * x"; |
340 (*if*) TermC.is_list ts (*else*); |
598 case nxt of (_,Subproblem (_, ["named", "integrate", "function"])) => () |
341 val ts = [ts] |
599 | _ => error "biegelinie.sml met2 d"; |
342 ; |
600 |
343 Pre_Conds.discern_type_subst (descr, id) ts; |
601 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
344 "~~~~~ fun discern_type_subst , args:"; val ((descr, id), ts) = ((descr, id), ts); |
602 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
345 val _(*"real \<Rightarrow> una"*) = |
603 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
346 (*case*) type_of descr (*of*); |
604 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
347 val return_discern_type_subst_1 = [(id, Library.the_single ts)] |
605 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
348 (*\\\################# nth 1 equal_descr_pairs ############################################=//*) |
606 "M_b x = Integral c + - 1 * q_0 * x D x"; |
349 |
607 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
350 (*///################# nth 4 equal_descr_pairs ############################################=\\*) |
608 "M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2"; |
351 val xxx = (fn ((_, (_, id)), (_, _, _, _, (feedb, _))) |
609 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
352 => (discern_feedback_subst id feedb) (*|> map fst (*rhs dropped*)|> map (pair id)*) ) (nth 1 equal_descr_pairs); |
610 "M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2"; |
353 "~~~~~ fun xxx , args:"; val ((_, (_, id)), (_, _, _, _, (feedb, _))) = (nth 4 equal_descr_pairs); |
611 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
354 (*--------------------------------------------------------------------------^^^----------------*) |
612 "- EI * y'' x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2"; |
355 |
613 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
356 Pre_Conds.discern_feedback_subst id feedb; |
614 "y'' x = 1 / - EI * (c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2)"; |
357 "~~~~~ fun discern_feedback_subst , args:"; val (id, Cor_TEST ((descr, (*[*)ts(*]*)), _)) = (id, feedb); |
615 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
358 (*+*)val (Free ("vs", _), "[[c], [c_2], [c_3], [c_4]]") |
616 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
359 = (id, ts |> UnparseC.terms @{context}); |
617 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
360 |
618 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
361 (*if*) fold (curry and_) (map TermC.is_list ts) true (*then*); |
619 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
362 val ts = ts; |
620 "y' x = Integral 1 / - EI * (c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2) D x"; |
363 |
621 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
364 discern_type_subst (descr, id) ts; |
622 "y' x = Integral 1 / (- 1 * EI) * (c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2) D x"; |
365 "~~~~~ fun discern_type_subst , args:"; val ((descr, id), ts) = ((descr, id), ts); |
623 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
366 val (Type ("fun", [Type ("List.list", [Type ("Real.real", [])]), _])) = |
624 "y' x =\nc_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"; |
367 (*case*) type_of descr (*of*); |
625 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
368 (*if*) TermC.is_list (hd ts) (*then*); |
626 "y' x =\nc_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"; |
369 |
627 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
370 val return_discern_type_subst_4 = |
628 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
371 (* if TermC.is_list (hd ts) |
629 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
372 then*) [(id, ts |> map TermC.the_single |> TermC.list2isalist HOLogic.realT)] |
630 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt; |
373 (* else []*) |
631 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
374 (*+*)val "[\"\n(vs, [c, c_2, c_3, c_4])\"]" |
632 "y x =\nIntegral c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3) D x"; |
375 = return_discern_type_subst_4 |> Subst.to_string @{context} |
633 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
376 |
634 "y x =\nc_4 + c_3 * x +\n1 / (- 1 * EI) *\n(c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)"; |
377 (*-------------------- contine discern_feedback_subst ----------------------------------------*) |
635 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = |
378 val return_discern_feedback_subst_4 = return_discern_type_subst_4 |
636 "y x =\nc_4 + c_3 * x +\n1 / (- 1 * EI) *\n(c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)"; |
379 (*-------------------- contine mk_env_subst_DEL ----------------------------------------------*) |
637 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
380 val return_mk_env_subst_DEL_4 = return_discern_feedback_subst_4 |
638 if f2str f = |
381 (*+*)val "[\"\n(vs, [c, c_2, c_3, c_4])\"]" |
639 "[Q x = c + - 1 * q_0 * x, M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2,\n dy x =\n c_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3),\n y x =\n c_4 + c_3 * x +\n 1 / (- 1 * EI) *\n (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)]" |
382 = return_mk_env_subst_DEL_4 |> Subst.to_string @{context} |
640 then case nxt of ("End_Proof'", End_Proof') => () |
383 (*\\\################# nth 4 equal_descr_pairs ############################################=//*) |
641 | _ => error "biegelinie.sml met2 e 1" |
384 |
642 else error "biegelinie.sml met2 e 2"; |
385 (*///################# nth 7 equal_descr_pairs ############################################=\\*) |
643 =============================================================================================//*) |
386 val xxx = (fn ((_, (_, id)), (_, _, _, _, (feedb, _))) |
|
387 => (discern_feedback_subst id feedb) (*|> map fst (*rhs dropped*)|> map (pair id)*) ) (nth 7 equal_descr_pairs); |
|
388 "~~~~~ fun xxx , args:"; val ((_, (_, id)), (_, _, _, _, (feedb, _))) = (nth 7 equal_descr_pairs); |
|
389 (*--------------------------------------------------------------------------^^^----------------*) |
|
390 |
|
391 Pre_Conds.discern_feedback_subst id feedb; |
|
392 "~~~~~ fun discern_feedback_subst , args:"; val (id, Cor_TEST ((descr, (*[*)ts(*]*)), _)) = (id, feedb); |
|
393 (*+*)val (Free ("r_b", _), "[[y 0 = 0], [y L = 0], [M_b 0 = 0], [M_b L = 0]]") |
|
394 = (id, ts |> UnparseC.terms @{context}); |
|
395 |
|
396 (*if*) fold (curry and_) (map TermC.is_list ts) true (*then*); |
|
397 val ts = ts; |
|
398 |
|
399 discern_type_subst (descr, id) ts; |
|
400 "~~~~~ fun discern_type_subst , args:"; val ((descr, id), ts) = ((descr, id), ts); |
|
401 val (Type ("fun", [Type ("List.list", [Type ("HOL.bool", [])]), _])) = |
|
402 (*case*) type_of descr (*of*); |
|
403 (*if*) TermC.is_list (hd ts) (*then*); |
|
404 |
|
405 val return_discern_type_subst_7 = |
|
406 (* if TermC.is_list (hd ts) |
|
407 then*) [(id, ts |> map TermC.the_single |> TermC.list2isalist HOLogic.boolT)] |
|
408 (* else []*) |
|
409 (*+*)val "[\"\n(r_b, [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0])\"]" |
|
410 = return_discern_type_subst_7 |> Subst.to_string @{context} |
|
411 |
|
412 (*-------------------- contine discern_feedback_subst ----------------------------------------*) |
|
413 val return_discern_feedback_subst_7 = return_discern_type_subst_7 |
|
414 (*-------------------- contine mk_env_subst_DEL ----------------------------------------------*) |
|
415 val return_mk_env_subst_DEL_7 = return_discern_type_subst_7 |
|
416 (*+*)val "[\"\n(r_b, [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0])\"]" |
|
417 = return_mk_env_subst_DEL_7 |> Subst.to_string @{context}; |
|
418 (*\\\################# nth 7 equal_descr_pairs ############################################=//*) |
|
419 |
|
420 (*BEFORE correct (vs, [c, c_2, c_3, c_4])* ) |
|
421 (*+*)val "[\"\n(l_l, L)\", \"\n(q_q, q_0)\", \"\n(fun_var, x)\", \"\n(vs, vs)\", \"\n(id_der, dy)\", \"\n(b_b, y)\"]" |
|
422 (*ERRORs still -----------------------------------------------------------^^^-------------------------------------, r_b*) |
|
423 = (env_subst |> Subst.to_string @{context}) |
|
424 *) |
|
425 (*NOW only nth 7 is missing.. (but mk_env_eval_DEL completely broken)* ) |
|
426 (*+*)val "[\"\n(l_l, L)\", \"\n(q_q, q_0)\", \"\n(fun_var, x)\", \"\n(vs, [c, c_2, c_3, c_4])\", \"\n(id_der, dy)\", \"\n(b_b, y)\"]" |
|
427 (*ERRORs still ---------------------------------------------------------------------------------------------------------------------, r_b*) |
|
428 = (env_subst |> Subst.to_string @ {context}) |
|
429 *) |
|
430 (*+*)if (env_subst |> Subst.to_string @{context}) = "[\"\n" ^ |
|
431 (*1*)"(l_l, L)\", \"\n" ^ |
|
432 (*2*)"(q_q, q_0)\", \"\n" ^ |
|
433 (*3*)"(fun_var, x)\", \"\n" ^ |
|
434 (*4*)"(vs, [c, c_2, c_3, c_4])\", \"\n" ^ |
|
435 (*5*)"(id_der, dy)\", \"\n" ^ |
|
436 (*6*)"(b_b, y)\", \"\n" ^ |
|
437 (*7*)"(r_b, [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0])\"]" |
|
438 (*+*)then () else error "env_subst CHANGED"; |
|
439 |
|
440 |
|
441 (*+*)if (i_model_max |> I_Model.to_string_TEST @{context}) = "[\n" ^ |
|
442 "(1, [1], true ,#Given, (Cor_TEST Traegerlaenge L ,(l_l, [L]), Position.T)), \n" ^ |
|
443 "(2, [1], true ,#Given, (Cor_TEST Streckenlast q_0 ,(q_q, [q_0]), Position.T)), \n" ^ |
|
444 "(3, [1], true ,#Find, (Cor_TEST Biegelinie y ,(b_b, [y]), Position.T)), \n" ^ |
|
445 "(4, [1], true ,#Relate, (Cor_TEST Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0] ,(r_b, [[y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]]), Position.T)), \n" ^ |
|
446 "(5, [1], true ,#Given, (Cor_TEST FunktionsVariable x ,(fun_var, [x]), Position.T)), \n" ^ |
|
447 "(6, [1], true ,#Given, (Cor_TEST GleichungsVariablen [c, c_2, c_3, c_4] ,(vs, [[c, c_2, c_3, c_4]]), Position.T)), \n" ^ |
|
448 "(7, [1], true ,#Given, (Cor_TEST AbleitungBiegelinie dy ,(id_der, [dy]), Position.T))]" |
|
449 (*+*)then () else error "i_model_max CHANGED"; |
|
450 |
|
451 (*||------------------ continue of_max_variant ---------------------------------------------\\*) |
|
452 |
|
453 mk_env_eval_DEL i_model_max; |
|
454 (*///----------------- step into mk_env_eval_DEL -------------------------------------------\\*) |
|
455 "~~~~~ fun mk_env_eval_DEL , args:"; val (i_singles) = (i_model_max); |
|
456 val xxx = (fn (_, _, _, _, (feedb, _)) => discern_feedback_subst id feedb); |
|
457 |
|
458 (*///################# nth 1 i_model_max \<longrightarrow>[], <>[] only in maximum-example ##############=\\*) |
|
459 "~~~~~ fun xxx , args:"; val (_, _, _, _, (feedb, _)) = nth 1 i_model_max; |
|
460 (*---------------------------------------------------------^^^------------*) |
|
461 (*+*)val "Cor_TEST Traegerlaenge L ,(l_l, [L])" |
|
462 = feedb |> I_Model.feedback_to_string'_TEST @{context}; |
|
463 |
|
464 discern_feedback_subst id feedb; |
|
465 "~~~~~ fun discern_feedback_subst , args:"; val (Model_Def.Cor_TEST ((descr, [ts]), _)) = (feedb); |
|
466 (*if*) TermC.is_list ts (*else*); |
|
467 val ts = (*if TermC.is_list ts then TermC.isalist2list ts else*) [ts]; |
|
468 |
|
469 Pre_Conds.discern_type_eval descr ts; |
|
470 "~~~~~ fun discern_type_eval , args:"; val (descr, ts) = (descr, ts); |
|
471 val _(*"real \<Rightarrow> una"*) = |
|
472 (*case*) type_of descr (*of*) |
|
473 ; |
|
474 Pre_Conds.discern_atoms ts; |
|
475 "~~~~~ fun discern_atoms , args:"; val (ts) = (ts); |
|
476 (*if*) all_atoms ts (*then*); |
|
477 |
|
478 val return_distinguish_ts_eval_1 = |
|
479 map (rpair TermC.empty (*dummy rhs*)) ts |
|
480 (*-------------------- contine discern_type_subst --------------------------------------------*) |
|
481 (*-------------------- contine discern_feedback_subst ----------------------------------------*) |
|
482 (*-------------------- contine mk_env_eval_DEL -----------------------------------------------*) |
|
483 val return_mk_env_subst_DEL_1 |
|
484 = filter_out (fn (_, b) => b = TermC.empty) return_distinguish_ts_eval_1 |
|
485 (*+*)val [] = return_mk_env_subst_DEL_1 |
|
486 (*\\\################# nth 1 i_model_max \<longrightarrow>[], <>[] only in maximum-example ##############=//*) |
|
487 (*\\\----------------- step into mk_env_eval_DEL -------------------------------------------//*) |
|
488 |
|
489 (*|||----------------- contine of_max_variant ------------------------------------------------*) |
|
490 |
|
491 (* val env_eval = mk_env_eval_DEL i_model_max*) |
|
492 val env_eval = mk_env_eval_DEL i_model_max |
|
493 (*+*)val [] = env_eval |
|
494 val return_of_max_variant_step = (i_model_max, env_model, (env_subst, env_eval)) |
|
495 ; |
|
496 return_of_max_variant_step = return_of_max_variant |
|
497 ( *\\\\\############### old test code ##################################################//////*) |
|
498 \<close> ML \<open> |
|
499 (*\\\----------------- step into of_max_variant --------------------------------------------//*) |
|
500 val (_, env_model, (env_subst, env_eval)) = return_of_max_variant |
|
501 |
|
502 (*|------------------- contine init_pstate ---------------------------------------------------*) |
|
503 val actuals = map snd env_model |
|
504 (*+* )val "[L, q_0, x, [c, c_2, c_3, c_4], dy, y, [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]]" |
|
505 = actuals |> UnparseC.terms @{context}(**) |
|
506 (*+*)val 7 = length actuals( **) |
|
507 (*WRONG ----------------v-v--v---v--v---v--v---v-----------v-------v--v-------v--v---------v--v---------v*) |
|
508 (*+*) val "[L, q_0, x, [[c], [c_2], [c_3], [c_4]], dy, y, [[y 0 = 0], [y L = 0], [M_b 0 = 0], [M_b L = 0]]]" |
|
509 = actuals |> UnparseC.terms @{context} |
|
510 \<close> ML \<open> |
|
511 val formals = Program.formal_args prog |
|
512 (*+*)val "[l_l, q_q, fun_var, b_b, r_b, vs, id_der]" |
|
513 = formals |> UnparseC.terms @{context} |
|
514 (*+*)val 7 = length formals |
|
515 |
|
516 \<close> ML \<open> |
|
517 val preconds = Pre_Conds.check_from_store ctxt where_rls where_ env_subst env_eval |
|
518 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
|
519 val ctxt = ctxt |> ContextC.insert_assumptions (map snd (snd preconds)); |
|
520 val ist = Istate.e_pstate |
|
521 |> Istate.set_eval prog_rls |
|
522 |> Istate.set_env_true (relate_args [] formals actuals ctxt prog met_id formals actuals) |
|
523 \<close> text \<open> (*ERROR type_of: real/real list/(#) [c_4]*) |
|
524 (*+*)(relate_args [] formals actuals ctxt prog met_id formals actuals) |
|
525 \<close> text \<open> |
|
526 val return_init_pstate = (Istate.Pstate ist, ctxt, program) |
|
527 \<close> ML \<open>(*\\------------ step into init_pstate -----------------------------------------------//*) |
|
528 (*\\------------------ step into init_pstate -----------------------------------------------//*) |
|
529 \<close> ML \<open>(*\------------- step into me_Add_Given_AbleitungBieg --------------------------------//*) |
|
530 (*\------------------- step into me_Add_Given_AbleitungBieg --------------------------------//*) |
|
531 \<close> text \<open> (*\------------ step into me_Add_Given_AbleitungBieg --------------------------------//*) |
|
532 val (p,_,f,nxt,_,pt) = return_Add_Given_AbleitungBieg; |
|
533 val Apply_Method ["IntegrierenUndKonstanteBestimmen2"] = nxt |
|
534 |
|
535 \<close> text \<open> |
|
536 (* final test ... ----------------------------------------------------------------------------*) |
|
537 (*+*)val ([], Met) = p |
|
538 (*+*)val Apply_Method ["IntegrierenUndKonstanteBestimmen2"] = nxt |
|
539 |
644 |
540 \<close> ML \<open> |
645 \<close> ML \<open> |
541 \<close> |
646 \<close> |
542 |
647 |
543 section \<open>===================================================================================\<close> |
648 section \<open>===================================================================================\<close> |
544 section \<open>===== ============================================================================\<close> |
649 section \<open>===== ============================================================================\<close> |
545 ML \<open> |
650 ML \<open> |
546 \<close> ML \<open> |
651 \<close> ML \<open> |
547 \<close> ML \<open> |
652 |
548 \<close> ML \<open> |
653 \<close> ML \<open> |
549 \<close> |
654 \<close> |
550 |
655 |
551 section \<open>code for copy & paste ===============================================================\<close> |
656 section \<open>code for copy & paste ===============================================================\<close> |
552 ML \<open> |
657 ML \<open> |