src/Pure/Isar/proof_context.ML
changeset 21807 a59f083632a7
parent 21803 bcef7eb50551
child 21814 d7bb902beb07
equal deleted inserted replaced
21806:6086783d4214 21807:a59f083632a7
   897 fun add_abbrev mode (c, raw_t) ctxt =
   897 fun add_abbrev mode (c, raw_t) ctxt =
   898   let
   898   let
   899     val t0 = cert_term (ctxt |> set_expand_abbrevs false) raw_t
   899     val t0 = cert_term (ctxt |> set_expand_abbrevs false) raw_t
   900       handle ERROR msg => cat_error msg ("in constant abbreviation " ^ quote c);
   900       handle ERROR msg => cat_error msg ("in constant abbreviation " ^ quote c);
   901     val [t] = Variable.exportT_terms (Variable.declare_term t0 ctxt) ctxt [t0];
   901     val [t] = Variable.exportT_terms (Variable.declare_term t0 ctxt) ctxt [t0];
   902     val ((lhs as Const (full_c, T), rhs), consts') = consts_of ctxt
   902     val ((lhs, rhs), consts') = consts_of ctxt
   903       |> Consts.abbreviate (pp ctxt) (tsig_of ctxt) (naming_of ctxt) mode (c, t);
   903       |> Consts.abbreviate (pp ctxt) (tsig_of ctxt) (naming_of ctxt) mode (c, t);
   904     val get = fn Const (c', _) => if c' = full_c then SOME (T, rhs) else NONE | _ => NONE;
       
   905   in
   904   in
   906     ctxt
   905     ctxt
   907     |> map_consts (apsnd (K consts'))
   906     |> map_consts (apsnd (K consts'))
   908     |> Variable.declare_term rhs
   907     |> Variable.declare_term rhs
   909     |> Assumption.add_assms (K (K (I, Envir.expand_term get))) [] |> snd
       
   910     |> pair (lhs, rhs)
   908     |> pair (lhs, rhs)
   911   end;
   909   end;
   912 
   910 
   913 fun target_abbrev prmode ((c, mx), rhs) phi =
   911 fun target_abbrev prmode ((c, mx), rhs) phi =
   914   let
   912   let