2025-11-27

This section is empty…

paislee digit sum proof

OKAY sorry finally here. two main options come to mind for your proof, but i'm not the most experienced agdacel so maybe there's something better. as far as i know, these would be the most faithful to your original proof. this all applies to agda, lean, and most likely coq.

represent dkbk+⋯+d0 as a list

this is the most faithful to your original proof but i don't think it's the most idiomatic. that said, it might be pretty elegant, so...........

  • define a custom data type that represents the sum dkbk+dk−1bk−1⋯+d0.

    • this would structurally resemble a linked list of digits, but you could also ensure that it's the "correct" form, accurately encoding the base-b digits; i.e., that each term dkbk is the greatest bk factor that's lesser than n.

  • you would need to define an equivalence (isomorphism) between the natural numbers and your custom list type.

  • the digital sum function would be exactly as you defined it: it would traverse the custom list-like type, and sum the digits. very cool feature.

  • for the final proof, you would do induction on your custom type, i.e. prove it for the empty sum, then for your type's equivalent to cons.

    • start by applying your previously-defined equivalence to get n=dkbk+⋯d0.

    • pretty much a one-to-one translation from there!!

induction on n

this is probably idiomatic but less interesting. instead of working with a list of terms as in dkbk+dk−1bk−1⋯+d0, you would

  • define functions that "pull out" individual terms from n.

    • e.g. a function take-leading-digit that, given a natural number, returns a triple (dk,bk,r) such that dkbk+r=n and dk is the first digit of n.

    • these functions will be used in the induction step in the final proof and optionally to define the digit sum function.

  • most complicated part will probably be defining the digit sum function. it'll require well-founded induction and some remainder/quotient/modulo theorems.

  • final proof will do induction on n instead of on the list of terms.