equal
deleted
inserted
replaced
56 type matrix = vector Inttab.table |
56 type matrix = vector Inttab.table |
57 type float = IntInf.int*IntInf.int |
57 type float = IntInf.int*IntInf.int |
58 type floatfunc = float -> float |
58 type floatfunc = float -> float |
59 |
59 |
60 val th = theory "FloatSparseMatrix" |
60 val th = theory "FloatSparseMatrix" |
61 val sg = sign_of th |
|
62 |
61 |
63 fun readtype s = Sign.intern_type sg s |
62 fun readtype s = Sign.intern_type th s |
64 fun readterm s = Sign.intern_const sg s |
63 fun readterm s = Sign.intern_const th s |
65 |
64 |
66 val ty_list = readtype "list" |
65 val ty_list = readtype "list" |
67 val term_Nil = readterm "Nil" |
66 val term_Nil = readterm "Nil" |
68 val term_Cons = readterm "Cons" |
67 val term_Cons = readterm "Cons" |
69 |
68 |
89 |
88 |
90 val mk_intinf = Float.mk_intinf |
89 val mk_intinf = Float.mk_intinf |
91 |
90 |
92 val mk_float = Float.mk_float |
91 val mk_float = Float.mk_float |
93 |
92 |
94 fun float2cterm (a,b) = cterm_of sg (mk_float (a,b)) |
93 fun float2cterm (a,b) = cterm_of th (mk_float (a,b)) |
95 |
94 |
96 fun approx_value_term prec f = Float.approx_float prec (fn (x, y) => (f x, f y)) |
95 fun approx_value_term prec f = Float.approx_float prec (fn (x, y) => (f x, f y)) |
97 |
96 |
98 fun approx_value prec pprt value = |
97 fun approx_value prec pprt value = |
99 let |
98 let |
100 val (flower, fupper) = approx_value_term prec pprt value |
99 val (flower, fupper) = approx_value_term prec pprt value |
101 in |
100 in |
102 (cterm_of sg flower, cterm_of sg fupper) |
101 (cterm_of th flower, cterm_of th fupper) |
103 end |
102 end |
104 |
103 |
105 fun sign_term t = cterm_of sg t |
104 fun sign_term t = cterm_of th t |
106 |
105 |
107 val empty_spvec = empty_vector_const |
106 val empty_spvec = empty_vector_const |
108 |
107 |
109 val empty_spmat = empty_matrix_const |
108 val empty_spmat = empty_matrix_const |
110 |
109 |
159 |
158 |
160 fun approx_vector prec pprt vector = |
159 fun approx_vector prec pprt vector = |
161 let |
160 let |
162 val (l, u) = approx_vector_term prec pprt vector |
161 val (l, u) = approx_vector_term prec pprt vector |
163 in |
162 in |
164 (cterm_of sg l, cterm_of sg u) |
163 (cterm_of th l, cterm_of th u) |
165 end |
164 end |
166 |
165 |
167 fun approx_matrix prec pprt matrix = |
166 fun approx_matrix prec pprt matrix = |
168 let |
167 let |
169 val (l, u) = approx_matrix_term prec pprt matrix |
168 val (l, u) = approx_matrix_term prec pprt matrix |
170 in |
169 in |
171 (cterm_of sg l, cterm_of sg u) |
170 (cterm_of th l, cterm_of th u) |
172 end |
171 end |
173 |
172 |
174 |
173 |
175 exception Nat_expected of int; |
174 exception Nat_expected of int; |
176 |
175 |