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