-
Notifications
You must be signed in to change notification settings - Fork 246
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
lib2.0 : ℕᵇ
(binary) can be pure unlike ℕ
.
#2362
Comments
On 2024-04-14 22:29, G. Allais wrote:
> Because Nat._+_ and Nat._*_ are implemented as built-in, not in
> Agda.
That is incorrect: these definitions are implemented in Agda, and
their proofs are
using the Agda definition. It's only during compilation (when the
proofs are getting
erased anyway) that these definitions are substituted for their more
efficient built-ins.
Something is wrong here.
If it was in Agda, the module Data.Nat.Base would contain, for example,
_+_ : Op₂ ℕ -- algorithm "Plus"
0 + n = n
suc m + n = suc (m + n)
Instead it contains
```
open import Agda.Builtin.Nat public using (_+_ ...) ...
```
This actually means
"believe that this built-in-+ returns the same result as the Plus
program in Agda".
This is postulation of that Plus is equivalent to this invisible
built-in-+.
`Binary._+_` is different, its Agda code is in the library written in
Agda,
nothing is postulated.
Therefore Binary needs to have possibly fewer items taken from Nat.
|
You can click through to |
Right - |
I deleted my original message because, even though So I think this is a somewhat legitimate complaint: this additional magic is used during |
On 2024-04-15 00:11, Nathan van Doorn wrote:
You can click through to Agda.Buildin.Nat and see exactly the
definition you expected here [1]
I look into `lib-2.0` and do not find the folder Agda in
`~/agda/stLib/2.0/src/`.
|
That's because it's bundled with the compiler, not the standard library. The sources for these modules can be found in the repository for the |
(Sorry, probably this needs to be in Zulip) I do not say that Agda.BuiltIn is not needed. Suppose that
Then, applying Agda interpreter to But Am I missing something? |
I don't think you're missing anything. This exact issue is why, with Bill Farmer and Michael Kohlhasse, we invented 'Realms'. Unfortunately these aren't implemented in Agda (just MMT). |
I recall it and return to pointing out that:
in lib-2.0 the part of Data.Nat.Binary.Properties
has several proofs that cannot be considered as reliable.
Their badness is in that the proofs
and some other,
rely on similar proofs for
ℕ
(unary representation) by using the isomoprphism toℕ
.But these proofs for
ℕ
are not implemented as the first class, are not reliable. BecauseNat._+_
andNat._*_
are implemented as built-in, not in Agda. So that these proofs forℕ
are not about the real algorithms for computing these operations.And
ℕᵇ
is different. Its arithmetic is implemented totally in Agda.The corresponding proofs can also be implemented totally in Agda.
In this sense,
ℕᵇ
is a better Agda model for natural numbers thanℕ
.So that it is better to untie
ℕᵇ
fromℕ
, because using proofs forℕ
spoils the purity ofℕᵇ
.The text was updated successfully, but these errors were encountered: