equal
deleted
inserted
replaced
238 |
238 |
239 fun check_def thy unchecked overloaded (b, tm) defs = |
239 fun check_def thy unchecked overloaded (b, tm) defs = |
240 let |
240 let |
241 val ctxt = ProofContext.init thy; |
241 val ctxt = ProofContext.init thy; |
242 val name = Sign.full_name thy b; |
242 val name = Sign.full_name thy b; |
243 val (lhs_const, rhs) = Sign.cert_def ctxt tm; |
243 val ((lhs, rhs), _) = Primitive_Defs.dest_def ctxt Term.is_Const (K false) (K false) tm |
|
244 handle TERM (msg, _) => error msg; |
|
245 val lhs_const = Term.dest_Const (Term.head_of lhs); |
244 val rhs_consts = fold_aterms (fn Const const => insert (op =) const | _ => I) rhs []; |
246 val rhs_consts = fold_aterms (fn Const const => insert (op =) const | _ => I) rhs []; |
245 val _ = check_overloading thy overloaded lhs_const; |
247 val _ = check_overloading thy overloaded lhs_const; |
246 in defs |> dependencies thy unchecked (SOME name) name lhs_const rhs_consts end |
248 in defs |> dependencies thy unchecked (SOME name) name lhs_const rhs_consts end |
247 handle ERROR msg => cat_error msg (Pretty.string_of (Pretty.block |
249 handle ERROR msg => cat_error msg (Pretty.string_of (Pretty.block |
248 [Pretty.str ("The error(s) above occurred in definition " ^ quote (Binding.str_of b) ^ ":"), |
250 [Pretty.str ("The error(s) above occurred in definition " ^ quote (Binding.str_of b) ^ ":"), |