src/Pure/Isar/proof_context.ML
changeset 35255 2cb27605301f
parent 35211 5d2fe4e09354
child 35262 9ea4445d2ccf
equal deleted inserted replaced
35254:0f17eda72e60 35255:2cb27605301f
    26   val naming_of: Proof.context -> Name_Space.naming
    26   val naming_of: Proof.context -> Name_Space.naming
    27   val restore_naming: Proof.context -> Proof.context -> Proof.context
    27   val restore_naming: Proof.context -> Proof.context -> Proof.context
    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
       
    32   val the_const_constraint: Proof.context -> string -> typ
    31   val the_const_constraint: Proof.context -> string -> typ
    33   val set_syntax_mode: Syntax.mode -> Proof.context -> Proof.context
    32   val set_syntax_mode: Syntax.mode -> Proof.context -> Proof.context
    34   val restore_syntax_mode: Proof.context -> Proof.context -> Proof.context
    33   val restore_syntax_mode: Proof.context -> Proof.context -> Proof.context
    35   val facts_of: Proof.context -> Facts.T
    34   val facts_of: Proof.context -> Facts.T
    36   val cases_of: Proof.context -> (string * (Rule_Cases.T * bool)) list
    35   val cases_of: Proof.context -> (string * (Rule_Cases.T * bool)) list
   233 val syn_of = Local_Syntax.syn_of o syntax_of;
   232 val syn_of = Local_Syntax.syn_of o syntax_of;
   234 val set_syntax_mode = map_syntax o Local_Syntax.set_mode;
   233 val set_syntax_mode = map_syntax o Local_Syntax.set_mode;
   235 val restore_syntax_mode = map_syntax o Local_Syntax.restore_mode o syntax_of;
   234 val restore_syntax_mode = map_syntax o Local_Syntax.restore_mode o syntax_of;
   236 
   235 
   237 val consts_of = #1 o #consts o rep_context;
   236 val consts_of = #1 o #consts o rep_context;
   238 val const_syntax_name = Consts.syntax_name o consts_of;
       
   239 val the_const_constraint = Consts.the_constraint o consts_of;
   237 val the_const_constraint = Consts.the_constraint o consts_of;
   240 
   238 
   241 val facts_of = #facts o rep_context;
   239 val facts_of = #facts o rep_context;
   242 val cases_of = #cases o rep_context;
   240 val cases_of = #cases o rep_context;
   243 
   241 
   705     val thy = theory_of ctxt;
   703     val thy = theory_of ctxt;
   706     val syntax = syntax_of ctxt;
   704     val syntax = syntax_of ctxt;
   707     val consts = consts_of ctxt;
   705     val consts = consts_of ctxt;
   708   in
   706   in
   709     t
   707     t
   710     |> Sign.extern_term (Consts.extern_early consts) thy
   708     |> Sign.extern_term thy
   711     |> Local_Syntax.extern_term syntax
   709     |> Local_Syntax.extern_term syntax
   712     |> Syntax.standard_unparse_term (Consts.extern consts) ctxt (Local_Syntax.syn_of syntax)
   710     |> Syntax.standard_unparse_term (Consts.extern consts) ctxt
   713         (not (PureThy.old_appl_syntax thy))
   711         (Local_Syntax.syn_of syntax) (not (PureThy.old_appl_syntax thy))
   714   end;
   712   end;
   715 
   713 
   716 in
   714 in
   717 
   715 
   718 val _ = Syntax.install_operations
   716 val _ = Syntax.install_operations
   988 local
   986 local
   989 
   987 
   990 fun const_ast_tr intern ctxt [Syntax.Variable c] =
   988 fun const_ast_tr intern ctxt [Syntax.Variable c] =
   991       let
   989       let
   992         val Const (c', _) = read_const_proper ctxt c;
   990         val Const (c', _) = read_const_proper ctxt c;
   993         val d = if intern then const_syntax_name ctxt c' else c;
   991         val d = if intern then Syntax.constN ^ c' else c;
   994       in Syntax.Constant d end
   992       in Syntax.Constant d end
   995   | const_ast_tr _ _ asts = raise Syntax.AST ("const_ast_tr", asts);
   993   | const_ast_tr _ _ asts = raise Syntax.AST ("const_ast_tr", asts);
   996 
   994 
   997 in
   995 in
   998 
   996 
  1016 
  1014 
  1017 local
  1015 local
  1018 
  1016 
  1019 fun const_syntax _ (Free (x, T), mx) = SOME (true, (x, T, mx))
  1017 fun const_syntax _ (Free (x, T), mx) = SOME (true, (x, T, mx))
  1020   | const_syntax ctxt (Const (c, _), mx) =
  1018   | const_syntax ctxt (Const (c, _), mx) =
  1021       Option.map (pair false) (try (Consts.syntax (consts_of ctxt)) (c, mx))
  1019       (case try (Consts.type_scheme (consts_of ctxt)) c of
       
  1020         SOME T => SOME (false, (Syntax.constN ^ c, T, mx))
       
  1021       | NONE => NONE)
  1022   | const_syntax _ _ = NONE;
  1022   | const_syntax _ _ = NONE;
  1023 
  1023 
  1024 in
  1024 in
  1025 
  1025 
  1026 fun notation add mode args ctxt =
  1026 fun notation add mode args ctxt =