Theory "quote"

Parents     prelim

Signature

Type Arity
varmap 1
index 0
Constant Type
index_lt :index -> index -> bool
Empty_vm :'a varmap
Left_idx :index -> index
index_case :(index -> 'a) -> (index -> 'a) -> 'a -> index -> 'a
dest_varmap :'a varmap -> 'a recspace
varmap_size :('a -> num) -> 'a varmap -> num
Right_idx :index -> index
index_compare_tupled :index # index -> ordering
mk_index :bool recspace -> index
index_compare :index -> index -> ordering
quote0 :index -> index
quote1 :index -> index
quote2 :index
quote3 :'a varmap
quote4 :'a -> 'a varmap -> 'a varmap -> 'a varmap
varmap_case :'b -> ('a -> 'a varmap -> 'a varmap -> 'b) -> 'a varmap -> 'b
End_idx :index
varmap_find :index -> 'a varmap -> 'a
index_size :index -> num
varmap_find_tupled :index # 'a varmap -> 'a
Node_vm :'a -> 'a varmap -> 'a varmap -> 'a varmap
mk_varmap :'a recspace -> 'a varmap
dest_index :index -> bool recspace

Definitions

index_TY_DEF
|- ?rep.
     TYPE_DEFINITION
       (\a0.
          !'index'.
            (!a0.
               (?a.
                  (a0 = (\a. CONSTR 0 (@x. T) (FCONS a (\n. BOTTOM))) a) /\
                  'index' a) \/
               (?a.
                  (a0 =
                   (\a. CONSTR (SUC 0) (@x. T) (FCONS a (\n. BOTTOM))) a) /\
                  'index' a) \/
               (a0 = CONSTR (SUC (SUC 0)) (@x. T) (\n. BOTTOM)) ==>
               'index' a0) ==>
            'index' a0) rep
index_repfns
|- (!a. mk_index (dest_index a) = a) /\
   !r.
     (\a0.
        !'index'.
          (!a0.
             (?a.
                (a0 = (\a. CONSTR 0 (@x. T) (FCONS a (\n. BOTTOM))) a) /\
                'index' a) \/
             (?a.
                (a0 =
                 (\a. CONSTR (SUC 0) (@x. T) (FCONS a (\n. BOTTOM))) a) /\
                'index' a) \/
             (a0 = CONSTR (SUC (SUC 0)) (@x. T) (\n. BOTTOM)) ==>
             'index' a0) ==>
          'index' a0) r =
     (dest_index (mk_index r) = r)
quote0_def
|- quote0 =
   (\a.
      mk_index ((\a. CONSTR 0 (@x. T) (FCONS a (\n. BOTTOM))) (dest_index a)))
quote1_def
|- quote1 =
   (\a.
      mk_index
        ((\a. CONSTR (SUC 0) (@x. T) (FCONS a (\n. BOTTOM))) (dest_index a)))
quote2_def
|- quote2 = mk_index (CONSTR (SUC (SUC 0)) (@x. T) (\n. BOTTOM))
Left_idx
|- Left_idx = quote0
Right_idx
|- Right_idx = quote1
End_idx
|- End_idx = quote2
index_case_def
|- (!f f1 v a. case f f1 v (Left_idx a) = f a) /\
   (!f f1 v a. case f f1 v (Right_idx a) = f1 a) /\
   !f f1 v. case f f1 v End_idx = v
index_size_def
|- (!a. index_size (Left_idx a) = 1 + index_size a) /\
   (!a. index_size (Right_idx a) = 1 + index_size a) /\
   (index_size End_idx = 0)
index_compare_tupled_primitive_def
|- index_compare_tupled =
   WFREC
     (@R.
        WF R /\ (!m' n'. R (n',m') (Left_idx n',Left_idx m')) /\
        !m' n'. R (n',m') (Right_idx n',Right_idx m'))
     (\index_compare_tupled' a.
        case a of
           (v,v1) ->
             case v of
                Left_idx v4 ->
                  (case v1 of
                      Left_idx v6 -> index_compare_tupled' (v4,v6)
                   || Right_idx v7 -> LESS
                   || End_idx -> GREATER)
             || Right_idx v5 ->
                  (case v1 of
                      Left_idx v8 -> GREATER
                   || Right_idx v9 -> index_compare_tupled' (v5,v9)
                   || End_idx -> GREATER)
             || End_idx ->
                  case v1 of
                     Left_idx v12 -> LESS
                  || Right_idx v13 -> LESS
                  || End_idx -> EQUAL)
index_compare_curried_def
|- !x x1. index_compare x x1 = index_compare_tupled (x,x1)
index_lt_def
|- !i1 i2. index_lt i1 i2 = (index_compare i1 i2 = LESS)
varmap_TY_DEF
|- ?rep.
     TYPE_DEFINITION
       (\a0'.
          !'varmap'.
            (!a0'.
               (a0' = CONSTR 0 (@v. T) (\n. BOTTOM)) \/
               (?a0 a1 a2.
                  (a0' =
                   (\a0 a1 a2.
                      CONSTR (SUC 0) a0 (FCONS a1 (FCONS a2 (\n. BOTTOM)))) a0
                     a1 a2) /\ 'varmap' a1 /\ 'varmap' a2) ==>
               'varmap' a0') ==>
            'varmap' a0') rep
varmap_repfns
|- (!a. mk_varmap (dest_varmap a) = a) /\
   !r.
     (\a0'.
        !'varmap'.
          (!a0'.
             (a0' = CONSTR 0 (@v. T) (\n. BOTTOM)) \/
             (?a0 a1 a2.
                (a0' =
                 (\a0 a1 a2.
                    CONSTR (SUC 0) a0 (FCONS a1 (FCONS a2 (\n. BOTTOM)))) a0
                   a1 a2) /\ 'varmap' a1 /\ 'varmap' a2) ==>
             'varmap' a0') ==>
          'varmap' a0') r =
     (dest_varmap (mk_varmap r) = r)
quote3_def
|- quote3 = mk_varmap (CONSTR 0 (@v. T) (\n. BOTTOM))
quote4_def
|- quote4 =
   (\a0 a1 a2.
      mk_varmap
        ((\a0 a1 a2. CONSTR (SUC 0) a0 (FCONS a1 (FCONS a2 (\n. BOTTOM)))) a0
           (dest_varmap a1) (dest_varmap a2)))
Empty_vm
|- Empty_vm = quote3
Node_vm
|- Node_vm = quote4
varmap_case_def
|- (!v f. case v f Empty_vm = v) /\
   !v f a0 a1 a2. case v f (Node_vm a0 a1 a2) = f a0 a1 a2
varmap_size_def
|- (!f. varmap_size f Empty_vm = 0) /\
   !f a0 a1 a2.
     varmap_size f (Node_vm a0 a1 a2) =
     1 + (f a0 + (varmap_size f a1 + varmap_size f a2))
varmap_find_tupled_primitive_def
|- varmap_find_tupled =
   WFREC
     (@R.
        WF R /\ (!v1 x v2 i1. R (i1,v2) (Right_idx i1,Node_vm x v1 v2)) /\
        !v2 x v1 i1. R (i1,v1) (Left_idx i1,Node_vm x v1 v2))
     (\varmap_find_tupled' a.
        case a of
           (v,v3) ->
             case v of
                Left_idx v6 ->
                  (case v3 of
                      Empty_vm -> (@x. T)
                   || Node_vm v11 v12 v13 -> varmap_find_tupled' (v6,v12))
             || Right_idx v7 ->
                  (case v3 of
                      Empty_vm -> (@x. T)
                   || Node_vm v17 v18 v19 -> varmap_find_tupled' (v7,v19))
             || End_idx ->
                  case v3 of
                     Empty_vm -> (@x. T)
                  || Node_vm v23 v24 v25 -> v23)
varmap_find_curried_def
|- !x x1. varmap_find x x1 = varmap_find_tupled (x,x1)


Theorems

index_11
|- (!a a'. (Left_idx a = Left_idx a') = (a = a')) /\
   !a a'. (Right_idx a = Right_idx a') = (a = a')
index_distinct
|- (!a' a. ~(Left_idx a = Right_idx a')) /\ (!a. ~(Left_idx a = End_idx)) /\
   !a. ~(Right_idx a = End_idx)
index_case_cong
|- !M M' f f1 v.
     (M = M') /\ (!a. (M' = Left_idx a) ==> (f a = f' a)) /\
     (!a. (M' = Right_idx a) ==> (f1 a = f1' a)) /\
     ((M' = End_idx) ==> (v = v')) ==>
     (case f f1 v M = case f' f1' v' M')
index_nchotomy
|- !i. (?i'. i = Left_idx i') \/ (?i'. i = Right_idx i') \/ (i = End_idx)
index_Axiom
|- !f0 f1 f2.
     ?fn.
       (!a. fn (Left_idx a) = f0 a (fn a)) /\
       (!a. fn (Right_idx a) = f1 a (fn a)) /\ (fn End_idx = f2)
index_induction
|- !P.
     (!i. P i ==> P (Left_idx i)) /\ (!i. P i ==> P (Right_idx i)) /\
     P End_idx ==>
     !i. P i
index_compare_ind
|- !P.
     P End_idx End_idx /\ (!v11. P End_idx (Right_idx v11)) /\
     (!v10. P End_idx (Left_idx v10)) /\ (!v3. P (Right_idx v3) End_idx) /\
     (!v2. P (Left_idx v2) End_idx) /\
     (!n' m'. P n' m' ==> P (Left_idx n') (Left_idx m')) /\
     (!n' m'. P (Left_idx n') (Right_idx m')) /\
     (!n' m'. P n' m' ==> P (Right_idx n') (Right_idx m')) /\
     (!n' m'. P (Right_idx n') (Left_idx m')) ==>
     !v v1. P v v1
index_compare_def
|- (index_compare End_idx End_idx = EQUAL) /\
   (index_compare End_idx (Right_idx v11) = LESS) /\
   (index_compare End_idx (Left_idx v10) = LESS) /\
   (index_compare (Right_idx v3) End_idx = GREATER) /\
   (index_compare (Left_idx v2) End_idx = GREATER) /\
   (index_compare (Left_idx n') (Left_idx m') = index_compare n' m') /\
   (index_compare (Left_idx n') (Right_idx m') = LESS) /\
   (index_compare (Right_idx n') (Right_idx m') = index_compare n' m') /\
   (index_compare (Right_idx n') (Left_idx m') = GREATER)
compare_index_equal
|- !i1 i2. (index_compare i1 i2 = EQUAL) = (i1 = i2)
compare_list_index
|- !l1 l2. (list_compare index_compare l1 l2 = EQUAL) = (l1 = l2)
varmap_11
|- !a0 a1 a2 a0' a1' a2'.
     (Node_vm a0 a1 a2 = Node_vm a0' a1' a2') =
     (a0 = a0') /\ (a1 = a1') /\ (a2 = a2')
varmap_distinct
|- !a2 a1 a0. ~(Empty_vm = Node_vm a0 a1 a2)
varmap_case_cong
|- !M M' v f.
     (M = M') /\ ((M' = Empty_vm) ==> (v = v')) /\
     (!a0 a1 a2. (M' = Node_vm a0 a1 a2) ==> (f a0 a1 a2 = f' a0 a1 a2)) ==>
     (case v f M = case v' f' M')
varmap_nchotomy
|- !v. (v = Empty_vm) \/ ?a v' v0. v = Node_vm a v' v0
varmap_Axiom
|- !f0 f1.
     ?fn.
       (fn Empty_vm = f0) /\
       !a0 a1 a2. fn (Node_vm a0 a1 a2) = f1 a0 a1 a2 (fn a1) (fn a2)
varmap_induction
|- !P.
     P Empty_vm /\ (!v v0. P v /\ P v0 ==> !a. P (Node_vm a v v0)) ==> !v. P v
varmap_find_ind
|- !P.
     (!x v1 v2. P End_idx (Node_vm x v1 v2)) /\
     (!i1 x v1 v2. P i1 v2 ==> P (Right_idx i1) (Node_vm x v1 v2)) /\
     (!i1 x v1 v2. P i1 v1 ==> P (Left_idx i1) (Node_vm x v1 v2)) /\
     P End_idx Empty_vm /\ (!v5. P (Right_idx v5) Empty_vm) /\
     (!v4. P (Left_idx v4) Empty_vm) ==>
     !v v1. P v v1
varmap_find_def
|- (varmap_find End_idx (Node_vm x v1 v2) = x) /\
   (varmap_find (Right_idx i1) (Node_vm x v1 v2) = varmap_find i1 v2) /\
   (varmap_find (Left_idx i1) (Node_vm x v1 v2) = varmap_find i1 v1) /\
   (varmap_find End_idx Empty_vm = @x. T) /\
   (varmap_find (Right_idx v5) Empty_vm = @x. T) /\
   (varmap_find (Left_idx v4) Empty_vm = @x. T)