Patterns and rules

Some examples:

Tests and Conditions:

Leaves in the beginning of a pattern rather match fewer leaves:

Optional arguments using Optional:

Options using OptionsPattern and OptionValue:

The attributes Flat, Orderless, and OneIdentity affect pattern matching.