Skip to content

[certifier] Allow checking procedures#7561

Merged
zliu41 merged 1 commit intomasterfrom
zliu41/check
Feb 4, 2026
Merged

[certifier] Allow checking procedures#7561
zliu41 merged 1 commit intomasterfrom
zliu41/check

Conversation

@zliu41
Copy link
Member

@zliu41 zliu41 commented Feb 3, 2026

Allows each pass to choose between a decision procedure, which returns ProofOrCE, or a checking procedure, which returns Proof?.

@zliu41 zliu41 added the No Changelog Required Add this to skip the Changelog Check label Feb 3, 2026
Copy link
Contributor

@ana-pantilie ana-pantilie left a comment

Choose a reason for hiding this comment

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

Why do we want to allow checking procedures? Is this because we're not sure if the translation relation for inline is fully decidable?

@zliu41
Copy link
Member Author

zliu41 commented Feb 3, 2026

This is what the entire email thread with Phil is about. Nothing is undecidable, but a decision procedure for inliner would be way too slow. Even the checking procedure is not that fast. And decision procedures in general can take exponential time, even for a simple pass like forceDelay.

Comment on lines +37 to +40
data CertResult (P : Set 𝓁) : Set (suc 𝓁) where
proof : (p : P) → CertResult P
ce : (¬p : ¬ P) → {X X' : Set} → SimplifierTag → X → X' → CertResult P
abort : {X X' : Set} → SimplifierTag → X → X' → CertResult P
Copy link
Contributor

Choose a reason for hiding this comment

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

Should abort be renamed to unknown? Since this type means: either we have proof of P, a proof of ¬ P, or neither?

Copy link
Member Author

Choose a reason for hiding this comment

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

unknown is not accurate. In general we do know that a proof doesn't exist. We just don't have a negative proof.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general we do know that a proof doesn't exist. We just don't have a negative proof.

That doesn't make sense in Agda's constructivist world. Logically, if we don't have a proof of P nor of ¬ P, then the result is unknown.

Even if we might reason about it outside of Agda (in X case we know that's not the right constructor so we can "abort"), the simple fact that we're not producing the proof means that Agda will never be convinced of that fact. Therefore, we won't have any formal guarantee of completeness.

Copy link
Member Author

Choose a reason for hiding this comment

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

"unknown" is confusing because it has multiple meanings.

It could mean "we really don't know whether or not there is a proof - my checking procedure is really lousy, it may give up prematurely and may not find a proof even if one exists!" which is bad.

It could also mean what you said - "we do know that it will find a proof if one exists, and we can even formally prove it on paper using classic reasoning; we just haven't proved it in Agda." That's much better.

If we use "unknown", I think many people's first instinct would be the former meaning - at least that's the case for me. By the way, for the same reason I think "abort" isn't ideal either, but I can't think of a better word at the moment.

Copy link
Member Author

Choose a reason for hiding this comment

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

As an example: the fastest prime testing algorithm can give yes/no quickly, but cannot quickly construct a negative proof (a factorization). If we use such an algorithm as a checking procedure, and it returns "no", it would be quite misleading to say "it is unknown whether the number is prime or not". We definitely do know that it's not prime, we just don't have a negative proof.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not to mention that in some cases (specifically, in the inliner case) we do have an Agda proof of completeness for the checking procedure.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what to name this! Maybe undecided, or do you think that still suffers from the same possible misinterpretations as unknown? Perhaps we can just document the constructors better: if it's "undecided" (or whatever name we choose) then it's up to the engineer to provide a completeness proof in whatever way they can. Also, maybe @basetunnel or @ramsay-t or Phil have better ideas for naming. In any case, I don't want to block this any further so I'll approve it but I still think it needs some clarification either through naming or through documentation or both.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add some documents separately.

@ana-pantilie
Copy link
Contributor

This is what the entire email thread with Phil is about. Nothing is undecidable, but a decision procedure for inliner would be way too slow. Even the checking procedure is not that fast. And decision procedures in general can take exponential time, even for a simple pass like forceDelay.

We should document this decision (no pun intended). The main takeaway I guess is that we're sacrificing completeness for performance, but that this does not affect soundness in any way.

Copy link
Member Author

@zliu41 zliu41 left a comment

Choose a reason for hiding this comment

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

The main takeaway I guess is that we're sacrificing completeness for performance

That's not true. We don't need to sacrifice completeness for the checking procedure to be much faster. Knowing that a proof can't exist is often computationally easier than constructing an actual negative proof.

Comment on lines +37 to +40
data CertResult (P : Set 𝓁) : Set (suc 𝓁) where
proof : (p : P) → CertResult P
ce : (¬p : ¬ P) → {X X' : Set} → SimplifierTag → X → X' → CertResult P
abort : {X X' : Set} → SimplifierTag → X → X' → CertResult P
Copy link
Member Author

Choose a reason for hiding this comment

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

unknown is not accurate. In general we do know that a proof doesn't exist. We just don't have a negative proof.

@zliu41 zliu41 merged commit b79b799 into master Feb 4, 2026
6 checks passed
@zliu41 zliu41 deleted the zliu41/check branch February 4, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Changelog Required Add this to skip the Changelog Check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants