319 \<close> ML \<open> |
74 \<close> ML \<open> |
320 |
75 |
321 \<close> ML \<open> |
76 \<close> ML \<open> |
322 \<close> |
77 \<close> |
323 |
78 |
324 ML \<open> |
|
325 Know_Store.set_ref_last_thy @{theory}; |
|
326 (*otherwise ERRORs in pbl-met-hierarchy.sml, refine.sml, evaluate.sml*) |
|
327 \<close> |
|
328 ML_file "Specify/refine.sml" (* requires setup from refine.thy *) |
|
329 |
|
330 section \<open>===================================================================================\<close> |
|
331 section \<open>=====AUFRÄUMEN refine.sml =========================================================\<close> |
|
332 ML \<open> |
|
333 \<close> ML \<open> |
|
334 (* Title: "Specify/refine.sml" |
|
335 Author: Walther Neuper |
|
336 (c) due to copyright terms |
|
337 *) |
|
338 |
|
339 "-----------------------------------------------------------------------------------------------"; |
|
340 "table of contents -----------------------------------------------------------------------------"; |
|
341 "-----------------------------------------------------------------------------------------------"; |
|
342 "refine.thy: store test-pbtyps by 'setup' ------------------------------------------------------"; |
|
343 "----------- testdata for refin, Refine.refine_ori --------------------------------------------"; |
|
344 (*"----------- refin test-pbtyps -------requires specific 'setup'-------------------------------";*) |
|
345 "----------- Refine.refine_ori test-pbtyps --requires 'setup'-----------------------------------"; |
|
346 "----------- refine test-pbtyps ------requires 'setup'------------------------------------------"; |
|
347 "----------- refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ------------------------"; |
|
348 "----------- Refine_Problem (from subp-rooteq.sml) ---------------------------------------------"; |
|
349 "----------- equation with CalcTree [ = 6 / 5] for timing: with/out adapt_to_type --------------"; |
|
350 "----------- refine ad-hoc equation for timing: with/out adapt_to_type -------------------------"; |
|
351 "-----------------------------------------------------------------------------------------------"; |
|
352 "-----------------------------------------------------------------------------------------------"; |
|
353 "-----------------------------------------------------------------------------------------------"; |
|
354 \<close> ML \<open> |
|
355 @{theory}(*val it = |
|
356 {Pure, Isac.VSCode_Example, Interpret.Interpret, Isac.MathEngine, Isac.Test_Code, |
|
357 Isac.BridgeLibisabelle, Isac.Base_Tools, Isac.Simplify, Isac.Poly, Isac.GCD_Poly_ML, |
|
358 Isac.Rational, Isac.Root, Isac.Equation, Isac.LinEq, Isac.RootEq, Isac.RatEq, Isac.RootRat, |
|
359 Isac.RootRatEq, Isac.PolyEq, Isac.Calculus, Isac.Trig, Isac.LogExp, Isac.Diff, Isac.Integrate, |
|
360 Isac.EqSystem, Isac.Test, Isac.Diff_App, Isac.Partial_Fractions, Isac.PolyMinus, Isac.Vect, |
|
361 Isac.Biegelinie, Isac.AlgEin, Isac.InsSort, Isac.DiophantEq, Isac.Inverse_Z_Transform, |
|
362 Tools.Code_Generator, HOL.HOL, HOL.Orderings, HOL.Groups, HOL.Lattices, HOL.Boolean_Algebras, |
|
363 HOL.Set, HOL.Fun, HOL.Complete_Lattices, HOL.Ctr_Sugar, HOL.Typedef, HOL.Inductive, HOL.Rings, |
|
364 HOL.Nat, HOL.Product_Type, HOL.Sum_Type, HOL.Fields, HOL.Finite_Set, HOL.Relation, |
|
365 HOL.Transitive_Closure, HOL.Wellfounded, HOL.Wfrec, HOL.Order_Relation, HOL.Hilbert_Choice, |
|
366 HOL.BNF_Wellorder_Relation, HOL.BNF_Wellorder_Embedding, HOL.Zorn, |
|
367 HOL.BNF_Wellorder_Constructions, HOL.BNF_Cardinal_Order_Relation, HOL.BNF_Cardinal_Arithmetic, |
|
368 HOL.Fun_Def_Base, HOL.BNF_Def, HOL.BNF_Composition, HOL.Basic_BNFs, HOL.BNF_Fixpoint_Base, |
|
369 HOL.BNF_Least_Fixpoint, HOL.Meson, HOL.ATP, HOL.Basic_BNF_LFPs, HOL.Metis, HOL.Equiv_Relations, |
|
370 HOL.Transfer, HOL.Lifting, HOL.Num, HOL.Power, HOL.Complete_Partial_Order, HOL.Option, HOL.Argo, |
|
371 HOL.Partial_Function, HOL.SAT, HOL.Quotient, HOL.Groups_Big, HOL.Fun_Def, HOL.Int, |
|
372 HOL.Lattices_Big, HOL.Euclidean_Division, HOL.Parity, HOL.Numeral_Simprocs, |
|
373 HOL.Semiring_Normalization, HOL.Groebner_Basis, HOL.Set_Interval, HOL.Divides, HOL.Presburger, |
|
374 HOL.SMT, HOL.Sledgehammer, HOL.Lifting_Set, HOL.List, HOL.Groups_List, HOL.Bit_Operations, |
|
375 HOL.Code_Numeral, HOL.Map, HOL.Enum, HOL.String, HOL.Predicate, HOL.Lazy_Sequence, HOL.Typerep, |
|
376 HOL.Limited_Sequence, HOL.Random, HOL.Code_Evaluation, HOL.Quickcheck_Random, HOL.Random_Pred, |
|
377 HOL.Random_Sequence, HOL.Quickcheck_Exhaustive, HOL.Predicate_Compile, HOL.Record, HOL.GCD, |
|
378 HOL.Nitpick, HOL.Factorial, HOL.Quickcheck_Narrowing, HOL.Mirabelle, HOL.Extraction, HOL.Nunchaku, |
|
379 HOL.BNF_Greatest_Fixpoint, HOL.Filter, HOL.Conditionally_Complete_Lattices, HOL.Binomial, Main, |
|
380 HOL.Archimedean_Field, HOL.Rat, HOL.Hull, HOL.Modules, HOL.Real, HOL.Topological_Spaces, |
|
381 HOL.Vector_Spaces, HOL.Real_Vector_Spaces, HOL.Limits, HOL.Inequalities, HOL.Deriv, HOL.Series, |
|
382 HOL.NthRoot, HOL.Transcendental, HOL.Complex, HOL.MacLaurin, Complex_Main, Specify.Know_Store, |
|
383 Specify.BaseDefinitions, Specify.Calc_Binop, Specify.ListC, Specify.Program, Specify.Prog_Tac, |
|
384 Specify.Tactical, Specify.Prog_Expr, Specify.Auto_Prog, Specify.ProgLang, Isac.Isac_Knowledge, |
|
385 Isac.Test_Build_Thydata, Isac.BridgeJEdit, Isac.Build_Thydata, Isac.Build_Isac, Isac_Test.refine, |
|
386 Isac_Test.Test_Theory:544}: |
|
387 theory*) |
|
388 \<close> ML \<open> |
|
389 |
|
390 \<close> ML \<open> |
|
391 open Test_Tool; |
|
392 |
|
393 |
|
394 \<close> ML \<open>"----- testdata for refin, Refine.refine_ori --------------------------------------------"; |
|
395 "----------- testdata for refin, Refine.refine_ori --------------------------------------------"; |
|
396 "----------- testdata for refin, Refine.refine_ori --------------------------------------------"; |
|
397 Test_Tool.show_ptyps(); |
|
398 val thy = @{theory "Isac_Knowledge"}; |
|
399 val ctxt = Proof_Context.init_global @{theory "Isac_Knowledge"}; |
|
400 |
|
401 (*case 1: no refinement *) |
|
402 val (d1,ts1) = Input_Descript.split (ParseC.parse_test ctxt "fixedValues [aaa = 0]"); |
|
403 val (d2,ts2) = Input_Descript.split (ParseC.parse_test ctxt "errorBound (ddd = 0)"); |
|
404 val ori1 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]: O_Model.T; |
|
405 |
|
406 (*case 2: refined to pbt without children *) |
|
407 val (d2,ts2) = Input_Descript.split (ParseC.parse_test ctxt "relations [aaa333]"); |
|
408 val ori2 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]:O_Model.T; |
|
409 |
|
410 (*case 3: refined to pbt with children *) |
|
411 val (d2,ts2) = Input_Descript.split (ParseC.parse_test ctxt "valuesFor [aaa222]"); |
|
412 val ori3 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]:O_Model.T; |
|
413 |
|
414 (*case 4: refined to children (without child)*) |
|
415 val (d3,ts3) = Input_Descript.split (ParseC.parse_test ctxt "boundVariable aaa222yyy"); |
|
416 val ori4 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2), (3,[1],"#Given",d3,ts3)]:O_Model.T; |
|
417 |
|
418 (*================================================================= |
|
419 This test expects pbls at a certain position in the tree. |
|
420 Since parallel evaluation (i.e. Theory_Data) this cannot be expected. |
|
421 Solutions would be |
|
422 * provide an access function for a branch (not only leaves) |
|
423 * sort the tree of pbls. |
|
424 "----------- refin test-pbtyps -------requires specific 'setup'-------------------------------"; |
|
425 "----------- refin test-pbtyps -------requires specific 'setup'-------------------------------"; |
|
426 "----------- refin test-pbtyps -------requires specific 'setup'-------------------------------"; |
|
427 (* fragile test setup: expects ptyps as fixed *) |
|
428 val level_1 = case nth 9 (get_pbls ()) of |
|
429 Store.Node ("test", _, level_1) => level_1 | _ => error "refin broken: root-branch in ptyps changed?" |
|
430 val level_2 = case nth 4 level_1 of |
|
431 Store.Node ("refine", _, level_2) => level_2 | _ => error "refin broken: lev1-branch in ptyps changed?" |
|
432 val pbla_branch = case level_2 of |
|
433 [Store.Node ("pbla", _, _)] => level_2 | _ => error "refin broken: lev2-branch in ptyps changed?"; |
|
434 |
|
435 (*case 1: no refinement *) |
|
436 case refin [] ori1 (hd pbla_branch) of |
|
437 SOME ["pbla"] => () | _ => error "refin case 1 broken"; |
|
438 |
|
439 (*case 2: refined to pbt without children *) |
|
440 case refin [] ori2 (hd pbla_branch) of |
|
441 SOME ["pbla", "pbla3"] => () | _ => error "refin case 2 broken"; |
|
442 |
|
443 (*case 3: refined to pbt with children *) |
|
444 case refin [] ori3 (hd pbla_branch) of |
|
445 SOME ["pbla", "pbla2"] => () | _ => error "refin case 3 broken"; |
|
446 |
|
447 (*case 4: refined to children (without child)*) |
|
448 case refin [] ori4 (hd pbla_branch) of |
|
449 SOME ["pbla", "pbla2", "pbla2y"] => () | _ => error "refin case 4 broken"; |
|
450 |
|
451 (*case 5: start refinement somewhere in ptyps*) |
|
452 val [Store.Node ("pbla",_,[_, ppp as Store.Node ("pbla2",_,_), _])] = pbla_branch; |
|
453 case refin ["pbla"] ori4 ppp of |
|
454 SOME ["pbla", "pbla2", "pbla2y"] => () | _ => error "refin case 5 broken"; |
|
455 ==================================================================*) |
|
456 |
|
457 |
|
458 \<close> ML \<open>"----- ERR Refine.refine_ori test-pbtyps --requires 'setup'----------------------------------"; |
|
459 "----------- Refine.refine_ori test-pbtyps --requires 'setup'----------------------------------"; |
|
460 "----------- Refine.refine_ori test-pbtyps --requires 'setup'----------------------------------"; |
|
461 (*case 1: no refinement *) |
|
462 case Refine.refine_ori @{context} ori1 ["pbla", "refine", "test"] of |
|
463 NONE => () | _ => error "Refine.refine_ori case 1 broken"; |
|
464 |
|
465 (*case 2: refined to pbt without children *) |
|
466 case Refine.refine_ori @{context} ori2 ["pbla", "refine", "test"] of |
|
467 SOME ["pbla3", "pbla", "refine", "test"] => () | _ => error "Refine.refine_ori case 2 broken"; |
|
468 |
|
469 (*case 3: refined to pbt with children *) |
|
470 case Refine.refine_ori @{context} ori3 ["pbla", "refine", "test"] of |
|
471 SOME ["pbla2", "pbla", "refine", "test"] => () | _ => error "Refine.refine_ori case 3 broken"; |
|
472 |
|
473 (*case 4: refined to children (without child)*) |
|
474 case Refine.refine_ori @{context} ori4 ["pbla", "refine", "test"] of |
|
475 SOME ["pbla2y", "pbla2", "pbla", "refine", "test"] => () | _ => error "Refine.refine_ori case 4 broken"; |
|
476 |
|
477 (*case 5: start refinement somewhere in ptyps*) |
|
478 case Refine.refine_ori @{context} ori4 ["pbla2", "pbla", "refine", "test"] of |
|
479 SOME ["pbla2y", "pbla2", "pbla", "refine", "test"] => () | _ => error "Refine.refine_ori case 5 broken"; |
|
480 |
|
481 |
|
482 \<close> ML \<open>"----- refine test-pbtyps ------requires 'setup'------------------------------------------"; |
|
483 "----------- refine test-pbtyps ------requires 'setup'------------------------------------------"; |
|
484 "----------- refine test-pbtyps ------requires 'setup'------------------------------------------"; |
|
485 val fmz1 = ["fixedValues [aaa=0]", "errorBound (ddd=0)"]; |
|
486 val fmz2 = ["fixedValues [aaa=0]", "relations aaa333"]; |
|
487 val fmz3 = ["fixedValues [aaa=0]", "valuesFor [aaa222]"]; |
|
488 val fmz4 = ["fixedValues [aaa=0]", "valuesFor [aaa222]", |
|
489 "boundVariable aaa222yyy"]; |
|
490 |
|
491 (*case 1: no refinement *) |
|
492 case Refine.xxxxx @{context} fmz1 ["pbla", "refine", "test"] of |
|
493 [M_Match.Matches (["pbla", "refine", "test"], _), |
|
494 M_Match.NoMatch (["pbla1", "pbla", "refine", "test"], _), |
|
495 M_Match.NoMatch (["pbla2", "pbla", "refine", "test"], _), |
|
496 M_Match.NoMatch (["pbla3", "pbla", "refine", "test"], _)] => () |
|
497 | _ => error "--- Refine.refine test-pbtyps --- broken with case 1"; |
|
498 (* |
|
499 *** pass ["pbla"] |
|
500 *** pass ["pbla", "pbla1"] |
|
501 *** pass ["pbla", "pbla2"] |
|
502 *** pass ["pbla", "pbla3"] |
|
503 val it = |
|
504 [M_Match.Matches |
|
505 (["pbla"], |
|
506 {Find=[], |
|
507 Given=[Correct "fixedValues [aaa = #0]", |
|
508 Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}), |
|
509 M_Match.NoMatch |
|
510 (["pbla1", "pbla"], |
|
511 {Find=[], |
|
512 Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_", |
|
513 Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}), |
|
514 M_Match.NoMatch |
|
515 (["pbla2", "pbla"], |
|
516 {Find=[], |
|
517 Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_", |
|
518 Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}), |
|
519 M_Match.NoMatch |
|
520 (["pbla3", "pbla"], |
|
521 {Find=[], |
|
522 Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_", |
|
523 Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]})] |
|
524 : match list*) |
|
525 |
|
526 (*case 2: refined to pbt without children *) |
|
527 case Refine.xxxxx @{context} fmz2 ["pbla", "refine", "test"] of |
|
528 [M_Match.Matches (["pbla", "refine", "test"], _), |
|
529 M_Match.NoMatch (["pbla1", "pbla", "refine", "test"], _), |
|
530 M_Match.NoMatch (["pbla2", "pbla", "refine", "test"], _), |
|
531 M_Match.Matches (["pbla3", "pbla", "refine", "test"], _)] => () |
|
532 | _ => error "--- Refine.refine test-pbtyps --- broken with case 2"; |
|
533 (* |
|
534 *** pass ["pbla"] |
|
535 *** pass ["pbla", "pbla1"] |
|
536 *** pass ["pbla", "pbla2"] |
|
537 *** pass ["pbla", "pbla3"] |
|
538 val it = |
|
539 [M_Match.Matches |
|
540 (["pbla"], |
|
541 {Find=[], |
|
542 Given=[Correct "fixedValues [aaa = #0]",Superfl "relations aaa333"], |
|
543 Relate=[],Where=[],With=[]}), |
|
544 M_Match.NoMatch |
|
545 (["pbla1", "pbla"], |
|
546 {Find=[], |
|
547 Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_", |
|
548 Superfl "relations aaa333"],Relate=[],Where=[],With=[]}), |
|
549 M_Match.NoMatch |
|
550 (["pbla2", "pbla"], |
|
551 {Find=[], |
|
552 Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_", |
|
553 Superfl "relations aaa333"],Relate=[],Where=[],With=[]}), |
|
554 M_Match.Matches |
|
555 (["pbla3", "pbla"], |
|
556 {Find=[], |
|
557 Given=[Correct "fixedValues [aaa = #0]",Correct "relations aaa333"], |
|
558 Relate=[],Where=[],With=[]})] : match list*) |
|
559 |
|
560 (*case 3: refined to pbt with children *) |
|
561 case Refine.xxxxx @{context} fmz3 ["pbla", "refine", "test"] of |
|
562 [M_Match.Matches (["pbla", "refine", "test"], _), |
|
563 M_Match.NoMatch (["pbla1", "pbla", "refine", "test"], _), |
|
564 M_Match.Matches (["pbla2", "pbla", "refine", "test"], _), |
|
565 M_Match.NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _), |
|
566 M_Match.NoMatch (["pbla2y", "pbla2", "pbla", "refine", "test"], _), |
|
567 M_Match.NoMatch (["pbla2z", "pbla2", "pbla", "refine", "test"], _), |
|
568 M_Match.NoMatch (["pbla3", "pbla", "refine", "test"], _)] => () |
|
569 | _ => error "--- Refine.refine test-pbtyps --- broken with case 3"; |
|
570 (* |
|
571 *** pass ["pbla"] |
|
572 *** pass ["pbla", "pbla1"] |
|
573 *** pass ["pbla", "pbla2"] |
|
574 *** pass ["pbla", "pbla2", "pbla2x"] |
|
575 *** pass ["pbla", "pbla2", "pbla2y"] |
|
576 *** pass ["pbla", "pbla2", "pbla2z"] |
|
577 *** pass ["pbla", "pbla3"] |
|
578 val it = |
|
579 [M_Match.Matches |
|
580 (["pbla"], |
|
581 {Find=[], |
|
582 Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222"], |
|
583 Relate=[],Where=[],With=[]}), |
|
584 M_Match.NoMatch |
|
585 (["pbla1", "pbla"], |
|
586 {Find=[], |
|
587 Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_", |
|
588 Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]}), |
|
589 M_Match.Matches |
|
590 (["pbla2", "pbla"], |
|
591 {Find=[], |
|
592 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222"], |
|
593 Relate=[],Where=[],With=[]}), |
|
594 M_Match.NoMatch |
|
595 (["pbla2x", "pbla2", "pbla"], |
|
596 {Find=[], |
|
597 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
598 Missing "functionOf a2x_"],Relate=[],Where=[],With=[]}), |
|
599 M_Match.NoMatch |
|
600 (["pbla2y", "pbla2", "pbla"], |
|
601 {Find=[], |
|
602 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
603 Missing "boundVariable a2y_"],Relate=[],Where=[],With=[]}), |
|
604 M_Match.NoMatch |
|
605 (["pbla2z", "pbla2", "pbla"], |
|
606 {Find=[], |
|
607 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
608 Missing "interval a2z_"],Relate=[],Where=[],With=[]}), |
|
609 M_Match.NoMatch |
|
610 (["pbla3", "pbla"], |
|
611 {Find=[], |
|
612 Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_", |
|
613 Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]})] |
|
614 : match list*) |
|
615 |
|
616 (*case 4: refined to children (without child)*) |
|
617 case Refine.xxxxx @{context} fmz4 ["pbla", "refine", "test"] of |
|
618 [M_Match.Matches (["pbla", "refine", "test"], _), |
|
619 M_Match.NoMatch (["pbla1", "pbla", "refine", "test"], _), |
|
620 M_Match.Matches (["pbla2", "pbla", "refine", "test"], _), |
|
621 M_Match.NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _), |
|
622 M_Match.Matches (["pbla2y", "pbla2", "pbla", "refine", "test"], _)] => () |
|
623 | _ => error "--- Refine.refine test-pbtyps --- broken with case 4"; |
|
624 (* |
|
625 *** pass ["pbla"] |
|
626 *** pass ["pbla", "pbla1"] |
|
627 *** pass ["pbla", "pbla2"] |
|
628 *** pass ["pbla", "pbla2", "pbla2x"] |
|
629 *** pass ["pbla", "pbla2", "pbla2y"] |
|
630 val it = |
|
631 [M_Match.Matches |
|
632 (["pbla"], |
|
633 {Find=[], |
|
634 Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222", |
|
635 Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}), |
|
636 M_Match.NoMatch |
|
637 (["pbla1", "pbla"], |
|
638 {Find=[], |
|
639 Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_", |
|
640 Superfl "valuesFor aaa222",Superfl "boundVariable aaa222yyy"], |
|
641 Relate=[],Where=[],With=[]}), |
|
642 M_Match.Matches |
|
643 (["pbla2", "pbla"], |
|
644 {Find=[], |
|
645 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
646 Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}), |
|
647 M_Match.NoMatch |
|
648 (["pbla2x", "pbla2", "pbla"], |
|
649 {Find=[], |
|
650 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
651 Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"], |
|
652 Relate=[],Where=[],With=[]}), |
|
653 M_Match.Matches |
|
654 (["pbla2y", "pbla2", "pbla"], |
|
655 {Find=[], |
|
656 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
657 Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})] |
|
658 : match list*) |
|
659 |
|
660 (*case 5: start refinement somewhere in ptyps*) |
|
661 case Refine.xxxxx @{context} fmz4 ["pbla2", "pbla", "refine", "test"] of |
|
662 [M_Match.Matches (["pbla2", "pbla", "refine", "test"], _), |
|
663 M_Match.NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _), |
|
664 M_Match.Matches (["pbla2y", "pbla2", "pbla", "refine", "test"], _)] => () |
|
665 | _ => error "--- Refine.refine test-pbtyps --- broken with case 5"; |
|
666 (* |
|
667 *** pass ["pbla", "pbla2"] |
|
668 *** pass ["pbla", "pbla2", "pbla2x"] |
|
669 *** pass ["pbla", "pbla2", "pbla2y"] |
|
670 val it = |
|
671 [M_Match.Matches |
|
672 (["pbla2", "pbla"], |
|
673 {Find=[], |
|
674 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
675 Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}), |
|
676 M_Match.NoMatch |
|
677 (["pbla2x", "pbla2", "pbla"], |
|
678 {Find=[], |
|
679 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
680 Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"], |
|
681 Relate=[],Where=[],With=[]}), |
|
682 M_Match.Matches |
|
683 (["pbla2y", "pbla2", "pbla"], |
|
684 {Find=[], |
|
685 Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222", |
|
686 Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})] |
|
687 : match list*) |
|
688 |
|
689 |
|
690 \<close> ML \<open>"----- refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ------------------------"; |
|
691 "----------- refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ------------------------"; |
|
692 "----------- refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ------------------------"; |
|
693 (*overwrites NEW funs in Test_Theory ABOVE* ) |
|
694 open Refine |
|
695 open M_Match |
|
696 open Pre_Conds |
|
697 ( *overwrites NEW funs in Test_Theory ABOVE*) |
|
698 (* |
|
699 refinement of the first eqsystem in Biegelinie, IntegrierenUndKonstanteBestimmen2; |
|
700 this example was the demonstrator; |
|
701 respective data are in ~/proto4/../exp_Statics_Biegel_Timischl_7-70.xml. |
|
702 Data for this test are from biegelinie-5.sml, --- me IntegrierenUndKonstanteBestimmen2 ALL --- |
|
703 *) |
|
704 (*+*)val o_model = [ |
|
705 (1, [1], "#Given", @{term "equalities"}, |
|
706 [@{term "[(0::real) = - 1 * c_4 / - 1]"}, |
|
707 @{term "[(0::real) = (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) / - 24]"}, |
|
708 @{term "[(0::real) = c_2]"}, |
|
709 @{term "[(0::real) = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]"}] ), |
|
710 (*Const ("List.list.Cons", "real \<Rightarrow> real list \<Rightarrow> real list") $ Free ("c", "real") $ Const ("List.list.Nil", "real list"),*) |
|
711 (2, [1], "#Given", @{term "solveForVars"}, |
|
712 [@{term "[c] ::real list"}, |
|
713 @{term "[c_2]::real list"}, |
|
714 @{term "[c_3]::real list"}, |
|
715 @{term "[c_4]::real list"}] ), |
|
716 (3, [1], "#Find", @{term "solution"}, [@{term "ss'''::bool list"}] )] |
|
717 ; |
|
718 val SOME ["normalise", "4x4", "LINEAR", "system"] = |
|
719 refine_ori @{context} o_model ["LINEAR", "system"]; |
|
720 "~~~~~ fun refine_ori , args:"; val (ctxt, oris, pblID) = |
|
721 (@{context}, o_model, ["LINEAR", "system"]); |
|
722 |
|
723 val opt as SOME ["system", "LINEAR", "4x4", "normalise"] |
|
724 = app_ptyp (refin ctxt ((rev o tl) pblID) oris) pblID (rev pblID); |
|
725 (* |
|
726 app_ptyp works strangely, parameter passing is awkward. |
|
727 Present refin knows structure of Store.T, thus we bypass app_ptyp |
|
728 *) |
|
729 (*!*)val pblID = ["LINEAR", "system"];(**) |
|
730 val return_refin as SOME ["system", "LINEAR", "LINEAR", "4x4", "normalise"] = (**) |
|
731 refin ctxt (rev pblID) oris (Store.get_node (rev pblID) pblID (get_pbls ())); |
|
732 "~~~~~ fun refin , args:"; val (ctxt, pblRD, ori, (Store.Node (pI, [py], pys))) |
|
733 = (ctxt, (rev pblID), oris, Store.get_node (rev pblID) pblID (get_pbls ())); |
|
734 val {where_rls, model, where_, ...} = py: Problem.T |
|
735 val model = map (Model_Pattern.adapt_to_type ctxt) model |
|
736 val where_ = map (ParseC.adapt_term_to_type ctxt) where_; |
|
737 (*if*) M_Match.match_oris ctxt where_rls ori (model, where_) (*then*); |
|
738 val return_refin as SOME ["system", "LINEAR"] = SOME (pblRD (** )@ [pI]( **)) |
|
739 |
|
740 (*follow the trace created in parallel by writeln in Store.get_node and Refine.refin*) |
|
741 (*!*)val pblID = ["4x4", "LINEAR", "system"];(**) |
|
742 val return_refin as SOME ["system", "LINEAR", "4x4", "4x4", "normalise"] = |
|
743 refin ctxt (rev pblID) oris (Store.get_node (rev pblID) pblID (get_pbls ())); |
|
744 "~~~~~ fun refin , args:"; val (ctxt, pblRD, ori, (Store.Node (pI, [py], pys))) |
|
745 = (ctxt, (rev pblID), oris, Store.get_node (rev pblID) pblID (get_pbls ())); |
|
746 val {where_rls, model, where_, ...} = py: Problem.T |
|
747 val model = map (Model_Pattern.adapt_to_type ctxt) model |
|
748 val where_ = map (ParseC.adapt_term_to_type ctxt) where_ |
|
749 |
|
750 (*+*)val (**)true(** )false( **) = (*if*) |
|
751 M_Match.match_oris ctxt where_rls o_model (model, where_); |
|
752 "~~~~~ fun match_oris , args:"; val (ctxt, where_rls, o_model, (model_pattern, where_)) = |
|
753 (ctxt, where_rls, o_model, (model, where_)); |
|
754 val i_model = (flat o (map (chk1_ model_pattern))) o_model; |
|
755 |
|
756 (*+*)val "[\n(1, [\"1\"], #Given, equalities, [\"[0 = - 1 * c_4 / - 1]\", \"[0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24]\", \"[0 = c_2]\", \"[0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]\"]), \n(2, [\"1\"], #Given, solveForVars, [\"[c]\", \"[c_2]\", \"[c_3]\", \"[c_4]\"]), \n(3, [\"1\"], #Find, solution, [\"ss'''\"])]" |
|
757 = o_model |> O_Model.to_string @{context}; |
|
758 (*+*)if "[\n" ^ |
|
759 "(1 ,[1] ,true ,#Given ,Cor equalities\n [0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2] ,(e_s, [[0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]])), \n" ^ |
|
760 "(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2, c_3, c_4] ,(v_s, [[c, c_2, c_3, c_4]])), \n" ^ |
|
761 "(3 ,[1] ,true ,#Find ,Cor solution ss''' ,(ss''', [ss''']))]" |
|
762 = (i_model |> I_Model.to_string @{context}) then () else raise error "i_model CAHNGED"; |
|
763 (*+*)val "[\"(#Given, (equalities, e_s))\", \"(#Given, (solveForVars, v_s))\", \"(#Find, (solution, ss'''))\"]" |
|
764 = model_pattern |> Model_Pattern.to_string @{context} |
|
765 (*+*)val "[Length e_s = 4, Length v_s = 4]" = where_ |> UnparseC.terms @{context} |
|
766 |
|
767 val mvat = I_Model.variables_TEST model_pattern (I_Model.OLD_to_TEST i_model) |
|
768 val complete = chk1_mis mvat i_model model_pattern; |
|
769 |
|
770 val (pb as true, (** )_( **)where_'(**)) = |
|
771 Pre_Conds.check_OLD ctxt where_rls where_ (model_pattern, I_Model.OLD_to_TEST i_model); |
|
772 "~~~~~ fun check_OLD , args:"; val (ctxt, where_rls, pres, (model_patt, i_model)) = |
|
773 (ctxt, where_rls, where_, (model_pattern, I_Model.OLD_to_TEST i_model)); |
|
774 |
|
775 (*+*)val [(true, xxx), (true, yyy)] = where_' |
|
776 (*+*)val "[Length\n [0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2] =\n4, Length [c, c_2, c_3, c_4] = 4]" |
|
777 = where_' |> map #2 |> UnparseC.terms @{context} |
|
778 |
|
779 val (_, env_model, (env_subst, env_eval)) = |
|
780 of_max_variant model_patt i_model; |
|
781 "~~~~~ fun of_max_variant , args:"; val (model_patt, i_model) = (model_patt, i_model); |
|
782 val all_variants = |
|
783 map (fn (_, variants, _, _, _) => variants) i_model |
|
784 |> flat |
|
785 |> distinct op = |
|
786 val variants_separated = map (filter_variants' i_model) all_variants |
|
787 val sums_corr = map (cnt_corrects) variants_separated |
|
788 val sum_variant_s = arrange_args1 sums_corr (1, all_variants) |
|
789 val (_, max_variant) = hd (*..crude decision, up to improvement *) |
|
790 (sort (fn ((i, _), (j, _)) => int_ord (i, j)) sum_variant_s) |
|
791 val i_model_max = |
|
792 filter (fn (_, variants, _ , _ ,_) => member (op =) variants max_variant) i_model |
|
793 val equal_descr_pairs = map (get_equal_descr i_model) model_patt |> flat |
|
794 |
|
795 val env_model = make_env_model equal_descr_pairs |
|
796 val equal_givens = filter (fn ((m_field, _), _) => m_field = "#Given") equal_descr_pairs |
|
797 |
|
798 val subst_eval_list = |
|
799 make_envs_preconds equal_givens; |
|
800 "~~~~~ fun make_envs_preconds , args:"; val (equal_givens) = (equal_givens); |
|
801 "~~~~~ fun xxx , args:"; val ((_, (_, id)), (_, _, _, _, (feedb, _))) = (nth 1 equal_givens); |
|
802 "~~~~~ fun discern_feedback , args:"; val (id, (Model_Def.Cor_TEST ((descr, ts), _))) = |
|
803 (id, feedb); |
|
804 |
|
805 val return_discern_typ as [] = |
|
806 discern_typ id (descr, ts); |
|
807 "~~~~~ fun discern_typ , args:"; val (id, (descr, ts)) = (id, (descr, ts)); |
|
808 |
|
809 (*+*)val "[[0 = - 1 * c_4 / - 1], [0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24], [0 = c_2], [0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]]" |
|
810 = ts |> UnparseC.terms @{context} |
|
811 |
|
812 val ts = if Model_Pattern.is_list_descr descr |
|
813 then if TermC.is_list (hd ts) |
|
814 then ts |> map TermC.isalist2list |> flat |
|
815 else ts |
|
816 else ts |
|
817 |
|
818 (*+*)val "[0 = - 1 * c_4 / - 1, 0 =\n(- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n- 24, 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]" |
|
819 = ts |> UnparseC.terms @{context}; |
|
820 |
|
821 (*if*) Model_Pattern.typ_of_element descr = HOLogic.boolT (*then*); |
|
822 |
|
823 (*+*)val false = all_lhs_atoms ts |
|
824 (*-------------------- contine check_OLD -----------------------------------------------------*) |
|
825 |
|
826 val pres_subst = map (TermC.subst_atomic_all env_subst) where_; |
|
827 |
|
828 (*+*)if "[\"\n" ^ |
|
829 "(e_s, [0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2])\", \"\n" ^ |
|
830 "(v_s, [c, c_2, c_3, c_4])\", \"\n(ss''', ss''')\"]" |
|
831 = (env_model |> Subst.to_string @{context}) then () else error "env_model CAHNGED"; |
|
832 (*+*)val "[]" = env_eval |> Subst.to_string @{context} (*GOON \<rightarrow> []*) |
|
833 |
|
834 val pres_subst_other = map (TermC.subst_atomic_all env_model) (map #2 pres_subst); |
|
835 val full_subst = if env_eval = [] then pres_subst_other |
|
836 else map (TermC.subst_atomic_all env_eval) (map #2 pres_subst_other) |
|
837 val evals = map (eval ctxt where_rls) full_subst |
|
838 val return_check_OLD = (foldl and_ (true, map fst evals), pres_subst_other) |
|
839 |
|
840 val return_refin as SOME ["system", "LINEAR", "4x4"] = SOME (pblRD(** ) @ [pI]( **)) |
|
841 |
|
842 (*follow the trace created in parallel by writeln in Store.get_node and Refine.refin*) |
|
843 (*!*)val pblID = ["normalise", "4x4", "LINEAR", "system"];(**) |
|
844 val return_refin as SOME ["system", "LINEAR", "4x4", "normalise", "normalise"] = |
|
845 refin ctxt (rev pblID) oris (Store.get_node (rev pblID) pblID (get_pbls ())); |
|
846 |
|
847 |
|
848 \<close> ML \<open>"----- Refine_Problem (from subp-rooteq.sml) ---------------------------------------------"; |
|
849 "----------- Refine_Problem (from subp-rooteq.sml) ---------------------------------------------"; |
|
850 "----------- Refine_Problem (from subp-rooteq.sml) ---------------------------------------------"; |
|
851 (* |
|
852 By child of 2d962612dd0a this test case revealed an undetected failure |
|
853 of Specify.find_next_step -- for_problem: these propose Tactic.Refine_Problem, |
|
854 but Step_Specify.by_tactic_input (Refine_Problem ["sqroot-test", "univariate", "equation", "test"].. |
|
855 encounters "case Refine.problem ... of NONE". |
|
856 The failure might be caused by inappropriate problem-hierarchy. |
|
857 *) |
|
858 val c = []; |
|
859 val fmz = ["equality ((x+1)*(x+2)=x \<up> 2+(8::real))", "solveFor x", |
|
860 "errorBound (eps=0)", "solutions L"]; |
|
861 val (dI',pI',mI') = ("Test",["sqroot-test", "univariate", "equation", "test"], |
|
862 ["Test", "squ-equ-test-subpbl1"]); |
|
863 (*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; |
|
864 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
865 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
866 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Find "solutions L"*) |
|
867 |
|
868 (*=== specify a not-matching problem ---vvvvvvvvvvvvvvvvvvvvvvvvvvvv*) |
|
869 val nxt = (Specify_Problem ["LINEAR", "univariate", "equation", "test"]); |
|
870 (*=== specify a not-matching problem --- \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> ^*) |
|
871 |
|
872 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Find "solutions L"*) |
|
873 |
|
874 val www = |
|
875 case f of Test_Out.PpcKF (Test_Out.Problem [], |
|
876 {Find = [Incompl "solutions []"], With = [], |
|
877 Given = [Correct "equality ((x + 1) * (x + 2) = x \<up> 2 + 8)", Correct "solveFor x"], |
|
878 Where = [Correct(*WAS False*) www(*! ! ! ! ! !*)], |
|
879 Relate = [],...}) => www(*! ! !*) |
|
880 | _ => error "--- Refine_Problem broken 1"; |
|
881 if www = "matches (x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8) \<or>\nmatches (?b * x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8) \<or>\nmatches (?a + x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8) \<or>\nmatches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8)" |
|
882 then () else error "--- Refine_Problem broken 2"; |
|
883 (*ML> f; |
|
884 val it = Form' (Test_Out.PpcKF (0,EdUndef,0,Nundef, |
|
885 (Problem ["LINEAR", "univariate", "equation", "test"], <<<<<===== diff.to above WN120313 |
|
886 {Find=[Incompl "solutions []"], |
|
887 Given=[Correct "equality ((x + #1) * (x + #2) = x \<up> #2 + #8)", |
|
888 Correct "solveFor x"],Relate=[], |
|
889 Where=[False "matches (x = #0) ((x + #1) * (x + #2) = x \<up> #2 + #8) |
|
890 |\nmatches (?b * x = #0) ((x + #1) * (x + #2) = x \<up> #2 + #8) |
|
891 |\nmatches (?a + x = #0) ((x + #1) * (x + #2) = x \<up> #2 + #8) |
|
892 |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x \<up> #2 + #8)"], |
|
893 With=[]}))) : mout |
|
894 *) |
|
895 |
|
896 (*/------------------- step into me Add_Find "solutions L" ---------------------------------\*) |
|
897 (*[], Pbl*)val (p''''',_,f''''',nxt''''',_,pt''''') = (me nxt p c pt); |
|
898 "~~~~~ fun me , args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, c, pt); |
|
899 |
|
900 (*+*)val Add_Find "solutions L" = tac; |
|
901 |
|
902 val (pt, p) = |
|
903 (*Step.by_tactic is here for testing by me; do_next would suffice in me*) |
|
904 case Step.by_tactic tac (pt, p) of |
|
905 ("ok", (_, _, ptp)) => ptp |
|
906 | ("unsafe-ok", (_, _, ptp)) => ptp |
|
907 | ("not-applicable",_) => (pt, p) |
|
908 | ("end-of-calculation", (_, _, ptp)) => ptp |
|
909 | ("failure", _) => raise ERROR "sys-raise ERROR" |
|
910 | _ => raise ERROR "me: uncovered case Step.by_tactic" |
|
911 |
|
912 val ("ok", ([(Add_Find "solutions L", _, _)], [], _)) = (*case*) |
|
913 Step.do_next p ((pt, Pos.e_pos'), []) (*of*); |
|
914 "~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = (p, ((pt, Pos.e_pos'), [])); |
|
915 (*if*) Pos.on_calc_end ip (*else*); |
|
916 val (_, probl_id, _) = Calc.references (pt, p); |
|
917 val _ = (*case*) tacis (*of*); |
|
918 (*if*) probl_id = Problem.id_empty (*else*); |
|
919 |
|
920 switch_specify_solve p_ (pt, ip) (*return from Step.do_next*); |
|
921 "~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip)); |
|
922 (*if*) Pos.on_specification ([], state_pos) (*then*); |
|
923 |
|
924 val ("ok", ([(Add_Find "solutions L", _, _)], [], _)) = |
|
925 specify_do_next (pt, input_pos); |
|
926 "~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos); |
|
927 val (_, (p_', tac)) = |
|
928 Specify.find_next_step ptp; |
|
929 (*/------------------- step into find_next_step --------------------------------------------\*) |
|
930 (*+ store for continuation after find_next_step*)val (p_'_'''''_', tac'''''_') = (p_', tac); |
|
931 |
|
932 "~~~~~ fun find_next_step , args:"; val (pt, pos as (_, p_)) = (ptp); |
|
933 val {meth = met, origin = origin as (oris, o_refs as (_, pI', mI'), _), probl = pbl, |
|
934 spec = refs, ...} = Calc.specify_data (pt, pos); |
|
935 (*if*) Ctree.just_created (pt, pos) andalso origin <> Ctree.e_origin (*else*); |
|
936 (*if*) p_ = Pos.Pbl (*then*); |
|
937 |
|
938 val ("dummy", (Pbl, Add_Find "solutions L")) = |
|
939 for_problem ctxt oris (o_refs, refs) (pbl, met); |
|
940 "~~~~~ fun for_problem , args:"; val (oris, ((dI', pI', mI'), (dI, pI, mI)), (pbl, met)) = |
|
941 (oris, (o_refs, refs), (pbl, met)); |
|
942 val cpI = if pI = Problem.id_empty then pI' else pI; |
|
943 val cmI = if mI = MethodC.id_empty then mI' else mI; |
|
944 val {model = pbt, where_rls, where_, ...} = Problem.from_store ctxt cpI; |
|
945 val {model = mpc, ...} = MethodC.from_store ctxt cmI |
|
946 val (preok, _) = Pre_Conds.check_OLD ctxt where_rls where_ (pbt, I_Model.OLD_to_TEST pbl); |
|
947 (*if*) dI' = ThyC.id_empty andalso dI = ThyC.id_empty (*else*); |
|
948 (*if*) pI' = Problem.id_empty andalso pI = Problem.id_empty (*else*); |
|
949 val NONE = (*case*) find_first (I_Model.is_error o #5) pbl (*of*); |
|
950 val SOME ("#Find", "solutions L") = (*case*) |
|
951 item_to_add (ThyC.get_theory @{context} (if dI = ThyC.id_empty then dI' else dI)) oris pbt pbl (*of*); |
|
952 (*if*) not preok (*then*); |
|
953 |
|
954 (*+*)Pre_Conds.to_string @{context} xxxxx = "[\n" ^ |
|
955 "(false, matches (x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8) \<or>\n" ^ |
|
956 "matches (?b * x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8) \<or>\n" ^ |
|
957 "matches (?a + x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8) \<or>\n" ^ |
|
958 "matches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x \<up> 2 + 8))]"; |
|
959 (*TermC.matches \<up> \<up> \<up> \<up> \<up> ^ NONE, ok: why then NONE = Refine.problem below?*) |
|
960 (*-------------------- stop step into find_next_step ----------------------------------------*) |
|
961 (*+ continue after find_next_step*)val (p_', tac) = (p_'_'''''_', tac'''''_') |
|
962 (*\------------------- step into find_next_step --------------------------------------------/*) |
|
963 |
|
964 (*-------------------- contiue step into specify_do_next ------------------------------------*) |
|
965 val ist_ctxt = Ctree.get_loc pt (p, p_) |
|
966 val Add_Find "solutions L" = |
|
967 (*case*) tac (*of*); |
|
968 |
|
969 val ("ok", ([(Add_Find "solutions L", _, _)], [], _)) = |
|
970 Step_Specify.by_tactic_input tac (pt, (p, p_')); |
|
971 "~~~~~ fun by_tactic_input , args:"; val ((Tactic.Add_Find ct), (ptp as (pt, pos as (p,_)))) = |
|
972 (tac, (pt, (p, p_'))); |
|
973 |
|
974 Specify.by_Add_ "#Find" ct ptp; |
|
975 "~~~~~ fun by_Add_ , args:"; val (m_field, ct, (pt, pos as (_, p_))) = |
|
976 ("#Find", ct, ptp); |
|
977 (*-------------------- stop step into -------------------------------------------------------*) |
|
978 val (p,f,nxt,pt) = (p''''',f''''',nxt''''',pt'''''); val Add_Find "solutions L" = nxt; |
|
979 (*\------------------- step into me Add_Find "solutions L" ---------------------------------/*) |
|
980 (* |
|
981 WN230814 |
|
982 repaired 'step into me Add_Find "solutions L"' above (ERROR was Tactic.Refine); |
|
983 But with the repair the subsequent steps repeatedly led to Add_Find "solutions L" -- |
|
984 -- which was NOT repaird, too. |
|
985 So we kept the old test code below, because it leads to the correct result "[x = 2]". |
|
986 |
|
987 ---------------------- old test code from before above repair ------------------------------- |
|
988 |
|
989 (*=== refine problem -----vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*) |
|
990 val nxt = (Refine_Problem ["univariate", "equation", "test"]); |
|
991 (*=== refine problem ----- \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> \<up> ^^*) |
|
992 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
993 (*("Specify_Problem", Specify_Problem ["normalise", "univariate", ...])*) |
|
994 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
995 (*nxt = ("Specify_Theory", Specify_Theory "Test")*) |
|
996 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
997 (*nxt = ("Specify_Method", Specify_Method ["Test", "squ-equ-test-subpbl1"]*) |
|
998 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
999 (*nxt = ("Apply_Method", *) |
|
1000 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1001 (*nxt = ("Rewrite_Set", Rewrite_Set "norm_equation")*) |
|
1002 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1003 (*nxt = ("Rewrite_Set", Rewrite_Set "Test_simplify")*) |
|
1004 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1005 (*Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]*) |
|
1006 |
|
1007 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1008 (*nxt = Model_Problem ["LINEAR", "univariate", "equation", "test"]*) |
|
1009 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1010 (*nxt = ("Add_Given", Add_Given "equality (-6 + 3 * x = 0)"*) |
|
1011 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1012 (**) |
|
1013 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1014 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1015 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1016 (*nxt = Specify_Problem ["LINEAR", "univariate", "equation", "test"])*) |
|
1017 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1018 (*xt = ("Specify_Method", Specify_Method ["Test", "solve_linear"])*) |
|
1019 val nxt = (Refine_Problem ["univariate", "equation", "test"]); |
|
1020 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1021 (*("Specify_Problem", Specify_Problem ["LINEAR", "univariate", ...])*) |
|
1022 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1023 (*val nxt = ("Specify_Method",Specify_Method ("Test", "solve_linear"))*) |
|
1024 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1025 (*val nxt = ("Apply_Method",Apply_Method ("Test", "solve_linear"))*) |
|
1026 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1027 (*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"isolate_bdv"))*) |
|
1028 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1029 (*val nxt = ("Rewrite_Set",Rewrite_Set "Test_simplify")*) |
|
1030 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1031 (*val nxt = ("Check_Postcond",Check_Postcond ["LINEAR", "univariate", "eq*) |
|
1032 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1033 (*val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*) |
|
1034 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1035 (*Check_Postcond ["normalise", "univariate", "equation", "test"])*) |
|
1036 val (p,_,f,nxt,_,pt) = me nxt p c pt; |
|
1037 val Test_Out.FormKF res = f; |
|
1038 |
|
1039 if res = "[x = 2]" |
|
1040 then case nxt of End_Proof' => () |
|
1041 | _ => error "new behaviour in test:refine.sml:miniscript with mini-subpb 1" |
|
1042 else error "new behaviour in test:refine.sml:miniscript with mini-subpb 2" |
|
1043 *) |
|
1044 |
|
1045 \<close> ML \<open>"----- equation with CalcTree [ = 6 / 5] for timing: with/out adapt_to_type --------------"; |
|
1046 "----------- equation with CalcTree [ = 6 / 5] for timing: with/out adapt_to_type --------------"; |
|
1047 "----------- equation with CalcTree [ = 6 / 5] for timing: with/out adapt_to_type --------------"; |
|
1048 (*for timing copy to Test_Some.thy*) |
|
1049 States.reset (); |
|
1050 val model = ["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)", "solveFor x", "solutions L"]; |
|
1051 val refs = ("PolyEq"(**), ["univariate", "equation"], ["no_met"]); |
|
1052 |
|
1053 CalcTree @{context} [(model, refs)]; |
|
1054 |
|
1055 Iterator 1; |
|
1056 moveActiveRoot 1; |
|
1057 autoCalculate 1 CompleteCalc; |
|
1058 |
|
1059 val ((pt, _), _) = States.get_calc 1; |
|
1060 val p = States.get_pos 1 1; |
|
1061 val (Form f, tac, asms) = ME_Misc.pt_extract ctxt (pt, p); |
|
1062 if UnparseC.term @{context} f = "[x = 6 / 5]" then () else error "equation for timing CHANGED" |
|
1063 |
|
1064 \<close> ML \<open>"----- refine ad-hoc equation for timing: with/out adapt_to_type -------------------------"; |
|
1065 "----------- refine ad-hoc equation for timing: with/out adapt_to_type -------------------------"; |
|
1066 "----------- refine ad-hoc equation for timing: with/out adapt_to_type -------------------------"; |
|
1067 (*for timing copy to Test_Some.thy*) |
|
1068 val model = ["equality ((x \<up> 2 - 6*x+9) - (x \<up> 2 - 3*x) = x)", "solveFor x", "solutions L"]; |
|
1069 val (_, pbl_id, _) = ("PolyEq", ["univariate", "equation"], ["no_met"]); |
|
1070 |
|
1071 Refine.xxxxx @{context} model pbl_id; |
|
1072 (* |
|
1073 *** pass ["equation", "univariate"] |
|
1074 *** pass ["equation", "univariate", "rootX"] |
|
1075 *** pass ["equation", "univariate", "LINEAR"] |
|
1076 *** pass ["equation", "univariate", "rational"] |
|
1077 *** pass ["equation", "univariate", "polynomial"] |
|
1078 *** pass ["equation", "univariate", "polynomial", "degree_0"] |
|
1079 *** pass ["equation", "univariate", "polynomial", "degree_1"] |
|
1080 *** pass ["equation", "univariate", "polynomial", "degree_2"] |
|
1081 *** pass ["equation", "univariate", "polynomial", "degree_3"] |
|
1082 *** pass ["equation", "univariate", "polynomial", "degree_4"] |
|
1083 *** pass ["equation", "univariate", "polynomial", "normalise"] |
|
1084 *) |
|
1085 |
|
1086 \<close> ML \<open> |
|
1087 \<close> |
|
1088 |
|
1089 section \<open>=====eqsy refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ==================\<close> |
|
1090 ML \<open> (*\<longrightarrow> refine.sml*) |
|
1091 \<close> ML \<open>"----- refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ------------------------"; |
|
1092 "----------- refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ------------------------"; |
|
1093 "----------- refine_ori' [0 = - 1 * c_4 / - 1, 0 =\n (- 24 * c_4.., ..] ------------------------"; |
|
1094 (*overwrites NEW funs in Test_Theory ABOVE*) |
|
1095 open Refine |
|
1096 open M_Match |
|
1097 open Pre_Conds |
|
1098 (*overwrites NEW funs in Test_Theory ABOVE*) |
|
1099 (* |
|
1100 refinement of the first eqsystem in Biegelinie, IntegrierenUndKonstanteBestimmen2; |
|
1101 this example was the demonstrator; |
|
1102 respective data are in ~/proto4/../exp_Statics_Biegel_Timischl_7-70.xml. |
|
1103 Data for this test are from biegelinie-5.sml, --- me IntegrierenUndKonstanteBestimmen2 ALL --- |
|
1104 *) |
|
1105 \<close> ML \<open> |
|
1106 (*+*)val o_model = [ |
|
1107 (1, [1], "#Given", @{term "equalities"}, |
|
1108 [@{term "[(0::real) = - 1 * c_4 / - 1]"}, |
|
1109 @{term "[(0::real) = (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) / - 24]"}, |
|
1110 @{term "[(0::real) = c_2]"}, |
|
1111 @{term "[(0::real) = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]"}] ), |
|
1112 (*Const ("List.list.Cons", "real \<Rightarrow> real list \<Rightarrow> real list") $ Free ("c", "real") $ Const ("List.list.Nil", "real list"),*) |
|
1113 (2, [1], "#Given", @{term "solveForVars"}, |
|
1114 [@{term "[c] ::real list"}, |
|
1115 @{term "[c_2]::real list"}, |
|
1116 @{term "[c_3]::real list"}, |
|
1117 @{term "[c_4]::real list"}] ), |
|
1118 (3, [1], "#Find", @{term "solution"}, [@{term "ss'''::bool list"}] )] |
|
1119 ; |
|
1120 val SOME ["normalise", "4x4", "LINEAR", "system"] = |
|
1121 refine_ori @{context} o_model ["LINEAR", "system"]; |
|
1122 \<close> ML \<open> |
|
1123 "~~~~~ fun refine_ori , args:"; val (ctxt, oris, pblID) = |
|
1124 (@{context}, o_model, ["LINEAR", "system"]); |
|
1125 |
|
1126 val opt as SOME ["system", "LINEAR", "4x4", "normalise"] |
|
1127 = app_ptyp (refin ctxt ((rev o tl) pblID) oris) pblID (rev pblID); |
|
1128 \<close> ML \<open> |
|
1129 (* |
|
1130 app_ptyp works strangely, parameter passing is awkward. |
|
1131 Present refin knows structure of Store.T, thus we bypass app_ptyp |
|
1132 *) |
|
1133 (*!*)val pblID = ["LINEAR", "system"];(**) |
|
1134 val return_refin as SOME ["system", "LINEAR", "LINEAR", "4x4", "normalise"] = (**) |
|
1135 refin ctxt (rev pblID) oris (Store.get_node (rev pblID) pblID (get_pbls ())); |
|
1136 \<close> ML \<open> |
|
1137 "~~~~~ fun refin , args:"; val (ctxt, pblRD, ori, (Store.Node (pI, [py], pys))) |
|
1138 = (ctxt, (rev pblID), oris, Store.get_node (rev pblID) pblID (get_pbls ())); |
|
1139 \<close> ML \<open> |
|
1140 val {where_rls, model, where_, ...} = py: Problem.T |
|
1141 val model = map (Model_Pattern.adapt_to_type ctxt) model |
|
1142 val where_ = map (ParseC.adapt_term_to_type ctxt) where_; |
|
1143 \<close> ML \<open> |
|
1144 (*if*) M_Match.match_oris ctxt where_rls ori (model, where_) (*then*); |
|
1145 \<close> ML \<open> |
|
1146 val return_refin as SOME ["system", "LINEAR"] = SOME (pblRD (** )@ [pI]( **)) |
|
1147 \<close> ML \<open> |
|
1148 (*follow the trace created in parallel by writeln in Store.get_node and Refine.refin*) |
|
1149 (*!*)val pblID = ["4x4", "LINEAR", "system"];(**) |
|
1150 val return_refin as SOME ["system", "LINEAR", "4x4", "4x4", "normalise"] = |
|
1151 refin ctxt (rev pblID) oris (Store.get_node (rev pblID) pblID (get_pbls ())); |
|
1152 \<close> ML \<open> |
|
1153 "~~~~~ fun refin , args:"; val (ctxt, pblRD, ori, (Store.Node (pI, [py], pys))) |
|
1154 = (ctxt, (rev pblID), oris, Store.get_node (rev pblID) pblID (get_pbls ())); |
|
1155 \<close> ML \<open> |
|
1156 val {where_rls, model, where_, ...} = py: Problem.T |
|
1157 val model = map (Model_Pattern.adapt_to_type ctxt) model |
|
1158 val where_ = map (ParseC.adapt_term_to_type ctxt) where_ |
|
1159 \<close> ML \<open> |
|
1160 (*+*)val (**)true(** )false( **) = (*if*) |
|
1161 M_Match.match_oris ctxt where_rls o_model (model, where_); |
|
1162 "~~~~~ fun match_oris , args:"; val (ctxt, where_rls, o_model, (model_pattern, where_)) = |
|
1163 (ctxt, where_rls, o_model, (model, where_)); |
|
1164 val i_model = (flat o (map (chk1_ model_pattern))) o_model; |
|
1165 |
|
1166 (*+*)val "[\n(1, [\"1\"], #Given, equalities, [\"[0 = - 1 * c_4 / - 1]\", \"[0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24]\", \"[0 = c_2]\", \"[0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]\"]), \n(2, [\"1\"], #Given, solveForVars, [\"[c]\", \"[c_2]\", \"[c_3]\", \"[c_4]\"]), \n(3, [\"1\"], #Find, solution, [\"ss'''\"])]" |
|
1167 = o_model |> O_Model.to_string @{context}; |
|
1168 (*+*)if "[\n" ^ |
|
1169 "(1 ,[1] ,true ,#Given ,Cor equalities\n [0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2] ,(e_s, [[0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]])), \n" ^ |
|
1170 "(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2, c_3, c_4] ,(v_s, [[c, c_2, c_3, c_4]])), \n" ^ |
|
1171 "(3 ,[1] ,true ,#Find ,Cor solution ss''' ,(ss''', [ss''']))]" |
|
1172 = (i_model |> I_Model.to_string @{context}) then () else raise error "i_model CAHNGED"; |
|
1173 \<close> ML \<open> |
|
1174 (*+*)val "[\"(#Given, (equalities, e_s))\", \"(#Given, (solveForVars, v_s))\", \"(#Find, (solution, ss'''))\"]" |
|
1175 = model_pattern |> Model_Pattern.to_string @{context} |
|
1176 (*+*)val "[Length e_s = 4, Length v_s = 4]" = where_ |> UnparseC.terms @{context} |
|
1177 |
|
1178 val mvat = I_Model.variables_TEST model_pattern (I_Model.OLD_to_TEST i_model) |
|
1179 val complete = chk1_mis mvat i_model model_pattern; |
|
1180 |
|
1181 val (pb as true, (** )_( **)where_'(**)) = |
|
1182 Pre_Conds.check_OLD ctxt where_rls where_ (model_pattern, I_Model.OLD_to_TEST i_model); |
|
1183 "~~~~~ fun check_OLD , args:"; val (ctxt, where_rls, pres, (model_patt, i_model)) = |
|
1184 (ctxt, where_rls, where_, (model_pattern, I_Model.OLD_to_TEST i_model)); |
|
1185 \<close> ML \<open> |
|
1186 (*+*)val [(true, xxx), (true, yyy)] = where_' |
|
1187 \<close> ML \<open> |
|
1188 (*+*)val "[Length\n [0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2] =\n4, Length [c, c_2, c_3, c_4] = 4]" |
|
1189 = where_' |> map #2 |> UnparseC.terms @{context} |
|
1190 |
|
1191 val (_, env_model, (env_subst, env_eval)) = |
|
1192 of_max_variant model_patt i_model; |
|
1193 "~~~~~ fun of_max_variant , args:"; val (model_patt, i_model) = (model_patt, i_model); |
|
1194 \<close> ML \<open> |
|
1195 val all_variants = |
|
1196 map (fn (_, variants, _, _, _) => variants) i_model |
|
1197 |> flat |
|
1198 |> distinct op = |
|
1199 val variants_separated = map (filter_variants' i_model) all_variants |
|
1200 val sums_corr = map (cnt_corrects) variants_separated |
|
1201 val sum_variant_s = arrange_args1 sums_corr (1, all_variants) |
|
1202 val (_, max_variant) = hd (*..crude decision, up to improvement *) |
|
1203 (sort (fn ((i, _), (j, _)) => int_ord (i, j)) sum_variant_s) |
|
1204 val i_model_max = |
|
1205 filter (fn (_, variants, _ , _ ,_) => member (op =) variants max_variant) i_model |
|
1206 val equal_descr_pairs = map (get_equal_descr i_model) model_patt |> flat |
|
1207 |
|
1208 val env_model = make_env_model equal_descr_pairs |
|
1209 val equal_givens = filter (fn ((m_field, _), _) => m_field = "#Given") equal_descr_pairs |
|
1210 \<close> ML \<open> |
|
1211 val subst_eval_list = |
|
1212 make_envs_preconds equal_givens; |
|
1213 \<close> ML \<open> |
|
1214 "~~~~~ fun make_envs_preconds , args:"; val (equal_givens) = (equal_givens); |
|
1215 \<close> ML \<open> |
|
1216 "~~~~~ fun xxx , args:"; val ((_, (_, id)), (_, _, _, _, (feedb, _))) = (nth 1 equal_givens); |
|
1217 \<close> ML \<open> |
|
1218 "~~~~~ fun discern_feedback , args:"; val (id, (Model_Def.Cor_TEST ((descr, ts), _))) = |
|
1219 (id, feedb); |
|
1220 \<close> ML \<open> |
|
1221 val return_discern_typ as [] = |
|
1222 discern_typ id (descr, ts); |
|
1223 \<close> ML \<open> |
|
1224 "~~~~~ fun discern_typ , args:"; val (id, (descr, ts)) = (id, (descr, ts)); |
|
1225 \<close> ML \<open> |
|
1226 (*+*)val "[[0 = - 1 * c_4 / - 1], [0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24], [0 = c_2], [0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]]" |
|
1227 = ts |> UnparseC.terms @{context} |
|
1228 \<close> ML \<open> |
|
1229 val ts = if Model_Pattern.is_list_descr descr |
|
1230 then if TermC.is_list (hd ts) |
|
1231 then ts |> map TermC.isalist2list |> flat |
|
1232 else ts |
|
1233 else ts |
|
1234 |
|
1235 (*+*)val "[0 = - 1 * c_4 / - 1, 0 =\n(- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n- 24, 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]" |
|
1236 = ts |> UnparseC.terms @{context}; |
|
1237 \<close> ML \<open> |
|
1238 (*if*) Model_Pattern.typ_of_element descr = HOLogic.boolT (*then*); |
|
1239 \<close> ML \<open> |
|
1240 (*+*)val false = all_lhs_atoms ts |
|
1241 (*-------------------- contine check_OLD -----------------------------------------------------*) |
|
1242 |
|
1243 val pres_subst = map (TermC.subst_atomic_all env_subst) where_; |
|
1244 \<close> ML \<open> |
|
1245 (*+*)if "[\"\n" ^ |
|
1246 "(e_s, [0 = - 1 * c_4 / - 1,\n 0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24,\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2])\", \"\n" ^ |
|
1247 "(v_s, [c, c_2, c_3, c_4])\", \"\n(ss''', ss''')\"]" |
|
1248 = (env_model |> Subst.to_string @{context}) then () else error "env_model CAHNGED"; |
|
1249 \<close> ML \<open> |
|
1250 (*+*)val "[]" = env_eval |> Subst.to_string @{context} (*GOON \<rightarrow> []*) |
|
1251 \<close> ML \<open> |
|
1252 val pres_subst_other = map (TermC.subst_atomic_all env_model) (map #2 pres_subst); |
|
1253 \<close> ML \<open> |
|
1254 val full_subst = if env_eval = [] then pres_subst_other |
|
1255 else map (TermC.subst_atomic_all env_eval) (map #2 pres_subst_other) |
|
1256 \<close> ML \<open> |
|
1257 val evals = map (eval ctxt where_rls) full_subst |
|
1258 \<close> ML \<open> |
|
1259 val return_check_OLD = (foldl and_ (true, map fst evals), pres_subst_other) |
|
1260 \<close> ML \<open> |
|
1261 val return_refin as SOME ["system", "LINEAR", "4x4"] = SOME (pblRD(** ) @ [pI]( **)) |
|
1262 \<close> ML \<open> |
|
1263 (*follow the trace created in parallel by writeln in Store.get_node and Refine.refin*) |
|
1264 (*!*)val pblID = ["normalise", "4x4", "LINEAR", "system"];(**) |
|
1265 val return_refin as SOME ["system", "LINEAR", "4x4", "normalise", "normalise"] = |
|
1266 refin ctxt (rev pblID) oris (Store.get_node (rev pblID) pblID (get_pbls ())); |
|
1267 \<close> ML \<open> |
|
1268 \<close> ML \<open> |
|
1269 \<close> ML \<open> |
|
1270 \<close> |
|
1271 |
|
1272 section \<open>===================================================================================\<close> |
|
1273 section \<open>=====isa2 -> me IntegrierenUndKonstanteBestimmen2 ALL ====================================\<close> |
|
1274 ML \<open> |
|
1275 open Sub_Problem |
|
1276 \<close> ML \<open> (*\<rightarrow> biegelinie-4.sml OR NEW biegelinie-5.sml *) |
|
1277 \<close> ML \<open>"----- me IntegrierenUndKonstanteBestimmen2 ALL ----------------------------------------"; |
|
1278 "----------- me IntegrierenUndKonstanteBestimmen2 ALL ----------------------------------------"; |
|
1279 "----------- me IntegrierenUndKonstanteBestimmen2 ALL ----------------------------------------"; |
|
1280 (* |
|
1281 This test is deeply nested (down into details of creating environments). |
|
1282 In order to make Sidekick show the structure add to each |
|
1283 * (*/...\*) and (*\.../*) |
|
1284 * a companion > ML < (*/...\*) and > ML < (*\.../*) |
|
1285 Note the wrong ^----^ delimiters. |
|
1286 *) |
|
1287 val fmz = ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y", |
|
1288 "Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", |
|
1289 (* |
|
1290 Now follow items for ALL SubProblems, |
|
1291 since ROOT MethodC must provide values for "actuals" of ALL SubProblems. |
|
1292 See Biegelinie.thy subsection \<open>Survey on Methods\<close>. |
|
1293 *) |
|
1294 (* |
|
1295 Items for MethodC "IntegrierenUndKonstanteBestimmen2" |
|
1296 *) |
|
1297 "FunktionsVariable x", |
|
1298 (*"Biegelinie y", ..already input for Problem above*) |
|
1299 "AbleitungBiegelinie dy", |
|
1300 "Biegemoment M_b", |
|
1301 "Querkraft Q", |
|
1302 (* |
|
1303 Item for Problem "LINEAR/system", which by [''no_met''] involves refinement |
|
1304 *) |
|
1305 "GleichungsVariablen [c, c_2, c_3, c_4]" |
|
1306 ]; |
|
1307 val (dI',pI',mI') = ("Biegelinie", ["Biegelinien"], |
|
1308 ["IntegrierenUndKonstanteBestimmen2"]); |
|
1309 val p = e_pos'; val c = []; |
|
1310 (*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; val Model_Problem = nxt |
|
1311 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Traegerlaenge L" = nxt |
|
1312 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Streckenlast q_0" = nxt |
|
1313 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "Biegelinie y" = nxt |
|
1314 (*/---broken elementwise input to lists---\* ) |
|
1315 (*[], 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*) |
|
1316 (*[], 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]"*) |
|
1317 ( *\---broken elementwise input to lists---/*) |
|
1318 (*[], 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 |
|
1319 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1320 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["Biegelinien"] = nxt |
|
1321 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["IntegrierenUndKonstanteBestimmen2"] = nxt |
|
1322 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "FunktionsVariable x" = nxt |
|
1323 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "AbleitungBiegelinie dy" = nxt |
|
1324 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Biegemoment M_b" = nxt |
|
1325 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Querkraft Q" = nxt |
|
1326 (*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "GleichungsVariablen [c, c_2, c_3, c_4]" = nxt |
|
1327 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["IntegrierenUndKonstanteBestimmen2"] = nxt |
|
1328 \<close> ML \<open> |
|
1329 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1330 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Streckenlast q_0" = nxt |
|
1331 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "FunktionsVariable x" = nxt |
|
1332 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "Funktionen funs'''" = nxt |
|
1333 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1334 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["vonBelastungZu", "Biegelinien"] = nxt |
|
1335 (*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["Biegelinien", "ausBelastung"] = nxt |
|
1336 (*[1], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Biegelinie y" = nxt |
|
1337 (*[1], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "AbleitungBiegelinie dy" = nxt |
|
1338 (*[1], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Biegemoment M_b" = nxt |
|
1339 (*[1], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Querkraft Q" = nxt |
|
1340 (*[1], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["Biegelinien", "ausBelastung"] = nxt |
|
1341 \<close> ML \<open> |
|
1342 (*[1, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite ("sym_neg_equal_iff_equal", _) = nxt |
|
1343 (*[1, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite ("Belastung_Querkraft", _) = nxt |
|
1344 (*[1, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["named", "integrate", "function"]) = nxt |
|
1345 (*[1, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1346 (*[1, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionTerm (- q_0)" = nxt |
|
1347 (*[1, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "integrateBy x" = nxt |
|
1348 (*[1, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "antiDerivativeName Q" = nxt |
|
1349 (*[1, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1350 (*[1, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["named", "integrate", "function"] = nxt |
|
1351 (*[1, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["diff", "integration", "named"] = nxt |
|
1352 (*[1, 3], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["diff", "integration", "named"] = nxt |
|
1353 \<close> ML \<open> |
|
1354 (*[1, 3, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set_Inst (["(''bdv'', x)"], "simplify_Integral") = nxt |
|
1355 (*[1, 3, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set_Inst (["(''bdv'', x)"], "integration") = nxt |
|
1356 (*[1, 3, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["named", "integrate", "function"] = nxt |
|
1357 \<close> ML \<open> |
|
1358 (*[1, 3], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite ("Querkraft_Moment", _) = nxt |
|
1359 (*[1, 4], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["named", "integrate", "function"]) = nxt |
|
1360 (*[1, 5], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1361 (*[1, 5], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionTerm (c + - 1 * q_0 * x)" = nxt |
|
1362 (*[1, 5], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "integrateBy x" = nxt |
|
1363 (*[1, 5], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "antiDerivativeName M_b" = nxt |
|
1364 (*[1, 5], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1365 (*[1, 5], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["named", "integrate", "function"] = nxt |
|
1366 (*[1, 5], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["diff", "integration", "named"] = nxt |
|
1367 (*[1, 5], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["diff", "integration", "named"] = nxt |
|
1368 \<close> ML \<open> |
|
1369 (*[1, 5, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set_Inst (["(''bdv'', x)"], "integration") = nxt |
|
1370 (*[1, 5, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["named", "integrate", "function"] = nxt |
|
1371 \<close> ML \<open> |
|
1372 (*[1, 5], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite ("Moment_Neigung", _) = nxt |
|
1373 (*[1, 6], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite ("make_fun_explicit", _) = nxt |
|
1374 (*[1, 7], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["named", "integrate", "function"]) = nxt |
|
1375 (*[1, 8], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1376 (*[1, 8], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionTerm (1 / - EI * (c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2))" = nxt |
|
1377 (*[1, 8], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "integrateBy x" = nxt |
|
1378 (*[1, 8], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "antiDerivativeName dy" = nxt |
|
1379 (*[1, 8], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1380 (*[1, 8], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["named", "integrate", "function"] = nxt |
|
1381 (*[1, 8], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["diff", "integration", "named"] = nxt |
|
1382 (*[1, 8], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["diff", "integration", "named"] = nxt |
|
1383 \<close> ML \<open> |
|
1384 (*[1, 8, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set_Inst (["(''bdv'', x)"], "simplify_Integral") = nxt |
|
1385 (*[1, 8, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set_Inst (["(''bdv'', x)"], "integration") = nxt |
|
1386 (*[1, 8, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["named", "integrate", "function"] = nxt |
|
1387 \<close> ML \<open> |
|
1388 (*[1, 8], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["named", "integrate", "function"]) = nxt |
|
1389 (*[1, 9], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1390 (*[1, 9], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionTerm\n (c_3 +\n 1 / (- 1 * EI) *\n (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3))" = nxt |
|
1391 (*[1, 9], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "integrateBy x" = nxt |
|
1392 (*[1, 9], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "antiDerivativeName y" = nxt |
|
1393 (*[1, 9], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1394 (*[1, 9], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["named", "integrate", "function"] = nxt |
|
1395 (*[1, 9], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["diff", "integration", "named"] = nxt |
|
1396 (*[1, 9], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["diff", "integration", "named"] = nxt |
|
1397 \<close> ML \<open> |
|
1398 (*[1, 9, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set_Inst (["(''bdv'', x)"], "integration") = nxt |
|
1399 (*[1, 9, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["named", "integrate", "function"] = nxt |
|
1400 (*[1, 9], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["vonBelastungZu", "Biegelinien"] = nxt |
|
1401 (*[1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["setzeRandbedingungen", "Biegelinien"]) = nxt |
|
1402 \<close> ML \<open> |
|
1403 (*[2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1404 (*[2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Funktionen\n [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 +\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 |
|
1405 (*/---broken elementwise input to lists---\* ) |
|
1406 (*[2], 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*) |
|
1407 (*[2], 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]"*) |
|
1408 ( *\---broken elementwise input to lists---/*) |
|
1409 (*[2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]" = nxt |
|
1410 (*[2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "Gleichungen equs'''" = nxt |
|
1411 (*[2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1412 (*[2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["setzeRandbedingungen", "Biegelinien"] = nxt |
|
1413 (*[2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["Biegelinien", "setzeRandbedingungenEin"] = nxt |
|
1414 (*[2], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["Biegelinien", "setzeRandbedingungenEin"] = nxt |
|
1415 \<close> ML \<open> |
|
1416 (*[2, 1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1417 (*[2, 1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionEq\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 |
|
1418 (*[2, 1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "substitution (y 0 = 0)" = nxt |
|
1419 (*[2, 1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "equality equ'''" = nxt |
|
1420 (*[2, 1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1421 (*[2, 1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["makeFunctionTo", "equation"] = nxt |
|
1422 (*[2, 1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["Equation", "fromFunction"] = nxt |
|
1423 (*[2, 1], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["Equation", "fromFunction"] = nxt |
|
1424 \<close> ML \<open> |
|
1425 (*[2, 1, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["x = 0"] = nxt |
|
1426 (*[2, 1, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["y 0 = 0"] = nxt |
|
1427 (*[2, 1, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set "norm_Rational" = nxt |
|
1428 (*[2, 1, 3], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["makeFunctionTo", "equation"] = nxt |
|
1429 \<close> ML \<open> |
|
1430 (*[2, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["makeFunctionTo", "equation"]) = nxt |
|
1431 (*[2, 2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1432 (*[2, 2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionEq\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 |
|
1433 (*[2, 2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "substitution (y L = 0)" = nxt |
|
1434 (*[2, 2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "equality equ'''" = nxt |
|
1435 (*[2, 2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1436 (*[2, 2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["makeFunctionTo", "equation"] = nxt |
|
1437 (*[2, 2], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["Equation", "fromFunction"] = nxt |
|
1438 (*[2, 2], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["Equation", "fromFunction"] = nxt |
|
1439 \<close> ML \<open> |
|
1440 (*[2, 2, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["x = L"] = nxt |
|
1441 (*[2, 2, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["y L = 0"] = nxt |
|
1442 (*[2, 2, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set "norm_Rational" = nxt |
|
1443 (*[2, 2, 3], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["makeFunctionTo", "equation"] = nxt |
|
1444 \<close> ML \<open> |
|
1445 (*[2, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["makeFunctionTo", "equation"]) = nxt |
|
1446 (*[2, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1447 (*[2, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionEq (M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2)" = nxt |
|
1448 (*[2, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "substitution (M_b 0 = 0)" = nxt |
|
1449 (*[2, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "equality equ'''" = nxt |
|
1450 (*[2, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1451 (*[2, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["makeFunctionTo", "equation"] = nxt |
|
1452 (*[2, 3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["Equation", "fromFunction"] = nxt |
|
1453 (*[2, 3], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["Equation", "fromFunction"] = nxt |
|
1454 \<close> ML \<open> |
|
1455 (*[2, 3, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["x = 0"] = nxt |
|
1456 (*[2, 3, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["M_b 0 = 0"] = nxt |
|
1457 (*[2, 3, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set "norm_Rational" = nxt |
|
1458 (*[2, 3, 3], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["makeFunctionTo", "equation"] = nxt |
|
1459 \<close> ML \<open> |
|
1460 (*[2, 3], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Subproblem ("Biegelinie", ["makeFunctionTo", "equation"]) = nxt |
|
1461 (*[2, 4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Model_Problem = nxt |
|
1462 (*[2, 4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "functionEq (M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2)" = nxt |
|
1463 (*[2, 4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "substitution (M_b L = 0)" = nxt |
|
1464 (*[2, 4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "equality equ'''" = nxt |
|
1465 (*[2, 4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Theory "Biegelinie" = nxt |
|
1466 (*[2, 4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Problem ["makeFunctionTo", "equation"] = nxt |
|
1467 (*[2, 4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Specify_Method ["Equation", "fromFunction"] = nxt |
|
1468 (*[2, 4], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method ["Equation", "fromFunction"] = nxt |
|
1469 \<close> ML \<open> |
|
1470 (*[2, 4, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["x = L"] = nxt |
|
1471 (*[2, 4, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Substitute ["M_b L = 0"] = nxt |
|
1472 (*[2, 4, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Rewrite_Set "norm_Rational" = nxt |
|
1473 (*[2, 4, 3], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["makeFunctionTo", "equation"] = nxt |
|
1474 (*[2, 4], Res*)val (p,_,f,nxt,_,pt) = me nxt p c pt; val Check_Postcond ["setzeRandbedingungen", "Biegelinien"] = nxt |
|
1475 |
|
1476 \<close> ML \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1477 (*[2], Res*)val return_Check_Postcond_setzeRandbedingungen = me nxt p c pt; |
|
1478 \<close> ML \<open> (*/------------ step into me_Check_Postcond_setzeRandbedingungen --------------------\\*) |
|
1479 (*/------------------- step into me_Check_Postcond_setzeRandbedingungen --------------------\\*) |
|
1480 "~~~~~ fun me , args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, c, pt); |
|
1481 \<close> ML \<open> |
|
1482 val ctxt = Ctree.get_ctxt pt p |
|
1483 \<close> ML \<open> |
|
1484 val (pt, p) = |
|
1485 case Step.by_tactic tac (pt, p) of |
|
1486 ("ok", (_, _, ptp)) => ptp |
|
1487 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1488 (*case*) |
|
1489 Step.do_next p ((pt, Pos.e_pos'), []) (*of*); |
|
1490 \<close> ML \<open> |
|
1491 "~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = (p, ((pt, Pos.e_pos'), [])); |
|
1492 \<close> ML \<open> |
|
1493 (*if*) Pos.on_calc_end ip (*else*); |
|
1494 val (_, probl_id, _) = Calc.references (pt, p); |
|
1495 \<close> ML \<open> |
|
1496 val _ = |
|
1497 (*case*) tacis (*of*); |
|
1498 \<close> ML \<open> |
|
1499 (*if*) probl_id = Problem.id_empty (*else*); |
|
1500 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1501 switch_specify_solve p_ (pt, ip); |
|
1502 \<close> ML \<open> |
|
1503 "~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip)); |
|
1504 \<close> ML \<open> |
|
1505 (*if*) Pos.on_specification ([], state_pos) (*else*); |
|
1506 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1507 LI.do_next (pt, input_pos) |
|
1508 \<close> ML \<open> |
|
1509 "~~~~~ and do_next , args:"; val (ptp as (pt, pos as (p, p_))) = (pt, input_pos); |
|
1510 \<close> ML \<open> |
|
1511 (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p) (*else*); |
|
1512 \<close> ML \<open> |
|
1513 val ((ist, ctxt), sc) = LItool.resume_prog pos pt; |
|
1514 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1515 val Next_Step (Pstate _, _, Subproblem' _) = |
|
1516 (*case*) find_next_step sc ptp ist ctxt (*of*); |
|
1517 \<close> ML \<open> |
|
1518 "~~~~~ fun find_next_step , args:"; val ((Rule.Prog prog), (ptp as (pt, pos as (p, _))), (Pstate ist), ctxt) |
|
1519 = (sc, ptp, ist, ctxt); |
|
1520 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1521 val Accept_Tac (Subproblem' _, _, _) = |
|
1522 (*case*) scan_to_tactic (prog, (ptp, ctxt)) (Pstate ist) (*of*); |
|
1523 \<close> ML \<open> |
|
1524 "~~~~~ fun scan_to_tactic , args:"; val ((prog, cc), (Pstate (ist as {path, ...}))) |
|
1525 = ((prog, (ptp, ctxt)), (Pstate ist)); |
|
1526 \<close> ML \<open> |
|
1527 (*if*) path = [] (*else*); |
|
1528 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1529 val Accept_Tac (Subproblem' _, _, _) = |
|
1530 go_scan_up (prog, cc) (trans_scan_up ist); |
|
1531 \<close> ML \<open> |
|
1532 "~~~~~ fun go_scan_up , args:"; val ((pcc as (sc, (_, ctxt))), (ist as {path, act_arg, found_accept, ...})) |
|
1533 = ((prog, cc), (trans_scan_up ist)); |
|
1534 \<close> ML \<open> |
|
1535 (*if*) path = [R] (*root of the program body*) (*else*); |
|
1536 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1537 scan_up pcc (ist |> path_up) (go_up ctxt path sc) |
|
1538 \<close> ML \<open> |
|
1539 "~~~~~ and scan_up , args:"; val ((pcc as (sc, cc as (_, ctxt))), ist, (Const (\<^const_name>\<open>Let\<close>(*1*), _) $ _)) |
|
1540 = (pcc, (ist |> path_up), (go_up ctxt path sc)); |
|
1541 \<close> ML \<open> |
|
1542 val (i, body) = check_Let_up ctxt ist sc |
|
1543 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1544 val Accept_Tac (Subproblem' _, _, _) = |
|
1545 (*case*) scan_dn cc (ist |> path_up_down [R, D] |> upd_env i) body (*of*); |
|
1546 \<close> ML \<open> |
|
1547 "~~~~~ fun scan_dn , args:"; val (cc, ist, (Const (\<^const_name>\<open>Let\<close>(*1*), _) $ e $ (Abs (i, T, b)))) |
|
1548 = (cc, (ist |> path_up_down [R, D] |> upd_env i), body); |
|
1549 \<close> text \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1550 val Accept_Tac (Subproblem' _, _, _) = |
|
1551 (*case*) scan_dn cc (ist |> path_down [L, R]) e (*of*); |
|
1552 \<close> ML \<open> |
|
1553 "~~~~~ fun scan_dn , args:"; val ((cc as (_, ctxt)), (ist as {eval, ...}), t (*fall-through*)) |
|
1554 = (cc, (ist |> path_down [L, R]), e); |
|
1555 \<close> ML \<open> |
|
1556 (*if*) Tactical.contained_in t (*else*); |
|
1557 \<close> ML \<open> (*ERROR during repair Biegelinie*) |
|
1558 val (Program.Tac prog_tac, form_arg) = |
|
1559 (*case*) LItool.check_leaf "next " ctxt eval (get_subst ist) t (*of*); |
|
1560 \<close> ML \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1561 check_tac cc ist (prog_tac, form_arg); |
|
1562 \<close> ML \<open> |
|
1563 "~~~~~ fun check_tac , args:"; val (((pt, p), ctxt), ist, (prog_tac, form_arg)) |
|
1564 = (cc, ist, (prog_tac, form_arg)); |
|
1565 \<close> ML \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1566 val Subproblem ("Biegelinie", ["normalise", "4x4", "LINEAR", "system"]) = |
|
1567 LItool.tac_from_prog (pt, p) prog_tac; |
|
1568 \<close> ML \<open> |
|
1569 "~~~~~ fun tac_from_prog , args:"; val ((pt, pos), intac) |
|
1570 = ((pt, p), prog_tac); |
|
1571 \<close> ML \<open> |
|
1572 val pos = Pos.back_from_new pos |
|
1573 val ctxt = Ctree.get_ctxt pt pos |
|
1574 val thy = Proof_Context.theory_of ctxt |
|
1575 \<close> ML \<open> (*ERROR during repair Biegelinie*) |
|
1576 val (ptac as Const (\<^const_name>\<open>Prog_Tac.SubProblem\<close>, _) $ _ $ _) = |
|
1577 (*case*) intac (*of*) |
|
1578 \<close> ML \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1579 val Subproblem ("Biegelinie", ["normalise", "4x4", "LINEAR", "system"]) = |
|
1580 fst (Sub_Problem.tac_from_prog (pt, pos) ptac) (*might involve problem refinement etc*) |
|
1581 \<close> ML \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1582 val (Subproblem _, Subproblem' _) = |
|
1583 Sub_Problem.tac_from_prog (pt, pos) ptac; |
|
1584 \<close> ML \<open> |
|
1585 "~~~~~ fun tac_from_prog , args:"; val ((pt, p), (stac as Const (\<^const_name>\<open>Prog_Tac.SubProblem\<close>, _) $ spec' $ ags')) |
|
1586 = ((pt, pos), ptac); |
|
1587 \<close> ML \<open> (*ERROR during repair Biegelinie*) |
|
1588 val (dI, pI, mI) = Prog_Tac.dest_spec spec' |
|
1589 (*+*)val ("Biegelinie", ["LINEAR", "system"], ["no_met"]) = Prog_Tac.dest_spec spec' |
|
1590 |
|
1591 val thy = common_sub_thy (Know_Store.get_via_last_thy dI, Ctree.root_thy pt); |
|
1592 val init_ctxt = Proof_Context.init_global thy |
|
1593 val ags = TermC.isalist2list ags'; |
|
1594 \<close> ML \<open> (*ERROR during repair Biegelinie*) |
|
1595 (*if*) mI = ["no_met"] (*then*); |
|
1596 val pors = (M_Match.arguments thy ((#model o (Problem.from_store init_ctxt)) pI) ags): O_Model.T |
|
1597 \<close> ML \<open> (*ERROR during repair Biegelinie*) |
|
1598 (*+*)if (pors |> O_Model.to_string @{context}) = "[\n" ^ |
|
1599 "(1, [\"1\"], #Given, equalities, [\"[0 = - 1 * c_4 / - 1]\", " ^ |
|
1600 "\"[0 =\n (- 24 * c_4 + - 24 * L * c_3 + 12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c +\n - 1 * L \<up> 4 * q_0) /\n - 24]\", " ^ |
|
1601 "\"[0 = c_2]\", " ^ |
|
1602 "\"[0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]" ^ |
|
1603 "\"]), \n" ^ |
|
1604 "(2, [\"1\"], #Given, solveForVars, [\"[c]\", \"[c_2]\", \"[c_3]\", \"[c_4]\"]), \n" ^ |
|
1605 "(3, [\"1\"], #Find, solution, [\"ss'''\"])]" then () else error "pors CHANGED"; |
|
1606 \<close> ML \<open> (*ERROR during repair Biegelinie*) |
|
1607 val pI' = Refine.refine_ori' init_ctxt pors pI; |
|
1608 \<close> ML \<open> |
|
1609 (*+*)val ["normalise", "4x4", "LINEAR", "system"] = pI'; |
|
1610 \<close> ML \<open> (*ERROR exception Empty raised (line 47 of "./basis/List.sml")*) |
|
1611 val return_tac_from_prog_step = (pI', pors (* refinement over models with diff.precond only *), |
|
1612 (hd o #solve_mets o Problem.from_store init_ctxt) pI'); |
|
1613 \<close> ML \<open> |
|
1614 (Problem.from_store init_ctxt) pI'; (*.., solve_mets = [], ...*) |
|
1615 \<close> ML \<open> |
|
1616 val [["EqSystem", "normalise", "4x4"]] = |
|
1617 (#solve_mets o Problem.from_store init_ctxt) pI'; |
|
1618 \<close> ML \<open> |
|
1619 \<close> ML \<open> |
|
1620 \<close> ML \<open> |
|
1621 \<close> ML \<open> (*|------------ contine me_Check_Postcond_setzeRandbedingungen ------------------------*) |
|
1622 (*|------------------- contine me_Check_Postcond_setzeRandbedingungen ------------------------*) |
|
1623 (*\------------------- step into me_Check_Postcond_setzeRandbedingungen --------------------//*) |
|
1624 \<close> ML \<open> (*\------------ step into me_Check_Postcond_setzeRandbedingungen --------------------//*) |
|
1625 \<close> ML \<open> |
|
1626 val (p,_,f,nxt,_,pt) = return_Check_Postcond_setzeRandbedingungen; |
|
1627 \<close> ML \<open> |
|
1628 \<close> ML \<open> |
|
1629 \<close> ML \<open> |
|
1630 \<close> ML \<open> |
|
1631 \<close> |
|
1632 |
|
1633 section \<open>===================================================================================\<close> |
|
1634 section \<open>===== ============================================================================\<close> |
|
1635 ML \<open> |
|
1636 \<close> ML \<open> |
|
1637 \<close> ML \<open> |
|
1638 \<close> ML \<open> |
|
1639 \<close> |
|
1640 |
|
1641 section \<open>code for copy & paste ===============================================================\<close> |
|
1642 ML \<open> |
|
1643 "~~~~~ fun xxx , args:"; val () = (); |
|
1644 "~~~~~ and xxx , args:"; val () = (); |
|
1645 "~~~~~ from fun xxx \<longrightarrow>fun yyy \<longrightarrow>fun zzz , return:"; val () = (); |
|
1646 "~~~~~ continue fun xxx"; val () = (); |
|
1647 (*if*) (*then*); (*else*); (*case*) (*of*); (*return value*); (*in*) (*end*); |
|
1648 "xx" |
|
1649 ^ "xxx" (*+*) (*+++*) (*keep for continuing YYYYY*) (*isa*) (*isa2*) (**) |
|
1650 \<close> ML \<open> (*//----------- adhoc inserted n ----------------------------------------------------\\*) |
|
1651 (*//----------------- adhoc inserted n ----------------------------------------------------\\*) |
|
1652 (*\\------------------ adhoc inserted n ----------------------------------------------------//*) |
|
1653 \<close> ML \<open> (*\\----------- adhoc inserted n ----------------------------------------------------//*) |
|
1654 |
|
1655 \<close> ML \<open> (*//----------- step into XXXXX -----------------------------------------------------\\*) |
|
1656 (*//------------------ step into XXXXX -----------------------------------------------------\\*) |
|
1657 (*keep for continuing YYYYY*) |
|
1658 \<close> ML \<open> (*------------- continuing XXXXX ------------------------------------------------------*) |
|
1659 (*-------------------- continuing XXXXX ------------------------------------------------------*) |
|
1660 (*kept for continuing XXXXX*) |
|
1661 (*-------------------- stop step into XXXXX --------------------------------------------------*) |
|
1662 \<close> ML \<open> (*------------- stop step into XXXXX --------------------------------------------------*) |
|
1663 (*\\------------------ step into XXXXX -----------------------------------------------------//*) |
|
1664 \<close> ML \<open> (*\\----------- step into XXXXX -----------------------------------------------------//*) |
|
1665 |
|
1666 (*/------------------- check entry to XXXXX -------------------------------------------------\*) |
|
1667 (*\------------------- check entry to XXXXX -------------------------------------------------/*) |
|
1668 (*/------------------- check within XXXXX ---------------------------------------------------\*) |
|
1669 (*\------------------- check within XXXXX ---------------------------------------------------/*) |
|
1670 (*/------------------- check result of XXXXX ------------------------------------------------\*) |
|
1671 (*\------------------- check result of XXXXX ------------------------------------------------/*) |
|
1672 (* final test ... ----------------------------------------------------------------------------*) |
|
1673 |
|
1674 \<close> ML \<open> (*//----------- inserted hidden code ------------------------------------------------\\*) |
|
1675 (*//------------------ inserted hidden code ------------------------------------------------\\*) |
|
1676 (*\\------------------ inserted hidden code ------------------------------------------------//*) |
|
1677 \<close> ML \<open> (*\\----------- inserted hidden code ------------------------------------------------//*) |
|
1678 |
|
1679 \<close> ML \<open> (*//----------- build new fun XXXXX -------------------------------------------------\\*) |
|
1680 (*//------------------ build new fun XXXXX -------------------------------------------------\\*) |
|
1681 (*\\------------------ build new fun XXXXX -------------------------------------------------//*) |
|
1682 \<close> ML \<open> (*\\----------- build new fun XXXXX -------------------------------------------------//*) |
|
1683 \<close> ML \<open> |
|
1684 \<close> |
|
1685 end |
79 end |