Theory: finmap

Parents


Type constants


Term constants


Axioms


Definitions

finmap_TY_DEF
|- ?rep. TYPE_DEFINITION (TRP (\v tl. (?x. v = x) /\ (LENGTH tl = 0))) rep
finmap_ISO_DEF
|- (!a. ABS_finmap (REP_finmap a) = a) /\
   (!r.
     TRP (\v tl. (?x. v = x) /\ (LENGTH tl = 0)) r =
     REP_finmap (ABS_finmap r) =
     r)
FINMAP_DEF
|- !x. FINMAP x = ABS_finmap (Node x [])
FINMAP_arg_DEF
|- !l. FINMAP_arg (FINMAP l) = l
empty_finmap_DEF
|- empty_finmap = FINMAP []
list_lookup_DEF
|- (!key. list_lookup key [] = undefined) /\
   (!key t h.
     list_lookup key (CONS h t) =
     ((key = FST h) => (lift (SND h)) | (list_lookup key t)))
finmap_lookup_DEF
|- !key l. finmap_lookup key (FINMAP l) = list_lookup key l
list_insert_DEF
|- (!less key item. list_insert less key item [] = [key,item]) /\
   (!less key item t h.
     list_insert less key item (CONS h t) =
     ((less (FST h) key)
      => (CONS h (list_insert less key item t))
      | ((key = FST h)
         => (CONS (key,item) t)
         | (CONS (key,item) (CONS h t)))))
finmap_insert_DEF
|- !less key item l.
     finmap_insert less key item (FINMAP l) =
     FINMAP (list_insert less key item l)
list_modify_DEF
|- (!less f. list_modify less f [] = f) /\
   (!less f t h.
     list_modify less f (CONS h t) =
     list_modify less (list_insert less (FST h) (SND h) f) t)
finmap_modify_DEF
|- !less f g.
     finmap_modify less f g =
     ((f = empty_finmap)
      => g
      | (FINMAP (list_modify less (FINMAP_arg f) (FINMAP_arg g))))
list_max_DEF
|- (list_max [] = 0) /\
   (!l n. list_max (CONS n l) = ((list_max l < n) => n | (list_max l)))
list_member_DEF
|- (!item. list_member item [] = F) /\
   (!item t h.
     list_member item (CONS h t) = ((h = item) => T | (list_member item t)))
dom_list_helper_DEF
|- (dom_list_helper [] = []) /\
   (!t h. dom_list_helper (CONS h t) = CONS (FST h) (dom_list_helper t))
dom_list_DEF
|- !l. dom_list (FINMAP l) = dom_list_helper l
finmap_dom_DEF
|- !l. finmap_dom (FINMAP l) = FOLDR (\x s. FST x INSERT s) l {}
finmap_range_DEF
|- !l. finmap_range (FINMAP l) = FOLDR (\x s. SND x INSERT s) l {}
restrict_finmap_DEF
|- !f set.
     restrict_finmap (FINMAP f) set = FINMAP (FILTER (\x. FST x IN set) f)
bij_inv_DEF
|- !f1 f2.
     bij_inv f1 f2 =
     ONE_ONE f1 /\ ONTO f1 /\ (!a. f2 (f1 a) = a) /\ (!b. f1 (f2 b) = b)
in_dom_DEF
|- !f x. in_dom f x = list_member x (dom_list f)
next_dom_DEF
|- !less f.
     next_dom less f = (@a. ~(in_dom f a) /\ (!a'. less a' a ==> in_dom f a'))
ne_length_DEF
|- (!x. ne_length (ONE x) = 0) /\
   (!n x. ne_length (MORE x n) = ne_length n + 1)

Theorems

finmap_Axiom
|- !f. ?!fn. !x. fn (FINMAP x) = f x
finmap_constructors_one_one
|- !x x'. (FINMAP x = FINMAP x') = x = x'
finmap_induction_thm
|- !P. (!x. P (FINMAP x)) ==> (!f. P f)
finmap_cases_thm
|- !f. ?x. f = FINMAP x
empty_finmap_is_zero
|- !less f.
     (finmap_modify less empty_finmap f = f) /\
     (finmap_modify less f empty_finmap = f)
next_dom_thm
|- !f from_num to_num less.
     bij_inv from_num to_num /\ (!a a'. less a a' = to_num a < to_num a') ==>
     ~(in_dom f (next_dom less f)) /\
     (!a'. less a' (next_dom less f) ==> in_dom f a')
length_preserved
|- !n f. ne_length (nonempty_MAP f n) = ne_length n
length_0_thm
|- !l. (ne_length l = 0) = (?x. l = ONE x)
length_suc_thm
|- !l. (ne_length l = SUC n) = (?x l2. (l = MORE x l2) /\ (ne_length l2 = n))
nonempty_MAP_thm
|- !l l' f. ONE_ONE f ==> ((nonempty_MAP f l = nonempty_MAP f l') = l = l')