| author | Achim D. Brucker <adbrucker@0x5f.org> |
| Mon, 25 Jul 2022 08:24:21 +0100 | |
| changeset 75799 | f1141438b4db |
| parent 70377 | 04f492d004fa |
| child 75800 | a21debbc7074 |
| permissions | -rw-r--r-- |
| 63355 | 1 |
(* Title: HOL/Library/Code_Real_Approx_By_Float.thy |
2 |
Author: Florian Haftmann |
|
3 |
Author: Johannes Hölzl |
|
4 |
Author: Tobias Nipkow |
|
5 |
*) |
|
| 45483 | 6 |
|
7 |
theory Code_Real_Approx_By_Float |
|
| 51542 | 8 |
imports Complex_Main Code_Target_Int |
| 45483 | 9 |
begin |
10 |
||
| 63355 | 11 |
text\<open> |
12 |
\<^bold>\<open>WARNING!\<close> This theory implements mathematical reals by machine reals |
|
13 |
(floats). This is inconsistent. See the proof of False at the end of the |
|
14 |
theory, where an equality on mathematical reals is (incorrectly) disproved |
|
15 |
by mapping it to machine reals. |
|
| 45483 | 16 |
|
| 63355 | 17 |
The \<^theory_text>\<open>value\<close> command cannot display real results yet. |
| 45483 | 18 |
|
| 63355 | 19 |
The only legitimate use of this theory is as a tool for code generation |
20 |
purposes. |
|
21 |
\<close> |
|
| 45483 | 22 |
|
|
75799
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
23 |
definition Realfract :: \<open>real \<Rightarrow> real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
24 |
where \<open>Realfract p q = p / q\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
25 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
26 |
code_datatype Realfract |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
27 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
28 |
context |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
29 |
begin |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
30 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
31 |
qualified definition real_of_int :: \<open>int \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
32 |
where [code_abbrev]: \<open>real_of_int = of_int\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
33 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
34 |
qualified definition real_of_integer :: "integer \<Rightarrow> real" |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
35 |
where [code_abbrev]: "real_of_integer = of_int \<circ> int_of_integer" |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
36 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
37 |
lemma [code]: "real_of_int = real_of_integer \<circ> integer_of_int" |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
38 |
by (simp add: fun_eq_iff real_of_integer_def real_of_int_def) |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
39 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
40 |
qualified definition exp_real :: \<open>real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
41 |
where [code_abbrev, code del]: \<open>exp_real = exp\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
42 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
43 |
qualified definition sin_real :: \<open>real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
44 |
where [code_abbrev, code del]: \<open>sin_real = sin\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
45 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
46 |
qualified definition cos_real :: \<open>real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
47 |
where [code_abbrev, code del]: \<open>cos_real = cos\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
48 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
49 |
end |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
50 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
51 |
definition Quotreal :: \<open>int \<Rightarrow> int \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
52 |
where \<open>Quotreal p q = Realfract (of_int p) (of_int q)\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
53 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
54 |
lemma [code]: "Ratreal r = case_prod Quotreal (quotient_of r)" |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
55 |
by (cases r) (simp add: Realfract_def Quotreal_def quotient_of_Fract of_rat_rat) |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
56 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
57 |
lemma [code]: \<open>inverse r = 1 / r\<close> for r :: real |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
58 |
by (fact inverse_eq_divide) |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
59 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
60 |
lemma [code_unfold del]: "numeral k \<equiv> real_of_rat (numeral k)" |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
61 |
by simp |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
62 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
63 |
lemma [code_unfold del]: "- numeral k \<equiv> real_of_rat (- numeral k)" |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
64 |
by simp |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
65 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
66 |
declare [[code drop: \<open>HOL.equal :: real \<Rightarrow> real \<Rightarrow> bool\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
67 |
\<open>plus :: real \<Rightarrow> real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
68 |
\<open>uminus :: real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
69 |
\<open>minus :: real \<Rightarrow> real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
70 |
\<open>times :: real \<Rightarrow> real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
71 |
\<open>divide :: real \<Rightarrow> real \<Rightarrow> real\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
72 |
\<open>(<) :: real \<Rightarrow> real \<Rightarrow> bool\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
73 |
\<open>(\<le>) :: real \<Rightarrow> real \<Rightarrow> bool\<close> |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
74 |
sqrt \<open>ln :: real \<Rightarrow> real\<close> pi |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
75 |
arcsin arccos arctan]] |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
76 |
|
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
77 |
code_reserved SML Real |
|
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
78 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
79 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
80 |
type_constructor real \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
81 |
(SML) "real" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
82 |
and (OCaml) "float" |
| 45483 | 83 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
84 |
code_printing |
|
75799
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
85 |
constant Realfract \<rightharpoonup> (SML) "_/ '// _" |
| 45483 | 86 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
87 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
88 |
constant "0 :: real" \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
89 |
(SML) "0.0" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
90 |
and (OCaml) "0.0" |
| 45483 | 91 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
92 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
93 |
constant "1 :: real" \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
94 |
(SML) "1.0" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
95 |
and (OCaml) "1.0" |
| 45483 | 96 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
97 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
98 |
constant "HOL.equal :: real \<Rightarrow> real \<Rightarrow> bool" \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
99 |
(SML) "Real.== ((_), (_))" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
100 |
and (OCaml) "Pervasives.(=)" |
| 45483 | 101 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
102 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
103 |
constant "Orderings.less_eq :: real \<Rightarrow> real \<Rightarrow> bool" \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
104 |
(SML) "Real.<= ((_), (_))" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
105 |
and (OCaml) "Pervasives.(<=)" |
| 45483 | 106 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
107 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
108 |
constant "Orderings.less :: real \<Rightarrow> real \<Rightarrow> bool" \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
109 |
(SML) "Real.< ((_), (_))" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
110 |
and (OCaml) "Pervasives.(<)" |
| 45483 | 111 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
112 |
code_printing |
| 67399 | 113 |
constant "(+) :: real \<Rightarrow> real \<Rightarrow> real" \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
114 |
(SML) "Real.+ ((_), (_))" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
115 |
and (OCaml) "Pervasives.( +. )" |
| 45483 | 116 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
117 |
code_printing |
|
69064
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents:
67399
diff
changeset
|
118 |
constant "(*) :: real \<Rightarrow> real \<Rightarrow> real" \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
119 |
(SML) "Real.* ((_), (_))" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
120 |
and (OCaml) "Pervasives.( *. )" |
| 45483 | 121 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
122 |
code_printing |
| 67399 | 123 |
constant "(-) :: real \<Rightarrow> real \<Rightarrow> real" \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
124 |
(SML) "Real.- ((_), (_))" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
125 |
and (OCaml) "Pervasives.( -. )" |
| 45483 | 126 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
127 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
128 |
constant "uminus :: real \<Rightarrow> real" \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
129 |
(SML) "Real.~" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
130 |
and (OCaml) "Pervasives.( ~-. )" |
| 45483 | 131 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
132 |
code_printing |
| 67399 | 133 |
constant "(/) :: real \<Rightarrow> real \<Rightarrow> real" \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
134 |
(SML) "Real.'/ ((_), (_))" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
135 |
and (OCaml) "Pervasives.( '/. )" |
| 45483 | 136 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
137 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
138 |
constant "sqrt :: real \<Rightarrow> real" \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
139 |
(SML) "Math.sqrt" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
140 |
and (OCaml) "Pervasives.sqrt" |
|
61115
3a4400985780
modernized name space management -- more uniform qualification;
wenzelm
parents:
60500
diff
changeset
|
141 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
142 |
code_printing |
|
75799
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
143 |
constant Code_Real_Approx_By_Float.exp_real \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
144 |
(SML) "Math.exp" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
145 |
and (OCaml) "Pervasives.exp" |
| 45483 | 146 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
147 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
148 |
constant ln \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
149 |
(SML) "Math.ln" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
150 |
and (OCaml) "Pervasives.ln" |
| 45483 | 151 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
152 |
code_printing |
|
75799
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
153 |
constant Code_Real_Approx_By_Float.cos_real \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
154 |
(SML) "Math.cos" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
155 |
and (OCaml) "Pervasives.cos" |
| 45483 | 156 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
157 |
code_printing |
|
75799
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
158 |
constant Code_Real_Approx_By_Float.sin_real \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
159 |
(SML) "Math.sin" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
160 |
and (OCaml) "Pervasives.sin" |
| 45483 | 161 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
162 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
163 |
constant pi \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
164 |
(SML) "Math.pi" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
165 |
and (OCaml) "Pervasives.pi" |
| 45483 | 166 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
167 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
168 |
constant arctan \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
169 |
(SML) "Math.atan" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
170 |
and (OCaml) "Pervasives.atan" |
| 45483 | 171 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
172 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
173 |
constant arccos \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
174 |
(SML) "Math.scos" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
175 |
and (OCaml) "Pervasives.acos" |
| 45483 | 176 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
177 |
code_printing |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
178 |
constant arcsin \<rightharpoonup> |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
179 |
(SML) "Math.asin" |
|
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
180 |
and (OCaml) "Pervasives.asin" |
| 45483 | 181 |
|
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
182 |
code_printing |
|
75799
f1141438b4db
more correct approximation (contributed by Achim Brucker)
Achim D. Brucker <adbrucker@0x5f.org>
parents:
70377
diff
changeset
|
183 |
constant Code_Real_Approx_By_Float.real_of_integer \<rightharpoonup> |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
52403
diff
changeset
|
184 |
(SML) "Real.fromInt" |
|
69906
55534affe445
migrated from Nums to Zarith as library for OCaml integer arithmetic
haftmann
parents:
69064
diff
changeset
|
185 |
and (OCaml) "Pervasives.float/ (Big'_int.to'_int (_))" |
| 45483 | 186 |
|
| 46530 | 187 |
notepad |
188 |
begin |
|
189 |
have "cos (pi/2) = 0" by (rule cos_pi_half) |
|
190 |
moreover have "cos (pi/2) \<noteq> 0" by eval |
|
| 63355 | 191 |
ultimately have False by blast |
| 46530 | 192 |
end |
| 45483 | 193 |
|
194 |
end |