1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/algebra/finite_groups/".
17 include "algebra/groups.ma".
19 record finite_enumerable (T:Type) : Type≝
23 index_of_sur: ∀x.index_of x ≤ order;
24 index_of_repr: ∀n. n≤order → index_of (repr n) = n;
25 repr_index_of: ∀x. repr (index_of x) = x
28 notation "hvbox(C \sub i)" with precedence 89
31 (* CSC: multiple interpretations in the same file are not considered in the
33 interpretation "Finite_enumerable representation" 'repr C i =
34 (cic:/matita/algebra/finite_groups/repr.con C _ i).*)
36 notation < "hvbox(|C|)" with precedence 89
39 interpretation "Finite_enumerable order" 'card C =
40 (cic:/matita/algebra/finite_groups/order.con C _).
42 record finite_enumerable_SemiGroup : Type≝
43 { semigroup:> SemiGroup;
44 is_finite_enumerable:> finite_enumerable semigroup
47 interpretation "Finite_enumerable representation" 'repr S i =
48 (cic:/matita/algebra/finite_groups/repr.con S
49 (cic:/matita/algebra/finite_groups/is_finite_enumerable.con S) i).
51 notation "hvbox(ι e)" with precedence 60
52 for @{ 'index_of_finite_enumerable_semigroup $e }.
54 interpretation "Index_of_finite_enumerable representation"
55 'index_of_finite_enumerable_semigroup e
57 (cic:/matita/algebra/finite_groups/index_of.con _
58 (cic:/matita/algebra/finite_groups/is_finite_enumerable.con _) e).
61 (* several definitions/theorems to be moved somewhere else *)
65 (∀x,y.x≤n → y≤n → f x = f y → x=y) →
66 (∀m. m ≤ n → f m ≤ n) →
67 ∀x. x≤n → ∃y.f y = x ∧ y ≤ n.
70 [ apply (ex_intro ? ? O);
72 [ rewrite < (le_n_O_to_eq ? H2);
73 rewrite < (le_n_O_to_eq ? (H1 O ?));
84 match ltb fSn1 fx with
88 cut (∀x,y. x ≤ n1 → y ≤ n1 → f' x = f' y → x=y);
89 [ cut (∀x. x ≤ n1 → f' x ≤ n1);
90 [ apply (nat_compare_elim (f (S n1)) x);
92 elim (H f' ? ? (pred x));
100 apply (ex_intro ? ? a);
102 [ generalize in match (eq_f ? ? S ? ? H6);
105 rewrite < S_pred in H5;
106 [ generalize in match H4;
110 apply (ltb_elim (f (S n1)) (f a));
115 | apply (ltn_to_ltO ? ? H4)
119 generalize in match (not_lt_to_le ? ? H4);
122 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
124 generalize in match (H1 ? ? ? ? H4);
126 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
128 generalize in match (H1 ? ? ? ? H9);
131 elim (not_le_Sn_n ? H7)
141 | apply (ltn_to_ltO ? ? H4)
148 | apply le_S_S_to_le;
151 | apply (ltn_to_ltO ? ? H4)
155 apply (ex_intro ? ? (S n1));
169 apply (ex_intro ? ? a);
171 [ generalize in match H4;
175 apply (ltb_elim (f (S n1)) (f a));
178 generalize in match (lt_to_lt_S_S ? ? H5);
180 rewrite < S_pred in H6;
181 [ elim (lt_n_m_to_not_lt_m_Sn ? ? H4 H6)
182 | apply (ltn_to_ltO ? ? H4)
193 | rewrite > (pred_Sn n1);
195 generalize in match (H2 (S n1));
197 generalize in match (lt_to_le_to_lt ? ? ? H4 (H5 (le_n ?)));
207 apply (ltb_elim (f (S n1)) (f x1));
210 [ generalize in match (H2 x1);
212 change in match n1 with (pred (S n1));
217 | generalize in match (H2 (S n1) (le_n ?));
219 generalize in match (not_lt_to_le ? ? H4);
221 generalize in match (transitive_le ? ? ? H7 H6);
223 cut (f x1 ≠ f (S n1));
224 [ generalize in match (not_eq_to_le_to_lt ? ? Hcut1 H7);
227 generalize in match (transitive_le ? ? ? H9 H6);
233 generalize in match (H1 ? ? ? ? H9);
236 apply (not_le_Sn_n ? H5)
247 apply (ltb_elim (f (S n1)) (f x1));
249 apply (ltb_elim (f (S n1)) (f y));
253 [ apply (H1 ? ? ? ? Hcut);
256 | alias id "eq_pred_to_eq" = "cic:/matita/nat/relevant_equations/eq_pred_to_eq.con".
258 [ apply (ltn_to_ltO ? ? H7)
259 | apply (ltn_to_ltO ? ? H6)
263 | (* pred (f x1) = f y absurd since y ≠ S n1 and thus f y ≠ f (S n1)
264 so that f y < f (S n1) < f x1; hence pred (f x1) = f y is absurd *)
266 [ generalize in match (lt_to_not_eq ? ? Hcut);
268 cut (f y ≠ f (S n1));
269 [ cut (f y < f (S n1));
270 [ rewrite < H8 in Hcut2;
273 generalize in match (le_S_S ? ? Hcut2);
275 generalize in match (transitive_le ? ? ? H10 H7);
277 rewrite < (S_pred (f x1)) in H11;
278 [ elim (not_le_Sn_n ? H11)
279 | fold simplify ((f (S n1)) < (f x1)) in H7;
280 apply (ltn_to_ltO ? ? H7)
282 | apply not_eq_to_le_to_lt;
284 | apply not_lt_to_le;
291 apply (H1 ? ? ? ? H10);
301 | (* f x1 = pred (f y) absurd since it implies S (f x1) = f y and
302 f x1 ≤ f (S n1) < f y = S (f x1) so that f x1 = f (S n1); by
303 injectivity x1 = S n1 that is absurd since x1 ≤ n1 *)
304 generalize in match (eq_f ? ? S ? ? H8);
306 rewrite < S_pred in H9;
307 [ rewrite < H9 in H6;
308 generalize in match (not_lt_to_le ? ? H7);
311 generalize in match (le_S_S ? ? H10);
313 generalize in match (antisym_le ? ? H11 H6);
315 generalize in match (inj_S ? ? H12);
317 generalize in match (H1 ? ? ? ? H13);
320 elim (not_le_Sn_n ? H4)
325 | apply (ltn_to_ltO ? ? H6)
327 | apply (H1 ? ? ? ? H8);
335 theorem finite_enumerable_SemiGroup_to_left_cancellable_to_right_cancellable_to_isMonoid:
336 ∀G:finite_enumerable_SemiGroup.
337 left_cancellable ? (op G) →
338 right_cancellable ? (op G) →
339 ∃e:G. isMonoid (mk_PreMonoid G e).
341 letin f ≝(λn.ι(G \sub O · G \sub n));
342 cut (∀n.n ≤ order ? (is_finite_enumerable G) → ∃m.f m = n);
343 [ letin EX ≝(Hcut O ?);
350 letin HH ≝(eq_f ? ? (repr ? (is_finite_enumerable G)) ? ? H2);
352 rewrite > (repr_index_of ? (is_finite_enumerable G)) in HH;
353 apply (ex_intro ? ? (G \sub a));
354 letin GOGO ≝(refl_eq ? (repr ? (is_finite_enumerable G) O));
356 rewrite < HH in GOGO;
357 rewrite < HH in GOGO:(? ? % ?);
358 rewrite > (op_associative ? G) in GOGO;
359 letin GaGa ≝(H ? ? ? GOGO);
364 apply (semigroup_properties G)
365 | unfold is_left_unit; intro;
366 letin GaxGax ≝(refl_eq ? (G \sub a ·x));
367 clearbody GaxGax; (* demo *)
368 rewrite < GaGa in GaxGax:(? ? % ?);
369 rewrite > (op_associative ? (semigroup_properties G)) in GaxGax;
370 apply (H ? ? ? GaxGax)
371 | unfold is_right_unit; intro;
372 letin GaxGax ≝(refl_eq ? (x·G \sub a));
374 rewrite < GaGa in GaxGax:(? ? % ?);
375 rewrite < (op_associative ? (semigroup_properties G)) in GaxGax;
376 apply (H1 ? ? ? GaxGax)
380 elim (pigeonhole (order ? G) f ? ? ? H2);
381 [ apply (ex_intro ? ? a);
386 cut (G \sub (ι(G \sub O · G \sub x)) = G \sub (ι(G \sub O · G \sub y)));
387 [ rewrite > (repr_index_of ? ? (G \sub O · G \sub x)) in Hcut;
388 rewrite > (repr_index_of ? ? (G \sub O · G \sub y)) in Hcut;
389 generalize in match (H ? ? ? Hcut);
391 generalize in match (eq_f ? ? (index_of ? G) ? ? H6);
393 rewrite > index_of_repr in H7;
394 rewrite > index_of_repr in H7;