src/Pure/sign.ML
changeset 922 196ca0973a6d
parent 901 77795af99315
child 926 9d1348498c36
equal deleted inserted replaced
921:6bee3815c0bf 922:196ca0973a6d
    59       (string * (ast list -> ast)) list -> sg -> sg
    59       (string * (ast list -> ast)) list -> sg -> sg
    60     val add_trrules: xrule list -> sg -> sg
    60     val add_trrules: xrule list -> sg -> sg
    61     val add_name: string -> sg -> sg
    61     val add_name: string -> sg -> sg
    62     val make_draft: sg -> sg
    62     val make_draft: sg -> sg
    63     val merge: sg * sg -> sg
    63     val merge: sg * sg -> sg
       
    64     val proto_pure: sg
    64     val pure: sg
    65     val pure: sg
       
    66     val cpure: sg
    65     val const_of_class: class -> string
    67     val const_of_class: class -> string
    66     val class_of_const: string -> class
    68     val class_of_const: string -> class
    67   end
    69   end
    68 end;
    70 end;
    69 
    71 
   177 
   179 
   178 
   180 
   179 
   181 
   180 (** pretty printing of terms and types **)
   182 (** pretty printing of terms and types **)
   181 
   183 
   182 fun pretty_term (Sg {syn, ...}) = Syntax.pretty_term syn;
   184 fun pretty_term (Sg {syn, stamps, ...}) =
       
   185   let val curried = "CPure" mem (map ! stamps);
       
   186   in Syntax.pretty_term curried syn end;
       
   187 
   183 fun pretty_typ (Sg {syn, ...}) = Syntax.pretty_typ syn;
   188 fun pretty_typ (Sg {syn, ...}) = Syntax.pretty_typ syn;
   184 
   189 
   185 fun string_of_term (Sg {syn, ...}) = Syntax.string_of_term syn;
   190 fun string_of_term (Sg {syn, stamps, ...}) = 
       
   191   let val curried = "CPure" mem (map ! stamps);
       
   192   in Syntax.string_of_term curried syn end;
       
   193 
   186 fun string_of_typ (Sg {syn, ...}) = Syntax.string_of_typ syn;
   194 fun string_of_typ (Sg {syn, ...}) = Syntax.string_of_typ syn;
   187 
   195 
   188 fun pprint_term sg = Pretty.pprint o Pretty.quote o (pretty_term sg);
   196 fun pprint_term sg = Pretty.pprint o Pretty.quote o (pretty_term sg);
   189 fun pprint_typ sg = Pretty.pprint o Pretty.quote o (pretty_typ sg);
   197 fun pprint_typ sg = Pretty.pprint o Pretty.quote o (pretty_typ sg);
   190 
   198 
   514 
   522 
   515 
   523 
   516 
   524 
   517 (** the Pure signature **)
   525 (** the Pure signature **)
   518 
   526 
   519 val pure =
   527 val proto_pure =
   520   make_sign (Syntax.pure_syn, tsig0, Symtab.null) [] "#"
   528   make_sign (Syntax.pure_syn, tsig0, Symtab.null) [] "#"
   521   |> add_types
   529   |> add_types
   522    (("fun", 2, NoSyn) ::
   530    (("fun", 2, NoSyn) ::
   523     ("prop", 0, NoSyn) ::
   531     ("prop", 0, NoSyn) ::
   524     ("itself", 1, NoSyn) ::
   532     ("itself", 1, NoSyn) ::
   535    [("==", "['a::{}, 'a] => prop", Mixfix ("(_ ==/ _)", [3, 2], 2)),
   543    [("==", "['a::{}, 'a] => prop", Mixfix ("(_ ==/ _)", [3, 2], 2)),
   536     ("=?=", "['a::{}, 'a] => prop", Mixfix ("(_ =?=/ _)", [3, 2], 2)),
   544     ("=?=", "['a::{}, 'a] => prop", Mixfix ("(_ =?=/ _)", [3, 2], 2)),
   537     ("==>", "[prop, prop] => prop", Mixfix ("(_ ==>/ _)", [2, 1], 1)),
   545     ("==>", "[prop, prop] => prop", Mixfix ("(_ ==>/ _)", [2, 1], 1)),
   538     ("all", "('a => prop) => prop", Binder ("!!", 0, 0)),
   546     ("all", "('a => prop) => prop", Binder ("!!", 0, 0)),
   539     ("TYPE", "'a itself", NoSyn)]
   547     ("TYPE", "'a itself", NoSyn)]
       
   548   |> add_name "ProtoPure";
       
   549 
       
   550 val pure = proto_pure
       
   551   |> add_syntax
       
   552    [("_appl",     "[('b => 'a), args] => logic",    Mixfix ("(1_/(1'(_')))",
       
   553                                                     [max_pri, 0], max_pri)),
       
   554     ("_appl",     "[('b => 'a), args] => aprop",    Mixfix ("(1_/(1'(_')))",
       
   555                                                     [max_pri, 0], max_pri))]
   540   |> add_name "Pure";
   556   |> add_name "Pure";
   541 
   557 
       
   558 val cpure = proto_pure
       
   559   |> add_syntax
       
   560    [("_applC",     "[('b => 'a), 'c] => logic",     Mixfix ("(1_ (1_))",
       
   561                                                     [max_pri-1, max_pri],
       
   562                                                     max_pri-1)),
       
   563     ("_applC",     "[('b => 'a), 'c] => aprop",     Mixfix ("(1_ (1_))",
       
   564                                                     [max_pri-1, max_pri],
       
   565                                                     max_pri-1))]
       
   566   |> add_name "CPure";
   542 
   567 
   543 end;
   568 end;