Quot/Nominal/Terms.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 02 Feb 2010 16:51:00 +0100
changeset 1029 5f098a0d2daa
parent 1028 41fc4d3fc764
child 1030 07f97267a392
permissions -rw-r--r--
More in Terms
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Terms
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../QuotMain" "Abs"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
atom_decl name
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
text {* primrec seems to be genarally faster than fun *}
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
section {*** lets with binding patterns ***}
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    11
datatype rtrm1 =
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    12
  rVr1 "name"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    13
| rAp1 "rtrm1" "rtrm1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    14
| rLm1 "name" "rtrm1"        --"name is bound in trm1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    15
| rLt1 "bp" "rtrm1" "rtrm1"   --"all variables in bp are bound in the 2nd trm1"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
and bp =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
  BUnit
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
| BVr "name"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
| BPr "bp" "bp"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
(* to be given by the user *)
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
    22
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
primrec 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  bv1
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  "bv1 (BUnit) = {}"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    27
| "bv1 (BVr x) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
| "bv1 (BPr bp1 bp2) = (bv1 bp1) \<union> (bv1 bp1)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
(* needs to be calculated by the package *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
primrec 
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    32
  rfv_trm1 and rfv_bp
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
where
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    34
  "rfv_trm1 (rVr1 x) = {atom x}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    35
| "rfv_trm1 (rAp1 t1 t2) = (rfv_trm1 t1) \<union> (rfv_trm1 t2)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    36
| "rfv_trm1 (rLm1 x t) = (rfv_trm1 t) - {atom x}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    37
| "rfv_trm1 (rLt1 bp t1 t2) = (rfv_trm1 t1) \<union> (rfv_trm1 t2 - bv1 bp)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    38
| "rfv_bp (BUnit) = {}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    39
| "rfv_bp (BVr x) = {atom x}"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    40
| "rfv_bp (BPr b1 b2) = (rfv_bp b1) \<union> (rfv_bp b2)"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
(* needs to be stated by the package *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
instantiation 
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    44
  rtrm1 and bp :: pt
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
primrec
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    48
  permute_rtrm1 and permute_bp
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
where
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    50
  "permute_rtrm1 pi (rVr1 a) = rVr1 (pi \<bullet> a)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    51
| "permute_rtrm1 pi (rAp1 t1 t2) = rAp1 (permute_rtrm1 pi t1) (permute_rtrm1 pi t2)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    52
| "permute_rtrm1 pi (rLm1 a t) = rLm1 (pi \<bullet> a) (permute_rtrm1 pi t)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    53
| "permute_rtrm1 pi (rLt1 bp t1 t2) = rLt1 (permute_bp pi bp) (permute_rtrm1 pi t1) (permute_rtrm1 pi t2)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    54
| "permute_bp pi (BUnit) = BUnit"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    55
| "permute_bp pi (BVr a) = BVr (pi \<bullet> a)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    56
| "permute_bp pi (BPr bp1 bp2) = BPr (permute_bp pi bp1) (permute_bp pi bp2)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    57
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    58
lemma pt_rtrm1_bp_zero:
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    59
  fixes t::rtrm1
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    60
  and   b::bp
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    61
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    62
  and   "0 \<bullet> b = b"
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    63
apply(induct t and b rule: rtrm1_bp.inducts)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    64
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    65
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    66
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    67
lemma pt_rtrm1_bp_plus:
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    68
  fixes t::rtrm1
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    69
  and   b::bp
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    70
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    71
  and   "((p + q) \<bullet> b) = p \<bullet> (q \<bullet> b)"
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    72
apply(induct t and b rule: rtrm1_bp.inducts)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    73
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    74
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    75
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    76
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    77
apply default
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    78
apply(simp_all add: pt_rtrm1_bp_zero pt_rtrm1_bp_plus)
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
    79
done
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
inductive
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    84
  alpha1 :: "rtrm1 \<Rightarrow> rtrm1 \<Rightarrow> bool" ("_ \<approx>1 _" [100, 100] 100)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
where
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    86
  a1: "a = b \<Longrightarrow> (rVr1 a) \<approx>1 (rVr1 b)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    87
| a2: "\<lbrakk>t1 \<approx>1 t2; s1 \<approx>1 s2\<rbrakk> \<Longrightarrow> rAp1 t1 s1 \<approx>1 rAp1 t2 s2"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    88
| a3: "(\<exists>pi. (({atom aa}, t) \<approx>gen alpha1 rfv_trm1 pi ({atom ab}, s))) \<Longrightarrow> rLm1 aa t \<approx>1 rLm1 ab s"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    89
| a4: "t1 \<approx>1 t2 \<Longrightarrow> (\<exists>pi. (((bv1 b1), s1) \<approx>gen alpha1 rfv_trm1 pi ((bv1 b2), s2))) \<Longrightarrow> rLt1 b1 t1 s1 \<approx>1 rLt1 b2 t2 s2"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    90
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
    91
lemma alpha1_inj:
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    92
"(rVr1 a \<approx>1 rVr1 b) = (a = b)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    93
"(rAp1 t1 s1 \<approx>1 rAp1 t2 s2) = (t1 \<approx>1 t2 \<and> s1 \<approx>1 s2)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    94
"(rLm1 aa t \<approx>1 rLm1 ab s) = (\<exists>pi. (({atom aa}, t) \<approx>gen alpha1 rfv_trm1 pi ({atom ab}, s)))"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    95
"(rLt1 b1 t1 s1 \<approx>1 rLt1 b2 t2 s2) = (t1 \<approx>1 t2 \<and> (\<exists>pi. (((bv1 b1), s1) \<approx>gen alpha1 rfv_trm1 pi ((bv1 b2), s2))))"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    96
apply -
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    97
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    98
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
    99
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   100
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   101
done
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   102
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   103
lemma rfv_trm1_eqvt[eqvt]:
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   104
  shows "(pi\<bullet>rfv_trm1 t) = rfv_trm1 (pi\<bullet>t)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   105
  sorry
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   106
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   107
lemma alpha1_eqvt:
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   108
  shows "t \<approx>1 s \<Longrightarrow> (pi \<bullet> t) \<approx>1 (pi \<bullet> s)"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   109
  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
   110
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   111
lemma alpha1_equivp: "equivp alpha1" 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   112
  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
   113
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   114
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
   115
  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
   116
1028
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   117
quotient_definition
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   118
  "Vr1 :: name \<Rightarrow> trm1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   119
as
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   120
  "rVr1"
41fc4d3fc764 First experiments in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 976
diff changeset
   121
1029
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   122
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   123
  "Ap1 :: trm1 \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   124
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   125
  "rAp1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   126
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   127
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   128
  "Lm1 :: name \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   129
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   130
  "rLm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   131
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   132
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   133
  "Lt1 :: bp \<Rightarrow> trm1 \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   134
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   135
  "rLt1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   136
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   137
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   138
  "fv_trm1 :: trm1 \<Rightarrow> atom set"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   139
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   140
  "rfv_trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   141
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   142
lemma alpha_rfv1:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   143
  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
   144
  apply(induct rule: alpha1.induct)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   145
  apply(simp_all add: alpha_gen.simps)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   146
  done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   147
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   148
lemma [quot_respect]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   149
 "(op = ===> alpha1) rVr1 rVr1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   150
 "(alpha1 ===> alpha1 ===> alpha1) rAp1 rAp1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   151
 "(op = ===> alpha1 ===> alpha1) rLm1 rLm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   152
 "(op = ===> alpha1 ===> alpha1 ===> alpha1) rLt1 rLt1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   153
apply (auto intro: alpha1.intros)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   154
apply(rule a3) apply (rule_tac x="0" in exI)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   155
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
   156
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
   157
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
   158
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   159
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   160
lemma [quot_respect]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   161
  "(op = ===> alpha1 ===> alpha1) permute permute"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   162
apply auto
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   163
apply (rule alpha1_eqvt)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   164
apply simp
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   165
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   166
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   167
lemma [quot_respect]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   168
  "(alpha1 ===> op =) rfv_trm1 rfv_trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   169
apply (simp add: alpha_rfv1)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   170
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   171
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   172
lemma trm1_bp_induct: "
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   173
\<lbrakk>\<And>name. P1 (Vr1 name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   174
 \<And>rtrm11 rtrm12. \<lbrakk>P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Ap1 rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   175
 \<And>name rtrm1. P1 rtrm1 \<Longrightarrow> P1 (Lm1 name rtrm1);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   176
 \<And>bp rtrm11 rtrm12.
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   177
    \<lbrakk>P2 bp; P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Lt1 bp rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   178
 P2 BUnit; \<And>name. P2 (BVr name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   179
 \<And>bp1 bp2. \<lbrakk>P2 bp1; P2 bp2\<rbrakk> \<Longrightarrow> P2 (BPr bp1 bp2)\<rbrakk>
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   180
\<Longrightarrow> P1 rtrma \<and> P2 bpa"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   181
apply (lifting rtrm1_bp.induct)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   182
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   183
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   184
lemma trm1_bp_inducts: "
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   185
\<lbrakk>\<And>name. P1 (Vr1 name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   186
 \<And>rtrm11 rtrm12. \<lbrakk>P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Ap1 rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   187
 \<And>name rtrm1. P1 rtrm1 \<Longrightarrow> P1 (Lm1 name rtrm1);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   188
 \<And>bp rtrm11 rtrm12.
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   189
    \<lbrakk>P2 bp; P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Lt1 bp rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   190
 P2 BUnit; \<And>name. P2 (BVr name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   191
 \<And>bp1 bp2. \<lbrakk>P2 bp1; P2 bp2\<rbrakk> \<Longrightarrow> P2 (BPr bp1 bp2)\<rbrakk>
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   192
\<Longrightarrow> P1 rtrma"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   193
"\<lbrakk>\<And>name. P1 (Vr1 name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   194
 \<And>rtrm11 rtrm12. \<lbrakk>P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Ap1 rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   195
 \<And>name rtrm1. P1 rtrm1 \<Longrightarrow> P1 (Lm1 name rtrm1);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   196
 \<And>bp rtrm11 rtrm12.
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   197
    \<lbrakk>P2 bp; P1 rtrm11; P1 rtrm12\<rbrakk> \<Longrightarrow> P1 (Lt1 bp rtrm11 rtrm12);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   198
 P2 BUnit; \<And>name. P2 (BVr name);
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   199
 \<And>bp1 bp2. \<lbrakk>P2 bp1; P2 bp2\<rbrakk> \<Longrightarrow> P2 (BPr bp1 bp2)\<rbrakk>
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   200
\<Longrightarrow> P2 bpa"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   201
by (lifting rtrm1_bp.inducts)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   202
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   203
instantiation trm1 and bp :: pt
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   204
begin
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   205
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   206
quotient_definition
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   207
  "permute_trm1 :: perm \<Rightarrow> trm1 \<Rightarrow> trm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   208
as
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   209
  "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   210
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   211
lemma permute_trm1 [simp]:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   212
  shows "pi \<bullet> Vr1 a = Vr1 (pi \<bullet> a)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   213
  and   "pi \<bullet> Ap1 t1 t2 = Ap1 (pi \<bullet> t1) (pi \<bullet> t2)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   214
  and   "pi \<bullet> Lm1 a t = Lm1 (pi \<bullet> a) (pi \<bullet> t)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   215
  and   "pi \<bullet> Lt1 b t s = Lt1 (pi \<bullet> b) (pi \<bullet> t) (pi \<bullet> s)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   216
apply -
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   217
apply(lifting permute_rtrm1_permute_bp.simps(1))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   218
apply(lifting permute_rtrm1_permute_bp.simps(2))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   219
apply(lifting permute_rtrm1_permute_bp.simps(3))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   220
apply(lifting permute_rtrm1_permute_bp.simps(4))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   221
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   222
instance
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   223
apply default
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   224
apply(induct_tac [!] x rule: trm1_bp_inducts(1))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   225
apply(simp_all)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   226
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   227
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   228
end
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   229
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   230
lemma fv_trm1:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   231
"fv_trm1 (Vr1 x) = {atom x}"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   232
"fv_trm1 (Ap1 t1 t2) = fv_trm1 t1 \<union> fv_trm1 t2"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   233
"fv_trm1 (Lm1 x t) = fv_trm1 t - {atom x}"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   234
"fv_trm1 (Lt1 bp t1 t2) = fv_trm1 t1 \<union> (fv_trm1 t2 - bv1 bp)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   235
apply -
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   236
apply (lifting rfv_trm1_rfv_bp.simps(1))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   237
apply (lifting rfv_trm1_rfv_bp.simps(2))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   238
apply (lifting rfv_trm1_rfv_bp.simps(3))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   239
apply (lifting rfv_trm1_rfv_bp.simps(4))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   240
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   241
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   242
lemma fv_trm1_eqvt:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   243
  shows "(p \<bullet> fv_trm1 t) = fv_trm1 (p \<bullet> t)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   244
apply(lifting rfv_trm1_eqvt)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   245
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   246
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   247
lemma alpha1_INJ:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   248
"(Vr1 a = Vr1 b) = (a = b)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   249
"(Ap1 t1 s1 = Ap1 t2 s2) = (t1 = t2 \<and> s1 = s2)"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   250
"(Lm1 aa t = Lm1 ab s) = (\<exists>pi. (({atom aa}, t) \<approx>gen (op =) fv_trm1 pi ({atom ab}, s)))"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   251
"(Lt1 b1 t1 s1 = Lt1 b2 t2 s2) = (t1 = t2 \<and> (\<exists>pi. (((bv1 b1), s1) \<approx>gen (op =) fv_trm1 pi ((bv1 b2), s2))))"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   252
unfolding alpha_gen apply (lifting alpha1_inj[unfolded alpha_gen])
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   253
done
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   254
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   255
lemma supp_fv:
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   256
  shows "supp t = fv_trm1 t"
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   257
apply(induct t rule: trm1_bp_inducts(1))
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   258
apply(simp_all add: supp_def permute_trm1 alpha1_INJ fv_trm1)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   259
apply(simp_all only: supp_at_base[simplified supp_def])
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   260
apply(simp_all add: Collect_imp_eq Collect_neg_eq)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   261
sorry (* Lam & Let still to do *)
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   262
5f098a0d2daa More in Terms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1028
diff changeset
   263
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
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
   266
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
datatype trm2 =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
  Vr2 "name"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
| Ap2 "trm2" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
| Lm2 "name" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
| Lt2 "assign" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
and assign =
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
  As "name" "trm2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
(* 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
   276
primrec 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
  bv2
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   279
  "bv2 (As x t) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
(* 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
   282
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
  fv_trm2 and fv_assign
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   285
  "fv_trm2 (Vr2 x) = {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
| "fv_trm2 (Ap2 t1 t2) = (fv_trm2 t1) \<union> (fv_trm2 t2)"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   287
| "fv_trm2 (Lm2 x t) = (fv_trm2 t) - {atom x}"
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
| "fv_trm2 (Lt2 as t) = (fv_trm2 t - bv2 as) \<union> (fv_assign as)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
| "fv_assign (As x t) = (fv_trm2 t)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
(* 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
   292
instantiation 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   293
  trm2 and assign :: pt
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
primrec
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   297
  permute_trm2 and permute_assign
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   299
  "permute_trm2 pi (Vr2 a) = Vr2 (pi \<bullet> a)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   300
| "permute_trm2 pi (Ap2 t1 t2) = Ap2 (permute_trm2 pi t1) (permute_trm2 pi t2)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   301
| "permute_trm2 pi (Lm2 a t) = Lm2 (pi \<bullet> a) (permute_trm2 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   302
| "permute_trm2 pi (Lt2 as t) = Lt2 (permute_assign pi as) (permute_trm2 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   303
| "permute_assign pi (As a t) = As (pi \<bullet> a) (permute_trm2 pi t)"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   304
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   305
lemma pt_trm2_assign_zero:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   306
  fixes t::trm2
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   307
  and   b::assign
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   308
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   309
  and   "0 \<bullet> b = b"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   310
apply(induct t and b rule: trm2_assign.inducts)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   311
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   312
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   313
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   314
lemma pt_trm2_assign_plus:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   315
  fixes t::trm2
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   316
  and   b::assign
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   317
  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
   318
  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
   319
apply(induct t and b rule: trm2_assign.inducts)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   320
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   321
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   322
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   323
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   324
apply default
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   325
apply(simp_all add: pt_trm2_assign_zero pt_trm2_assign_plus)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   326
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   327
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
  alpha2 :: "trm2 \<Rightarrow> trm2 \<Rightarrow> bool" ("_ \<approx>2 _" [100, 100] 100)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
  a1: "a = b \<Longrightarrow> (Vr2 a) \<approx>2 (Vr2 b)"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
| a2: "\<lbrakk>t1 \<approx>2 t2; s1 \<approx>2 s2\<rbrakk> \<Longrightarrow> Ap2 t1 s1 \<approx>2 Ap2 t2 s2"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   336
| a3: "\<exists>pi. (fv_trm2 t - {atom a} = fv_trm2 s - {atom b} \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   337
            (fv_trm2 t - {atom a})\<sharp>* pi \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   338
            (pi \<bullet> t) \<approx>2 s \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   339
            (pi \<bullet> a) = b)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
       \<Longrightarrow> Lm2 a t \<approx>2 Lm2 b s"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   341
| a4: "\<exists>pi. (
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
         fv_trm2 t1 - fv_assign b1 = fv_trm2 t2 - fv_assign b2 \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
         (fv_trm2 t1 - fv_assign b1) \<sharp>* pi \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
         pi \<bullet> t1 = t2       (* \<and> (pi \<bullet> b1 = b2) *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
       ) \<Longrightarrow> Lt2 b1 t1 \<approx>2 Lt2 b2 t2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   347
lemma alpha2_equivp: "equivp alpha2" 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   348
  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
   349
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
quotient_type qtrm2 = trm2 / alpha2
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
  by (rule alpha2_equivp)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
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
   354
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
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
   356
  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
   357
| Ap3 "trm3" "trm3"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
| Lm3 "name" "trm3"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
| Lt3 "assigns" "trm3"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
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
   361
  ANil
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
| 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
   363
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   364
(* 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
   365
primrec 
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
  bv3
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
  "bv3 ANil = {}"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   369
| "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
   370
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   371
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   372
  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
   373
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   374
  "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
   375
| "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
   376
| "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
   377
| "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
   378
| "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
   379
| "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
   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
(* 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
   382
instantiation
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   383
 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
   384
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
primrec
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   387
  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
   388
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   389
  "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
   390
| "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
   391
| "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
   392
| "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
   393
| "permute_assigns pi (ANil) = ANil"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   394
| "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
   395
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   396
lemma pt_trm3_assigns_zero:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   397
  fixes t::trm3
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   398
  and   b::assigns
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   399
  shows "0 \<bullet> t = t"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   400
  and   "0 \<bullet> b = b"
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   401
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
   402
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   403
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   404
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   405
lemma pt_trm3_assigns_plus:
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   406
  fixes t::trm3
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   407
  and   b::assigns
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   408
  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
   409
  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
   410
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
   411
apply(simp_all)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   412
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   413
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   414
instance
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   415
apply default
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   416
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
   417
done
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   418
950
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
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
  alpha3 :: "trm3 \<Rightarrow> trm3 \<Rightarrow> bool" ("_ \<approx>3 _" [100, 100] 100)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
  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
   426
| a2: "\<lbrakk>t1 \<approx>3 t2; s1 \<approx>3 s2\<rbrakk> \<Longrightarrow> Ap3 t1 s1 \<approx>3 Ap3 t2 s2"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   427
| a3: "\<exists>pi. (fv_trm3 t - {atom a} = fv_trm3 s - {atom b} \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   428
             (fv_trm3 t - {atom a})\<sharp>* pi \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   429
             (pi \<bullet> t) \<approx>3 s \<and> 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   430
             (pi \<bullet> a) = b)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   431
       \<Longrightarrow> Lm3 a t \<approx>3 Lm3 b s"
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   432
| a4: "\<exists>pi. (
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   433
         fv_trm3 t1 - fv_assigns b1 = fv_trm3 t2 - fv_assigns b2 \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   434
         (fv_trm3 t1 - fv_assigns b1) \<sharp>* pi \<and>
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   435
         pi \<bullet> t1 = t2      (* \<and> (pi \<bullet> b1 = b2)  *)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
       ) \<Longrightarrow> Lt3 b1 t1 \<approx>3 Lt3 b2 t2"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   438
lemma alpha3_equivp: "equivp alpha3" 
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   439
  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
   440
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
quotient_type qtrm3 = trm3 / alpha3
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
  by (rule alpha3_equivp)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   444
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445
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
   446
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   447
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
   448
  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
   449
| Ap4 "trm4" "trm4 list"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
| Lm4 "name" "trm4"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   451
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   452
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
   453
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   454
primrec
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   455
  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
   456
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   457
  "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
   458
| "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
   459
| "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
   460
| "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
   461
| "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
   462
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
(* 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
   465
(* there cannot be a clause for lists, as *) 
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   466
(* permuteutations are  already defined in Nominal (also functions, options, and so on) *)
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   467
instantiation
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   468
  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
   469
begin
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   470
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   471
(* 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
   472
primrec
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   473
  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
   474
where
957
080bd6f1607c mostly ported Terms.thy to new Nominal
Christian Urban <urbanc@in.tum.de>
parents: 950
diff changeset
   475
  "permute_trm4 pi (Vr4 a) = Vr4 (pi \<bullet> a)"
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   476
| "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
   477
| "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
   478
| "permute_trm4_list pi ([]) = []"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   479
| "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
   480
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   481
lemma pt_trm4_list_zero:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   482
  fixes t::trm4
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   483
  and   ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   484
  shows "0 \<bullet> t = t"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   485
  and   "permute_trm4_list 0 ts = ts"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   486
apply(induct t and ts rule: trm4.inducts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   487
apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   488
done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   489
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   490
lemma pt_trm4_list_plus:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   491
  fixes t::trm4
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   492
  and   ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   493
  shows "((p + q) \<bullet> t) = p \<bullet> (q \<bullet> t)"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   494
  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
   495
apply(induct t and ts rule: trm4.inducts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   496
apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   497
done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   498
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   499
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   500
instance
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   501
apply(default)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   502
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
   503
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
   504
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   505
end
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   507
(* "repairing" of the permute function *)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   508
lemma repaired:
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   509
  fixes ts::"trm4 list"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   510
  shows "permute_trm4_list p ts = p \<bullet> ts"
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   511
  apply(induct ts)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   512
  apply(simp_all)
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   513
  done
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   514
976
Christian Urban <urbanc@in.tum.de>
parents: 963
diff changeset
   515
thm permute_trm4_permute_trm4_list.simps
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   516
thm permute_trm4_permute_trm4_list.simps[simplified repaired]
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   517
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   518
inductive
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   519
    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
   520
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
   521
where
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   522
  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
   523
| a2: "\<lbrakk>t1 \<approx>4 t2; s1 \<approx>4list s2\<rbrakk> \<Longrightarrow> Ap4 t1 s1 \<approx>4 Ap4 t2 s2"
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   524
| a4: "\<exists>pi. (fv_trm4 t - {atom a} = fv_trm4 s - {atom b} \<and> 
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   525
            (fv_trm4 t - {atom a})\<sharp>* pi \<and> 
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   526
            (pi \<bullet> t) \<approx>4 s \<and> 
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   527
            (pi \<bullet> a) = b)
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   528
       \<Longrightarrow> Lm4 a t \<approx>4 Lm4 b s"
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
| 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
   530
| 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
   531
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
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
   533
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
   534
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   535
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
   536
  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
   537
  qtrm4list = "trm4 list" / alpha4list
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   538
  by (simp_all add: alpha4_equivp alpha4list_equivp)
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   539
963
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   540
caed1462c951 completely ported
Christian Urban <urbanc@in.tum.de>
parents: 957
diff changeset
   541
950
98764f25f012 added Terms to Nominal - Instantiation of two types does not work (ask Florian)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   542
end