test/Tools/isac/Knowledge/biegelinie-1.sml
author Walther Neuper <walther.neuper@jku.at>
Thu, 09 Apr 2020 17:13:17 +0200
changeset 59861 65ec9f679c3f
parent 59854 c20d08e01ad2
child 59868 d77aa0992e0f
permissions -rw-r--r--
separate struct. UnparseC, shift code to ThmC
walther@59627
     1
(* Title:  Knowledge/biegelinie-1.sml
walther@59627
     2
   Author: Walther Neuper 050826
wneuper@59372
     3
   (c) due to copyright terms
wneuper@59372
     4
*)
wneuper@59372
     5
"-----------------------------------------------------------------";
wneuper@59372
     6
"table of contents -----------------------------------------------";
wneuper@59372
     7
"-----------------------------------------------------------------";
walther@59627
     8
"------ biegelinie-1.sml -----------------------------------------";
walther@59627
     9
"----------- the rules -------------------------------------------";
walther@59627
    10
"----------- simplify_leaf for this script -----------------------";
walther@59627
    11
"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
walther@59627
    12
"----------- investigate normalforms in biegelinien --------------";
walther@59627
    13
"-----------------------------------------------------------------";
walther@59627
    14
"------ biegelinie-2.sml -----------------------------------------";
walther@59627
    15
"----------- auto SubProblem (_,[vonBelastungZu,Biegelinien] -----";
walther@59627
    16
"----------- me SubProblem (_,[vonBelastungZu,Biegelinien] -------";
walther@59627
    17
"-----------------------------------------------------------------";
walther@59627
    18
"------ biegelinie-3.sml -----------------------------------------";
walther@59627
    19
"----------- auto method [Biegelinien,setzeRandbedingungenEin]--------------------------------";
walther@59627
    20
"----------- me method [Biegelinien,setzeRandbedingungenEin]----------------------------------";
walther@59627
    21
"-----------------------------------------------------------------";
walther@59627
    22
"------ biegelinie-4.sml -----------------------------------------";
walther@59627
    23
"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. auto TODO investigate failure ------";
walther@59627
    24
"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. me -----";
wneuper@59372
    25
"-----------------------------------------------------------------";
wneuper@59372
    26
"-----------------------------------------------------------------";
wneuper@59372
    27
"-----------------------------------------------------------------";
wneuper@59372
    28
wneuper@59372
    29
val thy = @{theory "Biegelinie"};
walther@59854
    30
val ctxt = ThyC.thy2ctxt' "Biegelinie";
wneuper@59372
    31
fun str2term str = (Thm.term_of o the o (parse thy)) str;
walther@59861
    32
fun term2s t = UnparseC.term_to_string'' "Biegelinie" t;
walther@59852
    33
fun rewrit thm str = fst (the (rewrite_ thy tless_true Rule_Set.empty true thm str));
wneuper@59372
    34
wneuper@59372
    35
"----------- the rules -------------------------------------------";
wneuper@59372
    36
"----------- the rules -------------------------------------------";
wneuper@59372
    37
"----------- the rules -------------------------------------------";
wneuper@59372
    38
val t = rewrit @{thm Belastung_Querkraft} (str2term "- qq x = - q_0"); term2s t;
wneuper@59372
    39
if term2s t = "Q' x = - q_0" then ()
wneuper@59372
    40
else error  "/biegelinie.sml: Belastung_Querkraft";
wneuper@59372
    41
wneuper@59372
    42
val t = rewrit @{thm Querkraft_Moment} (str2term "Q x = - q_0 * x + c"); term2s t;
wneuper@59372
    43
if term2s t = "M_b' x = - q_0 * x + c" then ()
wneuper@59372
    44
else error  "/biegelinie.sml: Querkraft_Moment";
wneuper@59372
    45
wneuper@59372
    46
val t = rewrit @{thm Moment_Neigung} (str2term "M_b x = -q_0 * x^^^2/2 + q_0/2 *L*x");
wneuper@59372
    47
    term2s t;
wneuper@59372
    48
if term2s t = "- EI * y'' x = - q_0 * x ^^^ 2 / 2 + q_0 / 2 * L * x" then ()
wneuper@59372
    49
else error  "biegelinie.sml: Moment_Neigung";
wneuper@59372
    50
wneuper@59372
    51
"----------- simplify_leaf for this script -----------------------";
wneuper@59372
    52
"----------- simplify_leaf for this script -----------------------";
wneuper@59372
    53
"----------- simplify_leaf for this script -----------------------";
walther@59851
    54
val srls = Rule_Set.Repeat {id="srls_IntegrierenUnd..", 
wneuper@59372
    55
		preconds = [], 
wneuper@59372
    56
		rew_ord = ("termlessI",termlessI), 
walther@59852
    57
		erls = Rule_Set.append_rules "erls_in_srls_IntegrierenUnd.." Rule_Set.empty
wneuper@59372
    58
				  [(*for asm in NTH_CONS ...*)
walther@59773
    59
				   Num_Calc ("Orderings.ord_class.less",eval_equ "#less_"),
wneuper@59372
    60
				   (*2nd NTH_CONS pushes n+-1 into asms*)
walther@59773
    61
				   Num_Calc("Groups.plus_class.plus", eval_binop "#add_")
wneuper@59372
    62
				   ], 
walther@59851
    63
		srls = Rule_Set.Empty, calc = [], errpatts = [],
wneuper@59372
    64
		rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
walther@59773
    65
			 Num_Calc("Groups.plus_class.plus", eval_binop "#add_"),
wneuper@59372
    66
			 Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
walther@59773
    67
			 Num_Calc("Prog_Expr.lhs", eval_lhs "eval_lhs_"),
walther@59773
    68
			 Num_Calc("Prog_Expr.rhs", eval_rhs "eval_rhs_"),
walther@59773
    69
			 Num_Calc("Prog_Expr.argument'_in", eval_argument_in "Prog_Expr.argument'_in")
wneuper@59372
    70
			 ],
wneuper@59372
    71
		scr = EmptyScr};
wneuper@59372
    72
val rm_ = str2term"[M_b 0 = 0, M_b L = 0]";
wneuper@59372
    73
val M__ = str2term"M_b x = -1 * x ^^^ 2 / 2 + x * c + c_2";
wneuper@59372
    74
val SOME (e1__,_) = rewrite_set_ thy false srls 
wneuper@59372
    75
  (str2term "(NTH::[real,bool list]=>bool) 1 " $ rm_);
walther@59861
    76
if UnparseC.term2str e1__ = "M_b 0 = 0" then () else error "biegelinie.sml simplify NTH 1 rm_";
wneuper@59372
    77
wneuper@59372
    78
val SOME (x1__,_) = 
wneuper@59372
    79
    rewrite_set_ thy false srls 
wneuper@59372
    80
		 (str2term"argument_in (lhs (M_b 0 = 0))");
walther@59861
    81
if UnparseC.term2str x1__ = "0" then ()
wneuper@59372
    82
else error "biegelinie.sml simplify argument_in (lhs (M_b 0 = 0)";
wneuper@59372
    83
wneuper@59372
    84
(*trace_rewrite := true; ..stopped Test_Isac.thy*)
wneuper@59372
    85
trace_rewrite:=false;
wneuper@59372
    86
wneuper@59372
    87
"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
wneuper@59372
    88
"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
wneuper@59372
    89
"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
wneuper@59372
    90
val fmz = ["functionEq (M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2)", 
wneuper@59372
    91
	   "substitution (M_b L = 0)", 
wneuper@59372
    92
	   "equality equ_equ"];
wneuper@59372
    93
val (dI',pI',mI') = ("Biegelinie", ["makeFunctionTo","equation"],
wneuper@59372
    94
		     ["Equation","fromFunction"]);
wneuper@59372
    95
val p = e_pos'; val c = [];
wneuper@59372
    96
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
wneuper@59372
    97
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
wneuper@59372
    98
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
wneuper@59372
    99
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
wneuper@59372
   100
val (p,_,f,nxt,_,pt) = me nxt p c pt;
wneuper@59372
   101
wneuper@59372
   102
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = 
wneuper@59372
   103
			"M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
wneuper@59372
   104
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = 
wneuper@59372
   105
                        "M_b L = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
wneuper@59372
   106
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = 
wneuper@59372
   107
			"0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
wneuper@59372
   108
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
wneuper@59372
   109
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
wneuper@59372
   110
if (* f2str f = "0 = c_2 + L * c + -1 * q_0 / 2 * L ^^^ 2" CHANGE NOT considered, already on leave*)
wneuper@59372
   111
   f2str f = "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2"
walther@59749
   112
then case nxt of End_Proof' => ()
wneuper@59372
   113
  | _ => error "biegelinie.sml: SubProblem (_,[setzeRandbed 1"
walther@59620
   114
else error "biegelinie.sml: SubProblem (_,[setzeRandbed 2";
walther@59620
   115
walther@59620
   116
"----------- investigate normalforms in biegelinien --------------";
walther@59620
   117
"----------- investigate normalforms in biegelinien --------------";
walther@59620
   118
"----------- investigate normalforms in biegelinien --------------";
walther@59620
   119
"----- coming from integration, kept for later improvements:";
walther@59620
   120
val Q = str2term "Q x = c + -1 * q_0 * x";
walther@59620
   121
val M_b = str2term "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
walther@59620
   122
val y' = str2term "y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
walther@59620
   123
val y = str2term "y x = c_4 + c_3 * x +\n1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
walther@59620
   124
(*^^^  1 / (-1 * EI) NOT distributed - ok! ^^^^^^^^^^^^^^^^^^^^^^^*)