src/Pure/Isar/method.ML
changeset 15973 5fd94d84470f
parent 15829 652e53c4a1ed
child 16145 1bb17485602f
equal deleted inserted replaced
15972:8ac3803c8f73 15973:5fd94d84470f
   152 
   152 
   153 
   153 
   154 (* shuffle *)
   154 (* shuffle *)
   155 
   155 
   156 fun prefer i = METHOD (K (Tactic.defer_tac i THEN PRIMITIVE (Thm.permute_prems 0 ~1)));
   156 fun prefer i = METHOD (K (Tactic.defer_tac i THEN PRIMITIVE (Thm.permute_prems 0 ~1)));
   157 fun defer opt_i = METHOD (K (Tactic.defer_tac (getOpt (opt_i,1))));
   157 fun defer opt_i = METHOD (K (Tactic.defer_tac (if_none opt_i 1)));
   158 
   158 
   159 
   159 
   160 (* insert *)
   160 (* insert *)
   161 
   161 
   162 local
   162 local
   261   end);
   261   end);
   262 
   262 
   263 in
   263 in
   264 
   264 
   265 fun rules_tac ctxt opt_lim =
   265 fun rules_tac ctxt opt_lim =
   266   SELECT_GOAL (DEEPEN (2, getOpt (opt_lim,20)) (intpr_tac ctxt [] 0) 4 1);
   266   SELECT_GOAL (DEEPEN (2, if_none opt_lim 20) (intpr_tac ctxt [] 0) 4 1);
   267 
   267 
   268 end;
   268 end;
   269 
   269 
   270 
   270 
   271 (* rule_tac etc. *)
   271 (* rule_tac etc. *)
   374                            (* the same name are renamed during printing *)
   374                            (* the same name are renamed during printing *)
   375         fun types' (a, ~1) = (case assoc (params, a) of
   375         fun types' (a, ~1) = (case assoc (params, a) of
   376                 NONE => types (a, ~1)
   376                 NONE => types (a, ~1)
   377               | some => some)
   377               | some => some)
   378           | types' xi = types xi;
   378           | types' xi = types xi;
   379         fun internal x = isSome (types' (x, ~1));
   379         fun internal x = is_some (types' (x, ~1));
   380         val used = Drule.add_used thm (Drule.add_used st []);
   380         val used = Drule.add_used thm (Drule.add_used st []);
   381         val (ts, envT) =
   381         val (ts, envT) =
   382           ProofContext.read_termTs_schematic ctxt internal types' sorts used (ss ~~ Ts);
   382           ProofContext.read_termTs_schematic ctxt internal types' sorts used (ss ~~ Ts);
   383         val envT' = map (fn (ixn, T) =>
   383         val envT' = map (fn (ixn, T) =>
   384           (TVar (ixn, valOf (rsorts ixn)), T)) envT @ Tinsts_env;
   384           (TVar (ixn, the (rsorts ixn)), T)) envT @ Tinsts_env;
   385         val cenv =
   385         val cenv =
   386           map
   386           map
   387             (fn (xi, t) =>
   387             (fn (xi, t) =>
   388               pairself (Thm.cterm_of sign) (Var (xi, fastype_of t), t))
   388               pairself (Thm.cterm_of sign) (Var (xi, fastype_of t), t))
   389             (gen_distinct
   389             (gen_distinct
   733   | finish_text asm (SOME txt) = Then [txt, close_text asm];
   733   | finish_text asm (SOME txt) = Then [txt, close_text asm];
   734 
   734 
   735 fun proof opt_text state =
   735 fun proof opt_text state =
   736   state
   736   state
   737   |> Proof.assert_backward
   737   |> Proof.assert_backward
   738   |> refine (getOpt (opt_text,default_text))
   738   |> refine (if_none opt_text default_text)
   739   |> Seq.map (Proof.goal_facts (K []))
   739   |> Seq.map (Proof.goal_facts (K []))
   740   |> Seq.map Proof.enter_forward;
   740   |> Seq.map Proof.enter_forward;
   741 
   741 
   742 fun local_qed asm opt_text = Proof.local_qed (refine (finish_text asm opt_text));
   742 fun local_qed asm opt_text = Proof.local_qed (refine (finish_text asm opt_text));
   743 fun local_terminal_proof (text, opt_text) pr =
   743 fun local_terminal_proof (text, opt_text) pr =