src/HOL/Import/replay.ML
changeset 17594 98be710dabc4
parent 17592 ece268908438
child 17959 8db36a108213
equal deleted inserted replaced
17593:01870f76478c 17594:98be710dabc4
    75 	    in
    75 	    in
    76 		P.INST theta th thy'
    76 		P.INST theta th thy'
    77 	    end
    77 	    end
    78 	  | rp (PGen(prf,v)) thy =
    78 	  | rp (PGen(prf,v)) thy =
    79 	    let
    79 	    let
    80 		val _ = writeln "enter rp PGen"
    80 		val (thy',th) = rp' prf thy
    81 		val (thy',th) = rp' prf thy
       
    82 		val _ = writeln "replayed inner proof"
       
    83 		val p = P.GEN v th thy'
    81 		val p = P.GEN v th thy'
    84 		val _ = writeln "exit rp PGen"
       
    85 	    in
    82 	    in
    86 		p
    83 		p
    87 	    end
    84 	    end
    88 	  | rp (PGenAbs(prf,opt,vl)) thy =
    85 	  | rp (PGenAbs(prf,opt,vl)) thy =
    89 	    let
    86 	    let
   227 						end
   224 						end
   228 					      | SOME th => (thy,th))
   225 					      | SOME th => (thy,th))
   229 				       else raise ERR "replay_proof" ("Library " ^ thyname' ^ " should be built before " ^ thyname ^ " (" ^ thmname ^ ")")
   226 				       else raise ERR "replay_proof" ("Library " ^ thyname' ^ " should be built before " ^ thyname ^ " (" ^ thmname ^ ")")
   230 				     | NONE => 
   227 				     | NONE => 
   231 				       (case P.get_thm thyname' thmname thy of
   228 				       (case P.get_thm thyname' thmname thy of
   232 					    (thy',SOME res) => (writeln "Found theorem, no replay necessary!"; (thy',res))
   229 					    (thy',SOME res) => (thy',res)
   233 					  | (thy',NONE) => 
   230 					  | (thy',NONE) => 
   234 					    if thyname' = thyname
   231 					    if thyname' = thyname
   235 					    then
   232 					    then
   236 						let
   233 						let
   237 						    val _ = writeln ("Found no " ^ thmname ^ " theorem, replaying...")
   234 						    val _ = writeln ("Found no " ^ thmname ^ " theorem, replaying...")
   302 
   299 
   303 fun import_single_thm thyname int_thms thmname thy =
   300 fun import_single_thm thyname int_thms thmname thy =
   304     let
   301     let
   305 	fun replay_fact (thmname,thy) =
   302 	fun replay_fact (thmname,thy) =
   306 	    let
   303 	    let
   307 		val _ = writeln ("import_single_thm: Replaying " ^ thmname)
       
   308 		val prf = mk_proof PDisk
   304 		val prf = mk_proof PDisk
   309 		val _ = writeln ("Made proof.")
       
   310 		val _ = set_disk_info_of prf thyname thmname
   305 		val _ = set_disk_info_of prf thyname thmname
   311 		val _ = writeln ("set disk info")	    
   306                 val _ = writeln ("Replaying "^thmname^" ...")
   312 		val p = fst (replay_proof int_thms thyname thmname prf thy)
   307 		val p = fst (replay_proof int_thms thyname thmname prf thy)
   313 		val _ = writeln ("exit replay_fact")
       
   314 	    in
   308 	    in
   315 		p
   309 		p
   316 	    end
   310 	    end
   317     in
   311     in
   318 	replay_fact (thmname,thy)
   312 	replay_fact (thmname,thy)
   320 
   314 
   321 fun import_thms thyname int_thms thmnames thy =
   315 fun import_thms thyname int_thms thmnames thy =
   322     let
   316     let
   323 	fun replay_fact (thy,thmname) =
   317 	fun replay_fact (thy,thmname) =
   324 	    let
   318 	    let
   325 		val _ = writeln ("import_thms: Replaying " ^ thmname)
       
   326 		val prf = mk_proof PDisk	
   319 		val prf = mk_proof PDisk	
   327 		val _ = writeln ("Made proof.")
   320 		val _ = set_disk_info_of prf thyname thmname
   328 		val _ = set_disk_info_of prf thyname thmname	
   321                 val _ = writeln ("Replaying "^thmname^" ...")
   329 		val _ = writeln ("set disk info")	    
       
   330 		val p = fst (replay_proof int_thms thyname thmname prf thy)
   322 		val p = fst (replay_proof int_thms thyname thmname prf thy)
   331 		val _ = writeln ("exit replay_fact")
       
   332 	    in
   323 	    in
   333 		p
   324 		p
   334 	    end
   325 	    end
   335 	val res_thy = Library.foldl replay_fact (thy,thmnames)
   326 	val res_thy = Library.foldl replay_fact (thy,thmnames)
   336     in
   327     in
   340 fun import_thm thyname thmname thy =
   331 fun import_thm thyname thmname thy =
   341     let
   332     let
   342 	val int_thms = fst (setup_int_thms thyname thy)
   333 	val int_thms = fst (setup_int_thms thyname thy)
   343 	fun replay_fact (thmname,thy) =
   334 	fun replay_fact (thmname,thy) =
   344 	    let
   335 	    let
   345 		val _ = writeln ("import_thm: Replaying " ^ thmname)
       
   346 		val prf = mk_proof PDisk	
   336 		val prf = mk_proof PDisk	
   347 		val _ = writeln ("Made proof.")
   337 		val _ = set_disk_info_of prf thyname thmname 	    
   348 		val _ = set_disk_info_of prf thyname thmname 
   338                 val _ = writeln ("Replaying "^thmname^" ...")
   349 		val _ = writeln ("set disk info")	    
       
   350 		val p = fst (replay_proof int_thms thyname thmname prf thy)
   339 		val p = fst (replay_proof int_thms thyname thmname prf thy)
   351 		val _ = writeln ("exit replay_fact")	    
       
   352 	    in 
   340 	    in 
   353 		p
   341 		p
   354 	    end
   342 	    end
   355     in
   343     in
   356 	replay_fact (thmname,thy)
   344 	replay_fact (thmname,thy)