Why is the distinction between replacement and substitution important? I'm reading Exner/Rosskopf's: Logic in Elementary Mathematics.
They argue that there is replacement which seems to be a mapping from the set of variables to the set of formulas. As an example:
$$A\vee¬A\tag*{$A\mapsto(P\to Q) $}$$
$$[P\to Q]\vee¬[P\to Q]$$
As for substitution, it seems to be a mapping from the set of atomic formulas to the set of formulas, for example:
$$¬(PQ) \leftrightarrow ¬P\vee¬Q\tag*{$P\mapsto ¬P \\Q\mapsto¬Q$}$$
$$¬(¬P¬Q) \leftrightarrow ¬¬P\vee¬¬Q$$
And in previous exercises, it is seen that: $¬¬A=A.$ But we can't use replacement due to its definition, but we can use substitution and deduce that:
$$¬(¬P¬Q) \leftrightarrow P\vee Q$$
But why is this distinction important? The atomic formulas also appear as formulas and hence, we could have only the principle of substitution. So why is replacement important?
 A: In general, it is not so important: more recent treatments of mathematical logic do not need it.
See §2.1.: the letters $P, Q, R$ are used as placeholders for complete statements, i.e. they are propositional variables.
In §2.10, replacement is defined as the operation that produce from a formula $\mathcal F$ a new formula $\mathcal G$ replacing in $\mathcal F$ every occurrence of a placeholder $A$ with a formula $\mathcal A$.
Your first example with $A \lor \lnot A$ is correct.
We have to consider the comment : every formula derived by replacement from a valid formula (i.e. a tautology) is valid.
In §2.11 we have substitution: in this case "partial" replacement of sub-formulae is allowed, i.e. zero or more (some but not necessarily all) occurrences of a sub-formula $\mathcal A$ with an equivalent formula $\mathcal B$ into a formula $\mathcal U$ to get a new formula $\mathcal U^*$ wich is equivalent to the original one.

The issue is to have a rule of replacement that allows for the lack of a modern concept of schema.
If we want to express the "generality" of e.g. excluded middle, current presentations use schematic letters to formulate in the meta-theory the principle:

$\varphi \lor \lnot \varphi$.

We use it to "generate" all the needed instances of the law "replacing" the schematic letters with formulae of the calculus: $P \lor \lnot P, (P \to Q) \lor \lnot (P \to Q), \ldots$
If, as in the text, we operate at the "calculus level", all the above are different formulae. Thus the only way to express the "generality" of logical laws is to introduce a rule of replacement that allows us to (potentially) produce all the instances from a "basic" one.

You can compare it with the more terse (and rigorous) treatment by :


*

*Alonzo Church, Introduction to Mathematical Logic, Princeton (1956), page 69-on:



The rules of inference are the two following:

*100. From $[A \supset B]$ and $A$ to infer $B$    (Rule of modus ponens.)
*101. From $A$, if $b$ is a variable [ a propositional letter: $p,q,r,\ldots$], to infer $S^b_B A$ [ where $S^b_B A$ is the formula which results by substitution of $B$ for each occurrence of $b$ throughout $A$]  (Rule of substitution.) 


