Absolute beginner to Coq and proof assistants here, and this silly question has been bothering me for some time now.
I was wondering why the simpl
tactic, for example (reduction-based tactics, in general), is “valid” - in the same sense in which induction
is valid because of the structural induction that holds on inductively defined types.
So, why exactly is it okay to replace a term in a goal with another term that it is convertible to? I understand that such terms are called definitionally equal to one another, but why does this imply that they can be interchanged in any scenario?
For example, 2 + 2
and 4
are convertible terms, and I understand why using a reduction tactic on 2 + 2
for a goal that involves equality is valid – because if we can prove that an expression with 4
is equal to another expression, then so is the initial expression with 2 + 2
instead of 4
- because of the convertibility of these expressions.
But, what justifies replacing 2 + 2
by 4
in a goal, in general (not just involving equality)? One sense in which 2 + 2
is not “equivalent” to 4
is that one is a function application expression and another is simply a value of type nat
, but I don’t think such syntactic differences are expressible in Coq. Nonetheless, how do I convince myself that they are indeed equivalent in all scenarios?
My apologies if I haven’t framed the question well enough. My thoughts are all over the place. Any help would be appreciated, thank you!
PS: I posted this question on Proof Assistants StackExchange too, but I don’t understand the responses that I’ve received there so far.