src/Pure/Isar/toplevel.ML
changeset 17452 178344c74562
parent 17434 c2efacfe8ab8
child 17500 964bad535ac6
equal deleted inserted replaced
17451:cfa8b1ebfc9a 17452:178344c74562
   435 fun theory_context f =
   435 fun theory_context f =
   436   app_current (K (fn Theory (thy, _) => Theory (apsnd SOME (f thy)) | _ => raise UNDEF));
   436   app_current (K (fn Theory (thy, _) => Theory (apsnd SOME (f thy)) | _ => raise UNDEF));
   437 
   437 
   438 fun theory_to_proof f = app_current (fn int =>
   438 fun theory_to_proof f = app_current (fn int =>
   439   (fn Theory (thy, _) =>
   439   (fn Theory (thy, _) =>
   440         if ! skip_proofs then SkipProof (History.init (undo_limit int) 0,
   440       let val st = f thy in
   441           #1 (Proof.global_skip_proof int (f thy)))
   441         if Theory.eq_thy (thy, Proof.theory_of st) then ()
   442         else Proof (ProofHistory.init (undo_limit int) (f thy))
   442         else error "Theory changed at start of proof";
       
   443         if ! skip_proofs then
       
   444           SkipProof (History.init (undo_limit int) 0, #1 (Proof.global_skip_proof int st))
       
   445         else Proof (ProofHistory.init (undo_limit int) st)
       
   446       end
   443     | _ => raise UNDEF));
   447     | _ => raise UNDEF));
   444 
   448 
   445 fun proof' f = map_current (fn int =>
   449 fun proof' f = map_current (fn int =>
   446   (fn Proof prf => Proof (f int prf)
   450   (fn Proof prf => Proof (f int prf)
   447     | SkipProof (h, thy) => SkipProof (History.apply I h, thy)   (*approximate f*)
   451     | SkipProof (h, thy) => SkipProof (History.apply I h, thy)   (*approximate f*)