2019-02-15 13:48:48 +01:00
|
|
|
type t =
|
|
|
|
| Pos
|
|
|
|
| Neg
|
|
|
|
|
|
|
|
let of_nperm nperm =
|
|
|
|
if (nperm land 1) = 1 then Neg
|
|
|
|
else Pos
|
|
|
|
|
2019-02-18 15:39:26 +01:00
|
|
|
let to_nperm = function
|
|
|
|
| Pos -> 0
|
|
|
|
| Neg -> 1
|
|
|
|
|
2019-02-18 19:45:41 +01:00
|
|
|
let add t t' =
|
|
|
|
match t, t' with
|
|
|
|
| Pos, Pos
|
|
|
|
| Neg, Neg -> Pos
|
|
|
|
| Pos, Neg
|
|
|
|
| Neg, Pos -> Neg
|
|
|
|
|
|
|
|
let neg = function
|
|
|
|
| Pos -> Neg
|
|
|
|
| Neg -> Pos
|
|
|
|
|
2019-02-15 16:25:47 +01:00
|
|
|
let add_nperm phase = function
|
|
|
|
| 0 -> phase
|
2019-02-18 19:45:41 +01:00
|
|
|
| nperm -> add phase (of_nperm nperm)
|
2019-02-15 16:25:47 +01:00
|
|
|
|
2019-12-03 12:25:31 +01:00
|
|
|
let pp ppf = function
|
2019-02-15 13:48:48 +01:00
|
|
|
| Pos -> Format.fprintf ppf "@[<h>+1@]"
|
|
|
|
| Neg -> Format.fprintf ppf "@[<h>-1@]"
|
|
|
|
|