equal
deleted
inserted
replaced
1 (* Title: Pure/goal.ML |
1 (* Title: Pure/goal.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Makarius and Lawrence C Paulson |
3 Author: Makarius and Lawrence C Paulson |
4 |
4 |
5 Tactical goal state. |
5 Goals in tactical theorem proving. |
6 *) |
6 *) |
7 |
7 |
8 signature BASIC_GOAL = |
8 signature BASIC_GOAL = |
9 sig |
9 sig |
10 val SELECT_GOAL: tactic -> int -> tactic |
10 val SELECT_GOAL: tactic -> int -> tactic |
19 val finish: thm -> thm |
19 val finish: thm -> thm |
20 val norm_hhf: thm -> thm |
20 val norm_hhf: thm -> thm |
21 val compose_hhf: thm -> int -> thm -> thm Seq.seq |
21 val compose_hhf: thm -> int -> thm -> thm Seq.seq |
22 val compose_hhf_tac: thm -> int -> tactic |
22 val compose_hhf_tac: thm -> int -> tactic |
23 val comp_hhf: thm -> thm -> thm |
23 val comp_hhf: thm -> thm -> thm |
24 val prove: theory -> string list -> term list -> term -> (thm list -> tactic) -> thm |
|
25 val prove_multi: theory -> string list -> term list -> term list -> |
24 val prove_multi: theory -> string list -> term list -> term list -> |
26 (thm list -> tactic) -> thm list |
25 (thm list -> tactic) -> thm list |
|
26 val prove: theory -> string list -> term list -> term -> (thm list -> tactic) -> thm |
27 val prove_raw: cterm list -> cterm -> (thm list -> tactic) -> thm |
27 val prove_raw: cterm list -> cterm -> (thm list -> tactic) -> thm |
28 end; |
28 end; |
29 |
29 |
30 structure Goal: GOAL = |
30 structure Goal: GOAL = |
31 struct |
31 struct |
102 |
102 |
103 fun prove_multi thy xs asms props tac = |
103 fun prove_multi thy xs asms props tac = |
104 let |
104 let |
105 val prop = Logic.mk_conjunction_list props; |
105 val prop = Logic.mk_conjunction_list props; |
106 val statement = Logic.list_implies (asms, prop); |
106 val statement = Logic.list_implies (asms, prop); |
107 val frees = map Term.dest_Free (Term.term_frees statement); |
107 val frees = Term.add_frees statement []; |
108 val fixed_frees = filter_out (member (op =) xs o #1) frees; |
108 val fixed_frees = filter_out (member (op =) xs o #1) frees; |
109 val fixed_tfrees = foldr Term.add_typ_tfrees [] (map #2 fixed_frees); |
109 val fixed_tfrees = fold (Term.add_tfreesT o #2) fixed_frees []; |
110 val params = List.mapPartial (fn x => Option.map (pair x) (AList.lookup (op =) frees x)) xs; |
110 val params = List.mapPartial (fn x => Option.map (pair x) (AList.lookup (op =) frees x)) xs; |
111 |
111 |
112 fun err msg = raise ERROR_MESSAGE |
112 fun err msg = raise ERROR_MESSAGE |
113 (msg ^ "\nThe error(s) above occurred for the goal statement:\n" ^ |
113 (msg ^ "\nThe error(s) above occurred for the goal statement:\n" ^ |
114 Sign.string_of_term thy (Term.list_all_free (params, statement))); |
114 Sign.string_of_term thy (Term.list_all_free (params, statement))); |
134 Drule.conj_elim_precise (length props) raw_result |
134 Drule.conj_elim_precise (length props) raw_result |
135 |> map |
135 |> map |
136 (Drule.implies_intr_list casms |
136 (Drule.implies_intr_list casms |
137 #> Drule.forall_intr_list cparams |
137 #> Drule.forall_intr_list cparams |
138 #> norm_hhf |
138 #> norm_hhf |
139 #> (#1 o Thm.varifyT' fixed_tfrees) |
139 #> Thm.varifyT' fixed_tfrees |
140 #> Drule.zero_var_indexes) |
140 #-> K Drule.zero_var_indexes) |
141 end; |
141 end; |
142 |
142 |
143 |
143 |
144 (* prove *) |
144 (* prove *) |
145 |
145 |