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 theorem lt_O_S: ∀n. O < S n.
191 theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
194 generalize in match (le_S_S_to_le ? ? H1);
196 apply cic:/matita/nat/orders/antisym_le.con;
202 (∀x,y.x≤n → y≤n → f x = f y → x=y) →
203 (∀m. m ≤ n → f m ≤ n) →
204 ∀x. x≤n → ∃y.f y = x ∧ y ≤ n.
207 [ apply (ex_intro ? ? O);
209 [ rewrite < (le_n_O_to_eq ? H2);
210 rewrite < (le_n_O_to_eq ? (H1 O ?));
219 let fSn1 ≝f (S n1) in
221 match ltb fSn1 fx with
225 cut (∀x,y. x ≤ n1 → y ≤ n1 → f' x = f' y → x=y);
226 [ cut (∀x. x ≤ n1 → f' x ≤ n1);
227 [ apply (nat_compare_elim (f (S n1)) x);
229 elim (H f' ? ? (pred x));
236 apply (ex_intro ? ? a);
238 [ generalize in match (eq_f ? ? S ? ? H6);
241 rewrite < S_pred in H5;
242 [ generalize in match H4;
246 apply (ltb_elim (f (S n1)) (f a));
251 | apply (ltn_to_ltO ? ? H4)
255 generalize in match (not_lt_to_le ? ? H4);
258 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
260 generalize in match (H1 ? ? ? ? H4);
262 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
264 generalize in match (H1 ? ? ? ? H9);
267 elim (not_le_Sn_n ? H7)
277 | apply (ltn_to_ltO ? ? H4)
284 | apply le_S_S_to_le;
287 | apply (ltn_to_ltO ? ? H4)
291 apply (ex_intro ? ? (S n1));
304 apply (ex_intro ? ? a);
306 [ generalize in match H4;
310 apply (ltb_elim (f (S n1)) (f a));
313 generalize in match (lt_S_S ? ? H5);
315 rewrite < S_pred in H6;
316 [ elim (lt_n_m_to_not_lt_m_Sn ? ? H4 H6)
317 | apply (ltn_to_ltO ? ? H4)
328 | rewrite > (pred_Sn n1);
330 generalize in match (H2 (S n1));
332 generalize in match (lt_to_le_to_lt ? ? ? H4 (H5 (le_n ?)));
342 apply (ltb_elim (f (S n1)) (f x1));
345 [ generalize in match (H2 x1);
347 change in match n1 with (pred (S n1));
352 | generalize in match (H2 (S n1) (le_n ?));
354 generalize in match (not_lt_to_le ? ? H4);
356 generalize in match (transitive_le ? ? ? H7 H6);
358 cut (f x1 ≠ f (S n1));
359 [ generalize in match (not_eq_to_le_to_lt ? ? Hcut1 H7);
362 generalize in match (transitive_le ? ? ? H9 H6);
368 generalize in match (H1 ? ? ? ? H9);
371 apply (not_le_Sn_n ? H5)
382 apply (ltb_elim (f (S n1)) (f x1));
384 apply (ltb_elim (f (S n1)) (f y));
388 [ apply (H1 ? ? ? ? Hcut);
391 | apply eq_pred_to_eq;
392 [ apply (ltn_to_ltO ? ? H7)
393 | apply (ltn_to_ltO ? ? H6)
397 | (* pred (f x1) = f y absurd since y ≠ S n1 and thus f y ≠ f (S n1)
398 so that f y < f (S n1) < f x1; hence pred (f x1) = f y is absurd *)
400 [ generalize in match (lt_to_not_eq ? ? Hcut);
402 cut (f y ≠ f (S n1));
403 [ cut (f y < f (S n1));
404 [ rewrite < H8 in Hcut2;
407 generalize in match (le_S_S ? ? Hcut2);
409 generalize in match (transitive_le ? ? ? H10 H7);
411 rewrite < (S_pred (f x1)) in H11;
412 [ elim (not_le_Sn_n ? H11)
413 | fold simplify ((f (S n1)) < (f x1)) in H7;
414 apply (ltn_to_ltO ? ? H7)
416 | apply not_eq_to_le_to_lt;
418 | apply not_lt_to_le;
425 apply (H1 ? ? ? ? H10);
435 | (* f x1 = pred (f y) absurd since it implies S (f x1) = f y and
436 f x1 ≤ f (S n1) < f y = S (f x1) so that f x1 = f (S n1); by
437 injectivity x1 = S n1 that is absurd since x1 ≤ n1 *)
438 generalize in match (eq_f ? ? S ? ? H8);
440 rewrite < S_pred in H9;
441 [ rewrite < H9 in H6;
442 generalize in match (not_lt_to_le ? ? H7);
445 generalize in match (le_S_S ? ? H10);
447 generalize in match (antisym_le ? ? H11 H6);
449 generalize in match (inj_S ? ? H12);
451 generalize in match (H1 ? ? ? ? H13);
454 elim (not_le_Sn_n ? H4)
459 | apply (ltn_to_ltO ? ? H6)
461 | apply (H1 ? ? ? ? H8);
469 theorem finite_enumerable_SemiGroup_to_left_cancellable_to_right_cancellable_to_isMonoid:
470 ∀G:finite_enumerable_SemiGroup.
471 left_cancellable ? (op G) →
472 right_cancellable ? (op G) →
473 ∃e:G. isMonoid (mk_PreMonoid G e).
475 letin f ≝(λn.ι(G \sub O · G \sub n));
476 cut (∀n.n ≤ order ? (is_finite_enumerable G) → ∃m.f m = n);
477 [ letin EX ≝(Hcut O ?);
484 letin HH ≝(eq_f ? ? (repr ? (is_finite_enumerable G)) ? ? H2);
486 rewrite > (repr_index_of ? (is_finite_enumerable G)) in HH;
487 apply (ex_intro ? ? (G \sub a));
488 letin GOGO ≝(refl_eq ? (repr ? (is_finite_enumerable G) O));
490 rewrite < HH in GOGO;
491 rewrite < HH in GOGO:(? ? % ?);
492 rewrite > (op_associative ? G) in GOGO;
493 letin GaGa ≝(H ? ? ? GOGO);
498 apply (semigroup_properties G)
499 | unfold is_left_unit; intro;
500 letin GaxGax ≝(refl_eq ? (G \sub a ·x));
501 clearbody GaxGax; (* demo *)
502 rewrite < GaGa in GaxGax:(? ? % ?);
503 rewrite > (op_associative ? (semigroup_properties G)) in GaxGax;
504 apply (H ? ? ? GaxGax)
505 | unfold is_right_unit; intro;
506 letin GaxGax ≝(refl_eq ? (x·G \sub a));
508 rewrite < GaGa in GaxGax:(? ? % ?);
509 rewrite < (op_associative ? (semigroup_properties G)) in GaxGax;
510 apply (H1 ? ? ? GaxGax)
514 elim (pigeonhole (order ? G) f ? ? ? H2);
515 [ apply (ex_intro ? ? a);
520 cut (G \sub (ι(G \sub O · G \sub x)) = G \sub (ι(G \sub O · G \sub y)));
521 [ rewrite > (repr_index_of ? ? (G \sub O · G \sub x)) in Hcut;
522 rewrite > (repr_index_of ? ? (G \sub O · G \sub y)) in Hcut;
523 generalize in match (H ? ? ? Hcut);
525 generalize in match (eq_f ? ? (index_of ? G) ? ? H6);
527 rewrite > index_of_repr in H7;
528 rewrite > index_of_repr in H7;