When might 'attach' be a better fit than 'fix'?
The words attach and fix can be used in similar contexts, but attach suggests a connecting or uniting by a bond, link, or tie in order to keep things together.
// attach the W-2 form here
When is 'affix' a more appropriate choice than 'fix'?
Although the words affix and fix have much in common, affix implies an imposing of one thing on another by gluing, impressing, or nailing.
// affix your address label here
When can 'fasten' be used instead of 'fix'?
While in some cases nearly identical to fix, fasten implies an action such as tying, buttoning, nailing, locking, or otherwise securing.
// fasten the reins to a post
The term "to fix" is a synonym for "to repair". Your example "to fix [an] error in [a] theorem proof" would be completely understood, though it is slightly more common to hear "to correct an error in a theorem proof".
The word "fix" does not imply that something is unchanged.
EDIT: As others have rightly pointed out, there is a sense of "to fix" that means "to make constant", as in
I fixed the number of participants in the study at 100
You are correct, there can be ambiguity in the meanings.
fix
is usually used to mean correct, whereas
fixed
is used to mean immobilize.
In usage, usually additional context is usually supplied to avoid confusion, also an understanding of possible scenarios is necessary to properly understand some sentences, the entire sentence has to be read before the meaning is understood. For example,
Fix that chair down
anchor the chair so it doesn't moveThis will fix all our problems.
this will solve all our problemsI fixed the bug in the program
I corrected the bug in the programThe chair is fixed to the ground
the chair is set into the ground so it doesn't moveWe fixed the problem by fixing the chair to a tree.
we solved the problem by tying the chair to a tree