Filtering...

simple-equalities-and-inequalities-helper

books/arithmetic-5/lib/basic-ops/simple-equalities-and-inequalities-helper

Included Books

other
(in-package "ACL2")
local
(local (include-book "../../support/top"))
include-book
(include-book "building-blocks")
local
(local (defun rationalp-guard-fn
    (args)
    (if (endp (cdr args))
      `((rationalp ,(CAR ARGS)))
      (cons `(rationalp ,(CAR ARGS))
        (rationalp-guard-fn (cdr args))))))
local
(local (defmacro rationalp-guard
    (&rest args)
    (if (endp (cdr args))
      `(rationalp ,(CAR ARGS))
      (cons 'and (rationalp-guard-fn args)))))
local
(local (defun real/rationalp-guard-fn
    (args)
    (if (endp (cdr args))
      `((real/rationalp ,(CAR ARGS)))
      (cons `(real/rationalp ,(CAR ARGS))
        (real/rationalp-guard-fn (cdr args))))))
local
(local (defmacro real/rationalp-guard
    (&rest args)
    (if (endp (cdr args))
      `(real/rationalp ,(CAR ARGS))
      (cons 'and (real/rationalp-guard-fn args)))))
local
(local (defthm niq-bounds
    (implies (and (integerp i) (<= 0 i) (integerp j) (< 0 j))
      (and (<= (nonnegative-integer-quotient i j) (/ i j))
        (< (+ (/ i j) -1) (nonnegative-integer-quotient i j))))
    :hints (("Subgoal *1/1''" :in-theory (enable normalize-<-/-to-*-3-3)))
    :rule-classes ((:linear :trigger-terms ((nonnegative-integer-quotient i j))))))
local
(local (defthm floor-bounds-1
    (implies (real/rationalp-guard x y)
      (and (< (+ (/ x y) -1) (floor x y))
        (<= (floor x y) (/ x y))))
    :rule-classes ((:generalize) (:linear :trigger-terms ((floor x y))))))
local
(local (defthm floor-bounds-2
    (implies (and (real/rationalp-guard x y) (integerp (/ x y)))
      (equal (floor x y) (/ x y)))
    :rule-classes ((:generalize) (:linear :trigger-terms ((floor x y))))))
local
(local (defthm floor-bounds-3
    (implies (and (real/rationalp-guard x y) (not (integerp (/ x y))))
      (< (floor x y) (/ x y)))
    :rule-classes ((:generalize) (:linear :trigger-terms ((floor x y))))))
local
(local (in-theory (disable floor)))
integerp-<-constanttheorem
(defthm integerp-<-constant
  (implies (and (syntaxp (rational-constant-p c))
      (real/rationalp c)
      (not (integerp c))
      (integerp x))
    (equal (< x c) (<= x (floor c 1))))
  :otf-flg t)
constant-<-integerptheorem
(defthm constant-<-integerp
  (implies (and (syntaxp (rational-constant-p c))
      (real/rationalp c)
      (not (integerp c))
      (integerp x))
    (equal (< c x) (<= (+ 1 (floor c 1)) x)))
  :otf-flg t)