src/Pure/Isar/proof_context.ML
changeset 35139 e1a226a191b6
parent 35129 ed24ba6f69aa
child 35141 182f27a8716c
equal deleted inserted replaced
35138:ad213c602ec1 35139:e1a226a191b6
    28   val full_name: Proof.context -> binding -> string
    28   val full_name: Proof.context -> binding -> string
    29   val syn_of: Proof.context -> Syntax.syntax
    29   val syn_of: Proof.context -> Syntax.syntax
    30   val consts_of: Proof.context -> Consts.T
    30   val consts_of: Proof.context -> Consts.T
    31   val const_syntax_name: Proof.context -> string -> string
    31   val const_syntax_name: Proof.context -> string -> string
    32   val the_const_constraint: Proof.context -> string -> typ
    32   val the_const_constraint: Proof.context -> string -> typ
    33   val mk_const: Proof.context -> string * typ list -> term
       
    34   val set_syntax_mode: Syntax.mode -> Proof.context -> Proof.context
    33   val set_syntax_mode: Syntax.mode -> Proof.context -> Proof.context
    35   val restore_syntax_mode: Proof.context -> Proof.context -> Proof.context
    34   val restore_syntax_mode: Proof.context -> Proof.context -> Proof.context
    36   val facts_of: Proof.context -> Facts.T
    35   val facts_of: Proof.context -> Facts.T
    37   val cases_of: Proof.context -> (string * (Rule_Cases.T * bool)) list
    36   val cases_of: Proof.context -> (string * (Rule_Cases.T * bool)) list
    38   val transfer_syntax: theory -> Proof.context -> Proof.context
    37   val transfer_syntax: theory -> Proof.context -> Proof.context
   238 
   237 
   239 val consts_of = #1 o #consts o rep_context;
   238 val consts_of = #1 o #consts o rep_context;
   240 val const_syntax_name = Consts.syntax_name o consts_of;
   239 val const_syntax_name = Consts.syntax_name o consts_of;
   241 val the_const_constraint = Consts.the_constraint o consts_of;
   240 val the_const_constraint = Consts.the_constraint o consts_of;
   242 
   241 
   243 fun mk_const ctxt (c, Ts) = Const (c, Consts.instance (consts_of ctxt) (c, Ts));
       
   244 
       
   245 val facts_of = #facts o rep_context;
   242 val facts_of = #facts o rep_context;
   246 val cases_of = #cases o rep_context;
   243 val cases_of = #cases o rep_context;
   247 
   244 
   248 
   245 
   249 (* theory transfer *)
   246 (* theory transfer *)
  1318     let
  1315     let
  1319       val prt_term = Syntax.pretty_term ctxt;
  1316       val prt_term = Syntax.pretty_term ctxt;
  1320 
  1317 
  1321       (*structures*)
  1318       (*structures*)
  1322       val structs = Local_Syntax.structs_of (syntax_of ctxt);
  1319       val structs = Local_Syntax.structs_of (syntax_of ctxt);
  1323       val prt_structs = if null structs then []
  1320       val prt_structs =
       
  1321         if null structs then []
  1324         else [Pretty.block (Pretty.str "structures:" :: Pretty.brk 1 ::
  1322         else [Pretty.block (Pretty.str "structures:" :: Pretty.brk 1 ::
  1325           Pretty.commas (map Pretty.str structs))];
  1323           Pretty.commas (map Pretty.str structs))];
  1326 
  1324 
  1327       (*fixes*)
  1325       (*fixes*)
  1328       fun prt_fix (x, x') =
  1326       fun prt_fix (x, x') =
  1329         if x = x' then Pretty.str x
  1327         if x = x' then Pretty.str x
  1330         else Pretty.block [Pretty.str x, Pretty.str " =", Pretty.brk 1, prt_term (Syntax.free x')];
  1328         else Pretty.block [Pretty.str x, Pretty.str " =", Pretty.brk 1, prt_term (Syntax.free x')];
  1331       val fixes =
  1329       val fixes =
  1332         rev (filter_out ((can Name.dest_internal orf member (op =) structs) o #1)
  1330         rev (filter_out ((can Name.dest_internal orf member (op =) structs) o #1)
  1333           (Variable.fixes_of ctxt));
  1331           (Variable.fixes_of ctxt));
  1334       val prt_fixes = if null fixes then []
  1332       val prt_fixes =
       
  1333         if null fixes then []
  1335         else [Pretty.block (Pretty.str "fixed variables:" :: Pretty.brk 1 ::
  1334         else [Pretty.block (Pretty.str "fixed variables:" :: Pretty.brk 1 ::
  1336           Pretty.commas (map prt_fix fixes))];
  1335           Pretty.commas (map prt_fix fixes))];
  1337 
  1336 
  1338       (*prems*)
  1337       (*prems*)
  1339       val prems = Assumption.all_prems_of ctxt;
  1338       val prems = Assumption.all_prems_of ctxt;
  1340       val len = length prems;
  1339       val len = length prems;
  1341       val suppressed = len - ! prems_limit;
  1340       val suppressed = len - ! prems_limit;
  1342       val prt_prems = if null prems then []
  1341       val prt_prems =
       
  1342         if null prems then []
  1343         else [Pretty.big_list "prems:" ((if suppressed <= 0 then [] else [Pretty.str "..."]) @
  1343         else [Pretty.big_list "prems:" ((if suppressed <= 0 then [] else [Pretty.str "..."]) @
  1344           map (Display.pretty_thm ctxt) (drop suppressed prems))];
  1344           map (Display.pretty_thm ctxt) (drop suppressed prems))];
  1345     in prt_structs @ prt_fixes @ prt_prems end;
  1345     in prt_structs @ prt_fixes @ prt_prems end;
  1346 
  1346 
  1347 
  1347