Apologies if this is considered a dumb question, but how can I make an Isabelle theory recognise ML code? For example, let's say I have an Isabelle file that looks like
ML ‹
type vec = real * real;
fun addvec ((a,b):vec) ((c,d):vec) : vec = (a+b,c+d);
›
lemma "addvec (1,2) (3,4) = (4,6)"
Unfortunately addvec
isn't recognised in the lemma. How can I make the function recognised? I've read through How to get ML values from HOL? as well as the Isabelle Cookbook. The former uses a local_setup
to assign the constants to Isabelle constants (as far as I can see) using a function called mk_const
fun mk_const c t =
let
val b = Binding.name c
val defb = Binding.name (c ^ "_def")
in (((b, NoSyn), ((defb, []), t)) |> Local_Theory.define) #> snd end
What do the functions Binding.name
and Local_Theory.define
do, and what is the local_theory
type?
Thanks in advance!