src/Tools/isac/Knowledge/Equation.thy
author wenzelm
Mon, 21 Jun 2021 15:36:09 +0200
changeset 60309 70a1d102660d
parent 60306 51ec2e101e9f
child 60314 1cf9c607fa6a
permissions -rw-r--r--
more antiquotations for Isabelle/HOL consts/types, without change of semantics;
     1 (* equations and functions; functions NOT as lambda-terms
     2    author: Walther Neuper 2005, 2006
     3    (c) due to copyright terms
     4 *)
     5 
     6 theory Equation imports Base_Tools begin
     7 
     8 text \<open>univariate equations over terms :
     9   In 2003 Richard Lang prototyped ISAC's equation solver while also alpha-testing
    10   the Lucas-Interpreter's Subproblem mechanism.
    11   This prototype suffers from the drop-out of Matthias Goldgruber for a year,
    12   who had started to work on simplification in parallel. So this implementation
    13   replaced simplifiers by many specific theorems for specific terms in specific
    14   phases of equation solving; these specific solutions wait for generalisation
    15   in future improvements of ISAC's equation solver.
    16 \<close>
    17 
    18 consts
    19 
    20   (*descriptions in the related problems TODOshift here from Descriptions.thy*)
    21   substitution      :: "bool => una"
    22 
    23   (*the CAS-commands*)
    24   solve             :: "[bool * 'a] => bool list" (* solve (x+1=2, x) *)
    25   solveTest         :: "[bool * 'a] => bool list" (* for test collection *)
    26   
    27 text \<open>defines equation and univariate-equation
    28         created by: rlang 
    29               date: 02.09
    30         changed by: rlang
    31         last change by: rlang
    32                   date: 02.11.29
    33         (c) by Richard Lang, 2003\<close>
    34 
    35 ML \<open>
    36 val univariate_equation_prls = 
    37     Rule_Set.append_rules "univariate_equation_prls" Rule_Set.empty 
    38 	       [\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
    39 \<close>
    40 rule_set_knowledge univariate_equation_prls = \<open>Auto_Prog.prep_rls @{theory} univariate_equation_prls\<close>
    41 
    42 problem pbl_equ : "equation" =
    43   \<open>Rule_Set.append_rules "equation_prls" Rule_Set.empty
    44     [\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")]\<close>
    45   CAS: "solve (e_e::bool, v_v)"
    46   Given: "equality e_e" "solveFor v_v"
    47   Where: "matches (?a = ?b) e_e"
    48   Find: "solutions v_v'i'"
    49 
    50 problem pbl_equ_univ : "univariate/equation" =
    51   \<open>univariate_equation_prls\<close>
    52   CAS: "solve (e_e::bool, v_v)"
    53   Given: "equality e_e" "solveFor v_v"
    54   Where: "matches (?a = ?b) e_e"
    55   Find: "solutions v_v'i'"
    56 
    57 ML\<open>
    58 (*.function for handling the cas-input "solve (x+1=2, x)":
    59    make a model which is already in ctree-internal format.*)
    60 (* val (h,argl) = strip_comb (str2term "solve (x+1=2, x)");
    61    val (h,argl) = strip_comb ((Thm.term_of o the o (parse thy)) 
    62 				  "solveTest (x+1=2, x)");
    63    *)
    64 fun argl2dtss [Const (\<^const_name>\<open>Pair\<close>, _) $ eq $ bdv] =
    65     [((the o (TermC.parseNEW \<^context>)) "equality", [eq]),
    66      ((the o (TermC.parseNEW \<^context>)) "solveFor", [bdv]),
    67      ((the o (TermC.parseNEW \<^context>)) "solutions", 
    68       [(the o (TermC.parseNEW \<^context>)) "L"])
    69      ]
    70   | argl2dtss _ = raise ERROR "Equation.ML: wrong argument for argl2dtss";
    71 \<close>
    72 setup \<open>KEStore_Elems.add_cas
    73   [((Thm.term_of o the o (TermC.parse @{theory})) "solveTest", 
    74       (("Test", ["univariate", "equation", "test"], ["no_met"]), argl2dtss)),
    75     ((Thm.term_of o the o (TermC.parse @{theory})) "solve",
    76       (("Isac_Knowledge", ["univariate", "equation"], ["no_met"]), argl2dtss))]\<close>
    77 
    78 method met_equ : "Equation" =
    79   \<open>{rew_ord'="tless_true", rls'=Rule_Set.Empty, calc = [], srls = Rule_Set.empty, prls=Rule_Set.empty, crls = Atools_erls,
    80           errpats = [], nrls = Rule_Set.empty}\<close>
    81 
    82 ML \<open>
    83 \<close> ML \<open>
    84 \<close>
    85 end