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 *)
63 definition ltb ≝λn,m. leb n m ∧ notb (eqb n m).
65 theorem not_eq_to_le_to_lt: ∀n,m. n≠m → n≤m → n<m.
67 elim (le_to_or_lt_eq ? ? H1);
88 | apply (not_eq_to_le_to_lt ? ? H H1)
93 generalize in match (not_le_to_lt ? ? H1);
101 theorem ltb_elim: ∀n,m:nat. ∀P:bool → Prop.
102 (n < m → (P true)) → (n ≮ m → (P false)) →
106 (match (ltb n m) with
108 | false ⇒ n ≮ m] → (P (ltb n m))).
109 apply Hcut.apply ltb_to_Prop.
115 theorem Not_lt_n_n: ∀n. n ≮ n.
120 apply (not_le_Sn_n ? H).
123 theorem eq_pred_to_eq:
124 ∀n,m. O < n → O < m → pred n = pred m → n = m.
126 generalize in match (eq_f ? ? S ? ? H2);
128 rewrite < S_pred in H3;
129 rewrite < S_pred in H3;
133 theorem le_pred_to_le:
134 ∀n,m. O < m → pred n ≤ pred m → n ≤ m.
139 rewrite > (S_pred m);
147 theorem le_to_le_pred:
148 ∀n,m. n ≤ m → pred n ≤ pred m.
154 generalize in match H1;
157 [ elim (not_le_Sn_O ? H1)
165 theorem lt_n_m_to_not_lt_m_Sn: ∀n,m. n < m → m ≮ S n.
171 generalize in match (le_S_S ? ? H);
173 generalize in match (transitive_le ? ? ? H2 H1);
175 apply (not_le_Sn_n ? H3).
178 theorem lt_S_S: ∀n,m. n < m → S n < S m.
181 apply (le_S_S ? ? H).
184 (* moved to nat/order.ma
185 theorem lt_O_S: ∀n. O < S n.
192 theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
195 generalize in match (le_S_S_to_le ? ? H1);
197 apply cic:/matita/nat/orders/antisym_le.con;
203 (∀x,y.x≤n → y≤n → f x = f y → x=y) →
204 (∀m. m ≤ n → f m ≤ n) →
205 ∀x. x≤n → ∃y.f y = x ∧ y ≤ n.
208 [ apply (ex_intro ? ? O);
210 [ rewrite < (le_n_O_to_eq ? H2);
211 rewrite < (le_n_O_to_eq ? (H1 O ?));
220 let fSn1 ≝f (S n1) in
222 match ltb fSn1 fx with
226 cut (∀x,y. x ≤ n1 → y ≤ n1 → f' x = f' y → x=y);
227 [ cut (∀x. x ≤ n1 → f' x ≤ n1);
228 [ apply (nat_compare_elim (f (S n1)) x);
230 elim (H f' ? ? (pred x));
237 apply (ex_intro ? ? a);
239 [ generalize in match (eq_f ? ? S ? ? H6);
242 rewrite < S_pred in H5;
243 [ generalize in match H4;
247 apply (ltb_elim (f (S n1)) (f a));
252 | apply (ltn_to_ltO ? ? H4)
256 generalize in match (not_lt_to_le ? ? H4);
259 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
261 generalize in match (H1 ? ? ? ? H4);
263 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
265 generalize in match (H1 ? ? ? ? H9);
268 elim (not_le_Sn_n ? H7)
278 | apply (ltn_to_ltO ? ? H4)
285 | apply le_S_S_to_le;
288 | apply (ltn_to_ltO ? ? H4)
292 apply (ex_intro ? ? (S n1));
305 apply (ex_intro ? ? a);
307 [ generalize in match H4;
311 apply (ltb_elim (f (S n1)) (f a));
314 generalize in match (lt_S_S ? ? H5);
316 rewrite < S_pred in H6;
317 [ elim (lt_n_m_to_not_lt_m_Sn ? ? H4 H6)
318 | apply (ltn_to_ltO ? ? H4)
329 | rewrite > (pred_Sn n1);
331 generalize in match (H2 (S n1));
333 generalize in match (lt_to_le_to_lt ? ? ? H4 (H5 (le_n ?)));
343 apply (ltb_elim (f (S n1)) (f x1));
346 [ generalize in match (H2 x1);
348 change in match n1 with (pred (S n1));
353 | generalize in match (H2 (S n1) (le_n ?));
355 generalize in match (not_lt_to_le ? ? H4);
357 generalize in match (transitive_le ? ? ? H7 H6);
359 cut (f x1 ≠ f (S n1));
360 [ generalize in match (not_eq_to_le_to_lt ? ? Hcut1 H7);
363 generalize in match (transitive_le ? ? ? H9 H6);
369 generalize in match (H1 ? ? ? ? H9);
372 apply (not_le_Sn_n ? H5)
383 apply (ltb_elim (f (S n1)) (f x1));
385 apply (ltb_elim (f (S n1)) (f y));
389 [ apply (H1 ? ? ? ? Hcut);
392 | apply eq_pred_to_eq;
393 [ apply (ltn_to_ltO ? ? H7)
394 | apply (ltn_to_ltO ? ? H6)
398 | (* pred (f x1) = f y absurd since y ≠ S n1 and thus f y ≠ f (S n1)
399 so that f y < f (S n1) < f x1; hence pred (f x1) = f y is absurd *)
401 [ generalize in match (lt_to_not_eq ? ? Hcut);
403 cut (f y ≠ f (S n1));
404 [ cut (f y < f (S n1));
405 [ rewrite < H8 in Hcut2;
408 generalize in match (le_S_S ? ? Hcut2);
410 generalize in match (transitive_le ? ? ? H10 H7);
412 rewrite < (S_pred (f x1)) in H11;
413 [ elim (not_le_Sn_n ? H11)
414 | fold simplify ((f (S n1)) < (f x1)) in H7;
415 apply (ltn_to_ltO ? ? H7)
417 | apply not_eq_to_le_to_lt;
419 | apply not_lt_to_le;
426 apply (H1 ? ? ? ? H10);
436 | (* f x1 = pred (f y) absurd since it implies S (f x1) = f y and
437 f x1 ≤ f (S n1) < f y = S (f x1) so that f x1 = f (S n1); by
438 injectivity x1 = S n1 that is absurd since x1 ≤ n1 *)
439 generalize in match (eq_f ? ? S ? ? H8);
441 rewrite < S_pred in H9;
442 [ rewrite < H9 in H6;
443 generalize in match (not_lt_to_le ? ? H7);
446 generalize in match (le_S_S ? ? H10);
448 generalize in match (antisym_le ? ? H11 H6);
450 generalize in match (inj_S ? ? H12);
452 generalize in match (H1 ? ? ? ? H13);
455 elim (not_le_Sn_n ? H4)
460 | apply (ltn_to_ltO ? ? H6)
462 | apply (H1 ? ? ? ? H8);
470 theorem finite_enumerable_SemiGroup_to_left_cancellable_to_right_cancellable_to_isMonoid:
471 ∀G:finite_enumerable_SemiGroup.
472 left_cancellable ? (op G) →
473 right_cancellable ? (op G) →
474 ∃e:G. isMonoid (mk_PreMonoid G e).
476 letin f ≝(λn.ι(G \sub O · G \sub n));
477 cut (∀n.n ≤ order ? (is_finite_enumerable G) → ∃m.f m = n);
478 [ letin EX ≝(Hcut O ?);
485 letin HH ≝(eq_f ? ? (repr ? (is_finite_enumerable G)) ? ? H2);
487 rewrite > (repr_index_of ? (is_finite_enumerable G)) in HH;
488 apply (ex_intro ? ? (G \sub a));
489 letin GOGO ≝(refl_eq ? (repr ? (is_finite_enumerable G) O));
491 rewrite < HH in GOGO;
492 rewrite < HH in GOGO:(? ? % ?);
493 rewrite > (op_associative ? G) in GOGO;
494 letin GaGa ≝(H ? ? ? GOGO);
499 apply (semigroup_properties G)
500 | unfold is_left_unit; intro;
501 letin GaxGax ≝(refl_eq ? (G \sub a ·x));
502 clearbody GaxGax; (* demo *)
503 rewrite < GaGa in GaxGax:(? ? % ?);
504 rewrite > (op_associative ? (semigroup_properties G)) in GaxGax;
505 apply (H ? ? ? GaxGax)
506 | unfold is_right_unit; intro;
507 letin GaxGax ≝(refl_eq ? (x·G \sub a));
509 rewrite < GaGa in GaxGax:(? ? % ?);
510 rewrite < (op_associative ? (semigroup_properties G)) in GaxGax;
511 apply (H1 ? ? ? GaxGax)
515 elim (pigeonhole (order ? G) f ? ? ? H2);
516 [ apply (ex_intro ? ? a);
521 cut (G \sub (ι(G \sub O · G \sub x)) = G \sub (ι(G \sub O · G \sub y)));
522 [ rewrite > (repr_index_of ? ? (G \sub O · G \sub x)) in Hcut;
523 rewrite > (repr_index_of ? ? (G \sub O · G \sub y)) in Hcut;
524 generalize in match (H ? ? ? Hcut);
526 generalize in match (eq_f ? ? (index_of ? G) ? ? H6);
528 rewrite > index_of_repr in H7;
529 rewrite > index_of_repr in H7;