Theory: integer

Parents


Type constants


Term constants


Axioms


Definitions

integer_TY_DEF
|- ?rep. TYPE_DEFINITION (\X. (?p. (p,0) = X) \/ (?n. (0,n) = X)) rep
integer_ISO_DEF
|- (!a. ABS_integer (REP_integer a) = a) /\
   (!r.
     (\X. (?p. (p,0) = X) \/ (?n. (0,n) = X)) r =
     REP_integer (ABS_integer r) =
     r)
PROJ_DEF
|- !p n.
     proj (p,n) =
     ((n < p)
      => (@N. REP_integer N = (p - n,0))
      | (@N. REP_integer N = (0,n - p)))
INT_DEF
|- !p. INT p = proj (p,0)
PLUS_DEF
|- !M N.
     M plus N =
     proj
       (FST (REP_integer M) + FST (REP_integer N),
        SND (REP_integer M) + SND (REP_integer N))
neg_DEF
|- neg = INV ((\N. T),$plus)
MINUS_DEF
|- !M N. M minus N = M plus neg N
TIMES_DEF
|- !M N.
     M times N =
     proj
       (FST (REP_integer M) * FST (REP_integer N) +
        SND (REP_integer M) * SND (REP_integer N),
        FST (REP_integer M) * SND (REP_integer N) +
        SND (REP_integer M) * FST (REP_integer N))
POS_DEF
|- !M. POS M = (?n. M = INT (SUC n))
NEG_DEF
|- !M. NEG M = POS (neg M)
BELOW_DEF
|- !M N. M below N = POS (N minus M)
abs_DEF
|- !N. integer_abs N = ((~(NEG N)) => N | (neg N))
mod_div_DEF
|- !D X.
     ~(D = INT 0) ==>
     (X = X div D times D plus X mod D) /\
     ((POS D)
      => (~(NEG (X mod D)) /\ X mod D below D)
      | (~(POS (X mod D)) /\ D below X mod D))

Theorems

PROJ_ONTO
|- !M. ?n p. M = proj (p,n)
PROJ_REP
|- !N. proj (REP_integer N) = N
REP_PROJ
|- (!p. REP_integer (proj (p,0)) = (p,0)) /\
   (!n. REP_integer (proj (0,n)) = (0,n))
PROJ_EQ
|- !p n p' n'. (proj (p,n) = proj (p',n')) = p + n' = p' + n
INT_ONE_ONE
|- !m n. (INT m = INT n) = m = n
PROJ_PLUS
|- !p n p' n'. proj (p,n) plus proj (p',n') = proj (p + p',n + n')
NUM_ADD_IS_INT_ADD
|- !m n. INT m plus INT n = INT (m + n)
ASSOC_PLUS
|- !M N P. M plus N plus P = (M plus N) plus P
COMM_PLUS
|- !M N. M plus N = N plus M
PROJ_ZERO
|- !m. proj (m,m) = INT 0
PLUS_ID
|- !M. INT 0 plus M = M
PLUS_INV
|- !M. ?N. N plus M = INT 0
integer_as_GROUP
|- GROUP ((\N. T),$plus)
ID_EQ_0
|- ID ((\N. T),$plus) = INT 0
PLUS_GROUP_ASSOC
|- !x y z. (x plus y) plus z = x plus y plus z
PLUS_ID_LEMMA
|- (!x. INT 0 plus x = x) /\
   (!x. x plus INT 0 = x) /\
   (!x. ?y. y plus x = INT 0)
PLUS_LEFT_RIGHT_INV
|- !x y. (y plus x = INT 0) ==> (x plus y = INT 0)
PLUS_INV_LEMMA
|- !x. (neg x plus x = INT 0) /\ (x plus neg x = INT 0)
PLUS_LEFT_CANCELLATION
|- !x y z. (x plus y = x plus z) ==> (y = z)
PLUS_RIGHT_CANCELLATION
|- !x y z. (y plus x = z plus x) ==> (y = z)
PLUS_RIGHT_ONE_ONE_ONTO
|- !x y. ?z. (x plus z = y) /\ (!u. (x plus u = y) ==> (u = z))
PLUS_LEFT_ONE_ONE_ONTO
|- !x y. ?z. (z plus x = y) /\ (!u. (u plus x = y) ==> (u = z))
PLUS_UNIQUE_ID
|- !e. (?x. e plus x = x) \/ (?x. x plus e = x) ==> (e = INT 0)
PLUS_UNIQUE_INV
|- !x u. (u plus x = INT 0) ==> (u = neg x)
PLUS_INV_ID_LEMMA
|- neg (INT 0) = INT 0
PLUS_INV_INV_LEMMA
|- !x. neg (neg x) = x
PLUS_DIST_INV_LEMMA
|- !x y. neg x plus neg y = neg (y plus x)
PROJ_neg
|- !p n. neg (proj (p,n)) = proj (n,p)
PROJ_TIMES
|- !p n p' n'.
     proj (p,n) times proj (p',n') = proj (p * p' + n * n',p * n' + n * p')
NUM_MULT_IS_INT_MULT
|- !m n. INT m times INT n = INT (m * n)
ASSOC_TIMES
|- !M N P. M times N times P = (M times N) times P
COMM_TIMES
|- !M N. M times N = N times M
TIMES_IDENTITY
|- !M. (M times INT 1 = M) /\ (INT 1 times M = M)
RIGHT_PLUS_DISTRIB
|- !M N P. (M plus N) times P = M times P plus N times P
LEFT_PLUS_DISTRIB
|- !M N P. M times (N plus P) = M times N plus M times P
TIMES_ZERO
|- !M. (M times INT 0 = INT 0) /\ (INT 0 times M = INT 0)
TIMES_neg
|- (!M N. M times neg N = neg (M times N)) /\
   (!M N. neg M times N = neg (M times N))
neg_IS_TIMES_neg1
|- !M. neg M = M times neg (INT 1)
neg_ONE_ONE
|- !x y. (neg x = neg y) = x = y
POS_INT
|- !n. POS (INT (SUC n))
NEG_neg_INT
|- !n. NEG (neg (INT (SUC n)))
POS_PLUS_POS_IS_POS
|- !M N. POS M /\ POS N ==> POS (M plus N)
NEG_PLUS_NEG_IS_NEG
|- !M N. NEG M /\ NEG N ==> NEG (M plus N)
ZERO_NOT_POS
|- ~(POS (INT 0))
ZERO_NOT_NEG
|- ~(NEG (INT 0))
TRICHOTOMY
|- !M.
     (POS M \/ NEG M \/ (M = INT 0)) /\
     ~(POS M /\ NEG M) /\
     ~(POS M /\ (M = INT 0)) /\
     ~(NEG M /\ (M = INT 0))
POS_TIMES_NON_NEG_IS_POS
|- !M N. POS M /\ ~(NEG N) ==> POS (M plus N)
NEG_PLUS_NON_POS_IS_NEG
|- !M N. NEG M /\ ~(POS N) ==> NEG (M plus N)
POS_TIMES_POS_IS_POS
|- !M N. POS M /\ POS N ==> POS (M times N)
POS_TIMES_NEG_IS_NEG
|- !M N. POS M /\ NEG N ==> NEG (M times N)
NEG_TIMES_NEG_IS_POS
|- !M N. NEG M /\ NEG N ==> POS (M times N)
INT_INTEGRAL_DOMAIN
|- !x y. (x times y = INT 0) ==> (x = INT 0) \/ (y = INT 0)
TIMES_LEFT_CANCELLATION
|- !x y z. ~(x = INT 0) ==> (x times y = x times z) ==> (y = z)
TIMES_RIGHT_CANCELLATION
|- !x y z. ~(x = INT 0) ==> (y times x = z times x) ==> (y = z)
NON_NEG_INT_IS_NUM
|- !N. ~(NEG N) = (?n. N = INT n)
NOT_NEG_INT
|- !n. ~(NEG (INT n))
NEG_IS_neg_INT
|- !N. NEG N = (?n. N = neg (INT (SUC n)))
NON_POS_INT_IS_neg_NUM
|- !N. ~(POS N) = (?n. N = neg (INT n))
NOT_POS_neg_INT
|- !n. ~(POS (neg (INT n)))
INT_CASES
|- !P. (!m. P (INT m)) /\ (!m. P (neg (INT m))) ==> (!M. P M)
POS_IS_ZERO_BELOW
|- !N. POS N = INT 0 below N
NEG_IS_BELOW_ZERO
|- !N. NEG N = N below INT 0
NUM_LESS_IS_INT_BELOW
|- !m n. m < n = INT m below INT n
neg_REV_BELOW
|- !M N. neg M below neg N = N below M
POS_MULT_PRES_BELOW
|- !M N P. POS M ==> (N below P = M times N below M times P)
NEG_MULT_REV_BELOW
|- !M N P. NEG M ==> (N below P = M times P below M times N)
ANTISYM
|- !M. ~(M below M)
TRANSIT
|- !M N P. M below N /\ N below P ==> M below P
COMPAR
|- !M N. M below N \/ N below M \/ (M = N)
DOUBLE_INF
|- !M. (?N. N below M) /\ (?P. M below P)
PLUS_BELOW_TRANSL
|- !M N P. M below N = M plus P below N plus P
DISCRETE
|- !IntSet.
     (?M. IntSet M) ==>
     ((?LB. !N. N below LB ==> ~(IntSet N)) ==>
      (?GLB. IntSet GLB /\ (!N. N below GLB ==> ~(IntSet N)))) /\
     ((?UB. !N. UB below N ==> ~(IntSet N)) ==>
      (?LUB. IntSet LUB /\ (!N. LUB below N ==> ~(IntSet N))))
ABS_NOT_NEG
|- !N. ~(NEG (integer_abs N))
ABS_ABS
|- !N. integer_abs (integer_abs N) = integer_abs N
ABS_ZERO
|- integer_abs (INT 0) = INT 0
ABS_POS
|- !N. POS N ==> (integer_abs N = N)
ABS_NEG
|- !N. NEG N ==> (integer_abs N = neg N)
ABS_TIMES_IS_ABS_TIMES_ABS
|- !M N. integer_abs (M times N) = integer_abs M times integer_abs N
ABS_SQUARE
|- !N. integer_abs (N times N) = N times N