Section sum_bounded_permutation.
Let sigma_sum_split i n f : i < n -> ∑ (S n) f = f i + f n + ∑ i f + ∑ (n-S i) (fun j => f (S i+j)).
Let sum_permutation_1 n i j g f :
i < j < n
-> g i = j
-> g j = i
-> (forall k, k <> i -> k <> j -> k < n -> g k = k)
-> ∑ n f = ∑ n (fun i => f (g i)).
Inductive bounded_permut n (i j : nat) g : Prop :=
| in_nat_perm :
i < n -> j < n -> g i = j -> g j = i
-> (forall k, k <> i -> k <> j -> k < n -> g k = k)
-> bounded_permut n i j g.
Hint Resolve swap_spec_i swap_spec_j swap_spec : core.
Fact swap_bounded_permut n i j : i < n -> j < n -> bounded_permut n i j (swap i j).
Let flat n f i := if le_lt_dec n i then n else f i.
Let flat_left n f i : i < n -> flat n f i = f i.
Fact composed_permutation_S n g : g n = n -> composed_permutation n g -> composed_permutation (S n) g.

Theorem sum_injective n f g : bounded_injective n g -> ∑ n f = ∑ n (fun i => f (g i)).