Coalition formation in social environments with logic-based agents