implementing inductive match