Closed
Description
While trying to eliminate uses of inspect
(issue agda/agda-stdlib#1580) in Data.Fin.Properties
combine-surjective : ∀ {m} {n} (i : Fin (m ℕ.* n)) → ∃₂ λ j k → combine {m} {n} j k ≡ i
combine-surjective {m = m} {n = n} i with remQuot {m} n i in eq
... | p = {!begin
combine j k ≡˘⟨ uncurry (cong₂ combine) (,-injective eq) ⟩
uncurry combine (remQuot {m} n i) ≡⟨ combine-remQuot {m} n i ⟩
i ∎!}
where open ≡-Reasoning
causes the following error: "Panic: uncaught pattern violation"
(inessential variations on this theme seem also to be a problem)
Not clear what is responsible for raising the bug.
But the original
combine-surjective : ∀ (i : Fin (m ℕ.* n)) → ∃₂ λ j k → combine j k ≡ i
combine-surjective {m} {n} i with remQuot {m} n i | P.inspect (remQuot {m} n) i
... | j , k | P.[ eq ] = j , k , (begin
combine j k ≡˘⟨ uncurry (cong₂ combine) (,-injective eq) ⟩
uncurry combine (remQuot {m} n i) ≡⟨ combine-remQuot {m} n i ⟩
i ∎)
where open ≡-Reasoning
seems to be OK?