On Wed, Sep 14, 2016 at 07:29:19AM -0400, Norman Megill wrote:
> For others who want to try this,
system-invariant.mm seems to be the
> master that reads in the various included files including
set.mm.
Sorry for not explaining it better in my first mail, I was a bit
exhausted from a city council meeting.
> I read it in metamath.exe, which verifies the proof fine (with
> warnings for some unproved theorems);
... just for the record: Those unproved theorems are not used in
lem-function-exchange_mail but are open theorems for other
C functions.
> The big proof lem-function-exchange_mail chokes MM-PA, which hasn't
> completed after several minutes. It works with an uncompressed
> proof - do you know how many steps it would have? Does your Igor
> tool work directly with compressed proofs?
It builds a proof graph in memory and unifies common subgoals. So
it essentially works on compressed proofs, but not on the concrete
compressed representation.
> If this is an encoding of framebuffer.c (2KB), then the 2MB proof
> would represent a De Bruijn factor of 10000.
Yes, it is the proof of the framebuffer.c function exchange_mail.
Unfortunately, it is not yet an encoding of it, because it also
needs lem-function-exchange_mail.igor to come into existence.
> Perhaps you can give an overview of what this is doing, and how you
> know that your Metamath theorem statement accurately reflects what
> the C function is supposed to do.
The function in question communicates with the Raspberry Pi video
hardware and exchanges one message (called "mail" in the Pi
documentation).
As I whish to avoid axiomatizing all the specific hardware of the Pi,
the theorem does not talk about the concrete purpose of the function,
only about facts between the system state before (`x`), while (`y`) and
after (`z`) the function has been run:
* z e. kernel-code-constant, i.e. all the bytes which comprise
the compiled code are as they were initially
* ( z reg ; 1 3 ) = ( x reg ; 1 3 ), i.e. the stack pointer is
as before the function ran
* ( z reg ; 1 5 ) = ( ( x reg ; 1 5 ) + 4 ), i.e. the instruction
pointer is 4 bytes after the position it was when the CPU executed
the blx instruction which moved control into the function; which is
to say the function returned to where it was supposed to
* on all paths, such a `z` can be reached in less than
`; ; ; ; ; 5 0 0 0 0 0` `step`s, i.e. ARM instruction executions
(from the //! runtime comment in framebuffer.c)
* given any `ph` (with free `x`), and any `ps` (with free `y`) such that
`A. y ( A. a e. cpu-mem ( a >_ ( x reg ; 1 3 ) -> ( y mem a ) = ( x mem a ) ) -> ( ph -> ps ) )`
i.e. given that the memory above the initial stack pointer is still
unchanged relative to `x` then `ps` follows from `ph`
then
`ps` in all intermediate states (`y`) during the path from `x` to `z`
(including `x` and `z`)
This is essentially describing all the things the function will not
do (from //! independence in framebuffer.c) and allows me to call
the function from different context and carry through this call any
arbitrary invariants needed in said contexts (as long as the invariant
condition is enough to keep the invariant true, of course)
I don't "know" that this theorem is a correct and sufficient description
of what the C function does. But ultimately I'd like to show besides
other things:
`|- A. p e. ( path ` step ) ( ( p ` 0 ) = 0 -> A. i e. NN0 ( p ` i ) e. kernel-code-constant )`
i.e.
In all execution paths starting from when the image is loaded, the
bytes comprising the code will never change.
I know that the lem-function-exchange_mail lemma is a right one when
it becomes part of that global proof.
Regards,
Drahflow