Nominal/Ex/LF.thy
author Christian Urban <urbanc@in.tum.de>
Tue, 10 Apr 2012 16:02:30 +0100
changeset 3158 89f9d7e85e88
parent 3134 301b74fcd614
permissions -rw-r--r--
moved lift_raw_const from Quotient to Nominal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2083
9568f9f31822 tuned file names for examples
Christian Urban <urbanc@in.tum.de>
parents: 2082
diff changeset
     1
theory LF
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2440
diff changeset
     2
imports "../Nominal2"
985
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
atom_decl ident
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
     8
nominal_datatype lf:
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
     9
    kind =
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    10
      Type
2950
0911cb7bf696 changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents: 2779
diff changeset
    11
    | KPi "ty" n::"name" k::"kind" binds n in k
1348
2e2a3cd58f64 Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1344
diff changeset
    12
and ty =
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    13
      TConst "ident"
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    14
    | TApp "ty" "trm"
2950
0911cb7bf696 changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents: 2779
diff changeset
    15
    | TPi "ty" n::"name" ty::"ty"   binds n in ty
1348
2e2a3cd58f64 Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1344
diff changeset
    16
and trm =
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    17
      Const "ident"
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    18
    | Var "name"
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    19
    | App "trm" "trm"
2950
0911cb7bf696 changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents: 2779
diff changeset
    20
    | Lam' "ty" n::"name" t::"trm"  binds n in t
2779
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    21
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    22
abbreviation
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    23
  KPi_syn::"name \<Rightarrow> ty \<Rightarrow> kind \<Rightarrow> kind" ("\<Pi>[_:_]._" [100,100,100] 100)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    24
where 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    25
  "\<Pi>[x:A].K \<equiv> KPi A x K"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    26
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    27
abbreviation
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    28
  TPi_syn::"name \<Rightarrow> ty \<Rightarrow> ty \<Rightarrow> ty" ("\<Pi>[_:_]._" [100,100,100] 100)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    29
where 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    30
  "\<Pi>[x:A1].A2 \<equiv> TPi A1 x A2"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    31
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    32
abbreviation
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    33
  Lam_syn::"name \<Rightarrow> ty \<Rightarrow> trm \<Rightarrow> trm" ("Lam [_:_]._" [100,100,100] 100)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    34
where 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    35
  "Lam [x:A].M \<equiv> Lam' A x M"
994
333c24bd595d More in the LF example in the new nominal way, all is clear until support.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 993
diff changeset
    36
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    37
thm lf.distinct
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    38
thm lf.induct
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    39
thm lf.inducts
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    40
thm lf.exhaust
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    41
thm lf.strong_exhaust
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    42
thm lf.fv_defs
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    43
thm lf.bn_defs
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    44
thm lf.perm_simps
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    45
thm lf.eq_iff
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    46
thm lf.fv_bn_eqvt
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    47
thm lf.size_eqvt
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    48
thm lf.supports
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    49
thm lf.fsupp
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    50
thm lf.supp
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    51
thm lf.fresh
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    52
thm lf.fresh[simplified]
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    53
2779
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    54
nominal_datatype sig_ass =
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    55
    TC_ass "ident" "kind"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    56
  | C_ass "ident" "ty"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2059
diff changeset
    57
3045
d0ad264f8c4f updated to Isabelle 3 Nov; it includes a hack to work around a bug in the localised version of the quotient package
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    58
type_synonym Sig = "sig_ass list"
d0ad264f8c4f updated to Isabelle 3 Nov; it includes a hack to work around a bug in the localised version of the quotient package
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    59
type_synonym Ctx = "(name \<times> ty) list"
d0ad264f8c4f updated to Isabelle 3 Nov; it includes a hack to work around a bug in the localised version of the quotient package
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    60
type_synonym Subst = "(name \<times> trm) list"
2779
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    61
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    62
inductive
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    63
    sig_valid  :: "Sig \<Rightarrow> bool" ("\<turnstile> _ sig" [60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    64
and ctx_valid  :: "Sig \<Rightarrow> Ctx \<Rightarrow> bool" ("_ \<turnstile> _ ctx" [60,60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    65
and trm_valid  :: "Sig \<Rightarrow> Ctx \<Rightarrow> trm \<Rightarrow> ty \<Rightarrow> bool" ("_,_ \<turnstile> _ : _" [60,60,60,60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    66
and ty_valid   :: "Sig \<Rightarrow> Ctx \<Rightarrow> ty \<Rightarrow> kind \<Rightarrow> bool" ("_,_ \<turnstile> _ : _" [60,60,60,60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    67
and kind_valid :: "Sig \<Rightarrow> Ctx \<Rightarrow> kind \<Rightarrow> bool" ("_,_ \<turnstile> _ : Kind" [60,60,60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    68
and trm_equiv  :: "Sig \<Rightarrow> Ctx \<Rightarrow> trm \<Rightarrow> trm \<Rightarrow> ty \<Rightarrow> bool" ("_,_ \<turnstile> _ = _ : _" [60,60,60,60,60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    69
and ty_equiv   :: "Sig \<Rightarrow> Ctx \<Rightarrow> ty \<Rightarrow> ty \<Rightarrow> kind \<Rightarrow> bool" ("_,_ \<turnstile> _ = _ : _" [60,60,60,60,60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    70
and kind_equiv :: "Sig \<Rightarrow> Ctx \<Rightarrow> kind \<Rightarrow> kind \<Rightarrow> bool" ("_,_ \<turnstile> _ = _ : Kind" [60,60,60,60] 60)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    71
where
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    72
(* Signatures *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    73
  s1: "\<turnstile> [] sig"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    74
| s2: "\<lbrakk>\<turnstile> \<Sigma> sig; \<Sigma>,[] \<turnstile> K : Kind; atom a\<sharp>\<Sigma>\<rbrakk> \<Longrightarrow> \<turnstile> (TC_ass a K)#\<Sigma> sig"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    75
| s3: "\<lbrakk>\<turnstile> \<Sigma> sig; \<Sigma>,[] \<turnstile> A : Type; atom c\<sharp>\<Sigma>\<rbrakk> \<Longrightarrow> \<turnstile> (C_ass c A)#\<Sigma> sig"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    76
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    77
(* Contexts *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    78
| c1: "\<turnstile> \<Sigma> sig \<Longrightarrow> \<Sigma> \<turnstile> [] ctx"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    79
| c2: "\<lbrakk>\<Sigma> \<turnstile> \<Gamma>  ctx; \<Sigma>,\<Gamma> \<turnstile> A : Type; atom x\<sharp>\<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma> \<turnstile> (x,A)#\<Gamma> ctx"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    80
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    81
(* Typing Terms *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    82
| t1: "\<lbrakk>\<Sigma> \<turnstile> \<Gamma>  ctx; (x,A) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (Var x) : A"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    83
| t2: "\<lbrakk>\<Sigma> \<turnstile> \<Gamma>  ctx; C_ass c A \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (Const c) : A"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    84
| t3: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> M1 : \<Pi>[x:A2].A1; \<Sigma>,\<Gamma> \<turnstile> M2 : A2; atom x\<sharp>\<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (App M1 M2) : A1"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    85
| t4: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A1 : Type; \<Sigma>,(x,A1)#\<Gamma> \<turnstile> M2 : A2; atom x\<sharp>(\<Gamma>,A1)\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (Lam [x:A1].M2) : \<Pi>[x:A1].A2"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    86
| t5: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> M : A; \<Sigma>,\<Gamma> \<turnstile> A = B : Type\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> M : B "
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    87
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    88
(* Typing Types *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    89
| f1: "\<lbrakk>\<Sigma> \<turnstile> \<Gamma>  ctx; TC_ass a K \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (TConst a) : K"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    90
| f2: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A : \<Pi>[x:B].K; \<Sigma>,\<Gamma> \<turnstile> M : B; atom x\<sharp>\<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (TApp A M) : K"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    91
| f3: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A1 : Type; \<Sigma>,(x,A1)#\<Gamma> \<turnstile> A2 : Type; atom x\<sharp>(\<Gamma>,A1)\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (\<Pi>[x:A1].A2) : Type"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    92
| f4: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A : K; \<Sigma>,\<Gamma> \<turnstile> K = L : Kind\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> A : L"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    93
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    94
(* Typing Kinds *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    95
| k1: "\<Sigma> \<turnstile> \<Gamma> ctx \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> Type : Kind"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    96
| k2: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A : Type; \<Sigma>,(x,A)#\<Gamma> \<turnstile> K : Kind; atom x\<sharp>(\<Gamma>,A)\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (\<Pi>[x:A].K) : Kind"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    97
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    98
(* Simultaneous Congruence for Terms *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    99
| q1: "\<lbrakk>\<Sigma> \<turnstile> \<Gamma>  ctx; (x,A) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (Var x) = (Var x) : A"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   100
| q2: "\<lbrakk>\<Sigma> \<turnstile> \<Gamma>  ctx; C_ass c A \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (Const c) = (Const c): A"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   101
| q3: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> M1 = N1 : \<Pi>[x:A2].A1; \<Sigma>,\<Gamma> \<turnstile> M2 = N2 : A2; atom x\<sharp>\<Gamma>\<rbrakk> 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   102
       \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (App M1 M2) = (App N1 N2) : A1"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   103
| q4: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A1' = A1 : Type; \<Sigma>,\<Gamma> \<turnstile> A1'' = A1 : Type; \<Sigma>,\<Gamma> \<turnstile> A1 : Type;
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   104
        \<Sigma>,(x,A1)#\<Gamma> \<turnstile> M2 = N2 : A2; atom x\<sharp>\<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (Lam [x:A1'].M2) = (Lam [x:A1''].N2) : \<Pi>[x:A1].A2"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   105
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   106
(* Extensionality *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   107
| ex: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> M : \<Pi>[x:A1].A2; \<Sigma>,\<Gamma> \<turnstile> N : \<Pi>[x:A1].A2; \<Sigma>,\<Gamma> \<turnstile> A1 : Type;
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   108
        \<Sigma>,(x,A1)#\<Gamma> \<turnstile> App M (Var x) = App N (Var x) : A2; atom x\<sharp>\<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> M = N : \<Pi>[x:A1].A2"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   109
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   110
(* Parallel Conversion *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   111
| pc: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A1 : Type; \<Sigma>,(x,A1)#\<Gamma> \<turnstile> M2 = N2 : A2; \<Sigma>,\<Gamma> \<turnstile> M1 = N1 : A1; atom x\<sharp>\<Gamma>\<rbrakk> 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   112
       \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> App (Lam [x:A1].M2) M1 = N2 : A2"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   113
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   114
(* Equivalence *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   115
| e1: "\<Sigma>,\<Gamma> \<turnstile> M = N : A \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> N = M : (A::ty)"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   116
| e2: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> M = N : A; \<Sigma>,\<Gamma> \<turnstile> N = P : A\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> M = P : (A::ty)"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   117
(*| e3: "\<Sigma>,\<Gamma> \<turnstile> M : A \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> M = M : (A::ty)"*)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   118
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   119
(* Type conversion *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   120
| tc: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> M = N : A; \<Sigma>,\<Gamma> \<turnstile> A = B : Type\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> M = N : B"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   121
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   122
(* Types Conruence *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   123
| ft1: "\<lbrakk>\<Sigma> \<turnstile> \<Gamma>  ctx; TC_ass a K \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (TConst a) = (TConst a) : K"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   124
| ft2: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A = B : \<Pi>[x:C].K; \<Sigma>,\<Gamma> \<turnstile> M = N : C; atom x\<sharp>\<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> (TApp A M) = (TApp B N) : K"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   125
| ft3: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A1 = B1 : Type; \<Sigma>,\<Gamma> \<turnstile> A1 : Type; \<Sigma>,(x,A1)#\<Gamma> \<turnstile> A2 = B2 : Type; atom x\<sharp>\<Gamma>\<rbrakk> 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   126
       \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> \<Pi>[x:A1].A2 = \<Pi>[x:B1].B2 : Type"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   127
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   128
(* Types Equivalence *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   129
| fe1: "\<Sigma>,\<Gamma> \<turnstile> A = (B::ty) : (K::kind) \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> B = A : K"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   130
| fe2: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A = B : K; \<Sigma>,\<Gamma> \<turnstile> B = C : K\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> A = C : (K::kind)"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   131
(*| fe3: "\<Sigma>,\<Gamma> \<turnstile> A : K \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> A = A : (K::kind)"*)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   132
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   133
(* Kind Conversion *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   134
| kc: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A = B : K; \<Sigma>,\<Gamma> \<turnstile> K = L : Kind\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> A = B : (L::kind)"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   135
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   136
(* Kind Congruence *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   137
| kc1: "\<Sigma> \<turnstile> \<Gamma> ctx \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> Type = Type : Kind"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   138
| kc2: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A = B : Type; \<Sigma>,\<Gamma> \<turnstile> A : Type; \<Sigma>,(x,A)#\<Gamma> \<turnstile> K = L : Kind; atom x\<sharp>\<Gamma>\<rbrakk> 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   139
        \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> \<Pi>[x:A].K = \<Pi>[x:B].L : Kind"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   140
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   141
(* Kind Equivalence *)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   142
| ke1: "\<Sigma>,\<Gamma> \<turnstile> K = L : Kind \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> L = K : Kind"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   143
| ke2: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> K = L : Kind; \<Sigma>,\<Gamma> \<turnstile> L = L' : Kind\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> K = L' : Kind"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   144
(*| ke3: "\<Sigma>,\<Gamma> \<turnstile> K : Kind \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> K = K : Kind"*)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   145
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   146
(* type extensionality - needed in order to get the soundness theorem through*)
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   147
| tex: "\<lbrakk>\<Sigma>,\<Gamma> \<turnstile> A : \<Pi>[x:C].K; \<Sigma>,\<Gamma> \<turnstile> B : \<Pi>[x:C].K; \<Sigma>,\<Gamma> \<turnstile> C : Type; 
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   148
         \<Sigma>,(x,C)#\<Gamma> \<turnstile> TApp A (Var x) = TApp B (Var x) : K; atom x\<sharp>\<Gamma>\<rbrakk> \<Longrightarrow> \<Sigma>,\<Gamma> \<turnstile> A = B : \<Pi>[x:C].K"
3c769bf10e63 added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
   149
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2059
diff changeset
   150
985
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   151
end
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   152
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   153
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
ef8a2b0b237a Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155