Skip to content

Add prove of injectivity to Data.Fin.combine #1679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 24, 2022

Conversation

uzytkownik
Copy link
Contributor

No description provided.

Copy link
Contributor

@MatthewDaggitt MatthewDaggitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great PR! I've added a few comments.

where open ≡-Reasoning

combine-surjective : ∀ {n k} (x : Fin (n ℕ.* k)) → Σ[ y ∈ Fin n ] Σ[ z ∈ Fin k ] combine y z ≡ x
combine-surjective {n} {k} x with remQuot {n} k x | P.inspect (remQuot {n} k) x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the new with ... <- ... idiom instead of inspect? (see #1630 for an attempt to deprecate it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combine-surjective :  {n k} (x : Fin (n ℕ.* k))  Σ[ y ∈ Fin n ] Σ[ z ∈ Fin k ] combine y z ≡ x
combine-surjective {n} {k} x with remQuot {n} k x in eq
... | y , z = y , z , (begin
  combine y z                       ≡˘⟨ uncurry (cong₂ combine) (,-injective eq) ⟩
  uncurry combine (remQuot {n} k x) ≡⟨ combine-remQuot {n} k x ⟩
  x ∎)
  where open ≡-Reasoning

causes

Panic: uncaught pattern violation

What agda version I need to have?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eek, that's scary. Agda 2.6.2 should be fine. If you're on that and the issue is still occuring, then I would open an issue on the main Agda repo with a cut-down example, and then I guess you'll need to switch back to inspect 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have 2.6.2.1. I will create an issue.

@MatthewDaggitt
Copy link
Contributor

Thanks again for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants