src/Tools/isac/Knowledge/Biegelinie.thy
author Walther Neuper <wneuper@ist.tugraz.at>
Wed, 29 May 2019 10:36:16 +0200
changeset 59545 4035ec339062
parent 59544 dbe1a10234df
child 59549 e0e3d41ef86c
permissions -rw-r--r--
[-Test_Isac] funpack: switch from Script to partial_function
neuper@37906
     1
(* chapter 'Biegelinie' from the textbook: 
neuper@37906
     2
   Timischl, Kaiser. Ingenieur-Mathematik 3. Wien 1999. p.268-271.
neuper@37999
     3
   author: Walther Neuper 050826,
neuper@37906
     4
   (c) due to copyright terms
neuper@37906
     5
*)
neuper@37906
     6
wneuper@59424
     7
theory Biegelinie imports Integrate Equation EqSystem Base_Tools begin
neuper@37906
     8
neuper@37906
     9
consts
neuper@37906
    10
neuper@42385
    11
  qq    :: "real => real"             (* Streckenlast               *)
neuper@37999
    12
  Q     :: "real => real"             (* Querkraft                  *)
neuper@37999
    13
  Q'    :: "real => real"             (* Ableitung der Querkraft    *)
neuper@37999
    14
  M'_b  :: "real => real" ("M'_b")    (* Biegemoment                *)
neuper@37999
    15
  M'_b' :: "real => real" ("M'_b'")   (* Ableitung des Biegemoments *)
neuper@37999
    16
  y''   :: "real => real"             (* 2.Ableitung der Biegeline  *)
neuper@37999
    17
  y'    :: "real => real"             (* Neigung der Biegeline      *)
neuper@37999
    18
(*y     :: "real => real"             (* Biegeline                  *)*)
neuper@37999
    19
  EI    :: "real"                     (* Biegesteifigkeit           *)
neuper@37906
    20
neuper@37906
    21
  (*new Descriptions in the related problems*)
neuper@37999
    22
  Traegerlaenge            :: "real => una"
neuper@37999
    23
  Streckenlast             :: "real => una"
neuper@37999
    24
  BiegemomentVerlauf       :: "bool => una"
neuper@37999
    25
  Biegelinie               :: "(real => real) => una"
wneuper@59540
    26
  AbleitungBiegelinie      :: "(real => real) => una"
neuper@37999
    27
  Randbedingungen          :: "bool list => una"
neuper@37999
    28
  RandbedingungenBiegung   :: "bool list => una"
neuper@37999
    29
  RandbedingungenNeigung   :: "bool list => una"
neuper@37999
    30
  RandbedingungenMoment    :: "bool list => una"
neuper@37999
    31
  RandbedingungenQuerkraft :: "bool list => una"
neuper@37999
    32
  FunktionsVariable        :: "real => una"
neuper@37999
    33
  Funktionen               :: "bool list => una"
neuper@37999
    34
  Gleichungen              :: "bool list => una"
wneuper@59539
    35
  GleichungsVariablen      :: "real list => una"
neuper@37906
    36
neuper@37906
    37
  (*Script-names*)
wneuper@59540
    38
  Biegelinie2Script        :: "[real, real, real, real => real, real => real, bool list, real list,
neuper@37906
    39
				bool] => bool"	
wneuper@59540
    40
	("((Script Biegelinie2Script (_ _ _ _ _ _ _=))// (_))" 9)
neuper@37906
    41
  Biege1xIntegrierenScript :: 
neuper@37906
    42
	            "[real,real,real,real=>real,bool list,bool list,bool list,
neuper@37906
    43
		      bool] => bool"	
neuper@37906
    44
	("((Script Biege1xIntegrierenScript (_ _ _ _ _ _ _ =))// (_))" 9)
wneuper@59540
    45
  Belastung2BiegelScript   :: "[real,real,real=>real,real=>real,
neuper@37906
    46
	                        bool list] => bool list"	
wneuper@59540
    47
	("((Script Belastung2BiegelScript (_ _ _ _ =))// (_))" 9)
neuper@37906
    48
  SetzeRandbedScript       :: "[bool list,bool list,
neuper@37906
    49
	                        bool list] => bool list"	
neuper@37906
    50
	("((Script SetzeRandbedScript (_ _ =))// (_))" 9)
neuper@37906
    51
neuper@52148
    52
axiomatization where
neuper@37906
    53
neuper@52148
    54
  Querkraft_Belastung:   "Q' x = -qq x" and
neuper@52148
    55
  Belastung_Querkraft:   "-qq x = Q' x" and
neuper@37906
    56
neuper@52148
    57
  Moment_Querkraft:      "M_b' x = Q x" and
neuper@52148
    58
  Querkraft_Moment:      "Q x = M_b' x" and
neuper@37906
    59
neuper@52148
    60
  Neigung_Moment:        "y'' x = -M_b x/ EI" and
neuper@52148
    61
  Moment_Neigung:        "M_b x = -EI * y'' x" and
neuper@37906
    62
neuper@37906
    63
  (*according to rls 'simplify_Integral': .. = 1/a * .. instead .. = ../ a*)
neuper@37983
    64
  make_fun_explicit:     "Not (a =!= 0) ==> (a * (f x) = b) = (f x = 1/a * b)"
neuper@37906
    65
wneuper@59472
    66
setup \<open>
neuper@55425
    67
KEStore_Elems.add_thes
neuper@55425
    68
  [make_thy @{theory}
neuper@55425
    69
    ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55425
    70
  make_isa @{theory} ("IsacKnowledge", "Theorems")
neuper@55425
    71
    ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55489
    72
  make_thm @{theory}  "IsacKnowledge" ("Belastung_Querkraft", @{thm Belastung_Querkraft})
neuper@55425
    73
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55489
    74
  make_thm @{theory}  "IsacKnowledge" ("Moment_Neigung", @{thm Moment_Neigung})
neuper@55425
    75
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55489
    76
  make_thm @{theory}  "IsacKnowledge" ("Moment_Querkraft", @{thm Moment_Querkraft})
neuper@55425
    77
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55489
    78
  make_thm @{theory}  "IsacKnowledge" ("Neigung_Moment", @{thm Neigung_Moment})
neuper@55425
    79
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55489
    80
  make_thm @{theory}  "IsacKnowledge" ("Querkraft_Belastung", @{thm Querkraft_Belastung})
neuper@55425
    81
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55489
    82
  make_thm @{theory}  "IsacKnowledge" ("Querkraft_Moment", @{thm Querkraft_Moment})
neuper@55425
    83
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
neuper@55489
    84
  make_thm @{theory}  "IsacKnowledge" ("make_fun_explicit", @{thm make_fun_explicit})
neuper@55425
    85
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"]]
wneuper@59472
    86
\<close>
neuper@37954
    87
neuper@37954
    88
(** problems **)
wneuper@59472
    89
setup \<open>KEStore_Elems.add_pbts
wneuper@59406
    90
  [(Specify.prep_pbt @{theory} "pbl_bieg" [] Celem.e_pblID
s1210629013@55339
    91
      (["Biegelinien"],
s1210629013@55339
    92
        [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]),
s1210629013@55339
    93
          (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
s1210629013@55339
    94
          ("#Find"  ,["Biegelinie b_b"]),
s1210629013@55339
    95
          ("#Relate",["Randbedingungen r_b"])],
wneuper@59416
    96
        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])),
wneuper@59406
    97
    (Specify.prep_pbt @{theory} "pbl_bieg_mom" [] Celem.e_pblID
s1210629013@55339
    98
      (["MomentBestimmte","Biegelinien"],
s1210629013@55339
    99
        [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]),
s1210629013@55339
   100
          (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
s1210629013@55339
   101
          ("#Find"  ,["Biegelinie b_b"]),
s1210629013@55339
   102
          ("#Relate",["RandbedingungenBiegung r_b","RandbedingungenMoment r_m"])
s1210629013@55339
   103
        ],
wneuper@59416
   104
        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])),
wneuper@59406
   105
    (Specify.prep_pbt @{theory} "pbl_bieg_momg" [] Celem.e_pblID
wneuper@59416
   106
      (["MomentGegebene","Biegelinien"], [], Rule.append_rls "e_rls" Rule.e_rls [], NONE,
s1210629013@55339
   107
        [["IntegrierenUndKonstanteBestimmen","2xIntegrieren"]])),
wneuper@59406
   108
    (Specify.prep_pbt @{theory} "pbl_bieg_einf" [] Celem.e_pblID
wneuper@59416
   109
      (["einfache","Biegelinien"], [], Rule.append_rls "e_rls" Rule.e_rls [], NONE,
s1210629013@55339
   110
        [["IntegrierenUndKonstanteBestimmen","4x4System"]])),
wneuper@59406
   111
    (Specify.prep_pbt @{theory} "pbl_bieg_momquer" [] Celem.e_pblID
wneuper@59416
   112
      (["QuerkraftUndMomentBestimmte","Biegelinien"], [], Rule.append_rls "e_rls" Rule.e_rls [], NONE,
s1210629013@55339
   113
        [["IntegrierenUndKonstanteBestimmen","1xIntegrieren"]])),
wneuper@59406
   114
    (Specify.prep_pbt @{theory} "pbl_bieg_vonq" [] Celem.e_pblID
s1210629013@55339
   115
      (["vonBelastungZu","Biegelinien"],
s1210629013@55339
   116
          [("#Given" ,["Streckenlast q_q","FunktionsVariable v_v"]),
s1210629013@55339
   117
            ("#Find"  ,["Funktionen funs'''"])],
wneuper@59416
   118
        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["Biegelinien","ausBelastung"]])),
wneuper@59406
   119
    (Specify.prep_pbt @{theory} "pbl_bieg_randbed" [] Celem.e_pblID
s1210629013@55339
   120
      (["setzeRandbedingungen","Biegelinien"],
s1210629013@55339
   121
          [("#Given" ,["Funktionen fun_s","Randbedingungen r_b"]),
s1210629013@55339
   122
            ("#Find"  ,["Gleichungen equs'''"])],
wneuper@59416
   123
        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])),
wneuper@59406
   124
    (Specify.prep_pbt @{theory} "pbl_equ_fromfun" [] Celem.e_pblID
s1210629013@55339
   125
      (["makeFunctionTo","equation"],
s1210629013@55339
   126
          [("#Given" ,["functionEq fu_n","substitution su_b"]),
s1210629013@55339
   127
            ("#Find"  ,["equality equ'''"])],
wneuper@59472
   128
        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["Equation","fromFunction"]]))]\<close>
wneuper@59472
   129
ML \<open>
neuper@37954
   130
(** methods **)
neuper@37954
   131
wneuper@59416
   132
val srls = Rule.Rls {id="srls_IntegrierenUnd..", 
neuper@37954
   133
		preconds = [], 
neuper@37954
   134
		rew_ord = ("termlessI",termlessI), 
wneuper@59416
   135
		erls = Rule.append_rls "erls_in_srls_IntegrierenUnd.." Rule.e_rls
neuper@37999
   136
				  [(*for asm in NTH_CONS ...*)
wneuper@59416
   137
				   Rule.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
neuper@37999
   138
				   (*2nd NTH_CONS pushes n+-1 into asms*)
wneuper@59416
   139
				   Rule.Calc("Groups.plus_class.plus", eval_binop "#add_")
neuper@37954
   140
				   ], 
wneuper@59416
   141
		srls = Rule.Erls, calc = [], errpatts = [],
wneuper@59416
   142
		rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
wneuper@59416
   143
			 Rule.Calc("Groups.plus_class.plus", eval_binop "#add_"),
wneuper@59416
   144
			 Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
wneuper@59491
   145
			 Rule.Calc("Tools.lhs", Tools.eval_lhs"eval_lhs_"),
wneuper@59491
   146
			 Rule.Calc("Tools.rhs", Tools.eval_rhs"eval_rhs_"),
wneuper@59416
   147
			 Rule.Calc("Atools.argument'_in",
neuper@37954
   148
			      eval_argument_in "Atools.argument'_in")
neuper@37954
   149
			 ],
wneuper@59416
   150
		scr = Rule.EmptyScr};
neuper@37954
   151
    
neuper@37954
   152
val srls2 = 
wneuper@59416
   153
    Rule.Rls {id="srls_IntegrierenUnd..", 
neuper@37954
   154
	 preconds = [], 
neuper@37954
   155
	 rew_ord = ("termlessI",termlessI), 
wneuper@59416
   156
	 erls = Rule.append_rls "erls_in_srls_IntegrierenUnd.." Rule.e_rls
neuper@37999
   157
			   [(*for asm in NTH_CONS ...*)
wneuper@59416
   158
			    Rule.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
neuper@37999
   159
			    (*2nd NTH_CONS pushes n+-1 into asms*)
wneuper@59416
   160
			    Rule.Calc("Groups.plus_class.plus", eval_binop "#add_")
neuper@37954
   161
			    ], 
wneuper@59416
   162
	 srls = Rule.Erls, calc = [], errpatts = [],
wneuper@59416
   163
	 rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
wneuper@59416
   164
		  Rule.Calc("Groups.plus_class.plus", eval_binop "#add_"),
wneuper@59416
   165
		  Rule.Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}),
wneuper@59491
   166
		  Rule.Calc("Tools.lhs", Tools.eval_lhs "eval_lhs_"),
wneuper@59416
   167
		  Rule.Calc("Atools.filter'_sameFunId",
neuper@37954
   168
		       eval_filter_sameFunId "Atools.filter'_sameFunId"),
neuper@37954
   169
		  (*WN070514 just for smltest/../biegelinie.sml ...*)
wneuper@59416
   170
		  Rule.Calc("Atools.sameFunId", eval_sameFunId "Atools.sameFunId"),
wneuper@59416
   171
		  Rule.Thm ("filter_Cons", TermC.num_str @{thm filter_Cons}),
wneuper@59416
   172
		  Rule.Thm ("filter_Nil", TermC.num_str @{thm filter_Nil}),
wneuper@59416
   173
		  Rule.Thm ("if_True", TermC.num_str @{thm if_True}),
wneuper@59416
   174
		  Rule.Thm ("if_False", TermC.num_str @{thm if_False}),
wneuper@59416
   175
		  Rule.Thm ("hd_thm", TermC.num_str @{thm hd_thm})
neuper@37954
   176
		  ],
wneuper@59416
   177
	 scr = Rule.EmptyScr};
wneuper@59472
   178
\<close>
neuper@37999
   179
wneuper@59429
   180
section \<open>Methods\<close>
wneuper@59506
   181
(* setup parent directory *)
wneuper@59472
   182
setup \<open>KEStore_Elems.add_mets
wneuper@59473
   183
    [Specify.prep_met @{theory} "met_biege" [] Celem.e_metID 
wneuper@59506
   184
	    (["IntegrierenUndKonstanteBestimmen"], [],
wneuper@59506
   185
	    {rew_ord'="tless_true", rls'= Rule.Erls, calc = [], srls = Rule.Erls, prls = Rule.Erls, crls =Rule.Erls,
wneuper@59506
   186
          errpats = [], nrls = Rule.Erls},
wneuper@59545
   187
      @{thm refl})]
wneuper@59472
   188
\<close>
wneuper@59429
   189
subsection \<open>Sub-problem "integrate and determine constants", nicely modularised\<close>
wneuper@59545
   190
wneuper@59544
   191
partial_function (tailrec) biegelinie :: "real \<Rightarrow> real \<Rightarrow> real \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> bool list \<Rightarrow> real list \<Rightarrow> bool"
wneuper@59504
   192
  where
wneuper@59544
   193
"biegelinie l q v b s vs =
wneuper@59504
   194
  (let
wneuper@59504
   195
    funs = SubProblem (''Biegelinie'', [''vonBelastungZu'', ''Biegelinien''],
wneuper@59540
   196
             [''Biegelinien'', ''ausBelastung'']) [REAL q, REAL v];                \<comment> \<open>PROG +args\<close>
wneuper@59504
   197
    equs = SubProblem (''Biegelinie'', [''setzeRandbedingungen'', ''Biegelinien''],
wneuper@59504
   198
             [''Biegelinien'', ''setzeRandbedingungenEin'']) [BOOL_LIST funs, BOOL_LIST s];
wneuper@59504
   199
    cons = SubProblem (''Biegelinie'', [''LINEAR'', ''system''], [''no_met''])
wneuper@59544
   200
             [BOOL_LIST equs, REAL_LIST vs];     \<comment> \<open>PROG consts\<close>
wneuper@59504
   201
    B = Take (lastI funs);
wneuper@59504
   202
    B = ((Substitute cons) @@ (Rewrite_Set_Inst [(''bdv'', v)] ''make_ratpoly_in'' False)) B                         
wneuper@59504
   203
  in B)"
wneuper@59472
   204
setup \<open>KEStore_Elems.add_mets
wneuper@59473
   205
    [Specify.prep_met @{theory} "met_biege_2" [] Celem.e_metID
s1210629013@55373
   206
	    (["IntegrierenUndKonstanteBestimmen2"],
wneuper@59539
   207
	      [("#Given" ,["Traegerlaenge l", "Streckenlast q",
wneuper@59540
   208
              "FunktionsVariable v", "GleichungsVariablen vs", "AbleitungBiegelinie id_abl"]),
wneuper@59429
   209
		      (*("#Where",["0 < l"]), ...wait for &lt; and handling Arbfix*)
wneuper@59429
   210
		      ("#Find"  ,["Biegelinie b"]),
wneuper@59429
   211
		      ("#Relate",["Randbedingungen s"])],
s1210629013@55373
   212
	      {rew_ord'="tless_true", 
wneuper@59416
   213
	        rls' = Rule.append_rls "erls_IntegrierenUndK.." Rule.e_rls 
wneuper@59416
   214
				      [Rule.Calc ("Atools.ident",eval_ident "#ident_"),
wneuper@59416
   215
				        Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
wneuper@59416
   216
				        Rule.Thm ("not_false",TermC.num_str @{thm not_false})], 
s1210629013@55373
   217
				  calc = [], 
wneuper@59416
   218
				  srls = Rule.append_rls "erls_IntegrierenUndK.." Rule.e_rls 
wneuper@59491
   219
				      [Rule.Calc("Tools.rhs", Tools.eval_rhs"eval_rhs_"),
wneuper@59416
   220
				        Rule.Calc ("Atools.ident",eval_ident "#ident_"),
wneuper@59416
   221
				        Rule.Thm ("last_thmI",TermC.num_str @{thm last_thmI}),
wneuper@59416
   222
				        Rule.Thm ("if_True",TermC.num_str @{thm if_True}),
wneuper@59416
   223
				        Rule.Thm ("if_False",TermC.num_str @{thm if_False})],
wneuper@59416
   224
				  prls = Rule.Erls, crls = Atools_erls, errpats = [], nrls = Rule.Erls},
wneuper@59545
   225
        @{thm biegelinie.simps}
wneuper@59545
   226
	    (*""Script Biegelinie2Script                                                                           " ^
wneuper@59540
   227
        "(l::real) (q :: real) (v :: real) (id_abl::real\<Rightarrow>real) (b :: real => real) (s :: bool list) (vs :: real list) = " ^
wneuper@59504
   228
        "  (let                                                                                             " ^
wneuper@59540
   229
        "    (funs :: bool list) = (SubProblem (''Biegelinie'',                                             " ^
wneuper@59540
   230
        "      [''vonBelastungZu'', ''Biegelinien''], [''Biegelinien'', ''ausBelastung''])                  " ^
wneuper@59540
   231
        "      [REAL q, REAL v, REAL_REAL b, REAL_REAL id_abl]);                                            " ^
wneuper@59540
   232
        "    (equs :: bool list) = (SubProblem (''Biegelinie'',                                             " ^
wneuper@59489
   233
        "      [''setzeRandbedingungen'', ''Biegelinien''], [''Biegelinien'', ''setzeRandbedingungenEin'']) " ^
wneuper@59504
   234
        "      [BOOL_LIST funs, BOOL_LIST s]);                                                              " ^
wneuper@59540
   235
        "    (cons :: bool list) = (SubProblem (''Biegelinie'',                                             " ^
wneuper@59540
   236
        "      [''LINEAR'', ''system''], [''no_met''])                                                      " ^
wneuper@59540
   237
        "      [BOOL_LIST equs, REAL_LIST vs]);                                                             " ^
wneuper@59504
   238
        "    B = Take (lastI funs);                                                                         " ^
wneuper@59504
   239
        "    B = ((Substitute cons) @@                                                                      " ^
wneuper@59540
   240
        "           (Rewrite_Set_Inst [(''bdv'', v)] ''make_ratpoly_in'' False)) B                          " ^
wneuper@59545
   241
        "  in B)                                                                                            "*))]
wneuper@59473
   242
\<close>
wneuper@59473
   243
setup \<open>KEStore_Elems.add_mets
wneuper@59473
   244
    [Specify.prep_met @{theory} "met_biege_intconst_2" [] Celem.e_metID
s1210629013@55373
   245
	    (["IntegrierenUndKonstanteBestimmen","2xIntegrieren"], [],
wneuper@59416
   246
	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
wneuper@59416
   247
          errpats = [], nrls = Rule.e_rls},
wneuper@59545
   248
        @{thm refl}),
wneuper@59406
   249
    Specify.prep_met @{theory} "met_biege_intconst_4" [] Celem.e_metID
s1210629013@55373
   250
	    (["IntegrierenUndKonstanteBestimmen","4x4System"], [],
wneuper@59416
   251
	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
wneuper@59416
   252
          errpats = [], nrls = Rule.e_rls},
wneuper@59545
   253
        @{thm refl}),
wneuper@59406
   254
    Specify.prep_met @{theory} "met_biege_intconst_1" [] Celem.e_metID
s1210629013@55373
   255
	    (["IntegrierenUndKonstanteBestimmen","1xIntegrieren"], [],
wneuper@59416
   256
        {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
wneuper@59416
   257
          errpats = [], nrls = Rule.e_rls},
wneuper@59545
   258
        @{thm refl}),
wneuper@59406
   259
    Specify.prep_met @{theory} "met_biege2" [] Celem.e_metID
s1210629013@55373
   260
	    (["Biegelinien"], [],
wneuper@59416
   261
	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
wneuper@59416
   262
          errpats = [], nrls = Rule.e_rls},
wneuper@59545
   263
        @{thm refl})]
wneuper@59472
   264
\<close>
wneuper@59429
   265
subsection \<open>Compute the general bending line\<close>
wneuper@59429
   266
wneuper@59544
   267
partial_function (tailrec) belastung_zu_biegelinie :: "real \<Rightarrow> real \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> bool list"
wneuper@59504
   268
  where
wneuper@59544
   269
"belastung_zu_biegelinie q__q v_v id_fun id_abl =
wneuper@59504
   270
  (let q___q = Take (qq v_v = q__q);
wneuper@59504
   271
       q___q = ((Rewrite ''sym_neg_equal_iff_equal'' True) @@
wneuper@59504
   272
              (Rewrite ''Belastung_Querkraft'' True)) q___q;
wneuper@59504
   273
       Q__Q = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
wneuper@59504
   274
                [''diff'', ''integration'', ''named'']) [REAL (rhs q___q), REAL v_v, REAL_REAL Q];
wneuper@59504
   275
       M__M = Rewrite ''Querkraft_Moment'' True Q__Q;
wneuper@59504
   276
       M__M = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
wneuper@59504
   277
                [''diff'', ''integration'', ''named'']) [REAL (rhs M__M), REAL v_v, REAL_REAL M_b];
wneuper@59504
   278
       N__N = ((Rewrite ''Moment_Neigung'' False) @@
wneuper@59504
   279
               (Rewrite ''make_fun_explicit'' False)) M__M;
wneuper@59504
   280
       N__N = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
wneuper@59504
   281
                  [''diff'', ''integration'', ''named''])
wneuper@59544
   282
                [REAL (rhs N__N), REAL v_v, REAL_REAL id_abl];                        \<comment> \<open>PROG string\<close>
wneuper@59504
   283
       B__B = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
wneuper@59504
   284
                  [''diff'', ''integration'', ''named'']) 
wneuper@59544
   285
                [REAL (rhs N__N), REAL v_v, REAL_REAL id_fun]                          \<comment> \<open>PROG string\<close>
wneuper@59504
   286
 in [Q__Q, M__M, N__N, B__B])"
wneuper@59472
   287
setup \<open>KEStore_Elems.add_mets
wneuper@59473
   288
    [Specify.prep_met @{theory} "met_biege_ausbelast" [] Celem.e_metID
s1210629013@55373
   289
	    (["Biegelinien", "ausBelastung"],
wneuper@59540
   290
	      [("#Given" ,["Streckenlast q__q", "FunktionsVariable v_v",
wneuper@59540
   291
            "Biegelinie id_fun", "AbleitungBiegelinie id_abl"]),
wneuper@59540
   292
	       ("#Find"  ,["Funktionen fun_s"])],
s1210629013@55373
   293
	      {rew_ord'="tless_true", 
wneuper@59416
   294
	        rls' = Rule.append_rls "erls_ausBelastung" Rule.e_rls 
wneuper@59416
   295
				      [Rule.Calc ("Atools.ident", eval_ident "#ident_"),
wneuper@59416
   296
				        Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
wneuper@59416
   297
				        Rule.Thm ("not_false", TermC.num_str @{thm not_false})], 
s1210629013@55373
   298
				  calc = [], 
wneuper@59416
   299
				  srls = Rule.append_rls "srls_ausBelastung" Rule.e_rls 
wneuper@59491
   300
				      [Rule.Calc ("Tools.rhs", Tools.eval_rhs "eval_rhs_")], 
wneuper@59416
   301
				  prls = Rule.e_rls, crls = Atools_erls, errpats = [], nrls = Rule.e_rls},
wneuper@59545
   302
        @{thm belastung_zu_biegelinie.simps}
wneuper@59545
   303
	    (*"Script Belastung2BiegelScript (q__q::real) (v_v::real) (id_fun::real\<Rightarrow>real) (id_abl::real\<Rightarrow>real) = " ^
wneuper@59540
   304
          "  (let q___q = Take (qq v_v = q__q);                                                " ^
wneuper@59540
   305
          "       q___q = ((Rewrite ''sym_neg_equal_iff_equal'' True) @@                       " ^
wneuper@59540
   306
          "              (Rewrite ''Belastung_Querkraft'' True)) q___q;                        " ^
wneuper@59540
   307
          "      (Q__Q:: bool) =                                                               " ^
wneuper@59540
   308
          "             (SubProblem (''Biegelinie'',[''named'',''integrate'',''function''],    " ^
wneuper@59540
   309
          "                          [''diff'',''integration'',''named''])                     " ^
wneuper@59540
   310
          "                          [REAL (rhs q___q), REAL v_v, REAL_REAL Q]);               " ^
wneuper@59540
   311
          "       M__M = Rewrite ''Querkraft_Moment'' True Q__Q;                               " ^
wneuper@59540
   312
          "      (M__M::bool) =                                                                " ^
wneuper@59540
   313
          "             (SubProblem (''Biegelinie'',[''named'',''integrate'',''function''],    " ^
wneuper@59540
   314
          "                          [''diff'',''integration'',''named''])                     " ^
wneuper@59540
   315
          "                          [REAL (rhs M__M), REAL v_v, REAL_REAL M_b]);              " ^
wneuper@59540
   316
          "       N__N = ((Rewrite ''Moment_Neigung'' False) @@                                " ^
wneuper@59540
   317
          "              (Rewrite ''make_fun_explicit'' False)) M__M;                          " ^
wneuper@59540
   318
          "      (N__N:: bool) =                                                               " ^
wneuper@59540
   319
          "             (SubProblem (''Biegelinie'',[''named'',''integrate'',''function''],    " ^
wneuper@59498
   320
          "                          [''diff'',''integration'', ''named''])                    " ^
wneuper@59540
   321
          "                          [REAL (rhs N__N), REAL v_v, REAL_REAL id_abl]);           " ^
wneuper@59540
   322
          "      (B__B:: bool) =                                                               " ^
wneuper@59540
   323
          "             (SubProblem (''Biegelinie'',[''named'',''integrate'',''function''],    " ^
wneuper@59540
   324
          "                          [''diff'',''integration'',''named''])                     " ^
wneuper@59540
   325
          "                          [REAL (rhs N__N), REAL v_v, REAL_REAL id_fun])            " ^
wneuper@59545
   326
          " in [Q__Q, M__M, N__N, B__B])                                                       "*))]
wneuper@59472
   327
\<close>
wneuper@59429
   328
subsection \<open>Substitute the constraints into the equations\<close>
wneuper@59429
   329
wneuper@59504
   330
partial_function (tailrec) setzte_randbedingungen :: "bool list \<Rightarrow> bool list \<Rightarrow> bool list"
wneuper@59504
   331
  where 
wneuper@59504
   332
"setzte_randbedingungen fun_s r_b =
wneuper@59504
   333
 (let b_1 = NTH 1 r_b;
wneuper@59504
   334
      f_s = filter_sameFunId (lhs b_1) fun_s;
wneuper@59504
   335
      e_1 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
wneuper@59504
   336
              [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_1];
wneuper@59504
   337
      b_2 = NTH 2 r_b;
wneuper@59504
   338
      f_s = filter_sameFunId (lhs b_2) fun_s;
wneuper@59504
   339
      e_2 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
wneuper@59504
   340
               [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_2];
wneuper@59504
   341
      b_3 = NTH 3 r_b;
wneuper@59504
   342
      f_s = filter_sameFunId (lhs b_3) fun_s;
wneuper@59504
   343
      e_3 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
wneuper@59504
   344
               [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_3];
wneuper@59504
   345
      b_4 = NTH 4 r_b;
wneuper@59504
   346
      f_s = filter_sameFunId (lhs b_4) fun_s;
wneuper@59504
   347
      e_4 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
wneuper@59504
   348
               [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_4]
wneuper@59504
   349
 in [e_1, e_2, e_3, e_4])"
wneuper@59472
   350
setup \<open>KEStore_Elems.add_mets
wneuper@59473
   351
    [Specify.prep_met @{theory} "met_biege_setzrand" [] Celem.e_metID
s1210629013@55373
   352
	    (["Biegelinien", "setzeRandbedingungenEin"],
s1210629013@55373
   353
	      [("#Given" , ["Funktionen fun_s", "Randbedingungen r_b"]),
s1210629013@55373
   354
	        ("#Find"  , ["Gleichungen equs'''"])],
wneuper@59416
   355
	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = srls2, prls=Rule.e_rls, crls = Atools_erls,
wneuper@59416
   356
          errpats = [], nrls = Rule.e_rls},
wneuper@59545
   357
        @{thm setzte_randbedingungen.simps}
wneuper@59545
   358
	    (*"Script SetzeRandbedScript (fun_s::bool list) (r_b::bool list) = " ^
s1210629013@55373
   359
          " (let b_1 = NTH 1 r_b;                                         " ^
s1210629013@55373
   360
          "      f_s = filter_sameFunId (lhs b_1) fun_s;                   " ^
s1210629013@55373
   361
          "      (e_1::bool) =                                             " ^
wneuper@59489
   362
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   363
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   364
          "                          [BOOL (hd f_s), BOOL b_1]);         " ^
s1210629013@55373
   365
          "      b_2 = NTH 2 r_b;                                         " ^
s1210629013@55373
   366
          "      f_s = filter_sameFunId (lhs b_2) fun_s;                   " ^
s1210629013@55373
   367
          "      (e_2::bool) =                                             " ^
wneuper@59489
   368
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   369
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   370
          "                          [BOOL (hd f_s), BOOL b_2]);         " ^
s1210629013@55373
   371
          "      b_3 = NTH 3 r_b;                                         " ^
s1210629013@55373
   372
          "      f_s = filter_sameFunId (lhs b_3) fun_s;                   " ^
s1210629013@55373
   373
          "      (e_3::bool) =                                             " ^
wneuper@59489
   374
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   375
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   376
          "                          [BOOL (hd f_s), BOOL b_3]);         " ^
s1210629013@55373
   377
          "      b_4 = NTH 4 r_b;                                         " ^
s1210629013@55373
   378
          "      f_s = filter_sameFunId (lhs b_4) fun_s;                   " ^
s1210629013@55373
   379
          "      (e_4::bool) =                                             " ^
wneuper@59489
   380
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   381
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   382
          "                          [BOOL (hd f_s), BOOL b_4])          " ^
wneuper@59545
   383
          " in [e_1, e_2, e_3, e_4])"*)
s1210629013@55373
   384
          (* filter requires more than 1 sec !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
s1210629013@55373
   385
          "Script SetzeRandbedScript (fun_s::bool list) (r_b::bool list) = " ^
s1210629013@55373
   386
          " (let b_1 = NTH 1 r_b;                                         " ^
s1210629013@55373
   387
          "      f_s = filter (sameFunId (lhs b_1)) fun_s;                 " ^
s1210629013@55373
   388
          "      (e_1::bool) =                                             " ^
wneuper@59489
   389
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   390
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   391
          "                          [BOOL (hd f_s), BOOL b_1]);         " ^
s1210629013@55373
   392
          "      b_2 = NTH 2 r_b;                                         " ^
s1210629013@55373
   393
          "      f_s = filter (sameFunId (lhs b_2)) fun_s;                 " ^
s1210629013@55373
   394
          "      (e_2::bool) =                                             " ^
wneuper@59489
   395
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   396
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   397
          "                          [BOOL (hd f_s), BOOL b_2]);         " ^
s1210629013@55373
   398
          "      b_3 = NTH 3 r_b;                                         " ^
s1210629013@55373
   399
          "      f_s = filter (sameFunId (lhs b_3)) fun_s;                 " ^
s1210629013@55373
   400
          "      (e_3::bool) =                                             " ^
wneuper@59489
   401
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   402
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   403
          "                          [BOOL (hd f_s), BOOL b_3]);         " ^
s1210629013@55373
   404
          "      b_4 = NTH 4 r_b;                                         " ^
s1210629013@55373
   405
          "      f_s = filter (sameFunId (lhs b_4)) fun_s;                 " ^
s1210629013@55373
   406
          "      (e_4::bool) =                                             " ^
wneuper@59489
   407
          "             (SubProblem (''Biegelinie'',[''makeFunctionTo'',''equation'']," ^
wneuper@59489
   408
          "                          [''Equation'',''fromFunction''])              " ^
s1210629013@55373
   409
          "                          [BOOL (hd f_s), BOOL b_4])          " ^
wneuper@59429
   410
          " in [e_1,e_2,e_3,e_4])"*))]
wneuper@59472
   411
\<close>
wneuper@59429
   412
subsection \<open>Transform an equality into a function\<close>
wneuper@59429
   413
wneuper@59504
   414
        (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) (M_b L = 0) -->
wneuper@59504
   415
               0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*)
wneuper@59504
   416
partial_function (tailrec) function_to_equality :: "bool \<Rightarrow> bool \<Rightarrow> bool"
wneuper@59504
   417
  where
wneuper@59504
   418
"function_to_equality fu_n su_b =
wneuper@59504
   419
 (let fu_n = Take fu_n;
wneuper@59504
   420
      bd_v = argument_in (lhs fu_n);
wneuper@59504
   421
      va_l = argument_in (lhs su_b);
wneuper@59504
   422
      eq_u = Substitute [bd_v = va_l] fu_n;
wneuper@59504
   423
                                     \<comment> \<open>([1], Res), M_b L = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2\<close>
wneuper@59504
   424
      eq_u = Substitute [su_b] eq_u
wneuper@59504
   425
 in (Rewrite_Set ''norm_Rational'' False) eq_u)"
wneuper@59472
   426
setup \<open>KEStore_Elems.add_mets
wneuper@59473
   427
    [Specify.prep_met @{theory} "met_equ_fromfun" [] Celem.e_metID
s1210629013@55373
   428
	    (["Equation","fromFunction"],
s1210629013@55373
   429
	      [("#Given" ,["functionEq fu_n","substitution su_b"]),
s1210629013@55373
   430
	        ("#Find"  ,["equality equ'''"])],
wneuper@59416
   431
	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [],
wneuper@59416
   432
          srls = Rule.append_rls "srls_in_EquationfromFunc" Rule.e_rls
wneuper@59491
   433
				      [Rule.Calc("Tools.lhs", Tools.eval_lhs "eval_lhs_"),
wneuper@59416
   434
				        Rule.Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in")], 
wneuper@59416
   435
				  prls=Rule.e_rls, crls = Atools_erls, errpats = [], nrls = Rule.e_rls},
s1210629013@55373
   436
        (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) (M_b L = 0) -->
s1210629013@55373
   437
               0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*)
wneuper@59545
   438
        @{thm function_to_equality.simps}
wneuper@59545
   439
	    (*"Script Function2Equality (fu_n::bool) (su_b::bool) =" ^
s1210629013@55373
   440
        " (let fu_n = Take fu_n;                             " ^
s1210629013@55373
   441
        "      bd_v = argument_in (lhs fu_n);                " ^
s1210629013@55373
   442
        "      va_l = argument_in (lhs su_b);                " ^
s1210629013@55373
   443
        "      eq_u = (Substitute [bd_v = va_l]) fu_n;       " ^
s1210629013@55373
   444
                                        (*([1], Res), M_b L = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*)
s1210629013@55373
   445
        "      eq_u = (Substitute [su_b]) eq_u               " ^
wneuper@59545
   446
        " in (Rewrite_Set ''norm_Rational'' False) eq_u)         "*))]
wneuper@59472
   447
\<close>
s1210629013@55373
   448
neuper@37906
   449
end
neuper@37906
   450