1 (* Title: "Interpret/lucas-interpreter.sml"
3 (c) due to copyright terms
6 "-----------------------------------------------------------------------------------------------";
7 "table of contents -----------------------------------------------------------------------------";
8 "-----------------------------------------------------------------------------------------------";
9 "----------- note on new realpow ------- -------------------------------------------------------";
10 "-----------------------------------------------------------------------------------------------";
11 "-----------------------------------------------------------------------------------------------";
12 "-----------------------------------------------------------------------------------------------";
14 "----------- note on new realpow ------- -------------------------------------------------------";
15 "----------- note on new realpow ------- -------------------------------------------------------";
16 "----------- note on new realpow ------- -------------------------------------------------------";
18 (* these and other numeral calculations have been accomplished by Simplifier.rewrite so far *)
20 val t = Calc_Binop.simplify @{context} @{term "4 * - 1 * 4 ::real"};
21 if UnparseC.term @{context} t = "- 16"
22 then () else error "calcul 4 * - 1 * 4 \<longrightarrow> - 16";
25 guess: simp_ctxt is not sufficient for simplifying the conditions in the definition -- RIGHT.
26 note: missing cases, defined in lemma realpow_uminus_simps, go via [simp] into simp_ctxt.
28 val t = Calc_Binop.simplify @{context} @{term "4 \<up> 2 ::real"};
29 if UnparseC.term @{context} t = "16"
30 then () else error "calcul 4 \<up> 2 \<longrightarrow> 16";
32 val t = Calc_Binop.simplify @{context} @{term "(- 1) \<up> 2"};
33 if UnparseC.term @{context} t = "1"
34 then () else error "calcul (- 1) \<up> 2 \<longrightarrow> 1";
36 val t = Calc_Binop.simplify @{context} @{term "3 \<up> (- 2)"};
37 if UnparseC.term @{context} t = "1 / 9"
38 then () else error "calcul 3 \<up> (- 2) \<longrightarrow> 1 / 9";
40 val t = Calc_Binop.simplify @{context} @{term "3 \<up> - 1"};
41 if UnparseC.term @{context} t = "1 / 3"
42 then () else error "calcul 3 \<up> - 1 \<longrightarrow> 1 / 3";
44 (* note on example "4 * - 1 * 4 \<up> 2 \<le> 8 * (- 1) \<up> 2" *)
46 fun Calc_Binop.simplify should simplify both sides of the inequality.
47 Afterwards the inequality - 64 \<le> 8 should evaluate to True.
51 Eval.get_pair for "BaseDefinitions.realpow" \<longrightarrow> SOME (_, "4 \<up> 2 = 4 \<up> 2")
52 but rewrite__ on "4 * - 1 * 4 \<up> 2 \<le> 8 * (- 1) \<up> 2" \<longrightarrow> NONE
54 The error occurs while rewriting and expecting \<longrightarrow> SOME (_, "4 \<up> 2 = 16");
55 the rewriter takes the rhs 4 \<up> 2, the same as the lhs,
56 and assumes to be able to simplify, but we have lhs = rhs \<longrightarrow> NONE,
57 which is recognised by the rewriter as an error.
59 Eval.get_pair ensures, that only pairs of numerals are passed to fun Calc_Binop.simplify,
60 such that single-stepping is realised, although Simplifier.rewrite could do all at once.
62 \<le> is a binary operator, too, but has another signature as algebraic operations.
63 So \<le> is handled separately and not by fun Calc_Binop.simplify.