src/Tools/isac/Knowledge/DiophantEq.thy
author wenzelm
Thu, 10 Jun 2021 12:48:50 +0200
changeset 60291 52921aa0e14a
parent 60290 bb4e8b01b072
child 60303 815b0dc8b589
permissions -rw-r--r--
clarified theory context: avoid global "val thy = ..." hanging around (left-over from Isabelle2005), which is apt to various pitfalls;
     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 text \<open>problemclass for the usecase\<close>
    15 setup \<open>KEStore_Elems.add_pbts
    16   [(Problem.prep_input @{theory} "pbl_equ_dio" [] Problem.id_empty
    17       (["diophantine", "equation"],
    18         [("#Given" ,["boolTestGiven e_e", "intTestGiven (v_v::int)"]),
    19           (*                                      TODO: drop ^^^^^*)
    20           ("#Where" ,[]),
    21           ("#Find"  ,["boolTestFind s_s"])],
    22         Rule_Set.empty, SOME "solve (e_e::bool, v_v::int)", [["LinEq", "solve_lineq_equation"]]))]\<close>
    23 
    24 text \<open>method solving the usecase\<close>
    25 
    26 partial_function (tailrec) diophant_equation :: "bool => int => bool"
    27   where
    28 "diophant_equation e_e v_v = (
    29   Repeat (
    30     (Try (Rewrite_Inst [(''bdv'', v_v)] ''int_isolate_add'' )) #>
    31     (Try (Calculate ''PLUS'')) #>
    32     (Try (Calculate ''TIMES''))) e_e)"
    33 setup \<open>KEStore_Elems.add_mets
    34     [MethodC.prep_input @{theory} "met_test_diophant" [] MethodC.id_empty
    35       (["Test", "solve_diophant"],
    36         [("#Given" ,["boolTestGiven e_e", "intTestGiven (v_v::int)"]),
    37           (*                                      TODO: drop ^^^^^*)
    38           ("#Where" ,[]),
    39           ("#Find"  ,["boolTestFind s_s"])],
    40         {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.empty, prls = Rule_Set.empty, calc = [],
    41           crls = tval_rls, errpats = [], nrls = Test_simplify},
    42         @{thm diophant_equation.simps})]
    43 \<close> ML \<open>
    44 \<close> ML \<open>
    45 \<close>
    46 
    47 end