Package modular: Parametric theory of modular arithmetic

Information

namemodular
version1.1
descriptionParametric theory of modular arithmetic
authorJoe Hurd <joe@gilith.com>
licenseMIT
showData.Bool
Number.Modular
Number.Numeral

Files

Defined Type Operator

Defined Constants

Theorems

x. Number.Natural.< (toNatural x) modulus

x. fromNatural (toNatural x) = x

n. Number.Natural.< (Number.Natural.mod n modulus) modulus

x. Number.Natural.div (toNatural x) modulus = 0

x. toNatural (fromNatural x) = Number.Natural.mod x modulus

x. ¬x = fromNatural (Number.Natural.- modulus (toNatural x))

n. Number.Natural.< n modulus Number.Natural.mod n modulus = n

n.
    Number.Natural.mod (Number.Natural.mod n modulus) modulus =
    Number.Natural.mod n modulus

x y. x < y ¬(y x)

x y. x - y = x + ¬y

x y. x < y Number.Natural.< (toNatural x) (toNatural y)

x y. x y Number.Natural.≤ (toNatural x) (toNatural y)

x y. toNatural x = toNatural y x = y

x1 y1.
    fromNatural (Number.Natural.* x1 y1) = fromNatural x1 * fromNatural y1

x1 y1.
    fromNatural (Number.Natural.+ x1 y1) = fromNatural x1 + fromNatural y1

x y.
    toNatural (x + y) =
    Number.Natural.mod (Number.Natural.+ (toNatural x) (toNatural y))
      modulus

x y.
    fromNatural x = fromNatural y
    Number.Natural.mod x modulus = Number.Natural.mod y modulus

m n.
    Number.Natural.mod
      (Number.Natural.* (Number.Natural.mod m modulus)
         (Number.Natural.mod n modulus)) modulus =
    Number.Natural.mod (Number.Natural.* m n) modulus

m n.
    Number.Natural.mod
      (Number.Natural.+ (Number.Natural.mod m modulus)
         (Number.Natural.mod n modulus)) modulus =
    Number.Natural.mod (Number.Natural.+ m n) modulus

x y.
    Number.Natural.< x modulus Number.Natural.< y modulus
    fromNatural x = fromNatural y x = y

Input Type Operators

Input Constants

Assumptions

T

¬(modulus = 0)

F p. p

t. t ¬t

(¬) = λp. p F

() = λP. P ((select) P)

t. (x. t) t

t. (λx. t x) = t

() = λP. P = λx. T

x. x = x T

() = λp q. p q p

t. (t T) (t F)

(¬T F) (¬F T)

m n. ¬Number.Natural.≤ m n Number.Natural.< n m

() = λp q. (λf. f p q) = λf. f T T

P. ¬(x. P x) x. ¬P x

() = λP. q. (x. P x q) q

m n. Number.Natural.< m n Number.Natural.div m n = 0

m n. Number.Natural.< m n Number.Natural.mod m n = m

m n. ¬(n = 0) Number.Natural.< (Number.Natural.mod m n) n

f g. f = g x. f x = g x

() = λp q. r. (p r) (q r) r

P. (x. y. P x y) y. x. P x (y x)

(t. ¬¬t t) (¬T F) (¬F T)

m n.
    ¬(n = 0)
    Number.Natural.mod (Number.Natural.mod m n) n = Number.Natural.mod m n

m n.
    ¬(n = 0)
    Number.Natural.+ (Number.Natural.* (Number.Natural.div m n) n)
      (Number.Natural.mod m n) = m

m n p.
    ¬(n = 0)
    Number.Natural.mod
      (Number.Natural.* (Number.Natural.mod m n) (Number.Natural.mod p n))
      n = Number.Natural.mod (Number.Natural.* m p) n

a b n.
    ¬(n = 0)
    Number.Natural.mod
      (Number.Natural.+ (Number.Natural.mod a n) (Number.Natural.mod b n))
      n = Number.Natural.mod (Number.Natural.+ a b) n

t. ((T t) t) ((t T) t) ((F t) ¬t) ((t F) ¬t)

t. (T t t) (t T t) (F t F) (t F F) (t t t)

t. (T t T) (t T T) (F t t) (t F t) (t t t)

t. (T t t) (t T T) (F t T) (t t T) (t F ¬t)

p q r.
    (p q q p) ((p q) r p q r) (p q r q p r)
    (p p p) (p p q p q)