---
title: "Boolean Predicates"
canonical: "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodesOverFiniteRings/Boolean.html"
source: "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodesOverFiniteRings/Boolean.md"
part: "Coding Theory"
chapter: "Linear Codes over Finite Rings"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Coding Theory", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/index-coding-theory.md"}
  - {"title": "Linear Codes over Finite Rings", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodesOverFiniteRings/index-linear-codes-over-finite-rings.md"}
prev: {"title": "Subcodes", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodesOverFiniteRings/subcode.md"}
next: {"title": "New Codes from Old", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodesOverFiniteRings/operation.md"}
intrinsics:
  - {"name": "in", "signature": "u in C: ModTupRngElt, Code -> BoolElt"}
  - {"name": "notin", "signature": "u notin C: ModTupRngElt, Code -> BoolElt"}
  - {"name": "subset", "signature": "C subset D: Code, Code -> BoolElt"}
  - {"name": "notsubset", "signature": "C notsubset D: Code, Code -> BoolElt"}
  - {"name": "eq", "signature": "C eq D: Code, Code -> BoolElt"}
  - {"name": "ne", "signature": "C ne D: Code, Code -> BoolElt"}
  - {"name": "IsCyclic", "signature": "IsCyclic(C): Code -> BoolElt"}
  - {"name": "IsSelfDual", "signature": "IsSelfDual(C): Code -> BoolElt"}
  - {"name": "IsSelfOrthogonal", "signature": "IsSelfOrthogonal(C): Code -> BoolElt"}
  - {"name": "IsProjective", "signature": "IsProjective(C): Code -> BoolElt"}
  - {"name": "IsZero", "signature": "IsZero(u): ModTupRngElt -> BoolElt"}
examples:
  - "ex-659440"
---

# Boolean Predicates

For the following operators, $C$ and $D$ are codes defined as a subset (or subspace) of the $R$-space $V$.

<a id="operation-op-in-modtuprngelt-code"></a>
## `u in C: ModTupRngElt, Code -> BoolElt`

Return `true` if and only if the vector $u$ of $V$ belongs to the code $C$.

<a id="operation-op-notin-modtuprngelt-code"></a>
## `u notin C: ModTupRngElt, Code -> BoolElt`

Return `true` if and only if the vector $u$ of $V$ does not belong to the code $C$.

<a id="operation-op-subset-code-code"></a>
## `C subset D: Code, Code -> BoolElt`

Return `true` if and only if the code $C$ is a subcode of the code $D$.

<a id="operation-operation-notsubset-code-code-boolelt"></a>
## `C notsubset D: Code, Code -> BoolElt`

Return `true` if and only if the code $C$ is not a subcode of the code $D$.

<a id="operation-op-eq-code-code"></a>
## `C eq D: Code, Code -> BoolElt`

Return `true` if and only if the codes $C$ and $D$ are equal.

<a id="operation-op-ne-code-code"></a>
## `C ne D: Code, Code -> BoolElt`

Return `true` if and only if the codes $C$ and $D$ are not equal.

<a id="function-iscyclic-code"></a>
## `IsCyclic(C): Code -> BoolElt`

Return `true` if and only if the linear code $C$ is a cyclic code.

<a id="function-isselfdual-code"></a>
## `IsSelfDual(C): Code -> BoolElt`

Return `true` if and only if the linear code $C$ is self-dual (or self-orthogonal) (i.e., $C$ equals the dual of $C$).

<a id="function-isselforthogonal-code"></a>
## `IsSelfOrthogonal(C): Code -> BoolElt`

Return `true` if and only if the linear code $C$ is self-orthogonal; that is, return whether $C$ is contained in the dual of $C$.

<a id="function-isprojective-code"></a>
## `IsProjective(C): Code -> BoolElt`

Returns `true` if and only if the (non-quantum) code $C$ is projective.

<a id="function-iszero-modtuprngelt"></a>
## `IsZero(u): ModTupRngElt -> BoolElt`

Return `true` if and only if the codeword $u$ is the zero vector.

<a id="example-ex-659440"></a>
## `Example: Properties of a Code over Z4 (ex-659440)`

We consider an [8, 7] linear code $K_8$ over $Z_4$ and examine some of its properties.

```magma
> Z4 := IntegerRing(4);
> K8 := LinearCode< Z4, 8 |
>     [1,1,1,1,1,1,1,1],
>     [0,2,0,0,0,0,0,2],
>     [0,0,2,0,0,0,0,2],
>     [0,0,0,2,0,0,0,2],
>     [0,0,0,0,2,0,0,2],
>     [0,0,0,0,0,2,0,2],
>     [0,0,0,0,0,0,2,2]>;
> K8;
[8, 7, 2] Linear Code over IntegerRing(4)
Generator matrix:
[1 1 1 1 1 1 1 1]
[0 2 0 0 0 0 0 2]
[0 0 2 0 0 0 0 2]
[0 0 0 2 0 0 0 2]
[0 0 0 0 2 0 0 2]
[0 0 0 0 0 2 0 2]
[0 0 0 0 0 0 2 2]
> IsCyclic(K8);
true
> IsSelfDual(K8);
true
> K8 eq Dual(K8);
true
```
