neuper@41921
|
1 |
theory DiophantEq imports Atools Equation begin
|
neuper@41921
|
2 |
|
neuper@41921
|
3 |
consts
|
neuper@41921
|
4 |
Solve'_lineq'_equation :: "[bool, int, bool ]
|
neuper@41921
|
5 |
=> bool "
|
neuper@41921
|
6 |
("((Script Diophant'_equation (_ _ =))//(_))" 9)
|
neuper@41921
|
7 |
axioms
|
neuper@41921
|
8 |
|
neuper@41921
|
9 |
int_isolate_add: "(bdv + a = b) = (bdv = b - (a::int))"
|
neuper@41921
|
10 |
|
neuper@41921
|
11 |
ML {*
|
neuper@41921
|
12 |
val thy = @{theory};
|
neuper@41921
|
13 |
val ctxt = ProofContext.init_global thy;
|
neuper@41921
|
14 |
fun parseNEW ctxt str = numbers_to_string (Syntax.read_term ctxt str);
|
neuper@41921
|
15 |
parseNEW ctxt "x = (1::int)"; (*TODO omit ::int*)
|
neuper@41921
|
16 |
*}
|
neuper@41921
|
17 |
|
neuper@41921
|
18 |
ML {*
|
neuper@41921
|
19 |
store_pbt
|
neuper@41921
|
20 |
(prep_pbt thy "pbl_equ_dio" [] e_pblID
|
neuper@41921
|
21 |
(["diophantine","equation"],
|
neuper@41921
|
22 |
[("#Given" ,["boolTestGiven e_e","intTestGiven (v_v::int)"]),
|
neuper@41921
|
23 |
(* TODO: drop ^^^^^*)
|
neuper@41921
|
24 |
("#Where" ,[]),
|
neuper@41921
|
25 |
("#Find" ,["boolTestFind s_s"])
|
neuper@41921
|
26 |
],
|
neuper@41921
|
27 |
e_rls, SOME "solve (e_e::bool, v_v::int)",
|
neuper@41921
|
28 |
[["LinEq","solve_lineq_equation"]])); (*-----TODO*)
|
neuper@41921
|
29 |
show_ptyps();
|
neuper@41921
|
30 |
get_pbt ["diophantine","equation"];
|
neuper@41921
|
31 |
*}
|
neuper@41921
|
32 |
|
neuper@41921
|
33 |
ML {*
|
neuper@41921
|
34 |
val subst = [(parseNEW ctxt "bdv::int", parseNEW ctxt "x::int")];
|
neuper@41921
|
35 |
val t = parseNEW ctxt "x + 1 = (2::int)";
|
neuper@41921
|
36 |
*}
|
neuper@41921
|
37 |
|
neuper@41921
|
38 |
ML {*
|
neuper@41921
|
39 |
tracing "\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>\<equiv>";
|
neuper@41921
|
40 |
rewrite_inst_ thy e_rew_ord e_rls true subst (@{thm "int_isolate_add"}) t;
|
neuper@41921
|
41 |
|
neuper@41921
|
42 |
|
neuper@41921
|
43 |
*}
|
neuper@41921
|
44 |
|
neuper@41921
|
45 |
ML {*
|
neuper@41921
|
46 |
prop_of (@{thm "int_isolate_add"});
|
neuper@41921
|
47 |
writeln "-----------";
|
neuper@41921
|
48 |
t;
|
neuper@41921
|
49 |
*}
|
neuper@41921
|
50 |
|
neuper@41921
|
51 |
end |