equal
deleted
inserted
replaced
589 |
589 |
590 (* fix *) |
590 (* fix *) |
591 |
591 |
592 local |
592 local |
593 |
593 |
594 fun gen_fix prep_vars args = |
594 fun gen_fix prep_var args = |
595 assert_forward |
595 assert_forward |
596 #> map_context (fn ctxt => snd (Proof_Context.add_fixes (fst (prep_vars args ctxt)) ctxt)) |
596 #> map_context (fn ctxt => snd (Proof_Context.add_fixes (fst (fold_map prep_var args ctxt)) ctxt)) |
597 #> reset_facts; |
597 #> reset_facts; |
598 |
598 |
599 in |
599 in |
600 |
600 |
601 val fix = gen_fix Proof_Context.cert_vars; |
601 val fix = gen_fix Proof_Context.cert_var; |
602 val fix_cmd = gen_fix Proof_Context.read_vars; |
602 val fix_cmd = gen_fix Proof_Context.read_var; |
603 |
603 |
604 end; |
604 end; |
605 |
605 |
606 |
606 |
607 (* assume etc. *) |
607 (* assume etc. *) |
628 |
628 |
629 (* def *) |
629 (* def *) |
630 |
630 |
631 local |
631 local |
632 |
632 |
633 fun gen_def prep_att prep_vars prep_binds args state = |
633 fun gen_def prep_att prep_var prep_binds args state = |
634 let |
634 let |
635 val _ = assert_forward state; |
635 val _ = assert_forward state; |
636 val (raw_name_atts, (raw_vars, raw_rhss)) = args |> split_list ||> split_list; |
636 val (raw_name_atts, (raw_vars, raw_rhss)) = args |> split_list ||> split_list; |
637 val name_atts = map (apsnd (map (prep_att (context_of state)))) raw_name_atts; |
637 val name_atts = map (apsnd (map (prep_att (context_of state)))) raw_name_atts; |
638 in |
638 in |
639 state |
639 state |
640 |> map_context_result (prep_vars (map (fn (x, mx) => (x, NONE, mx)) raw_vars)) |
640 |> map_context_result (fold_map (fn (x, mx) => prep_var (x, NONE, mx)) raw_vars) |
641 |>> map (fn (x, _, mx) => (x, mx)) |
641 |>> map (fn (x, _, mx) => (x, mx)) |
642 |-> (fn vars => |
642 |-> (fn vars => |
643 map_context_result (prep_binds false (map swap raw_rhss)) |
643 map_context_result (prep_binds false (map swap raw_rhss)) |
644 #-> (fn rhss => |
644 #-> (fn rhss => |
645 let |
645 let |
649 |-> (set_facts o map (#2 o #2)) |
649 |-> (set_facts o map (#2 o #2)) |
650 end; |
650 end; |
651 |
651 |
652 in |
652 in |
653 |
653 |
654 val def = gen_def (K I) Proof_Context.cert_vars Proof_Context.match_bind; |
654 val def = gen_def (K I) Proof_Context.cert_var Proof_Context.match_bind; |
655 val def_cmd = gen_def Attrib.attribute_cmd Proof_Context.read_vars Proof_Context.match_bind_cmd; |
655 val def_cmd = gen_def Attrib.attribute_cmd Proof_Context.read_var Proof_Context.match_bind_cmd; |
656 |
656 |
657 end; |
657 end; |
658 |
658 |
659 |
659 |
660 |
660 |