Nominal/Manual/Term8.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 05 Mar 2012 16:27:28 +0000
changeset 3132 87eca760dcba
parent 1937 ffca58ce9fbc
permissions -rw-r--r--
updated tutorial to latest version and added it to the tests
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 Term8
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
     2
imports "../../Nominal-General/Nominal2_Atoms" "../../Nominal-General/Nominal2_Eqvt" "../../Nominal-General/Nominal2_Supp" "../Abs" "../Perm" "../Fv" "../Rsp" "../Lift" "../../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
datatype rfoo8 =
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  Foo0 "name"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| Foo1 "rbar8" "rfoo8" --"bind bv(bar) in foo"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
and rbar8 =
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
  Bar0 "name"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
| Bar1 "name" "name" "rbar8" --"bind second name in b"
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
primrec
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
  rbv8
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
where
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
  "rbv8 (Bar0 x) = {}"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
| "rbv8 (Bar1 v x b) = {atom v}"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
1277
6eacf60ce41d Permutation and FV_Alpha interface change.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1270
diff changeset
    20
setup {* snd o define_raw_perms (Datatype.the_info @{theory} "Term8.rfoo8") 2 *}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
print_theorems
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    23
ML define_fv_alpha_export
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    24
local_setup {* snd o define_fv_alpha_export (Datatype.the_info @{theory} "Term8.rfoo8") [
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    25
  [[], [(SOME (@{term rbv8}, false), 0, 1, AlphaGen)]], [[], [(NONE, 1, 2, AlphaGen)]]]
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    26
  [(@{term "rbv8"}, 1, [[], [(0, NONE), (2, SOME @{term rbv8})]])] *}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
notation
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  alpha_rfoo8 ("_ \<approx>f' _" [100, 100] 100) and
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  alpha_rbar8 ("_ \<approx>b' _" [100, 100] 100)
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    30
thm alpha_rfoo8_alpha_rbar8_alpha_rbv8.intros[no_vars]
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    31
thm fv_rbar8.simps fv_rfoo8_fv_rbv8.simps
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
inductive
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
  alpha8f :: "rfoo8 \<Rightarrow> rfoo8 \<Rightarrow> bool" ("_ \<approx>f _" [100, 100] 100)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
and
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
  alpha8b :: "rbar8 \<Rightarrow> rbar8 \<Rightarrow> bool" ("_ \<approx>b _" [100, 100] 100)
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    37
and
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    38
  alpha8bv:: "rbar8 \<Rightarrow> rbar8 \<Rightarrow> bool" ("_ \<approx>bv _" [100, 100] 100)
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
where
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    40
  "name = namea \<Longrightarrow> Foo0 name \<approx>f Foo0 namea"
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    41
| "\<exists>pi. rbar8 \<approx>bv rbar8a \<and>
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    42
     (rbv8 rbar8, rfoo8) \<approx>gen alpha8f fv_rfoo8 pi (rbv8 rbar8a, rfoo8a) \<Longrightarrow>
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    43
  Foo1 rbar8 rfoo8 \<approx>f Foo1 rbar8a rfoo8a"
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    44
| "name = namea \<Longrightarrow> Bar0 name \<approx>b Bar0 namea"
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    45
| "\<exists>pi. name1 = name1a \<and> ({atom name2}, rbar8) \<approx>gen alpha8b fv_rbv8 pi ({atom name2a}, rbar8a) \<Longrightarrow>
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    46
  Bar1 name1 name2 rbar8 \<approx>b Bar1 name1a name2a rbar8a"
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    47
| "name = namea \<Longrightarrow> alpha8bv (Bar0 name) (Bar0 namea)"
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    48
| "({atom name2}, rbar8) \<approx>gen alpha8b fv_rbv8 pi ({atom name2a}, rbar8a) \<Longrightarrow>
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    49
   alpha8bv (Bar1 name1 name2 rbar8) (Bar1 name1a name2a rbar8a)"
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
lemma "(alpha8b ===> op =) rbv8 rbv8"
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    52
  apply rule
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    53
  apply (induct_tac a b rule: alpha8f_alpha8b_alpha8bv.inducts(2))
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
  apply (simp_all)
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    55
  done
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
lemma fv_rbar8_rsp_hlp: "x \<approx>b y \<Longrightarrow> fv_rbar8 x = fv_rbar8 y"
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    58
  apply (erule alpha8f_alpha8b_alpha8bv.inducts(2))
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
  apply (simp_all add: alpha_gen)
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    60
  apply clarify
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    61
  sorry
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    62
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
lemma "(alpha8b ===> op =) fv_rbar8 fv_rbar8"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
  apply simp apply clarify apply (simp add: fv_rbar8_rsp_hlp)
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    65
  done
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
lemma "(alpha8f ===> op =) fv_rfoo8 fv_rfoo8"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
  apply simp apply clarify
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    69
  apply (erule alpha8f_alpha8b_alpha8bv.inducts(1))
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
  apply (simp_all add: alpha_gen fv_rbar8_rsp_hlp)
1937
ffca58ce9fbc Update term8
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1592
diff changeset
    71
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
done
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
end