Nominal/Ex/Classical.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Fri, 24 Jun 2011 10:12:47 +0900
changeset 2892 a9f3600c9ae6
parent 2891 304dfe6cc83a
child 2899 fe290b4e508f
permissions -rw-r--r--
Speed-up the completeness proof.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1792
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Classical
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     2
imports "../Nominal2"
1792
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
     5
(* example from Urban's PhD *)
1792
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
atom_decl name
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
atom_decl coname
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
nominal_datatype trm =
2889
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    11
  Ax "name" "coname"
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    12
| Cut c::"coname" t1::"trm" n::"name" t2::"trm"             bind n in t1, bind c in t2  
2889
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    13
     ("Cut <_>._ '(_')._" [100,100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    14
| NotR n::"name" t::"trm" "coname"                            bind n in t
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    15
     ("NotR '(_')._ _" [100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    16
| NotL c::"coname" t::"trm" "name"                            bind c in t   
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    17
     ("NotL <_>._ _" [100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    18
| AndR c1::"coname" t1::"trm" c2::"coname" t2::"trm" "coname" bind c1 in t1, bind c2 in t2
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    19
     ("AndR <_>._ <_>._ _" [100,100,100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    20
| AndL1 n::"name" t::"trm" "name"                             bind n in t
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    21
     ("AndL1 '(_')._ _" [100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    22
| AndL2 n::"name" t::"trm" "name"                             bind n in t
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    23
     ("AndL2 '(_')._ _" [100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    24
| OrR1 c::"coname" t::"trm" "coname"                          bind c in t             
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    25
     ("OrR1 <_>._ _" [100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    26
| OrR2 c::"coname" t::"trm" "coname"                          bind c in t     
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    27
     ("OrR2 <_>._ _" [100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    28
| OrL n1::"name" t1::"trm" n2::"name" t2::"trm" "name"        bind n1 in t1, bind n2 in t2       
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    29
     ("OrL '(_')._ '(_')._ _" [100,100,100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    30
| ImpL c::"coname" t1::"trm" n::"name" t2::"trm" "name"       bind c in t1, bind n in t2
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    31
     ("ImpL <_>._ '(_')._ _" [100,100,100,100,100] 100)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    32
| ImpR c::"coname" n::"name" t::"trm" "coname"                bind n c in t
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    33
     ("ImpR '(_').<_>._ _" [100,100,100,100] 100)
1792
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    35
thm trm.distinct
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    36
thm trm.induct
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    37
thm trm.exhaust
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    38
thm trm.strong_exhaust
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    39
thm trm.strong_exhaust[simplified]
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    40
thm trm.fv_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    41
thm trm.bn_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    42
thm trm.perm_simps
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    43
thm trm.eq_iff
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    44
thm trm.fv_bn_eqvt
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    45
thm trm.size_eqvt
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    46
thm trm.supp
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    47
thm trm.supp[simplified]
1792
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
2892
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    49
lemma swap_at_base_sort: "sort_of (atom a) \<noteq> sort_of (atom x) \<Longrightarrow> sort_of (atom b) \<noteq> sort_of (atom x) \<Longrightarrow> (atom a \<rightleftharpoons> atom b) \<bullet> x = x"
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    50
  by (rule swap_fresh_fresh) (simp_all add: fresh_at_base(1))
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    51
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    52
nominal_primrec (* (invariant "\<lambda>(_, e, d) y. atom e \<sharp> y \<and> atom d \<sharp> y") *)
2889
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    53
  crename :: "trm \<Rightarrow> coname \<Rightarrow> coname \<Rightarrow> trm"  ("_[_\<turnstile>c>_]" [100,100,100] 100) 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    54
where
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    55
  "(Ax x a)[d\<turnstile>c>e] = (if a=d then Ax x e else Ax x a)" 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    56
| "atom a \<sharp> (d, e) \<Longrightarrow> (Cut <a>.M (x).N)[d\<turnstile>c>e] = Cut <a>.(M[d\<turnstile>c>e]) (x).(N[d\<turnstile>c>e])" 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    57
| "(NotR (x).M a)[d\<turnstile>c>e] = (if a=d then NotR (x).(M[d\<turnstile>c>e]) e else NotR (x).(M[d\<turnstile>c>e]) a)" 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    58
| "atom a \<sharp> (d, e) \<Longrightarrow> (NotL <a>.M x)[d\<turnstile>c>e] = (NotL <a>.(M[d\<turnstile>c>e]) x)" 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    59
| "\<lbrakk>atom a \<sharp> (d, e); atom b \<sharp> (d, e)\<rbrakk> \<Longrightarrow> (AndR <a>.M <b>.N c)[d\<turnstile>c>e] = 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    60
          (if c=d then AndR <a>.(M[d\<turnstile>c>e]) <b>.(N[d \<turnstile>c>e]) e else AndR <a>.(M[d\<turnstile>c>e]) <b>.(N[d\<turnstile>c>e]) c)" 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    61
| "(AndL1 (x).M y)[d\<turnstile>c>e] = AndL1 (x).(M[d\<turnstile>c>e]) y"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    62
| "(AndL2 (x).M y)[d\<turnstile>c>e] = AndL2 (x).(M[d\<turnstile>c>e]) y"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    63
| "atom a \<sharp> (d, e) \<Longrightarrow> (OrR1 <a>.M b)[d\<turnstile>c>e] = 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    64
          (if b=d then OrR1 <a>.(M[d\<turnstile>c>e]) e else OrR1 <a>.(M[d\<turnstile>c>e]) b)"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    65
| "atom a \<sharp> (d, e) \<Longrightarrow> (OrR2 <a>.M b)[d\<turnstile>c>e] = 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    66
          (if b=d then OrR2 <a>.(M[d\<turnstile>c>e]) e else OrR2 <a>.(M[d\<turnstile>c>e]) b)"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    67
| "(OrL (x).M (y).N z)[d\<turnstile>c>e] = OrL (x).(M[d\<turnstile>c>e]) (y).(N[d\<turnstile>c>e]) z"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    68
| "atom a \<sharp> (d, e) \<Longrightarrow> (ImpR (x).<a>.M b)[d\<turnstile>c>e] = 
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    69
          (if b=d then ImpR (x).<a>.(M[d\<turnstile>c>e]) e else ImpR (x).<a>.(M[d\<turnstile>c>e]) b)"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    70
| "atom a \<sharp> (d, e) \<Longrightarrow> (ImpL <a>.M (x).N y)[d\<turnstile>c>e] = ImpL <a>.(M[d\<turnstile>c>e]) (x).(N[d\<turnstile>c>e]) y"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    71
  apply(simp only: eqvt_def)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    72
  apply(simp only: crename_graph_def)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    73
  apply (rule, perm_simp, rule)
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    74
  (*apply(erule crename_graph.induct)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    75
  apply(simp add: trm.fresh)*)
2889
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    76
  apply(rule TrueI)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    77
  -- "covered all cases"
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    78
  apply(case_tac x)
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    79
  apply(rule_tac y="a" and c="(b, c)" in trm.strong_exhaust)
2892
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    80
  apply (simp_all add: fresh_star_def)[12]
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    81
  apply(metis)+
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    82
  -- "compatibility"
2889
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    83
  apply(simp_all)
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    84
  apply(rule conjI)
2892
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    85
  apply(elim conjE)
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    86
  apply(erule Abs_lst1_fcb)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    87
  apply(simp add: Abs_fresh_iff)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    88
  apply(simp add: Abs_fresh_iff)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    89
  apply(erule fresh_eqvt_at)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    90
  apply(simp add: finite_supp)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2889
diff changeset
    91
  apply(simp add: fresh_Pair fresh_at_base(1))
2892
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    92
  apply(simp add: eqvt_at_def swap_at_base_sort)
a9f3600c9ae6 Speed-up the completeness proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2891
diff changeset
    93
  apply simp
2889
0435c4dfd6f6 expanded the example
Christian Urban <urbanc@in.tum.de>
parents: 2617
diff changeset
    94
  oops
1792
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
end
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
c29a139410d2 properly separated the example from my PhD and gave the correct alpha-equivalence relation (according to the paper)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99