(* 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                                                     *)
(** * direct_sum.v *)
Local Unset Standard Proposition Elimination Names.
Set Implicit Arguments.
Unset Strict Implicit.
Require Export algebraic_span_facts.
Section MAIN.
Variable F : field.
Variable V : vectorspace F.
(** - A vectorspace being a direct sum is only defined as a predicate; the sum_set however is defined as a construction: %\tocdef{sum\_set}% *)
Definition sum_set (S1 S2 : part_set V) : part_set V.
intros.
simpl in |- *.
apply
Build_Predicate
with
(fun x : V =>
exists s1 : S1,
(exists s2 : S2, x =' subtype_elt s1 +' subtype_elt s2 in _)).
red in |- *.
intros.
inversion_clear H.
inversion_clear H1.
exists x0.
exists x1.
apply Trans with x; auto with algebra.
Defined.

(* Specifications: *)
Lemma subspace_sum_set :
forall W1 W2 : part_set V,
is_subspace W1 -> is_subspace W2 -> is_subspace (sum_set W1 W2).