620 | Const ("op :", T) => collect_type_axioms (axs, T) |
620 | Const ("op :", T) => collect_type_axioms (axs, T) |
621 (* other optimizations *) |
621 (* other optimizations *) |
622 | Const ("Finite_Set.card", T) => collect_type_axioms (axs, T) |
622 | Const ("Finite_Set.card", T) => collect_type_axioms (axs, T) |
623 | Const ("Finite_Set.Finites", T) => collect_type_axioms (axs, T) |
623 | Const ("Finite_Set.Finites", T) => collect_type_axioms (axs, T) |
624 | Const ("op <", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("bool", [])])])) => collect_type_axioms (axs, T) |
624 | Const ("op <", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("bool", [])])])) => collect_type_axioms (axs, T) |
625 | Const ("op +", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => collect_type_axioms (axs, T) |
625 | Const ("HOL.plus", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => collect_type_axioms (axs, T) |
626 | Const ("op -", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => collect_type_axioms (axs, T) |
626 | Const ("HOL.minus", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => collect_type_axioms (axs, T) |
627 | Const ("op *", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => collect_type_axioms (axs, T) |
627 | Const ("HOL.times", T as Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => collect_type_axioms (axs, T) |
628 | Const ("List.op @", T) => collect_type_axioms (axs, T) |
628 | Const ("List.op @", T) => collect_type_axioms (axs, T) |
629 | Const ("Lfp.lfp", T) => collect_type_axioms (axs, T) |
629 | Const ("Lfp.lfp", T) => collect_type_axioms (axs, T) |
630 | Const ("Gfp.gfp", T) => collect_type_axioms (axs, T) |
630 | Const ("Gfp.gfp", T) => collect_type_axioms (axs, T) |
631 (* simply-typed lambda calculus *) |
631 (* simply-typed lambda calculus *) |
632 | Const (s, T) => |
632 | Const (s, T) => |
2160 | _ => |
2160 | _ => |
2161 NONE; |
2161 NONE; |
2162 |
2162 |
2163 (* theory -> model -> arguments -> Term.term -> (interpretation * model * arguments) option *) |
2163 (* theory -> model -> arguments -> Term.term -> (interpretation * model * arguments) option *) |
2164 |
2164 |
2165 (* only an optimization: 'op +' could in principle be interpreted with *) |
2165 (* only an optimization: 'HOL.plus' could in principle be interpreted with*) |
2166 (* interpreters available already (using its definition), but the code *) |
2166 (* interpreters available already (using its definition), but the code *) |
2167 (* below is more efficient *) |
2167 (* below is more efficient *) |
2168 |
2168 |
2169 fun Nat_plus_interpreter thy model args t = |
2169 fun Nat_plus_interpreter thy model args t = |
2170 case t of |
2170 case t of |
2171 Const ("op +", Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => |
2171 Const ("HOL.plus", Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => |
2172 let |
2172 let |
2173 val (i_nat, _, _) = interpret thy model {maxvars=0, def_eq=false, next_idx=1, bounds=[], wellformed=True} (Free ("dummy", Type ("nat", []))) |
2173 val (i_nat, _, _) = interpret thy model {maxvars=0, def_eq=false, next_idx=1, bounds=[], wellformed=True} (Free ("dummy", Type ("nat", []))) |
2174 val size_nat = size_of_type i_nat |
2174 val size_nat = size_of_type i_nat |
2175 (* int -> int -> interpretation *) |
2175 (* int -> int -> interpretation *) |
2176 fun plus m n = |
2176 fun plus m n = |
2194 (* interpreters available already (using its definition), but the code *) |
2194 (* interpreters available already (using its definition), but the code *) |
2195 (* below is more efficient *) |
2195 (* below is more efficient *) |
2196 |
2196 |
2197 fun Nat_minus_interpreter thy model args t = |
2197 fun Nat_minus_interpreter thy model args t = |
2198 case t of |
2198 case t of |
2199 Const ("op -", Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => |
2199 Const ("HOL.minus", Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => |
2200 let |
2200 let |
2201 val (i_nat, _, _) = interpret thy model {maxvars=0, def_eq=false, next_idx=1, bounds=[], wellformed=True} (Free ("dummy", Type ("nat", []))) |
2201 val (i_nat, _, _) = interpret thy model {maxvars=0, def_eq=false, next_idx=1, bounds=[], wellformed=True} (Free ("dummy", Type ("nat", []))) |
2202 val size_nat = size_of_type i_nat |
2202 val size_nat = size_of_type i_nat |
2203 (* int -> int -> interpretation *) |
2203 (* int -> int -> interpretation *) |
2204 fun minus m n = |
2204 fun minus m n = |
2213 | _ => |
2213 | _ => |
2214 NONE; |
2214 NONE; |
2215 |
2215 |
2216 (* theory -> model -> arguments -> Term.term -> (interpretation * model * arguments) option *) |
2216 (* theory -> model -> arguments -> Term.term -> (interpretation * model * arguments) option *) |
2217 |
2217 |
2218 (* only an optimization: 'op *' could in principle be interpreted with *) |
2218 (* only an optimization: 'HOL.times' could in principle be interpreted with *) |
2219 (* interpreters available already (using its definition), but the code *) |
2219 (* interpreters available already (using its definition), but the code *) |
2220 (* below is more efficient *) |
2220 (* below is more efficient *) |
2221 |
2221 |
2222 fun Nat_mult_interpreter thy model args t = |
2222 fun Nat_mult_interpreter thy model args t = |
2223 case t of |
2223 case t of |
2224 Const ("op *", Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => |
2224 Const ("HOL.times", Type ("fun", [Type ("nat", []), Type ("fun", [Type ("nat", []), Type ("nat", [])])])) => |
2225 let |
2225 let |
2226 val (i_nat, _, _) = interpret thy model {maxvars=0, def_eq=false, next_idx=1, bounds=[], wellformed=True} (Free ("dummy", Type ("nat", []))) |
2226 val (i_nat, _, _) = interpret thy model {maxvars=0, def_eq=false, next_idx=1, bounds=[], wellformed=True} (Free ("dummy", Type ("nat", []))) |
2227 val size_nat = size_of_type i_nat |
2227 val size_nat = size_of_type i_nat |
2228 (* nat -> nat -> interpretation *) |
2228 (* nat -> nat -> interpretation *) |
2229 fun mult m n = |
2229 fun mult m n = |