Definition:Replacement Operation

From ProofWiki
Jump to navigation Jump to search

Definition

The replacement operation on two variables $a$ and $b$ is denoted:

$a \gets b$

and is interpreted as:

the value of variable $a$ is to be replaced by the current value of variable $b$, while leaving the value of variable $b$ the same.


Examples

Exchange Operation as Replacement Operations

Let $x$ and $y$ be variables whose values are to be exchanged.

The exchange operation on $x$ and $y$ can be implemented using replacement operations.

Let $t$ be a third variable which has been established for this purpose.

Then the sequence of replacement operations:

$t \gets x$
$x \gets y$
$y \gets t$

performs the task.


Rearrangement Operation as Replacement Operations

Let $\left({a, b, c, d}\right)$ be an ordered quadruple consisting of four variables whose values are to be rearranged into the order $\left({b, c, d, a}\right)$.

This can be implemented using replacement operations.

Let $t$ be a new variable which has been established for this purpose.

Then the sequence of replacement operations:

$t \gets a$
$a \gets b$
$b \gets c$
$c \gets d$
$d \gets t$

performs the task.


Also known as

The operation of replacement is also known as assignment or substitution.


Also see

Do not confuse with the left operation, which has the same notation but is interpreted in exactly the opposite manner.


Sources