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).
180 (* moved to nat/order.ma
181 theorem lt_O_S: ∀n. O < S n.
188 theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
191 generalize in match (le_S_S_to_le ? ? H1);
193 apply cic:/matita/nat/orders/antisym_le.con;
199 (∀x,y.x≤n → y≤n → f x = f y → x=y) →
200 (∀m. m ≤ n → f m ≤ n) →
201 ∀x. x≤n → ∃y.f y = x ∧ y ≤ n.
204 [ apply (ex_intro ? ? O);
206 [ rewrite < (le_n_O_to_eq ? H2);
207 rewrite < (le_n_O_to_eq ? (H1 O ?));
216 let fSn1 ≝f (S n1) in
218 match ltb fSn1 fx with
222 cut (∀x,y. x ≤ n1 → y ≤ n1 → f' x = f' y → x=y);
223 [ cut (∀x. x ≤ n1 → f' x ≤ n1);
224 [ apply (nat_compare_elim (f (S n1)) x);
226 elim (H f' ? ? (pred x));
233 apply (ex_intro ? ? a);
235 [ generalize in match (eq_f ? ? S ? ? H6);
238 rewrite < S_pred in H5;
239 [ generalize in match H4;
243 apply (ltb_elim (f (S n1)) (f a));
248 | apply (ltn_to_ltO ? ? H4)
252 generalize in match (not_lt_to_le ? ? H4);
255 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
257 generalize in match (H1 ? ? ? ? H4);
259 generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5);
261 generalize in match (H1 ? ? ? ? H9);
264 elim (not_le_Sn_n ? H7)
274 | apply (ltn_to_ltO ? ? H4)
281 | apply le_S_S_to_le;
284 | apply (ltn_to_ltO ? ? H4)
288 apply (ex_intro ? ? (S n1));
301 apply (ex_intro ? ? a);
303 [ generalize in match H4;
307 apply (ltb_elim (f (S n1)) (f a));
310 generalize in match (lt_S_S ? ? H5);
312 rewrite < S_pred in H6;
313 [ elim (lt_n_m_to_not_lt_m_Sn ? ? H4 H6)
314 | apply (ltn_to_ltO ? ? H4)
325 | rewrite > (pred_Sn n1);
327 generalize in match (H2 (S n1));
329 generalize in match (lt_to_le_to_lt ? ? ? H4 (H5 (le_n ?)));
339 apply (ltb_elim (f (S n1)) (f x1));
342 [ generalize in match (H2 x1);
344 change in match n1 with (pred (S n1));
349 | generalize in match (H2 (S n1) (le_n ?));
351 generalize in match (not_lt_to_le ? ? H4);
353 generalize in match (transitive_le ? ? ? H7 H6);
355 cut (f x1 ≠ f (S n1));
356 [ generalize in match (not_eq_to_le_to_lt ? ? Hcut1 H7);
359 generalize in match (transitive_le ? ? ? H9 H6);
365 generalize in match (H1 ? ? ? ? H9);
368 apply (not_le_Sn_n ? H5)
379 apply (ltb_elim (f (S n1)) (f x1));
381 apply (ltb_elim (f (S n1)) (f y));
385 [ apply (H1 ? ? ? ? Hcut);
388 | apply eq_pred_to_eq;
389 [ apply (ltn_to_ltO ? ? H7)
390 | apply (ltn_to_ltO ? ? H6)
394 | (* pred (f x1) = f y absurd since y ≠ S n1 and thus f y ≠ f (S n1)
395 so that f y < f (S n1) < f x1; hence pred (f x1) = f y is absurd *)
397 [ generalize in match (lt_to_not_eq ? ? Hcut);
399 cut (f y ≠ f (S n1));
400 [ cut (f y < f (S n1));
401 [ rewrite < H8 in Hcut2;
404 generalize in match (le_S_S ? ? Hcut2);
406 generalize in match (transitive_le ? ? ? H10 H7);
408 rewrite < (S_pred (f x1)) in H11;
409 [ elim (not_le_Sn_n ? H11)
410 | fold simplify ((f (S n1)) < (f x1)) in H7;
411 apply (ltn_to_ltO ? ? H7)
413 | apply not_eq_to_le_to_lt;
415 | apply not_lt_to_le;
422 apply (H1 ? ? ? ? H10);
432 | (* f x1 = pred (f y) absurd since it implies S (f x1) = f y and
433 f x1 ≤ f (S n1) < f y = S (f x1) so that f x1 = f (S n1); by
434 injectivity x1 = S n1 that is absurd since x1 ≤ n1 *)
435 generalize in match (eq_f ? ? S ? ? H8);
437 rewrite < S_pred in H9;
438 [ rewrite < H9 in H6;
439 generalize in match (not_lt_to_le ? ? H7);
442 generalize in match (le_S_S ? ? H10);
444 generalize in match (antisym_le ? ? H11 H6);
446 generalize in match (inj_S ? ? H12);
448 generalize in match (H1 ? ? ? ? H13);
451 elim (not_le_Sn_n ? H4)
456 | apply (ltn_to_ltO ? ? H6)
458 | apply (H1 ? ? ? ? H8);
466 theorem finite_enumerable_SemiGroup_to_left_cancellable_to_right_cancellable_to_isMonoid:
467 ∀G:finite_enumerable_SemiGroup.
468 left_cancellable ? (op G) →
469 right_cancellable ? (op G) →
470 ∃e:G. isMonoid (mk_PreMonoid G e).
472 letin f ≝(λn.ι(G \sub O · G \sub n));
473 cut (∀n.n ≤ order ? (is_finite_enumerable G) → ∃m.f m = n);
474 [ letin EX ≝(Hcut O ?);
481 letin HH ≝(eq_f ? ? (repr ? (is_finite_enumerable G)) ? ? H2);
483 rewrite > (repr_index_of ? (is_finite_enumerable G)) in HH;
484 apply (ex_intro ? ? (G \sub a));
485 letin GOGO ≝(refl_eq ? (repr ? (is_finite_enumerable G) O));
487 rewrite < HH in GOGO;
488 rewrite < HH in GOGO:(? ? % ?);
489 rewrite > (op_associative ? G) in GOGO;
490 letin GaGa ≝(H ? ? ? GOGO);
495 apply (semigroup_properties G)
496 | unfold is_left_unit; intro;
497 letin GaxGax ≝(refl_eq ? (G \sub a ·x));
498 clearbody GaxGax; (* demo *)
499 rewrite < GaGa in GaxGax:(? ? % ?);
500 rewrite > (op_associative ? (semigroup_properties G)) in GaxGax;
501 apply (H ? ? ? GaxGax)
502 | unfold is_right_unit; intro;
503 letin GaxGax ≝(refl_eq ? (x·G \sub a));
505 rewrite < GaGa in GaxGax:(? ? % ?);
506 rewrite < (op_associative ? (semigroup_properties G)) in GaxGax;
507 apply (H1 ? ? ? GaxGax)
511 elim (pigeonhole (order ? G) f ? ? ? H2);
512 [ apply (ex_intro ? ? a);
517 cut (G \sub (ι(G \sub O · G \sub x)) = G \sub (ι(G \sub O · G \sub y)));
518 [ rewrite > (repr_index_of ? ? (G \sub O · G \sub x)) in Hcut;
519 rewrite > (repr_index_of ? ? (G \sub O · G \sub y)) in Hcut;
520 generalize in match (H ? ? ? Hcut);
522 generalize in match (eq_f ? ? (index_of ? G) ? ? H6);
524 rewrite > index_of_repr in H7;
525 rewrite > index_of_repr in H7;