11 (binding * string option * mixfix) list -> thm -> thm |
11 (binding * string option * mixfix) list -> thm -> thm |
12 val of_rule: Proof.context -> string option list * string option list -> |
12 val of_rule: Proof.context -> string option list * string option list -> |
13 (binding * string option * mixfix) list -> thm -> thm |
13 (binding * string option * mixfix) list -> thm -> thm |
14 val read_instantiate: Proof.context -> |
14 val read_instantiate: Proof.context -> |
15 ((indexname * Position.T) * string) list -> string list -> thm -> thm |
15 ((indexname * Position.T) * string) list -> string list -> thm -> thm |
|
16 val read_term: string -> Proof.context -> term * Proof.context |
16 val schematic: bool Config.T |
17 val schematic: bool Config.T |
17 val goal_context: int -> thm -> Proof.context -> (string * typ) list * Proof.context |
18 val goal_context: int -> thm -> Proof.context -> (string * typ) list * Proof.context |
18 val res_inst_tac: Proof.context -> |
19 val res_inst_tac: Proof.context -> |
19 ((indexname * Position.T) * string) list -> (binding * string option * mixfix) list -> thm -> |
20 ((indexname * Position.T) * string) list -> (binding * string option * mixfix) list -> thm -> |
20 int -> tactic |
21 int -> tactic |
67 val T = Syntax.read_typ ctxt s; |
68 val T = Syntax.read_typ ctxt s; |
68 in |
69 in |
69 if Sign.of_sort (Proof_Context.theory_of ctxt) (T, S) then ((xi, S), T) |
70 if Sign.of_sort (Proof_Context.theory_of ctxt) (T, S) then ((xi, S), T) |
70 else error_var "Bad sort for instantiation of type variable: " (xi, pos) |
71 else error_var "Bad sort for instantiation of type variable: " (xi, pos) |
71 end; |
72 end; |
|
73 |
|
74 fun make_instT f v = |
|
75 let |
|
76 val T = TVar v; |
|
77 val T' = f T; |
|
78 in if T = T' then NONE else SOME (v, T') end; |
|
79 |
|
80 fun make_inst f v = |
|
81 let |
|
82 val t = Var v; |
|
83 val t' = f t; |
|
84 in if t aconv t' then NONE else SOME (v, t') end; |
72 |
85 |
73 fun read_terms ss Ts ctxt = |
86 fun read_terms ss Ts ctxt = |
74 let |
87 let |
75 fun parse T = if T = propT then Syntax.parse_prop ctxt else Syntax.parse_term ctxt; |
88 fun parse T = if T = propT then Syntax.parse_prop ctxt else Syntax.parse_term ctxt; |
76 val (ts, ctxt') = fold_map Variable.fix_dummy_patterns (map2 parse Ts ss) ctxt; |
89 val (ts, ctxt') = fold_map Variable.fix_dummy_patterns (map2 parse Ts ss) ctxt; |
81 val Ts' = map Term.fastype_of ts'; |
94 val Ts' = map Term.fastype_of ts'; |
82 val tyenv = fold Type.raw_match (Ts ~~ Ts') Vartab.empty; |
95 val tyenv = fold Type.raw_match (Ts ~~ Ts') Vartab.empty; |
83 val tyenv' = Vartab.fold (fn (xi, (S, T)) => cons ((xi, S), T)) tyenv []; |
96 val tyenv' = Vartab.fold (fn (xi, (S, T)) => cons ((xi, S), T)) tyenv []; |
84 in ((ts', tyenv'), ctxt') end; |
97 in ((ts', tyenv'), ctxt') end; |
85 |
98 |
86 fun make_instT f v = |
|
87 let |
|
88 val T = TVar v; |
|
89 val T' = f T; |
|
90 in if T = T' then NONE else SOME (v, T') end; |
|
91 |
|
92 fun make_inst f v = |
|
93 let |
|
94 val t = Var v; |
|
95 val t' = f t; |
|
96 in if t aconv t' then NONE else SOME (v, t') end; |
|
97 |
|
98 in |
99 in |
|
100 |
|
101 fun read_term s ctxt = |
|
102 let |
|
103 val (t, ctxt') = Variable.fix_dummy_patterns (Syntax.parse_term ctxt s) ctxt; |
|
104 val t' = Syntax.check_term ctxt' t; |
|
105 in (t', ctxt') end; |
99 |
106 |
100 fun read_insts thm mixed_insts ctxt = |
107 fun read_insts thm mixed_insts ctxt = |
101 let |
108 let |
102 val (type_insts, term_insts) = |
109 val (type_insts, term_insts) = |
103 List.partition (fn (((x, _), _), _) => String.isPrefix "'" x) mixed_insts; |
110 List.partition (fn (((x, _), _), _) => String.isPrefix "'" x) mixed_insts; |