src/HOL/Record.thy
author nipkow
Mon Aug 16 14:22:27 2004 +0200 (2004-08-16)
changeset 15131 c69542757a4d
parent 14701 62a724ce51c7
child 15140 322485b816ac
permissions -rw-r--r--
New theory header syntax.
     1 (*  Title:      HOL/Record.thy
     2     ID:         $Id$
     3     Author:     Wolfgang Naraschewski, Norbert Schirmer  and Markus Wenzel, TU Muenchen
     4 *)
     5 
     6 theory Record
     7 import Product_Type
     8 files ("Tools/record_package.ML")
     9 begin
    10 
    11 ML {*
    12 val [h1, h2] = Goal "PROP Goal (\<And>x. PROP P x) \<Longrightarrow> (PROP P x \<Longrightarrow> PROP Q) \<Longrightarrow> PROP Q";
    13 by (rtac h2 1);
    14 by (rtac (gen_all (h1 RS Drule.rev_triv_goal)) 1);
    15 qed "meta_allE";
    16 *}
    17 
    18 lemma prop_subst: "s = t \<Longrightarrow> PROP P t \<Longrightarrow> PROP P s"
    19   by simp
    20 
    21 lemma rec_UNIV_I: "\<And>x. x\<in>UNIV \<equiv> True"
    22   by simp
    23 
    24 lemma rec_True_simp: "(True \<Longrightarrow> PROP P) \<equiv> PROP P"
    25   by simp
    26 
    27 
    28 subsection {* Concrete record syntax *}
    29 
    30 nonterminals
    31   ident field_type field_types field fields update updates
    32 syntax
    33   "_constify"           :: "id => ident"                        ("_")
    34   "_constify"           :: "longid => ident"                    ("_")
    35 
    36   "_field_type"         :: "[ident, type] => field_type"        ("(2_ ::/ _)")
    37   ""                    :: "field_type => field_types"          ("_")
    38   "_field_types"        :: "[field_type, field_types] => field_types"    ("_,/ _")
    39   "_record_type"        :: "field_types => type"                ("(3'(| _ |'))")
    40   "_record_type_scheme" :: "[field_types, type] => type"        ("(3'(| _,/ (2... ::/ _) |'))")
    41 
    42   "_field"              :: "[ident, 'a] => field"               ("(2_ =/ _)")
    43   ""                    :: "field => fields"                    ("_")
    44   "_fields"             :: "[field, fields] => fields"          ("_,/ _")
    45   "_record"             :: "fields => 'a"                       ("(3'(| _ |'))")
    46   "_record_scheme"      :: "[fields, 'a] => 'a"                 ("(3'(| _,/ (2... =/ _) |'))")
    47 
    48   "_update_name"        :: idt
    49   "_update"             :: "[ident, 'a] => update"              ("(2_ :=/ _)")
    50   ""                    :: "update => updates"                  ("_")
    51   "_updates"            :: "[update, updates] => updates"       ("_,/ _")
    52   "_record_update"      :: "['a, updates] => 'b"                ("_/(3'(| _ |'))" [900,0] 900)
    53 
    54 syntax (xsymbols)
    55   "_record_type"        :: "field_types => type"                ("(3\<lparr>_\<rparr>)")
    56   "_record_type_scheme" :: "[field_types, type] => type"        ("(3\<lparr>_,/ (2\<dots> ::/ _)\<rparr>)")
    57   "_record"             :: "fields => 'a"                               ("(3\<lparr>_\<rparr>)")
    58   "_record_scheme"      :: "[fields, 'a] => 'a"                 ("(3\<lparr>_,/ (2\<dots> =/ _)\<rparr>)")
    59   "_record_update"      :: "['a, updates] => 'b"                ("_/(3\<lparr>_\<rparr>)" [900,0] 900)
    60 
    61 use "Tools/record_package.ML";
    62 setup RecordPackage.setup;
    63 
    64 end
    65