Crafter.learn_pattern validates fold formats

If the format isn't an already-known pattern or a valid bitstring
format, it can't be folded correctly.

Closes Issue #3