equal
deleted
inserted
replaced
346 |
346 |
347 fun add_axiom (b, prop) thy = |
347 fun add_axiom (b, prop) thy = |
348 let |
348 let |
349 val b' = if Binding.is_empty b then Binding.name ("unnamed_axiom_" ^ serial_string ()) else b; |
349 val b' = if Binding.is_empty b then Binding.name ("unnamed_axiom_" ^ serial_string ()) else b; |
350 |
350 |
351 val _ = Sign.no_vars (Syntax.pp_global thy) prop; |
351 val _ = Sign.no_vars (Syntax.init_pretty_global thy) prop; |
352 val (strip, recover, prop') = stripped_sorts thy prop; |
352 val (strip, recover, prop') = stripped_sorts thy prop; |
353 val constraints = map (fn (TFree (_, S), T) => (T, S)) strip; |
353 val constraints = map (fn (TFree (_, S), T) => (T, S)) strip; |
354 val of_sorts = maps (fn (T as TFree (_, S), _) => of_sort (Thm.ctyp_of thy T, S)) strip; |
354 val of_sorts = maps (fn (T as TFree (_, S), _) => of_sort (Thm.ctyp_of thy T, S)) strip; |
355 |
355 |
356 val thy' = |
356 val thy' = |
363 |> fold elim_implies of_sorts; |
363 |> fold elim_implies of_sorts; |
364 in ((axm_name, thm), thy') end; |
364 in ((axm_name, thm), thy') end; |
365 |
365 |
366 fun add_def unchecked overloaded (b, prop) thy = |
366 fun add_def unchecked overloaded (b, prop) thy = |
367 let |
367 let |
368 val _ = Sign.no_vars (Syntax.pp_global thy) prop; |
368 val _ = Sign.no_vars (Syntax.init_pretty_global thy) prop; |
369 val prems = map (Thm.cterm_of thy) (Logic.strip_imp_prems prop); |
369 val prems = map (Thm.cterm_of thy) (Logic.strip_imp_prems prop); |
370 val (_, recover, concl') = stripped_sorts thy (Logic.strip_imp_concl prop); |
370 val (_, recover, concl') = stripped_sorts thy (Logic.strip_imp_concl prop); |
371 |
371 |
372 val thy' = Theory.add_def unchecked overloaded (b, concl') thy; |
372 val thy' = Theory.add_def unchecked overloaded (b, concl') thy; |
373 val axm_name = Sign.full_name thy' b; |
373 val axm_name = Sign.full_name thy' b; |