Theory: more_list

Parents


Type constants


Term constants


Axioms


Definitions

FOLDR_DEF
|- (!f start. FOLDR f [] start = start) /\
   (!f x l start. FOLDR f (CONS x l) start = f x (FOLDR f l start))
FOLDL_DEF
|- (!f. FOLDL f [] = (\start. start)) /\
   (!f l x. FOLDL f (CONS x l) = (\start. FOLDL f l (f start x)))
FILTER_DEF
|- (!pred. FILTER pred [] = []) /\
   (!pred tl hd.
     FILTER pred (CONS hd tl) =
     ((pred hd) => (CONS hd (FILTER pred tl)) | (FILTER pred tl)))
nonemptylist_TY_DEF
|- ?rep.
     TYPE_DEFINITION
       (TRP
         (\v tl.
           (?x. v = INL x) /\ (LENGTH tl = 0) \/
           (?x. v = INR x) /\ (LENGTH tl = SUC 0)))
       rep
nonemptylist_ISO_DEF
|- (!a. ABS_nonemptylist (REP_nonemptylist a) = a) /\
   (!r.
     TRP
       (\v tl.
         (?x. v = INL x) /\ (LENGTH tl = 0) \/
         (?x. v = INR x) /\ (LENGTH tl = SUC 0))
       r =
     REP_nonemptylist (ABS_nonemptylist r) =
     r)
ONE_DEF
|- !x. ONE x = ABS_nonemptylist (Node (INL x) [])
MORE_DEF
|- !x n. MORE x n = ABS_nonemptylist (Node (INR x) [REP_nonemptylist n])
nonempty_MAP_DEF
|- (!f x. nonempty_MAP f (ONE x) = ONE (f x)) /\
   (!f xs x. nonempty_MAP f (MORE x xs) = MORE (f x) (nonempty_MAP f xs))
nonempty_FOLDR_DEF
|- (!f start x. nonempty_FOLDR f start (ONE x) = f x start) /\
   (!f start l y.
     nonempty_FOLDR f start (MORE y l) = f y (nonempty_FOLDR f start l))
nonempty_FOLDR_TO_ONE_DEF
|- (!f x. nonempty_FOLDR_TO_ONE f (ONE x) = x) /\
   (!f l y.
     nonempty_FOLDR_TO_ONE f (MORE y l) = f y (nonempty_FOLDR_TO_ONE f l))
nonempty_FOLDL_DEF
|- (!start f x. nonempty_FOLDL start f (ONE x) = f start x) /\
   (!start f xs x.
     nonempty_FOLDL start f (MORE x xs) = nonempty_FOLDL (f start x) f xs)
nonempty_FOLDL_WITH_INIT_DEF
|- (!f x. nonempty_FOLDL_WITH_INIT f (ONE x) = x) /\
   (!f xs x. nonempty_FOLDL_WITH_INIT f (MORE x xs) = nonempty_FOLDL x f xs)
option_TY_DEF
|- ?rep.
     TYPE_DEFINITION
       (TRP
         (\v tl.
           (v = INL one) /\ (LENGTH tl = 0) \/
           (?x. v = INR x) /\ (LENGTH tl = 0)))
       rep
option_ISO_DEF
|- (!a. ABS_option (REP_option a) = a) /\
   (!r.
     TRP
       (\v tl.
         (v = INL one) /\ (LENGTH tl = 0) \/
         (?x. v = INR x) /\ (LENGTH tl = 0))
       r =
     REP_option (ABS_option r) =
     r)
NONE_DEF
|- NONE = ABS_option (Node (INL one) [])
SOME_DEF
|- !x. SOME x = ABS_option (Node (INR x) [])
SOME_arg_DEF
|- !x. SOME_arg (SOME x) = x

Theorems

nonemptylist_Axiom
|- !f0 f1.
     ?!fn. (!x. fn (ONE x) = f0 x) /\ (!x n. fn (MORE x n) = f1 (fn n) x n)
nonemptylist_induction_thm
|- !P. (!x. P (ONE x)) /\ (!n. P n ==> (!x. P (MORE x n))) ==> (!n. P n)
nonemptylist_cases_thm
|- !n. (?x. n = ONE x) \/ (?n' x. n = MORE x n')
nonemptylist_constructors_one_one
|- (!x x'. (ONE x = ONE x') = x = x') /\
   (!x n x' n'. (MORE x n = MORE x' n') = (x = x') /\ (n = n'))
nonemptylist_constructors_distinct
|- !n x' x. ~(ONE x = MORE x' n)
option_Axiom
|- !e f. ?!fn. (fn NONE = e) /\ (!x. fn (SOME x) = f x)
option_induction_thm
|- !P. P NONE /\ (!x. P (SOME x)) ==> (!o'. P o')
option_cases_thm
|- !o'. (o' = NONE) \/ (?x. o' = SOME x)
option_constructors_one_one
|- !x x'. (SOME x = SOME x') = x = x'
option_constructors_distinct
|- !x. ~(NONE = SOME x)