Fix termination and performance issues with DecEq#7840
Merged
Conversation
…ents' into ana/remove-terminating-deceq
ana-pantilie
marked this pull request as ready for review
July 15, 2026 08:56
basetunnel
reviewed
Jul 15, 2026
| ... | no a₁≠a₂ | _ = no λ { refl → a₁≠a₂ refl } | ||
| ... | _ | no b₁≠b₂ = no λ { refl → b₁≠b₂ refl } | ||
|
|
||
| decEq-⊢⋆ [] [] = yes refl |
Collaborator
There was a problem hiding this comment.
The unicode character ⋆ seems to be used as a suffix for things that refer plutus types, like _⊢⋆_ and Ctx⋆ (probably referencing base kind). Perhaps we could have a different convention for a suffix for these map-like functions that appease the termination checker. I"ve used * in some of the translation relation machinery, but I think historically it was more often List, e.g. dischargeList.
basetunnel
reviewed
Jul 15, 2026
| decEq-⊢ : ∀{n} → DecidableEquality (n ⊢) | ||
| decEq-⊢ : {n : ℕ} → DecidableEquality (n ⊢) | ||
|
|
||
| decEq-⊢⋆ : {n : ℕ} → DecidableEquality (List (n ⊢)) -- {n : ℕ} → (Ms : List (n ⊢)) → (Ns : List (n ⊢)) → Dec (Ms ≡ Ns) |
Collaborator
There was a problem hiding this comment.
Is this comment for documentation purposes or a left-over from writing out DecidableEquality?
basetunnel
reviewed
Jul 15, 2026
basetunnel
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs #7832
Needs #7843
Termination fix
Removes the need for the
TERMINATINGpragma in thedecEqdefinitions, Agda can now prove that they terminate.Performance fix
The matching on
reflinsidedecEqtriggered normalization of terms when typechecking, which affected performance significantly, to the point of using more than 128GB of memory for the example @basetunnel and I worked on.The example is an equality proof of the first AST to itself, from
agda-certificates/cardano_constitution_Cardano_Constitution_Validator_Data_Sorted-b48sy0.agda-cert. This was the certificate produced fordefaultConstitutionCodefromcardano-constitution/src/Cardano/Constitution/Validator/Data/Sorted.hs.For this particular example comparing
cons was the most expensive, so avoiding matching onreflin the recursive call todecEq-⟦ t ⟧tag x x₁insidedecEq-TmCondid the trick.