src/Pure/Isar/specification.ML
changeset 33386 ff29d1549aca
parent 33369 470a7b233ee5
child 33389 bb3a5fa94a91
equal deleted inserted replaced
33385:fb2358edcfb6 33386:ff29d1549aca
   296             (vars |> map_filter (fn (x, SOME T) => SOME (Name.of_binding x, T) | _ => NONE)));
   296             (vars |> map_filter (fn (x, SOME T) => SOME (Name.of_binding x, T) | _ => NONE)));
   297 
   297 
   298         val raw_propp = obtains |> map (fn (_, (_, props)) => map (rpair []) props);
   298         val raw_propp = obtains |> map (fn (_, (_, props)) => map (rpair []) props);
   299         val (propp, elems_ctxt) = prep_stmt (elems @ constraints) raw_propp ctxt;
   299         val (propp, elems_ctxt) = prep_stmt (elems @ constraints) raw_propp ctxt;
   300 
   300 
   301         val thesis = ObjectLogic.fixed_judgment (ProofContext.theory_of ctxt) AutoBind.thesisN;
   301         val thesis = ObjectLogic.fixed_judgment (ProofContext.theory_of ctxt) Auto_Bind.thesisN;
   302 
   302 
   303         fun assume_case ((name, (vars, _)), asms) ctxt' =
   303         fun assume_case ((name, (vars, _)), asms) ctxt' =
   304           let
   304           let
   305             val bs = map fst vars;
   305             val bs = map fst vars;
   306             val xs = map Name.of_binding bs;
   306             val xs = map Name.of_binding bs;
   321           [Rule_Cases.consumes (~ (length obtains)), Rule_Cases.case_names case_names];
   321           [Rule_Cases.consumes (~ (length obtains)), Rule_Cases.case_names case_names];
   322         val prems = Assumption.local_prems_of elems_ctxt ctxt;
   322         val prems = Assumption.local_prems_of elems_ctxt ctxt;
   323         val stmt = [((Binding.empty, atts), [(thesis, [])])];
   323         val stmt = [((Binding.empty, atts), [(thesis, [])])];
   324 
   324 
   325         val (facts, goal_ctxt) = elems_ctxt
   325         val (facts, goal_ctxt) = elems_ctxt
   326           |> (snd o ProofContext.add_fixes [(Binding.name AutoBind.thesisN, NONE, NoSyn)])
   326           |> (snd o ProofContext.add_fixes [(Binding.name Auto_Bind.thesisN, NONE, NoSyn)])
   327           |> fold_map assume_case (obtains ~~ propp)
   327           |> fold_map assume_case (obtains ~~ propp)
   328           |-> (fn ths => ProofContext.note_thmss Thm.assumptionK
   328           |-> (fn ths => ProofContext.note_thmss Thm.assumptionK
   329                 [((Binding.name Obtain.thatN, []), [(ths, [])])] #> #2 #> pair ths);
   329                 [((Binding.name Obtain.thatN, []), [(ths, [])])] #> #2 #> pair ths);
   330       in ((prems, stmt, SOME facts), goal_ctxt) end);
   330       in ((prems, stmt, SOME facts), goal_ctxt) end);
   331 
   331 
   367         |> after_qed results'
   367         |> after_qed results'
   368       end;
   368       end;
   369   in
   369   in
   370     goal_ctxt
   370     goal_ctxt
   371     |> ProofContext.note_thmss Thm.assumptionK
   371     |> ProofContext.note_thmss Thm.assumptionK
   372       [((Binding.name AutoBind.assmsN, []), [(prems, [])])]
   372       [((Binding.name Auto_Bind.assmsN, []), [(prems, [])])]
   373     |> snd
   373     |> snd
   374     |> Proof.theorem_i before_qed after_qed' (map snd stmt)
   374     |> Proof.theorem_i before_qed after_qed' (map snd stmt)
   375     |> (case facts of NONE => I | SOME ths => Proof.refine_insert ths)
   375     |> (case facts of NONE => I | SOME ths => Proof.refine_insert ths)
   376     |> Library.apply (map (fn (f, _) => f int) (rev (TheoremHook.get (Context.Proof goal_ctxt))))
   376     |> Library.apply (map (fn (f, _) => f int) (rev (TheoremHook.get (Context.Proof goal_ctxt))))
   377   end;
   377   end;