Nominal/ExTySch.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Sat, 27 Mar 2010 09:41:00 +0100
changeset 1676 141a36535f1d
parent 1673 e8cf0520c820
child 1677 ba3f6e33d647
permissions -rw-r--r--
Manually proved TySch support; All properties of TySch now true.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1596
diff changeset
     1
theory ExTySch
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1596
diff changeset
     2
imports "Parser"
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1596
diff changeset
     5
(* Type Schemes *)
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
atom_decl name
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
1676
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
     8
ML {* val _ = alpha_type := AlphaRes *}
1477
4ac3485899e1 Updated Type Schemes to automatic lifting. One goal is not true because of the restriction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1430
diff changeset
     9
nominal_datatype t =
4ac3485899e1 Updated Type Schemes to automatic lifting. One goal is not true because of the restriction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1430
diff changeset
    10
  Var "name"
4ac3485899e1 Updated Type Schemes to automatic lifting. One goal is not true because of the restriction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1430
diff changeset
    11
| Fun "t" "t"
4ac3485899e1 Updated Type Schemes to automatic lifting. One goal is not true because of the restriction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1430
diff changeset
    12
and tyS =
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
    13
  All xs::"name fset" ty::"t" bind xs in ty
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
1676
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    15
lemma t_tyS_supp_fv: "fv_t t = supp t \<and> fv_tyS tyS = supp tyS"
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    16
apply (induct rule: t_tyS.induct)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    17
apply (simp_all only: t_tyS.fv)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    18
apply (simp_all only: supp_abs(2)[symmetric])
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    19
apply(simp_all (no_asm) only: supp_def)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    20
apply(simp_all only: t_tyS.perm permute_abs)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    21
apply(simp only: t_tyS.eq_iff supp_at_base[simplified supp_def])
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    22
apply(simp only: t_tyS.eq_iff Collect_disj_eq[symmetric] infinite_Un[symmetric])
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    23
apply simp
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    24
apply(simp only: Abs_eq_iff t_tyS.eq_iff)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    25
apply (simp add: alphas)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    26
apply (simp add: eqvts[symmetric])
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    27
apply (simp add: eqvts eqvts_raw)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    28
done
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    29
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    30
lemmas t_tyS_supp = t_tyS.fv[simplified t_tyS_supp_fv]
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    31
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
    32
1568
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    33
lemma size_eqvt_raw:
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    34
  "size (pi \<bullet> t :: t_raw) = size t"
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    35
  "size (pi \<bullet> ts :: tyS_raw) = size ts"
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    36
  apply (induct rule: t_raw_tyS_raw.inducts)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    37
  apply simp_all
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    38
  done
1562
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    39
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    40
instantiation t and tyS :: size begin
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    41
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    42
quotient_definition
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    43
  "size_t :: t \<Rightarrow> nat"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    44
is
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    45
  "size :: t_raw \<Rightarrow> nat"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    46
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    47
quotient_definition
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    48
  "size_tyS :: tyS \<Rightarrow> nat"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    49
is
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    50
  "size :: tyS_raw \<Rightarrow> nat"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    51
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    52
lemma size_rsp:
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    53
  "alpha_t_raw x y \<Longrightarrow> size x = size y"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    54
  "alpha_tyS_raw a b \<Longrightarrow> size a = size b"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    55
  apply (induct rule: alpha_t_raw_alpha_tyS_raw.inducts)
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    56
  apply (simp_all only: t_raw_tyS_raw.size)
1673
e8cf0520c820 New compose lemmas. Reverted alpha_gen sym/trans changes. Equivp for alpha_res should work now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1670
diff changeset
    57
  apply (simp_all only: alphas)
1562
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    58
  apply clarify
1568
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    59
  apply (simp_all only: size_eqvt_raw)
1562
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    60
  done
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    61
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    62
lemma [quot_respect]:
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    63
  "(alpha_t_raw ===> op =) size size"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    64
  "(alpha_tyS_raw ===> op =) size size"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    65
  by (simp_all add: size_rsp)
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    66
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    67
lemma [quot_preserve]:
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    68
  "(rep_t ---> id) size = size"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    69
  "(rep_tyS ---> id) size = size"
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    70
  by (simp_all add: size_t_def size_tyS_def)
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    71
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    72
instance
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    73
  by default
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    74
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    75
end
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    76
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    77
thm t_raw_tyS_raw.size(4)[quot_lifted]
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    78
thm t_raw_tyS_raw.size(5)[quot_lifted]
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    79
thm t_raw_tyS_raw.size(6)[quot_lifted]
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    80
41294e4fc870 Size experiments.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1561
diff changeset
    81
1515
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
    82
thm t_tyS.fv
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
    83
thm t_tyS.eq_iff
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
    84
thm t_tyS.bn
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
    85
thm t_tyS.perm
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
    86
thm t_tyS.inducts
1515
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
    87
thm t_tyS.distinct
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1530
diff changeset
    88
ML {* Sign.of_sort @{theory} (@{typ t}, @{sort fs}) *}
1430
ccbcebef56f3 Trying to prove atom_image_fresh_swap
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
    89
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
    90
lemma induct:
1537
0b21101157b1 Something is wrong with the statement of strong induction for TySch, as the All case is trivial and Fun case unprovable...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    91
  assumes a1: "\<And>name b. P b (Var name)"
0b21101157b1 Something is wrong with the statement of strong induction for TySch, as the All case is trivial and Fun case unprovable...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    92
  and     a2: "\<And>t1 t2 b. \<lbrakk>\<And>c. P c t1; \<And>c. P c t2\<rbrakk> \<Longrightarrow> P b (Fun t1 t2)"
1538
6853ce305118 Working on TySch strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1537
diff changeset
    93
  and     a3: "\<And>fset t b. \<lbrakk>\<And>c. P c t; fset_to_set (fmap atom fset) \<sharp>* b\<rbrakk> \<Longrightarrow> P' b (All fset t)"
1568
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
    94
  shows "P (a :: 'a :: pt) t \<and> P' (d :: 'b :: {fs}) ts "
1537
0b21101157b1 Something is wrong with the statement of strong induction for TySch, as the All case is trivial and Fun case unprovable...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    95
proof -
1539
78d0adf8a086 TySch strong induction looks ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1538
diff changeset
    96
  have " (\<forall>p a. P a (p \<bullet> t)) \<and> (\<forall>p d. P' d (p \<bullet> ts))"
1538
6853ce305118 Working on TySch strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1537
diff changeset
    97
    apply (rule t_tyS.induct)
1537
0b21101157b1 Something is wrong with the statement of strong induction for TySch, as the All case is trivial and Fun case unprovable...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    98
    apply (simp add: a1)
1539
78d0adf8a086 TySch strong induction looks ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1538
diff changeset
    99
    apply (simp)
78d0adf8a086 TySch strong induction looks ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1538
diff changeset
   100
    apply (rule allI)+
1538
6853ce305118 Working on TySch strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1537
diff changeset
   101
    apply (rule a2)
1539
78d0adf8a086 TySch strong induction looks ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1538
diff changeset
   102
    apply simp
78d0adf8a086 TySch strong induction looks ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1538
diff changeset
   103
    apply simp
78d0adf8a086 TySch strong induction looks ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1538
diff changeset
   104
    apply (rule allI)
1538
6853ce305118 Working on TySch strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1537
diff changeset
   105
    apply (rule allI)
1605
d46a32cfcd89 compiles
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1599
diff changeset
   106
    apply(subgoal_tac "\<exists>pa. ((pa \<bullet> (fset_to_set (fmap atom (p \<bullet> fset)))) \<sharp>* d \<and> supp (p \<bullet> All fset t) \<sharp>* pa)")
1539
78d0adf8a086 TySch strong induction looks ok.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1538
diff changeset
   107
    apply clarify
1605
d46a32cfcd89 compiles
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1599
diff changeset
   108
    apply(rule_tac t="p \<bullet> All fset t" and 
d46a32cfcd89 compiles
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1599
diff changeset
   109
                   s="pa \<bullet> (p \<bullet> All fset t)" in subst)
1568
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   110
    apply (rule supp_perm_eq)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   111
    apply assumption
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   112
    apply (simp only: t_tyS.perm)
1538
6853ce305118 Working on TySch strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1537
diff changeset
   113
    apply (rule a3)
1568
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   114
    apply(erule_tac x="(pa + p)" in allE)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   115
    apply simp
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   116
    apply (simp add: eqvts eqvts_raw)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   117
    apply (rule at_set_avoiding2)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   118
    apply (simp add: fin_fset_to_set)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   119
    apply (simp add: finite_supp)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   120
    apply (simp add: eqvts finite_supp)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   121
    apply (subst atom_eqvt_raw[symmetric])
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   122
    apply (subst fmap_eqvt[symmetric])
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   123
    apply (subst fset_to_set_eqvt[symmetric])
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   124
    apply (simp only: fresh_star_permute_iff)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   125
    apply (simp add: fresh_star_def)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   126
    apply clarify
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   127
    apply (simp add: fresh_def)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   128
    apply (simp add: t_tyS_supp)
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1562
diff changeset
   129
    done
1538
6853ce305118 Working on TySch strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1537
diff changeset
   130
  then have "P a (0 \<bullet> t) \<and> P' d (0 \<bullet> ts)" by blast
6853ce305118 Working on TySch strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1537
diff changeset
   131
  then show ?thesis by simp
1537
0b21101157b1 Something is wrong with the statement of strong induction for TySch, as the All case is trivial and Fun case unprovable...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
   132
qed
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
   133
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   134
lemma
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
   135
  shows "All {|a, b|} (Fun (Var a) (Var b)) = All {|b, a|} (Fun (Var a) (Var b))"
1515
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
   136
  apply(simp add: t_tyS.eq_iff)
1477
4ac3485899e1 Updated Type Schemes to automatic lifting. One goal is not true because of the restriction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1430
diff changeset
   137
  apply(rule_tac x="0::perm" in exI)
1673
e8cf0520c820 New compose lemmas. Reverted alpha_gen sym/trans changes. Equivp for alpha_res should work now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1670
diff changeset
   138
  apply(simp add: alphas)
1477
4ac3485899e1 Updated Type Schemes to automatic lifting. One goal is not true because of the restriction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1430
diff changeset
   139
  apply(simp add: fresh_star_def fresh_zero_perm)
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   140
  done
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   141
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   142
lemma
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
   143
  shows "All {|a, b|} (Fun (Var a) (Var b)) = All {|a, b|} (Fun (Var b) (Var a))"
1515
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
   144
  apply(simp add: t_tyS.eq_iff)
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   145
  apply(rule_tac x="(atom a \<rightleftharpoons> atom b)" in exI)
1676
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
   146
  apply(simp add: alphas fresh_star_def eqvts)
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   147
  done
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   148
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   149
lemma
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
   150
  shows "All {|a, b, c|} (Fun (Var a) (Var b)) = All {|a, b|} (Fun (Var a) (Var b))"
1515
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
   151
  apply(simp add: t_tyS.eq_iff)
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   152
  apply(rule_tac x="0::perm" in exI)
1676
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
   153
  apply(simp add: alphas fresh_star_def eqvts t_tyS.eq_iff)
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
   154
done
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
lemma
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   157
  assumes a: "a \<noteq> b"
1525
bf321f16d025 Reached strong_induction in fset-based TySch. Will not work until isabelle changes are pushed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1515
diff changeset
   158
  shows "\<not>(All {|a, b|} (Fun (Var a) (Var b)) = All {|c|} (Fun (Var c) (Var c)))"
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   159
  using a
1515
76fa21f27f22 Rename "_property" to ".property"
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1510
diff changeset
   160
  apply(simp add: t_tyS.eq_iff)
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
  apply(clarify)
1676
141a36535f1d Manually proved TySch support; All properties of TySch now true.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1673
diff changeset
   162
  apply(simp add: alphas fresh_star_def eqvts t_tyS.eq_iff)
1477
4ac3485899e1 Updated Type Schemes to automatic lifting. One goal is not true because of the restriction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1430
diff changeset
   163
  apply auto
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
  done
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   166
(* PROBLEM:
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   167
Type schemes with separate datatypes
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   168
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   169
nominal_datatype T =
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   170
  TVar "name"
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   171
| TFun "T" "T"
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   172
nominal_datatype TyS =
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   173
  TAll xs::"name list" ty::"T" bind xs in ty
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   174
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   175
*** exception Datatype raised
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   176
*** (line 218 of "/usr/local/src/Isabelle_16-Mar-2010/src/HOL/Tools/Datatype/datatype_aux.ML")
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   177
*** At command "nominal_datatype".
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   178
*)
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   179
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1595
diff changeset
   180
1271
393aced4801d Forgot to add one file.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
end