src/Pure/facts.ML
changeset 70545 b93ba98e627a
parent 68698 6ee53660a911
child 70546 2970fdc230cc
equal deleted inserted replaced
70544:16e98f89a29c 70545:b93ba98e627a
    10   datatype interval = FromTo of int * int | From of int | Single of int
    10   datatype interval = FromTo of int * int | From of int | Single of int
    11   datatype ref =
    11   datatype ref =
    12     Named of (string * Position.T) * interval list option |
    12     Named of (string * Position.T) * interval list option |
    13     Fact of string
    13     Fact of string
    14   val named: string -> ref
    14   val named: string -> ref
       
    15   val ref_name: ref -> string
       
    16   val ref_pos: ref -> Position.T
       
    17   val map_ref_name: (string -> string) -> ref -> ref
    15   val string_of_selection: interval list option -> string
    18   val string_of_selection: interval list option -> string
    16   val string_of_ref: ref -> string
    19   val string_of_ref: ref -> string
    17   val name_of_ref: ref -> string
       
    18   val pos_of_ref: ref -> Position.T
       
    19   val map_name_of_ref: (string -> string) -> ref -> ref
       
    20   val select: ref -> thm list -> thm list
    20   val select: ref -> thm list -> thm list
    21   val selections: string * thm list -> (ref * thm) list
    21   val selections: string * thm list -> (ref * thm) list
    22   type T
    22   type T
    23   val empty: T
    23   val empty: T
    24   val space_of: T -> Name_Space.T
    24   val space_of: T -> Name_Space.T
    83   Named of (string * Position.T) * interval list option |
    83   Named of (string * Position.T) * interval list option |
    84   Fact of string;
    84   Fact of string;
    85 
    85 
    86 fun named name = Named ((name, Position.none), NONE);
    86 fun named name = Named ((name, Position.none), NONE);
    87 
    87 
    88 fun name_of_ref (Named ((name, _), _)) = name
    88 fun ref_name (Named ((name, _), _)) = name
    89   | name_of_ref (Fact _) = raise Fail "Illegal literal fact";
    89   | ref_name (Fact _) = raise Fail "Illegal literal fact";
    90 
    90 
    91 fun pos_of_ref (Named ((_, pos), _)) = pos
    91 fun ref_pos (Named ((_, pos), _)) = pos
    92   | pos_of_ref (Fact _) = Position.none;
    92   | ref_pos (Fact _) = Position.none;
    93 
    93 
    94 fun map_name_of_ref f (Named ((name, pos), is)) = Named ((f name, pos), is)
    94 fun map_ref_name f (Named ((name, pos), is)) = Named ((f name, pos), is)
    95   | map_name_of_ref _ r = r;
    95   | map_ref_name _ r = r;
    96 
    96 
    97 fun string_of_selection NONE = ""
    97 fun string_of_selection NONE = ""
    98   | string_of_selection (SOME is) = enclose "(" ")" (commas (map string_of_interval is));
    98   | string_of_selection (SOME is) = enclose "(" ")" (commas (map string_of_interval is));
    99 
    99 
   100 fun string_of_ref (Named ((name, _), sel)) = name ^ string_of_selection sel
   100 fun string_of_ref (Named ((name, _), sel)) = name ^ string_of_selection sel