Quot/Nominal/Terms.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 03 Feb 2010 12:44:29 +0100
changeset 1043 534d4c604f80
parent 1039 0d832c36b1bb
child 1044 ef024a42c1bb
permissions -rw-r--r--
fixed proofs that broke because of eqvt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Terms
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../QuotMain" "Abs"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
atom_decl name
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
text {* primrec seems to be genarally faster than fun *}
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
section {*** lets with binding patterns ***}
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    11
datatype rtrm1 =
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    12
  rVr1 "name"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    13
| rAp1 "rtrm1" "rtrm1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    14
| rLm1 "name" "rtrm1"        --"name is bound in trm1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    15
| rLt1 "bp" "rtrm1" "rtrm1"   --"all variables in bp are bound in the 2nd trm1"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
and bp =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
  BUnit
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
| BVr "name"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
| BPr "bp" "bp"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
(* to be given by the user *)
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
    22
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
primrec 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  bv1
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  "bv1 (BUnit) = {}"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    27
| "bv1 (BVr x) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
| "bv1 (BPr bp1 bp2) = (bv1 bp1) \<union> (bv1 bp1)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
(* needs to be calculated by the package *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
primrec 
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    32
  rfv_trm1 and rfv_bp
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
where
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    34
  "rfv_trm1 (rVr1 x) = {atom x}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    35
| "rfv_trm1 (rAp1 t1 t2) = (rfv_trm1 t1) \<union> (rfv_trm1 t2)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    36
| "rfv_trm1 (rLm1 x t) = (rfv_trm1 t) - {atom x}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    37
| "rfv_trm1 (rLt1 bp t1 t2) = (rfv_trm1 t1) \<union> (rfv_trm1 t2 - bv1 bp)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    38
| "rfv_bp (BUnit) = {}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    39
| "rfv_bp (BVr x) = {atom x}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    40
| "rfv_bp (BPr b1 b2) = (rfv_bp b1) \<union> (rfv_bp b2)"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
(* needs to be stated by the package *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
instantiation 
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    44
  rtrm1 and bp :: pt
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
primrec
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    48
  permute_rtrm1 and permute_bp
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
where
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    50
  "permute_rtrm1 pi (rVr1 a) = rVr1 (pi \<bullet> a)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    51
| "permute_rtrm1 pi (rAp1 t1 t2) = rAp1 (permute_rtrm1 pi t1) (permute_rtrm1 pi t2)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    52
| "permute_rtrm1 pi (rLm1 a t) = rLm1 (pi \<bullet> a) (permute_rtrm1 pi t)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    53
| "permute_rtrm1 pi (rLt1 bp t1 t2) = rLt1 (permute_bp pi bp) (permute_rtrm1 pi t1) (permute_rtrm1 pi t2)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    54
| "permute_bp pi (BUnit) = BUnit"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    55
| "permute_bp pi (BVr a) = BVr (pi \<bullet> a)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    56
| "permute_bp pi (BPr bp1 bp2) = BPr (permute_bp pi bp1) (permute_bp pi bp2)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    57
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    58
lemma pt_rtrm1_bp_zero:
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    59
  fixes t::rtrm1
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    60
  and   b::bp
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    61
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    62
  and   "0 \<bullet> b = b"
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    63
apply(induct t and b rule: rtrm1_bp.inducts)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    64
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    65
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    66
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    67
lemma pt_rtrm1_bp_plus:
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    68
  fixes t::rtrm1
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    69
  and   b::bp
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    70
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    71
  and   "((p + q) \<bullet> b) = p \<bullet> (q \<bullet> b)"
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    72
apply(induct t and b rule: rtrm1_bp.inducts)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    73
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    74
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    75
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    76
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    77
apply default
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    78
apply(simp_all add: pt_rtrm1_bp_zero pt_rtrm1_bp_plus)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    79
done
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
inductive
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    84
  alpha1 :: "rtrm1 \<Rightarrow> rtrm1 \<Rightarrow> bool" ("_ \<approx>1 _" [100, 100] 100)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
where
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    86
  a1: "a = b \<Longrightarrow> (rVr1 a) \<approx>1 (rVr1 b)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    87
| a2: "\<lbrakk>t1 \<approx>1 t2; s1 \<approx>1 s2\<rbrakk> \<Longrightarrow> rAp1 t1 s1 \<approx>1 rAp1 t2 s2"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    88
| a3: "(\<exists>pi. (({atom aa}, t) \<approx>gen alpha1 rfv_trm1 pi ({atom ab}, s))) \<Longrightarrow> rLm1 aa t \<approx>1 rLm1 ab s"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    89
| a4: "t1 \<approx>1 t2 \<Longrightarrow> (\<exists>pi. (((bv1 b1), s1) \<approx>gen alpha1 rfv_trm1 pi ((bv1 b2), s2))) \<Longrightarrow> rLt1 b1 t1 s1 \<approx>1 rLt1 b2 t2 s2"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    90
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
    91
lemma alpha1_inj:
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    92
"(rVr1 a \<approx>1 rVr1 b) = (a = b)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    93
"(rAp1 t1 s1 \<approx>1 rAp1 t2 s2) = (t1 \<approx>1 t2 \<and> s1 \<approx>1 s2)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    94
"(rLm1 aa t \<approx>1 rLm1 ab s) = (\<exists>pi. (({atom aa}, t) \<approx>gen alpha1 rfv_trm1 pi ({atom ab}, s)))"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    95
"(rLt1 b1 t1 s1 \<approx>1 rLt1 b2 t2 s2) = (t1 \<approx>1 t2 \<and> (\<exists>pi. (((bv1 b1), s1) \<approx>gen alpha1 rfv_trm1 pi ((bv1 b2), s2))))"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    96
apply -
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    97
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    98
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    99
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   100
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   101
done
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   102
1030
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   103
(* Shouyld we derive it? But bv is given by the user? *)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   104
lemma bv1_eqvt[eqvt]:
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   105
  shows "(pi \<bullet> bv1 x) = bv1 (pi \<bullet> x)"
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   106
  apply (induct x)
1043
534d4c604f80 fixed proofs that broke because of eqvt
Christian Urban <urbanc@in.tum.de>
parents: 1039
diff changeset
   107
apply (simp_all add: empty_eqvt insert_eqvt atom_eqvt)
1030
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   108
done
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   109
1031
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   110
lemma rfv_trm1_eqvt[eqvt]:
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   111
  shows "(pi\<bullet>rfv_trm1 t) = rfv_trm1 (pi\<bullet>t)"
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   112
  apply (induct t)
1043
534d4c604f80 fixed proofs that broke because of eqvt
Christian Urban <urbanc@in.tum.de>
parents: 1039
diff changeset
   113
  apply (simp_all add: insert_eqvt atom_eqvt empty_eqvt union_eqvt Diff_eqvt bv1_eqvt)
1031
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   114
  done
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   115
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   116
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   117
lemma alpha1_eqvt:
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   118
  shows "t \<approx>1 s \<Longrightarrow> (pi \<bullet> t) \<approx>1 (pi \<bullet> s)"
1031
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   119
  apply (induct t s rule: alpha1.inducts)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   120
  apply (simp_all add:eqvts alpha1_inj)
1033
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   121
  apply (erule exE)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   122
  apply (rule_tac x="pi \<bullet> pia" in exI)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   123
  apply (simp add: alpha_gen)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   124
  apply(erule conjE)+
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   125
  apply(rule conjI)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   126
  apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1])
1043
534d4c604f80 fixed proofs that broke because of eqvt
Christian Urban <urbanc@in.tum.de>
parents: 1039
diff changeset
   127
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt empty_eqvt rfv_trm1_eqvt)
1033
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   128
  apply(rule conjI)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   129
  apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1])
1043
534d4c604f80 fixed proofs that broke because of eqvt
Christian Urban <urbanc@in.tum.de>
parents: 1039
diff changeset
   130
  apply(simp add: atom_eqvt Diff_eqvt rfv_trm1_eqvt insert_eqvt empty_eqvt)
1033
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   131
  apply(simp add: permute_eqvt[symmetric])
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   132
  apply (erule exE)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   133
  apply (rule_tac x="pi \<bullet> pia" in exI)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   134
  apply (simp add: alpha_gen)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   135
  apply(erule conjE)+
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   136
  apply(rule conjI)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   137
  apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1])
1043
534d4c604f80 fixed proofs that broke because of eqvt
Christian Urban <urbanc@in.tum.de>
parents: 1039
diff changeset
   138
  apply(simp add: rfv_trm1_eqvt Diff_eqvt bv1_eqvt)
1033
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   139
  apply(rule conjI)
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   140
  apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1])
1043
534d4c604f80 fixed proofs that broke because of eqvt
Christian Urban <urbanc@in.tum.de>
parents: 1039
diff changeset
   141
  apply(simp add: atom_eqvt rfv_trm1_eqvt Diff_eqvt bv1_eqvt)
1033
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   142
  apply(simp add: permute_eqvt[symmetric])
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   143
  done
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   145
lemma alpha1_equivp: "equivp alpha1" 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   146
  sorry
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   148
quotient_type trm1 = rtrm1 / alpha1
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
  by (rule alpha1_equivp)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   151
quotient_definition
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   152
  "Vr1 :: name \<Rightarrow> trm1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   153
as
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   154
  "rVr1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   155
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   156
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   157
  "Ap1 :: trm1 \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   158
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   159
  "rAp1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   160
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   161
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   162
  "Lm1 :: name \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   163
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   164
  "rLm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   165
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   166
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   167
  "Lt1 :: bp \<Rightarrow> trm1 \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   168
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   169
  "rLt1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   170
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   171
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   172
  "fv_trm1 :: trm1 \<Rightarrow> atom set"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   173
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   174
  "rfv_trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   175
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   176
lemma alpha_rfv1:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   177
  shows "t \<approx>1 s \<Longrightarrow> rfv_trm1 t = rfv_trm1 s"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   178
  apply(induct rule: alpha1.induct)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   179
  apply(simp_all add: alpha_gen.simps)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   180
  done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   181
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   182
lemma [quot_respect]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   183
 "(op = ===> alpha1) rVr1 rVr1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   184
 "(alpha1 ===> alpha1 ===> alpha1) rAp1 rAp1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   185
 "(op = ===> alpha1 ===> alpha1) rLm1 rLm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   186
 "(op = ===> alpha1 ===> alpha1 ===> alpha1) rLt1 rLt1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   187
apply (auto intro: alpha1.intros)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   188
apply(rule a3) apply (rule_tac x="0" in exI)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   189
apply (simp add: fresh_star_def fresh_zero_perm alpha_rfv1 alpha_gen)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   190
apply(rule a4) apply assumption apply (rule_tac x="0" in exI)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   191
apply (simp add: fresh_star_def fresh_zero_perm alpha_rfv1 alpha_gen)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   192
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   193
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   194
lemma [quot_respect]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   195
  "(op = ===> alpha1 ===> alpha1) permute permute"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   196
apply auto
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   197
apply (rule alpha1_eqvt)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   198
apply simp
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   199
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   200
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   201
lemma [quot_respect]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   202
  "(alpha1 ===> op =) rfv_trm1 rfv_trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   203
apply (simp add: alpha_rfv1)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   204
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   205
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   206
lemma trm1_bp_induct: "
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   207
\<lbrakk>\<And>name. P1 (Vr1 name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   208
 \<And>rtrm11 rtrm12. \<lbrakk>P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Ap1 rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   209
 \<And>name rtrm1. P1 rtrm1 \<Longrightarrow> P1 (Lm1 name rtrm1);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   210
 \<And>bp rtrm11 rtrm12.
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   211
    \<lbrakk>P2 bp; P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Lt1 bp rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   212
 P2 BUnit; \<And>name. P2 (BVr name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   213
 \<And>bp1 bp2. \<lbrakk>P2 bp1; P2 bp2\<rbrakk> \<Longrightarrow> P2 (BPr bp1 bp2)\<rbrakk>
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   214
\<Longrightarrow> P1 rtrma \<and> P2 bpa"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   215
apply (lifting rtrm1_bp.induct)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   216
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   217
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   218
lemma trm1_bp_inducts: "
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   219
\<lbrakk>\<And>name. P1 (Vr1 name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   220
 \<And>rtrm11 rtrm12. \<lbrakk>P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Ap1 rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   221
 \<And>name rtrm1. P1 rtrm1 \<Longrightarrow> P1 (Lm1 name rtrm1);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   222
 \<And>bp rtrm11 rtrm12.
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   223
    \<lbrakk>P2 bp; P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Lt1 bp rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   224
 P2 BUnit; \<And>name. P2 (BVr name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   225
 \<And>bp1 bp2. \<lbrakk>P2 bp1; P2 bp2\<rbrakk> \<Longrightarrow> P2 (BPr bp1 bp2)\<rbrakk>
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   226
\<Longrightarrow> P1 rtrma"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   227
"\<lbrakk>\<And>name. P1 (Vr1 name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   228
 \<And>rtrm11 rtrm12. \<lbrakk>P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Ap1 rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   229
 \<And>name rtrm1. P1 rtrm1 \<Longrightarrow> P1 (Lm1 name rtrm1);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   230
 \<And>bp rtrm11 rtrm12.
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   231
    \<lbrakk>P2 bp; P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Lt1 bp rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   232
 P2 BUnit; \<And>name. P2 (BVr name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   233
 \<And>bp1 bp2. \<lbrakk>P2 bp1; P2 bp2\<rbrakk> \<Longrightarrow> P2 (BPr bp1 bp2)\<rbrakk>
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   234
\<Longrightarrow> P2 bpa"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   235
by (lifting rtrm1_bp.inducts)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   236
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   237
instantiation trm1 and bp :: pt
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   238
begin
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   239
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   240
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   241
  "permute_trm1 :: perm \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   242
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   243
  "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   244
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   245
lemma permute_trm1 [simp]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   246
  shows "pi \<bullet> Vr1 a = Vr1 (pi \<bullet> a)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   247
  and   "pi \<bullet> Ap1 t1 t2 = Ap1 (pi \<bullet> t1) (pi \<bullet> t2)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   248
  and   "pi \<bullet> Lm1 a t = Lm1 (pi \<bullet> a) (pi \<bullet> t)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   249
  and   "pi \<bullet> Lt1 b t s = Lt1 (pi \<bullet> b) (pi \<bullet> t) (pi \<bullet> s)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   250
apply -
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   251
apply(lifting permute_rtrm1_permute_bp.simps(1))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   252
apply(lifting permute_rtrm1_permute_bp.simps(2))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   253
apply(lifting permute_rtrm1_permute_bp.simps(3))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   254
apply(lifting permute_rtrm1_permute_bp.simps(4))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   255
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   256
instance
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   257
apply default
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   258
apply(induct_tac [!] x rule: trm1_bp_inducts(1))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   259
apply(simp_all)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   260
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   261
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   262
end
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   263
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   264
lemma fv_trm1:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   265
"fv_trm1 (Vr1 x) = {atom x}"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   266
"fv_trm1 (Ap1 t1 t2) = fv_trm1 t1 \<union> fv_trm1 t2"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   267
"fv_trm1 (Lm1 x t) = fv_trm1 t - {atom x}"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   268
"fv_trm1 (Lt1 bp t1 t2) = fv_trm1 t1 \<union> (fv_trm1 t2 - bv1 bp)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   269
apply -
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   270
apply (lifting rfv_trm1_rfv_bp.simps(1))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   271
apply (lifting rfv_trm1_rfv_bp.simps(2))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   272
apply (lifting rfv_trm1_rfv_bp.simps(3))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   273
apply (lifting rfv_trm1_rfv_bp.simps(4))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   274
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   275
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   276
lemma fv_trm1_eqvt:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   277
  shows "(p \<bullet> fv_trm1 t) = fv_trm1 (p \<bullet> t)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   278
apply(lifting rfv_trm1_eqvt)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   279
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   280
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   281
lemma alpha1_INJ:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   282
"(Vr1 a = Vr1 b) = (a = b)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   283
"(Ap1 t1 s1 = Ap1 t2 s2) = (t1 = t2 \<and> s1 = s2)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   284
"(Lm1 aa t = Lm1 ab s) = (\<exists>pi. (({atom aa}, t) \<approx>gen (op =) fv_trm1 pi ({atom ab}, s)))"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   285
"(Lt1 b1 t1 s1 = Lt1 b2 t2 s2) = (t1 = t2 \<and> (\<exists>pi. (((bv1 b1), s1) \<approx>gen (op =) fv_trm1 pi ((bv1 b2), s2))))"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   286
unfolding alpha_gen apply (lifting alpha1_inj[unfolded alpha_gen])
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   287
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   288
1031
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   289
lemma lm1_supp_pre:
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   290
  shows "(supp (atom x, t)) supports (Lm1 x t) "
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   291
apply(simp add: supports_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   292
apply(fold fresh_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   293
apply(simp add: fresh_Pair swap_fresh_fresh)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   294
apply(clarify)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   295
apply(subst swap_at_base_simps(3))
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   296
apply(simp_all add: fresh_atom)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   297
done
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   298
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   299
lemma lt1_supp_pre:
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   300
  shows "(supp (x, t, s)) supports (Lt1 t x s) "
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   301
apply(simp add: supports_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   302
apply(fold fresh_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   303
apply(simp add: fresh_Pair swap_fresh_fresh)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   304
done
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   305
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   306
lemma bp_supp: "finite (supp (bp :: bp))"
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   307
  apply (induct bp)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   308
  apply(simp_all add: supp_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   309
  apply (fold supp_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   310
  apply (simp add: supp_at_base)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   311
  apply(simp add: Collect_imp_eq)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   312
  apply(simp add: Collect_neg_eq[symmetric])
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   313
  apply (fold supp_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   314
  apply (simp)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   315
  done
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   316
1030
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   317
instance trm1 :: fs
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   318
apply default
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   319
apply(induct_tac x rule: trm1_bp_inducts(1))
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   320
apply(simp_all)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   321
apply(simp add: supp_def alpha1_INJ eqvts)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   322
apply(simp add: supp_def[symmetric] supp_at_base)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   323
apply(simp only: supp_def alpha1_INJ eqvts permute_trm1)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   324
apply(simp add: Collect_imp_eq Collect_neg_eq)
1031
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   325
apply(rule supports_finite)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   326
apply(rule lm1_supp_pre)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   327
apply(simp add: supp_Pair supp_atom)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   328
apply(rule supports_finite)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   329
apply(rule lt1_supp_pre)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   330
apply(simp add: supp_Pair supp_atom bp_supp)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   331
done
1030
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   332
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   333
lemma supp_fv:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   334
  shows "supp t = fv_trm1 t"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   335
apply(induct t rule: trm1_bp_inducts(1))
1030
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   336
apply(simp_all)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   337
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   338
apply(simp only: supp_at_base[simplified supp_def])
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   339
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   340
apply(simp add: Collect_imp_eq Collect_neg_eq)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   341
apply(subgoal_tac "supp (Lm1 name rtrm1) = supp (Abs {atom name} rtrm1)")
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   342
apply(simp add: supp_Abs fv_trm1)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   343
apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   344
apply(simp add: alpha1_INJ)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   345
apply(simp add: Abs_eq_iff)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   346
apply(simp add: alpha_gen.simps)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   347
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric])
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   348
apply(subgoal_tac "supp (Lt1 bp rtrm11 rtrm12) = supp(rtrm11) \<union> supp (Abs (bv1 bp) rtrm12)")
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   349
apply(simp add: supp_Abs fv_trm1)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   350
apply(simp (no_asm) add: supp_def)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   351
apply(simp add: alpha1_INJ)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   352
apply(simp add: Abs_eq_iff)
1033
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   353
apply(simp add: alpha_gen)
1030
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   354
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric] bv1_eqvt)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   355
apply(simp add: Collect_imp_eq Collect_neg_eq)
07f97267a392 Finished the supp_fv proof; first proof that analyses the structure of 'Let' :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1029
diff changeset
   356
done
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   357
1032
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   358
lemma trm1_supp:
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   359
  "supp (Vr1 x) = {atom x}"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   360
  "supp (Ap1 t1 t2) = supp t1 \<union> supp t2"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   361
  "supp (Lm1 x t) = (supp t) - {atom x}"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   362
  "supp (Lt1 b t s) = supp t \<union> (supp s - bv1 b)"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   363
  by (simp_all only: supp_fv fv_trm1)
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   364
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   365
lemma trm1_induct_strong:
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   366
  assumes "\<And>name b. P b (Vr1 name)"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   367
  and     "\<And>rtrm11 rtrm12 b. \<lbrakk>\<And>c. P c rtrm11; \<And>c. P c rtrm12\<rbrakk> \<Longrightarrow> P b (Ap1 rtrm11 rtrm12)"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   368
  and     "\<And>name rtrm1 b. \<lbrakk>\<And>c. P c rtrm1; (atom name) \<sharp> b\<rbrakk> \<Longrightarrow> P b (Lm1 name rtrm1)"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   369
  and     "\<And>bp rtrm11 rtrm12 b. \<lbrakk>\<And>c. P c rtrm11; \<And>c. P c rtrm12; bp1 bp \<sharp>* b\<rbrakk> \<Longrightarrow> P b (Lt1 bp rtrm11 rtrm12)"
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   370
  shows   "P a rtrma"
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   371
sorry
1032
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   372
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   373
section {*** lets with single assignments ***}
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
datatype trm2 =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
  Vr2 "name"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   377
| Ap2 "trm2" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   378
| Lm2 "name" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   379
| Lt2 "assign" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
and assign =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
  As "name" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
(* to be given by the user *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
primrec 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
  bv2
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   387
  "bv2 (As x t) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
(* needs to be calculated by the package *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
  fv_trm2 and fv_assign
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   393
  "fv_trm2 (Vr2 x) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
| "fv_trm2 (Ap2 t1 t2) = (fv_trm2 t1) \<union> (fv_trm2 t2)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   395
| "fv_trm2 (Lm2 x t) = (fv_trm2 t) - {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
| "fv_trm2 (Lt2 as t) = (fv_trm2 t - bv2 as) \<union> (fv_assign as)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
| "fv_assign (As x t) = (fv_trm2 t)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
(* needs to be stated by the package *)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   400
instantiation 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   401
  trm2 and assign :: pt
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
primrec
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   405
  permute_trm2 and permute_assign
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   407
  "permute_trm2 pi (Vr2 a) = Vr2 (pi \<bullet> a)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   408
| "permute_trm2 pi (Ap2 t1 t2) = Ap2 (permute_trm2 pi t1) (permute_trm2 pi t2)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   409
| "permute_trm2 pi (Lm2 a t) = Lm2 (pi \<bullet> a) (permute_trm2 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   410
| "permute_trm2 pi (Lt2 as t) = Lt2 (permute_assign pi as) (permute_trm2 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   411
| "permute_assign pi (As a t) = As (pi \<bullet> a) (permute_trm2 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   412
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   413
lemma pt_trm2_assign_zero:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   414
  fixes t::trm2
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   415
  and   b::assign
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   416
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   417
  and   "0 \<bullet> b = b"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   418
apply(induct t and b rule: trm2_assign.inducts)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   419
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   420
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   421
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   422
lemma pt_trm2_assign_plus:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   423
  fixes t::trm2
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   424
  and   b::assign
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   425
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   426
  and   "((p + q) \<bullet> b) = p \<bullet> (q \<bullet> b)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   427
apply(induct t and b rule: trm2_assign.inducts)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   428
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   429
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   430
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   431
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   432
apply default
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   433
apply(simp_all add: pt_trm2_assign_zero pt_trm2_assign_plus)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   434
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   435
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
  alpha2 :: "trm2 \<Rightarrow> trm2 \<Rightarrow> bool" ("_ \<approx>2 _" [100, 100] 100)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
  a1: "a = b \<Longrightarrow> (Vr2 a) \<approx>2 (Vr2 b)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
| a2: "\<lbrakk>t1 \<approx>2 t2; s1 \<approx>2 s2\<rbrakk> \<Longrightarrow> Ap2 t1 s1 \<approx>2 Ap2 t2 s2"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   444
| a3: "\<exists>pi. (fv_trm2 t - {atom a} = fv_trm2 s - {atom b} \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   445
            (fv_trm2 t - {atom a})\<sharp>* pi \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   446
            (pi \<bullet> t) \<approx>2 s \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   447
            (pi \<bullet> a) = b)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   448
       \<Longrightarrow> Lm2 a t \<approx>2 Lm2 b s"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   449
| a4: "\<exists>pi. (
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
         fv_trm2 t1 - fv_assign b1 = fv_trm2 t2 - fv_assign b2 \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   451
         (fv_trm2 t1 - fv_assign b1) \<sharp>* pi \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   452
         pi \<bullet> t1 = t2       (* \<and> (pi \<bullet> b1 = b2) *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   453
       ) \<Longrightarrow> Lt2 b1 t1 \<approx>2 Lt2 b2 t2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   454
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   455
lemma alpha2_equivp: "equivp alpha2" 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   456
  sorry
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   457
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   458
quotient_type qtrm2 = trm2 / alpha2
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   459
  by (rule alpha2_equivp)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   460
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   461
section {*** lets with many assignments ***}
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
datatype trm3 =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
  Vr3 "name"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   465
| Ap3 "trm3" "trm3"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   466
| Lm3 "name" "trm3"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   467
| Lt3 "assigns" "trm3"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   468
and assigns =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   469
  ANil
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   470
| ACons "name" "trm3" "assigns"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   471
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   472
(* to be given by the user *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
primrec 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
  bv3
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   475
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   476
  "bv3 ANil = {}"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   477
| "bv3 (ACons x t as) = {atom x} \<union> (bv3 as)"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   479
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
  fv_trm3 and fv_assigns
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   482
  "fv_trm3 (Vr3 x) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   483
| "fv_trm3 (Ap3 t1 t2) = (fv_trm3 t1) \<union> (fv_trm3 t2)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   484
| "fv_trm3 (Lm3 x t) = (fv_trm3 t) - {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   485
| "fv_trm3 (Lt3 as t) = (fv_trm3 t - bv3 as) \<union> (fv_assigns as)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   486
| "fv_assigns (ANil) = {}"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
| "fv_assigns (ACons x t as) = (fv_trm3 t) \<union> (fv_assigns as)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   488
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
(* needs to be stated by the package *)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   490
instantiation
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   491
 trm3 and assigns :: pt
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   494
primrec
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   495
  permute_trm3 and permute_assigns
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   496
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   497
  "permute_trm3 pi (Vr3 a) = Vr3 (pi \<bullet> a)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   498
| "permute_trm3 pi (Ap3 t1 t2) = Ap3 (permute_trm3 pi t1) (permute_trm3 pi t2)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   499
| "permute_trm3 pi (Lm3 a t) = Lm3 (pi \<bullet> a) (permute_trm3 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   500
| "permute_trm3 pi (Lt3 as t) = Lt3 (permute_assigns pi as) (permute_trm3 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   501
| "permute_assigns pi (ANil) = ANil"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   502
| "permute_assigns pi (ACons a t as) = ACons (pi \<bullet> a) (permute_trm3 pi t) (permute_assigns pi as)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   503
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   504
lemma pt_trm3_assigns_zero:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   505
  fixes t::trm3
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   506
  and   b::assigns
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   507
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   508
  and   "0 \<bullet> b = b"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   509
apply(induct t and b rule: trm3_assigns.inducts)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   510
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   511
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   512
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   513
lemma pt_trm3_assigns_plus:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   514
  fixes t::trm3
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   515
  and   b::assigns
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   516
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   517
  and   "((p + q) \<bullet> b) = p \<bullet> (q \<bullet> b)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   518
apply(induct t and b rule: trm3_assigns.inducts)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   519
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   520
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   521
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   522
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   523
apply default
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   524
apply(simp_all add: pt_trm3_assigns_zero pt_trm3_assigns_plus)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   525
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   526
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   527
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   528
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   530
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   531
  alpha3 :: "trm3 \<Rightarrow> trm3 \<Rightarrow> bool" ("_ \<approx>3 _" [100, 100] 100)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   533
  a1: "a = b \<Longrightarrow> (Vr3 a) \<approx>3 (Vr3 b)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   534
| a2: "\<lbrakk>t1 \<approx>3 t2; s1 \<approx>3 s2\<rbrakk> \<Longrightarrow> Ap3 t1 s1 \<approx>3 Ap3 t2 s2"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   535
| a3: "\<exists>pi. (fv_trm3 t - {atom a} = fv_trm3 s - {atom b} \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   536
             (fv_trm3 t - {atom a})\<sharp>* pi \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   537
             (pi \<bullet> t) \<approx>3 s \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   538
             (pi \<bullet> a) = b)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   539
       \<Longrightarrow> Lm3 a t \<approx>3 Lm3 b s"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   540
| a4: "\<exists>pi. (
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   541
         fv_trm3 t1 - fv_assigns b1 = fv_trm3 t2 - fv_assigns b2 \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   542
         (fv_trm3 t1 - fv_assigns b1) \<sharp>* pi \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   543
         pi \<bullet> t1 = t2      (* \<and> (pi \<bullet> b1 = b2)  *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   544
       ) \<Longrightarrow> Lt3 b1 t1 \<approx>3 Lt3 b2 t2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   545
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   546
lemma alpha3_equivp: "equivp alpha3" 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   547
  sorry
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   548
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   549
quotient_type qtrm3 = trm3 / alpha3
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   550
  by (rule alpha3_equivp)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   551
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   552
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   553
section {*** lam with indirect list recursion ***}
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   554
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   555
datatype trm4 =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   556
  Vr4 "name"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   557
| Ap4 "trm4" "trm4 list"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   558
| Lm4 "name" "trm4"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   559
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   560
thm trm4.recs
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   561
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   562
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   563
  fv_trm4 and fv_trm4_list
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   565
  "fv_trm4 (Vr4 x) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   566
| "fv_trm4 (Ap4 t ts) = (fv_trm4 t) \<union> (fv_trm4_list ts)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   567
| "fv_trm4 (Lm4 x t) = (fv_trm4 t) - {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   568
| "fv_trm4_list ([]) = {}"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   569
| "fv_trm4_list (t#ts) = (fv_trm4 t) \<union> (fv_trm4_list ts)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   570
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   571
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   572
(* needs to be stated by the package *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
(* there cannot be a clause for lists, as *) 
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   574
(* permuteutations are  already defined in Nominal (also functions, options, and so on) *)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   575
instantiation
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   576
  trm4 :: pt
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   577
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   579
(* does not work yet *)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   580
primrec
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   581
  permute_trm4  and permute_trm4_list
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   582
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   583
  "permute_trm4 pi (Vr4 a) = Vr4 (pi \<bullet> a)"
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   584
| "permute_trm4 pi (Ap4 t ts) = Ap4 (permute_trm4 pi t) (permute_trm4_list pi ts)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   585
| "permute_trm4 pi (Lm4 a t) = Lm4 (pi \<bullet> a) (permute_trm4 pi t)"
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   586
| "permute_trm4_list pi ([]) = []"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   587
| "permute_trm4_list pi (t#ts) = (permute_trm4 pi t) # (permute_trm4_list pi ts)"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   588
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   589
lemma pt_trm4_list_zero:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   590
  fixes t::trm4
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   591
  and   ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   592
  shows "0 \<bullet> t = t"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   593
  and   "permute_trm4_list 0 ts = ts"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   594
apply(induct t and ts rule: trm4.inducts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   595
apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   596
done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   597
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   598
lemma pt_trm4_list_plus:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   599
  fixes t::trm4
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   600
  and   ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   601
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   602
  and   "(permute_trm4_list (p + q) ts) = permute_trm4_list p (permute_trm4_list q ts)"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   603
apply(induct t and ts rule: trm4.inducts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   604
apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   605
done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   606
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   607
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   608
instance
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   609
apply(default)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   610
apply(simp_all add: pt_trm4_list_zero pt_trm4_list_plus)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   611
done
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   612
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   613
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   614
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   615
(* "repairing" of the permute function *)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   616
lemma repaired:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   617
  fixes ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   618
  shows "permute_trm4_list p ts = p \<bullet> ts"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   619
  apply(induct ts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   620
  apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   621
  done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   622
976
Christian Urban <urbanc@in.tum.de>
parents: 963
diff changeset
   623
thm permute_trm4_permute_trm4_list.simps
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   624
thm permute_trm4_permute_trm4_list.simps[simplified repaired]
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   625
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   626
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   627
    alpha4 :: "trm4 \<Rightarrow> trm4 \<Rightarrow> bool" ("_ \<approx>4 _" [100, 100] 100)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   628
and alpha4list :: "trm4 list \<Rightarrow> trm4 list \<Rightarrow> bool" ("_ \<approx>4list _" [100, 100] 100) 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   629
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   630
  a1: "a = b \<Longrightarrow> (Vr4 a) \<approx>4 (Vr4 b)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   631
| a2: "\<lbrakk>t1 \<approx>4 t2; s1 \<approx>4list s2\<rbrakk> \<Longrightarrow> Ap4 t1 s1 \<approx>4 Ap4 t2 s2"
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   632
| a4: "\<exists>pi. (fv_trm4 t - {atom a} = fv_trm4 s - {atom b} \<and> 
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   633
            (fv_trm4 t - {atom a})\<sharp>* pi \<and> 
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   634
            (pi \<bullet> t) \<approx>4 s \<and> 
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   635
            (pi \<bullet> a) = b)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   636
       \<Longrightarrow> Lm4 a t \<approx>4 Lm4 b s"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   637
| a5: "[] \<approx>4list []"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   638
| a6: "\<lbrakk>t \<approx>4 s; ts \<approx>4list ss\<rbrakk> \<Longrightarrow> (t#ts) \<approx>4list (s#ss)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   639
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   640
lemma alpha4_equivp: "equivp alpha4" sorry
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   641
lemma alpha4list_equivp: "equivp alpha4list" sorry
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   642
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   643
quotient_type 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   644
  qtrm4 = trm4 / alpha4 and
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   645
  qtrm4list = "trm4 list" / alpha4list
1043
534d4c604f80 fixed proofs that broke because of eqvt
Christian Urban <urbanc@in.tum.de>
parents: 1039
diff changeset
   646
  by (simp_all add: alpha4_equivp alpha4list_equivp)
1036
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   647
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   648
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   649
datatype rtrm5 =
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   650
  rVr5 "name"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   651
| rAp5 "rtrm5" "rtrm5"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   652
| rLt5 "rlts" "rtrm5"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   653
and rlts =
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   654
  rLnil
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   655
| rLcons "name" "rtrm5" "rlts"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   656
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   657
primrec
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   658
  bv5
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   659
where
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   660
  "bv5 rLnil = {}"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   661
| "bv5 (rLcons n t ltl) = {atom n} \<union> (bv5 ltl)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   662
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   663
primrec
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   664
  rfv_trm5 and rfv_lts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   665
where
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   666
  "rfv_trm5 (rVr5 n) = {atom n}"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   667
| "rfv_trm5 (rAp5 t s) = (rfv_trm5 t) \<union> (rfv_trm5 s)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   668
| "rfv_trm5 (rLt5 lts t) = (rfv_trm5 t - bv5 lts) \<union> (rfv_lts lts - bv5 lts)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   669
| "rfv_lts (rLnil) = {}"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   670
| "rfv_lts (rLcons n t ltl) = (rfv_trm5 t) \<union> (rfv_lts ltl)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   671
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   672
instantiation
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   673
  rtrm5 and rlts :: pt
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   674
begin
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   675
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   676
primrec
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   677
  permute_rtrm5 and permute_rlts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   678
where
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   679
  "permute_rtrm5 pi (rVr5 a) = rVr5 (pi \<bullet> a)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   680
| "permute_rtrm5 pi (rAp5 t1 t2) = rAp5 (permute_rtrm5 pi t1) (permute_rtrm5 pi t2)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   681
| "permute_rtrm5 pi (rLt5 as t) = rLt5 (permute_rlts pi as) (permute_rtrm5 pi t)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   682
| "permute_rlts pi (rLnil) = rLnil"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   683
| "permute_rlts pi (rLcons n t ls) = rLcons (pi \<bullet> n) (permute_rtrm5 pi t) (permute_rlts pi ls)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   684
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   685
lemma pt_rtrm5_zero:
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   686
  fixes t::rtrm5
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   687
  and   l::rlts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   688
  shows "0 \<bullet> t = t"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   689
  and   "0 \<bullet> l = l"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   690
apply(induct t and l rule: rtrm5_rlts.inducts)
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   691
apply(simp_all)
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   692
done
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   693
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   694
lemma pt_rtrm5_plus:
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   695
  fixes t::rtrm5
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   696
  and   l::rlts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   697
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   698
  and   "((p + q) \<bullet> l) = p \<bullet> (q \<bullet> l)"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   699
apply(induct t and l rule: rtrm5_rlts.inducts)
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   700
apply(simp_all)
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   701
done
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   702
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   703
instance
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   704
apply default
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   705
apply(simp_all add: pt_rtrm5_zero pt_rtrm5_plus)
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   706
done
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   707
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   708
end
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   709
1036
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   710
inductive
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   711
  alpha5 :: "rtrm5 \<Rightarrow> rtrm5 \<Rightarrow> bool" ("_ \<approx>5 _" [100, 100] 100)
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   712
and
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   713
  alphalts :: "rlts \<Rightarrow> rlts \<Rightarrow> bool" ("_ \<approx>l _" [100, 100] 100)
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   714
where
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   715
  a1: "a = b \<Longrightarrow> (rVr5 a) \<approx>5 (rVr5 b)"
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   716
| a2: "\<lbrakk>t1 \<approx>5 t2; s1 \<approx>5 s2\<rbrakk> \<Longrightarrow> rAp5 t1 s1 \<approx>5 rAp5 t2 s2"
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   717
| a3: "\<exists>pi. ((bv5 l1, t1) \<approx>gen alpha5 rfv_trm5 pi (bv5 l2, t2) \<and>
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   718
             (bv5 l1, l1) \<approx>gen alphalts rfv_lts pi (bv5 l2, l2) \<and>
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   719
              (pi \<bullet> (bv5 l1) = bv5 l2))
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   720
        \<Longrightarrow> rLt5 l1 t1 \<approx>5 rLt5 l2 t2"
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   721
| a4: "rLnil \<approx>l rLnil"
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   722
| a5: "ls1 \<approx>l ls2 \<Longrightarrow> t1 \<approx>5 t2 \<Longrightarrow> rLcons n1 t1 ls1 \<approx>l rLcons n2 t2 ls2"
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   723
1036
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   724
thm a3[simplified alpha_gen]
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   725
end