Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Help with proving bounds on Z.land and Z.lor

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Help with proving bounds on Z.land and Z.lor


Chronological Thread 
  • From: Jason Gross <jasongross9 AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Help with proving bounds on Z.land and Z.lor
  • Date: Sun, 09 Apr 2017 22:11:17 +0000
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f170.google.com
  • Ironport-phdr: 9a23:z+sbmhIMiRNCJwpsy9mcpTZWNBhigK39O0sv0rFitYgRL/zxwZ3uMQTl6Ol3ixeRBMOAuq4C07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9ZDeZwpFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLdQgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhygJNzE78G/ZhM9+gr9Frh29vBFw2ZLYbZuPOfZiYq/Qf9UXTndBUMZLUCxBB5uxYY8VAOoaOuZYqZT2qVoUrRu5HgmsH/7kxzhKhnDsxq061OIhEQ7c3AwnBNIOq3DZoc76NKcXS++1za3IwS/fYPNR3Dfw8Y7FeQ0vr/GLWLJ/a8vRyU83GgPKj1WQtYzlPy6O2egXr2eb6O9gWOSygGAkswF8uiajytsoh4XThY8YykrI+TtnzIopP9G0VUx2bcKiHZBNrS+VLZF2TdknQ2xwuCY11LkGuZmjcSgP0psnxhrfZ+Wec4iL/h7vTeiRLSp6iX55Yr6/iBGy8U+vyu34SMa4ykpFri1AktXUt3AN0QLc6tSfR/dj4kus3SyD2gPT5+1eP0w4i7bXJ4Q8zrMyipYfqUHDETX3mEXygq+WbEIk+u2w5uTleLrmvZicN4l7igHkNaQugde/DOAjPwgBWmiU4+W81Ln58ULlR7VKi+U6krPFv5DCOcQbuqm5DhdJ3YYk8hazFiup0NAFnXYcN19FYxKGj43xO17UOvz4DPG/g06tkDhx3fzGMKfhUd3xKS3Il66kdrJg4QYIww0qiNtb+ph8C7cbIfu1VFWn5/LCCRpsEQWvxOCvJ896zZhWDWCGGaifP7nVqkTZzu0qKuiIIoQSvWCueLAe+/fygCphyhcmdq6z0M5PZQ==

In case anyone, now or in the future, is wanting to do this, I managed to do this with some help from Andres, and the bulk of the code is https://github.com/mit-plv/fiat-crypto/blob/4d334608f7f8f5be98276c5f1904d7955e1b6f53/src/Util/ZUtil/Stabilization.v, with the actual bounds lemmas in the forms that I use them here: https://github.com/mit-plv/fiat-crypto/blob/4d334608f7f8f5be98276c5f1904d7955e1b6f53/src/Compilers/Z/Bounds/InterpretationLemmas/IsBoundedBy.v#L152-L171 


On Sat, Apr 8, 2017 at 3:36 PM Jason Gross <jasongross9 AT gmail.com> wrote:
Hi,

I'm trying to establish bounds on Z.lor and Z.land, in particular for negative arguments.  The standard library seems fairly impoverished on lemmas about N.ldiff (which is used in the definition of Z.lor and Z.land).  Can anyone help me prove the following two lemmas?

Lemma land_abs_bounds a b
  : a < 0 \/ b < 0
    -> -(2^(Z.log2_up (Z.max (Z.abs a) (Z.abs b))))
       <= Z.land a b
       <= Z.max a b.

Lemma lor_abs_bounds a b
  : a < 0 \/ b < 0
    -> Z.min a b
       <= Z.lor a b
       <= 2^(Z.log2_up (Z.max (Z.abs a) (Z.abs b) + 1)) - 1.

(It doesn't matter much to me what the bounds are, as long as they don't use Z.lor/Z.land.  These bounds also hold when both inputs are non-negative; I've already proven those cases)

Thanks,
Jason



Archive powered by MHonArc 2.6.18.

Top of Page