FScaFi : A Core Calculus for Collective Adaptive Systems Programming