How does this simple script use the OP_CHECKSIG opcode? I have this Script P2PKH

&lt;A Signature&gt; &lt;A Public Key&gt; 
OP_DUP OP_HASH160 &lt;A Public Key Hash&gt; OP_EQUALVERIFY OP_CHECKSIG


The bitcoin.org documentation say this


  The entire transaction's outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.


Now I want to understand how the code is running inside the stack and how the OP_CHECKSIG work.

My question comes from the fact, why use another operator (OP_CHECKSIG) if is used the operator OP_EQUALVERIFY to does control ?

But I have another question on OP_DUP, the documentation say this


  Duplicates the top stack item.


Why when the bitcoin run the script need to duplicate the items inside the stack?

to close, exist other documentation on Bitcoin Script language?
Let's run through the program.


The stack starts as &lt;A sig&gt; &lt;A pubkey&gt;.
You run OP_DUP. The stack is now &lt;A sig&gt; &lt;A pubkey&gt; &lt;A pubkey&gt;.
You run OP_HASH160. The stack is now &lt;A sig&gt; &lt;A pubkey&gt; &lt;A pubkeyhash&gt;.
You push (A expected pubkeyhash). The stack is now &lt;A sig&gt; &lt;A pubkey&gt; &lt;A pubkeyhash&gt; &lt;A expected pubkeyhash&gt;.
You run OP_EQUALVERIFY. If the initial public key on the stack does matches the expected one, the execution aborts and the script fails. If it matches, the resulting stack is &lt;A sig&gt; &lt;A pubkey&gt;.
You run OP_CHECKSIG. If the signature matches, the resulting stack is 1, which means success.


Without the OP_DUP, it would be impossible to verify the public key both against the signature and against the expected public key hash.