chore: simplify Array.isEqvAux

This commit is contained in:
Leonardo de Moura 2022-02-10 16:51:47 -08:00
parent 6b6c44c559
commit 1d5da63482

View file

@ -514,11 +514,7 @@ namespace Array
@[specialize]
def isEqvAux (a b : Array α) (hsz : a.size = b.size) (p : αα → Bool) (i : Nat) : Bool :=
if h : i < a.size then
let aidx : Fin a.size := ⟨i, h⟩;
let bidx : Fin b.size := ⟨i, hsz ▸ h⟩;
match p (a.get aidx) (b.get bidx) with
| true => isEqvAux a b hsz p (i+1)
| false => false
p (a.get ⟨i, h⟩) (b.get ⟨i, hsz ▸ h⟩) && isEqvAux a b hsz p (i+1)
else
true
termination_by _ => a.size - i