src/Pure/Isar/element.ML
changeset 20233 ece639738db3
parent 20218 be3bfb0699ba
child 20264 f09a4003e12d
equal deleted inserted replaced
20232:31998a8c7f25 20233:ece639738db3
   118 
   118 
   119 fun prems_of (Assumes asms) = maps (map fst o snd) asms
   119 fun prems_of (Assumes asms) = maps (map fst o snd) asms
   120   | prems_of (Defines defs) = map (fst o snd) defs
   120   | prems_of (Defines defs) = map (fst o snd) defs
   121   | prems_of _ = [];
   121   | prems_of _ = [];
   122 
   122 
   123 fun assume thy t = Goal.norm_hhf (Thm.assume (Thm.cterm_of thy t));
   123 fun assume thy t = Assumption.assume (Thm.cterm_of thy t);
   124 
   124 
   125 fun facts_of thy (Assumes asms) = map (apsnd (map (fn (t, _) => ([assume thy t], [])))) asms
   125 fun facts_of thy (Assumes asms) = map (apsnd (map (fn (t, _) => ([assume thy t], [])))) asms
   126   | facts_of thy (Defines defs) = map (apsnd (fn (t, _) => [([assume thy t], [])])) defs
   126   | facts_of thy (Defines defs) = map (apsnd (fn (t, _) => [([assume thy t], [])])) defs
   127   | facts_of _ (Notes facts) = facts
   127   | facts_of _ (Notes facts) = facts
   128   | facts_of _ _ = [];
   128   | facts_of _ _ = [];
   226 fun pretty_statement ctxt kind raw_th =
   226 fun pretty_statement ctxt kind raw_th =
   227   let
   227   let
   228     val thy = ProofContext.theory_of ctxt;
   228     val thy = ProofContext.theory_of ctxt;
   229     val cert = Thm.cterm_of thy;
   229     val cert = Thm.cterm_of thy;
   230 
   230 
   231     val th = Goal.norm_hhf raw_th;
   231     val th = norm_hhf raw_th;
   232     val is_elim = ObjectLogic.is_elim th;
   232     val is_elim = ObjectLogic.is_elim th;
   233 
   233 
   234     val ((_, [th']), ctxt') = Variable.import true [th] ctxt;
   234     val ((_, [th']), ctxt') = Variable.import true [th] ctxt;
   235     val prop = Thm.prop_of th';
   235     val prop = Thm.prop_of th';
   236     val (prems, concl) = Logic.strip_horn prop;
   236     val (prems, concl) = Logic.strip_horn prop;
   270 
   270 
   271 fun prove_witness ctxt t tac =
   271 fun prove_witness ctxt t tac =
   272   Witness (t, Goal.prove ctxt [] [] (Logic.protect t) (fn _ =>
   272   Witness (t, Goal.prove ctxt [] [] (Logic.protect t) (fn _ =>
   273     Tactic.rtac Drule.protectI 1 THEN tac));
   273     Tactic.rtac Drule.protectI 1 THEN tac));
   274 
   274 
   275 fun conclude_witness (Witness (_, th)) = Goal.norm_hhf (Goal.conclude th);
   275 fun conclude_witness (Witness (_, th)) = norm_hhf (Goal.conclude th);
   276 
   276 
   277 val mark_witness = Logic.protect;
   277 val mark_witness = Logic.protect;
   278 
   278 
   279 fun make_witness t th = Witness (t, th);
   279 fun make_witness t th = Witness (t, th);
   280 
       
   281 fun dest_witness (Witness w) = w;
   280 fun dest_witness (Witness w) = w;
   282 
   281 
   283 fun transfer_witness thy (Witness (t, th)) = Witness (t, Thm.transfer thy th);
   282 fun transfer_witness thy (Witness (t, th)) = Witness (t, Thm.transfer thy th);
   284 
   283 
   285 val refine_witness =
   284 val refine_witness =