Quot/Nominal/Terms.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Thu, 11 Feb 2010 16:54:04 +0100
changeset 1134 998d6b491003
parent 1133 649680775e93
child 1135 dd4d05587bd0
permissions -rw-r--r--
Finished a working foo/bar.
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
1129
9a86f0ef6503 Notation available locally
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1128
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "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
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   206
lemmas trm1_bp_induct = rtrm1_bp.induct[quot_lifted]
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   207
lemmas trm1_bp_inducts = rtrm1_bp.inducts[quot_lifted]
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   208
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   209
instantiation trm1 and bp :: pt
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   210
begin
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   211
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   212
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   213
  "permute_trm1 :: perm \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   214
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   215
  "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   216
1083
30550327651a Proper context fixes lifting inside instantiations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1073
diff changeset
   217
lemmas permute_trm1[simp] = permute_rtrm1_permute_bp.simps[quot_lifted]
30550327651a Proper context fixes lifting inside instantiations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1073
diff changeset
   218
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   219
instance
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   220
apply default
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   221
apply(induct_tac [!] x rule: trm1_bp_inducts(1))
1083
30550327651a Proper context fixes lifting inside instantiations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1073
diff changeset
   222
apply(simp_all)
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   223
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   224
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   225
end
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   226
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   227
lemmas fv_trm1 = rfv_trm1_rfv_bp.simps[quot_lifted]
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   228
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   229
lemmas fv_trm1_eqvt = rfv_trm1_eqvt[quot_lifted]
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   230
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   231
lemmas alpha1_INJ = alpha1_inj[unfolded alpha_gen, quot_lifted, folded alpha_gen]
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   232
1031
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   233
lemma lm1_supp_pre:
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   234
  shows "(supp (atom x, t)) supports (Lm1 x t) "
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   235
apply(simp add: supports_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   236
apply(fold fresh_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   237
apply(simp add: fresh_Pair swap_fresh_fresh)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   238
apply(clarify)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   239
apply(subst swap_at_base_simps(3))
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   240
apply(simp_all add: fresh_atom)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   241
done
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   242
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   243
lemma lt1_supp_pre:
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   244
  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
   245
apply(simp add: supports_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   246
apply(fold fresh_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   247
apply(simp add: fresh_Pair swap_fresh_fresh)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   248
done
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   249
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   250
lemma bp_supp: "finite (supp (bp :: bp))"
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   251
  apply (induct bp)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   252
  apply(simp_all add: supp_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   253
  apply (fold supp_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   254
  apply (simp add: supp_at_base)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   255
  apply(simp add: Collect_imp_eq)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   256
  apply(simp add: Collect_neg_eq[symmetric])
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   257
  apply (fold supp_def)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   258
  apply (simp)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   259
  done
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   260
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
   261
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
   262
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
   263
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
   264
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
   265
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
   266
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
   267
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
   268
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
   269
apply(rule supports_finite)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   270
apply(rule lm1_supp_pre)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   271
apply(simp add: supp_Pair supp_atom)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   272
apply(rule supports_finite)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   273
apply(rule lt1_supp_pre)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   274
apply(simp add: supp_Pair supp_atom bp_supp)
bcf6e7d20c20 More ingredients in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1030
diff changeset
   275
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
   276
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   277
lemma supp_fv:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   278
  shows "supp t = fv_trm1 t"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   279
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
   280
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
   281
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
   282
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
   283
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
   284
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
   285
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
   286
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
   287
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
   288
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
   289
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
   290
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
   291
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
   292
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
   293
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
   294
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
   295
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
   296
apply(simp add: Abs_eq_iff)
1033
dce45db16063 Some cleaning and eqvt proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1032
diff changeset
   297
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
   298
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
   299
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
   300
done
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   301
1032
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   302
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
   303
  "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
   304
  "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
   305
  "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
   306
  "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
   307
  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
   308
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   309
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
   310
  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
   311
  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
   312
  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
   313
  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
   314
  shows   "P a rtrma"
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   315
sorry
1032
135bf399c036 The trm1_support lemma explicitly and stated a strong induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1031
diff changeset
   316
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
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
   318
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   319
datatype rtrm2 =
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   320
  rVr2 "name"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   321
| rAp2 "rtrm2" "rtrm2"
1093
139b257e10d2 Explicitly marked what is bound.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1092
diff changeset
   322
| rLm2 "name" "rtrm2" --"bind (name) in (rtrm2)"
139b257e10d2 Explicitly marked what is bound.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1092
diff changeset
   323
| rLt2 "rassign" "rtrm2" --"bind (bv2 rassign) in (rtrm2)"
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   324
and rassign =
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   325
  rAs "name" "rtrm2"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
(* 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
   328
primrec 
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   329
  rbv2
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
where
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   331
  "rbv2 (rAs 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
   332
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
(* 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
   334
primrec
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   335
  fv_rtrm2 and fv_rassign
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
where
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   337
  "fv_rtrm2 (rVr2 x) = {atom x}"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   338
| "fv_rtrm2 (rAp2 t1 t2) = (fv_rtrm2 t1) \<union> (fv_rtrm2 t2)"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   339
| "fv_rtrm2 (rLm2 x t) = (fv_rtrm2 t) - {atom x}"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   340
| "fv_rtrm2 (rLt2 as t) = (fv_rtrm2 t - rbv2 as) \<union> (fv_rassign as)"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   341
| "fv_rassign (rAs x t) = fv_rtrm2 t"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
(* needs to be stated by the package *)
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   344
instantiation
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   345
  rtrm2 and rassign :: 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
   346
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
primrec
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   349
  permute_rtrm2 and permute_rassign
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
where
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   351
  "permute_rtrm2 pi (rVr2 a) = rVr2 (pi \<bullet> a)"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   352
| "permute_rtrm2 pi (rAp2 t1 t2) = rAp2 (permute_rtrm2 pi t1) (permute_rtrm2 pi t2)"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   353
| "permute_rtrm2 pi (rLm2 a t) = rLm2 (pi \<bullet> a) (permute_rtrm2 pi t)"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   354
| "permute_rtrm2 pi (rLt2 as t) = rLt2 (permute_rassign pi as) (permute_rtrm2 pi t)"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   355
| "permute_rassign pi (rAs a t) = rAs (pi \<bullet> a) (permute_rtrm2 pi t)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   356
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   357
lemma pt_rtrm2_rassign_zero:
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   358
  fixes t::rtrm2
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   359
  and   b::rassign
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   360
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   361
  and   "0 \<bullet> b = b"
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   362
apply(induct t and b rule: rtrm2_rassign.inducts)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   363
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   364
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   365
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   366
lemma pt_rtrm2_rassign_plus:
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   367
  fixes t::rtrm2
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   368
  and   b::rassign
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   369
  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
   370
  and   "((p + q) \<bullet> b) = p \<bullet> (q \<bullet> b)"
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   371
apply(induct t and b rule: rtrm2_rassign.inducts)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   372
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   373
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   374
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   375
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   376
apply default
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   377
apply(simp_all add: pt_rtrm2_rassign_zero pt_rtrm2_rassign_plus)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   378
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   379
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
end
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
inductive
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   384
  alpha2 :: "rtrm2 \<Rightarrow> rtrm2 \<Rightarrow> bool" ("_ \<approx>2 _" [100, 100] 100)
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   385
and
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   386
  alpha2a :: "rassign \<Rightarrow> rassign \<Rightarrow> bool" ("_ \<approx>2a _" [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
   387
where
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   388
  a1: "a = b \<Longrightarrow> (rVr2 a) \<approx>2 (rVr2 b)"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   389
| a2: "\<lbrakk>t1 \<approx>2 t2; s1 \<approx>2 s2\<rbrakk> \<Longrightarrow> rAp2 t1 s1 \<approx>2 rAp2 t2 s2"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   390
| a3: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha2 fv_rtrm2 pi ({atom b}, s))) \<Longrightarrow> rLm2 a t \<approx>2 rLm2 b s"
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   391
| a4: "\<lbrakk>\<exists>pi. ((rbv2 bt, t) \<approx>gen alpha2 fv_rtrm2 pi ((rbv2 bs), s));
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   392
        \<exists>pi. ((rbv2 bt, bt) \<approx>gen alpha2a fv_rassign pi (rbv2 bs, bs))\<rbrakk>
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   393
        \<Longrightarrow> rLt2 bt t \<approx>2 rLt2 bs s"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   394
| a5: "\<lbrakk>a = b; t \<approx>2 s\<rbrakk> \<Longrightarrow> rAs a t \<approx>2a rAs b s" (* This way rbv2 can be lifted *)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   396
lemma alpha2_equivp:
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   397
  "equivp alpha2"
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   398
  "equivp alpha2a"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   399
  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
   400
1091
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   401
quotient_type
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   402
  trm2 = rtrm2 / alpha2
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   403
and
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   404
  assign = rassign / alpha2a
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   405
  by (auto intro: alpha2_equivp)
d3946f1a9341 Looking at the trm2 example
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1083
diff changeset
   406
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   408
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
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
   410
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
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
   412
  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
   413
| Ap3 "trm3" "trm3"
1093
139b257e10d2 Explicitly marked what is bound.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1092
diff changeset
   414
| Lm3 "name" "trm3" --"bind (name) in (trm3)"
139b257e10d2 Explicitly marked what is bound.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1092
diff changeset
   415
| Lt3 "assigns" "trm3" --"bind (bv3 assigns) in (trm3)"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
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
   417
  ANil
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
| 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
   419
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
(* 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
   421
primrec 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
  bv3
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
  "bv3 ANil = {}"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   425
| "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
   426
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   428
  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
   429
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   430
  "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
   431
| "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
   432
| "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
   433
| "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
   434
| "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
   435
| "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
   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
(* 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
   438
instantiation
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   439
 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
   440
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
primrec
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   443
  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
   444
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   445
  "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
   446
| "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
   447
| "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
   448
| "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
   449
| "permute_assigns pi (ANil) = ANil"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   450
| "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
   451
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   452
lemma pt_trm3_assigns_zero:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   453
  fixes t::trm3
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   454
  and   b::assigns
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   455
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   456
  and   "0 \<bullet> b = b"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   457
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
   458
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   459
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   460
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   461
lemma pt_trm3_assigns_plus:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   462
  fixes t::trm3
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   463
  and   b::assigns
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   464
  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
   465
  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
   466
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
   467
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   468
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   469
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   470
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   471
apply default
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   472
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
   473
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   474
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   475
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   476
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   477
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   479
  alpha3 :: "trm3 \<Rightarrow> trm3 \<Rightarrow> bool" ("_ \<approx>3 _" [100, 100] 100)
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   480
and
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   481
  alpha3a :: "assigns \<Rightarrow> assigns \<Rightarrow> bool" ("_ \<approx>3a _" [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
   482
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   483
  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
   484
| a2: "\<lbrakk>t1 \<approx>3 t2; s1 \<approx>3 s2\<rbrakk> \<Longrightarrow> Ap3 t1 s1 \<approx>3 Ap3 t2 s2"
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   485
| a3: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha3 fv_rtrm3 pi ({atom b}, s))) \<Longrightarrow> Lm3 a t \<approx>3 Lm3 b s"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   486
| a4: "\<lbrakk>\<exists>pi. ((bv3 bt, t) \<approx>gen alpha3 fv_trm3 pi ((bv3 bs), s));
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   487
        \<exists>pi. ((bv3 bt, bt) \<approx>gen alpha3a fv_assign pi (bv3 bs, bs))\<rbrakk>
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   488
        \<Longrightarrow> Lt3 bt t \<approx>3 Lt3 bs s"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   489
| a5: "ANil \<approx>3a ANil"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   490
| a6: "\<lbrakk>a = b; t \<approx>3 s; tt \<approx>3a st\<rbrakk> \<Longrightarrow> ACons a t tt \<approx>3a ACons b s st"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   492
lemma alpha3_equivp:
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   493
  "equivp alpha3"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   494
  "equivp alpha3a"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   495
  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
   496
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   497
quotient_type
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   498
  qtrm3 = trm3 / alpha3
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   499
and
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   500
  qassigns = assigns / alpha3a
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   501
  by (auto intro: alpha3_equivp)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   502
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   503
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   504
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
   505
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
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
   507
  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
   508
| Ap4 "trm4" "trm4 list"
1093
139b257e10d2 Explicitly marked what is bound.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1092
diff changeset
   509
| Lm4 "name" "trm4"  --"bind (name) in (trm)"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   510
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   511
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
   512
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   513
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   514
  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
   515
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   516
  "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
   517
| "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
   518
| "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
   519
| "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
   520
| "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
   521
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   522
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   523
(* 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
   524
(* there cannot be a clause for lists, as *) 
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   525
(* permutations are  already defined in Nominal (also functions, options, and so on) *)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   526
instantiation
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   527
  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
   528
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   530
(* 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
   531
primrec
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   532
  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
   533
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   534
  "permute_trm4 pi (Vr4 a) = Vr4 (pi \<bullet> a)"
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   535
| "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
   536
| "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
   537
| "permute_trm4_list pi ([]) = []"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   538
| "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
   539
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   540
lemma pt_trm4_list_zero:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   541
  fixes t::trm4
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   542
  and   ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   543
  shows "0 \<bullet> t = t"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   544
  and   "permute_trm4_list 0 ts = ts"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   545
apply(induct t and ts rule: trm4.inducts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   546
apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   547
done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   548
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   549
lemma pt_trm4_list_plus:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   550
  fixes t::trm4
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   551
  and   ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   552
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   553
  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
   554
apply(induct t and ts rule: trm4.inducts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   555
apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   556
done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   557
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   558
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   559
instance
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   560
apply(default)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   561
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
   562
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
   563
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   565
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   566
(* "repairing" of the permute function *)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   567
lemma repaired:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   568
  fixes ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   569
  shows "permute_trm4_list p ts = p \<bullet> ts"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   570
  apply(induct ts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   571
  apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   572
  done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   573
976
Christian Urban <urbanc@in.tum.de>
parents: 963
diff changeset
   574
thm permute_trm4_permute_trm4_list.simps
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   575
thm permute_trm4_permute_trm4_list.simps[simplified repaired]
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   576
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
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
    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
   579
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
   580
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   581
  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
   582
| a2: "\<lbrakk>t1 \<approx>4 t2; s1 \<approx>4list s2\<rbrakk> \<Longrightarrow> Ap4 t1 s1 \<approx>4 Ap4 t2 s2"
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   583
| a3: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha4 fv_rtrm4 pi ({atom b}, s))) \<Longrightarrow> Lm4 a t \<approx>4 Lm4 b s"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   584
| 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
   585
| 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
   586
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   587
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
   588
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
   589
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   590
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
   591
  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
   592
  qtrm4list = "trm4 list" / alpha4list
1042
5a3bc323661c Minor fix.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1041
diff changeset
   593
  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
   594
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   595
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   596
datatype rtrm5 =
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   597
  rVr5 "name"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   598
| rAp5 "rtrm5" "rtrm5"
1093
139b257e10d2 Explicitly marked what is bound.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1092
diff changeset
   599
| rLt5 "rlts" "rtrm5" --"bind (bv5 lts) in (rtrm5)"
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   600
and rlts =
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   601
  rLnil
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   602
| rLcons "name" "rtrm5" "rlts"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   603
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   604
primrec
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   605
  rbv5
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   606
where
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   607
  "rbv5 rLnil = {}"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   608
| "rbv5 (rLcons n t ltl) = {atom n} \<union> (rbv5 ltl)"
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   609
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   610
primrec
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   611
  rfv_trm5 and rfv_lts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   612
where
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   613
  "rfv_trm5 (rVr5 n) = {atom n}"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   614
| "rfv_trm5 (rAp5 t s) = (rfv_trm5 t) \<union> (rfv_trm5 s)"
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   615
| "rfv_trm5 (rLt5 lts t) = (rfv_trm5 t - rbv5 lts) \<union> (rfv_lts lts - rbv5 lts)"
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   616
| "rfv_lts (rLnil) = {}"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   617
| "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
   618
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   619
instantiation
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   620
  rtrm5 and rlts :: pt
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   621
begin
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   622
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   623
primrec
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   624
  permute_rtrm5 and permute_rlts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   625
where
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   626
  "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
   627
| "permute_rtrm5 pi (rAp5 t1 t2) = rAp5 (permute_rtrm5 pi t1) (permute_rtrm5 pi t2)"
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   628
| "permute_rtrm5 pi (rLt5 ls t) = rLt5 (permute_rlts pi ls) (permute_rtrm5 pi t)"
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   629
| "permute_rlts pi (rLnil) = rLnil"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   630
| "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
   631
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   632
lemma pt_rtrm5_zero:
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   633
  fixes t::rtrm5
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   634
  and   l::rlts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   635
  shows "0 \<bullet> t = t"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   636
  and   "0 \<bullet> l = l"
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   637
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
   638
apply(simp_all)
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   639
done
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   640
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   641
lemma pt_rtrm5_plus:
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   642
  fixes t::rtrm5
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   643
  and   l::rlts
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   644
  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
   645
  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
   646
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
   647
apply(simp_all)
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   648
done
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   649
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   650
instance
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   651
apply default
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   652
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
   653
done
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   654
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   655
end
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   656
1036
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   657
inductive
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   658
  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
   659
and
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   660
  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
   661
where
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   662
  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
   663
| a2: "\<lbrakk>t1 \<approx>5 t2; s1 \<approx>5 s2\<rbrakk> \<Longrightarrow> rAp5 t1 s1 \<approx>5 rAp5 t2 s2"
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   664
| a3: "\<lbrakk>\<exists>pi. ((rbv5 l1, t1) \<approx>gen alpha5 rfv_trm5 pi (rbv5 l2, t2)); 
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   665
        \<exists>pi. ((rbv5 l1, l1) \<approx>gen alphalts rfv_lts pi (rbv5 l2, l2))\<rbrakk>
1036
aaac8274f08c The alpha-equivalence relation for let-rec. Not sure if correct...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1035
diff changeset
   666
        \<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
   667
| a4: "rLnil \<approx>l rLnil"
1040
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   668
| a5: "ls1 \<approx>l ls2 \<Longrightarrow> t1 \<approx>5 t2 \<Longrightarrow> n1 = n2 \<Longrightarrow> rLcons n1 t1 ls1 \<approx>l rLcons n2 t2 ls2"
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   669
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   670
print_theorems
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   671
1040
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   672
lemma alpha5_inj:
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   673
  "((rVr5 a) \<approx>5 (rVr5 b)) = (a = b)"
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   674
  "(rAp5 t1 s1 \<approx>5 rAp5 t2 s2) = (t1 \<approx>5 t2 \<and> s1 \<approx>5 s2)"
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   675
  "(rLt5 l1 t1 \<approx>5 rLt5 l2 t2) = ((\<exists>pi. ((rbv5 l1, t1) \<approx>gen alpha5 rfv_trm5 pi (rbv5 l2, t2))) \<and>
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   676
         (\<exists>pi. ((rbv5 l1, l1) \<approx>gen alphalts rfv_lts pi (rbv5 l2, l2))))"
1040
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   677
  "rLnil \<approx>l rLnil"
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   678
  "(rLcons n1 t1 ls1 \<approx>l rLcons n2 t2 ls2) = (n1 = n2 \<and> ls1 \<approx>l ls2 \<and> t1 \<approx>5 t2)"
1040
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   679
apply -
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   680
apply (simp_all add: alpha5_alphalts.intros)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   681
apply rule
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   682
apply (erule alpha5.cases)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   683
apply (simp_all add: alpha5_alphalts.intros)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   684
apply rule
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   685
apply (erule alpha5.cases)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   686
apply (simp_all add: alpha5_alphalts.intros)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   687
apply rule
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   688
apply (erule alpha5.cases)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   689
apply (simp_all add: alpha5_alphalts.intros)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   690
apply rule
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   691
apply (erule alphalts.cases)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   692
apply (simp_all add: alpha5_alphalts.intros)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   693
done
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   694
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   695
lemma alpha5_equivps:
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   696
  shows "equivp alpha5"
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   697
  and   "equivp alphalts"
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   698
sorry
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   699
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   700
quotient_type
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   701
  trm5 = rtrm5 / alpha5
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   702
and
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   703
  lts = rlts / alphalts
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   704
  by (auto intro: alpha5_equivps)
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   705
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   706
quotient_definition
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   707
  "Vr5 :: name \<Rightarrow> trm5"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   708
as
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   709
  "rVr5"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   710
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   711
quotient_definition
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   712
  "Ap5 :: trm5 \<Rightarrow> trm5 \<Rightarrow> trm5"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   713
as
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   714
  "rAp5"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   715
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   716
quotient_definition
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   717
  "Lt5 :: lts \<Rightarrow> trm5 \<Rightarrow> trm5"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   718
as
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   719
  "rLt5"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   720
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   721
quotient_definition
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   722
  "Lnil :: lts"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   723
as
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   724
  "rLnil"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   725
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   726
quotient_definition
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   727
  "Lcons :: name \<Rightarrow> trm5 \<Rightarrow> lts \<Rightarrow> lts"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   728
as
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   729
  "rLcons"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   730
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   731
quotient_definition
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   732
   "fv_trm5 :: trm5 \<Rightarrow> atom set"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   733
as
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   734
  "rfv_trm5"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   735
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   736
quotient_definition
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   737
   "fv_lts :: lts \<Rightarrow> atom set"
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   738
as
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   739
  "rfv_lts"
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
   740
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   741
quotient_definition
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   742
   "bv5 :: lts \<Rightarrow> atom set"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   743
as
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   744
  "rbv5"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   745
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   746
lemma rbv5_eqvt:
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   747
  "pi \<bullet> (rbv5 x) = rbv5 (pi \<bullet> x)"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   748
sorry
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   749
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   750
lemma rfv_trm5_eqvt:
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   751
  "pi \<bullet> (rfv_trm5 x) = rfv_trm5 (pi \<bullet> x)"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   752
sorry
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   753
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   754
lemma rfv_lts_eqvt:
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   755
  "pi \<bullet> (rfv_lts x) = rfv_lts (pi \<bullet> x)"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   756
sorry
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   757
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   758
lemma alpha5_eqvt:
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   759
  "xa \<approx>5 y \<Longrightarrow> (x \<bullet> xa) \<approx>5 (x \<bullet> y)"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   760
  "xb \<approx>l ya \<Longrightarrow> (x \<bullet> xb) \<approx>l (x \<bullet> ya)"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   761
  apply(induct rule: alpha5_alphalts.inducts)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   762
  apply (simp_all add: alpha5_inj)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   763
  apply (erule exE)+
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   764
  apply(unfold alpha_gen)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   765
  apply (erule conjE)+
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   766
  apply (rule conjI)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   767
  apply (rule_tac x="x \<bullet> pi" in exI)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   768
  apply (rule conjI)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   769
  apply(rule_tac ?p1="- x" in permute_eq_iff[THEN iffD1])
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   770
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt rfv_trm5_eqvt)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   771
  apply(rule conjI)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   772
  apply(rule_tac ?p1="- x" in fresh_star_permute_iff[THEN iffD1])
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   773
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt rfv_trm5_eqvt)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   774
  apply (subst permute_eqvt[symmetric])
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   775
  apply (simp)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   776
  apply (rule_tac x="x \<bullet> pia" in exI)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   777
  apply (rule conjI)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   778
  apply(rule_tac ?p1="- x" in permute_eq_iff[THEN iffD1])
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   779
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt rfv_lts_eqvt)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   780
  apply(rule conjI)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   781
  apply(rule_tac ?p1="- x" in fresh_star_permute_iff[THEN iffD1])
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   782
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt rfv_lts_eqvt)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   783
  apply (subst permute_eqvt[symmetric])
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   784
  apply (simp)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   785
  done
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   786
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   787
lemma alpha5_rfv:
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   788
  "(t \<approx>5 s \<Longrightarrow> rfv_trm5 t = rfv_trm5 s)"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   789
  "(l \<approx>l m \<Longrightarrow> rfv_lts l = rfv_lts m)"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   790
  apply(induct rule: alpha5_alphalts.inducts)
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   791
  apply(simp_all add: alpha_gen)
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   792
  done
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   793
1053
b1ca92ea3a86 proved that bv for lists respects alpha for terms
Christian Urban <urbanc@in.tum.de>
parents: 1051
diff changeset
   794
lemma bv_list_rsp:
1055
34220518cccf Simplified the proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1054
diff changeset
   795
  shows "x \<approx>l y \<Longrightarrow> rbv5 x = rbv5 y"
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   796
  apply(induct rule: alpha5_alphalts.inducts(2))
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   797
  apply(simp_all)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   798
  done
1053
b1ca92ea3a86 proved that bv for lists respects alpha for terms
Christian Urban <urbanc@in.tum.de>
parents: 1051
diff changeset
   799
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   800
lemma [quot_respect]:
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   801
  "(alphalts ===> op =) rfv_lts rfv_lts"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   802
  "(alpha5 ===> op =) rfv_trm5 rfv_trm5"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   803
  "(alphalts ===> op =) rbv5 rbv5"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   804
  "(op = ===> alpha5) rVr5 rVr5"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   805
  "(alpha5 ===> alpha5 ===> alpha5) rAp5 rAp5"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   806
  "(alphalts ===> alpha5 ===> alpha5) rLt5 rLt5"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   807
  "(alphalts ===> alpha5 ===> alpha5) rLt5 rLt5"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   808
  "(op = ===> alpha5 ===> alphalts ===> alphalts) rLcons rLcons"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   809
  "(op = ===> alpha5 ===> alpha5) permute permute"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   810
  "(op = ===> alphalts ===> alphalts) permute permute"
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   811
  apply (simp_all add: alpha5_inj alpha5_rfv alpha5_eqvt bv_list_rsp)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   812
  apply (auto)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   813
  apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_gen alpha5_rfv)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   814
  apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_gen alpha5_rfv)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   815
  apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_gen alpha5_rfv)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   816
  apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_gen alpha5_rfv)
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   817
  done
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   818
1092
01ae4a87c7c3 Cleaning and updating in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1091
diff changeset
   819
lemma
1053
b1ca92ea3a86 proved that bv for lists respects alpha for terms
Christian Urban <urbanc@in.tum.de>
parents: 1051
diff changeset
   820
  shows "(alphalts ===> op =) rbv5 rbv5"
b1ca92ea3a86 proved that bv for lists respects alpha for terms
Christian Urban <urbanc@in.tum.de>
parents: 1051
diff changeset
   821
  by (simp add: bv_list_rsp)
b1ca92ea3a86 proved that bv for lists respects alpha for terms
Christian Urban <urbanc@in.tum.de>
parents: 1051
diff changeset
   822
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   823
lemmas trm5_lts_inducts = rtrm5_rlts.inducts[quot_lifted]
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   824
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   825
instantiation trm5 and lts :: pt
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   826
begin
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   827
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   828
quotient_definition
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   829
  "permute_trm5 :: perm \<Rightarrow> trm5 \<Rightarrow> trm5"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   830
as
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   831
  "permute :: perm \<Rightarrow> rtrm5 \<Rightarrow> rtrm5"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   832
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   833
quotient_definition
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   834
  "permute_lts :: perm \<Rightarrow> lts \<Rightarrow> lts"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   835
as
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   836
  "permute :: perm \<Rightarrow> rlts \<Rightarrow> rlts"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   837
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   838
lemma trm5_lts_zero:
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   839
  "0 \<bullet> (x\<Colon>trm5) = x"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   840
  "0 \<bullet> (y\<Colon>lts) = y"
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   841
apply(induct x and y rule: trm5_lts_inducts)
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   842
apply(simp_all add: permute_rtrm5_permute_rlts.simps[quot_lifted])
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   843
done
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   844
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   845
lemma trm5_lts_plus:
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   846
  "(p + q) \<bullet> (x\<Colon>trm5) = p \<bullet> q \<bullet> x"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   847
  "(p + q) \<bullet> (y\<Colon>lts) = p \<bullet> q \<bullet> y"
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   848
apply(induct x and y rule: trm5_lts_inducts)
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   849
apply(simp_all add: permute_rtrm5_permute_rlts.simps[quot_lifted])
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   850
done
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   851
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   852
instance
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   853
apply default
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   854
apply (simp_all add: trm5_lts_zero trm5_lts_plus)
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   855
done
1040
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
   856
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
   857
end
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   858
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   859
lemmas permute_trm5_lts = permute_rtrm5_permute_rlts.simps[quot_lifted]
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   860
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   861
lemmas alpha5_INJ = alpha5_inj[unfolded alpha_gen, quot_lifted, folded alpha_gen]
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   862
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   863
lemmas bv5[simp] = rbv5.simps[quot_lifted]
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   864
1073
53350d409473 Cleaned Terms using [lifted] and found a workaround for the instantiation problem.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1058
diff changeset
   865
lemmas fv_trm5_lts[simp] = rfv_trm5_rfv_lts.simps[quot_lifted]
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   866
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   867
lemma lets_ok:
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   868
  "(Lt5 (Lcons x (Vr5 x) Lnil) (Vr5 x)) = (Lt5 (Lcons y (Vr5 y) Lnil) (Vr5 y))"
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   869
apply (subst alpha5_INJ)
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   870
apply (rule conjI)
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   871
apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   872
apply (simp only: alpha_gen)
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   873
apply (simp add: permute_trm5_lts fresh_star_def)
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   874
apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   875
apply (simp only: alpha_gen)
1052
c1b469325033 Finished remains on the let proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1051
diff changeset
   876
apply (simp add: permute_trm5_lts fresh_star_def)
c1b469325033 Finished remains on the let proof.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1051
diff changeset
   877
done
1050
e8bb5f85e510 Lets are ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1046
diff changeset
   878
1058
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   879
lemma lets_ok2:
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   880
  "(Lt5 (Lcons x (Vr5 x) (Lcons y (Vr5 y) Lnil)) (Ap5 (Vr5 x) (Vr5 y))) =
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   881
   (Lt5 (Lcons y (Vr5 y) (Lcons x (Vr5 x) Lnil)) (Ap5 (Vr5 x) (Vr5 y)))"
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   882
apply (subst alpha5_INJ)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   883
apply (rule conjI)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   884
apply (rule_tac x="0 :: perm" in exI)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   885
apply (simp only: alpha_gen)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   886
apply (simp add: permute_trm5_lts fresh_star_def)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   887
apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   888
apply (simp only: alpha_gen)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   889
apply (simp add: permute_trm5_lts fresh_star_def)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   890
done
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   891
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   892
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   893
lemma lets_not_ok1:
1056
a9135d300fbf Lets different.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1055
diff changeset
   894
  "x \<noteq> y \<Longrightarrow> (Lt5 (Lcons x (Vr5 x) (Lcons y (Vr5 y) Lnil)) (Ap5 (Vr5 x) (Vr5 y))) \<noteq>
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   895
             (Lt5 (Lcons y (Vr5 x) (Lcons x (Vr5 y) Lnil)) (Ap5 (Vr5 x) (Vr5 y)))"
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   896
apply (subst alpha5_INJ(3))
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   897
apply(clarify)
1056
a9135d300fbf Lets different.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1055
diff changeset
   898
apply (simp add: alpha_gen)
a9135d300fbf Lets different.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1055
diff changeset
   899
apply (simp add: permute_trm5_lts fresh_star_def)
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   900
apply (simp add: alpha5_INJ(5))
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   901
apply(clarify)
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   902
apply (simp add: alpha5_INJ(2))
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   903
apply (simp only: alpha5_INJ(1))
1056
a9135d300fbf Lets different.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1055
diff changeset
   904
done
a9135d300fbf Lets different.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1055
diff changeset
   905
1058
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   906
lemma distinct_helper:
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   907
  shows "\<not>(rVr5 x \<approx>5 rAp5 y z)"
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   908
  apply auto
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   909
  apply (erule alpha5.cases)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   910
  apply (simp_all only: rtrm5.distinct)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   911
  done
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   912
1058
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   913
lemma distinct_helper2:
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   914
  shows "(Vr5 x) \<noteq> (Ap5 y z)"
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   915
  by (lifting distinct_helper)
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   916
1058
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   917
lemma lets_nok:
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   918
  "x \<noteq> y \<Longrightarrow> x \<noteq> z \<Longrightarrow> z \<noteq> y \<Longrightarrow>
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   919
   (Lt5 (Lcons x (Ap5 (Vr5 z) (Vr5 z)) (Lcons y (Vr5 z) Lnil)) (Ap5 (Vr5 x) (Vr5 y))) \<noteq>
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   920
   (Lt5 (Lcons y (Vr5 z) (Lcons x (Ap5 (Vr5 z) (Vr5 z)) Lnil)) (Ap5 (Vr5 x) (Vr5 y)))"
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   921
apply (subst alpha5_INJ)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   922
apply (simp only: alpha_gen permute_trm5_lts fresh_star_def)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   923
apply (subst alpha5_INJ(5))
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   924
apply (subst alpha5_INJ(5))
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   925
apply (simp add: distinct_helper2)
afedef46d3ab More let-rec experiments
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1057
diff changeset
   926
done
1057
f81b506f62a7 proposal for an alpha equivalence
Christian Urban <urbanc@in.tum.de>
parents: 1056
diff changeset
   927
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   928
1105
Christian Urban <urbanc@in.tum.de>
parents: 1104
diff changeset
   929
(* example with a bn function defined over the type itself *)
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   930
datatype rtrm6 =
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   931
  rVr6 "name"
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   932
| rLm6 "name" "rtrm6"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   933
| rLt6 "rtrm6" "rtrm6" --"bind (bv6 left) in (right)"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   934
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   935
primrec
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   936
  rbv6
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   937
where
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   938
  "rbv6 (rVr6 n) = {}"
1117
8948319b190e Fixed rbv6, when translating to OTT.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1111
diff changeset
   939
| "rbv6 (rLm6 n t) = {atom n} \<union> rbv6 t"
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   940
| "rbv6 (rLt6 l r) = rbv6 l \<union> rbv6 r"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   941
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   942
primrec
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   943
  rfv_trm6
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   944
where
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   945
  "rfv_trm6 (rVr6 n) = {atom n}"
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   946
| "rfv_trm6 (rLm6 n t) = (rfv_trm6 t) - {atom n}"
1119
44cabac6ad3d Another mistake found with OTT.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1117
diff changeset
   947
| "rfv_trm6 (rLt6 l r) = (rfv_trm6 r - rbv6 l) \<union> rfv_trm6 l"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   948
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   949
instantiation
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   950
  rtrm6 :: pt
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   951
begin
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   952
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   953
primrec
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   954
  permute_rtrm6
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   955
where
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   956
  "permute_rtrm6 pi (rVr6 a) = rVr6 (pi \<bullet> a)"
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   957
| "permute_rtrm6 pi (rLm6 n t) = rLm6 (pi \<bullet> n) (permute_rtrm6 pi t)"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   958
| "permute_rtrm6 pi (rLt6 l r) = rLt6 (permute_rtrm6 pi l) (permute_rtrm6 pi r)"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   959
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   960
lemma pt_rtrm6_zero:
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   961
  fixes t::rtrm6
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   962
  shows "0 \<bullet> t = t"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   963
apply(induct t)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   964
apply(simp_all)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   965
done
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   966
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   967
lemma pt_rtrm6_plus:
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   968
  fixes t::rtrm6
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   969
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   970
apply(induct t)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   971
apply(simp_all)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   972
done
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   973
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   974
instance
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   975
apply default
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   976
apply(simp_all add: pt_rtrm6_zero pt_rtrm6_plus)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   977
done
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   978
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   979
end
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   980
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   981
inductive
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   982
  alpha6 :: "rtrm6 \<Rightarrow> rtrm6 \<Rightarrow> bool" ("_ \<approx>6 _" [100, 100] 100)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   983
where
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   984
  a1: "a = b \<Longrightarrow> (rVr6 a) \<approx>6 (rVr6 b)"
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   985
| a2: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha6 rfv_trm6 pi ({atom b}, s))) \<Longrightarrow> rLm6 a t \<approx>6 rLm6 b s"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
   986
| a3: "(\<exists>pi. (((rbv6 t1), s1) \<approx>gen alpha6 rfv_trm6 pi ((rbv6 t2), s2))) \<Longrightarrow> rLt6 t1 s1 \<approx>6 rLt6 t2 s2"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   987
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   988
lemma alpha6_equivps:
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   989
  shows "equivp alpha6"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   990
sorry
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   991
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   992
quotient_type
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   993
  trm6 = rtrm6 / alpha6
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   994
  by (auto intro: alpha6_equivps)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   995
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   996
quotient_definition
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   997
  "Vr6 :: name \<Rightarrow> trm6"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   998
as
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
   999
  "rVr6"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1000
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1001
quotient_definition
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1002
  "Lm6 :: name \<Rightarrow> trm6 \<Rightarrow> trm6"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1003
as
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1004
  "rLm6"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1005
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1006
quotient_definition
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1007
  "Lt6 :: trm6 \<Rightarrow> trm6 \<Rightarrow> trm6"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1008
as
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1009
  "rLt6"
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1010
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1011
quotient_definition
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1012
   "fv_trm6 :: trm6 \<Rightarrow> atom set"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1013
as
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1014
  "rfv_trm6"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1015
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1016
quotient_definition
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1017
   "bv6 :: trm6 \<Rightarrow> atom set"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1018
as
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1019
  "rbv6"
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1020
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1021
lemma [quot_respect]:
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1022
  "(op = ===> alpha6 ===> alpha6) permute permute"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1023
apply auto (* will work with eqvt *)
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1024
sorry
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1025
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1026
(* Definitely not true , see lemma below *)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1027
1104
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1028
lemma [quot_respect]:"(alpha6 ===> op =) rbv6 rbv6"
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1029
apply simp apply clarify
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1030
apply (erule alpha6.induct)
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1031
oops
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1032
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1033
lemma "(a :: name) \<noteq> b \<Longrightarrow> \<not> (alpha6 ===> op =) rbv6 rbv6"
1104
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1034
apply simp
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1035
apply (rule_tac x="rLm6 (a::name) (rVr6 (a :: name))" in  exI)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1036
apply (rule_tac x="rLm6 (b::name) (rVr6 (b :: name))" in  exI)
1104
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1037
apply simp
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1038
apply (rule a2)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1039
apply (rule_tac x="(a \<leftrightarrow> b)" in  exI)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1040
apply (simp add: alpha_gen fresh_star_def)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1041
apply (rule a1)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1042
apply (rule refl)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1043
done
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1044
1104
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1045
lemma [quot_respect]:"(alpha6 ===> op =) rfv_trm6 rfv_trm6"
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1046
apply simp apply clarify
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1047
apply (induct_tac x y rule: alpha6.induct)
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1048
apply simp_all
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1049
apply (erule exE)
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1050
apply (simp_all add: alpha_gen)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1051
apply (erule conjE)+
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1052
apply (erule exE)
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1053
apply (erule conjE)+
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1054
apply (simp)
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1055
oops
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1056
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1057
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1058
lemma [quot_respect]: "(op = ===> alpha6) rVr6 rVr6"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1059
by (simp_all add: a1)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1060
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1061
lemma [quot_respect]:
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1062
 "(op = ===> alpha6 ===> alpha6) rLm6 rLm6"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1063
 "(alpha6 ===> alpha6 ===> alpha6) rLt6 rLt6"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1064
apply simp_all apply (clarify)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1065
apply (rule a2)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1066
apply (rule_tac x="0::perm" in exI)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1067
apply (simp add: alpha_gen)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1068
(* needs rfv6_rsp *) defer
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1069
apply clarify
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1070
apply (rule a3)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1071
apply (rule_tac x="0::perm" in exI)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1072
apply (simp add: alpha_gen)
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1073
(* needs rbv6_rsp *)
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1074
oops
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1075
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1076
instantiation trm6 :: pt begin
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1077
1104
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1078
quotient_definition
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1079
  "permute_trm6 :: perm \<Rightarrow> trm6 \<Rightarrow> trm6"
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1080
as
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1081
  "permute :: perm \<Rightarrow> rtrm6 \<Rightarrow> rtrm6"
84d666f9face the specifications of the respects.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1103
diff changeset
  1082
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1083
instance
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1084
apply default
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1085
sorry
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1086
end
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1087
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1088
lemma lifted_induct:
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1089
"\<lbrakk>x1 = x2; \<And>a b. a = b \<Longrightarrow> P (Vr6 a) (Vr6 b);
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1090
 \<And>a t b s.
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1091
   \<exists>pi. fv_trm6 t - {atom a} = fv_trm6 s - {atom b} \<and>
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1092
        (fv_trm6 t - {atom a}) \<sharp>* pi \<and> pi \<bullet> t = s \<and> P (pi \<bullet> t) s \<Longrightarrow>
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1093
   P (Lm6 a t) (Lm6 b s);
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1094
 \<And>t1 s1 t2 s2.
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1095
   \<exists>pi. fv_trm6 s1 - bv6 t1 = fv_trm6 s2 - bv6 t2 \<and>
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1096
        (fv_trm6 s1 - bv6 t1) \<sharp>* pi \<and> pi \<bullet> s1 = s2 \<and> P (pi \<bullet> s1) s2 \<Longrightarrow>
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1097
   P (Lt6 t1 s1) (Lt6 t2 s2)\<rbrakk>
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1098
 \<Longrightarrow> P x1 x2"
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1099
unfolding alpha_gen
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1100
apply (lifting alpha6.induct[unfolded alpha_gen])
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1101
apply injection
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1102
(* notice unsolvable goals: (alpha6 ===> op =) rbv6 rbv6 *)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1103
oops
1106
ad2feded2a8c More about trm6
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1104
diff changeset
  1104
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1105
lemma lifted_inject_a3:
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1106
 "\<exists>pi. fv_trm6 s1 - bv6 t1 = fv_trm6 s2 - bv6 t2 \<and>
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1107
    (fv_trm6 s1 - bv6 t1) \<sharp>* pi \<and> pi \<bullet> s1 = s2 \<Longrightarrow> Lt6 t1 s1 = Lt6 t2 s2"
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1108
apply(lifting a3[unfolded alpha_gen])
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1109
apply injection
1111
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1110
(* notice unsolvable goals: (alpha6 ===> op =) rbv6 rbv6 *)
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1111
oops
ee276c9f12f0 A concrete example, with a proof that rbv is not regular and
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1109
diff changeset
  1112
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1113
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1114
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1115
1121
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1116
(* example with a respectful bn function defined over the type itself *)
1131
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1117
1121
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1118
datatype rtrm7 =
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1119
  rVr7 "name"
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1120
| rLm7 "name" "rtrm7"
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1121
| rLt7 "rtrm7" "rtrm7" --"bind (bv7 left) in (right)"
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1122
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1123
primrec
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1124
  rbv7
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1125
where
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1126
  "rbv7 (rVr7 n) = {atom n}"
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1127
| "rbv7 (rLm7 n t) = rbv7 t - {atom n}"
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1128
| "rbv7 (rLt7 l r) = rbv7 l \<union> rbv7 r"
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1129
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1130
primrec
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1131
  rfv_trm7
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1132
where
1131
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1133
  "rfv_trm7 (rVr7 n) = {atom n}"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1134
| "rfv_trm7 (rLm7 n t) = (rfv_trm7 t) - {atom n}"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1135
| "rfv_trm7 (rLt7 l r) = (rfv_trm7 l) \<union> (rfv_trm7 r - rbv7 l)"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1136
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1137
instantiation
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1138
  rtrm7 :: pt
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1139
begin
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1140
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1141
primrec
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1142
  permute_rtrm7
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1143
where
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1144
  "permute_rtrm7 pi (rVr7 a) = rVr7 (pi \<bullet> a)"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1145
| "permute_rtrm7 pi (rLm7 a t) = rLm7 (pi \<bullet> a) (permute_rtrm7 pi t)"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1146
| "permute_rtrm7 pi (rLt7 t1 t2) = rLt7 (permute_rtrm7 pi t1) (permute_rtrm7 pi t2)"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1147
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1148
lemma pt_rtrm7_zero:
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1149
  fixes t::rtrm7
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1150
  shows "0 \<bullet> t = t"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1151
apply(induct t)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1152
apply(simp_all)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1153
done
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1154
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1155
lemma pt_rtrm7_plus:
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1156
  fixes t::rtrm7
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1157
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1158
apply(induct t)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1159
apply(simp_all)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1160
done
1121
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1161
1131
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1162
instance
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1163
apply default
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1164
apply(simp_all add: pt_rtrm7_zero pt_rtrm7_plus)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1165
done
1121
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1166
1131
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1167
end
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1168
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1169
inductive
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1170
  alpha7 :: "rtrm7 \<Rightarrow> rtrm7 \<Rightarrow> bool" ("_ \<approx>7 _" [100, 100] 100)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1171
where
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1172
  a1: "a = b \<Longrightarrow> (rVr7 a) \<approx>7 (rVr7 b)"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1173
| a2: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha7 rfv_trm7 pi ({atom b}, s))) \<Longrightarrow> rLm7 a t \<approx>7 rLm7 b s"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1174
| a3: "(\<exists>pi. (((rbv7 t1), s1) \<approx>gen alpha7 rfv_trm7 pi ((rbv7 t2), s2))) \<Longrightarrow> rLt7 t1 s1 \<approx>7 rLt7 t2 s2"
1121
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1175
1131
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1176
lemma bvfv7: "rbv7 x = rfv_trm7 x"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1177
  apply induct
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1178
  apply simp_all
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1179
done
1121
8d3f92694e85 example with a respectful bn function defined over the type itself
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1119
diff changeset
  1180
1131
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1181
lemma "(x::name) \<noteq> y \<Longrightarrow> \<not> (alpha7 ===> op =) rbv7 rbv7"
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1182
  apply simp
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1183
  apply (rule_tac x="rLt7 (rVr7 x) (rVr7 x)" in exI)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1184
  apply (rule_tac x="rLt7 (rVr7 y) (rVr7 y)" in exI)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1185
  apply simp
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1186
  apply (rule a3)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1187
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1188
  apply (simp_all add: alpha_gen fresh_star_def)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1189
  apply (rule a1)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1190
  apply (rule refl)
95e587907728 Even when bv = fv it still doesn't lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
  1191
done
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1192
1133
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1193
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1194
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1195
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1196
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1197
atom_decl name2
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1198
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1199
datatype rfoo8 =
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1200
  Foo0 "name"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1201
| Foo1 "rbar8" "rfoo8" --"bind bv(bar) in foo"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1202
and rbar8 =
1133
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1203
  Bar0 "name2"
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1204
| Bar1 "name" "name2" "rbar8" --"bind second name in b"
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1205
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1206
primrec
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1207
  rbv8
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1208
where
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1209
  "rbv8 (Bar0 x) = {}"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1210
| "rbv8 (Bar1 v x b) = {atom v}"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1211
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1212
primrec 
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1213
  rfv_foo8 and rfv_bar8
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1214
where
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1215
  "rfv_foo8 (Foo0 x) = {atom x}"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1216
| "rfv_foo8 (Foo1 b t) = (rfv_foo8 t - rbv8 b) \<union> (rfv_bar8 b)"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1217
| "rfv_bar8 (Bar0 x) = {atom x}"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1218
| "rfv_bar8 (Bar1 v x t) = {atom v} \<union> (rfv_bar8 t - {atom x})"
1134
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1219
print_theorems
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1220
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1221
instantiation
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1222
  rfoo8 and rbar8 :: pt
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1223
begin
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1224
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1225
primrec
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1226
  permute_rfoo8 and permute_rbar8
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1227
where
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1228
  "permute_rfoo8 pi (Foo0 a) = Foo0 (pi \<bullet> a)"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1229
| "permute_rfoo8 pi (Foo1 b t) = Foo1 (permute_rbar8 pi b) (permute_rfoo8 pi t)"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1230
| "permute_rbar8 pi (Bar0 a) = Bar0 (pi \<bullet> a)"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1231
| "permute_rbar8 pi (Bar1 v x t) = Bar1 (pi \<bullet> v) (pi \<bullet> x) (permute_rbar8 pi t)"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1232
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1233
instance sorry
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1234
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1235
end
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1236
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1237
inductive
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1238
  alpha8f :: "rfoo8 \<Rightarrow> rfoo8 \<Rightarrow> bool" ("_ \<approx>f _" [100, 100] 100)
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1239
and
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1240
  alpha8b :: "rbar8 \<Rightarrow> rbar8 \<Rightarrow> bool" ("_ \<approx>b _" [100, 100] 100)
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1241
where
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1242
  a1: "a = b \<Longrightarrow> (Foo0 a) \<approx>f (Foo0 b)"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1243
| a2: "a = b \<Longrightarrow> (Bar0 a) \<approx>b (Bar0 b)"
1134
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1244
| a3: "b1 \<approx>b b2 \<Longrightarrow> (\<exists>pi. (((rbv8 b1), t1) \<approx>gen alpha8f rfv_foo8 pi ((rbv8 b2), t2))) \<Longrightarrow> Foo1 b1 t1 \<approx>f Foo1 b2 t2"
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1245
| a4: "v1 = v2 \<Longrightarrow> (\<exists>pi. (({atom x1}, t1) \<approx>gen alpha8b rfv_bar8 pi ({atom x2}, t2))) \<Longrightarrow> Bar1 v1 x1 t1 \<approx>b Bar1 v2 x2 t2"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1246
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1247
lemma "(alpha8b ===> op =) rbv8 rbv8"
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1248
  apply simp apply clarify
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1249
  apply (erule alpha8f_alpha8b.inducts(2))
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1250
  apply (simp_all)
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1251
done
1134
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1252
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1253
lemma rfv_bar8_rsp_hlp: "x \<approx>b y \<Longrightarrow> rfv_bar8 x = rfv_bar8 y"
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1254
  apply (erule alpha8f_alpha8b.inducts(2))
1133
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1255
  apply (simp_all add: alpha_gen)
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1256
done
1134
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1257
lemma "(alpha8b ===> op =) rfv_bar8 rfv_bar8"
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1258
  apply simp apply clarify apply (simp add: rfv_bar8_rsp_hlp)
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1259
done
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1260
1134
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1261
lemma "(alpha8f ===> op =) rfv_foo8 rfv_foo8"
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1262
  apply simp apply clarify
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1263
  apply (erule alpha8f_alpha8b.inducts(1))
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1264
  apply (simp_all add: alpha_gen rfv_bar8_rsp_hlp)
1133
649680775e93 fv_foo is not regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1132
diff changeset
  1265
done
1132
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1266
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1267
3d28e437581b Testing foo/bar
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1131
diff changeset
  1268
1103
7e691b3c2414 trm6 with the 'Foo' constructor.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1093
diff changeset
  1269
1134
998d6b491003 Finished a working foo/bar.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1133
diff changeset
  1270
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1271
text {* type schemes *} 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1272
datatype ty = 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1273
  Var "name" 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1274
| Fun "ty" "ty"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1275
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1276
instantiation
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1277
  ty :: pt
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1278
begin
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1279
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1280
primrec
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1281
  permute_ty 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1282
where
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1283
  "permute_ty pi (Var a) = Var (pi \<bullet> a)"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1284
| "permute_ty pi (Fun T1 T2) = Fun (permute_ty pi T1) (permute_ty pi T2)"
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
  1285
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1286
lemma pt_ty_zero:
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1287
  fixes T::ty
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1288
  shows "0 \<bullet> T = T"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1289
apply(induct T rule: ty.inducts)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1290
apply(simp_all)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1291
done
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
  1292
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1293
lemma pt_ty_plus:
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1294
  fixes T::ty
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1295
  shows "((p + q) \<bullet> T) = p \<bullet> (q \<bullet> T)"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1296
apply(induct T rule: ty.inducts)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1297
apply(simp_all)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1298
done
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1299
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1300
instance
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1301
apply default
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1302
apply(simp_all add: pt_ty_zero pt_ty_plus)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1303
done
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
  1304
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
  1305
end
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1306
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1307
datatype tyS = 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1308
  All "name set" "ty" 
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
  1309
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1310
instantiation
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1311
  tyS :: pt
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1312
begin
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1313
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1314
primrec
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1315
  permute_tyS 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1316
where
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1317
  "permute_tyS pi (All xs T) = All (pi \<bullet> xs) (pi \<bullet> T)"
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
  1318
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1319
lemma pt_tyS_zero:
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1320
  fixes T::tyS
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1321
  shows "0 \<bullet> T = T"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1322
apply(induct T rule: tyS.inducts)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1323
apply(simp_all)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1324
done
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
  1325
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1326
lemma pt_tyS_plus:
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1327
  fixes T::tyS
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1328
  shows "((p + q) \<bullet> T) = p \<bullet> (q \<bullet> T)"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1329
apply(induct T rule: tyS.inducts)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1330
apply(simp_all)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1331
done
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1332
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1333
instance
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1334
apply default
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1335
apply(simp_all add: pt_tyS_zero pt_tyS_plus)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1336
done
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1337
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1338
end
1046
159c7a9cd575 Definitions for trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1044
diff changeset
  1339
1040
632467a97dd8 alpha5 pseudo-injective
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1036
diff changeset
  1340
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1341
abbreviation
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1342
  "atoms xs \<equiv> {atom x| x. x \<in> xs}"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1343
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1344
primrec
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1345
  rfv_ty
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1346
where
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1347
  "rfv_ty (Var n) = {atom n}"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1348
| "rfv_ty (Fun T1 T2) = (rfv_ty T1) \<union> (rfv_ty T2)"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1349
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1350
primrec
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1351
  rfv_tyS
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1352
where 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1353
  "rfv_tyS (All xs T) = (rfv_ty T - atoms xs)"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1354
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1355
inductive
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1356
  alpha_tyS :: "tyS \<Rightarrow> tyS \<Rightarrow> bool" ("_ \<approx>tyS _" [100, 100] 100)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1357
where
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1358
  a1: "\<exists>pi. ((atoms xs1, T1) \<approx>gen (op =) rfv_ty pi (atoms xs2, T2)) 
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1359
        \<Longrightarrow> All xs1 T1 \<approx>tyS All xs2 T2"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1360
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1361
lemma
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1362
  shows "All {a, b} (Fun (Var a) (Var b)) \<approx>tyS All {b, a} (Fun (Var a) (Var b))"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1363
  apply(rule a1)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1364
  apply(simp add: alpha_gen)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1365
  apply(rule_tac x="0::perm" in exI)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1366
  apply(simp add: fresh_star_def)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1367
  done
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1368
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1369
lemma
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1370
  shows "All {a, b} (Fun (Var a) (Var b)) \<approx>tyS All {a, b} (Fun (Var b) (Var a))"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1371
  apply(rule a1)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1372
  apply(simp add: alpha_gen)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1373
  apply(rule_tac x="(atom a \<rightleftharpoons> atom b)" in exI)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1374
  apply(simp add: fresh_star_def)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1375
  done
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1376
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1377
lemma
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1378
  shows "All {a, b, c} (Fun (Var a) (Var b)) \<approx>tyS All {a, b} (Fun (Var a) (Var b))"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1379
  apply(rule a1)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1380
  apply(simp add: alpha_gen)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1381
  apply(rule_tac x="0::perm" in exI)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1382
  apply(simp add: fresh_star_def)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1383
  done
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1384
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1385
lemma
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1386
  assumes a: "a \<noteq> b"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1387
  shows "\<not>(All {a, b} (Fun (Var a) (Var b)) \<approx>tyS All {c} (Fun (Var c) (Var c)))"
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1388
  using a
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1389
  apply(clarify)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1390
  apply(erule alpha_tyS.cases)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1391
  apply(simp add: alpha_gen)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1392
  apply(erule conjE)+
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1393
  apply(erule exE)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1394
  apply(erule conjE)+
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1395
  apply(clarify)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1396
  apply(simp)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1397
  apply(simp add: fresh_star_def)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1398
  apply(auto)
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1399
  done
1051
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1050 1049
diff changeset
  1400
1048
f5e037fd7c01 added type-scheme example
Christian Urban <urbanc@in.tum.de>
parents: 1044
diff changeset
  1401
1035
3a60a028cfc5 Starting with a let-rec example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1033
diff changeset
  1402
end