Nominal/Manual/Term4.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 04 May 2010 17:15:21 +0200
changeset 2061 37337fd5e8a7
parent 2060 04a881bf49e4
child 2063 e4e128e59c41
permissions -rw-r--r--
Move Term4 to NewParser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory Term4
2061
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
     2
imports "../NewAlpha" "../Abs" "../Perm" "../Rsp" "../Lift" "Quotient_List" "../../Attic/Prove"
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
section {*** lam with indirect list recursion ***}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
datatype rtrm4 =
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
  rVr4 "name"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
| rAp4 "rtrm4" "rtrm4 list"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
| rLm4 "name" "rtrm4"  --"bind (name) in (trm)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
(* there cannot be a clause for lists, as *)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
(* permutations are  already defined in Nominal (also functions, options, and so on) *)
2060
04a881bf49e4 Fix Term4 for permutation signature change
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1906
diff changeset
    16
ML {*
04a881bf49e4 Fix Term4 for permutation signature change
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1906
diff changeset
    17
  val dtinfo = Datatype.the_info @{theory} "Term4.rtrm4";
04a881bf49e4 Fix Term4 for permutation signature change
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1906
diff changeset
    18
  val {descr, sorts, ...} = dtinfo;
04a881bf49e4 Fix Term4 for permutation signature change
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1906
diff changeset
    19
*}
04a881bf49e4 Fix Term4 for permutation signature change
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1906
diff changeset
    20
setup {* snd o (define_raw_perms descr sorts @{thm rtrm4.induct} 1) *}
1862
310b7b768adf Lifting in Term4.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1856
diff changeset
    21
print_theorems
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
(* "repairing" of the permute function *)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
lemma repaired:
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
  fixes ts::"rtrm4 list"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  shows "permute_rtrm4_list p ts = p \<bullet> ts"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
  apply(induct ts)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  apply(simp_all)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
thm permute_rtrm4_permute_rtrm4_list.simps
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    32
lemmas perm_fixed = permute_rtrm4_permute_rtrm4_list.simps[simplified repaired]
1862
310b7b768adf Lifting in Term4.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1856
diff changeset
    33
2061
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
    34
ML {* val bl = [[[BEmy 0], [BEmy 0, BEmy 1], [BSet ([(NONE, 0)], [1])]], [[], [BEmy 0, BEmy 1]]] *}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
2061
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
    36
local_setup {* fn ctxt => let val (_, _, ctxt') = define_raw_fv descr sorts [] bl ctxt in ctxt' end *}
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
    37
thm fv_rtrm4.simps fv_rtrm4_list.simps
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
    38
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
    39
local_setup {* snd o define_raw_alpha dtinfo [] bl [@{term fv_rtrm4}, @{term fv_rtrm4_list}] *}
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
    40
thm alpha_rtrm4_alpha_rtrm4_list.intros
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    42
lemma fix2: "alpha_rtrm4_list = list_rel alpha_rtrm4"
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    43
apply (rule ext)+
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    44
apply (induct_tac x xa rule: list_induct2')
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    45
apply (simp_all add: alpha_rtrm4_alpha_rtrm4_list.intros)
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    46
apply clarify apply (erule alpha_rtrm4_list.cases) apply(simp_all)
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    47
apply clarify apply (erule alpha_rtrm4_list.cases) apply(simp_all)
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    48
apply rule
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    49
apply (erule alpha_rtrm4_list.cases)
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    50
apply simp_all
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    51
apply (rule alpha_rtrm4_alpha_rtrm4_list.intros)
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    52
apply simp_all
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    53
done
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    54
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    55
lemma fix3: "fv_rtrm4_list = Union o (set o (map fv_rtrm4))"
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    56
apply (rule ext)
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    57
apply (induct_tac x)
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    58
apply simp_all
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    59
done
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    60
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
notation
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
  alpha_rtrm4 ("_ \<approx>4 _" [100, 100] 100) and
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
  alpha_rtrm4_list ("_ \<approx>4l _" [100, 100] 100)
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    64
thm alpha_rtrm4_alpha_rtrm4_list.intros[simplified fix2]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    66
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha4_inj}, []), (build_rel_inj @{thms alpha_rtrm4_alpha_rtrm4_list.intros} @{thms rtrm4.distinct rtrm4.inject list.distinct list.inject} @{thms alpha_rtrm4.cases alpha_rtrm4_list.cases} ctxt)) ctxt)) *}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
thm alpha4_inj
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    68
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    69
lemmas alpha4_inj_fixed = alpha4_inj[simplified fix2 fix3]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
2061
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
    71
local_setup {* snd o (prove_eqvt [@{typ rtrm4},@{typ "rtrm4 list"}] @{thm rtrm4.induct} @{thms permute_rtrm4_permute_rtrm4_list.simps[simplified repaired] fv_rtrm4.simps fv_rtrm4_list.simps} [@{term fv_rtrm4}, @{term fv_rtrm4_list}]) *}
1853
0120da30673e fv_eqvt in term4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1852
diff changeset
    72
thm eqvts(1-2)
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
local_setup {*
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    75
(fn ctxt => snd (Local_Theory.note ((@{binding alpha4_eqvt}, []),
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    76
  build_alpha_eqvts [@{term alpha_rtrm4}, @{term alpha_rtrm4_list}] (fn _ => alpha_eqvt_tac @{thm alpha_rtrm4_alpha_rtrm4_list.induct} @{thms permute_rtrm4_permute_rtrm4_list.simps[simplified repaired] alpha4_inj} ctxt 1) ctxt) ctxt))
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    77
*}
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    78
thm alpha4_eqvt
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    79
lemmas alpha4_eqvt_fixed = alpha4_eqvt[simplified fix2 fix3]
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    80
1854
8442d81496d5 alpha4_eqvt and alpha4_reflp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1853
diff changeset
    81
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha4_reflp}, []),
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    82
  build_alpha_refl [((0, @{term alpha_rtrm4}), 0), ((0, @{term alpha_rtrm4_list}), 0)] [@{term alpha_rtrm4}, @{term alpha_rtrm4_list}] @{thm rtrm4.induct} @{thms alpha4_inj} ctxt) ctxt)) *}
1854
8442d81496d5 alpha4_eqvt and alpha4_reflp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1853
diff changeset
    83
thm alpha4_reflp
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    84
lemmas alpha4_reflp_fixed = alpha4_reflp[simplified fix2 fix3]
1854
8442d81496d5 alpha4_eqvt and alpha4_reflp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1853
diff changeset
    85
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    86
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha4_equivp}, []),
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    87
  (build_equivps [@{term alpha_rtrm4}, @{term alpha_rtrm4_list}] @{thms alpha4_reflp} @{thm alpha_rtrm4_alpha_rtrm4_list.induct} @{thms rtrm4.inject list.inject} @{thms alpha4_inj} @{thms rtrm4.distinct list.distinct} @{thms alpha_rtrm4_list.cases alpha_rtrm4.cases} @{thms alpha4_eqvt} ctxt)) ctxt)) *}
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
    88
lemmas alpha4_equivp_fixed = alpha4_equivp[simplified fix2 fix3]
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    89
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    90
quotient_type 
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    91
  trm4 = rtrm4 / alpha_rtrm4
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    92
  by (simp_all add: alpha4_equivp)
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    93
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    94
local_setup {*
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
    95
(fn ctxt => ctxt
1855
0a306922ace7 alpha4_equivp and constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1854
diff changeset
    96
 |> snd o (Quotient_Def.quotient_lift_const [] ("Vr4", @{term rVr4}))
1856
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
    97
 |> snd o (Quotient_Def.quotient_lift_const [@{typ "trm4"}] ("Ap4", @{term rAp4}))
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
    98
 |> snd o (Quotient_Def.quotient_lift_const [] ("Lm4", @{term rLm4}))
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
    99
 |> snd o (Quotient_Def.quotient_lift_const [] ("fv_trm4", @{term fv_rtrm4})))
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
*}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
print_theorems
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
1856
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   103
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   104
lemma fv_rtrm4_rsp:
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   105
  "xa \<approx>4 ya \<Longrightarrow> fv_rtrm4 xa = fv_rtrm4 ya"
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   106
  "x \<approx>4l y \<Longrightarrow> fv_rtrm4_list x = fv_rtrm4_list y"
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   107
  apply (induct rule: alpha_rtrm4_alpha_rtrm4_list.inducts)
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   108
  apply (simp_all add: alpha_gen)
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   109
done
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   110
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   111
local_setup {* snd o prove_const_rsp [] @{binding fv_rtrm4_rsp'} [@{term fv_rtrm4}]
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   112
  (fn _ => asm_full_simp_tac (@{simpset} addsimps @{thms fv_rtrm4_rsp}) 1) *}
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   113
print_theorems
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   114
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   115
local_setup {* snd o prove_const_rsp [] @{binding rVr4_rsp} [@{term rVr4}]
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   116
  (fn _ => constr_rsp_tac @{thms alpha4_inj} @{thms fv_rtrm4_rsp alpha4_equivp} 1) *}
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   117
local_setup {* snd o prove_const_rsp [] @{binding rLm4_rsp} [@{term rLm4}]
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   118
  (fn _ => constr_rsp_tac @{thms alpha4_inj} @{thms fv_rtrm4_rsp alpha4_equivp} 1) *}
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   119
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   120
lemma [quot_respect]:
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   121
  "(alpha_rtrm4 ===> list_rel alpha_rtrm4 ===> alpha_rtrm4) rAp4 rAp4"
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   122
  by (simp add: alpha4_inj_fixed)
1856
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   123
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   124
local_setup {* snd o prove_const_rsp [] @{binding permute_rtrm4_rsp}
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   125
  [@{term "permute :: perm \<Rightarrow> rtrm4 \<Rightarrow> rtrm4"}]
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   126
  (fn _ => asm_simp_tac (HOL_ss addsimps @{thms alpha4_eqvt}) 1) *}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   127
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   128
setup {* define_lifted_perms [@{typ trm4}] ["Term4.trm4"] [("permute_trm4", @{term "permute :: perm \<Rightarrow> rtrm4 \<Rightarrow> rtrm4"})] @{thms permute_rtrm4_permute_rtrm4_list_zero permute_rtrm4_permute_rtrm4_list_plus} *}
1862
310b7b768adf Lifting in Term4.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1856
diff changeset
   129
print_theorems
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
   130
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   131
(* Instead of permute for trm4_list we may need the following 2 lemmas: *)
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   132
lemma [quot_preserve]: "(id ---> map rep_trm4 ---> map abs_trm4) permute = permute"
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   133
  apply (simp add: expand_fun_eq)
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   134
  apply clarify
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   135
  apply (rename_tac "pi" x)
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   136
  apply (induct_tac x)
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   137
  apply simp
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   138
  apply simp
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   139
  apply (simp add: meta_eq_to_obj_eq[OF permute_trm4_def,simplified expand_fun_eq,simplified])
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   140
  done
1856
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   141
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   142
lemma [quot_respect]: "(op = ===> list_rel alpha_rtrm4 ===> list_rel alpha_rtrm4) permute permute"
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   143
  apply simp
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   144
  apply (rule allI)+
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   145
  apply (induct_tac xa y rule: list_induct2')
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   146
  apply simp_all
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   147
  apply clarify
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   148
  apply (erule alpha4_eqvt)
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   149
  done
1856
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   150
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   151
ML {*
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   152
  map (lift_thm [@{typ trm4}] @{context}) @{thms perm_fixed}
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   153
*}
1318
cce1b6d1b761 Some tests around Term4. Not sure how to fix the generated fv function.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1300
diff changeset
   154
1856
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   155
ML {* lift_thm [@{typ trm4}] @{context} @{thm rtrm4.induct} *}
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   156
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   157
ML {*
2061
37337fd5e8a7 Move Term4 to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2060
diff changeset
   158
  map (lift_thm [@{typ trm4}] @{context}) @{thms fv_rtrm4.simps[simplified fix3] fv_rtrm4_list.simps[simplified fix3]}
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   159
*}
1856
c8e406f64db0 More on Manual/Trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1855
diff changeset
   160
1906
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   161
ML {*
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   162
val liftd =
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   163
  map (Local_Defs.unfold @{context} @{thms id_simps}) (
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   164
    map (Local_Defs.fold @{context} @{thms alphas}) (
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   165
      map (lift_thm [@{typ trm4}] @{context}) @{thms alpha4_inj_fixed[unfolded alphas]}
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   166
    )
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   167
  )
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   168
*}
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   169
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   170
ML {*
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   171
  map (lift_thm [@{typ trm4}] @{context})
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   172
  (flat (map (distinct_rel @{context} @{thms alpha_rtrm4.cases alpha_rtrm4_list.cases}) [(@{thms rtrm4.distinct},@{term "alpha_rtrm4"})]))
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   173
*}
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   174
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   175
ML {*
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   176
  map (lift_thm [@{typ trm4}] @{context}) @{thms eqvts(1-2)[simplified fix3]}
0dc61c2966da All lifted in Term4. Requires new isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1862
diff changeset
   177
*}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
end