-
Notifications
You must be signed in to change notification settings - Fork 380
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
feat(Mathlib/Computability/Ackermann): Ackermann function is computable #22457
base: master
Are you sure you want to change the base?
Conversation
PR summary b73698b1d3
|
File | Base Count | Head Count | Change |
---|---|---|---|
Mathlib.Computability.Ackermann | 710 | 716 | +6 (+0.85%) |
Import changes for all files
Files | Import difference |
---|---|
Mathlib.Computability.Ackermann |
6 |
Declarations diff
+ _root_.computable₂_ack
+ eval_pappAck
+ eval_pappAck_step_succ
+ eval_pappAck_step_zero
+ pappAck
+ pappAck_prim
+ pappAck_step_prim
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>
The doc-module for script/declarations_diff.sh
contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relative
value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolute
value is therelative
value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
16438ae
to
04e9308
Compare
Awesome! I'm not very familiar with the computability API, but I'll try to review this anyways. |
04e9308
to
b73698b
Compare
|
||
/-- The code for the partial applied Ackermann function. | ||
This is used to prove that the Ackermann function is computable. -/ | ||
def pappAck : ℕ → Code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes do make the code look nicer, though that's not quite what I meant. I was expecting something like
theorem primrec_ack_apply (n : ℕ) : Primrec (ack n) := sorry
This should then (hopefully) give you a simple proof of computability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question!
Indeed, we can get a function of ℕ → Code
from the primrec_ack_apply
lemma by using choose
tactic, but there are no warranty that the function is computable, this fact is used to the proof.
So, we should give an explicit code function which is computable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, there are uncountable noncomputable many code functions which evaluated to ack n
.
@vihdzp If the review is done, please approve. |
step (c : Code) : Code := | ||
.curry (.prec (.comp c (.const 1)) (.comp c (.comp .right .right))) 0 | ||
|
||
lemma pappAck_step_prim : Primrec pappAck.step := by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is prim
a standard abbreviation for Primrec
in these files? I would've expected a name primrec_pappAck_step
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the consistency with lemmas like Code.prec_prim
.
(pappAck.step c).eval (n + 1) = ((pappAck.step c).eval n).bind c.eval := by | ||
simp [pappAck.step, Code.eval] | ||
|
||
lemma pappAck_prim : Primrec pappAck := by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also be used to prove the primrec_ack_apply
theorem I mentioned earlier, right? Can you add that too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lemma can prove Computable (ack n)
but not Primrec (ack n)
.
This is clearly weaker than Computable₂ ack
so it's not worth to prove.
It had been proved that Ackermann function is not primitive recursive, but not been proved that it's computable.
I proved that.