author | Christian Urban <urbanc@in.tum.de> |
Thu, 04 Oct 2012 11:10:23 +0100 | |
changeset 3200 | 995d47b09ab4 |
parent 3175 | 52730e5ec8cb |
child 3229 | b52e8651591f |
permissions | -rw-r--r-- |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
1 |
(* General executable permutations *) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
2 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
3 |
theory GPerm |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
4 |
imports |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
5 |
"~~/src/HOL/Library/Quotient_Syntax" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
6 |
"~~/src/HOL/Library/Product_ord" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
7 |
"~~/src/HOL/Library/List_lexord" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
8 |
begin |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
9 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
10 |
definition perm_apply where |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
11 |
"perm_apply l e = (case [a\<leftarrow>l . fst a = e] of [] \<Rightarrow> e | x # xa \<Rightarrow> snd x)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
12 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
13 |
lemma perm_apply_simps[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
14 |
"perm_apply (h # t) e = (if fst h = e then snd h else perm_apply t e)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
15 |
"perm_apply [] e = e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
16 |
by (auto simp add: perm_apply_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
17 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
18 |
definition valid_perm where |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
19 |
"valid_perm p \<longleftrightarrow> distinct (map fst p) \<and> fst ` set p = snd ` set p" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
20 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
21 |
lemma valid_perm_zero[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
22 |
"valid_perm []" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
23 |
by (simp add: valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
24 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
25 |
lemma length_eq_card_distinct: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
26 |
"length l = card (set l) \<longleftrightarrow> distinct l" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
27 |
using card_distinct distinct_card by force |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
28 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
29 |
lemma len_set_eq_distinct: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
30 |
assumes "length l = length m" "set l = set m" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
31 |
shows "distinct l = distinct m" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
32 |
using assms |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
33 |
by (simp add: length_eq_card_distinct[symmetric]) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
34 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
35 |
lemma valid_perm_distinct_snd: "valid_perm a \<Longrightarrow> distinct (map snd a)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
36 |
by (metis valid_perm_def image_set length_map len_set_eq_distinct) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
37 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
38 |
definition |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
39 |
perm_eq :: "('a \<times> 'a) list \<Rightarrow> ('a \<times> 'a) list \<Rightarrow> bool" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
40 |
where |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
41 |
"perm_eq x y \<longleftrightarrow> valid_perm x \<and> valid_perm y \<and> (perm_apply x = perm_apply y)" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
42 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
43 |
lemma perm_eq_sym[sym]: |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
44 |
"perm_eq x y \<Longrightarrow> perm_eq y x" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
45 |
by (auto simp add: perm_eq_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
46 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
47 |
lemma perm_eq_equivp: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
48 |
"part_equivp perm_eq" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
49 |
by (auto intro!: part_equivpI sympI transpI exI[of _ "[]"] simp add: perm_eq_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
50 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
51 |
quotient_type |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
52 |
'a gperm = "('a \<times> 'a) list" / partial: "perm_eq" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
53 |
by (rule perm_eq_equivp) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
54 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
55 |
definition perm_add_raw where |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
56 |
"perm_add_raw p q = map (map_pair id (perm_apply p)) q @ [a\<leftarrow>p. fst a \<notin> fst ` set q]" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
57 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
58 |
lemma perm_apply_del[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
59 |
"e \<noteq> b \<Longrightarrow> perm_apply [a\<leftarrow>l. fst a \<noteq> b] e = perm_apply l e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
60 |
"e \<noteq> b \<Longrightarrow> e \<noteq> c \<Longrightarrow> perm_apply [a\<leftarrow>l . fst a \<noteq> b \<and> fst a \<noteq> c] e = perm_apply l e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
61 |
by (induct l) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
62 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
63 |
lemma perm_apply_appendl: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
64 |
"perm_apply a e = perm_apply b e \<Longrightarrow> perm_apply (c @ a) e = perm_apply (c @ b) e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
65 |
by (induct c) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
66 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
67 |
lemma perm_apply_filterP: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
68 |
"b \<noteq> e \<Longrightarrow> perm_apply [a\<leftarrow>l . fst a \<noteq> b \<and> P a] e = perm_apply [a\<leftarrow>l . P a] e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
69 |
by (induct l) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
70 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
71 |
lemma perm_add_apply: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
72 |
shows "perm_apply (perm_add_raw p q) e = perm_apply p (perm_apply q e)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
73 |
by (rule sym, induct q) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
74 |
(auto simp add: perm_add_raw_def perm_apply_filterP intro!: perm_apply_appendl) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
75 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
76 |
definition swap_pair where |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
77 |
"swap_pair a = (snd a, fst a)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
78 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
79 |
definition uminus_perm_raw where |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
80 |
[simp]: "uminus_perm_raw = map swap_pair" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
81 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
82 |
lemma map_fst_minus_perm[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
83 |
"map fst (uminus_perm_raw x) = map snd x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
84 |
"map snd (uminus_perm_raw x) = map fst x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
85 |
by (induct x) (auto simp add: swap_pair_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
86 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
87 |
lemma fst_snd_set_minus_perm[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
88 |
"fst ` set (uminus_perm_raw x) = snd ` set x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
89 |
"snd ` set (uminus_perm_raw x) = fst ` set x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
90 |
by (induct x) (auto simp add: swap_pair_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
91 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
92 |
lemma fst_snd_swap_pair[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
93 |
"fst (swap_pair x) = snd x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
94 |
"snd (swap_pair x) = fst x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
95 |
by (auto simp add: swap_pair_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
96 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
97 |
lemma fst_snd_swap_pair_set[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
98 |
"fst ` swap_pair ` set l = snd ` set l" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
99 |
"snd ` swap_pair ` set l = fst ` set l" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
100 |
by (induct l) (auto simp add: swap_pair_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
101 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
102 |
lemma valid_perm_minus[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
103 |
assumes "valid_perm x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
104 |
shows "valid_perm (map swap_pair x)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
105 |
using assms unfolding valid_perm_def |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
106 |
by (simp add: valid_perm_distinct_snd[OF assms] o_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
107 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
108 |
lemma swap_pair_id[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
109 |
"swap_pair (swap_pair x) = x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
110 |
unfolding swap_pair_def by simp |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
111 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
112 |
lemma perm_apply_minus_minus[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
113 |
"perm_apply (uminus_perm_raw (uminus_perm_raw x)) = perm_apply x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
114 |
by (simp add: o_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
115 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
116 |
lemma filter_eq_nil: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
117 |
"[a\<leftarrow>a. fst a = e] = [] \<longleftrightarrow> e \<notin> fst ` set a" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
118 |
"[a\<leftarrow>a. snd a = e] = [] \<longleftrightarrow> e \<notin> snd ` set a" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
119 |
by (induct a) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
120 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
121 |
lemma filter_rev_eq_nil: "[a\<leftarrow>map swap_pair a. fst a = e] = [] \<longleftrightarrow> e \<notin> snd ` set a" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
122 |
by (induct a) (auto simp add: swap_pair_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
123 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
124 |
lemma filter_fst_eq: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
125 |
"[a\<leftarrow>a . fst a = e] = (l, r) # list \<Longrightarrow> l = e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
126 |
"[a\<leftarrow>a . snd a = e] = (l, r) # list \<Longrightarrow> r = e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
127 |
by (drule filter_eq_ConsD, auto)+ |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
128 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
129 |
lemma filter_map_swap_pair: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
130 |
"[a\<leftarrow>map swap_pair a. fst a = e] = map swap_pair [a\<leftarrow>a. snd a = e]" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
131 |
by (induct a) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
132 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
133 |
lemma forget_tl: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
134 |
"[a\<leftarrow>l . P a] = a # b \<Longrightarrow> a \<in> set l" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
135 |
by (metis Cons_eq_filter_iff in_set_conv_decomp) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
136 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
137 |
lemma valid_perm_lookup_fst_eq_snd: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
138 |
"[a\<leftarrow>l . fst a = f] = (f, s) # l1 \<Longrightarrow> [a\<leftarrow>l . snd a = s] = (f2, s) # l2 \<Longrightarrow> valid_perm l \<Longrightarrow> f2 = f" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
139 |
apply (drule forget_tl valid_perm_distinct_snd)+ |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
140 |
apply (case_tac "f2 = f") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
141 |
apply (auto simp add: in_set_conv_nth swap_pair_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
142 |
apply (case_tac "i = ia") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
143 |
apply auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
144 |
by (metis length_map nth_eq_iff_index_eq nth_map snd_conv) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
145 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
146 |
lemma valid_perm_add_minus: "valid_perm a \<Longrightarrow> perm_apply (map swap_pair a) (perm_apply a e) = e" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
147 |
apply (auto simp add: filter_map_swap_pair filter_eq_nil filter_rev_eq_nil perm_apply_def split: list.split) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
148 |
apply (metis filter_eq_nil(2) neq_Nil_conv valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
149 |
apply (metis hd.simps hd_in_set image_eqI list.simps(2) member_project project_set snd_conv) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
150 |
apply (frule filter_fst_eq(1)) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
151 |
apply (frule filter_fst_eq(2)) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
152 |
apply (auto simp add: swap_pair_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
153 |
apply (erule valid_perm_lookup_fst_eq_snd) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
154 |
apply assumption+ |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
155 |
done |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
156 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
157 |
lemma perm_apply_minus: "valid_perm x \<Longrightarrow> perm_apply (map swap_pair x) a = b \<longleftrightarrow> perm_apply x b = a" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
158 |
using valid_perm_add_minus[symmetric] valid_perm_minus |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
159 |
by (metis uminus_perm_raw_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
160 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
161 |
lemma uminus_perm_raw_rsp[simp]: |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
162 |
"perm_eq x y \<Longrightarrow> perm_eq (map swap_pair x) (map swap_pair y)" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
163 |
by (auto simp add: fun_eq_iff perm_apply_minus[symmetric] perm_eq_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
164 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
165 |
lemma fst_snd_map_pair[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
166 |
"fst ` map_pair f g ` set l = f ` fst ` set l" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
167 |
"snd ` map_pair f g ` set l = g ` snd ` set l" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
168 |
by (induct l) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
169 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
170 |
lemma fst_diff[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
171 |
shows "fst ` {xa \<in> set x. fst xa \<notin> fst ` set y} = fst ` set x - fst ` set y" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
172 |
by auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
173 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
174 |
lemma pair_perm_apply: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
175 |
"distinct (map fst x) \<Longrightarrow> (a, b) \<in> set x \<Longrightarrow> perm_apply x a = b" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
176 |
by (induct x) (auto, metis fst_conv image_eqI) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
177 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
178 |
lemma valid_perm_apply: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
179 |
"valid_perm x \<Longrightarrow> (a, b) \<in> set x \<Longrightarrow> perm_apply x a = b" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
180 |
unfolding valid_perm_def using pair_perm_apply by auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
181 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
182 |
lemma in_perm_apply: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
183 |
"valid_perm x \<Longrightarrow> (a, b) \<in> set x \<Longrightarrow> a \<in> c \<Longrightarrow> b \<in> perm_apply x ` c" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
184 |
by (metis imageI valid_perm_apply) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
185 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
186 |
lemma snd_set_not_in_perm_apply[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
187 |
assumes "valid_perm x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
188 |
shows "snd ` {xa \<in> set x. fst xa \<notin> fst ` set y} = perm_apply x ` (fst ` set x - fst ` set y)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
189 |
proof auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
190 |
fix a b |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
191 |
assume a: "(a, b) \<in> set x" " a \<notin> fst ` set y" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
192 |
then have "a \<in> fst ` set x - fst ` set y" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
193 |
by simp (metis fst_conv image_eqI) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
194 |
with a show "b \<in> perm_apply x ` (fst ` set x - fst ` set y)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
195 |
by (simp add: in_perm_apply assms) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
196 |
next |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
197 |
fix a b |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
198 |
assume a: "a \<notin> fst ` set y" "(a, b) \<in> set x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
199 |
then have "perm_apply x a = b" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
200 |
by (simp add: valid_perm_apply assms) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
201 |
with a show "perm_apply x a \<in> snd ` {xa \<in> set x. fst xa \<notin> fst ` set y}" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
202 |
by (metis (lifting) CollectI fst_conv image_eqI snd_conv) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
203 |
qed |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
204 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
205 |
lemma perm_apply_set: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
206 |
"valid_perm x \<Longrightarrow> perm_apply x ` fst ` set x = fst ` set x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
207 |
by (auto simp add: valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
208 |
(metis (hide_lams, no_types) image_iff pair_perm_apply snd_eqD surjective_pairing)+ |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
209 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
210 |
lemma perm_apply_outset: "a \<notin> fst ` set x \<Longrightarrow> perm_apply x a = a" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
211 |
by (induct x) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
212 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
213 |
lemma perm_apply_subset: "valid_perm x \<Longrightarrow> fst ` set x \<subseteq> s \<Longrightarrow> perm_apply x ` s = s" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
214 |
apply auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
215 |
apply (case_tac [!] "xa \<in> fst ` set x") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
216 |
apply (metis imageI perm_apply_set subsetD) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
217 |
apply (metis perm_apply_outset) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
218 |
apply (metis image_mono perm_apply_set subsetD) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
219 |
by (metis imageI perm_apply_outset) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
220 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
221 |
lemma valid_perm_add_raw[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
222 |
assumes "valid_perm x" "valid_perm y" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
223 |
shows "valid_perm (perm_add_raw x y)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
224 |
using assms |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
225 |
apply (simp (no_asm) add: valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
226 |
apply (intro conjI) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
227 |
apply (auto simp add: perm_add_raw_def valid_perm_def fst_def[symmetric])[1] |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
228 |
apply (simp add: distinct_map inj_on_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
229 |
apply (metis imageI snd_conv) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
230 |
apply (simp add: perm_add_raw_def image_Un) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
231 |
apply (simp add: image_Un[symmetric]) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
232 |
apply (auto simp add: perm_apply_subset valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
233 |
done |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
234 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
235 |
lemma perm_add_raw_rsp[simp]: |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
236 |
"perm_eq x y \<Longrightarrow> perm_eq xa ya \<Longrightarrow> perm_eq (perm_add_raw x xa) (perm_add_raw y ya)" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
237 |
by (simp add: fun_eq_iff perm_add_apply perm_eq_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
238 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
239 |
lemma [simp]: |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
240 |
"perm_eq a a \<longleftrightarrow> valid_perm a" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
241 |
by (simp_all add: perm_eq_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
242 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
243 |
instantiation gperm :: (type) group_add |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
244 |
begin |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
245 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
246 |
lift_definition zero_gperm :: "'a gperm" is "[]" by simp |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
247 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
248 |
lift_definition uminus_gperm :: "'a gperm \<Rightarrow> 'a gperm" is uminus_perm_raw |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
249 |
by (auto simp add: fun_eq_iff perm_apply_minus[symmetric] perm_eq_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
250 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
251 |
lift_definition plus_gperm :: "'a gperm \<Rightarrow> 'a gperm \<Rightarrow> 'a gperm" is perm_add_raw |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
252 |
by simp |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
253 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
254 |
definition |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
255 |
minus_perm_def: "(p1::'a gperm) - p2 = p1 + - p2" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
256 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
257 |
instance |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
258 |
apply default |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
259 |
unfolding minus_perm_def |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
260 |
by (transfer,simp add: perm_add_apply perm_eq_def fun_eq_iff valid_perm_add_minus)+ |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
261 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
262 |
end |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
263 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
264 |
definition "mk_perm_raw l = (if valid_perm l then l else [])" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
265 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
266 |
lift_definition mk_perm :: "('a \<times> 'a) list \<Rightarrow> 'a gperm" is "mk_perm_raw" |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
267 |
by (simp add: mk_perm_raw_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
268 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
269 |
definition "dest_perm_raw p = sort [x\<leftarrow>p. fst x \<noteq> snd x]" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
270 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
271 |
lemma distinct_fst_distinct[simp]: "distinct (map fst x) \<Longrightarrow> distinct x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
272 |
by (induct x) auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
273 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
274 |
lemma perm_apply_in_set: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
275 |
"a \<noteq> b \<Longrightarrow> perm_apply y a = b \<Longrightarrow> (a, b) \<in> set y" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
276 |
by (induct y) (auto split: if_splits) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
277 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
278 |
lemma perm_eq_not_eq_same: |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
279 |
"perm_eq x y \<Longrightarrow> {xa \<in> set x. fst xa \<noteq> snd xa} = {x \<in> set y. fst x \<noteq> snd x}" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
280 |
unfolding perm_eq_def set_eq_iff |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
281 |
apply auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
282 |
apply (subgoal_tac "perm_apply x a = b") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
283 |
apply (simp add: perm_apply_in_set) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
284 |
apply (erule valid_perm_apply) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
285 |
apply simp |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
286 |
apply (subgoal_tac "perm_apply y a = b") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
287 |
apply (simp add: perm_apply_in_set) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
288 |
apply (erule valid_perm_apply) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
289 |
apply simp |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
290 |
done |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
291 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
292 |
lemma [simp]: "distinct (map fst (sort x)) = distinct (map fst x)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
293 |
by (rule len_set_eq_distinct) simp_all |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
294 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
295 |
lemma valid_perm_sort[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
296 |
"valid_perm x \<Longrightarrow> valid_perm (sort x)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
297 |
unfolding valid_perm_def by simp |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
298 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
299 |
lemma same_not_in_dpr: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
300 |
"valid_perm x \<Longrightarrow> (b, b) \<in> set x \<Longrightarrow> b \<notin> fst ` set (dest_perm_raw x)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
301 |
unfolding dest_perm_raw_def valid_perm_def |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
302 |
by auto (metis pair_perm_apply) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
303 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
304 |
lemma in_set_in_dpr: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
305 |
"valid_perm x \<Longrightarrow> a \<noteq> b \<Longrightarrow> (a, b) \<in> set x \<longleftrightarrow> (a, b) \<in> set (dest_perm_raw x)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
306 |
unfolding dest_perm_raw_def valid_perm_def |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
307 |
by simp |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
308 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
309 |
lemma in_set_in_dpr2: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
310 |
"a \<noteq> b \<Longrightarrow> (dest_perm_raw x = dest_perm_raw y) \<Longrightarrow> valid_perm x \<Longrightarrow> valid_perm y \<Longrightarrow> (a, b) \<in> set x \<longleftrightarrow> (a, b) \<in> set y" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
311 |
using in_set_in_dpr by metis |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
312 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
313 |
lemma in_set_in_dpr3: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
314 |
"(dest_perm_raw x = dest_perm_raw y) \<Longrightarrow> valid_perm x \<Longrightarrow> valid_perm y \<Longrightarrow> perm_apply x a = perm_apply y a" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
315 |
by (metis in_set_in_dpr2 pair_perm_apply perm_apply_in_set valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
316 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
317 |
lemma dest_perm_raw_eq[simp]: |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
318 |
"valid_perm x \<Longrightarrow> valid_perm y \<Longrightarrow> (dest_perm_raw x = dest_perm_raw y) = perm_eq x y" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
319 |
apply (auto simp add: perm_eq_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
320 |
apply (metis in_set_in_dpr3 fun_eq_iff) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
321 |
unfolding dest_perm_raw_def |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
322 |
by (rule sorted_distinct_set_unique) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
323 |
(simp_all add: distinct_filter valid_perm_def perm_eq_not_eq_same[simplified perm_eq_def, simplified]) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
324 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
325 |
lift_definition dest_perm :: "('a :: linorder) gperm \<Rightarrow> ('a \<times> 'a) list" |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
326 |
is "dest_perm_raw" |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
327 |
by (simp add: perm_eq_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
328 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
329 |
lemma dest_perm_mk_perm[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
330 |
"dest_perm (mk_perm xs) = sort [x\<leftarrow>mk_perm_raw xs. fst x \<noteq> snd x]" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
331 |
by transfer (simp add: dest_perm_raw_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
332 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
333 |
lemma valid_perm_filter_id[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
334 |
"valid_perm p \<Longrightarrow> valid_perm [x\<leftarrow>p. fst x \<noteq> snd x]" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
335 |
proof (simp (no_asm) add: valid_perm_def, intro conjI) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
336 |
show "valid_perm p \<Longrightarrow> distinct (map fst [x\<Colon>'a \<times> 'a\<leftarrow>p . fst x \<noteq> snd x])" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
337 |
by (auto simp add: distinct_map inj_on_def valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
338 |
assume a: "valid_perm p" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
339 |
then show "fst ` {x\<Colon>'a \<times> 'a \<in> set p. fst x \<noteq> snd x} = snd ` {x\<Colon>'a \<times> 'a \<in> set p. fst x \<noteq> snd x}" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
340 |
apply - |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
341 |
apply (frule valid_perm_distinct_snd) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
342 |
apply (simp add: valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
343 |
apply auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
344 |
apply (subgoal_tac "a \<in> snd ` set p") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
345 |
apply auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
346 |
apply (subgoal_tac "(aa, ba) \<in> {x \<in> set p. fst x \<noteq> snd x}") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
347 |
apply (metis (lifting) image_eqI snd_conv) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
348 |
apply (metis (lifting, mono_tags) fst_conv mem_Collect_eq snd_conv pair_perm_apply) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
349 |
apply (metis fst_conv imageI) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
350 |
apply (drule sym) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
351 |
apply (subgoal_tac "b \<in> fst ` set p") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
352 |
apply auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
353 |
apply (subgoal_tac "(aa, ba) \<in> {x \<in> set p. fst x \<noteq> snd x}") |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
354 |
apply (metis (lifting) image_eqI fst_conv) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
355 |
apply simp |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
356 |
apply (metis valid_perm_add_minus valid_perm_apply valid_perm_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
357 |
apply (metis snd_conv imageI) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
358 |
done |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
359 |
qed |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
360 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
361 |
lemma valid_perm_dest_pair_raw[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
362 |
assumes "valid_perm x" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
363 |
shows "valid_perm (dest_perm_raw x)" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
364 |
using valid_perm_filter_id valid_perm_sort assms |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
365 |
unfolding dest_perm_raw_def |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
366 |
by simp |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
367 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
368 |
lemma dest_perm_raw_repeat[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
369 |
"dest_perm_raw (dest_perm_raw p) = dest_perm_raw p" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
370 |
unfolding dest_perm_raw_def |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
371 |
by simp (rule sorted_sort_id[OF sorted_sort]) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
372 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
373 |
lemma valid_dest_perm_raw_eq[simp]: |
3175
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
374 |
"valid_perm p \<Longrightarrow> perm_eq (dest_perm_raw p) p" |
52730e5ec8cb
Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3173
diff
changeset
|
375 |
"valid_perm p \<Longrightarrow> perm_eq p (dest_perm_raw p)" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
376 |
by (simp_all add: dest_perm_raw_eq[symmetric]) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
377 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
378 |
lemma mk_perm_dest_perm[code abstype]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
379 |
"mk_perm (dest_perm p) = p" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
380 |
by transfer |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
381 |
(auto simp add: mk_perm_raw_def) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
382 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
383 |
instantiation gperm :: (linorder) equal begin |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
384 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
385 |
definition equal_gperm_def: "equal_gperm a b \<longleftrightarrow> dest_perm a = dest_perm b" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
386 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
387 |
instance |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
388 |
apply default |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
389 |
unfolding equal_gperm_def |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
390 |
by transfer simp |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
391 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
392 |
end |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
393 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
394 |
lemma [code abstract]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
395 |
"dest_perm 0 = []" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
396 |
by transfer (simp add: dest_perm_raw_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
397 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
398 |
lemma [code abstract]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
399 |
"dest_perm (-a) = dest_perm_raw (uminus_perm_raw (dest_perm a))" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
400 |
by transfer auto |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
401 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
402 |
lemma [code abstract]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
403 |
"dest_perm (a + b) = dest_perm_raw (perm_add_raw (dest_perm a) (dest_perm b))" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
404 |
by transfer auto |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
405 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
406 |
lift_definition gpermute :: "'a gperm \<Rightarrow> 'a \<Rightarrow> 'a" |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
407 |
is perm_apply |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
408 |
by (simp add: perm_eq_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
409 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
410 |
lemma gpermute_zero[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
411 |
"gpermute 0 x = x" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
412 |
by transfer simp |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
413 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
414 |
lemma gpermute_add[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
415 |
"gpermute (p + q) x = gpermute p (gpermute q x)" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
416 |
by transfer (simp add: perm_add_apply) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
417 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
418 |
definition [simp]: "swap_raw a b = (if a = b then [] else [(a, b), (b, a)])" |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
419 |
|
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
420 |
lift_definition gswap :: "'a \<Rightarrow> 'a \<Rightarrow> 'a gperm" is swap_raw |
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
421 |
by (auto simp add: valid_perm_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
422 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
423 |
lemma [code abstract]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
424 |
"dest_perm (gswap a b) = (if (a, b) \<le> (b, a) then swap_raw a b else swap_raw b a)" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
425 |
by transfer (auto simp add: dest_perm_raw_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
426 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
427 |
lemma swap_self [simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
428 |
"gswap a a = 0" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
429 |
by transfer simp |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
430 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
431 |
lemma [simp]: "a \<noteq> b \<Longrightarrow> valid_perm [(a, b), (b, a)]" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
432 |
unfolding valid_perm_def by auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
433 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
434 |
lemma swap_cancel [simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
435 |
"gswap a b + gswap a b = 0" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
436 |
"gswap a b + gswap b a = 0" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
437 |
by (transfer, auto simp add: perm_eq_def perm_add_apply)+ |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
438 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
439 |
lemma minus_swap [simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
440 |
"- gswap a b = gswap a b" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
441 |
by transfer (auto simp add: perm_eq_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
442 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
443 |
lemma swap_commute: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
444 |
"gswap a b = gswap b a" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
445 |
by transfer (auto simp add: perm_eq_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
446 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
447 |
lemma swap_triple: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
448 |
assumes "a \<noteq> b" "c \<noteq> b" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
449 |
shows "gswap a c + gswap b c + gswap a c = gswap a b" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
450 |
using assms |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
451 |
by transfer (auto simp add: perm_eq_def fun_eq_iff perm_add_apply) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
452 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
453 |
lemma gpermute_gswap[simp]: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
454 |
"b \<noteq> a \<Longrightarrow> gpermute (gswap a b) b = a" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
455 |
"a \<noteq> b \<Longrightarrow> gpermute (gswap a b) a = b" |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
456 |
"c \<noteq> b \<Longrightarrow> c \<noteq> a \<Longrightarrow> gpermute (gswap a b) c = c" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
457 |
by (transfer, auto)+ |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
458 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
459 |
lemma gperm_eq: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
460 |
"(p = q) = (\<forall>a. gpermute p a = gpermute q a)" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
461 |
by transfer (auto simp add: perm_eq_def) |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
462 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
463 |
lemma finite_gpermute_neq: |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
464 |
"finite {a. gpermute p a \<noteq> a}" |
3173
9876d73adb2b
Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3139
diff
changeset
|
465 |
apply transfer |
3139
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
466 |
apply (rule_tac B="fst ` set p" in finite_subset) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
467 |
apply auto |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
468 |
by (metis perm_apply_outset) |
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
469 |
|
e05c033d69c1
Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff
changeset
|
470 |
end |