(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(** %\subsection*{ support :  algebra\_omissions.v }%*)
(** - In this file I prove some results that do not pertain to linear algebra at all. Instead, they could have been proven solely for the algebra distribution. This is also why I do not use the syntactic sugar as defined in equal_syntax.v and more_syntax.v *)
From Algebra Require Export Group_facts.
Set Implicit Arguments.
Unset Strict Implicit.
intros.
apply Trans with (group_inverse _ (group_inverse _ g)); auto with algebra.
apply GROUP_law_inverse.
apply Trans with (sgroup_law _ (group_inverse _ g') g'); auto with algebra.
Qed.
(* Because of later notation, this should also be known as: *)
Definition min_inj := group_inverse_inj.
(** - Elements of subsets are really pairs of those elements and proofs that they belong to that subset. I prove that two of these pairs are equal (in the subsetoid) iff their first projections are (in the parent setoid) *)
simpl in |- *.
unfold subtype_image_equal in |- *.
auto with algebra.
Qed.
simpl in |- *.
unfold subtype_image_equal in |- *.
auto with algebra.
Qed.
Hint Resolve subtype_elt_comp: algebra.
intros.
red in |- *.
apply subtype_prf.
Qed.
Hint Resolve in_part_subtype_elt: algebra.
(** - The setoid mechanism as defined in the algebra contribution makes for a 'layered' structure when dealing with subsets. Suppose $C\subset B\subset A$. This is translated as [A:Setoid; B:(part_set A); C:(part_set B)]. But obviously also $C\subset A$. Now [inject_subsets] injects a subset of B into the subsets of [A]  %\label{injectsubsets}% *)
Definition inject_subsets :
forall (A : Setoid) (B : part_set A), part_set B -> part_set A.
intros A B C.
apply
(Build_Predicate
(Pred_fun:=fun a : A =>
exists c : C, Equal a (subtype_elt (subtype_elt c)))).
red in |- *.
intros.
destruct H.
generalize dependent x0; intro c; intros.
exists c.
apply Trans with x; auto with algebra.
Defined.

Lemma inject_subsets_comp :
forall (A : Setoid) (B : part_set A) (C C' : part_set B),
Equal C C' -> Equal (inject_subsets C) (inject_subsets C').