From Semantic Versioning:
Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards compatible bug fixes are introduced. A bug fix is defined as an internal change that fixes incorrect behavior.
Suppose I have a program at version 0.1.12. If I had to increment Y (0.Y.12), should I return Z (0.2.Z) to 0 (becoming 0.2.0) or just keep it unaltered (becoming 0.2.12)?
Yes. All numbers should be reset when their parent version is changed.
The specification (http://semver.org/) states: