src/Pure/Isar/obtain.ML
changeset 60389 ea3a699964aa
parent 60388 0c9d2a4f589d
child 60390 c8384ff11711
equal deleted inserted replaced
60388:0c9d2a4f589d 60389:ea3a699964aa
   118     val xs = map (Variable.check_name o #1) vars;
   118     val xs = map (Variable.check_name o #1) vars;
   119 
   119 
   120     (*obtain asms*)
   120     (*obtain asms*)
   121     val (asm_propss, binds) = prep_propp fix_ctxt (map snd raw_asms);
   121     val (asm_propss, binds) = prep_propp fix_ctxt (map snd raw_asms);
   122     val asm_props = flat asm_propss;
   122     val asm_props = flat asm_propss;
   123     val asms_ctxt = fix_ctxt
   123     val declare_asms = fold Variable.declare_term asm_props #> Proof_Context.bind_terms binds;
   124       |> fold Variable.declare_term asm_props
       
   125       |> Proof_Context.bind_terms binds;
       
   126     val asms =
   124     val asms =
   127       map (fn ((b, raw_atts), _) => (b, map (prep_att ctxt) raw_atts)) raw_asms ~~
   125       map (fn ((b, raw_atts), _) => (b, map (prep_att ctxt) raw_atts)) raw_asms ~~
   128       unflat asm_propss (map (rpair []) asm_props);
   126       unflat asm_propss (map (rpair []) asm_props);
   129 
   127 
   130     (*obtain params*)
   128     (*obtain params*)
   131     val (Ts, params_ctxt) = fold_map Proof_Context.inferred_param xs' asms_ctxt;
   129     val (Ts, params_ctxt) = fold_map Proof_Context.inferred_param xs' (declare_asms fix_ctxt);
   132     val params = map Free (xs' ~~ Ts);
   130     val params = map Free (xs' ~~ Ts);
   133     val cparams = map (Thm.cterm_of params_ctxt) params;
   131     val cparams = map (Thm.cterm_of params_ctxt) params;
   134     val _ = Variable.warn_extra_tfrees fix_ctxt params_ctxt;
   132     val _ = Variable.warn_extra_tfrees fix_ctxt params_ctxt;
   135 
   133 
   136     (*abstracted term bindings*)
   134     (*abstracted term bindings*)
   156 
   154 
   157     fun after_qed _ =
   155     fun after_qed _ =
   158       Proof.local_qed (NONE, false)
   156       Proof.local_qed (NONE, false)
   159       #> `Proof.the_fact #-> (fn rule =>
   157       #> `Proof.the_fact #-> (fn rule =>
   160         Proof.fix vars
   158         Proof.fix vars
   161         #> Proof.map_context (Proof_Context.bind_terms binds)
   159         #> Proof.map_context declare_asms
   162         #> Proof.assm (obtain_export params_ctxt rule cparams) asms);
   160         #> Proof.assm (obtain_export params_ctxt rule cparams) asms);
   163   in
   161   in
   164     state
   162     state
   165     |> Proof.enter_forward
   163     |> Proof.enter_forward
   166     |> Proof.have NONE (K I) [(Thm.empty_binding, [(obtain_prop, [])])] int
   164     |> Proof.have NONE (K I) [(Thm.empty_binding, [(obtain_prop, [])])] int