(****************************************************************************** Finite orbit-stabilizer theorem.  Based on proof from Rahbar Virk's notes from the University of Wisconsin (www.math.wisc.edu/~virk/notes/pdf/orphans/orbit-stabilizer_thm.pdf) Copyright 2008 Robert Kam  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 3 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 Lesser 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, see <http://www.gnu.org/licenses/>. ******************************************************************************)
From Algebra Require Export Group_util.
From Algebra Require Export Fpart2.
From Algebra Require Export Parts3.
From Algebra Require Export Fmap.
From LinAlg Require Export seq_set_facts.
From LinAlg Require Export has_n_elements.
From LinAlg Require Export finite_subsets.
Require Export ClassicalDescription.
Fixpoint nsum (n:Nat) {struct n} : seq n Nat -> Nat :=
match n return (seq n Nat -> Nat) with
|O => fun x:seq 0 Nat => 0
|S m => fun x:seq (S m) Nat => (head x) + (nsum m (Seqtl x)) end.

Lemma nsum_comp:forall (n:Nat) (f f':seq n Nat),
f =' f' in _ -> nsum n f =' nsum n f' in _.