Package gfp-div: GF(p) field division
Information
name | gfp-div |
version | 1.23 |
description | GF(p) field division |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
requires | bool pair natural relation natural-divides natural-gcd natural-prime gfp-witness gfp-def gfp-thm |
show | Data.Bool Data.Pair Number.GF(p) Number.Natural |
Files
- Package tarball gfp-div-1.23.tgz
- Theory file gfp-div.thy (included in the package tarball)
Defined Constants
- Number
- GF(p)
- /
- gcdDiv
- inv
- GF(p)
Theorems
⊦ inv 1 = 1
⊦ ∀x. ¬(x = 0) ⇒ inv (inv x) = x
⊦ ∀x. ¬(x = 0) ⇒ ¬(inv x = 0)
⊦ ∀x. ¬(x = 0) ⇒ x * inv x = 1
⊦ ∀x. ¬(x = 0) ⇒ inv x * x = 1
⊦ ∀x y. ¬(x = 0) ⇒ x * (y / x) = y
⊦ ∀x y. ¬(x = 0) ⇒ y / x * x = y
⊦ ∀x y. ¬(x = 0) ⇒ x * y / x = y
⊦ ∀x y. ¬(x = 0) ⇒ y * x / x = y
⊦ ∀x y. ¬(x = 0) ⇒ y / x = y * inv x
⊦ ∀x y. x * y = x ⇔ x = 0 ∨ y = 1
⊦ ∀x y. y * x = x ⇔ x = 0 ∨ y = 1
⊦ ∀x y. x * y = 0 ⇔ x = 0 ∨ y = 0
⊦ ∀x. ¬(x = 0) ∧ inv x = 1 ⇒ x = 1
⊦ ∀x y. ¬(y = 0) ⇒ gcdDiv (toNatural y) oddprime x 0 = x / y
⊦ ∀x y z. x * y = x * z ⇔ x = 0 ∨ y = z
⊦ ∀x y z. y * x = z * x ⇔ x = 0 ∨ y = z
⊦ ∀x y. ¬(x = 0) ∧ ¬(y = 0) ∧ inv x = inv y ⇒ x = y
⊦ ∀x y. ¬(x = 0) ∧ ¬(y = 0) ⇒ inv x * inv y = inv (x * y)
⊦ ∀u v x1 x2.
gcd u v = 1 ∧ fromNatural u * x2 = fromNatural v * x1 ⇒
fromNatural u * gcdDiv u v x1 x2 = x1 ∧
fromNatural v * gcdDiv u v x1 x2 = x2
⊦ ∀u v x1 x2.
gcdDiv u v x1 x2 =
if u = 1 then x1
else if v = 1 then x2
else if even u then gcdDiv (u div 2) v (x1 / 2) x2
else if even v then gcdDiv u (v div 2) x1 (x2 / 2)
else if v ≤ u then gcdDiv (u - v) v (x1 - x2) x2
else gcdDiv u (v - u) x1 (x2 - x1)
⊦ ∀p.
(∀v. p 1 v) ∧ (∀u. ¬(u = 1) ⇒ p u 1) ∧
(∀u v. gcd (2 * u) v = 1 ∧ ¬(v = 1) ∧ p u v ⇒ p (2 * u) v) ∧
(∀u v. gcd u (2 * v) = 1 ∧ ¬(u = 1) ∧ odd u ∧ p u v ⇒ p u (2 * v)) ∧
(∀u v. gcd u v = 1 ∧ even u ∧ ¬(v = 1) ∧ odd v ∧ p u v ⇒ p (v + u) v) ∧
(∀u v. gcd u v = 1 ∧ ¬(u = 1) ∧ odd u ∧ even v ∧ p u v ⇒ p u (u + v)) ⇒
∀u v. gcd u v = 1 ⇒ p u v
⊦ ∀p.
(∀v x1 x2. p 1 v x1 x2 x1) ∧ (∀u x1 x2. p u 1 x1 x2 x2) ∧
(∀u v x1 x2 g.
gcd (2 * u) v = 1 ∧ p u v x1 x2 g ⇒ p (2 * u) v (2 * x1) x2 g) ∧
(∀u v x1 x2 g.
gcd u (2 * v) = 1 ∧ p u v x1 x2 g ⇒ p u (2 * v) x1 (2 * x2) g) ∧
(∀u v x1 x2 g.
gcd u v = 1 ∧ p u v x1 x2 g ⇒ p (v + u) v (x2 + x1) x2 g) ∧
(∀u v x1 x2 g.
gcd u v = 1 ∧ p u v x1 x2 g ⇒ p u (u + v) x1 (x1 + x2) g) ⇒
∀u v x1 x2. gcd u v = 1 ⇒ p u v x1 x2 (gcdDiv u v x1 x2)
Input Type Operators
- →
- bool
- Data
- Pair
- ×
- Pair
- Number
- GF(p)
- gfp
- Natural
- natural
- GF(p)
Input Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∨
- ¬
- cond
- ⊥
- ⊤
- Pair
- ,
- Bool
- Number
- GF(p)
- *
- +
- -
- ~
- fromNatural
- oddprime
- toNatural
- Natural
- *
- +
- -
- <
- ≤
- bit0
- bit1
- div
- divides
- even
- gcd
- mod
- odd
- prime
- suc
- zero
- GF(p)
Assumptions
⊦ ⊤
⊦ prime oddprime
⊦ ¬(oddprime = 0)
⊦ ¬⊥ ⇔ ⊤
⊦ ¬⊤ ⇔ ⊥
⊦ bit0 0 = 0
⊦ ∀t. t ⇒ t
⊦ ∀n. 0 ≤ n
⊦ ⊥ ⇔ ∀p. p
⊦ fromNatural oddprime = 0
⊦ ∀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
⊦ ∀x. fromNatural (toNatural x) = x
⊦ ∀n. ¬(suc n = 0)
⊦ ∀n. 0 + n = n
⊦ ∀m. m + 0 = m
⊦ ∀a. gcd 0 a = a
⊦ ∀a. gcd a 0 = a
⊦ ¬(1 = 0)
⊦ ∀t. (⊥ ⇔ t) ⇔ ¬t
⊦ ∀t. (t ⇔ ⊥) ⇔ ¬t
⊦ ∀t. t ⇒ ⊥ ⇔ ¬t
⊦ ∀x. x + 0 = x
⊦ ∀x. 0 + x = x
⊦ ∀n. even (2 * n)
⊦ ∀n. bit1 n = suc (bit0 n)
⊦ ∀n. ¬even n ⇔ odd n
⊦ ∀n. ¬odd n ⇔ even n
⊦ ∀m. 1 * m = m
⊦ ∀m n. m ≤ m + n
⊦ ¬(2 = 0)
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀t. (t ⇔ ⊤) ∨ (t ⇔ ⊥)
⊦ ∀x. x * 0 = 0
⊦ ∀x. 0 * x = 0
⊦ ∀x. ~x + x = 0
⊦ ∀x. toNatural x mod oddprime = toNatural x
⊦ ∀x. x * 1 = x
⊦ ∀x. 1 * x = x
⊦ ∀n. even (suc n) ⇔ ¬even n
⊦ ∀m. m ≤ 0 ⇔ m = 0
⊦ ∀t1 t2. (if ⊥ then t1 else t2) = t2
⊦ ∀t1 t2. (if ⊤ then t1 else t2) = t1
⊦ ∀p x. p x ⇒ p ((select) p)
⊦ ∀n. 0 < n ⇔ ¬(n = 0)
⊦ ∀n. bit0 (suc n) = suc (suc (bit0 n))
⊦ ∀x y. x = y ⇒ y = x
⊦ ∀t1 t2. t1 ∨ t2 ⇔ t2 ∨ t1
⊦ ∀x y. x * y = y * x
⊦ ∀x y. x + y = y + x
⊦ ∀a b. gcd a b = gcd b a
⊦ ∀m n. m ≤ n ∨ n ≤ m
⊦ ∀m n. m + n - m = n
⊦ ∀x. fromNatural x = 0 ⇔ divides oddprime x
⊦ ∀n. 2 * n = n + n
⊦ ∀x y. x - y = x + ~y
⊦ ∀m n. ¬(m < n ∧ n ≤ m)
⊦ ∀m n. ¬(m ≤ n ∧ n < m)
⊦ ∀m n. ¬(m ≤ n) ⇔ n < m
⊦ ∀m n. suc m ≤ n ⇔ m < n
⊦ ∀p. (∀b. p b) ⇔ p ⊤ ∧ p ⊥
⊦ (∧) = λp q. (λf. f p q) = λf. f ⊤ ⊤
⊦ ∀p. ¬(∀x. p x) ⇔ ∃x. ¬p x
⊦ (∃) = λp. ∀q. (∀x. p x ⇒ q) ⇒ q
⊦ ∀t1 t2. ¬t1 ⇒ ¬t2 ⇔ t2 ⇒ t1
⊦ ∀m n. m + suc n = suc (m + n)
⊦ ∀m n. suc m + n = suc (m + n)
⊦ ∀m n. n < m + n ⇔ 0 < m
⊦ ∀m n. suc m = suc n ⇔ m = n
⊦ ∀a b. gcd a (a + b) = gcd a b
⊦ ∀a b. gcd (b + a) b = gcd a b
⊦ ∀t1 t2. ¬(t1 ∨ t2) ⇔ ¬t1 ∧ ¬t2
⊦ ∀m n. even (m * n) ⇔ even m ∨ even n
⊦ ∀m n. even (m + n) ⇔ even m ⇔ even n
⊦ ∀x1 y1. fromNatural (x1 * y1) = fromNatural x1 * fromNatural y1
⊦ ∀x1 y1. fromNatural (x1 + y1) = fromNatural x1 + fromNatural y1
⊦ ∀n. even n ⇔ ∃m. n = 2 * m
⊦ ∀P. (∀p. P p) ⇔ ∀p1 p2. P (p1, p2)
⊦ ∀m n. m ≤ n ⇔ ∃d. n = m + d
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ ∀m n. m ≤ n ⇔ m < n ∨ m = n
⊦ ∀m n. m ≤ n ∧ n ≤ m ⇔ m = n
⊦ ∀PAIR'. ∃fn. ∀a0 a1. fn (a0, a1) = PAIR' a0 a1
⊦ ∀p q. (∀x. p ⇒ q x) ⇔ p ⇒ ∀x. q x
⊦ ∀p q. p ∧ (∃x. q x) ⇔ ∃x. p ∧ q x
⊦ ∀p q. p ⇒ (∃x. q x) ⇔ ∃x. p ⇒ q x
⊦ ∀p q. p ∨ (∀x. q x) ⇔ ∀x. p ∨ q x
⊦ ∀p q. p ∨ (∃x. q x) ⇔ ∃x. p ∨ q x
⊦ ∀m n. ¬(m = 0) ⇒ m * n div m = n
⊦ ∀p q. (∃x. p x) ∧ q ⇔ ∃x. p x ∧ q
⊦ ∀p q. (∃x. p x) ∨ q ⇔ ∃x. p x ∨ q
⊦ ∀x y z. x = y ∧ y = z ⇒ x = z
⊦ ∀p q r. p ⇒ q ⇒ r ⇔ p ∧ q ⇒ r
⊦ ∀x y z. x * y * z = x * (y * z)
⊦ ∀x y z. x + y + z = x + (y + z)
⊦ ∀x y z. x + y = x + z ⇔ y = z
⊦ ∀m n p. m + n < m + p ⇔ n < p
⊦ ∀m n p. n + m < p + m ⇔ n < p
⊦ ∀m n p. m + n ≤ m + p ⇔ n ≤ p
⊦ ∀p. (∀x. ∃y. p x y) ⇔ ∃y. ∀x. p x (y x)
⊦ ∀m n. m ≤ suc n ⇔ m = suc n ∨ m ≤ n
⊦ ∀m n. m * n = 0 ⇔ m = 0 ∨ n = 0
⊦ ∀P. P 0 ∧ (∀n. P n ⇒ P (suc n)) ⇒ ∀n. P n
⊦ ∀a b. ¬(a = 0) ⇒ (divides a b ⇔ b mod a = 0)
⊦ ∀p n. prime p ∧ ¬divides p n ⇒ gcd p n = 1
⊦ ∀x y z. x * (y + z) = x * y + x * z
⊦ ∀x y z. (y + z) * x = y * x + z * x
⊦ ∀P. (∀n. (∀m. m < n ⇒ P m) ⇒ P n) ⇒ ∀n. P n
⊦ ∀p g h. ∃f. ∀x. f x = if p x then f (g x) else h x
⊦ ∀p q. (∃x. p x) ∨ (∃x. q x) ⇔ ∃x. p x ∨ q x
⊦ ∀x y. x * y = 0 ⇔ x = 0 ∨ y = 0
⊦ ∀m n p. m * n = m * p ⇔ m = 0 ∨ n = p
⊦ ∀m n p. m * n ≤ m * p ⇔ m = 0 ∨ n ≤ p
⊦ ∀m n p. m * n < m * p ⇔ ¬(m = 0) ∧ n < p
⊦ ∀m n p. m * p < n * p ⇔ m < n ∧ ¬(p = 0)
⊦ ∀a b. ¬(a = 0) ⇒ ∃s t. t * b + gcd b a = s * a
⊦ ∀a b c. gcd a (b * c) = 1 ⇔ gcd a b = 1 ∧ gcd a c = 1
⊦ ∀a b c. gcd (b * c) a = 1 ⇔ gcd b a = 1 ∧ gcd c a = 1