Documentation

Batteries.Data.Array.Pairwise

def Array.Pairwise {α : Type u_1} (R : ααProp) (as : Array α) :

Pairwise R as means that all the elements of the array as are R-related to all elements with larger indices.

Pairwise R #[1, 2, 3] ↔ R 1 2 ∧ R 1 3 ∧ R 2 3

For example as.Pairwise (· ≠ ·) asserts that as has no duplicates, as.Pairwise (· < ·) asserts that as is strictly sorted and as.Pairwise (· ≤ ·) asserts that as is weakly sorted.

Equations
Instances For
    theorem Array.pairwise_iff_get {α : Type u_1} {R : ααProp} {as : Array α} :
    Array.Pairwise R as ∀ (i j : Fin as.size), i < jR (as.get i) (as.get j)
    theorem Array.pairwise_iff_getElem {α : Type u_1} {R : ααProp} {as : Array α} :
    Array.Pairwise R as ∀ (i j : Nat) (x : i < as.size) (x_1 : j < as.size), i < jR as[i] as[j]
    instance Array.instDecidablePairwiseOfDecidableRel {α : Type u_1} (R : ααProp) [DecidableRel R] (as : Array α) :
    Equations
    theorem Array.pairwise_empty :
    ∀ {α : Type u_1} {R : ααProp}, Array.Pairwise R #[]
    theorem Array.pairwise_singleton {α : Type u_1} (R : ααProp) (a : α) :
    theorem Array.pairwise_pair :
    ∀ {α : Type u_1} {a b : α} {R : ααProp}, Array.Pairwise R #[a, b] R a b
    theorem Array.pairwise_append {α : Type u_1} {R : ααProp} {as : Array α} {bs : Array α} :
    Array.Pairwise R (as ++ bs) Array.Pairwise R as Array.Pairwise R bs ∀ (x : α), x as∀ (y : α), y bsR x y
    theorem Array.pairwise_push {α : Type u_1} {a : α} {R : ααProp} {as : Array α} :
    Array.Pairwise R (as.push a) Array.Pairwise R as ∀ (x : α), x asR x a
    theorem Array.pairwise_extract {α : Type u_1} {R : ααProp} {as : Array α} (h : Array.Pairwise R as) (start : Nat) (stop : Nat) :
    Array.Pairwise R (as.extract start stop)