72536
|
1 |
theory Specifications_with_bundle_mixins
|
|
2 |
imports "HOL-Library.Perm"
|
|
3 |
begin
|
|
4 |
|
|
5 |
locale involutory =
|
|
6 |
includes permutation_syntax
|
|
7 |
fixes f :: \<open>'a perm\<close>
|
|
8 |
assumes involutory: \<open>\<And>x. f \<langle>$\<rangle> (f \<langle>$\<rangle> x) = x\<close>
|
|
9 |
begin
|
|
10 |
|
|
11 |
lemma
|
|
12 |
\<open>f * f = 1\<close>
|
|
13 |
using involutory
|
|
14 |
by (simp add: perm_eq_iff apply_sequence)
|
|
15 |
|
|
16 |
end
|
|
17 |
|
|
18 |
context involutory
|
|
19 |
begin
|
|
20 |
|
|
21 |
thm involutory (*syntax from permutation_syntax only present in locale specification and initial block*)
|
|
22 |
|
|
23 |
end
|
|
24 |
|
|
25 |
|
|
26 |
class at_most_two_elems =
|
|
27 |
includes permutation_syntax
|
|
28 |
assumes swap_distinct: \<open>a \<noteq> b \<Longrightarrow> \<langle>a \<leftrightarrow> b\<rangle> \<langle>$\<rangle> c \<noteq> c\<close>
|
|
29 |
begin
|
|
30 |
|
|
31 |
lemma
|
|
32 |
\<open>card (UNIV :: 'a set) \<le> 2\<close>
|
|
33 |
proof (rule ccontr)
|
|
34 |
fix a :: 'a
|
|
35 |
assume \<open>\<not> card (UNIV :: 'a set) \<le> 2\<close>
|
|
36 |
then have c0: \<open>card (UNIV :: 'a set) \<ge> 3\<close>
|
|
37 |
by simp
|
|
38 |
then have [simp]: \<open>finite (UNIV :: 'a set)\<close>
|
|
39 |
using card.infinite by fastforce
|
|
40 |
from c0 card_Diff1_le [of UNIV a]
|
|
41 |
have ca: \<open>card (UNIV - {a}) \<ge> 2\<close>
|
|
42 |
by simp
|
|
43 |
then obtain b where \<open>b \<in> (UNIV - {a})\<close>
|
|
44 |
by (metis all_not_in_conv card.empty card_2_iff' le_zero_eq)
|
|
45 |
with ca card_Diff1_le [of \<open>UNIV - {a}\<close> b]
|
|
46 |
have cb: \<open>card (UNIV - {a, b}) \<ge> 1\<close> and \<open>a \<noteq> b\<close>
|
|
47 |
by simp_all
|
|
48 |
then obtain c where \<open>c \<in> (UNIV - {a, b})\<close>
|
|
49 |
by (metis One_nat_def all_not_in_conv card.empty le_zero_eq nat.simps(3))
|
|
50 |
then have \<open>a \<noteq> c\<close> \<open>b \<noteq> c\<close>
|
|
51 |
by auto
|
|
52 |
with swap_distinct [of a b c] show False
|
|
53 |
by (simp add: \<open>a \<noteq> b\<close>)
|
|
54 |
qed
|
|
55 |
|
|
56 |
end
|
|
57 |
|
|
58 |
thm swap_distinct (*syntax from permutation_syntax only present in class specification and initial block*)
|
|
59 |
|
|
60 |
end |