# In propositional logic, if a subformula A is equivalent to a formula B, can A be replaced by B in a given formula φ without changing its truth value?

For example,

$$\phi = r \rightarrow (\neg p \rightarrow \neg q)$$

$$A = ( \neg p \rightarrow \neg q)$$

$$B = ( q \rightarrow p)$$

A is equivalent to B. In other words, they have identical truth tables. I also know that if I replace A with B in this specific case the resulting truth table remains the same. I'd like to know if that's the case for any formula and, if so, where can I find the theory or proof of that property, please.

I'm not satisfied, for example, with this article: https://en.wikipedia.org/wiki/Substitution_(logic), because it doesn't speak at all about logical equivalence.

I also am not sure if a substitution theorem for an axiom system apply for this case, because I'm talking about any formula in propositional logic and not only axioms.

Your $$A$$ and $$B$$ are metavariables, so you can make the substitution because here you are working in the metatheory. Also, by the truth table definition of logical equivalence, $$A ⟷ B$$ if and only if $$A$$ and $$B$$ have the same truth value.