src/HOL/Complex/ex/linreif.ML
changeset 23808 4e4b92e76219
parent 23515 3e7f62e68fe4
child 23881 851c74f1bb69
equal deleted inserted replaced
23807:d36e3ffdb5ce 23808:4e4b92e76219
     7 
     7 
     8 structure ReflectedFerrack =
     8 structure ReflectedFerrack =
     9 struct
     9 struct
    10 
    10 
    11 open Ferrack;
    11 open Ferrack;
    12 open ReflectedFerrack
    12 
       
    13 val nat = Ferrack.nat o Integer.int;
    13 
    14 
    14 exception LINR;
    15 exception LINR;
    15 
    16 
    16 (* pseudo reification : term -> intterm *)
    17 (* pseudo reification : term -> intterm *)
    17 val iT = HOLogic.intT;
    18 val iT = HOLogic.intT;
    27 			 | SOME n => Bound n)
    28 			 | SOME n => Bound n)
    28       | Const("RealDef.real",_)$ @{term "0::int"} => C 0
    29       | Const("RealDef.real",_)$ @{term "0::int"} => C 0
    29       | Const("RealDef.real",_)$ @{term "1::int"} => C 1
    30       | Const("RealDef.real",_)$ @{term "1::int"} => C 1
    30       | @{term "0::real"} => C 0
    31       | @{term "0::real"} => C 0
    31       | @{term "0::real"} => C 1
    32       | @{term "0::real"} => C 1
    32       | Term.Bound i => Bound (Integer.nat i)
    33       | Term.Bound i => Bound (nat i)
    33       | Const(@{const_name "HOL.uminus"},_)$t' => Neg (num_of_term vs t')
    34       | Const(@{const_name "HOL.uminus"},_)$t' => Neg (num_of_term vs t')
    34       | Const (@{const_name "HOL.plus"},_)$t1$t2 => Add (num_of_term vs t1,num_of_term vs t2)
    35       | Const (@{const_name "HOL.plus"},_)$t1$t2 => Add (num_of_term vs t1,num_of_term vs t2)
    35       | Const (@{const_name "HOL.minus"},_)$t1$t2 => Sub (num_of_term vs t1,num_of_term vs t2)
    36       | Const (@{const_name "HOL.minus"},_)$t1$t2 => Sub (num_of_term vs t1,num_of_term vs t2)
    36       | Const (@{const_name "HOL.times"},_)$t1$t2 => 
    37       | Const (@{const_name "HOL.times"},_)$t1$t2 => 
    37 	(case (num_of_term vs t1) of C i => 
    38 	(case (num_of_term vs t1) of C i => 
    67   | zip (x::xs) (y::ys) = (x,y)::(zip xs ys);
    68   | zip (x::xs) (y::ys) = (x,y)::(zip xs ys);
    68 
    69 
    69 
    70 
    70 fun start_vs t =
    71 fun start_vs t =
    71     let val fs = term_frees t
    72     let val fs = term_frees t
    72     in zip fs (map Integer.nat (0 upto  (length fs - 1)))
    73     in zip fs (map nat (0 upto  (length fs - 1)))
    73     end ;
    74     end ;
    74 
    75 
    75 (* transform num and fm back to terms *)
    76 (* transform num and fm back to terms *)
    76 
    77 
    77 fun myassoc2 l v =
    78 fun myassoc2 l v =