src/Tools/isac/Knowledge/DiophantEq.thy
author wneuper <walther.neuper@jku.at>
Fri, 07 May 2021 18:12:51 +0200
changeset 60278 343efa173023
parent 60154 2ab0d1523731
child 60290 bb4e8b01b072
permissions -rw-r--r--
* WN: simplify const names like "is'_expanded"
     1 (* Title:  Knowledge/DiophantEq.thy
     2    Author: Mathias Lehnfeld 2011
     3    (c) due to copyright terms
     4 12345678901234567890123456789012345678901234567890123456789012345678901234567890
     5         10        20        30        40        50        60        70        80
     6 *)
     7 
     8 theory DiophantEq imports Base_Tools Equation Test
     9 begin
    10 
    11 axiomatization where
    12   int_isolate_add: "(bdv + a = b) = (bdv = b + (-1)*(a::int))"
    13 
    14 ML \<open>val thy = @{theory}\<close>
    15 
    16 text \<open>problemclass for the usecase\<close>
    17 setup \<open>KEStore_Elems.add_pbts
    18   [(Problem.prep_input thy "pbl_equ_dio" [] Problem.id_empty
    19       (["diophantine", "equation"],
    20         [("#Given" ,["boolTestGiven e_e", "intTestGiven (v_v::int)"]),
    21           (*                                      TODO: drop ^^^^^*)
    22           ("#Where" ,[]),
    23           ("#Find"  ,["boolTestFind s_s"])],
    24         Rule_Set.empty, SOME "solve (e_e::bool, v_v::int)", [["LinEq", "solve_lineq_equation"]]))]\<close>
    25 
    26 text \<open>method solving the usecase\<close>
    27 
    28 partial_function (tailrec) diophant_equation :: "bool => int => bool"
    29   where
    30 "diophant_equation e_e v_v = (
    31   Repeat (
    32     (Try (Rewrite_Inst [(''bdv'', v_v)] ''int_isolate_add'' )) #>
    33     (Try (Calculate ''PLUS'')) #>
    34     (Try (Calculate ''TIMES''))) e_e)"
    35 setup \<open>KEStore_Elems.add_mets
    36     [MethodC.prep_input thy "met_test_diophant" [] MethodC.id_empty
    37       (["Test", "solve_diophant"],
    38         [("#Given" ,["boolTestGiven e_e", "intTestGiven (v_v::int)"]),
    39           (*                                      TODO: drop ^^^^^*)
    40           ("#Where" ,[]),
    41           ("#Find"  ,["boolTestFind s_s"])],
    42         {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.empty, prls = Rule_Set.empty, calc = [],
    43           crls = tval_rls, errpats = [], nrls = Test_simplify},
    44         @{thm diophant_equation.simps})]
    45 \<close> ML \<open>
    46 \<close> ML \<open>
    47 \<close>
    48 
    49 end