Exchange Rule

In logic and type theory, the exchange rule is a Structural Rule that lets you permute elements of the context.

For systems based off of Natural Deduction, exchange rules take the form of

Γ1,x:X,Γ2,y:Y,Γ3e:AΓ1,y:Y,Γ2,x:X,Γ3e:A:subscriptΓ1𝑥𝑋subscriptΓ2𝑦:𝑌subscriptΓ3proves𝑒:𝐴:subscriptΓ1𝑦𝑌subscriptΓ2𝑥:𝑋subscriptΓ3proves𝑒:𝐴\par\frac{\Gamma_{1},x:X,\Gamma_{2},y:Y,\Gamma_{3}\vdash e:A}{\Gamma_{1},y:Y,% \Gamma_{2},x:X,\Gamma_{3}\vdash e:A}\\

For Sequent Calculi, we need to add both Left and Right Rules, ala

Γ1,x:X,Γ2,y:Y,Γ3ΔΓ1,y:Y,Γ2,x:X,Γ3Δ:subscriptΓ1𝑥𝑋subscriptΓ2𝑦:𝑌subscriptΓ3provesΔ:subscriptΓ1𝑦𝑌subscriptΓ2𝑥:𝑋subscriptΓ3provesΔ\displaystyle\frac{\Gamma_{1},x:X,\Gamma_{2},y:Y,\Gamma_{3}\vdash\Delta}{% \Gamma_{1},y:Y,\Gamma_{2},x:X,\Gamma_{3}\vdash\Delta}
ΓΔ1,x:X,Δ2,y:Y,Δ3ΓΔ1,y:Y,Δ2,x:X,Δ3provesΓsubscriptΔ1𝑥:𝑋subscriptΔ2𝑦:𝑌subscriptΔ3provesΓsubscriptΔ1𝑦:𝑌subscriptΔ2𝑥:𝑋subscriptΔ3\displaystyle\frac{\Gamma\vdash\Delta_{1},x:X,\Delta_{2},y:Y,\Delta_{3}}{% \Gamma\vdash\Delta_{1},y:Y,\Delta_{2},x:X,\Delta_{3}}

An equivalent presentation involves adding in Permutations to the calculus of Substitutions, which makes the resulting Category of Contexts a Symmetric Monoidal Category.

Note that exchange is a bit tricky in the presence of Dependent Types, as applying an exchange rule can make things ill-typed.