137 ((string * attribute list) * (term * term list) list) list -> |
137 ((string * attribute list) * (term * term list) list) list -> |
138 Proof.context -> (bstring * thm list) list * Proof.context |
138 Proof.context -> (bstring * thm list) list * Proof.context |
139 val add_cases: bool -> (string * RuleCases.T option) list -> Proof.context -> Proof.context |
139 val add_cases: bool -> (string * RuleCases.T option) list -> Proof.context -> Proof.context |
140 val apply_case: RuleCases.T -> Proof.context -> (string * term list) list * Proof.context |
140 val apply_case: RuleCases.T -> Proof.context -> (string * term list) list * Proof.context |
141 val get_case: Proof.context -> string -> string option list -> RuleCases.T |
141 val get_case: Proof.context -> string -> string option list -> RuleCases.T |
142 val add_notation: Syntax.mode -> (term * mixfix) list -> |
142 val notation: bool -> Syntax.mode -> (term * mixfix) list -> Proof.context -> Proof.context |
143 Proof.context -> Proof.context |
143 val target_notation: bool -> Syntax.mode -> (term * mixfix) list -> morphism -> |
144 val target_notation: Syntax.mode -> (term * mixfix) list -> morphism -> |
|
145 Context.generic -> Context.generic |
144 Context.generic -> Context.generic |
146 val add_const_constraint: string * typ option -> Proof.context -> Proof.context |
145 val add_const_constraint: string * typ option -> Proof.context -> Proof.context |
147 val add_abbrev: string -> Markup.property list -> |
146 val add_abbrev: string -> Markup.property list -> |
148 bstring * term -> Proof.context -> (term * term) * Proof.context |
147 bstring * term -> Proof.context -> (term * term) * Proof.context |
149 val verbose: bool ref |
148 val verbose: bool ref |
989 end; |
988 end; |
990 |
989 |
991 |
990 |
992 (* authentic constants *) |
991 (* authentic constants *) |
993 |
992 |
994 fun const_syntax ctxt (Free (x, T), mx) = SOME (true, (x, T, mx)) |
|
995 | const_syntax ctxt (Const (c, _), mx) = |
|
996 Option.map (pair false) (try (Consts.syntax (consts_of ctxt)) (c, mx)) |
|
997 | const_syntax _ _ = NONE; |
|
998 |
|
999 fun context_const_ast_tr ctxt [Syntax.Variable c] = |
993 fun context_const_ast_tr ctxt [Syntax.Variable c] = |
1000 let |
994 let |
1001 val consts = consts_of ctxt; |
995 val consts = consts_of ctxt; |
1002 val c' = Consts.intern consts c; |
996 val c' = Consts.intern consts c; |
1003 val _ = Consts.the_constraint consts c' handle TYPE (msg, _, _) => error msg; |
997 val _ = Consts.the_constraint consts c' handle TYPE (msg, _, _) => error msg; |
1011 Sign.add_advanced_trfuns ([("_context_const", context_const_ast_tr)], [], [], [])); |
1005 Sign.add_advanced_trfuns ([("_context_const", context_const_ast_tr)], [], [], [])); |
1012 |
1006 |
1013 |
1007 |
1014 (* notation *) |
1008 (* notation *) |
1015 |
1009 |
1016 fun add_notation mode args ctxt = |
1010 local |
|
1011 |
|
1012 fun const_syntax ctxt (Free (x, T), mx) = SOME (true, (x, T, mx)) |
|
1013 | const_syntax ctxt (Const (c, _), mx) = |
|
1014 Option.map (pair false) (try (Consts.syntax (consts_of ctxt)) (c, mx)) |
|
1015 | const_syntax _ _ = NONE; |
|
1016 |
|
1017 in |
|
1018 |
|
1019 fun notation add mode args ctxt = |
1017 ctxt |> map_syntax |
1020 ctxt |> map_syntax |
1018 (LocalSyntax.add_modesyntax (theory_of ctxt) mode (map_filter (const_syntax ctxt) args)); |
1021 (LocalSyntax.update_modesyntax (theory_of ctxt) add mode (map_filter (const_syntax ctxt) args)); |
1019 |
1022 |
1020 fun target_notation mode args phi = |
1023 fun target_notation add mode args phi = |
1021 let val args' = filter (fn (t, _) => Term.equiv_types (t, Morphism.term phi t)) args; |
1024 let val args' = filter (fn (t, _) => Term.equiv_types (t, Morphism.term phi t)) args; |
1022 in Context.mapping (Sign.add_notation mode args') (add_notation mode args') end; |
1025 in Context.mapping (Sign.notation add mode args') (notation add mode args') end; |
|
1026 |
|
1027 end; |
1023 |
1028 |
1024 |
1029 |
1025 (* local constants *) |
1030 (* local constants *) |
1026 |
1031 |
1027 fun add_const_constraint (c, opt_T) ctxt = |
1032 fun add_const_constraint (c, opt_T) ctxt = |