src/Provers/Arith/cancel_numerals.ML
changeset 61144 5e94dfead1c2
parent 59530 2a20354c0877
child 70315 2f9623aa1eeb
equal deleted inserted replaced
61143:5f898411ce87 61144:5e94dfead1c2
    42   val simplify_meta_eq: Proof.context -> thm -> thm (*simplifies the final theorem*)
    42   val simplify_meta_eq: Proof.context -> thm -> thm (*simplifies the final theorem*)
    43 end;
    43 end;
    44 
    44 
    45 signature CANCEL_NUMERALS =
    45 signature CANCEL_NUMERALS =
    46 sig
    46 sig
    47   val proc: Proof.context -> term -> thm option
    47   val proc: Proof.context -> cterm -> thm option
    48 end;
    48 end;
    49 
    49 
    50 functor CancelNumeralsFun(Data: CANCEL_NUMERALS_DATA): CANCEL_NUMERALS =
    50 functor CancelNumeralsFun(Data: CANCEL_NUMERALS_DATA): CANCEL_NUMERALS =
    51 struct
    51 struct
    52 
    52 
    63               let val (_,u) = Data.dest_coeff t
    63               let val (_,u) = Data.dest_coeff t
    64               in if Termtab.defined tab2 u then u else seek terms end
    64               in if Termtab.defined tab2 u then u else seek terms end
    65   in  seek terms1 end;
    65   in  seek terms1 end;
    66 
    66 
    67 (*the simplification procedure*)
    67 (*the simplification procedure*)
    68 fun proc ctxt t =
    68 fun proc ctxt ct =
    69   let
    69   let
    70     val prems = Simplifier.prems_of ctxt
    70     val prems = Simplifier.prems_of ctxt
       
    71     val t = Thm.term_of ct
    71     val ([t'], ctxt') = Variable.import_terms true [t] ctxt
    72     val ([t'], ctxt') = Variable.import_terms true [t] ctxt
    72     val export = singleton (Variable.export ctxt' ctxt)
    73     val export = singleton (Variable.export ctxt' ctxt)
    73     (* FIXME ctxt vs. ctxt' (!?) *)
    74     (* FIXME ctxt vs. ctxt' (!?) *)
    74 
    75 
    75     val (t1,t2) = Data.dest_bal t'
    76     val (t1,t2) = Data.dest_bal t'