# Coercion

Coercion is a fundamental concept in Magma. Given a structures $A$ and $B$, there is often a natural mathematical mapping from $A$ to $B$ (e.g., embedding, projection), which allows one to transfer elements of $A$ to corresponding elements of $B$. This is known as coercion. Natural and obvious coercions are supported in Magma as much as possible; see the relevant chapters for the coercions possible between various structures.

## `S ! x: Str, Elt -> Elt`

Given a structure $S$ and an object $x$, attempt to coerce $x$ into $S$ and return the result if successful. If the attempt fails, an error ensues.

## `IsCoercible(S, x): Str, Elt -> Bool, Elt`

Given a structure $S$ and an object $x$, attempt to coerce $x$ into $S$; if successful, return `true` and the result of the coercion, otherwise return `false`.
