src/Tools/isac/Knowledge/Biegelinie.thy
author wneuper <Walther.Neuper@jku.at>
Thu, 16 Nov 2023 08:15:46 +0100
changeset 60763 2121f1a39a64
parent 60736 7297c166991e
child 60765 5e91c279af3a
permissions -rw-r--r--
prepare 14: improved item_to_add

emergency-CS:
* no code cleanup
* ERROR in test/../biegelinie-3.sml outcommented
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
walther@60023
     9
section \<open>Constants specific for Biegelinie\<close>
walther@60023
    10
neuper@37906
    11
consts
neuper@42385
    12
  qq    :: "real => real"             (* Streckenlast               *)
neuper@37999
    13
  Q     :: "real => real"             (* Querkraft                  *)
neuper@37999
    14
  Q'    :: "real => real"             (* Ableitung der Querkraft    *)
walther@60278
    15
  M_b  :: "real => real" ("M'_b")    (* Biegemoment                *)
walther@60278
    16
(*M_b' :: "real => real" ("M_b' ")  ( * Ableitung des Biegemoments
Walther@60652
    17
  Isabelle2020: new handling of quotes in mixfix, so the parser cannot distinguish M_b  M_b'
walther@60086
    18
walther@60086
    19
Outcommenting causes error at Neigung_Moment:   "y'' x = -M_b x/ EI" below:
walther@60086
    20
Ambiguous input\<^here> produces 2 parse trees:
walther@60086
    21
  ("\<^const>HOL.Trueprop"
walther@60086
    22
    ("\<^const>HOL.eq" ("_applC" ("_position" y'') ("_position" x))
walther@60278
    23
      ("\<^const>Fields.inverse_class.inverse_divide" ("\<^const>Groups.uminus_class.uminus" ("_applC" ("\<^const>Biegelinie_Test.M_b") ("_position" x)))
walther@60086
    24
        ("_position" EI))))
walther@60086
    25
  ("\<^const>HOL.Trueprop"
walther@60086
    26
    ("\<^const>HOL.eq" ("_applC" ("_position" y'') ("_position" x))
walther@60278
    27
      ("\<^const>Fields.inverse_class.inverse_divide" ("\<^const>Groups.uminus_class.uminus" ("_applC" ("\<^const>Biegelinie_Test.M_b'") ("_position" x)))
walther@60086
    28
        ("_position" EI))))
walther@60086
    29
Ambiguous input -------------------------------------------------------------------------------------------------------^^^^^^
walther@60086
    30
2 terms are type correct:
walther@60086
    31
  ((y'' x) = ((- (M_b x)) / EI))
walther@60086
    32
  ((y'' x) = ((- (M_b x)) / EI))
walther@60086
    33
Failed to parse prop
walther@60086
    34
*)
neuper@37999
    35
  y''   :: "real => real"             (* 2.Ableitung der Biegeline  *)
neuper@37999
    36
  y'    :: "real => real"             (* Neigung der Biegeline      *)
neuper@37999
    37
(*y     :: "real => real"             (* Biegeline                  *)*)
neuper@37999
    38
  EI    :: "real"                     (* Biegesteifigkeit           *)
neuper@37906
    39
walther@60023
    40
walther@60023
    41
section \<open>Descriptions extending Input_Descript.thy\<close>
walther@60023
    42
walther@60023
    43
consts
neuper@37999
    44
  Traegerlaenge            :: "real => una"
neuper@37999
    45
  Streckenlast             :: "real => una"
Walther@60736
    46
neuper@37999
    47
  Biegelinie               :: "(real => real) => una"
wneuper@59540
    48
  AbleitungBiegelinie      :: "(real => real) => una"
Walther@60736
    49
  Biegemoment              :: "(real => real) => una"
Walther@60736
    50
  Querkraft                :: "(real => real) => una"
Walther@60736
    51
neuper@37999
    52
  Randbedingungen          :: "bool list => una"
neuper@37999
    53
  RandbedingungenBiegung   :: "bool list => una"
neuper@37999
    54
  RandbedingungenNeigung   :: "bool list => una"
neuper@37999
    55
  RandbedingungenMoment    :: "bool list => una"
neuper@37999
    56
  RandbedingungenQuerkraft :: "bool list => una"
neuper@37999
    57
  FunktionsVariable        :: "real => una"
neuper@37999
    58
  Funktionen               :: "bool list => una"
Walther@60763
    59
  Gleichungen              :: "bool list => una" (*\<longrightarrow> Input_Descript.thy: known by fun is_NObrack_list*)
wneuper@59539
    60
  GleichungsVariablen      :: "real list => una"
neuper@37906
    61
walther@60023
    62
walther@60023
    63
section \<open>Theorems from statics, still as axioms\<close>
walther@60023
    64
neuper@52148
    65
axiomatization where
neuper@37906
    66
neuper@52148
    67
  Querkraft_Belastung:   "Q' x = -qq x" and
neuper@52148
    68
  Belastung_Querkraft:   "-qq x = Q' x" and
neuper@37906
    69
neuper@52148
    70
  Moment_Querkraft:      "M_b' x = Q x" and
neuper@52148
    71
  Querkraft_Moment:      "Q x = M_b' x" and
neuper@37906
    72
walther@60079
    73
  Neigung_Moment:        "y'' x = -M_b (x / EI)" and
walther@60079
    74
  Moment_Neigung:        "(M_b x) = -EI * y'' x" and
neuper@37906
    75
neuper@37906
    76
  (*according to rls 'simplify_Integral': .. = 1/a * .. instead .. = ../ a*)
walther@60278
    77
  make_fun_explicit:     "~ (a =!= 0) ==> (a * (f x) = bb) = (f x = 1/a * bb)"
neuper@37906
    78
walther@60023
    79
walther@60023
    80
section \<open>Acknowledgements shown in browsers of Isac_Knowledge\<close>
walther@60023
    81
Walther@60634
    82
setup \<open>ThyC.set_metadata {
Walther@60634
    83
  coursedesign = ["(c) Christian Dürnsteiner 2006 supported by a grant from NMI Austria"],
Walther@60634
    84
  mathauthors = ["Walther Neuper 2005 supported by a grant from NMI Austria"]}
Walther@60634
    85
\<close>
Walther@60634
    86
(* ? more finegrained as above in Isabelle/PIDE ?* )
wneuper@59472
    87
setup \<open>
Walther@60588
    88
Know_Store.add_thes
walther@60253
    89
  [Thy_Hierarchy.make_thy @{theory}
neuper@55425
    90
    ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
    91
  Thy_Hierarchy.make_isa @{theory} ("IsacKnowledge", "Theorems")
neuper@55425
    92
    ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
    93
  Thy_Hierarchy.make_thm @{theory}  "IsacKnowledge" ("Belastung_Querkraft", @{thm Belastung_Querkraft})
neuper@55425
    94
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
    95
  Thy_Hierarchy.make_thm @{theory}  "IsacKnowledge" ("Moment_Neigung", @{thm Moment_Neigung})
neuper@55425
    96
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
    97
  Thy_Hierarchy.make_thm @{theory}  "IsacKnowledge" ("Moment_Querkraft", @{thm Moment_Querkraft})
neuper@55425
    98
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
    99
  Thy_Hierarchy.make_thm @{theory}  "IsacKnowledge" ("Neigung_Moment", @{thm Neigung_Moment})
neuper@55425
   100
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
   101
  Thy_Hierarchy.make_thm @{theory}  "IsacKnowledge" ("Querkraft_Belastung", @{thm Querkraft_Belastung})
neuper@55425
   102
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
   103
  Thy_Hierarchy.make_thm @{theory}  "IsacKnowledge" ("Querkraft_Moment", @{thm Querkraft_Moment})
neuper@55425
   104
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"],
walther@60253
   105
  Thy_Hierarchy.make_thm @{theory}  "IsacKnowledge" ("make_fun_explicit", @{thm make_fun_explicit})
neuper@55425
   106
	  ["Walther Neuper 2005 supported by a grant from NMI Austria"]]
wneuper@59472
   107
\<close>
walther@60255
   108
( **)
neuper@37954
   109
Walther@60736
   110
section \<open>Problem.T, trial to decouple the models/formal arguments\<close>
Walther@60710
   111
text \<open>
Walther@60710
   112
  (Only) here was a trial to decouple the model of the problem from the model of the method.
Walther@60710
   113
  E.g. for "Traegerlaenge" in the problem we had "l_l", while in the method we had "beam".
Walther@60710
   114
  This had been working with the old "fun arguments_from_model, relate_args" in LItool.
Walther@60710
   115
  But the Pre_Conds of Biegelinie were empty at that time --
Walther@60710
   116
  -- how should this work with Pre_Conds <>[] involved with both, problem and method?
Walther@60710
   117
  A kind of "model-translation" (see the old "fun LItool.arguments_from_model";
Walther@60710
   118
  there is already an implicit kind of relation exploitet by refinement)?
Walther@60710
   119
  In this changeset there is the decision to make the two models equal, of model and of method.
walther@60023
   120
wenzelm@60306
   121
problem pbl_bieg : "Biegelinien" =
wenzelm@60306
   122
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   123
  Method_Ref: "IntegrierenUndKonstanteBestimmen2"
wenzelm@60306
   124
  Given: "Traegerlaenge l_l" "Streckenlast q_q"
wenzelm@60306
   125
  (* Where: "0 < l_l" ...wait for &lt; and handling Arbfix*)
wenzelm@60306
   126
  Find: "Biegelinie b_b"
wenzelm@60306
   127
  Relate: "Randbedingungen r_b"
wenzelm@60306
   128
Walther@60710
   129
(* Traegerlaenge beam      Biegelinie!TYPE! id_fun                    AbleitungBiegelinie id_der
Walther@60710
   130
           Streckenlast load                Randbedingungen side_conds                 Biegelinie \<noteq>!TYPE!
Walther@60710
   131
                   FunktionsVariable fun_var             GleichungsVariablen vs                *)
Walther@60710
   132
partial_function (tailrec) biegelinie ::
Walther@60710
   133
  "real \<Rightarrow> real \<Rightarrow> real \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> bool list \<Rightarrow> real list \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> bool"
Walther@60710
   134
  where
Walther@60710
   135
"biegelinie beam load fun_var id_fun side_conds vs id_der = (
Walther@60710
   136
  let
Walther@60710
   137
    funs = SubProblem (''Biegelinie'', [''vonBelastungZu'', ''Biegelinien''],
Walther@60710
   138
      [''Biegelinien'', ''ausBelastung''])
Walther@60710
   139
        [REAL load, REAL fun_var, REAL_REAL id_fun, REAL_REAL id_der];
Walther@60710
   140
    equs = SubProblem (''Biegelinie'', [''setzeRandbedingungen'', ''Biegelinien''],
Walther@60710
   141
      [''Biegelinien'', ''setzeRandbedingungenEin'']) [BOOL_LIST funs, BOOL_LIST side_conds];
Walther@60710
   142
    cons = SubProblem (''Biegelinie'', [''LINEAR'', ''system''],
Walther@60710
   143
      [''no_met'']) [BOOL_LIST equs, REAL_LIST vs];
Walther@60710
   144
    B = Take (lastI funs);
Walther@60710
   145
    B = ((Substitute cons) #> (Rewrite_Set_Inst [(''bdv'', fun_var)] ''make_ratpoly_in'')) B
Walther@60710
   146
  in B)"
Walther@60710
   147
Walther@60710
   148
method met_biege_2 : "IntegrierenUndKonstanteBestimmen2" =
Walther@60710
   149
  \<open>{rew_ord="tless_true",
Walther@60710
   150
    rls' = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty [
Walther@60710
   151
      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
Walther@60710
   152
      \<^rule_thm>\<open>not_true\<close>,
Walther@60710
   153
      \<^rule_thm>\<open>not_false\<close>], 
Walther@60710
   154
    calc = [], 
Walther@60710
   155
    prog_rls = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty [
Walther@60710
   156
      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
Walther@60710
   157
      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
Walther@60710
   158
      \<^rule_thm>\<open>last_thmI\<close>,
Walther@60710
   159
      \<^rule_thm>\<open>if_True\<close>,
Walther@60710
   160
      \<^rule_thm>\<open>if_False\<close>],
Walther@60710
   161
    where_rls = Rule_Set.Empty, errpats = [], rew_rls = Rule_Set.Empty}\<close>
Walther@60710
   162
  Program: biegelinie.simps
Walther@60710
   163
  Given: "Traegerlaenge beam" "Streckenlast load"
Walther@60710
   164
    "FunktionsVariable fun_var" "GleichungsVariablen vs" "AbleitungBiegelinie id_der"
Walther@60710
   165
  (* Where: "0 < beam" ...wait for &lt; and handling Arbfix*)
Walther@60710
   166
  Find: "Biegelinie id_fun"
Walther@60710
   167
  Relate: "Randbedingungen side_conds"
Walther@60736
   168
Walther@60736
   169
(*here was a trial to decouple the model of the problem from the model of the method.*)
Walther@60710
   170
\<close>
Walther@60710
   171
problem pbl_bieg : "Biegelinien" =
Walther@60710
   172
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60710
   173
  Method_Ref: "IntegrierenUndKonstanteBestimmen2"
Walther@60710
   174
  Given: "Traegerlaenge l_l" "Streckenlast q_q"
Walther@60710
   175
  (* Where: "0 < l_l" ...wait for &lt; and handling Arbfix*)
Walther@60710
   176
  Find: "Biegelinie b_b"
Walther@60710
   177
  Relate: "Randbedingungen r_b"
Walther@60710
   178
wenzelm@60306
   179
problem pbl_bieg_mom : "MomentBestimmte/Biegelinien" =
wenzelm@60306
   180
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   181
  Method_Ref: "IntegrierenUndKonstanteBestimmen"
wenzelm@60306
   182
  Given: "Traegerlaenge l_l" "Streckenlast q_q"
wenzelm@60306
   183
  (* Where: "0 < l_l" ...wait for &lt; and handling Arbfix*)
wenzelm@60306
   184
  Find: "Biegelinie b_b"
wenzelm@60306
   185
  Relate: "RandbedingungenBiegung r_b" "RandbedingungenMoment r_m"
wenzelm@60306
   186
wenzelm@60306
   187
problem pbl_bieg_momg : "MomentGegebene/Biegelinien" =
wenzelm@60306
   188
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   189
  Method_Ref: "IntegrierenUndKonstanteBestimmen/2xIntegrieren"
wenzelm@60306
   190
wenzelm@60306
   191
problem pbl_bieg_einf : "einfache/Biegelinien" =
wenzelm@60306
   192
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   193
  Method_Ref: "IntegrierenUndKonstanteBestimmen/4x4System"
wenzelm@60306
   194
wenzelm@60306
   195
problem pbl_bieg_momquer : "QuerkraftUndMomentBestimmte/Biegelinien" =
wenzelm@60306
   196
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   197
  Method_Ref: "IntegrierenUndKonstanteBestimmen/1xIntegrieren"
wenzelm@60306
   198
wenzelm@60306
   199
problem pbl_bieg_vonq : "vonBelastungZu/Biegelinien" =
wenzelm@60306
   200
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   201
  Method_Ref: "Biegelinien/ausBelastung"
wenzelm@60306
   202
  Given: "Streckenlast q_q" "FunktionsVariable v_v"
wenzelm@60306
   203
  Find: "Funktionen funs'''"
wenzelm@60306
   204
wenzelm@60306
   205
problem pbl_bieg_randbed : "setzeRandbedingungen/Biegelinien" =
wenzelm@60306
   206
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   207
  Method_Ref: "Biegelinien/setzeRandbedingungenEin"
wenzelm@60306
   208
  Given: "Funktionen fun_s" "Randbedingungen r_b"
wenzelm@60306
   209
  Find: "Gleichungen equs'''"
wenzelm@60306
   210
wenzelm@60306
   211
problem pbl_equ_fromfun : "makeFunctionTo/equation" =
wenzelm@60306
   212
  \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
Walther@60449
   213
  Method_Ref: "Equation/fromFunction"
wenzelm@60306
   214
  Given: "functionEq fu_n" "substitution su_b"
wenzelm@60306
   215
  Find: "equality equ'''"
wenzelm@60306
   216
wneuper@59472
   217
ML \<open>
neuper@37954
   218
(** methods **)
neuper@37954
   219
Walther@60586
   220
val prog_rls = Rule_Def.Repeat {
walther@60358
   221
  id="srls_IntegrierenUnd..", preconds = [], rew_ord = ("termlessI",termlessI), 
Walther@60586
   222
	asm_rls = Rule_Set.append_rules "erls_in_srls_IntegrierenUnd.." Rule_Set.empty [
walther@60358
   223
    (*for asm in NTH_CONS ...*)
walther@60358
   224
	  \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
walther@60358
   225
	  (*2nd NTH_CONS pushes n+-1 into asms*)
Walther@60515
   226
	  \<^rule_eval>\<open>plus\<close> (**)(Calc_Binop.numeric "#add_")], 
Walther@60586
   227
	prog_rls = Rule_Set.Empty, calc = [], errpatts = [],
walther@60358
   228
	rules = [
walther@60358
   229
     \<^rule_thm>\<open>NTH_CONS\<close>,
Walther@60515
   230
		 \<^rule_eval>\<open>plus\<close> (**)(Calc_Binop.numeric "#add_"),
walther@60358
   231
		 \<^rule_thm>\<open>NTH_NIL\<close>,
walther@60358
   232
		 \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs"eval_lhs_"),
walther@60358
   233
		 \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
walther@60358
   234
		 \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in")],
Walther@60586
   235
	program = Rule.Empty_Prog};
neuper@37954
   236
    
walther@60358
   237
val srls2 = Rule_Def.Repeat {
walther@60358
   238
  id="srls_IntegrierenUnd..", preconds = [], rew_ord = ("termlessI",termlessI), 
Walther@60586
   239
	asm_rls = Rule_Set.append_rules "erls_in_srls_IntegrierenUnd.." Rule_Set.empty [
walther@60358
   240
    (*for asm in NTH_CONS ...*)
walther@60358
   241
		\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
walther@60358
   242
		(*2nd NTH_CONS pushes n+-1 into asms*)
Walther@60515
   243
		\<^rule_eval>\<open>plus\<close> (**)(Calc_Binop.numeric "#add_")], 
Walther@60586
   244
	prog_rls = Rule_Set.Empty, calc = [], errpatts = [],
walther@60358
   245
	rules = [
walther@60358
   246
    \<^rule_thm>\<open>NTH_CONS\<close>,
Walther@60515
   247
	  \<^rule_eval>\<open>plus\<close> (**)(Calc_Binop.numeric "#add_"),
walther@60358
   248
	  \<^rule_thm>\<open>NTH_NIL\<close>,
walther@60358
   249
	  \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
walther@60358
   250
	  \<^rule_eval>\<open>Prog_Expr.filter_sameFunId\<close> (Prog_Expr.eval_filter_sameFunId "Prog_Expr.filter_sameFunId"),
walther@60358
   251
	  (*WN070514 just for smltest/../biegelinie.sml ...*)
walther@60358
   252
	  \<^rule_eval>\<open>Prog_Expr.sameFunId\<close> (Prog_Expr.eval_sameFunId "Prog_Expr.sameFunId"),
walther@60358
   253
	  \<^rule_thm>\<open>filter_Cons\<close>,
walther@60358
   254
	  \<^rule_thm>\<open>filter_Nil\<close>,
walther@60358
   255
	  \<^rule_thm>\<open>if_True\<close>,
walther@60358
   256
	  \<^rule_thm>\<open>if_False\<close>,
walther@60358
   257
	  \<^rule_thm>\<open>hd_thm\<close>],
Walther@60586
   258
	program = Rule.Empty_Prog};
wneuper@59472
   259
\<close>
neuper@37999
   260
wneuper@59429
   261
section \<open>Methods\<close>
wneuper@59506
   262
(* setup parent directory *)
wenzelm@60303
   263
method met_biege : "IntegrierenUndKonstanteBestimmen" =
Walther@60587
   264
  \<open>{rew_ord="tless_true", rls'= Rule_Set.Empty, calc = [], prog_rls = Rule_Set.Empty, where_rls = Rule_Set.Empty,
Walther@60586
   265
    errpats = [], rew_rls = Rule_Set.Empty}\<close>
wneuper@59545
   266
walther@60023
   267
subsection \<open>Survey on Methods\<close>
walther@60023
   268
text \<open>
Walther@60736
   269
  Calculations guided by IntegrierenUndKonstanteBestimmen are structured
Walther@60736
   270
  by the following Subproblems.
Walther@60736
   271
  An example calculation is found in test/../biegelinie-4.sml as
Walther@60736
   272
  test --- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. me' with ALL subproblems ---.
Walther@60736
   273
walther@60023
   274
  Theory "Biegelinie" used by all Subproblems
walther@60023
   275
  v-- the root Problem calling SubProblems according to indentation
walther@60023
   276
walther@60023
   277
  Problem ["Biegelinien"]
walther@60154
   278
  MethodC ["IntegrierenUndKonstanteBestimmen2"]  biegelinie
walther@60023
   279
walther@60023
   280
    Problem ["vonBelastungZu", "Biegelinien"]
walther@60154
   281
    MethodC ["Biegelinien", "ausBelastung"]  belastung_zu_biegelinie
walther@60023
   282
walther@60023
   283
      Problem ["named", "integrate", "function"]
walther@60154
   284
      MethodC ["diff", "integration", "named"]
walther@60023
   285
walther@60023
   286
      -"- 4 times
walther@60023
   287
walther@60023
   288
    Problem ["setzeRandbedingungen", "Biegelinien"]
walther@60154
   289
    MethodC ["Biegelinien", "setzeRandbedingungenEin"]  setzte_randbedingungen
walther@60023
   290
walther@60023
   291
      Problem ["makeFunctionTo", "equation"]
walther@60154
   292
      MethodC ["Equation", "fromFunction"]
walther@60023
   293
walther@60023
   294
      -"- 4 times
walther@60023
   295
walther@60023
   296
    Problem ["LINEAR", "system"]
walther@60154
   297
    MethodC ["no_met"]
walther@60023
   298
             ^^^^^^--- thus automatied refinement to appropriate Problem
walther@60023
   299
\<close>
walther@60023
   300
walther@60023
   301
subsection \<open>Compute the general bending line\<close>
Walther@60736
   302
(* Traegerlaenge l_l                Randbedingungen r_b                    Biegemoment id_momentum
Walther@60736
   303
           Streckenlast q_q                      FunktionsVariable fun_var                  Querkraft id_lat_force
Walther@60736
   304
                   Biegelinie b_b                         AbleitungBiegelinie id_der                         GleichungsVariablen vs                *)
wneuper@59549
   305
partial_function (tailrec) biegelinie ::
Walther@60736
   306
  "real \<Rightarrow> real \<Rightarrow> bool list \<Rightarrow> real \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> real list \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> bool"
Walther@60736
   307
(* l_l-----q__q---r_b----------fun_var--id_der-----------id_momentum------id_lat_force------vs----------b_b--------------value
Walther@60736
   308
  Note: while the sequence of formal arguments tries to follow the sequence of items in the models
Walther@60736
   309
    (also the models of the SubProblems),
Walther@60736
   310
    the fairly liberal <fun relate_args> shifts b_b to the end -----------------------------------------^^^
Walther@60736
   311
*)
wneuper@59504
   312
  where
Walther@60736
   313
"biegelinie l_l q_q r_b fun_var id_der id_momentum id_lat_force vs  b_b = (
walther@59635
   314
  let
wneuper@59504
   315
    funs = SubProblem (''Biegelinie'', [''vonBelastungZu'', ''Biegelinien''],
walther@60023
   316
      [''Biegelinien'', ''ausBelastung''])
Walther@60736
   317
        [REAL q_q, REAL fun_var, REAL_REAL b_b, REAL_REAL id_der, REAL_REAL id_momentum, REAL_REAL id_lat_force];
wneuper@59504
   318
    equs = SubProblem (''Biegelinie'', [''setzeRandbedingungen'', ''Biegelinien''],
Walther@60710
   319
      [''Biegelinien'', ''setzeRandbedingungenEin'']) [BOOL_LIST funs, BOOL_LIST r_b];
walther@59635
   320
    cons = SubProblem (''Biegelinie'', [''LINEAR'', ''system''],
walther@59635
   321
      [''no_met'']) [BOOL_LIST equs, REAL_LIST vs];
wneuper@59504
   322
    B = Take (lastI funs);
walther@60023
   323
    B = ((Substitute cons) #> (Rewrite_Set_Inst [(''bdv'', fun_var)] ''make_ratpoly_in'')) B
wneuper@59504
   324
  in B)"
wenzelm@60303
   325
wenzelm@60303
   326
method met_biege_2 : "IntegrierenUndKonstanteBestimmen2" =
Walther@60586
   327
  \<open>{rew_ord="tless_true",
walther@60358
   328
    rls' = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty [
walther@60358
   329
      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
walther@60358
   330
      \<^rule_thm>\<open>not_true\<close>,
walther@60358
   331
      \<^rule_thm>\<open>not_false\<close>], 
wenzelm@60303
   332
    calc = [], 
Walther@60586
   333
    prog_rls = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty [
walther@60358
   334
      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
walther@60358
   335
      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
walther@60358
   336
      \<^rule_thm>\<open>last_thmI\<close>,
walther@60358
   337
      \<^rule_thm>\<open>if_True\<close>,
walther@60358
   338
      \<^rule_thm>\<open>if_False\<close>],
Walther@60587
   339
    where_rls = Rule_Set.Empty, errpats = [], rew_rls = Rule_Set.Empty}\<close>
wenzelm@60303
   340
  Program: biegelinie.simps
Walther@60710
   341
  Given: "Traegerlaenge l_l" "Streckenlast q_q"
Walther@60736
   342
    (*OLD "FunktionsVariable fun_var" "GleichungsVariablen vs" "AbleitungBiegelinie id_der"*)
Walther@60710
   343
  (* Where: "0 < l_l" ...wait for &lt; and handling Arbfix*)
Walther@60736
   344
    "Randbedingungen r_b"
Walther@60736
   345
  (* Items for MethodC "IntegrierenUndKonstanteBestimmen2" *)
Walther@60736
   346
    (*NEW*)"FunktionsVariable fun_var"
Walther@60736
   347
      "AbleitungBiegelinie id_der" "Biegemoment id_momentum" "Querkraft id_lat_force"
Walther@60736
   348
  (* Item for Problem "LINEAR/system", which by [''no_met''] involves refinement *)
Walther@60736
   349
    "GleichungsVariablen vs"(*NEW*)
Walther@60710
   350
  Find: "Biegelinie b_b"
wenzelm@60303
   351
wenzelm@60303
   352
method met_biege_intconst_2 : "IntegrierenUndKonstanteBestimmen/2xIntegrieren" =
Walther@60587
   353
  \<open>{rew_ord="tless_true", rls'=Rule_Set.Empty, calc = [], prog_rls = Rule_Set.empty, where_rls=Rule_Set.empty,
Walther@60586
   354
    errpats = [], rew_rls = Rule_Set.empty}\<close>
wenzelm@60303
   355
wenzelm@60303
   356
method met_biege_intconst_4 : "IntegrierenUndKonstanteBestimmen/4x4System" =
Walther@60587
   357
  \<open>{rew_ord="tless_true", rls'=Rule_Set.Empty, calc = [], prog_rls = Rule_Set.empty, where_rls=Rule_Set.empty,
Walther@60586
   358
    errpats = [], rew_rls = Rule_Set.empty}\<close>
wenzelm@60303
   359
wenzelm@60303
   360
method met_biege_intconst_1 : "IntegrierenUndKonstanteBestimmen/1xIntegrieren" =
Walther@60587
   361
  \<open>{rew_ord="tless_true", rls'=Rule_Set.Empty, calc = [], prog_rls = Rule_Set.empty, where_rls=Rule_Set.empty,
Walther@60586
   362
    errpats = [], rew_rls = Rule_Set.empty}\<close>
wenzelm@60303
   363
wenzelm@60303
   364
method met_biege2 : "Biegelinien" =
Walther@60587
   365
  \<open>{rew_ord="tless_true", rls'=Rule_Set.Empty, calc = [], prog_rls = Rule_Set.empty, where_rls=Rule_Set.empty,
Walther@60586
   366
    errpats = [], rew_rls = Rule_Set.empty}\<close>
wenzelm@60303
   367
wenzelm@60303
   368
walther@60023
   369
subsection \<open>Sub-problem "integrate and determine constants", nicely modularised\<close>
wneuper@59429
   370
walther@59998
   371
partial_function (tailrec) belastung_zu_biegelinie ::
Walther@60736
   372
(* Streckenlast     Biegelinie                                                           Funktionen
Walther@60736
   373
           FunktionsVariable         AbleitungBiegelinie       
Walther@60736
   374
                                                      id_lateral_force  id_momentum               *)
Walther@60736
   375
  "real \<Rightarrow> real \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> bool list"
Walther@60736
   376
(* q__q----v_v------b_b--------------id_der-----------id_momentum-------id_lat_force-----value*)
wneuper@59504
   377
  where
Walther@60736
   378
"belastung_zu_biegelinie q__q v_v b_b id_der id_momentum id_lat_force = (
walther@59635
   379
  let
walther@59635
   380
    q___q = Take (qq v_v = q__q);
walther@59635
   381
    q___q = (
walther@59637
   382
      (Rewrite ''sym_neg_equal_iff_equal'') #>
walther@59635
   383
      (Rewrite ''Belastung_Querkraft'')) q___q;
walther@59635
   384
    Q__Q = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
Walther@60736
   385
      [''diff'', ''integration'', ''named'']) [REAL (rhs q___q), REAL v_v, REAL_REAL id_lat_force];
walther@59635
   386
    M__M = Rewrite ''Querkraft_Moment'' Q__Q;
walther@59635
   387
    M__M = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
Walther@60736
   388
      [''diff'', ''integration'', ''named'']) [REAL (rhs M__M), REAL v_v, REAL_REAL id_momentum];
walther@59635
   389
    N__N = (
walther@59637
   390
      (Rewrite ''Moment_Neigung'' ) #> (Rewrite ''make_fun_explicit'' )) M__M;
walther@59635
   391
    N__N = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
walther@60023
   392
      [''diff'', ''integration'', ''named'']) [REAL (rhs N__N), REAL v_v, REAL_REAL id_der];
walther@59635
   393
    B__B = SubProblem (''Biegelinie'', [''named'', ''integrate'', ''function''],
Walther@60710
   394
      [''diff'', ''integration'', ''named'']) [REAL (rhs N__N), REAL v_v, REAL_REAL b_b]
walther@59635
   395
  in
walther@59998
   396
    [Q__Q, M__M, N__N, B__B])"  (*..Q is Const Querkraft    -------------------------^ *)
wenzelm@60303
   397
wenzelm@60303
   398
method met_biege_ausbelast : "Biegelinien/ausBelastung" =
Walther@60586
   399
  \<open>{rew_ord="tless_true", 
walther@60358
   400
    rls' = Rule_Set.append_rules "erls_ausBelastung" Rule_Set.empty [
walther@60358
   401
      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
walther@60358
   402
      \<^rule_thm>\<open>not_true\<close>,
walther@60358
   403
      \<^rule_thm>\<open>not_false\<close>],
wenzelm@60303
   404
    calc = [], 
Walther@60586
   405
    prog_rls = Rule_Set.append_rules "srls_ausBelastung" Rule_Set.empty [
walther@60358
   406
      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs "eval_rhs_")],
Walther@60587
   407
    where_rls = Rule_Set.empty, errpats = [], rew_rls = Rule_Set.empty}\<close>
wenzelm@60303
   408
  Program: belastung_zu_biegelinie.simps
Walther@60710
   409
  Given: "Streckenlast q__q" "FunktionsVariable v_v" "Biegelinie b_b" "AbleitungBiegelinie id_der"
Walther@60736
   410
         (*NEW*)"Biegemoment id_momentum" "Querkraft id_lat_force"(*NEW*)
wenzelm@60303
   411
  Find: "Funktionen fun_s"
wenzelm@60303
   412
wneuper@59429
   413
subsection \<open>Substitute the constraints into the equations\<close>
wneuper@59429
   414
wneuper@59504
   415
partial_function (tailrec) setzte_randbedingungen :: "bool list \<Rightarrow> bool list \<Rightarrow> bool list"
wneuper@59504
   416
  where 
walther@59635
   417
"setzte_randbedingungen fun_s r_b = (
walther@59635
   418
  let
walther@59635
   419
    b_1 = NTH 1 r_b;
walther@59635
   420
    f_s = filter_sameFunId (lhs b_1) fun_s;
walther@59635
   421
    e_1 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
walther@59635
   422
            [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_1];
walther@59635
   423
    b_2 = NTH 2 r_b;
walther@59635
   424
    f_s = filter_sameFunId (lhs b_2) fun_s;
walther@59635
   425
    e_2 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
walther@59635
   426
             [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_2];
walther@59635
   427
    b_3 = NTH 3 r_b;
walther@59635
   428
    f_s = filter_sameFunId (lhs b_3) fun_s;
walther@59635
   429
    e_3 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
walther@59635
   430
             [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_3];
walther@59635
   431
    b_4 = NTH 4 r_b;
walther@59635
   432
    f_s = filter_sameFunId (lhs b_4) fun_s;
walther@59635
   433
    e_4 = SubProblem (''Biegelinie'', [''makeFunctionTo'', ''equation''],
walther@59635
   434
             [''Equation'', ''fromFunction'']) [BOOL (hd f_s), BOOL b_4]
walther@59635
   435
  in
walther@59635
   436
    [e_1, e_2, e_3, e_4])"
wenzelm@60303
   437
wenzelm@60303
   438
method met_biege_setzrand : "Biegelinien/setzeRandbedingungenEin" =
Walther@60587
   439
  \<open>{rew_ord="tless_true", rls'=Rule_Set.Empty, calc = [], prog_rls = srls2, where_rls=Rule_Set.empty,
Walther@60586
   440
    errpats = [], rew_rls = Rule_Set.empty}\<close>
wenzelm@60303
   441
  Program: setzte_randbedingungen.simps
wenzelm@60303
   442
  Given: "Funktionen fun_s" "Randbedingungen r_b"
wenzelm@60303
   443
  Find: "Gleichungen equs'''"
wenzelm@60303
   444
wenzelm@60303
   445
wneuper@59429
   446
subsection \<open>Transform an equality into a function\<close>
wneuper@59429
   447
walther@60242
   448
        (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x \<up> 2) (M_b L = 0) -->
walther@60242
   449
               0 = c_2 + c * L + -1 * q_0 / 2 * L \<up> 2*)
wneuper@59504
   450
partial_function (tailrec) function_to_equality :: "bool \<Rightarrow> bool \<Rightarrow> bool"
wneuper@59504
   451
  where
walther@59635
   452
"function_to_equality fu_n su_b = (
walther@59635
   453
  let
walther@59635
   454
    fu_n = Take fu_n;
walther@59635
   455
    bd_v = argument_in (lhs fu_n);
walther@59635
   456
    va_l = argument_in (lhs su_b);
walther@60242
   457
    eq_u = Substitute [bd_v = va_l] fu_n; \<comment> \<open>([1], Res), M_b L = c_2 + c * L + -1 * q_0 / 2 * L \<up> 2\<close>
walther@59635
   458
    eq_u = Substitute [su_b] eq_u
walther@59635
   459
  in
walther@59635
   460
    (Rewrite_Set ''norm_Rational'') eq_u)"
wenzelm@60303
   461
wenzelm@60303
   462
method met_equ_fromfun : "Equation/fromFunction" =
Walther@60586
   463
  \<open>{rew_ord="tless_true", rls'=Rule_Set.Empty, calc = [],
Walther@60586
   464
    prog_rls = Rule_Set.append_rules "srls_in_EquationfromFunc" Rule_Set.empty [
walther@60358
   465
      \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
walther@60358
   466
      \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in")],
Walther@60587
   467
    where_rls=Rule_Set.empty, errpats = [], rew_rls = Rule_Set.empty}\<close>
wenzelm@60303
   468
  Program: function_to_equality.simps
wenzelm@60303
   469
  (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x \<up> 2) (M_b L = 0) -->
wenzelm@60303
   470
         0 = c_2 + c * L + -1 * q_0 / 2 * L \<up> 2*)
wenzelm@60303
   471
  Given: "functionEq fu_n" "substitution su_b"
wenzelm@60303
   472
  Find: "equality equ'''"
wenzelm@60303
   473
wneuper@59549
   474
ML \<open>
wneuper@59549
   475
\<close> ML \<open>
walther@60278
   476
\<close> ML \<open>
wneuper@59549
   477
\<close>
neuper@37906
   478
end
neuper@37906
   479