src/HOL/Record.thy
author nipkow
Fri Aug 28 18:52:41 2009 +0200 (2009-08-28)
changeset 32436 10cd49e0c067
parent 31723 f5cafe803b55
child 32743 c4e9a48bc50e
permissions -rw-r--r--
Turned "x <= y ==> sup x y = y" (and relatives) into simp rules
wenzelm@4870
     1
(*  Title:      HOL/Record.thy
wenzelm@16114
     2
    Author:     Wolfgang Naraschewski, Norbert Schirmer and Markus Wenzel, TU Muenchen
wenzelm@4870
     3
*)
wenzelm@4870
     4
wenzelm@22817
     5
header {* Extensible records with structural subtyping *}
wenzelm@22817
     6
nipkow@15131
     7
theory Record
nipkow@15140
     8
imports Product_Type
haftmann@31723
     9
uses ("Tools/record.ML")
nipkow@15131
    10
begin
wenzelm@4870
    11
schirmer@14700
    12
lemma prop_subst: "s = t \<Longrightarrow> PROP P t \<Longrightarrow> PROP P s"
schirmer@14700
    13
  by simp
wenzelm@11826
    14
schirmer@14700
    15
lemma rec_UNIV_I: "\<And>x. x\<in>UNIV \<equiv> True"
schirmer@14700
    16
  by simp
wenzelm@11826
    17
schirmer@14700
    18
lemma rec_True_simp: "(True \<Longrightarrow> PROP P) \<equiv> PROP P"
schirmer@14700
    19
  by simp
berghofe@14080
    20
schirmer@25705
    21
lemma K_record_comp: "(\<lambda>x. c) \<circ> f = (\<lambda>x. c)" 
schirmer@25705
    22
  by (simp add: comp_def)
wenzelm@11821
    23
wenzelm@22817
    24
wenzelm@11833
    25
subsection {* Concrete record syntax *}
wenzelm@4870
    26
wenzelm@4870
    27
nonterminals
wenzelm@5198
    28
  ident field_type field_types field fields update updates
wenzelm@4870
    29
syntax
wenzelm@11821
    30
  "_constify"           :: "id => ident"                        ("_")
wenzelm@11821
    31
  "_constify"           :: "longid => ident"                    ("_")
wenzelm@5198
    32
wenzelm@11821
    33
  "_field_type"         :: "[ident, type] => field_type"        ("(2_ ::/ _)")
wenzelm@11821
    34
  ""                    :: "field_type => field_types"          ("_")
wenzelm@11821
    35
  "_field_types"        :: "[field_type, field_types] => field_types"    ("_,/ _")
wenzelm@11821
    36
  "_record_type"        :: "field_types => type"                ("(3'(| _ |'))")
wenzelm@10093
    37
  "_record_type_scheme" :: "[field_types, type] => type"        ("(3'(| _,/ (2... ::/ _) |'))")
wenzelm@5198
    38
wenzelm@11821
    39
  "_field"              :: "[ident, 'a] => field"               ("(2_ =/ _)")
wenzelm@11821
    40
  ""                    :: "field => fields"                    ("_")
wenzelm@11821
    41
  "_fields"             :: "[field, fields] => fields"          ("_,/ _")
wenzelm@11821
    42
  "_record"             :: "fields => 'a"                       ("(3'(| _ |'))")
wenzelm@10093
    43
  "_record_scheme"      :: "[fields, 'a] => 'a"                 ("(3'(| _,/ (2... =/ _) |'))")
wenzelm@5198
    44
wenzelm@10641
    45
  "_update_name"        :: idt
wenzelm@11821
    46
  "_update"             :: "[ident, 'a] => update"              ("(2_ :=/ _)")
wenzelm@11821
    47
  ""                    :: "update => updates"                  ("_")
wenzelm@11821
    48
  "_updates"            :: "[update, updates] => updates"       ("_,/ _")
wenzelm@10093
    49
  "_record_update"      :: "['a, updates] => 'b"                ("_/(3'(| _ |'))" [900,0] 900)
wenzelm@4870
    50
wenzelm@10331
    51
syntax (xsymbols)
wenzelm@11821
    52
  "_record_type"        :: "field_types => type"                ("(3\<lparr>_\<rparr>)")
wenzelm@10093
    53
  "_record_type_scheme" :: "[field_types, type] => type"        ("(3\<lparr>_,/ (2\<dots> ::/ _)\<rparr>)")
wenzelm@10093
    54
  "_record"             :: "fields => 'a"                               ("(3\<lparr>_\<rparr>)")
wenzelm@10093
    55
  "_record_scheme"      :: "[fields, 'a] => 'a"                 ("(3\<lparr>_,/ (2\<dots> =/ _)\<rparr>)")
wenzelm@10093
    56
  "_record_update"      :: "['a, updates] => 'b"                ("_/(3\<lparr>_\<rparr>)" [900,0] 900)
wenzelm@9729
    57
haftmann@31723
    58
use "Tools/record.ML"
haftmann@31723
    59
setup Record.setup
wenzelm@10641
    60
wenzelm@4870
    61
end