The monoid of functions

Let A be some Set. If we assume that eta-equivalent functions on A are equal, we can prove the associativity of function composition, and build a new monoid:

Section fun.
 Variable A:Set.
 Hypothesis eta_A:(f,g:A->A)((x:A)(f x)=(g x))->f=g.

 Local comp:=[f,g:A->A][x:A](g (f x)).
 Local Id := [a:A]a.

 Lemma funmono: (monoid A->A).
  Proof.
  Realizer (mkmonoid A->A Id  comp).
  Program; Unfold comp;Intros;Apply eta_A;Auto.
 Qed.
End fun.

Remarks

Please notice that in the file obtained by extraction and conversion into Caml_light, funono is a polymorphic function:
#funmono;;
- : ('a -> 'a) monoid = mkmonoid (<fun>, <fun>)

This monoid is used in our example (with 'a = string list):

let it= addchains (dicho log2_impl) 
                  87 
                  funmono 
                  (function l->"boum"::l) ;;
it : string list -> string list = 

it [];;
- : string list =
 ["boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum";
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum";
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; "boum"; 
  "boum"; "boum"; "boum"]