---
title: "User-defined Verbose Flags"
canonical: "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/FunctionsProceduresAndPackages/verbose.html"
source: "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/FunctionsProceduresAndPackages/verbose.md"
part: "The Magma Language"
chapter: "Functions, Procedures, and Packages"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "The Magma Language", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/index-magma-language.md"}
  - {"title": "Functions, Procedures, and Packages", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/FunctionsProceduresAndPackages/index-functions-procedures-and-packages.md"}
prev: {"title": "Attributes", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/FunctionsProceduresAndPackages/attribute.md"}
next: {"title": "User-Defined Types", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/FunctionsProceduresAndPackages/type.md"}
intrinsics:
  - {"name": "declare verbose", "signature": "declare verbose F, m;"}
examples:
  - "ex-ca5e5c"
  - "ex-659b09"
  - "ex-280c05"
---

# User-defined Verbose Flags

Verbose flags may be defined by users within packages.

<a id="literal-literal-declare-verbose-declare-verbose-f-m"></a>
## `declare verbose F, m;`

Given a verbose flag name $F$ (without quotes), and a literal integer $m$, create the verbose flag $F$, with the maximal allowable level for the flag set to $m$. This directive may only be used within package files.

## Examples

In this subsection we give examples which illustrate all of the above features.

<a id="example-ex-ca5e5c"></a>
### `Example: System Attributes (ex-ca5e5c)`

We illustrate how the predefined system attributes may be used. Note that the valid arguments for `AssertAttribute` and `HasAttribute` documented elsewhere now also work as system attributes so see the documentation for these functions for details as to the valid system attribute field names.

```magma
> // Create group G.
> G := PSL(3, 2);
> // Check whether order known.
> assigned G`Order;
false
> // Attempt to access order -- error since not assigned.
> G`Order;

>> G`Order;
    ^
Runtime error in `: Attribute 'Order' for this structure
is valid but not assigned
> // Force computation of order by intrinsic Order.
> Order(G);
168
> // Check Order field again.
> assigned G`Order;
true
> G`Order;
168
> G`` "Order"; // String form for field
168
> o := "Order";
> G`` o;
168
> // Create code C and set its minimum weight.
> C := QRCode(GF(2), 31);
> C`MinimumWeight := 7;
> C;
[31, 16, 7] Quadratic Residue code over GF(2)
...
```

<a id="example-ex-659b09"></a>
### `Example: Interactive User Attributes (ex-659b09)`

We illustrate how user attributes may be defined and used in an interactive session. This situation would arise rarely – more commonly, attributes would be used within packages.

```magma
> // Add attribute field MyStuff for matrix groups.
> AddAttribute(GrpMat, "MyStuff");
> // Create group G.
> G := GL(2, 3);
> // Try illegal field.
> G`silly;

>> G`silly;
    ^
Runtime error in `: Invalid attribute 'silly' for this structure
> // Try legal but unassigned field.
> G`MyStuff;

>> G`MyStuff;
    ^
Runtime error in `: Attribute 'MyStuff' for this structure is valid but not
assigned
> // Assign field and notice value.
> G`MyStuff := [1, 2];
> G`MyStuff;
[ 1, 2 ]
```

<a id="example-ex-280c05"></a>
### `Example: Package User Attributes (ex-280c05)`

We illustrate how user attributes may be used in packages. This is the most common usage of such attributes. We first give some (rather naive) Magma code to compute and store a permutation representation of a matrix group. Suppose the following code is stored in the file `permrep.m`.

```magma
declare attributes GrpMat: PermRep, PermRepMap;

intrinsic PermutationRepresentation(G::GrpMat) -> GrpPerm
{A permutation group representation P of G, with homomorphism f: G -> P};
    // Only compute rep if not already stored.
    if not assigned G`PermRep then
        G`PermRepMap, G`PermRep := CosetAction(G, sub<G|>);
    end if;
    return G`PermRep, G`PermRepMap;
end intrinsic;
```

Note that the information stored will be reused in subsequent calls of the intrinsic. Then the package can be attached within a Magma session and the intrinsic `PermutationRepresentation` called like in the following code (assumed to be run in the same directory).

```magma
> Attach("permrep.m");
> G := GL(2, 2);
> P, f := PermutationRepresentation(G);
> P;
Permutation group P acting on a set of cardinality 6
    (1, 2)(3, 5)(4, 6)
    (1, 3)(2, 4)(5, 6)
> f;
Mapping from: GrpMat: G to GrpPerm: P
```

Suppose the following line were also in the package file:

```magma
declare verbose MyAlgorithm, 3;
```

Then there would be a new verbose flag `MyAlgorithm` for use anywhere within Magma, with the maximum 3 for the level.
