Theory toto

Parents

Contents

Type operators

Constants

Definitions

ListOrdStrongLinearOrder_of_TOTO_invTO_of_LinearOrderTotOrdWeakLinearOrder_of_TOcharOrdchartoimageOrdlexTOlextotolistotonumOrdnum_dt_TY_DEFnum_dt_case_defnum_dt_size_defnum_to_dt_primitive_defnumtoqk_numOrd_defqk_numtostringtoto_bijtoto_TY_DEFtoto_invtoto_of_LinearOrder

Theorems

LEX_ALTListOrd_THMNOT_EQ_LESS_IMPSLO_LEXSLO_listorderSPLIT_PAIRSSTRORD_SLOStrongLinearOrderExistsStrongLinearOrder_LESSStrongLinearOrder_of_TO_TO_of_LinearOrderStrongOrder_ALTStrong_Strong_ofStrong_Strong_of_TOStrong_toto_invStrong_toto_thmStrongof_toto_STRORDTO_11TO_ListOrdTO_antisymTO_apto_IDTO_apto_TO_IDTO_apto_TO_IMPTO_charOrdTO_cpn_eqnTO_equal_eqTO_existsTO_injectionTO_inv_OrdTO_inv_TO_invTO_lexTOTO_numOrdTO_of_LinearOrder_LEXTO_of_greater_lerTO_of_less_relTO_ontoTO_qk_numOrdTO_reflTotOrd_TO_of_LOTotOrd_TO_of_StrongTotOrd_TO_of_WeakTotOrd_aptoTotOrd_invWeak_Weak_ofWeak_toto_invWeak_toto_thmall_cpn_distinctap_qk_numto_thmapcharto_thmaplextotoaplistotoapnumto_thmapto_invcharOrd_eq_lemcharOrd_gt_lemcharOrd_lt_lemcharOrd_thmdatatype_num_dtinv_TOlexTO_ALTlexTO_thmlistorderlistorder_indnum_dtOrdnum_dtOrd_indnum_dt_11num_dt_Axiomnum_dt_case_congnum_dt_case_eqnum_dt_distinctnum_dt_inductionnum_dt_nchotomynumeralOrdonto_aptopre_aplextotoqk_numeralOrdtotoEEtranstotoELtranstotoGGtranstotoGLtranstotoLEtranstotoLGtranstotoLLtranstoto_Strong_thmtoto_Weak_thmtoto_antisymtoto_cpn_eqntoto_equal_eqtoto_equal_imptoto_equal_imp_eqtoto_equal_symtoto_glneqtoto_inv_toto_invtoto_not_less_refltoto_refltoto_swap_casestoto_thmtoto_trans_lesstoto_unequal_imptrichotomous_ALT

Definitions

|- !c. ListOrd c =
       TO_of_LinearOrder (listorder (StrongLinearOrder_of_TO (apto c)))
|- !c x y.
     StrongLinearOrder_of_TO c x y <=>
     case c x y of LESS => T | EQUAL => F | GREATER => F
|- !c x y. TO_inv c x y = c y x
|- !r x y.
     TO_of_LinearOrder r x y =
     if x = y then EQUAL else if r x y then LESS else GREATER
|- !c. TotOrd c <=>
       (!x y. (c x y = EQUAL) <=> (x = y)) /\
       (!x y. (c x y = GREATER) <=> (c y x = LESS)) /\
       !x y z. (c x y = LESS) /\ (c y z = LESS) ==> (c x z = LESS)
|- !c x y.
     WeakLinearOrder_of_TO c x y <=>
     case c x y of LESS => T | EQUAL => T | GREATER => F
|- !a b. charOrd a b = numOrd (ORD a) (ORD b)
|- charto = TO charOrd
|- !f cp a b. imageOrd f cp a b = cp (f a) (f b)
|- !R V.
     R lexTO V =
     TO_of_LinearOrder
       (StrongLinearOrder_of_TO R LEX StrongLinearOrder_of_TO V)
|- !c v. c lextoto v = TO (apto c lexTO apto v)
|- !c. listoto c = TO (ListOrd c)
|- numOrd = TO_of_LinearOrder $<
num_dt_TY_DEF
|- ?rep.
     TYPE_DEFINITION
       (\a0.
            ! $var$('num_dt').
              (!a0.
                 (a0 = ind_type$CONSTR 0 ARB (\n. ind_type$BOTTOM)) \/
                 (?a. (a0 =
                       (\a.
                            ind_type$CONSTR (SUC 0) ARB
                              (ind_type$FCONS a (\n. ind_type$BOTTOM))) a) /\
                      $var$('num_dt') a) \/
                 (?a. (a0 =
                       (\a.
                            ind_type$CONSTR (SUC (SUC 0)) ARB
                              (ind_type$FCONS a (\n. ind_type$BOTTOM))) a) /\
                      $var$('num_dt') a) ==>
                 $var$('num_dt') a0) ==>
              $var$('num_dt') a0) rep
num_dt_case_def
|- (!v f f1. num_dt_CASE zer v f f1 = v) /\
   (!a v f f1. num_dt_CASE (bit1 a) v f f1 = f a) /\
   !a v f f1. num_dt_CASE (bit2 a) v f f1 = f1 a
num_dt_size_def
|- (num_dt_size zer = 0) /\
   (!a. num_dt_size (bit1 a) = 1 + num_dt_size a) /\
   !a. num_dt_size (bit2 a) = 1 + num_dt_size a
num_to_dt_primitive_def
|- num_to_dt =
   WFREC
     (@R. WF R /\ (!n. n <> 0 /\ ODD n ==> R (DIV2 (n - 1)) n) /\
          !n. n <> 0 /\ ~ODD n ==> R (DIV2 (n - 2)) n)
     (\num_to_dt a.
          I
            (if a = 0 then zer
             else if ODD a then bit1 (num_to_dt (DIV2 (a - 1)))
             else bit2 (num_to_dt (DIV2 (a - 2)))))
|- numto = TO numOrd
|- !m n. qk_numOrd m n = num_dtOrd (num_to_dt m) (num_to_dt n)
|- qk_numto = TO qk_numOrd
|- stringto = listoto charto
to_bij
|- (!a. TO (apto a) = a) /\ !r. TotOrd r <=> (apto (TO r) = r)
toto_TY_DEF
|- ?rep. TYPE_DEFINITION TotOrd rep
|- !c. toto_inv c = TO (TO_inv (apto c))
|- !r. toto_of_LinearOrder r = TO (TO_of_LinearOrder r)

Theorems

|- !R U c d.
     (R LEX U) c d <=>
     R (FST c) (FST d) \/ (FST c = FST d) /\ U (SND c) (SND d)
|- !c. (ListOrd c [] [] = EQUAL) /\ (!b y. ListOrd c [] (b::y) = LESS) /\
       (!a x. ListOrd c (a::x) [] = GREATER) /\
       !a x b y.
         ListOrd c (a::x) (b::y) =
         case apto c a b of
           LESS => LESS
         | EQUAL => ListOrd c x y
         | GREATER => GREATER
|- !cmp x y. apto cmp x y <> LESS ==> (x = y) \/ (apto cmp y x = LESS)
|- !R V.
     StrongLinearOrder R /\ StrongLinearOrder V ==>
     StrongLinearOrder (R LEX V)
|- !V. StrongLinearOrder V ==> StrongLinearOrder (listorder V)
|- !x y. (x = y) <=> (FST x = FST y) /\ (SND x = SND y)
|- !R. WeakLinearOrder R ==> StrongLinearOrder (STRORD R)
|- ?R. StrongLinearOrder R
|- StrongLinearOrder $<
|- !R. irreflexive R ==>
       (StrongLinearOrder_of_TO (TO_of_LinearOrder R) = R)
|- !Z. StrongOrder Z <=> irreflexive Z /\ transitive Z
|- !c. StrongLinearOrder (StrongLinearOrder_of_TO (apto c))
|- !c. TotOrd c ==> StrongLinearOrder (StrongLinearOrder_of_TO c)
|- !c. StrongLinearOrder_of_TO (apto (toto_inv c)) =
       relinv (StrongLinearOrder_of_TO (apto c))
|- !r. StrongLinearOrder r ==>
       (StrongLinearOrder_of_TO (apto (toto_of_LinearOrder r)) = r)
|- !c. StrongLinearOrder_of_TO (apto c) =
       STRORD (WeakLinearOrder_of_TO (apto c))
|- !r r'. TotOrd r ==> TotOrd r' ==> ((TO r = TO r') <=> (r = r'))
|- !c. TotOrd (ListOrd c)
|- !c. TotOrd c ==> !x y. (c x y = GREATER) <=> (c y x = LESS)
|- !a. TO (apto a) = a
|- !r. TotOrd r <=> (apto (TO r) = r)
|- !r. TotOrd r ==> (apto (TO r) = r)
|- TotOrd charOrd
|- !c. TotOrd c ==>
       (!x y. (c x y = LESS) ==> x <> y) /\
       (!x y. (c x y = GREATER) ==> x <> y) /\
       !x y. (c x y = EQUAL) ==> (x = y)
|- !c. TotOrd c ==> !x y. (c x y = EQUAL) <=> (x = y)
|- ?x. TotOrd x
|- !cp. TotOrd cp ==> !f. ONE_ONE f ==> TotOrd (imageOrd f cp)
|- !r. TO_of_LinearOrder (relinv r) = TO_inv (TO_of_LinearOrder r)
|- !c. TO_inv (TO_inv c) = c
|- !R V. TotOrd R /\ TotOrd V ==> TotOrd (R lexTO V)
|- TotOrd numOrd
|- !R V.
     irreflexive R /\ irreflexive V ==>
     (TO_of_LinearOrder (R LEX V) =
      TO_of_LinearOrder R lexTO TO_of_LinearOrder V)
|- !r. StrongLinearOrder r ==>
       !x y. (TO_of_LinearOrder r x y = GREATER) <=> r y x
|- !r. StrongLinearOrder r ==>
       !x y. (TO_of_LinearOrder r x y = LESS) <=> r x y
|- !a. ?r. (a = TO r) /\ TotOrd r
|- TotOrd qk_numOrd
|- !c. TotOrd c ==> !x. c x x = EQUAL
|- !r. LinearOrder r ==> TotOrd (TO_of_LinearOrder r)
|- !r. StrongLinearOrder r ==> TotOrd (TO_of_LinearOrder r)
|- !r. WeakLinearOrder r ==> TotOrd (TO_of_LinearOrder r)
|- !c. TotOrd (apto c)
|- !c. TotOrd c ==> TotOrd (TO_inv c)
|- !c. WeakLinearOrder (WeakLinearOrder_of_TO (apto c))
|- !c. WeakLinearOrder_of_TO (apto (toto_inv c)) =
       relinv (WeakLinearOrder_of_TO (apto c))
|- !r. WeakLinearOrder r ==>
       (WeakLinearOrder_of_TO (apto (toto_of_LinearOrder r)) = r)
|- (LESS <> EQUAL /\ LESS <> GREATER /\ EQUAL <> GREATER) /\
   EQUAL <> LESS /\ GREATER <> LESS /\ GREATER <> EQUAL
|- apto qk_numto = qk_numOrd
|- apto charto = charOrd
|- !c v x1 x2 y1 y2.
     apto (c lextoto v) (x1,x2) (y1,y2) =
     case apto c x1 y1 of
       LESS => LESS
     | EQUAL => apto v x2 y2
     | GREATER => GREATER
|- !c. (apto (listoto c) [] [] = EQUAL) /\
       (!b y. apto (listoto c) [] (b::y) = LESS) /\
       (!a x. apto (listoto c) (a::x) [] = GREATER) /\
       !a x b y.
         apto (listoto c) (a::x) (b::y) =
         case apto c a b of
           LESS => LESS
         | EQUAL => apto (listoto c) x y
         | GREATER => GREATER
|- apto numto = numOrd
|- !c. apto (toto_inv c) = TO_inv (apto c)
|- !a b. (numOrd a b = EQUAL) ==> (charOrd (CHR a) (CHR b) = EQUAL)
|- !a b.
     (numOrd a b = GREATER) ==>
     (a < 256 <=> T) ==>
     (charOrd (CHR a) (CHR b) = GREATER)
|- !a b.
     (numOrd a b = LESS) ==>
     (b < 256 <=> T) ==>
     (charOrd (CHR a) (CHR b) = LESS)
|- charOrd = TO_of_LinearOrder char_lt
datatype_num_dt
|- DATATYPE (num_dt zer bit1 bit2)
|- !r. TotOrd r ==> (toto_inv (TO r) = TO (TO_inv r))
|- !R V.
     TotOrd R /\ TotOrd V ==>
     !(r,u) (r',u').
       (R lexTO V) (r,u) (r',u') =
       case R r r' of LESS => LESS | EQUAL => V u u' | GREATER => GREATER
|- !R V.
     TotOrd R /\ TotOrd V ==>
     !x y.
       (R lexTO V) x y =
       case R (FST x) (FST y) of
         LESS => LESS
       | EQUAL => V (SND x) (SND y)
       | GREATER => GREATER
|- (!l V. listorder V l [] <=> F) /\
   (!s m V. listorder V [] (s::m) <=> T) /\
   !s r m l V.
     listorder V (r::l) (s::m) <=> V r s \/ (r = s) /\ listorder V l m
|- !P. (!V l. P V l []) /\ (!V s m. P V [] (s::m)) /\
       (!V r l s m. P V l m ==> P V (r::l) (s::m)) ==>
       !v v1 v2. P v v1 v2
|- (num_dtOrd zer zer = EQUAL) /\ (!x. num_dtOrd zer (bit1 x) = LESS) /\
   (!x. num_dtOrd zer (bit2 x) = LESS) /\
   (!x. num_dtOrd (bit1 x) zer = GREATER) /\
   (!x. num_dtOrd (bit2 x) zer = GREATER) /\
   (!y x. num_dtOrd (bit1 x) (bit2 y) = LESS) /\
   (!y x. num_dtOrd (bit2 x) (bit1 y) = GREATER) /\
   (!y x. num_dtOrd (bit1 x) (bit1 y) = num_dtOrd x y) /\
   !y x. num_dtOrd (bit2 x) (bit2 y) = num_dtOrd x y
|- !P. P zer zer /\ (!x. P zer (bit1 x)) /\ (!x. P zer (bit2 x)) /\
       (!x. P (bit1 x) zer) /\ (!x. P (bit2 x) zer) /\
       (!x y. P (bit1 x) (bit2 y)) /\ (!x y. P (bit2 x) (bit1 y)) /\
       (!x y. P x y ==> P (bit1 x) (bit1 y)) /\
       (!x y. P x y ==> P (bit2 x) (bit2 y)) ==>
       !v v1. P v v1
num_dt_11
|- (!a a'. (bit1 a = bit1 a') <=> (a = a')) /\
   !a a'. (bit2 a = bit2 a') <=> (a = a')
num_dt_Axiom
|- !f0 f1 f2. ?fn.
     (fn zer = f0) /\ (!a. fn (bit1 a) = f1 a (fn a)) /\
     !a. fn (bit2 a) = f2 a (fn a)
num_dt_case_cong
|- !M M' v f f1.
     (M = M') /\ ((M' = zer) ==> (v = v')) /\
     (!a. (M' = bit1 a) ==> (f a = f' a)) /\
     (!a. (M' = bit2 a) ==> (f1 a = f1' a)) ==>
     (num_dt_CASE M v f f1 = num_dt_CASE M' v' f' f1')
num_dt_case_eq
|- (num_dt_CASE x v f f1 = v') <=>
   (x = zer) /\ (v = v') \/ (?n. (x = bit1 n) /\ (f n = v')) \/
   ?n. (x = bit2 n) /\ (f1 n = v')
num_dt_distinct
|- (!a. zer <> bit1 a) /\ (!a. zer <> bit2 a) /\ !a' a. bit1 a <> bit2 a'
num_dt_induction
|- !P. P zer /\ (!n. P n ==> P (bit1 n)) /\ (!n. P n ==> P (bit2 n)) ==>
       !n. P n
num_dt_nchotomy
|- !nn. (nn = zer) \/ (?n. nn = bit1 n) \/ ?n. nn = bit2 n
|- !x y.
     (numOrd ZERO ZERO = EQUAL) /\ (numOrd ZERO (BIT1 y) = LESS) /\
     (numOrd ZERO (BIT2 y) = LESS) /\ (numOrd (BIT1 x) ZERO = GREATER) /\
     (numOrd (BIT2 x) ZERO = GREATER) /\
     (numOrd (BIT1 x) (BIT1 y) = numOrd x y) /\
     (numOrd (BIT2 x) (BIT2 y) = numOrd x y) /\
     (numOrd (BIT1 x) (BIT2 y) =
      case numOrd x y of LESS => LESS | EQUAL => LESS | GREATER => GREATER) /\
     (numOrd (BIT2 x) (BIT1 y) =
      case numOrd x y of
        LESS => LESS
      | EQUAL => GREATER
      | GREATER => GREATER)
|- !r. TotOrd r <=> ?a. r = apto a
|- !c v x y.
     apto (c lextoto v) x y =
     case apto c (FST x) (FST y) of
       LESS => LESS
     | EQUAL => apto v (SND x) (SND y)
     | GREATER => GREATER
|- !x y.
     (qk_numOrd ZERO ZERO = EQUAL) /\ (qk_numOrd ZERO (BIT1 y) = LESS) /\
     (qk_numOrd ZERO (BIT2 y) = LESS) /\
     (qk_numOrd (BIT1 x) ZERO = GREATER) /\
     (qk_numOrd (BIT2 x) ZERO = GREATER) /\
     (qk_numOrd (BIT1 x) (BIT1 y) = qk_numOrd x y) /\
     (qk_numOrd (BIT2 x) (BIT2 y) = qk_numOrd x y) /\
     (qk_numOrd (BIT1 x) (BIT2 y) = LESS) /\
     (qk_numOrd (BIT2 x) (BIT1 y) = GREATER)
|- !c x y z.
     ((apto c x y = EQUAL) /\ (apto c y z = EQUAL) ==> (apto c x z = EQUAL)) /\
     ((apto c x y = EQUAL) /\ (apto c z y = EQUAL) ==> (apto c x z = EQUAL))
|- !c x y z.
     (apto c x y = EQUAL) /\ (apto c y z = LESS) ==> (apto c x z = LESS)
|- !c x y z.
     (apto c y x = GREATER) /\ (apto c z y = GREATER) ==>
     (apto c x z = LESS)
|- !c x y z.
     (apto c y x = GREATER) /\ (apto c y z = LESS) ==> (apto c x z = LESS)
|- !c x y z.
     (apto c x y = LESS) /\ (apto c y z = EQUAL) ==> (apto c x z = LESS)
|- !c x y z.
     (apto c x y = LESS) /\ (apto c z y = GREATER) ==> (apto c x z = LESS)
|- !c x y z.
     (apto c x y = LESS) /\ (apto c y z = LESS) ==> (apto c x z = LESS)
|- !c. toto_of_LinearOrder (StrongLinearOrder_of_TO (apto c)) = c
|- !c. toto_of_LinearOrder (WeakLinearOrder_of_TO (apto c)) = c
|- !c x y. (apto c x y = GREATER) <=> (apto c y x = LESS)
|- (!c x y. (apto c x y = EQUAL) ==> (x = y)) /\
   (!c x y. (apto c x y = LESS) ==> x <> y) /\
   !c x y. (apto c x y = GREATER) ==> x <> y
|- !c x y. (apto c x y = EQUAL) <=> (x = y)
|- !cmp phi.
     LinearOrder phi /\ (cmp = toto_of_LinearOrder phi) ==>
     !x y. ((x = y) <=> T) ==> (apto cmp x y = EQUAL)
|- !c x y. (apto c x y = EQUAL) ==> (x = y)
|- !c x y. (apto c x y = EQUAL) <=> (apto c y x = EQUAL)
|- (!c x y. (apto c x y = LESS) ==> x <> y) /\
   !c x y. (apto c x y = GREATER) ==> x <> y
|- !c. toto_inv (toto_inv c) = c
|- !cmp h. (apto cmp h h = LESS) <=> F
|- !c x. apto c x x = EQUAL
|- !c x y.
     apto c y x =
     case apto c x y of LESS => GREATER | EQUAL => EQUAL | GREATER => LESS
|- !c. (!x y. (apto c x y = EQUAL) <=> (x = y)) /\
       (!x y. (apto c x y = GREATER) <=> (apto c y x = LESS)) /\
       !x y z.
         (apto c x y = LESS) /\ (apto c y z = LESS) ==> (apto c x z = LESS)
|- (!c x y z.
      (apto c x y = LESS) /\ (apto c y z = LESS) ==> (apto c x z = LESS)) /\
   (!c x y z.
      (apto c x y = LESS) /\ (apto c z y = GREATER) ==> (apto c x z = LESS)) /\
   (!c x y z.
      (apto c y x = GREATER) /\ (apto c z y = GREATER) ==>
      (apto c x z = LESS)) /\
   (!c x y z.
      (apto c y x = GREATER) /\ (apto c y z = LESS) ==> (apto c x z = LESS)) /\
   (!c x y z.
      (apto c x y = LESS) /\ (apto c y z = EQUAL) ==> (apto c x z = LESS)) /\
   !c x y z.
     (apto c x y = EQUAL) /\ (apto c y z = LESS) ==> (apto c x z = LESS)
|- !cmp phi.
     LinearOrder phi /\ (cmp = toto_of_LinearOrder phi) ==>
     !x y.
       ((x = y) <=> F) ==>
       if phi x y then apto cmp x y = LESS else apto cmp x y = GREATER
|- !R. trichotomous R <=> !x y. ~R x y /\ ~R y x ==> (x = y)