Package modular-def: Definition of modular arithmetic
Information
name | modular-def |
version | 1.72 |
description | Definition of modular arithmetic |
author | Joe Leslie-Hurd <joe@gilith.com> |
license | MIT |
provenance | HOL Light theory extracted on 2012-11-10 |
requires | bool modular-witness natural natural-bits natural-divides pair probability |
show | Data.Bool Data.Pair Number.Modular Number.Natural Probability.Random |
Files
- Package tarball modular-def-1.72.tgz
- Theory file modular-def.thy (included in the package tarball)
Defined Type Operator
- Number
- Modular
- modular
- Modular
Defined Constants
- Number
- Modular
- *
- +
- -
- <
- ≤
- ↑
- ~
- fromNatural
- fromRandom
- toNatural
- Modular
Theorems
⊦ modulus mod modulus = 0
⊦ 0 mod modulus = 0
⊦ ∀x. fromNatural (toNatural x) = x
⊦ ∀n. n mod modulus < modulus
⊦ ∀n. n mod modulus ≤ n
⊦ ∀x. x ↑ 0 = 1
⊦ ∀n. toNatural (fromNatural n) = n mod modulus
⊦ ∀x. ~x = fromNatural (modulus - toNatural x)
⊦ ∀n. divides modulus n ⇔ n mod modulus = 0
⊦ ∀n. n < modulus ⇒ toNatural (fromNatural n) = n
⊦ ∀n. n < modulus ⇒ n mod modulus = n
⊦ ∀n. n mod modulus mod modulus = n mod modulus
⊦ ∀x y. x - y = x + ~y
⊦ ∀x y. x < y ⇔ toNatural x < toNatural y
⊦ ∀x y. x ≤ y ⇔ toNatural x ≤ toNatural y
⊦ ∀x n. x ↑ suc n = x * x ↑ n
⊦ ∀x1 y1. fromNatural (x1 * y1) = fromNatural x1 * fromNatural y1
⊦ ∀x1 y1. fromNatural (x1 + y1) = fromNatural x1 + fromNatural y1
⊦ ∀m n. (m mod modulus) * (n mod modulus) mod modulus = m * n mod modulus
⊦ ∀m n. (m mod modulus + n mod modulus) mod modulus = (m + n) mod modulus
⊦ ∀x y. x < modulus ∧ y < modulus ∧ fromNatural x = fromNatural y ⇒ x = y
⊦ ∀r.
fromRandom r =
let (n, r') ← Uniform.fromRandom modulus r in (fromNatural n, r')
Input Type Operators
- →
- bool
- Data
- Pair
- ×
- Pair
- Number
- Natural
- natural
- Natural
- Probability
- Random
- random
- Random
Input Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∃!
- ∨
- ¬
- ⊥
- ⊤
- Pair
- ,
- Bool
- Number
- Modular
- modulus
- Natural
- *
- +
- -
- <
- ≤
- bit1
- div
- divides
- mod
- suc
- zero
- Uniform
- Uniform.fromRandom
- Modular
Assumptions
⊦ ⊤
⊦ ¬(modulus = 0)
⊦ ¬⊥ ⇔ ⊤
⊦ ¬⊤ ⇔ ⊥
⊦ ∀t. t ⇒ t
⊦ ⊥ ⇔ ∀p. p
⊦ ∀t. t ∨ ¬t
⊦ (¬) = λp. p ⇒ ⊥
⊦ (∃) = λp. p ((select) p)
⊦ ∀t. (∀x. t) ⇔ t
⊦ ∀t. (λx. t x) = t
⊦ (∀) = λp. p = λx. ⊤
⊦ ∀t. ¬¬t ⇔ t
⊦ ∀t. (⊤ ⇔ t) ⇔ t
⊦ ∀t. (t ⇔ ⊤) ⇔ t
⊦ ∀t. ⊥ ∧ t ⇔ ⊥
⊦ ∀t. ⊤ ∧ t ⇔ t
⊦ ∀t. ⊥ ⇒ t ⇔ ⊤
⊦ ∀t. ⊤ ⇒ t ⇔ t
⊦ ∀t. t ⇒ ⊤ ⇔ ⊤
⊦ ∀t. ⊥ ∨ t ⇔ t
⊦ ∀t. ⊤ ∨ t ⇔ ⊤
⊦ ∀t. t ∨ ⊥ ⇔ t
⊦ ∀t. t ∨ ⊤ ⇔ ⊤
⊦ ∀t. (⊥ ⇔ t) ⇔ ¬t
⊦ ∀t. t ⇒ ⊥ ⇔ ¬t
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀t. (t ⇔ ⊤) ∨ (t ⇔ ⊥)
⊦ ∀n. 0 < n ⇔ ¬(n = 0)
⊦ ∀x y. x = y ⇔ y = x
⊦ ∀t1 t2. t1 ∨ t2 ⇔ t2 ∨ t1
⊦ (∧) = λp q. (λf. f p q) = λf. f ⊤ ⊤
⊦ ∀n. ¬(n = 0) ⇒ n mod n = 0
⊦ ∀p. ¬(∀x. p x) ⇔ ∃x. ¬p x
⊦ (∃) = λp. ∀q. (∀x. p x ⇒ q) ⇒ q
⊦ ∀m n. m < n ⇒ m mod n = m
⊦ ∀m n. ¬(n = 0) ⇒ m mod n < n
⊦ ∀m n. ¬(n = 0) ⇒ m mod n ≤ m
⊦ ∀f g. (∀x. f x = g x) ⇔ f = g
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ ∀t1 t2 t3. (t1 ∨ t2) ∨ t3 ⇔ t1 ∨ t2 ∨ t3
⊦ ∀p. (∀x. ∃y. p x y) ⇔ ∃y. ∀x. p x (y x)
⊦ ∀a b. ¬(a = 0) ⇒ (divides a b ⇔ b mod a = 0)
⊦ ∀n m. ¬(n = 0) ⇒ m mod n mod n = m mod n
⊦ (∃!) = λp. (∃) p ∧ ∀x y. p x ∧ p y ⇒ x = y
⊦ ∀e f. ∃!fn. fn 0 = e ∧ ∀n. fn (suc n) = f (fn n) n
⊦ ∀m n. ¬(n = 0) ⇒ (m div n) * n + m mod n = m
⊦ ∀n m p. ¬(n = 0) ⇒ (m mod n) * (p mod n) mod n = m * p mod n
⊦ ∀n a b. ¬(n = 0) ⇒ (a mod n + b mod n) mod n = (a + b) mod n