src/Cube/Cube.thy
author wenzelm
Sun, 30 Sep 2007 21:55:15 +0200
changeset 24783 5a3e336a2e37
parent 22809 3cf5df73d50a
child 26956 1309a6a0a29f
permissions -rw-r--r--
avoid internal names;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22809
3cf5df73d50a added header;
wenzelm
parents: 17782
diff changeset
     1
(*  Title:      Cube/Cube.thy
3cf5df73d50a added header;
wenzelm
parents: 17782
diff changeset
     2
    ID:         $Id$
3cf5df73d50a added header;
wenzelm
parents: 17782
diff changeset
     3
    Author:     Tobias Nipkow
3cf5df73d50a added header;
wenzelm
parents: 17782
diff changeset
     4
*)
3773
989ef5e9d543 syntactic constants;
wenzelm
parents: 1149
diff changeset
     5
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
     6
header {* Barendregt's Lambda-Cube *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
     7
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
     8
theory Cube
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
     9
imports Pure
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    10
begin
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    11
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    12
typedecl "term"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    13
typedecl "context"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    14
typedecl typing
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    15
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    16
nonterminals
24783
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    17
  context' typing'
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    18
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    19
consts
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    20
  Abs           :: "[term, term => term] => term"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    21
  Prod          :: "[term, term => term] => term"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    22
  Trueprop      :: "[context, typing] => prop"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    23
  MT_context    :: "context"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    24
  Context       :: "[typing, context] => context"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    25
  star          :: "term"                               ("*")
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    26
  box           :: "term"                               ("[]")
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    27
  app           :: "[term, term] => term"               (infixl "^" 20)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    28
  Has_type      :: "[term, term] => typing"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    29
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    30
syntax
24783
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    31
  Trueprop      :: "[context', typing'] => prop"        ("(_/ |- _)")
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    32
  Trueprop1     :: "typing' => prop"                    ("(_)")
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    33
  ""            :: "id => context'"                     ("_")
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    34
  ""            :: "var => context'"                    ("_")
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    35
  MT_context    :: "context'"                           ("")
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    36
  Context       :: "[typing', context'] => context'"    ("_ _")
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    37
  Has_type      :: "[term, term] => typing'"            ("(_:/ _)" [0, 0] 5)
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    38
  Lam           :: "[idt, term, term] => term"          ("(3Lam _:_./ _)" [0, 0, 0] 10)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    39
  Pi            :: "[idt, term, term] => term"          ("(3Pi _:_./ _)" [0, 0] 10)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    40
  arrow         :: "[term, term] => term"               (infixr "->" 10)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    41
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    42
translations
17260
wenzelm
parents: 17252
diff changeset
    43
  ("prop") "x:X" == ("prop") "|- x:X"
wenzelm
parents: 17252
diff changeset
    44
  "Lam x:A. B"   == "Abs(A, %x. B)"
wenzelm
parents: 17252
diff changeset
    45
  "Pi x:A. B"    => "Prod(A, %x. B)"
17782
b3846df9d643 replaced _K by dummy abstraction;
wenzelm
parents: 17260
diff changeset
    46
  "A -> B"       => "Prod(A, %_. B)"
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    47
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    48
syntax (xsymbols)
24783
5a3e336a2e37 avoid internal names;
wenzelm
parents: 22809
diff changeset
    49
  Trueprop      :: "[context', typing'] => prop"        ("(_/ \<turnstile> _)")
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    50
  box           :: "term"                               ("\<box>")
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    51
  Lam           :: "[idt, term, term] => term"          ("(3\<Lambda> _:_./ _)" [0, 0, 0] 10)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    52
  Pi            :: "[idt, term, term] => term"          ("(3\<Pi> _:_./ _)" [0, 0] 10)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    53
  arrow         :: "[term, term] => term"               (infixr "\<rightarrow>" 10)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    54
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    55
print_translation {* [("Prod", dependent_tr' ("Pi", "arrow"))] *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    56
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    57
axioms
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    58
  s_b:          "*: []"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    59
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    60
  strip_s:      "[| A:*;  a:A ==> G |- x:X |] ==> a:A G |- x:X"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    61
  strip_b:      "[| A:[]; a:A ==> G |- x:X |] ==> a:A G |- x:X"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    62
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    63
  app:          "[| F:Prod(A, B); C:A |] ==> F^C: B(C)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    65
  pi_ss:        "[| A:*; !!x. x:A ==> B(x):* |] ==> Prod(A, B):*"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    66
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    67
  lam_ss:       "[| A:*; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):* |]
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    68
                   ==> Abs(A, f) : Prod(A, B)"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    69
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    70
  beta:          "Abs(A, f)^a == f(a)"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    71
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    72
lemmas simple = s_b strip_s strip_b app lam_ss pi_ss
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    73
lemmas rules = simple
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    74
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    75
lemma imp_elim:
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    76
  assumes "f:A->B" and "a:A" and "f^a:B ==> PROP P"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    77
  shows "PROP P" by (rule app prems)+
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    78
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    79
lemma pi_elim:
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    80
  assumes "F:Prod(A,B)" and "a:A" and "F^a:B(a) ==> PROP P"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    81
  shows "PROP P" by (rule app prems)+
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    82
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    83
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    84
locale L2 =
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    85
  assumes pi_bs: "[| A:[]; !!x. x:A ==> B(x):* |] ==> Prod(A,B):*"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    86
    and lam_bs: "[| A:[]; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):* |]
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    87
                   ==> Abs(A,f) : Prod(A,B)"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    88
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    89
lemmas (in L2) rules = simple lam_bs pi_bs
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    90
17260
wenzelm
parents: 17252
diff changeset
    91
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    92
locale Lomega =
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    93
  assumes
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    94
    pi_bb: "[| A:[]; !!x. x:A ==> B(x):[] |] ==> Prod(A,B):[]"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    95
    and lam_bb: "[| A:[]; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):[] |]
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    96
                   ==> Abs(A,f) : Prod(A,B)"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    97
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    98
lemmas (in Lomega) rules = simple lam_bb pi_bb
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
    99
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   100
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   101
locale LP =
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   102
  assumes pi_sb: "[| A:*; !!x. x:A ==> B(x):[] |] ==> Prod(A,B):[]"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   103
    and lam_sb: "[| A:*; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):[] |]
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   104
                   ==> Abs(A,f) : Prod(A,B)"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   105
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   106
lemmas (in LP) rules = simple lam_sb pi_sb
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   107
17260
wenzelm
parents: 17252
diff changeset
   108
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   109
locale LP2 = LP + L2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   110
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   111
lemmas (in LP2) rules = simple lam_bs pi_bs lam_sb pi_sb
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   112
17260
wenzelm
parents: 17252
diff changeset
   113
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   114
locale Lomega2 = L2 + Lomega
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   115
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   116
lemmas (in Lomega2) rules = simple lam_bs pi_bs lam_bb pi_bb
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   117
17260
wenzelm
parents: 17252
diff changeset
   118
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   119
locale LPomega = LP + Lomega
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   120
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   121
lemmas (in LPomega) rules = simple lam_bb pi_bb lam_sb pi_sb
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   122
17260
wenzelm
parents: 17252
diff changeset
   123
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   124
locale CC = L2 + LP + Lomega
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   125
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   126
lemmas (in CC) rules = simple lam_bs pi_bs lam_bb pi_bb lam_sb pi_sb
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   127
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 11260
diff changeset
   128
end