Writing rules for function tables