src/Tools/isac/Knowledge/Equation.thy
author wneuper <Walther.Neuper@jku.at>
Mon, 30 Jan 2023 12:11:40 +0100
changeset 60661 91c30b11e5bc
parent 60658 1c089105f581
permissions -rw-r--r--
cleanup parse #4: eliminate TermC.parse
neuper@37906
     1
(* equations and functions; functions NOT as lambda-terms
neuper@37906
     2
   author: Walther Neuper 2005, 2006
neuper@37906
     3
   (c) due to copyright terms
neuper@37906
     4
*)
neuper@37906
     5
wneuper@59424
     6
theory Equation imports Base_Tools begin
neuper@37906
     7
wneuper@59472
     8
text \<open>univariate equations over terms :
neuper@42398
     9
  In 2003 Richard Lang prototyped ISAC's equation solver while also alpha-testing
neuper@42398
    10
  the Lucas-Interpreter's Subproblem mechanism.
neuper@42398
    11
  This prototype suffers from the drop-out of Matthias Goldgruber for a year,
neuper@42398
    12
  who had started to work on simplification in parallel. So this implementation
neuper@42398
    13
  replaced simplifiers by many specific theorems for specific terms in specific
neuper@42398
    14
  phases of equation solving; these specific solutions wait for generalisation
neuper@42398
    15
  in future improvements of ISAC's equation solver.
wneuper@59472
    16
\<close>
neuper@42398
    17
neuper@37906
    18
consts
neuper@37906
    19
neuper@37906
    20
  (*descriptions in the related problems TODOshift here from Descriptions.thy*)
neuper@37950
    21
  substitution      :: "bool => una"
neuper@37906
    22
neuper@37906
    23
  (*the CAS-commands*)
walther@60417
    24
  solve             :: "[bool * real] => bool list"(*solveFor ::"real => una"; eg.solve (x+1=2, x)*)
neuper@37950
    25
  solveTest         :: "[bool * 'a] => bool list" (* for test collection *)
neuper@37906
    26
  
wneuper@59472
    27
text \<open>defines equation and univariate-equation
neuper@37950
    28
        created by: rlang 
neuper@37950
    29
              date: 02.09
neuper@37950
    30
        changed by: rlang
neuper@37950
    31
        last change by: rlang
neuper@37950
    32
                  date: 02.11.29
wneuper@59472
    33
        (c) by Richard Lang, 2003\<close>
neuper@37950
    34
wneuper@59472
    35
ML \<open>
neuper@37950
    36
val univariate_equation_prls = 
walther@60358
    37
  Rule_Set.append_rules "univariate_equation_prls" Rule_Set.empty 
walther@60358
    38
	  [\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
wneuper@59472
    39
\<close>
wenzelm@60289
    40
rule_set_knowledge univariate_equation_prls = \<open>Auto_Prog.prep_rls @{theory} univariate_equation_prls\<close>
neuper@37950
    41
wenzelm@60306
    42
problem pbl_equ : "equation" =
wenzelm@60306
    43
  \<open>Rule_Set.append_rules "equation_prls" Rule_Set.empty
wenzelm@60306
    44
    [\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")]\<close>
wenzelm@60306
    45
  CAS: "solve (e_e::bool, v_v)"
wenzelm@60306
    46
  Given: "equality e_e" "solveFor v_v"
wenzelm@60306
    47
  Where: "matches (?a = ?b) e_e"
wenzelm@60306
    48
  Find: "solutions v_v'i'"
wenzelm@60306
    49
wenzelm@60306
    50
problem pbl_equ_univ : "univariate/equation" =
wenzelm@60306
    51
  \<open>univariate_equation_prls\<close>
wenzelm@60306
    52
  CAS: "solve (e_e::bool, v_v)"
wenzelm@60306
    53
  Given: "equality e_e" "solveFor v_v"
wenzelm@60306
    54
  Where: "matches (?a = ?b) e_e"
wenzelm@60306
    55
  Find: "solutions v_v'i'"
neuper@37950
    56
wneuper@59472
    57
ML\<open>
Walther@60602
    58
(* function for handling the cas-input "solve (x+1=2, x)":
Walther@60603
    59
   make a model which is already in ctree-internal format *)
wenzelm@60309
    60
fun argl2dtss [Const (\<^const_name>\<open>Pair\<close>, _) $ eq $ bdv] =
Walther@60661
    61
    [(ParseC.term_opt \<^context> "equality" |> the, [eq]),
Walther@60661
    62
     (ParseC.term_opt \<^context> "solveFor" |> the, [bdv]),
Walther@60661
    63
     (ParseC.term_opt \<^context> "solutions" |> the, 
Walther@60661
    64
      [ParseC.term_opt\<^context> "L" |> the])
neuper@37950
    65
     ]
walther@59962
    66
  | argl2dtss _ = raise ERROR "Equation.ML: wrong argument for argl2dtss";
wneuper@59472
    67
\<close>
wenzelm@60314
    68
cas solveTest = \<open>argl2dtss\<close>
Walther@60449
    69
  Theory_Ref: Test
Walther@60449
    70
  Problem_Ref: "univariate/equation/test"
wenzelm@60314
    71
cas solve = \<open>argl2dtss\<close>
Walther@60449
    72
  Problem_Ref: "univariate/equation"
neuper@37950
    73
wenzelm@60303
    74
method met_equ : "Equation" =
Walther@60586
    75
  \<open>{rew_ord = "tless_true", rls' = Rule_Set.Empty, calc = [], prog_rls = Rule_Set.empty, 
Walther@60587
    76
    where_rls=Rule_Set.empty, errpats = [], rew_rls = Rule_Set.empty}\<close>
neuper@37950
    77
wenzelm@60303
    78
ML \<open>
walther@60278
    79
\<close> ML \<open>
wneuper@59472
    80
\<close>
walther@60417
    81
end