A formal analysis of complexity and systemic risk in financial networks with derivatives