equal
deleted
inserted
replaced
454 (* wrapper -- restores quantifiers in rule specifications *) |
454 (* wrapper -- restores quantifiers in rule specifications *) |
455 fun inductive_def (binding as ((R, T), _)) intrs lthy = |
455 fun inductive_def (binding as ((R, T), _)) intrs lthy = |
456 let |
456 let |
457 val ({intrs = intrs_gen, elims = [elim_gen], preds = [ Rdef ], induct, ...}, lthy) = |
457 val ({intrs = intrs_gen, elims = [elim_gen], preds = [ Rdef ], induct, ...}, lthy) = |
458 lthy |
458 lthy |
459 |> LocalTheory.conceal |
459 |> Local_Theory.conceal |
460 |> Inductive.add_inductive_i |
460 |> Inductive.add_inductive_i |
461 {quiet_mode = true, |
461 {quiet_mode = true, |
462 verbose = ! trace, |
462 verbose = ! trace, |
463 alt_name = Binding.empty, |
463 alt_name = Binding.empty, |
464 coind = false, |
464 coind = false, |
468 fork_mono = false} |
468 fork_mono = false} |
469 [binding] (* relation *) |
469 [binding] (* relation *) |
470 [] (* no parameters *) |
470 [] (* no parameters *) |
471 (map (fn t => (Attrib.empty_binding, t)) intrs) (* intro rules *) |
471 (map (fn t => (Attrib.empty_binding, t)) intrs) (* intro rules *) |
472 [] (* no special monos *) |
472 [] (* no special monos *) |
473 ||> LocalTheory.restore_naming lthy |
473 ||> Local_Theory.restore_naming lthy |
474 |
474 |
475 val cert = cterm_of (ProofContext.theory_of lthy) |
475 val cert = cterm_of (ProofContext.theory_of lthy) |
476 fun requantify orig_intro thm = |
476 fun requantify orig_intro thm = |
477 let |
477 let |
478 val (qs, t) = dest_all_all orig_intro |
478 val (qs, t) = dest_all_all orig_intro |
516 val f_def = |
516 val f_def = |
517 Abs ("x", domT, Const (@{const_name FunDef.THE_default}, ranT --> (ranT --> boolT) --> ranT) |
517 Abs ("x", domT, Const (@{const_name FunDef.THE_default}, ranT --> (ranT --> boolT) --> ranT) |
518 $ (default $ Bound 0) $ Abs ("y", ranT, G $ Bound 1 $ Bound 0)) |
518 $ (default $ Bound 0) $ Abs ("y", ranT, G $ Bound 1 $ Bound 0)) |
519 |> Syntax.check_term lthy |
519 |> Syntax.check_term lthy |
520 in |
520 in |
521 LocalTheory.define "" |
521 Local_Theory.define "" |
522 ((Binding.name (function_name fname), mixfix), |
522 ((Binding.name (function_name fname), mixfix), |
523 ((Binding.conceal (Binding.name fdefname), []), f_def)) lthy |
523 ((Binding.conceal (Binding.name fdefname), []), f_def)) lthy |
524 end |
524 end |
525 |
525 |
526 fun define_recursion_relation Rname domT ranT fvar f qglrs clauses RCss lthy = |
526 fun define_recursion_relation Rname domT ranT fvar f qglrs clauses RCss lthy = |
926 |
926 |
927 val ((R, RIntro_thmss, R_elim), lthy) = |
927 val ((R, RIntro_thmss, R_elim), lthy) = |
928 PROFILE "def_rel" (define_recursion_relation (rel_name defname) domT ranT fvar f abstract_qglrs clauses RCss) lthy |
928 PROFILE "def_rel" (define_recursion_relation (rel_name defname) domT ranT fvar f abstract_qglrs clauses RCss) lthy |
929 |
929 |
930 val (_, lthy) = |
930 val (_, lthy) = |
931 LocalTheory.abbrev Syntax.mode_default ((Binding.name (dom_name defname), NoSyn), mk_acc domT R) lthy |
931 Local_Theory.abbrev Syntax.mode_default ((Binding.name (dom_name defname), NoSyn), mk_acc domT R) lthy |
932 |
932 |
933 val newthy = ProofContext.theory_of lthy |
933 val newthy = ProofContext.theory_of lthy |
934 val clauses = map (transfer_clause_ctx newthy) clauses |
934 val clauses = map (transfer_clause_ctx newthy) clauses |
935 |
935 |
936 val cert = cterm_of (ProofContext.theory_of lthy) |
936 val cert = cterm_of (ProofContext.theory_of lthy) |