A permutation of the vertex set Fin n, stored as the array of images:
vertex i maps to vec[i]. The two proof fields record that the array is
duplicate-free and contains every vertex; both are decidable, and carrying
both makes the inverse constructible directly.
The image array: vertex
imaps tovec[i].The image array has no duplicate entries.
Every vertex occurs in the image array.
Instances For
Equations
- Hex.Perm.instCoeFunForallFin = { coe := Hex.Perm.get }
Build a permutation from an injective-and-surjective entry function.
Equations
- Hex.Perm.ofFn f hinj hsurj = { vec := Hex.Vector.ofFn' f, nodup := ⋯, complete := ⋯ }
Instances For
Checked construction: accepts exactly the duplicate-free complete vertex arrays.
Equations
Instances For
The identity permutation.
Equations
- Hex.Perm.id n = Hex.Perm.ofFn (fun (i : Fin n) => i) ⋯ ⋯
Instances For
The image array of the inverse, built by one scatter pass over the
vertices: each i is written at position p.get i. Every position is
written, because p is surjective.
Equations
- p.invVec = List.foldl p.scatterStep (Hex.Vector.ofFn' fun (i : Fin n) => i) (List.finRange n)
Instances For
Check a vertex array in linear time: scatter a candidate inverse, then check both inverse identities. The checks also reject repeated entries; no pairwise membership scan is needed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The linear checker accepts exactly the original checked constructor's inputs and returns the same proof-carrying permutation.
Checked permutation construction from raw entries, for literal data emitted by tactics: entries must be in range, duplicate-free, and complete.