Homology and fibrations I: Coalgebras, cotensor product and its derived functors.