equal
deleted
inserted
replaced
8 ("nominal_permeq.ML") |
8 ("nominal_permeq.ML") |
9 ("nominal_fresh_fun.ML") |
9 ("nominal_fresh_fun.ML") |
10 ("nominal_primrec.ML") |
10 ("nominal_primrec.ML") |
11 ("nominal_inductive.ML") |
11 ("nominal_inductive.ML") |
12 ("nominal_inductive2.ML") |
12 ("nominal_inductive2.ML") |
13 begin |
13 begin |
14 |
14 |
15 section {* Permutations *} |
15 section {* Permutations *} |
16 (*======================*) |
16 (*======================*) |
17 |
17 |
18 type_synonym |
18 type_synonym |
25 |
25 |
26 (* a "private" copy of the option type used in the abstraction function *) |
26 (* a "private" copy of the option type used in the abstraction function *) |
27 datatype 'a noption = nSome 'a | nNone |
27 datatype 'a noption = nSome 'a | nNone |
28 |
28 |
29 (* a "private" copy of the product type used in the nominal induct method *) |
29 (* a "private" copy of the product type used in the nominal induct method *) |
30 datatype ('a,'b) nprod = nPair 'a 'b |
30 datatype ('a, 'b) nprod = nPair 'a 'b |
31 |
31 |
32 (* an auxiliary constant for the decision procedure involving *) |
32 (* an auxiliary constant for the decision procedure involving *) |
33 (* permutations (to avoid loops when using perm-compositions) *) |
33 (* permutations (to avoid loops when using perm-compositions) *) |
34 definition |
34 definition |
35 "perm_aux pi x = pi\<bullet>x" |
35 "perm_aux pi x = pi\<bullet>x" |
37 (* overloaded permutation operations *) |
37 (* overloaded permutation operations *) |
38 overloading |
38 overloading |
39 perm_fun \<equiv> "perm :: 'x prm \<Rightarrow> ('a\<Rightarrow>'b) \<Rightarrow> ('a\<Rightarrow>'b)" (unchecked) |
39 perm_fun \<equiv> "perm :: 'x prm \<Rightarrow> ('a\<Rightarrow>'b) \<Rightarrow> ('a\<Rightarrow>'b)" (unchecked) |
40 perm_bool \<equiv> "perm :: 'x prm \<Rightarrow> bool \<Rightarrow> bool" (unchecked) |
40 perm_bool \<equiv> "perm :: 'x prm \<Rightarrow> bool \<Rightarrow> bool" (unchecked) |
41 perm_unit \<equiv> "perm :: 'x prm \<Rightarrow> unit \<Rightarrow> unit" (unchecked) |
41 perm_unit \<equiv> "perm :: 'x prm \<Rightarrow> unit \<Rightarrow> unit" (unchecked) |
42 perm_prod \<equiv> "perm :: 'x prm \<Rightarrow> ('a\<times>'b) \<Rightarrow> ('a\<times>'b)" (unchecked) |
42 perm_prod \<equiv> "perm :: 'x prm \<Rightarrow> ('a\<times>'b) \<Rightarrow> ('a\<times>'b)" (unchecked) |
43 perm_list \<equiv> "perm :: 'x prm \<Rightarrow> 'a list \<Rightarrow> 'a list" (unchecked) |
43 perm_list \<equiv> "perm :: 'x prm \<Rightarrow> 'a list \<Rightarrow> 'a list" (unchecked) |
44 perm_option \<equiv> "perm :: 'x prm \<Rightarrow> 'a option \<Rightarrow> 'a option" (unchecked) |
44 perm_option \<equiv> "perm :: 'x prm \<Rightarrow> 'a option \<Rightarrow> 'a option" (unchecked) |
45 perm_char \<equiv> "perm :: 'x prm \<Rightarrow> char \<Rightarrow> char" (unchecked) |
45 perm_char \<equiv> "perm :: 'x prm \<Rightarrow> char \<Rightarrow> char" (unchecked) |
46 perm_nat \<equiv> "perm :: 'x prm \<Rightarrow> nat \<Rightarrow> nat" (unchecked) |
46 perm_nat \<equiv> "perm :: 'x prm \<Rightarrow> nat \<Rightarrow> nat" (unchecked) |
47 perm_int \<equiv> "perm :: 'x prm \<Rightarrow> int \<Rightarrow> int" (unchecked) |
47 perm_int \<equiv> "perm :: 'x prm \<Rightarrow> int \<Rightarrow> int" (unchecked) |
51 begin |
51 begin |
52 |
52 |
53 definition |
53 definition |
54 perm_fun_def: "perm_fun pi (f::'a\<Rightarrow>'b) = (\<lambda>x. pi\<bullet>f((rev pi)\<bullet>x))" |
54 perm_fun_def: "perm_fun pi (f::'a\<Rightarrow>'b) = (\<lambda>x. pi\<bullet>f((rev pi)\<bullet>x))" |
55 |
55 |
56 primrec perm_bool :: "'x prm \<Rightarrow> bool \<Rightarrow> bool" where |
56 definition perm_bool :: "'x prm \<Rightarrow> bool \<Rightarrow> bool" where |
57 true_eqvt: "perm_bool pi True = True" |
57 perm_bool_def: "perm_bool pi b = b" |
58 | false_eqvt: "perm_bool pi False = False" |
|
59 |
58 |
60 primrec perm_unit :: "'x prm \<Rightarrow> unit \<Rightarrow> unit" where |
59 primrec perm_unit :: "'x prm \<Rightarrow> unit \<Rightarrow> unit" where |
61 "perm_unit pi () = ()" |
60 "perm_unit pi () = ()" |
62 |
61 |
63 primrec perm_prod :: "'x prm \<Rightarrow> ('a\<times>'b) \<Rightarrow> ('a\<times>'b)" where |
62 primrec perm_prod :: "'x prm \<Rightarrow> ('a\<times>'b) \<Rightarrow> ('a\<times>'b)" where |
87 primrec perm_nprod :: "'x prm \<Rightarrow> ('a, 'b) nprod \<Rightarrow> ('a, 'b) nprod" where |
86 primrec perm_nprod :: "'x prm \<Rightarrow> ('a, 'b) nprod \<Rightarrow> ('a, 'b) nprod" where |
88 "perm_nprod pi (nPair x y) = nPair (pi\<bullet>x) (pi\<bullet>y)" |
87 "perm_nprod pi (nPair x y) = nPair (pi\<bullet>x) (pi\<bullet>y)" |
89 |
88 |
90 end |
89 end |
91 |
90 |
92 |
|
93 (* permutations on booleans *) |
91 (* permutations on booleans *) |
94 lemma perm_bool: |
92 lemmas perm_bool = perm_bool_def |
95 shows "pi\<bullet>(b::bool) = b" |
93 |
96 by (cases b) auto |
94 lemma true_eqvt [simp]: |
|
95 "pi \<bullet> True \<longleftrightarrow> True" |
|
96 by (simp add: perm_bool_def) |
|
97 |
|
98 lemma false_eqvt [simp]: |
|
99 "pi \<bullet> False \<longleftrightarrow> False" |
|
100 by (simp add: perm_bool_def) |
97 |
101 |
98 lemma perm_boolI: |
102 lemma perm_boolI: |
99 assumes a: "P" |
103 assumes a: "P" |
100 shows "pi\<bullet>P" |
104 shows "pi\<bullet>P" |
101 using a by (simp add: perm_bool) |
105 using a by (simp add: perm_bool) |