# Local Invariants

These commands calculate the standard invariants that characterize a quadratic form over the rationals. Definitions of the invariants may be found in Conway-Sloane [[J.H. Conway, 1998](../../references.md#cite-conwaysloane)], Chapter 15, Section 5.1.

## `pSignature(f, p): RngMPolElt, RngIntElt -> RngIntElt`

## `pSignature(M, p): Mtrx, RngIntElt -> RngIntElt`

## `pSignature(L, p): Lat, RngIntElt -> RngIntElt`

The $p$-signature of the specified quadratic form over the rationals, where $p$ is a prime number or $-1$ (designating the real place).

For odd primes $p$, this is defined by diagonalizing the form, and adding $p$-parts of these entries to 4 times the number of anti-squares (mod $p$) amongst these entries. The term “anti-square” modulo $p$ denotes something that has: odd valuation at $p$; and the prime-to-$p$ part, called $u$, has Kronecker symbol $({u\over p})=-1$.

At $p=2$ it is the sum of the odd parts of the diagonalized entries plus 4 times the number of anti-squares. In either case, the final answer is really only defined modulo 8 (this is so that $p$-signatures are invariant under rational equivalence).

At the real place, it is the difference between the number of positive and negative eigenvalues (the terminology here can be murky).

## `Oddity(f): RngMPolElt -> RngIntElt`

## `Oddity(L): Lat -> RngIntElt`

## `Oddity(M): Mtrx -> RngIntElt`

This returns the $2$-signature of the given quadratic form over the rationals.

## `pExcess(f, p): RngMPolElt, RngIntElt -> RngIntElt`

## `pExcess(M, p): Mtrx, RngIntElt -> RngIntElt`

## `pExcess(L, p): Lat, RngIntElt -> RngIntElt`

The $p$-excess of the specified quadratic form over the rationals, where $p$ is a prime number or $-1$ (designating the real place). The $p$-excess is the difference between the $p$-signature and dimension for odd primes (including $-1$), and is the negation of this for $p=2$. The sum of $p$-excesses over all primes should be 0 modulo 8.

## `WittInvariant(f, p): RngMPolElt, RngIntElt -> RngIntElt`

## `WittInvariant(M, p): AlgMatElt, RngIntElt -> RngIntElt`

Calculates the Witt invariant over ${\mathbb{Q}}_p$ of the given quadratic form. Again the form must be defined over either the rationals or the integers. The result is returned as something in the set $\{-1,+1\}$. This is the class in the Brauer group of the Clifford algebra for even dimension, of the even Clifford algebra for odd dimension, see §3 of Chapter V of Lam [[Lam, 2005](../../references.md#cite-lam05)].

## `WittInvariant(L, p): Lat, RngIntElt -> RngIntElt`

## `WittInvariant(L, P): Lat, RngInt -> RngIntElt`

## `WittInvariant(L, P): LatNF, RngOrdIdl -> RngIntElt`

```magma
AmbientSpace: BoolElt                    Default: false
```

The Witt invariant of the quadratic form at $p$ (or $P$). If `AmbientSpace` is set to `true`, returns the Witt invariant of the ambient quadratic space.

## `HasseInvariant(f, p): RngMPolElt, RngIntElt -> RngIntElt`

## `HasseInvariant(M, p): AlgMatElt, RngIntElt -> RngIntElt`

## `HasseMinkowskiInvariant(f, p): RngMPolElt, RngIntElt -> RngIntElt`

## `HasseMinkowskiInvariant(M, p): AlgMatElt, RngIntElt -> RngIntElt`

Calculates the Hasse (or Hasse-Minkowski) invariant over ${\mathbb{Q}}_p$ of the given quadratic form. Again the form must be defined over either the rationals or the integers. The result is returned as something in the set $\{-1,+1\}$. One definition of this invariant is to diagonalize the form and then take the product (in our multiplicative notation) of the Hilbert symbols of the ${n\choose 2}$ pairs of distinct nonzero diagonal entries, as in §5.3 of Chapter 15 of Conway-Sloane [[J.H. Conway, 1998](../../references.md#cite-conwaysloane)], which is what is implemented here. Another method would be to use a comparison of $p$-excesses with the standard form (also in Conway-Sloane). Starting with a $p$-adic input could lead to precision problems at the diagonalization step, and so is not allowed. Can also be called via `HasseMinkowskiInvariant`.

## `HasseInvariant(L, p): Lat, RngIntElt -> RngIntElt`

## `HasseMinkowskiInvariant(L, p): Lat, RngIntElt -> RngIntElt`

## `HasseInvariant(L, P): Lat, RngInt -> RngIntElt`

## `HasseInvariant(L, P): LatNF, RngOrdIdl -> RngIntElt`

## `HasseMinkowskiInvariant(L, P): Lat, RngInt -> RngIntElt`

```magma
AmbientSpace: BoolElt                    Default: false
```

The Hasse invariant of the quadratic form at $p$ (or at $P$). If `AmbientSpace` is set to `true`, returns the Hasse invariant of the ambient quadratic space.

## `WittInvariants(f): RngMPolElt -> SeqEnum`

## `WittInvariants(M): AlgMatElt -> SeqEnum`

## `WittInvariants(L): Lat -> SeqEnum`

## `HasseInvariants(f): RngMPolElt -> SeqEnum`

## `HasseInvariants(M): AlgMatElt -> SeqEnum`

## `HasseInvariants(L): Lat -> SeqEnum`

## `HasseMinkowskiInvariants(f): RngMPolElt -> SeqEnum`

## `HasseMinkowskiInvariants(M): AlgMatElt -> SeqEnum`

## `HasseMinkowskiInvariants(L): Lat -> SeqEnum`

```magma
Minimize: BoolElt                    Default: false
AA      : BoolElt                    Default: false
```

Compute `WittInvariant(f,p)` or `HasseInvariant(f,p)`, repsectively, for all bad primes $p$, and return the result of a sequence of tuples, each entry given by $\langle p,W_p(f)\rangle$. The set of bad primes includes the real place, the prime $p=2$, and all primes that divide either the numerator or the denominator of the determinant or symmetric matrix associated to $f$. If `Minimize` is set, the primes greater than 2 must have odd valuation in the determinant to appear. If `AA` is set, the result is return as an associative array. Can also be called via `HasseMinkowskiInvariants`.

## `QuadraticFormInvariants(f): RngMPolElt -> FldElt, SetEnum, SeqEnum[RngIntElt]`

## `QuadraticFormInvariants(M): AlgMatElt -> FldElt, SetEnum, SeqEnum[RngIntElt]`

## `QuadraticFormInvariants(L): LatNF -> FldElt, SetEnum, SeqEnum[RngIntElt]`

```magma
Minimize: BoolElt                    Default: false
AA      : BoolElt                    Default: false
```

The determinant of the diagonalization, the set of Hasse-Minkowski invariants, and the number of negative eigenvalues (in each real place) of the quadratic form M. If `AA` is set, the Hasse-Minkowski invariants are returned as an associative array. If `Minimize` is set, the set of Hasse-Minkowski invariants is minimized, returning only the prime ideals for which the Hasse-Minkowski invariant is $-1$.
