Loading theory "HOL-Eisbach.Eisbach" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Collections.SetIteratorOperations" via "Collections.SetIterator" via "Automatic_Refinement.Misc") Loading theory "Automatic_Refinement.Foldi" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Collections.SetIteratorOperations" via "Collections.SetIterator") signature PARSE_TOOLS = sig val is_real_val: ('a, 'b) parse_val -> bool val name_term: (term, string) parse_val parser val parse_term_val: 'a parser -> (term, 'a) parse_val parser val parse_thm_val: 'a parser -> (thm, 'a) parse_val parser datatype ('a, 'b) parse_val = Parse_Val of 'b * ('a -> unit) | Real_Val of 'a val parse_val_cases: ('a -> 'b) -> ('b, 'a) parse_val -> 'b * ('b -> unit) val the_parse_fun: ('a, 'b) parse_val -> 'a -> unit val the_parse_val: ('a, 'b) parse_val -> 'b val the_real_val: ('a, 'b) parse_val -> 'a end structure Parse_Tools: PARSE_TOOLS consts foldli :: "'b list \ ('a \ bool) \ ('b \ 'a \ 'a) \ 'a \ 'a" signature METHOD_CLOSURE = sig val apply_method: Proof.context -> string -> term list -> thm list list -> (Proof.context -> Method.method) list -> Proof.context -> thm list -> context_tactic val method: binding -> (binding * typ option * mixfix) list -> binding list -> binding list -> binding list -> Token.src -> local_theory -> string * local_theory val method_cmd: binding -> (binding * string option * mixfix) list -> binding list -> binding list -> binding list -> Token.src -> local_theory -> string * local_theory end structure Method_Closure: METHOD_CLOSURE structure Eisbach_Rule_Insts: sig end ### theory "Automatic_Refinement.Foldi" ### 0.252s elapsed time, 0.496s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Prio_List" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") signature PRIO_LIST = sig type T val add_after: T -> item -> item -> T val add_before: T -> item -> item -> T val add_first: T -> item -> T val add_last: T -> item -> T val contains: T -> item -> bool val delete: item -> T -> T val dest: T -> item list val empty: T type item val merge: T * T -> T val merge': T * T -> item list * T val prio_of: (item -> bool) -> (item * item -> bool) -> T -> int end functor Prio_List (sig val eq: item * item -> bool type item end): PRIO_LIST ### theory "Automatic_Refinement.Prio_List" ### 0.044s elapsed time, 0.088s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Refine_Util_Bootstrap1" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib" via "Automatic_Refinement.Refine_Util") infix 1 ## signature BASIC_REFINE_UTIL = sig val ## : ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd val map_fold: ('a -> 'b -> 'c * 'b) -> 'a list -> 'b -> 'c list * 'b val map_option: ('a -> 'b) -> 'a option -> 'b option val seq_is_empty: 'a Seq.seq -> bool * 'a Seq.seq val split: ('a -> bool) -> 'a list -> 'a list * 'a list val split_matching: ('a -> 'b -> bool) -> 'a list -> 'b list -> ('b list * 'b list) option val yield_singleton2: ('a list -> 'b -> ('c * 'd list) * 'e) -> 'a -> 'b -> ('c * 'd) * 'e end structure Basic_Refine_Util: BASIC_REFINE_UTIL val split_matching = fn: ('a -> 'b -> bool) -> 'a list -> 'b list -> ('b list * 'b list) option val split = fn: ('a -> bool) -> 'a list -> 'a list * 'a list val map_fold = fn: ('a -> 'b -> 'c * 'b) -> 'a list -> 'b -> 'c list * 'b val yield_singleton2 = fn: ('a list -> 'b -> ('c * 'd list) * 'e) -> 'a -> 'b -> ('c * 'd) * 'e val map_option = fn: ('a -> 'b) -> 'a option -> 'b option val seq_is_empty = fn: 'a Seq.seq -> bool * 'a Seq.seq val ## = fn: ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd ### theory "Automatic_Refinement.Refine_Util_Bootstrap1" ### 0.040s elapsed time, 0.080s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Mk_Term_Antiquot" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib" via "Automatic_Refinement.Refine_Util") val mk_term_antiquot = fn: Context.generic * Token.T list -> string * (Context.generic * Token.T list) ### theory "Automatic_Refinement.Mk_Term_Antiquot" ### 0.109s elapsed time, 0.220s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Mpat_Antiquot" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib" via "Automatic_Refinement.Refine_Util") val mpat_antiquot = fn: Context.generic * Token.T list -> string * (Context.generic * Token.T list) ### theory "Automatic_Refinement.Mpat_Antiquot" ### 0.156s elapsed time, 0.312s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Refine_Util" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") ### ML warning (line 170 of "~~/src/HOL/Eisbach/match_method.ML"): ### Pattern is not exhaustive. ### ML warning (line 187 of "~~/src/HOL/Eisbach/match_method.ML"): ### Pattern is not exhaustive. ### ML warning (line 309 of "~~/src/HOL/Eisbach/match_method.ML"): ### Pattern is not exhaustive. signature MATCH_METHOD = sig val focus_params: Proof.context -> term list val focus_schematics: Proof.context -> Envir.tenv end structure Match_Method: MATCH_METHOD val method_evaluate = fn: Method.text -> Proof.context -> thm list -> tactic ### theory "HOL-Eisbach.Eisbach" ### 0.732s elapsed time, 1.460s cpu time, 0.000s GC time Loading theory "Collections.ICF_Tools" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Record_Intf") infix 0 ## signature ICF_TOOLS = sig val changed_conv: conv -> conv val chead_of: cterm -> cterm val chead_of_thm: thm -> cterm val define_simple: string -> term -> local_theory -> (term * thm) * local_theory val define_simple_global: string -> term -> theory -> (term * thm) * theory val define_simple_local: string -> term -> local_theory -> (term * thm) * local_theory val dest_def_eq: term -> term * term val dt_head: term -> term val dt_lhs: term -> term val dt_params: term -> term list val dt_rhs: term -> term val dthm_head: thm -> term val dthm_lhs: thm -> term val dthm_params: thm -> term list val dthm_rhs: thm -> term val gen_variant: (string -> bool) -> string -> string val import_cterm: cterm -> Proof.context -> cterm * Proof.context val inst_meta_cong: Proof.context -> cterm -> thm val map_option: ('a -> 'b) -> 'a option -> 'b option val norm_def_thm: thm -> thm val parse_cpat: cterm context_parser val rem_dup_prems: Proof.context -> thm -> thm val rename_cterm: cterm * cterm -> ((indexname * sort) * ctyp) list * ((indexname * typ) * cterm) list val renames_cterm: cterm * cterm -> bool val repeat_top_sweep_conv: (Proof.context -> conv) -> Proof.context -> conv val revert_abbrevs: string -> theory -> theory val sss_add: thm list -> Proof.context -> Proof.context val wrap_lthy_global: (local_theory -> local_theory) -> theory -> theory val wrap_lthy_local: (local_theory -> local_theory) -> local_theory -> local_theory val wrap_lthy_result_global: (local_theory -> 'a * local_theory) -> (morphism -> 'a -> 'b) -> theory -> 'b * theory val wrap_lthy_result_local: (local_theory -> 'a * local_theory) -> (morphism -> 'a -> 'b) -> local_theory -> 'b * local_theory end val ## = fn: ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd structure ICF_Tools: ICF_TOOLS ### theory "Collections.ICF_Tools" ### 0.137s elapsed time, 0.344s cpu time, 0.000s GC time Loading theory "Collections.Ord_Code_Preproc" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Record_Intf") ### ML warning (line 27 of "~~/afp/thys/Collections/ICF/tools/Ord_Code_Preproc.thy"): ### (=) has infix status but was not preceded by op. ### ML warning (line 38 of "~~/afp/thys/Collections/ICF/tools/Ord_Code_Preproc.thy"): ### Value identifier (trace_ft) has not been referenced. ### ML warning (line 51 of "~~/afp/thys/Collections/ICF/tools/Ord_Code_Preproc.thy"): ### Value identifier (process) has not been referenced. signature ORD_CODE_PREPROC = sig val add: int * string * (theory -> thm -> thm) -> theory -> theory val get: theory -> (int * string * (theory -> thm -> thm)) list val rem: string -> theory -> theory val setup: theory -> theory val trace_enabled: bool ref end signature OC_SIMPSET = sig val get: theory -> simpset val map: (simpset -> simpset) -> theory -> theory val setup: theory -> theory end structure Ord_Code_Preproc: ORD_CODE_PREPROC functor Oc_Simpset (sig val name: string val prio: int end): OC_SIMPSET ### theory "Collections.Ord_Code_Preproc" ### 0.065s elapsed time, 0.132s cpu time, 0.000s GC time Loading theory "Collections.Locale_Code" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base") ### ML warning (line 343 of "~~/afp/thys/Collections/ICF/tools/Locale_Code.thy"): ### Pattern is not exhaustive. signature LOCALE_CODE = sig val add_pat_eq: cterm -> thm list -> theory -> theory val close_block: theory -> theory val del_pat: cterm -> theory -> theory val get_unf_ss: theory -> simpset val lc_decl_del: term -> local_theory -> local_theory val lc_decl_eq: thm list -> local_theory -> local_theory val open_block: theory -> theory type pat_eq = cterm * thm list val setup: theory -> theory val tracing_enabled: bool ref end structure Locale_Code: LOCALE_CODE ### theory "Collections.Locale_Code" ### 0.201s elapsed time, 0.388s cpu time, 0.000s GC time Loading theory "Collections.Record_Intf" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base") ### ML warning (line 563 of "~~/afp/thys/Automatic_Refinement/Lib/Refine_Util.thy"): ### Handler catches all exceptions. infix 0 THEN_ELSE' infix 0 THEN_ELSE_COMB' infix 1 THEN_ALL_NEW_FWD infix 1 THEN_INTERVAL infix 2 ORELSE_INTERVAL infix 3 ->> type itactic = int -> int -> tactic type tactic' = int -> tactic signature BASIC_REFINE_UTIL = sig val ## : ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd val ->> : 'a context_parser * ('a * Context.generic -> 'b * Context.generic) -> 'b context_parser val ALL_GOALS_FWD: tactic' -> tactic val ALL_GOALS_FWD': tactic' -> tactic' val APPEND_LIST': tactic' list -> tactic' val CAN': tactic' -> tactic' val CASES': (tactic' * tactic) list -> tactic' val CONCL_COND': (term -> bool) -> tactic' val COND': (term -> bool) -> tactic' val IF_EXGOAL: (int -> tactic) -> tactic' val INTERVAL_FWD: tactic' -> int -> int -> tactic val NTIMES': tactic' -> int -> tactic' val ORELSE_INTERVAL: itactic * itactic -> itactic val REPEAT': tactic' -> tactic' val REPEAT_ALL_NEW_FWD: tactic' -> tactic' val REPEAT_DETERM': tactic' -> tactic' val RSm: Proof.context -> thm -> thm -> thm val SINGLE_INTERVAL: itactic -> tactic' val THEN_ALL_NEW_FWD: tactic' * tactic' -> tactic' val THEN_ELSE': tactic' * (tactic' * tactic') -> tactic' val THEN_ELSE_COMB': tactic' * ((tactic' * tactic' -> tactic') * tactic' * tactic') -> tactic' val THEN_INTERVAL: itactic * itactic -> itactic val TRADE: (Proof.context -> tactic') -> Proof.context -> tactic' val TRY_SOLVED': tactic' -> tactic' val WITH_concl: (term -> tactic') -> tactic' val WITH_subgoal: (term -> tactic') -> tactic' val elim_all_tac: Proof.context -> thm list -> tactic val eqsubst_inst_meth: (Proof.context -> Proof.method) context_parser val eqsubst_inst_tac: Proof.context -> bool -> int list -> ((indexname * Position.T) * string) list -> thm -> int -> tactic val fo_resolve_tac: thm list -> Proof.context -> tactic' val fo_rtac: thm -> Proof.context -> tactic' val has_Var: term -> bool val insert_subgoal_tac: cterm -> tactic' val insert_subgoals_tac: cterm list -> tactic' val is_Abs: term -> bool val is_Comb: term -> bool val is_TFree: typ -> bool val is_def_thm: thm -> bool type itactic = int -> int -> tactic val map_fold: ('a -> 'b -> 'c * 'b) -> 'a list -> 'b -> 'c list * 'b val map_option: ('a -> 'b) -> 'a option -> 'b option val prefer_tac: int -> tactic val rprem_tac: int -> Proof.context -> tactic' val rprems_tac: Proof.context -> tactic' val seq_is_empty: 'a Seq.seq -> bool * 'a Seq.seq val split: ('a -> bool) -> 'a list -> 'a list * 'a list val split_matching: ('a -> 'b -> bool) -> 'a list -> 'b list -> ('b list * 'b list) option type tactic' = int -> tactic val yield_singleton2: ('a list -> 'b -> ('c * 'd list) * 'e) -> 'a -> 'b -> ('c * 'd) * 'e end signature REFINE_UTIL = sig val ## : ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd val ->> : 'a context_parser * ('a * Context.generic -> 'b * Context.generic) -> 'b context_parser val ALL_GOALS_FWD: tactic' -> tactic val ALL_GOALS_FWD': tactic' -> tactic' val APPEND_LIST': tactic' list -> tactic' val CAN': tactic' -> tactic' val CASES': (tactic' * tactic) list -> tactic' val CONCL_COND': (term -> bool) -> tactic' val COND': (term -> bool) -> tactic' val HOL_concl_conv: (Proof.context -> conv) -> Proof.context -> conv val IF_EXGOAL: (int -> tactic) -> tactic' val INTERVAL_FWD: tactic' -> int -> int -> tactic val NTIMES': tactic' -> int -> tactic' val OF_fst: thm list -> thm list -> thm val ORELSE_INTERVAL: itactic * itactic -> itactic val REPEAT': tactic' -> tactic' val REPEAT_ALL_NEW_FWD: tactic' -> tactic' val REPEAT_DETERM': tactic' -> tactic' val RS_fst: thm -> thm list -> thm val RSm: Proof.context -> thm -> thm -> thm val SINGLE_INTERVAL: itactic -> tactic' val THEN_ALL_NEW_FWD: tactic' * tactic' -> tactic' val THEN_ELSE': tactic' * (tactic' * tactic') -> tactic' val THEN_ELSE_COMB': tactic' * ((tactic' * tactic' -> tactic') * tactic' * tactic') -> tactic' val THEN_INTERVAL: itactic * itactic -> itactic val TRADE: (Proof.context -> tactic') -> Proof.context -> tactic' val TRY_SOLVED': tactic' -> tactic' val WITH_concl: (term -> tactic') -> tactic' val WITH_subgoal: (term -> tactic') -> tactic' val abs_def: Proof.context -> thm -> thm val anorm_term: term -> term val anorm_typ: typ -> typ val apply_configs: ('a Config.T * 'a) list -> Proof.context -> Proof.context val build_res_net: thm list -> (int * thm) Net.net val cfg_trace_f_tac_conv: bool Config.T val changed_rule: (thm -> thm) -> thm -> thm val dest_itselfT: typ -> typ val dummify_tvars: term -> term val elim_all_tac: Proof.context -> thm list -> tactic val eqsubst_inst_meth: (Proof.context -> Proof.method) context_parser val eqsubst_inst_tac: Proof.context -> bool -> int list -> ((indexname * Position.T) * string) list -> thm -> int -> tactic val f_tac_conv: Proof.context -> (term -> term) -> tactic -> conv val fcomb_conv: conv -> conv val fix_conv: Proof.context -> conv -> conv val fix_left_tuple_from_Ts: string -> typ list -> Proof.context -> term * Proof.context val fixup_vars: cterm -> thm -> thm val fixup_vars_conv: conv -> conv val fixup_vars_conv': (Proof.context -> conv) -> Proof.context -> conv val fo_matches: theory -> cterm -> term -> bool val fo_matchp: theory -> cterm -> term -> term list option val fo_resolve_tac: thm list -> Proof.context -> tactic' val fo_rtac: thm -> Proof.context -> tactic' val fold_binop_left: ('a -> 'b * 'a) -> ('c -> 'a -> 'b * 'a) -> ('b * 'b -> 'b) -> 'c list -> 'a -> 'b * 'a val fsub_conv: (Proof.context -> conv) -> Proof.context -> conv val ftop_conv: (Proof.context -> conv) -> Proof.context -> conv val has_Var: term -> bool val import_conv: (Proof.context -> conv) -> Proof.context -> conv val import_cterms: bool -> cterm list -> Proof.context -> cterm list * Proof.context val insert_subgoal_tac: cterm -> tactic' val insert_subgoals_tac: cterm list -> tactic' val instantiate_tuples: Proof.context -> (indexname * typ) list -> thm -> thm val instantiate_tuples_from_term_tac: Proof.context -> term -> tactic val instantiate_tuples_subgoal_tac: Proof.context -> tactic' val is_Abs: term -> bool val is_Comb: term -> bool val is_TFree: typ -> bool val is_def_thm: thm -> bool type itactic = int -> int -> tactic val ite_conv: conv -> conv -> conv -> conv val lambda_tuple: term list -> term -> term val list_binop_left: 'a -> ('a * 'a -> 'a) -> 'a list -> 'a val list_prodT_left: typ list -> typ val map_fold: ('a -> 'b -> 'c * 'b) -> 'a list -> 'b -> 'c list * 'b val map_option: ('a -> 'b) -> 'a option -> 'b option val mk_compN: int -> term -> term -> term val mk_compN1: typ list -> int -> term -> term -> term val mk_ltuple: term list -> term val monitor_conv: string -> conv -> conv val monitor_conv': string -> (Proof.context -> conv) -> Proof.context -> conv val order_by: ('a * 'a -> order) -> ('b -> 'a) -> 'b list -> 'b list val parse_bool_config: string -> bool Config.T -> bool context_parser val parse_bool_config': string -> bool Config.T -> Token.T list -> (bool Config.T * bool) * Token.T list val parse_paren_list: 'a context_parser -> 'a list context_parser val parse_paren_list': 'a parser -> Token.T list -> 'a list * Token.T list val parse_paren_lists: 'a context_parser -> 'a list list context_parser val pat_conv: cterm -> (Proof.context -> conv) -> Proof.context -> conv val pat_conv': cterm -> (string -> Proof.context -> conv) -> Proof.context -> conv val prefer_tac: int -> tactic val repeat_rule: (thm -> thm) -> thm -> thm val rprem_tac: int -> Proof.context -> tactic' val rprems_tac: Proof.context -> tactic' val seq_is_empty: 'a Seq.seq -> bool * 'a Seq.seq val shift_lambda_left: thm -> thm val shift_lambda_leftN: int -> thm -> thm val split: ('a -> bool) -> 'a list -> 'a list * 'a list val split_matching: ('a -> 'b -> bool) -> 'a list -> 'b list -> ('b list * 'b list) option val strip_prodT_left: typ -> typ list val subsume_sort: ('a -> term) -> theory -> 'a list -> 'a list val subsume_sort_gen: ('a -> term) -> Context.generic -> 'a list -> 'a list type tactic' = int -> tactic val trace_conv: conv val trade_rule: (Proof.context -> thm -> thm) -> Proof.context -> thm -> thm val try_rule: (thm -> thm) -> thm -> thm val yield_singleton2: ('a list -> 'b -> ('c * 'd list) * 'e) -> 'a -> 'b -> ('c * 'd) * 'e end structure Refine_Util: REFINE_UTIL structure Basic_Refine_Util: BASIC_REFINE_UTIL val ORELSE_INTERVAL = fn: itactic * itactic -> itactic val split = fn: ('a -> bool) -> 'a list -> 'a list * 'a list val fo_resolve_tac = fn: thm list -> Proof.context -> tactic' val RSm = fn: Proof.context -> thm -> thm -> thm val prefer_tac = fn: int -> tactic val WITH_subgoal = fn: (term -> tactic') -> tactic' val NTIMES' = fn: tactic' -> int -> tactic' val map_option = fn: ('a -> 'b) -> 'a option -> 'b option val REPEAT_DETERM' = fn: tactic' -> tactic' val THEN_ELSE_COMB' = fn: tactic' * ((tactic' * tactic' -> tactic') * tactic' * tactic') -> tactic' val SINGLE_INTERVAL = fn: itactic -> tactic' val insert_subgoals_tac = fn: cterm list -> tactic' val ALL_GOALS_FWD' = fn: tactic' -> tactic' val yield_singleton2 = fn: ('a list -> 'b -> ('c * 'd list) * 'e) -> 'a -> 'b -> ('c * 'd) * 'e val insert_subgoal_tac = fn: cterm -> tactic' val INTERVAL_FWD = fn: tactic' -> int -> int -> tactic val split_matching = fn: ('a -> 'b -> bool) -> 'a list -> 'b list -> ('b list * 'b list) option val IF_EXGOAL = fn: (int -> tactic) -> tactic' val seq_is_empty = fn: 'a Seq.seq -> bool * 'a Seq.seq val elim_all_tac = fn: Proof.context -> thm list -> tactic val TRADE = fn: (Proof.context -> tactic') -> Proof.context -> tactic' val APPEND_LIST' = fn: tactic' list -> tactic' val is_TFree = fn: typ -> bool val ## = fn: ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd val CAN' = fn: tactic' -> tactic' val fo_rtac = fn: thm -> Proof.context -> tactic' val is_Abs = fn: term -> bool val COND' = fn: (term -> bool) -> tactic' val CONCL_COND' = fn: (term -> bool) -> tactic' val CASES' = fn: (tactic' * tactic) list -> tactic' val map_fold = fn: ('a -> 'b -> 'c * 'b) -> 'a list -> 'b -> 'c list * 'b val THEN_ALL_NEW_FWD = fn: tactic' * tactic' -> tactic' val WITH_concl = fn: (term -> tactic') -> tactic' val is_Comb = fn: term -> bool val eqsubst_inst_tac = fn: Proof.context -> bool -> int list -> ((indexname * Position.T) * string) list -> thm -> int -> tactic val eqsubst_inst_meth = fn: (Proof.context -> Proof.method) context_parser val ->> = fn: 'a context_parser * ('a * Context.generic -> 'b * Context.generic) -> 'b context_parser val ALL_GOALS_FWD = fn: tactic' -> tactic val is_def_thm = fn: thm -> bool val THEN_INTERVAL = fn: itactic * itactic -> itactic val rprem_tac = fn: int -> Proof.context -> tactic' val rprems_tac = fn: Proof.context -> tactic' val has_Var = fn: term -> bool val REPEAT' = fn: tactic' -> tactic' val THEN_ELSE' = fn: tactic' * (tactic' * tactic') -> tactic' val TRY_SOLVED' = fn: tactic' -> tactic' val REPEAT_ALL_NEW_FWD = fn: tactic' -> tactic' ### theory "Automatic_Refinement.Refine_Util" ### 0.570s elapsed time, 1.196s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Anti_Unification" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") signature RECORD_INTF = sig val add_unf_thms: thm list -> Context.generic -> Context.generic val add_unf_thms_global: thm list -> theory -> theory val get_unf_ss: Context.generic -> simpset val get_unf_thms: Context.generic -> thm list val icf_locales_tac: Proof.context -> tactic val icf_rec_def: thm -> Context.generic -> Context.generic val icf_rec_def_attr: attribute context_parser val setup: theory -> theory end structure Record_Intf: RECORD_INTF ### theory "Collections.Record_Intf" ### 0.101s elapsed time, 0.200s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Attr_Comb" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") signature ANTI_UNIFICATION = sig val anti_unify: term * term -> term val anti_unifyT: typ * typ -> typ_env -> typ * typ_env val anti_unify_env: term * term -> env -> term * env val anti_unify_list: term list -> term val empty: env val empty_term: term_env val empty_typ: typ_env type env = typ_env * term_env val specialize_net_tac: Proof.context -> (int * thm) Net.net -> tactic' val specialize_tac: Proof.context -> thm list -> tactic' type term_env type typ_env end structure Anti_Unification: ANTI_UNIFICATION ### theory "Automatic_Refinement.Anti_Unification" ### 0.107s elapsed time, 0.212s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Data" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel" via "Automatic_Refinement.Autoref_Id_Ops") infixr 5 THEN_ATTR infixr 4 ELSE_ATTR signature ATTR_COMB = sig exception ATTR_EXC of string val CHECK_PREPARE: (Context.generic * thm -> bool) -> attribute -> attribute val COND_attr: (Context.generic * thm -> bool) -> attribute val EFF_ATTR: (Context.generic * thm -> 'a) -> attribute val ELSE_ATTR: attribute * attribute -> attribute val ID_ATTR: attribute val IGNORE_THM: attribute -> attribute val ITE_ATTR: attribute -> attribute -> attribute -> attribute val ITE_ATTR': attribute -> attribute -> (exn -> attribute) -> attribute val NO_ATTR: attribute val RPT1_ATTR: attribute -> attribute val RPT_ATTR: attribute -> attribute val RS_attr: thm -> attribute val RSm_attr: thm -> attribute val THEN_ATTR: attribute * attribute -> attribute val TRACE_ATTR: string -> attribute -> attribute val TRY_ATTR: attribute -> attribute val WARN_ATTR: Context.generic -> string -> attribute end structure Attr_Comb: ATTR_COMB ### theory "Automatic_Refinement.Attr_Comb" ### 0.076s elapsed time, 0.152s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Named_Sorted_Thms" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") signature AUTOREF_DATA = sig type T exception exCIRCULAR exception exNULL val get: Proof.context -> T val init: Proof.context -> Proof.context end functor Autoref_Data ( sig type T val compute: Proof.context -> T val prereq: (Proof.context -> Proof.context) list end ): AUTOREF_DATA ### theory "Automatic_Refinement.Autoref_Data" ### 0.030s elapsed time, 0.060s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Indep_Vars" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") signature NAMED_SORTED_THMS = sig val add: attribute val add_thm: thm -> Context.generic -> Context.generic val del: attribute val del_thm: thm -> Context.generic -> Context.generic val get: Proof.context -> thm list val member: Proof.context -> thm -> bool val setup: theory -> theory end functor Named_Sorted_Thms ( sig val description: string val name: binding val sort: Context.generic -> thm list -> thm list val transform: Context.generic -> thm -> thm list end ): NAMED_SORTED_THMS ### theory "Automatic_Refinement.Named_Sorted_Thms" ### 0.035s elapsed time, 0.068s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Mk_Record_Simp" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") signature INDEP_VARS = sig val indep_tac: Proof.context -> tactic' end structure Indep_Vars: INDEP_VARS ### theory "Automatic_Refinement.Indep_Vars" ### 0.053s elapsed time, 0.108s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Tagged_Solver" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") val mk_record_simp = fn: Context.generic -> thm -> thm ### theory "Automatic_Refinement.Mk_Record_Simp" ### 0.044s elapsed time, 0.088s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Select_Solve" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Automatic_Refinement.Refine_Lib") signature SELECT_SOLVE = sig val AS_FIRSTGOAL: tactic -> tactic' val IF_SUBGOAL_SOLVED: tactic -> tactic -> tactic -> tactic val PREFER_SOLVED: tactic -> tactic val REPEAT_SOLVE_FWD_SELECT: Proof.context -> int -> tactic' -> tactic' val SELECT_FIRST: Proof.context -> tactic -> tactic val TRY_SOLVE_FWD: int -> tactic -> tactic end structure Select_Solve: SELECT_SOLVE ### theory "Automatic_Refinement.Select_Solve" ### 0.154s elapsed time, 0.264s cpu time, 0.112s GC time Loading theory "Containers-Benchmarks.Benchmark_Comparison" (required by "Containers-Benchmarks.Benchmark_LC") signature TAGGED_SOLVER = sig val add_triggers: string -> thm list -> morphism -> Context.generic -> Context.generic val cfg_full: bool Config.T val cfg_keep: bool Config.T val cfg_step: bool Config.T val cfg_trace: bool Config.T val declare_solver: thm list -> binding -> string -> (Proof.context -> tactic') -> morphism -> Context.generic -> Context.generic val delete_solver: string -> morphism -> Context.generic -> Context.generic val get_potential_solvers: Proof.context -> int -> thm -> solver list val get_potential_tacs: Proof.context -> int -> thm -> tactic' list val get_solvers: Proof.context -> solver list val lookup_solver: string -> Context.generic -> solver option val pretty_solvers: Proof.context -> Pretty.T val solve_full_keep_tac: Proof.context -> tactic' val solve_full_step_tac: Proof.context -> tactic' val solve_full_tac: Proof.context -> tactic' val solve_greedy_keep_tac: Proof.context -> tactic' val solve_greedy_step_tac: Proof.context -> tactic' val solve_greedy_tac: Proof.context -> tactic' val solve_tac: Proof.context -> tactic' type solver = thm list * string * string * (Proof.context -> tactic') val tac_of_solver: Proof.context -> solver -> tactic' end structure Tagged_Solver: TAGGED_SOLVER ### theory "Automatic_Refinement.Tagged_Solver" ### 0.188s elapsed time, 0.332s cpu time, 0.112s GC time Loading theory "Finger-Trees.FingerTree" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.FTAnnotatedListImpl") locale FingerTreeStruc_loc Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" Found termination order: "(\p. size (fst (snd (snd p)))) <*mlex*> {}" consts lookup :: "nat \ natural set \ natural \ natural \ natural \ natural \ natural" ### theory "Containers-Benchmarks.Benchmark_Comparison" ### 0.884s elapsed time, 1.764s cpu time, 0.000s GC time Loading theory "Trie.Trie" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.TrieSetImpl" via "Collections.TrieMapImpl" via "Collections.Trie2" via "Collections.Trie_Impl") Found termination order: "{}" Found termination order: "(\p. length (snd p)) <*mlex*> {}" Found termination order: "(\p. length (fst p)) <*mlex*> {}" Found termination order: "(\p. length (fst p)) <*mlex*> {}" Found termination order: "(\p. size (snd p)) <*mlex*> {}" Found termination order: "size <*mlex*> {}" ### theory "Trie.Trie" ### 2.477s elapsed time, 4.852s cpu time, 0.940s GC time Loading theory "Binomial-Heaps.BinomialHeap" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.BinoPrioImpl") locale BinomialHeapStruc_loc ### Ignoring sort constraints in type variables(s): "'a" ### in type abbreviation "BinomialQueue_inv" Found termination order: "{}" Found termination order: "case_sum size (size_list size) <*mlex*> {}" Found termination order: "size_list size <*mlex*> {}" Found termination order: "{}" locale FingerTreeStruc_loc consts gmn :: "('e, 'a) Node \ 'a" Found termination order: "case_sum size (size_list size) <*mlex*> {}" consts gmd :: "('e, 'a) Digit \ 'a" consts gmft :: "('e, 'a) FingerTreeStruc \ 'a" Found termination order: "(\p. size_list size (snd p)) <*mlex*> {}" Found termination order: "(\p. size (snd p)) <*mlex*> {}" consts is_leveln_digit :: "nat \ ('e, 'a) Digit \ bool" consts is_leveln_ftree :: "nat \ ('e, 'a) FingerTreeStruc \ bool" consts is_measured_node :: "('e, 'a) Node \ bool" consts is_measured_digit :: "('e, 'a) Digit \ bool" consts is_measured_ftree :: "('e, 'a) FingerTreeStruc \ bool" consts nodeToList :: "('e, 'a) Node \ ('e \ 'a) list" consts digitToList :: "('e, 'a) Digit \ ('e \ 'a) list" consts toList :: "('e, 'a) FingerTreeStruc \ ('e \ 'a) list" Found termination order: "(\p. size_list size (snd p)) <*mlex*> (\p. size_list size (fst p)) <*mlex*> {}" ### Missing patterns in function definition: ### getMinTree [] = undefined Found termination order: "size_list size <*mlex*> {}" Found termination order: "(\p. size (snd p)) <*mlex*> {}" Found termination order: "(\p. size_list size (snd p)) <*mlex*> {}" Found termination order: "(\p. size (fst p)) <*mlex*> {}" consts toTree :: "('e \ 'a) list \ ('e, 'a) FingerTreeStruc" consts digitToTree :: "('e, 'a) Digit \ ('e, 'a) FingerTreeStruc" consts nodeToDigit :: "('e, 'a) Node \ ('e, 'a) Digit" ### Missing patterns in function definition: ### nlistToDigit [] = undefined ### \v vb va vc vd vf. ### nlistToDigit (v # vb # va # vc # vd # vf) = undefined locale BinomialHeap_loc Found termination order: "{}" consts digitToNlist :: "('e, 'a) Digit \ ('e, 'a) Node list" consts n_unwrap :: "('e, 'a) Node \ 'e \ 'a" ### theory "Binomial-Heaps.BinomialHeap" ### 3.833s elapsed time, 7.600s cpu time, 0.860s GC time Loading theory "Binomial-Heaps.SkewBinomialHeap" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SkewPrioImpl") locale SkewBinomialHeapStruc_loc Found termination order: "size <*mlex*> {}" Found termination order: "size <*mlex*> {}" consts lconsNlist :: "('e, 'a) Node list \ ('e, 'a) FingerTreeStruc \ ('e, 'a) FingerTreeStruc" consts rconsNlist :: "('e, 'a) FingerTreeStruc \ ('e, 'a) Node list \ ('e, 'a) FingerTreeStruc" ### Missing patterns in function definition: ### nodes [] = undefined ### \v. nodes [v] = undefined ### Ignoring sort constraints in type variables(s): "'a" ### in type abbreviation "SkewBinomialQueue" Found termination order: "size_list size <*mlex*> {}" Found termination order: "case_sum size (size_list size) <*mlex*> {}" Found termination order: "{}" Found termination order: "{}" Found termination order: "(\p. size (snd (snd p))) <*mlex*> {}" consts nlistToList :: "('e, 'a) Node list \ ('e \ 'a) list" Found termination order: "{}" Found termination order: "size_list size <*mlex*> {}" Found termination order: "{}" ### Missing patterns in function definition: ### \a b. splitNlist a b [] = undefined Found termination order: "{}" Found termination order: "(\p. size_list size (snd (snd p))) <*mlex*> {}" Found termination order: "{}" Found termination order: "case_sum size (size_list size) <*mlex*> {}" Found termination order: "(\p. size (snd (snd p))) <*mlex*> {}" consts gmnl :: "('e, 'a) Node list \ 'a" Found termination order: "(\p. size_list size (snd p)) <*mlex*> {}" Found termination order: "{}" Found termination order: "{}" Found termination order: "(\p. size (snd (snd p))) <*mlex*> {}" consts foldl_digit :: "('s \ 'e \ 'a \ 's) \ 's \ ('e, 'a) Digit \ 's" Found termination order: "(\p. size_list size (snd p)) <*mlex*> (\p. size_list size (fst p)) <*mlex*> {}" consts foldr_node :: "('e \ 'a \ 's \ 's) \ ('e, 'a) Node \ 's \ 's" consts foldr_digit :: "('e \ 'a \ 's \ 's) \ ('e, 'a) Digit \ 's \ 's" consts foldl :: "('s \ 'e \ 'a \ 's) \ 's \ ('e, 'a) FingerTreeStruc \ 's" ### Missing patterns in function definition: ### getMinTree [] = undefined consts foldr :: "('e \ 'a \ 's \ 's) \ ('e, 'a) FingerTreeStruc \ 's \ 's" consts count_node :: "('e, 'a) Node \ nat" consts count_digit :: "('e, 'a) Digit \ nat" consts count :: "('e, 'a) FingerTreeStruc \ nat" Found termination order: "size_list size <*mlex*> {}" Found termination order: "(\p. size_list size (fst p)) <*mlex*> {}" Found termination order: "(\p. size_list size (snd p)) <*mlex*> {}" locale Bootstrapped locale FingerTree_loc ### theory "Finger-Trees.FingerTree" ### 12.929s elapsed time, 25.592s cpu time, 3.336s GC time Loading theory "HOL-ex.Quicksort" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Collections.SetIteratorOperations" via "Collections.SetIterator" via "Automatic_Refinement.Misc") class linorder = order + assumes "linear": "\x y. x \ y \ y \ x" Found termination order: "length <*mlex*> {}" ### theory "HOL-ex.Quicksort" ### 0.510s elapsed time, 1.020s cpu time, 0.000s GC time Loading theory "Containers-Benchmarks.Benchmark_Default" ### theory "Containers-Benchmarks.Benchmark_Default" ### 2.532s elapsed time, 5.316s cpu time, 4.316s GC time Loading theory "Automatic_Refinement.Misc" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Collections.SetIteratorOperations" via "Collections.SetIterator") Found termination order: "size <*mlex*> {}" consts prio :: "('e, 'a) BsSkewBinomialTree \ 'a" Found termination order: "{}" Found termination order: "{}" locale Lattice_Syntax locale Assoc fixes f :: "'a \ 'a \ 'a" assumes "Assoc f" locale AC fixes f :: "'a \ 'a \ 'a" assumes "AC f" locale su_rel_fun fixes F :: "('a \ 'b) set" and f :: "'a \ 'b" assumes "su_rel_fun F f" Found termination order: "(\p. size_list size (snd p)) <*mlex*> {}" Found termination order: "{}" Found termination order: "{}" Found termination order: "(\p. size_list size (snd p)) <*mlex*> (\p. size_list size (fst p)) <*mlex*> {}" Found termination order: "(\p. size_list size (fst p)) <*mlex*> {}" Found termination order: "(\p. length (fst p)) <*mlex*> {}" Found termination order: "(\p. size_list size (snd p)) <*mlex*> {}" ### Missing patterns in function definition: ### getMinTree [] = undefined locale comp_fun_commute fixes f :: "'a \ 'b \ 'b" assumes "comp_fun_commute f" Found termination order: "size_list size <*mlex*> {}" ### Ignoring duplicate rewrite rule: ### dom (\x. Some (?f1 x)) \ UNIV consts findMin' :: "('a, 'b) BsSkewElem \ 'a \ 'b" consts filter_rev_aux :: "'a list \ ('a \ bool) \ 'a list \ 'a list" ### Missing patterns in function definition: ### \a v va. zipf a (v # va) [] = undefined ### \a v va. zipf a [] (v # va) = undefined Found termination order: "{}" Found termination order: "{}" Found termination order: "(\p. length (snd (snd p))) <*mlex*> {}" Found termination order: "{}" Found termination order: "(\p. length (snd (snd p))) <*mlex*> {}" Found termination order: "case_sum size (size_list size) <*mlex*> {}" Found termination order: "{}" ### No equation for constructor "Inl" consts bs_findMin :: "'c + ('a, 'b) BsSkewElem \ 'a \ 'b" Found termination order: "{}" consts bs_insert :: "'e \ 'a \ unit + ('e, 'a) BsSkewElem \ unit + ('e, 'a) BsSkewElem" ### Missing patterns in function definition: ### \v. bs_deleteMin (Inl v) = undefined Found termination order: "(\p. length (snd (snd p))) <*mlex*> {}" Found termination order: "{}" consts bs_invar :: "unit + ('e, 'a) BsSkewElem \ bool" consts bs_to_mset :: "unit + ('e, 'a) BsSkewElem \ ('e \ 'a) multiset" ### Code generator: dropping subsumed code equation ### quicksort (?x # ?xs) \ ### quicksort (filter (\y. y < ?x) ?xs) @ ### [?x] @ quicksort (filter ((\) ?x) ?xs) ### Code generator: dropping subsumed code equation ### quicksort [] \ [] Found termination order: "(\p. length (snd p)) <*mlex*> {}" Found termination order: "(\p. length (snd (snd p))) <*mlex*> (\p. length (fst (snd p))) <*mlex*> {}" locale SkewBinomialHeap_loc Found termination order: "(\p. length (snd p)) <*mlex*> (\p. length (fst p)) <*mlex*> {}" ### theory "Binomial-Heaps.SkewBinomialHeap" ### 14.218s elapsed time, 27.984s cpu time, 6.960s GC time Loading theory "Containers-Benchmarks.Benchmark_RBT" Found termination order: "{}" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" consts the_default :: "'a \ 'a option \ 'a" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" class ccpo = Sup + order + assumes "ccpo_Sup_upper": "\A x. \Complete_Partial_Order.chain (\) A; x \ A\ \ x \ Sup A" assumes "ccpo_Sup_least": "\A z. \Complete_Partial_Order.chain (\) A; \x. x \ A \ x \ z\ \ Sup A \ z" ### theory "Automatic_Refinement.Misc" ### 6.747s elapsed time, 12.896s cpu time, 1.108s GC time Loading theory "Automatic_Refinement.Refine_Lib" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator") Found termination order: "(\p. size (fst (snd (snd p)))) <*mlex*> {}" consts lookup :: "nat \ (natural, unit) rbt \ natural \ natural \ natural \ natural \ natural" ### theory "Containers-Benchmarks.Benchmark_RBT" ### 2.357s elapsed time, 4.640s cpu time, 0.556s GC time Loading theory "Collections.SetIterator" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator" via "Collections.SetIteratorOperations") locale set_iterator_genord fixes iti :: "('\ \ bool) \ ('x \ '\ \ '\) \ '\ \ '\" and S0 :: "'x set" and R :: "'x \ 'x \ bool" assumes "set_iterator_genord iti S0 R" signature COND_REWR_CONV = sig val cond_rewr_conv: tactic -> thm -> Proof.context -> conv val cond_rewrs_conv: tactic -> thm list -> Proof.context -> conv end structure Cond_Rewr_Conv: COND_REWR_CONV signature REVERT_ABBREV = sig val revert_abbrev: string -> theory -> theory val revert_abbrev_matching: (string -> bool) -> theory -> theory end structure Revert_Abbrev: REVERT_ABBREV ### theory "Automatic_Refinement.Refine_Lib" ### 1.360s elapsed time, 2.632s cpu time, 0.556s GC time Loading theory "Automatic_Refinement.Autoref_Phases" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel" via "Automatic_Refinement.Autoref_Id_Ops") signature AUTOREF_PHASES = sig val all_phases_tac: Proof.context -> tactic' val cfg_debug: bool Config.T val cfg_keep_goal: bool Config.T val cfg_trace: bool Config.T val declare_solver: thm list -> binding -> string -> (Proof.context -> tactic') -> morphism -> Context.generic -> Context.generic val delete_phase: string -> morphism -> Context.generic -> Context.generic val get_phase: string -> Proof.context -> (string * int * phase) option val get_phases: Proof.context -> (string * int * phase) list val init_data: Proof.context -> Proof.context val init_phase: string * int * phase -> Proof.context -> Proof.context val init_phases: (string * int * phase) list -> Proof.context -> Proof.context type phase = {analyze: Proof.context -> int -> int -> thm -> bool, init: Proof.context -> Proof.context, pretty_failure: Proof.context -> int -> int -> thm -> Pretty.T, tac: Proof.context -> int -> int -> tactic} val phase_tac: string * int * phase -> Proof.context -> tactic' val phase_tacN: string -> Proof.context -> tactic' val phases_tac: (string * int * phase) list -> Proof.context -> tactic' val phases_tacN: string list -> Proof.context -> tactic' val register_phase: string -> int -> phase -> morphism -> Context.generic -> Context.generic end structure Autoref_Phases: AUTOREF_PHASES ### theory "Automatic_Refinement.Autoref_Phases" ### 0.080s elapsed time, 0.152s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Tagging" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel" via "Automatic_Refinement.Autoref_Id_Ops") structure Autoref_Tag_Defs: NAMED_THMS class linorder = order + assumes "linear": "\x y. x \ y \ y \ x" signature AUTOREF_TAGGING = sig val ABS_beta_conv: Proof.context -> conv val is_valid_tagged: term -> bool val lambda': string * typ -> term -> term val list_APP: term * term list -> term val mk_ABS_conv: Proof.context -> conv val mk_ANNOT_conv: cterm -> conv val mk_APP: term -> term -> term val mk_APP_conv: conv val mk_OP: term -> term val mk_OP_conv: conv val mk_rel_ANNOT_conv: Proof.context -> cterm -> conv val rhs_conv: (Proof.context -> conv) -> Proof.context -> conv val strip_app: term -> term * term list val term_of_tagged: term -> term val untag_conv: Proof.context -> conv end structure Autoref_Tagging: AUTOREF_TAGGING ### theory "Automatic_Refinement.Autoref_Tagging" ### 0.135s elapsed time, 0.268s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Relators" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel" via "Automatic_Refinement.Autoref_Id_Ops" via "Automatic_Refinement.Parametricity" via "Automatic_Refinement.Param_Tool") structure Refine_Relators_Thms: sig structure rel_comb_def_rules: NAMED_THMS end structure relator_props: NAMED_THMS structure solve_relator_props: NAMED_THMS class linorder = order + assumes "linear": "\x y. x \ y \ y \ x" ### ML warning (line 561 of "~~/afp/thys/Automatic_Refinement/Parametricity/Relators.thy"): ### Handler catches all exceptions. signature RELATORS = sig val declare_natural_relator: string * string -> Context.generic -> Context.generic val dest_prodrel: term -> term * term val dest_relT: typ -> typ * typ val is_prodrel: term -> bool val list_prodrel_left: term list -> term val list_rel: term list -> term -> term val list_relAPP: term list -> term -> term val mk_fun_rel: term -> term -> term val mk_natural_relator: Proof.context -> term list -> string -> term option val mk_prodrel: term * term -> term val mk_relAPP: term -> term -> term val mk_relT: typ * typ -> typ val natural_relator_of: Proof.context -> string -> string option val rel_absT: term -> typ val rel_concT: term -> typ val remove_natural_relator: string -> Context.generic -> Context.generic val setup: theory -> theory val strip_prodrel_left: term -> term list val strip_relAPP: term -> term list * term end structure Relators: RELATORS class linorder = order + assumes "linear": "\x y. x \ y \ y \ x" ### theory "Collections.SetIterator" ### 1.308s elapsed time, 2.596s cpu time, 0.000s GC time Loading theory "Collections.SetIteratorOperations" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It" via "Collections.Proper_Iterator") ### theory "Automatic_Refinement.Relators" ### 1.185s elapsed time, 2.332s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Param_Tool" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel" via "Automatic_Refinement.Autoref_Id_Ops" via "Automatic_Refinement.Parametricity") signature PARAMETRICITY = sig val add_dflt: thm -> Context.generic -> Context.generic val add_dflt_attr: attribute val adjust_arity: int -> thm -> thm val adjust_arity_tac: int -> Proof.context -> tactic' val asm_param_tac: Proof.context -> tactic' val cfg_single_step: bool Config.T val cfg_use_asm: bool Config.T val del_dflt: thm -> Context.generic -> Context.generic val del_dflt_attr: attribute val dest_param_goal: int -> thm -> param_ruleT val dest_param_rule: thm -> param_ruleT val dest_param_term: term -> param_ruleT val fo_rule: thm -> thm val get_dflt: Proof.context -> param_net val net_add: thm -> param_net -> param_net val net_add_int: Context.generic -> thm -> param_net -> param_net val net_del: thm -> param_net -> param_net val net_del_int: Context.generic -> thm -> param_net -> param_net val net_empty: param_net val net_tac: param_net -> Proof.context -> tactic' type param_net type param_ruleT = {R: term, arity: int, lhs: term, rhs: term, rhs_head: term} val param_rule_tac: Proof.context -> thm -> tactic' val param_rules_tac: Proof.context -> thm list -> tactic' val prepare_tac: Proof.context -> tactic' val safe_fun_relD_tac: Proof.context -> tactic' val setup: theory -> theory val unlambda_tac: Proof.context -> tactic' end structure Parametricity: PARAMETRICITY val cnv_relAPP = fn: term -> term val to_relAPP_conv = fn: Proof.context -> conv val to_relAPP_attr = fn: attribute ### theory "Automatic_Refinement.Param_Tool" ### 0.237s elapsed time, 0.396s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Param_HOL" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel" via "Automatic_Refinement.Autoref_Id_Ops" via "Automatic_Refinement.Parametricity") locale partial_function_definitions fixes leq :: "'a \ 'a \ bool" and lub :: "'a set \ 'a" assumes "partial_function_definitions leq lub" consts is_Inl :: "'a + 'b \ bool" consts is_Inr :: "'b + 'a \ bool" consts list_all2_alt :: "('a \ 'b \ bool) \ 'a list \ 'b list \ bool" Found termination order: "(\p. length (snd (snd p))) <*mlex*> {}" consts list_all_rec :: "('a \ bool) \ 'a list \ bool" consts list_ex_rec :: "('a \ bool) \ 'a list \ bool" ### theory "Automatic_Refinement.Param_HOL" ### 1.634s elapsed time, 2.652s cpu time, 0.480s GC time Loading theory "Automatic_Refinement.Parametricity" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel" via "Automatic_Refinement.Autoref_Id_Ops") ### theory "Automatic_Refinement.Parametricity" ### 0.024s elapsed time, 0.048s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Id_Ops" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate" via "Automatic_Refinement.Autoref_Fix_Rel") ### theory "Collections.SetIteratorOperations" ### 2.555s elapsed time, 4.388s cpu time, 0.480s GC time Loading theory "Collections.Assoc_List" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.HashSet" via "Collections.HashMap" via "Collections.HashMap_Impl" via "Collections.ListMapImpl") instantiation assoc_list :: (equal, equal) equal equal_assoc_list == equal_class.equal :: ('a, 'b) assoc_list \ ('a, 'b) assoc_list \ bool instantiation assoc_list :: (type, type) size size_assoc_list == size :: ('a, 'b) assoc_list \ nat consts map_ran :: "('key \ 'val \ 'val') \ ('key \ 'val) list \ ('key \ 'val') list" val limit_depth = fn: int -> term -> term val depth_of = fn: term -> int val depth_of_lhs = fn: thm -> int val depth_of_rhs = fn: thm -> int val pretty_rewrite = fn: Proof.context -> thm -> thm -> Pretty.T val index_rewr_thms = fn: thm list -> thm Item_Net.T val net_rewr_tac = fn: thm Item_Net.T -> (term -> term) -> (conv -> 'a -> conv) -> 'a -> tactic' ### theory "Collections.Assoc_List" ### 0.562s elapsed time, 1.124s cpu time, 0.000s GC time Loading theory "Collections.Diff_Array" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ArrayHashSet" via "Collections.ArrayHashMap" via "Collections.ArrayHashMap_Impl") signature AUTOREF_ID_OPS = sig val cfg_ss_id_op: bool Config.T val cfg_trace_failed_id: bool Config.T val cfg_trace_id_tags: bool Config.T val cfg_trace_intf_unif: bool Config.T val cfg_trace_patterns: bool Config.T val cfg_use_id_tags: bool Config.T val decl_derived_typing: bool -> term -> term -> Context.generic -> Context.generic val dest_const_intf: term -> term * term val dest_const_intf_thm: thm -> term * term val has_typ_thms: Proof.context -> term -> bool val id_phase: Autoref_Phases.phase val id_tac: Proof.context -> tactic' val mk_const_intf: term -> term -> term val mk_const_intf_thm: Proof.context -> term -> term -> thm val setup: theory -> theory val typ_thms_of_seq: Proof.context -> term -> thm Seq.seq end structure Autoref_Id_Ops: AUTOREF_ID_OPS signature AUTOREF_REL_INF = sig val cfg_sbias: int Config.T val roi_phase: Autoref_Phases.phase val roi_step_tac: Proof.context -> tactic' val roi_tac: Proof.context -> tactic' val setup: theory -> theory end structure Autoref_Rel_Inf: AUTOREF_REL_INF ### theory "Automatic_Refinement.Autoref_Id_Ops" ### 0.973s elapsed time, 1.948s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Fix_Rel" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool" via "Automatic_Refinement.Autoref_Translate") structure Autoref_Rules: NAMED_THMS ### ML warning (line 351 of "~~/afp/thys/Automatic_Refinement/Tool/Autoref_Fix_Rel.thy"): ### Value identifier (phi) has not been referenced. signature AUTOREF_FIX_REL = sig val add_hom_rule: thm -> Context.generic -> Context.generic val add_tyrel_rule: thm -> Context.generic -> Context.generic val analyze: Proof.context -> int -> int -> thm -> bool val compute_hom_net: thm_pairs -> Proof.context -> hom_net type constraint = (term * term) list * (term * term) val constraint_of_thm: Proof.context -> thm -> constraint val constraints_of_goal: int -> thm -> (term * term) list val constraints_of_term: term -> (term * term) list val declare_prio: string -> term -> prio_relpos -> local_theory -> local_theory val del_hom_rule: thm -> Context.generic -> Context.generic val del_tyrel_rule: thm -> Context.generic -> Context.generic val delete_prio: string -> local_theory -> local_theory val get_hom_rules: Proof.context -> thm list val get_tyrel_rules: Proof.context -> thm list val guess_relators_tac: Proof.context -> itactic type hom_net = (int * thm) Net.net val insert_CONSTRAINTS_tac: Proof.context -> tactic' val insert_tyrel_tac: Proof.context -> int -> int -> tactic' val internal_hom_tac: Proof.context -> itactic val internal_solve_tac: Proof.context -> itactic val internal_spec_tac: Proof.context -> itactic val mk_CONSTRAINT: term * term -> term val mk_CONSTRAINT_rl: Proof.context -> constraint -> thm val phase: Autoref_Phases.phase val pretty_constraint: Proof.context -> constraint -> Pretty.T val pretty_constraints: Proof.context -> constraint list -> Pretty.T val pretty_failure: Proof.context -> int -> int -> thm -> Pretty.T val pretty_thm_pair: Proof.context -> constraint option * thm -> Pretty.T val pretty_thm_pairs: Proof.context -> thm_pairs -> Pretty.T val print_prios: Proof.context -> unit datatype prio_relpos = PR_AFTER of string | PR_BEFORE of string | PR_FIRST | PR_LAST val setup: theory -> theory val solve_step_tac: Proof.context -> tactic' val solve_tyrel_tac: Proof.context -> tactic' type thm_pairs = (constraint option * thm) list val thm_pairsD_get: Proof.context -> thm_pairs val thm_pairsD_init: Proof.context -> Proof.context val try_solve_tac: Proof.context -> tactic' val tyrel_tac: Proof.context -> itactic end structure Autoref_Fix_Rel: AUTOREF_FIX_REL ### theory "Automatic_Refinement.Autoref_Fix_Rel" ### 1.018s elapsed time, 1.580s cpu time, 0.608s GC time Loading theory "Automatic_Refinement.Autoref_Translate" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool") signature AUTOREF_TACTICALS = sig val COND'': (int -> thm -> bool) -> tactic' -> tactic' -> tactic' val IF_SOLVED: tactic' -> tactic' -> tactic' -> tactic' val REPEAT_INTERVAL: tactic' -> itactic val REPEAT_ON_SUBGOAL: tactic' -> tactic' val is_defer_cond: int -> thm -> bool val is_prefer_cond: int -> thm -> bool end signature AUTOREF_TRANSLATE = sig val add_post_rule: thm -> Context.generic -> Context.generic val compute_trans_net: Autoref_Fix_Rel.thm_pairs -> Proof.context -> trans_net val delete_post_rule: thm -> Context.generic -> Context.generic val get_post_rules: Proof.context -> thm list val setup: theory -> theory val side_dbg_tac: Proof.context -> tactic' val side_tac: Proof.context -> tactic' val trans_analyze: Proof.context -> int -> int -> thm -> bool val trans_dbg_step_tac: Proof.context -> tactic' type trans_net = (int * thm) Net.net val trans_phase: Autoref_Phases.phase val trans_pretty_failure: Proof.context -> int -> int -> thm -> Pretty.T val trans_step_only_tac: Proof.context -> tactic' val trans_step_tac: Proof.context -> tactic' val trans_tac: Proof.context -> itactic end structure Autoref_Tacticals: AUTOREF_TACTICALS structure Autoref_Translate: AUTOREF_TRANSLATE ### theory "Automatic_Refinement.Autoref_Translate" ### 0.223s elapsed time, 0.320s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Gen_Algo" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool") structure Autoref_Gen_Algo: sig val decl_setup: morphism -> Context.generic -> Context.generic structure ga_side_thms: NAMED_SORTED_THMS val setup: theory -> theory val side_ga_op_tac: Proof.context -> int -> tactic val side_ga_tac: Proof.context -> int -> tactic val transform_ga_rule: Context.generic -> thm -> thm list end ### theory "Automatic_Refinement.Autoref_Gen_Algo" ### 0.069s elapsed time, 0.124s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Relator_Interface" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement" via "Automatic_Refinement.Autoref_Tool") consts array_length :: "'a array \ nat" consts array_get :: "'a array \ nat \ 'a" consts array_set :: "'a array \ nat \ 'a \ 'a array" consts array_grow :: "'a array \ nat \ 'a \ 'a array" signature AUTOREF_RELATOR_INTERFACE = sig val declare_rel_intf: thm -> Context.generic -> Context.generic val delete_rel_intf: thm -> Context.generic -> Context.generic val get_rel_intfs: Proof.context -> thm list val intf_of_rel: Proof.context -> term -> term val itype_of_rule: Proof.context -> thm -> (term * term) option val list_invented_intf: term -> term list val mk_intfAPP: term -> term -> term val setup: theory -> theory val warn_invented_intf: Proof.context -> term -> unit end structure Autoref_Relator_Interface: AUTOREF_RELATOR_INTERFACE ### theory "Automatic_Refinement.Autoref_Relator_Interface" ### 0.076s elapsed time, 0.128s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Tool" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement") consts array_shrink :: "'a array \ nat \ 'a array" consts list_of_array :: "'a array \ 'a list" consts assoc_list_of_array :: "'a array \ (nat \ 'a) list" ### Rewrite rule not in simpset: ### Wellfounded.accp assoc_list_of_array_code_rel (?a1, ?n1) \ ### assoc_list_of_array_code ?a1 ?n1 \ ### if array_length ?a1 \ ?n1 then [] ### else (?n1, array_get ?a1 ?n1) # assoc_list_of_array_code ?a1 (?n1 + 1) structure Autoref_Debug: sig val print_thm_pairs: Proof.context -> unit val print_thm_pairs_matching: Proof.context -> cterm -> unit end locale autoref_syn ### theory "Automatic_Refinement.Autoref_Tool" ### 0.991s elapsed time, 1.528s cpu time, 0.000s GC time Loading theory "Automatic_Refinement.Autoref_Bindings_HOL" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc" via "Automatic_Refinement.Automatic_Refinement") structure Autoref_Struct_Expand: sig structure autoref_struct_expand: NAMED_THMS val decl_setup: morphism -> Context.generic -> Context.generic val expand_tac: Proof.context -> int -> tactic val setup: theory -> theory end ### Adding overloaded interface type to constant: ?x ::\<^sub>i i_bool ### Adding overloaded interface type to constant: ?x ::\<^sub>i i_bool ### Adding overloaded interface type to constant: ?x ::\<^sub>i i_bool ### Adding overloaded interface type to constant: ?x ::\<^sub>i i_bool Found termination order: "(\p. length (snd (snd p))) <*mlex*> {}" ### Adding overloaded interface type to constant: ?a ::\<^sub>i i_of_rel Id ### theory "Automatic_Refinement.Autoref_Bindings_HOL" ### 6.723s elapsed time, 9.036s cpu time, 5.796s GC time Loading theory "Automatic_Refinement.Automatic_Refinement" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc") ### theory "Automatic_Refinement.Automatic_Refinement" ### 0.057s elapsed time, 0.056s cpu time, 0.000s GC time Loading theory "Collections.Idx_Iterator" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator") Found termination order: "(\p. size (fst (snd (snd p)))) <*mlex*> {}" ### theory "Collections.Idx_Iterator" ### 0.664s elapsed time, 0.580s cpu time, 0.000s GC time Loading theory "Collections.Trie_Impl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.TrieSetImpl" via "Collections.TrieMapImpl" via "Collections.Trie2") Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" ### theory "Collections.Trie_Impl" ### 0.657s elapsed time, 0.588s cpu time, 0.000s GC time Loading theory "Collections.Trie2" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.TrieSetImpl" via "Collections.TrieMapImpl") instantiation trie :: (equal, equal) equal equal_trie == equal_class.equal :: ('a, 'b) trie \ ('a, 'b) trie \ bool ### theory "Collections.Trie2" ### 0.225s elapsed time, 0.228s cpu time, 0.000s GC time Loading theory "Collections.Dlist_add" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ListSetImpl") consts dlist_remove1' :: "'a \ 'a list \ 'a list \ 'a list" ### theory "Collections.Dlist_add" ### 0.338s elapsed time, 0.336s cpu time, 0.000s GC time Loading theory "Collections.Proper_Iterator" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.It_to_It") structure Icf_Proper_Iterator: sig val add: attribute val add_thm: thm -> Context.generic -> Context.generic val del: attribute val del_thm: thm -> Context.generic -> Context.generic val get: Proof.context -> thm list structure icf_proper_iteratorI: NAMED_THMS val setup: theory -> theory end ### theory "Collections.Proper_Iterator" ### 0.762s elapsed time, 0.816s cpu time, 0.260s GC time Loading theory "Collections.It_to_It" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator") locale proper_it_loc fixes it :: "'s \ ('x list \ bool) \ ('x \ 'x list \ 'x list) \ 'x list \ 'x list" and it' :: "'s \ ('\ \ bool) \ ('x \ '\ \ '\) \ '\ \ '\" assumes "proper_it_loc it it'" ### theory "Collections.It_to_It" ### 0.121s elapsed time, 0.124s cpu time, 0.000s GC time Loading theory "Collections.SetIteratorGA" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator") ### theory "Collections.SetIteratorGA" ### 0.705s elapsed time, 0.708s cpu time, 0.000s GC time Loading theory "Collections.Sorted_List_Operations" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ListSetImpl_Sorted") Found termination order: "(\p. length (snd p)) <*mlex*> (\p. length (fst p)) <*mlex*> {}" Found termination order: "(\p. length (snd p)) <*mlex*> (\p. length (fst p)) <*mlex*> {}" Found termination order: "(\p. length (snd p)) <*mlex*> {}" Found termination order: "(\p. length (fst p)) <*mlex*> {}" Found termination order: "(\p. length (snd p)) <*mlex*> {}" Found termination order: "(\p. length (snd p)) <*mlex*> {}" ### theory "Collections.Sorted_List_Operations" ### 0.867s elapsed time, 0.836s cpu time, 0.000s GC time Loading theory "Collections.DatRef" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections") datatype 'a ref = ref of 'a ROOT.ML:13: warning: Value identifier (idx) has not been referenced. structure STArray: sig exception AccessedOldVersion datatype 'a Cell = Invalid | Value of 'a Array.array structure IsabelleMapping: sig type 'a ArrayType = 'a array val array_get: 'a ArrayType -> int -> 'a val array_grow: 'a ArrayType -> int -> 'a -> 'a Cell ref val array_length: 'a ArrayType -> int val array_of_list: 'a list -> 'a Cell ref val array_set: 'a ArrayType -> int -> 'a -> 'a Cell ref val array_shrink: 'a ArrayType -> int -> 'a Cell ref val new_array: 'a -> int -> 'a Cell ref end val array: int * 'a -> 'a Cell ref type 'a array = 'a Cell ref val fromList: 'a list -> 'a Cell ref val grow: 'a Cell ref * int * 'a -> 'a Cell ref val length: 'a Cell ref -> int val shrink: 'a Cell ref * int -> 'a Cell ref val sub: 'a Cell ref * int -> 'a val tabulate: int * (int -> 'a) -> 'a Cell ref val update: 'a Cell ref * int * 'a -> 'a Cell ref end ROOT.ML:86: warning: Value identifier (v) has not been referenced. ROOT.ML:86: warning: Value identifier (i) has not been referenced. ROOT.ML:102: warning: Matches are not exhaustive. Found near case res of (Unsynchronized.ref (Value a)) => (Array.update (a, ...); res) ROOT.ML:109: warning: Value identifier (cr) has not been referenced. ROOT.ML:109: warning: Value identifier (i) has not been referenced. ROOT.ML:123: warning: Matches are not exhaustive. Found near case ra of (Unsynchronized.ref (Value a)) => Array.update (a, idx, ...) structure FArray: sig datatype 'a Cell = Upd of int * 'a * 'a Cell ref | Value of 'a Array.array structure IsabelleMapping: sig type 'a ArrayType = 'a array val array_get: 'a ArrayType -> int -> 'a val array_get_oo: 'a -> 'a ArrayType -> int -> 'a val array_grow: 'a ArrayType -> int -> 'a -> 'a Cell ref val array_length: 'a ArrayType -> int val array_of_list: 'a list -> 'a Cell ref val array_set: 'a ArrayType -> int -> 'a -> 'a Cell ref val array_set_oo: (unit -> 'a ArrayType) -> 'a ArrayType -> int -> 'a -> 'a Cell ref val array_shrink: 'a ArrayType -> int -> 'a Cell ref val new_array: 'a -> int -> 'a Cell ref end val array: int * 'a -> 'a Cell ref type 'a array = 'a Cell ref val fromList: 'a list -> 'a Cell ref val grow: 'a Cell ref * int * 'a -> 'a Cell ref val length: 'a Cell ref -> int val realize: 'a Cell ref -> 'a Cell ref val realize_aux: 'a Cell ref * 'a -> 'a Cell ref val shrink: 'a Cell ref * int -> 'a Cell ref val sub: 'a Cell ref * int -> 'a val tabulate: int * (int -> 'a) -> 'a Cell ref val update: 'a Cell ref * int * 'a -> 'a Cell ref end structure Generated_Code: sig val test_diffarray_setup: ('a list -> 'a FArray.IsabelleMapping.ArrayType) * (('b -> int -> 'b FArray.IsabelleMapping.ArrayType) * (('c FArray.IsabelleMapping.ArrayType -> int) * (('d FArray.IsabelleMapping.ArrayType -> int -> 'd) * (('e FArray.IsabelleMapping.ArrayType -> int -> 'e -> 'e FArray.IsabelleMapping.ArrayType) * (('f FArray.IsabelleMapping.ArrayType -> int -> 'f -> 'f FArray.IsabelleMapping.ArrayType) * (('g FArray.IsabelleMapping.ArrayType -> int -> 'g FArray.IsabelleMapping.ArrayType) * (('h list -> 'h FArray.IsabelleMapping.ArrayType) * (('i -> 'i FArray.IsabelleMapping.ArrayType -> ...) * (... -> ...))))))))) end locale while_algo fixes WA :: "'S while_algo" assumes "while_algo WA" locale wa_refine fixes WAC :: "'C while_algo" and WAA :: "'A while_algo" and \ :: "'C \ 'A" assumes "wa_refine WAC WAA \" locale wa_precise_refine fixes WAC :: "'C while_algo" and WAA :: "'A while_algo" and \ :: "'C \ 'A" assumes "wa_precise_refine WAC WAA \" ### theory "Collections.Diff_Array" ### 14.581s elapsed time, 18.292s cpu time, 6.664s GC time Loading theory "Native_Word.Code_Target_Bits_Int" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.HashSet" via "Collections.HashMap" via "Collections.HashMap_Impl" via "Collections.Code_Target_ICF") locale det_while_algo fixes WA :: "'S det_while_algo" assumes "det_while_algo WA" ### theory "Collections.DatRef" ### 1.037s elapsed time, 1.284s cpu time, 0.000s GC time Loading theory "Containers-Benchmarks.Benchmark_Set" (required by "Containers-Benchmarks.Benchmark_Set_Default") ### theory "Native_Word.Code_Target_Bits_Int" ### 0.255s elapsed time, 0.508s cpu time, 0.000s GC time Loading theory "Collections.Code_Target_ICF" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.HashSet" via "Collections.HashMap" via "Collections.HashMap_Impl") instantiation word :: (len) card_UNIV card_UNIV_word == card_UNIV_class.card_UNIV :: ('a word, nat) phantom finite_UNIV_word == finite_UNIV :: ('a word, bool) phantom ### theory "Collections.Code_Target_ICF" ### 0.280s elapsed time, 0.544s cpu time, 0.000s GC time Loading theory "Containers-Benchmarks.Benchmark_Bool" ### theory "Containers-Benchmarks.Benchmark_Bool" ### 0.093s elapsed time, 0.176s cpu time, 0.000s GC time Loading theory "Containers-Benchmarks.Benchmark_LC" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" Found termination order: "(\p. size (fst (snd (snd p)))) <*mlex*> {}" consts lookup :: "nat \ nat \ 32 word set set \ natural \ natural \ nat \ natural \ natural" ### theory "Containers-Benchmarks.Benchmark_Set" ### 1.998s elapsed time, 3.488s cpu time, 0.556s GC time Loading theory "Containers-Benchmarks.Benchmark_Set_Default" ### theory "Containers-Benchmarks.Benchmark_Set_Default" ### 1.119s elapsed time, 2.108s cpu time, 0.000s GC time Loading theory "Containers-Benchmarks.Benchmark_Set_LC" instantiation word :: (len0) ceq ceq_word == ceq :: ('a word \ 'a word \ bool) option instantiation word :: (len0) compare compare_word == compare :: 'a word \ 'a word \ order instantiation word :: (len0) ccompare ccompare_word == ccompare :: ('a word \ 'a word \ order) option instantiation word :: (len0) set_impl set_impl_word == set_impl :: ('a word, set_impl) phantom instantiation word :: (len) proper_interval proper_interval_word == proper_interval :: 'a word option \ 'a word option \ bool Found termination order: "{}" instantiation word :: (len) cproper_interval cproper_interval_word == cproper_interval :: 'a word option \ 'a word option \ bool ### theory "Containers-Benchmarks.Benchmark_LC" ### 4.226s elapsed time, 7.812s cpu time, 0.844s GC time Loading theory "Containers-Benchmarks.Clauses" instantiation word :: (len0) cenum cEnum_word == cEnum :: ('a word list \ (('a word \ bool) \ bool) \ (('a word \ bool) \ bool)) option consts eval_bexp :: "(nat \ bool) \ bexp \ bool" ### theory "Containers-Benchmarks.Clauses" ### 1.127s elapsed time, 2.260s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_Chapter" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") ### theory "Refine_Monadic.Refine_Chapter" ### 0.022s elapsed time, 0.044s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_Mono_Prover" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.Refine_Misc") signature REFINE_MONO_PROVER = sig val add_mono_thm: thm -> Context.generic -> Context.generic val decl_setup: morphism -> Context.generic -> Context.generic val declare_mono_triggers: thm list -> morphism -> Context.generic -> Context.generic val del_mono_thm: thm -> Context.generic -> Context.generic val gen_split_cases_tac: pat_extractor -> Proof.context -> tactic' val get_mono_thms: Proof.context -> thm list val mono_tac: Proof.context -> tactic' type pat_extractor = term -> (term * ((Proof.context -> conv) -> Proof.context -> conv)) option val setup: theory -> theory val split_cases_tac: Proof.context -> tactic' val untriggered_mono_tac: Proof.context -> tactic' end structure Refine_Mono_Prover: REFINE_MONO_PROVER locale mono_setup_loc fixes le :: "'a \ 'a \ bool" assumes "mono_setup_loc le" ### theory "Refine_Monadic.Refine_Mono_Prover" ### 0.110s elapsed time, 0.220s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_Misc" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic") ### Ignoring duplicate rewrite rule: ### SUP x:insert ?a1 ?A1. ?f1 x \ sup (?f1 ?a1) (SUPREMUM ?A1 ?f1) locale galois_connection fixes \ :: "'a \ 'b" and \ :: "'b \ 'a" assumes "galois_connection \ \" ### Ignoring duplicate rewrite rule: ### map_to_set Map.empty \ {} ### theory "Refine_Monadic.Refine_Misc" ### 0.707s elapsed time, 1.416s cpu time, 0.000s GC time Loading theory "Refine_Monadic.RefineG_Domain" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.RefineG_Recursion") ### theory "Refine_Monadic.RefineG_Domain" ### 0.645s elapsed time, 1.212s cpu time, 0.368s GC time Loading theory "Refine_Monadic.RefineG_Transfer" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic" via "Refine_Monadic.RefineG_Recursion") structure RefineG_Transfer: sig structure Post_Processors: THEORY_DATA structure Post_Simp: GENERIC_DATA val add_post_processor: Symtab.key -> (Proof.context -> tactic') -> theory -> theory val add_post_simps: thm list -> Context.generic -> Context.generic val align_tac: Proof.context -> tactic' val del_post_simps: thm list -> Context.generic -> Context.generic val delete_post_processor: Symtab.key -> theory -> theory val get_post_processors: theory -> (Symtab.key * (Proof.context -> tactic')) list val get_post_simp_rules: Context.generic -> thm list val get_post_ss: Proof.context -> Proof.context val post_process_tac: Proof.context -> tactic' val post_simps_op: (Proof.context * 'a -> Proof.context) -> 'a -> Context.generic -> Context.generic structure post_subst: NAMED_THMS val post_subst_tac: Proof.context -> int -> tactic val post_transfer_tac: thm list -> Proof.context -> int -> tactic val setup: theory -> theory structure transfer: NAMED_THMS val transfer_tac: thm list -> Proof.context -> int -> thm -> thm Seq.seq end locale transfer fixes \ :: "'c \ 'a" locale ordered_transfer fixes \ :: "'c \ 'a" locale dist_transfer fixes \ :: "'c \ 'a" assumes "dist_transfer \" locale ccpo_transfer fixes \ :: "'c \ 'a" locale dist_ccpo_transfer fixes \ :: "'c \ 'a" assumes "dist_ccpo_transfer \" ### theory "Refine_Monadic.RefineG_Transfer" ### 0.213s elapsed time, 0.424s cpu time, 0.000s GC time Loading theory "Refine_Monadic.RefineG_Assert" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic") locale generic_Assert fixes bind :: "'mu \ (unit \ 'ma) \ 'ma" and return :: "unit \ 'mu" and ASSERT :: "bool \ 'mu" and ASSUME :: "bool \ 'mu" assumes "generic_Assert bind return ASSERT ASSUME" locale transfer_generic_Assert fixes cbind :: "'muc \ (unit \ 'mac) \ 'mac" and creturn :: "unit \ 'muc" and cASSERT :: "bool \ 'muc" and cASSUME :: "bool \ 'muc" and abind :: "'mua \ (unit \ 'maa) \ 'maa" and areturn :: "unit \ 'mua" and aASSERT :: "bool \ 'mua" and aASSUME :: "bool \ 'mua" and \ :: "'mac \ 'maa" assumes "transfer_generic_Assert cbind creturn cASSERT cASSUME abind areturn aASSERT aASSUME" locale transfer_generic_Assert_remove fixes abind :: "'mua \ (unit \ 'maa) \ 'maa" and areturn :: "unit \ 'mua" and aASSERT :: "bool \ 'mua" and aASSUME :: "bool \ 'mua" and \ :: "'mac \ 'maa" assumes "transfer_generic_Assert_remove abind areturn aASSERT aASSUME" ### theory "Refine_Monadic.RefineG_Assert" ### 0.162s elapsed time, 0.324s cpu time, 0.000s GC time Loading theory "Refine_Monadic.RefineG_Recursion" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Basic") ### Ignoring duplicate rewrite rule: ### flat_ord ?b1 ?b1 ?x1 \ True ### theory "Refine_Monadic.RefineG_Recursion" ### 0.492s elapsed time, 0.888s cpu time, 0.000s GC time Loading theory "Refine_Monadic.RefineG_While" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_While") locale generic_WHILE fixes bind :: "'m \ ('a \ 'm) \ 'm" and return :: "'a \ 'm" and WHILEIT :: "('a \ bool) \ ('a \ bool) \ ('a \ 'm) \ 'a \ 'm" and WHILEI :: "('a \ bool) \ ('a \ bool) \ ('a \ 'm) \ 'a \ 'm" and WHILET :: "('a \ bool) \ ('a \ 'm) \ 'a \ 'm" and WHILE :: "('a \ bool) \ ('a \ 'm) \ 'a \ 'm" assumes "generic_WHILE bind return WHILEIT WHILEI WHILET WHILE" locale transfer_WHILE fixes cbind :: "'mc \ ('a \ 'mc) \ 'mc" and creturn :: "'a \ 'mc" and cWHILEIT :: "('a \ bool) \ ('a \ bool) \ ('a \ 'mc) \ 'a \ 'mc" and cWHILEI :: "('a \ bool) \ ('a \ bool) \ ('a \ 'mc) \ 'a \ 'mc" and cWHILET :: "('a \ bool) \ ('a \ 'mc) \ 'a \ 'mc" and cWHILE :: "('a \ bool) \ ('a \ 'mc) \ 'a \ 'mc" and abind :: "'ma \ ('a \ 'ma) \ 'ma" and areturn :: "'a \ 'ma" and aWHILEIT :: "('a \ bool) \ ('a \ bool) \ ('a \ 'ma) \ 'a \ 'ma" and aWHILEI :: "('a \ bool) \ ('a \ bool) \ ('a \ 'ma) \ 'a \ 'ma" and aWHILET :: "('a \ bool) \ ('a \ 'ma) \ 'a \ 'ma" and aWHILE :: "('a \ bool) \ ('a \ 'ma) \ 'a \ 'ma" and \ :: "'mc \ 'ma" assumes "transfer_WHILE cbind creturn cWHILEIT cWHILEI cWHILET cWHILE abind areturn aWHILEIT aWHILEI aWHILET aWHILE \" locale generic_WHILE_rules fixes bind :: "'a \ ('b \ 'a) \ 'a" and return :: "'b \ 'a" and SPEC :: "('b \ bool) \ 'a" and WHILEIT :: "('b \ bool) \ ('b \ bool) \ ('b \ 'a) \ 'b \ 'a" and WHILEI :: "('b \ bool) \ ('b \ bool) \ ('b \ 'a) \ 'b \ 'a" and WHILET :: "('b \ bool) \ ('b \ 'a) \ 'b \ 'a" and WHILE :: "('b \ bool) \ ('b \ 'a) \ 'b \ 'a" assumes "generic_WHILE_rules bind return SPEC WHILEIT WHILEI WHILET WHILE" ### theory "Refine_Monadic.RefineG_While" ### 0.545s elapsed time, 0.980s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_Det" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Foreach" via "Refine_Monadic.Refine_Pfun") ### theory "Containers-Benchmarks.Benchmark_Set_LC" ### 6.636s elapsed time, 12.684s cpu time, 0.968s GC time Loading theory "Refine_Monadic.Refine_Basic" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") instantiation dres :: (type) complete_lattice Inf_dres == Inf :: 'a dres set \ 'a dres Sup_dres == Sup :: 'a dres set \ 'a dres bot_dres == bot :: 'a dres sup_dres == sup :: 'a dres \ 'a dres \ 'a dres top_dres == top :: 'a dres inf_dres == inf :: 'a dres \ 'a dres \ 'a dres less_eq_dres == less_eq :: 'a dres \ 'a dres \ bool less_dres == less :: 'a dres \ 'a dres \ bool Found termination order: "{}" Found termination order: "{}" Found termination order: "{}" instantiation nres :: (type) complete_lattice Inf_nres == Inf :: 'a nres set \ 'a nres Sup_nres == Sup :: 'a nres set \ 'a nres bot_nres == bot :: 'a nres sup_nres == sup :: 'a nres \ 'a nres \ 'a nres top_nres == top :: 'a nres inf_nres == inf :: 'a nres \ 'a nres \ 'a nres less_eq_nres == less_eq :: 'a nres \ 'a nres \ bool less_nres == less :: 'a nres \ 'a nres \ bool Found termination order: "{}" Found termination order: "{}" ### theory "Refine_Monadic.Refine_Det" ### 2.549s elapsed time, 4.580s cpu time, 0.312s GC time Found termination order: "{}" Found termination order: "{}" val mk_2elem_list = fn: term -> term -> term val mk_compr = fn: term -> term -> term val test1 = "[1, 2]": cterm val test2 = "{x \ {1, 2, 3}. 2 < x}": cterm val test3 = Const ("Groups.plus_class.plus", "nat \ nat \ nat") $ Bound 0 $ Bound 0: term val dest_pair_singleton = fn: term -> term val dest_nat_pair_singleton = fn: term -> term * term val dest_pair_singleton_T = fn: term -> (term * typ) * (term * typ) val dest_pair_lambda = fn: term -> string * typ * string * typ * term * term val foo = fn: term -> term * term * int * term * term val it = fn: (theory -> theory) -> (Proof.context -> Proof.context) -> Context.generic -> Context.generic "True" :: "bool" Found termination order: "size <*mlex*> {}" structure refine_pw_simps: NAMED_THMS Found termination order: "(\p. length (fst p)) <*mlex*> {}" ### Introduced fixed type variable(s): 'd in "ks__" ### No equation for constructor "FAILi" consts the_RES :: "'a nres \ 'a set" structure Refine: sig val no_prod_split: bool Config.T val post_tac: Proof.context -> tactic' val rcg_tac: thm list -> Proof.context -> tactic' structure refine: NAMED_THMS structure refine0: NAMED_THMS structure refine2: NAMED_THMS structure vcg: NAMED_THMS structure vcg_cons: NAMED_THMS end ### theory "Refine_Monadic.Refine_Basic" ### 3.649s elapsed time, 6.716s cpu time, 0.576s GC time Loading theory "Refine_Monadic.Refine_Heuristics" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") Loading theory "Refine_Monadic.Refine_Leof" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") structure refine_heuristics_simps: NAMED_THMS ### ML warning (line 65 of "~~/afp/thys/Refine_Monadic/Refine_Heuristics.thy"): ### Value identifier (ctxt) has not been referenced. structure Refine_dref_type: sig structure RELATES_rules: NAMED_THMS val has_schematic: term -> bool val match_goal_shape_tac: (term -> bool) -> Proof.context -> int -> thm -> thm Seq.seq val output_failed_msg: Proof.context -> term -> unit structure pattern_rules: NAMED_THMS val tracing: bool Config.T val type_tac: Proof.context -> tactic end ### theory "Refine_Monadic.Refine_Heuristics" ### 0.151s elapsed time, 0.280s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_Pfun" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Foreach") ### theory "Refine_Monadic.Refine_Leof" ### 0.181s elapsed time, 0.340s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_More_Comb" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") ### theory "Refine_Monadic.Refine_More_Comb" ### 0.245s elapsed time, 0.484s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_While" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") ### theory "Refine_Monadic.Refine_Pfun" ### 0.307s elapsed time, 0.608s cpu time, 0.000s GC time Proofs for inductive predicate(s) "rwof" Proving monotonicity ... Proving the introduction rules ... Proving the elimination rules ... Proving the induction rule ... Proving the simplification rules ... consts bounded_WHILE' :: "nat \ ('a \ bool) \ ('a \ 'a nres) \ 'a nres \ 'a nres" consts bounded_WHILE :: "nat \ ('a \ bool) \ ('a \ 'a nres) \ 'a nres \ 'a nres" ### theory "Refine_Monadic.Refine_While" ### 1.694s elapsed time, 3.100s cpu time, 0.340s GC time Loading theory "Refine_Monadic.Refine_Transfer" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic" via "Refine_Monadic.Refine_Foreach") ### Missing patterns in function definition: ### the_res dSUCCEEDi = undefined ### the_res dFAILi = undefined Found termination order: "{}" ### theory "Refine_Monadic.Refine_Transfer" ### 0.475s elapsed time, 0.844s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Autoref_Monadic" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") structure Autoref_Monadic: sig val autoref_monadic_tac: Proof.context -> int -> tactic val cfg_plain: bool Config.T end ### theory "Refine_Monadic.Autoref_Monadic" ### 0.049s elapsed time, 0.100s cpu time, 0.000s GC time Loading theory "Refine_Monadic.Refine_Automation" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") Loading theory "Refine_Monadic.Refine_Foreach" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator" via "Refine_Monadic.Refine_Monadic") signature REFINE_AUTOMATION = sig val add_cd_pattern: cterm -> Context.generic -> Context.generic val add_extraction: string -> extraction -> theory -> theory val add_vc_rec_thm: thm -> Context.generic -> Context.generic val add_vc_solve_thm: thm -> Context.generic -> Context.generic val define_concrete_fun: extraction list option -> binding -> Token.src list -> indexname list -> thm -> cterm list -> local_theory -> (thm * thm) * local_theory val del_cd_pattern: cterm -> Context.generic -> Context.generic val del_vc_rec_thm: thm -> Context.generic -> Context.generic val del_vc_solve_thm: thm -> Context.generic -> Context.generic val extract_as_def: (string * typ) list -> string -> term -> local_theory -> (term * thm) * local_theory val extract_recursion_eqs: extraction list -> string -> thm -> local_theory -> local_theory type extraction = {gen_tac: local_theory -> tactic', gen_thm: thm, pattern: term} val get_cd_patterns: Proof.context -> cterm list val get_vc_rec_thms: Proof.context -> thm list val get_vc_solve_thms: Proof.context -> thm list val mk_qualified: string -> bstring -> binding val prepare_cd_pattern: Proof.context -> cterm -> cterm val prepare_code_thms_cmd: string list -> thm -> local_theory -> local_theory val setup: theory -> theory val vc_solve_modifiers: Method.modifier parser list val vc_solve_tac: Proof.context -> bool -> tactic' end structure Refine_Automation: REFINE_AUTOMATION val it = (): unit val it = (): unit ### theory "Refine_Monadic.Refine_Automation" ### 0.225s elapsed time, 0.448s cpu time, 0.000s GC time locale trimono_spec ### theory "Refine_Monadic.Refine_Foreach" ### 3.067s elapsed time, 5.064s cpu time, 0.300s GC time Loading theory "Refine_Monadic.Refine_Monadic" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator" via "Collections.Gen_Iterator") locale Refine_Monadic_Syntax ### theory "Refine_Monadic.Refine_Monadic" ### 0.994s elapsed time, 1.988s cpu time, 0.000s GC time Loading theory "Collections.Gen_Iterator" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base" via "Collections.Iterator") Loading theory "Collections.Intf_Map" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Autoref") ### theory "Collections.Intf_Map" ### 0.406s elapsed time, 0.816s cpu time, 0.000s GC time Loading theory "Collections.Intf_Set" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Autoref") ### theory "Collections.Gen_Iterator" ### 0.945s elapsed time, 1.660s cpu time, 0.248s GC time Loading theory "Collections.Iterator" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec" via "Collections.ICF_Spec_Base") ### theory "Collections.Intf_Set" ### 0.758s elapsed time, 1.260s cpu time, 0.248s GC time ### Ignoring duplicate rewrite rule: ### toList (?a1 \ ?t1) \ ?a1 # toList ?t1 ### Ignoring duplicate rewrite rule: ### toList (?a1 \ ?t1) \ ?a1 # toList ?t1 ### theory "Collections.Iterator" ### 0.633s elapsed time, 1.244s cpu time, 0.000s GC time Loading theory "Collections.Array_Iterator" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ArrayHashSet" via "Collections.ArrayHashMap" via "Collections.ArrayHashMap_Impl") Loading theory "Collections.ICF_Spec_Base" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetSpec") ### theory "Collections.Array_Iterator" ### 0.240s elapsed time, 0.480s cpu time, 0.000s GC time Loading theory "Collections.RBT_add" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.RBTSetImpl" via "Collections.RBTMapImpl") ### theory "Collections.ICF_Spec_Base" ### 0.350s elapsed time, 0.700s cpu time, 0.000s GC time Loading theory "Collections.AnnotatedListSpec" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale al fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" locale al_no_invar fixes \ :: "'a \ ('b \ 'c) list" and invar :: "'a \ bool" assumes "al_no_invar invar" locale al_empty fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and empty :: "unit \ 's" assumes "al_empty \ invar empty" locale al_isEmpty fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and isEmpty :: "'s \ bool" assumes "al_isEmpty \ invar isEmpty" locale al_count fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and count :: "'s \ nat" assumes "al_count \ invar count" locale al_consl fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and consl :: "'e \ 'a \ 's \ 's" assumes "al_consl \ invar consl" locale al_consr fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and consr :: "'s \ 'e \ 'a \ 's" assumes "al_consr \ invar consr" locale al_head fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and head :: "'s \ 'e \ 'a" assumes "al_head \ invar head" locale al_tail fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and tail :: "'s \ 's" assumes "al_tail \ invar tail" locale al_headR fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and headR :: "'s \ 'e \ 'a" assumes "al_headR \ invar headR" locale al_tailR fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and tailR :: "'s \ 's" assumes "al_tailR \ invar tailR" locale al_foldl fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and foldl :: "('z \ 'e \ 'a \ 'z) \ 'z \ 's \ 'z" assumes "al_foldl \ invar foldl" locale al_foldr fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and foldr :: "('e \ 'a \ 'z \ 'z) \ 's \ 'z \ 'z" assumes "al_foldr \ invar foldr" locale poly_al_fold fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" locale al_app fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and app :: "'s \ 's \ 's" assumes "al_app \ invar app" locale al_annot fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and annot :: "'s \ 'a" assumes "al_annot \ invar annot" locale al_splits fixes \ :: "'s \ ('e \ 'a) list" and invar :: "'s \ bool" and splits :: "('a \ bool) \ 'a \ 's \ 's \ ('e \ 'a) \ 's" assumes "al_splits \ invar splits" consts rm_iterateoi :: "('k, 'v) rbt \ ('\ \ bool) \ ('k \ 'v \ '\ \ '\) \ '\ \ '\" consts rm_reverse_iterateoi :: "('k, 'v) rbt \ ('\ \ bool) \ ('k \ 'v \ '\ \ '\) \ '\ \ '\" consts bheight_aux :: "('a, 'b) rbt \ nat \ nat" ### theory "Collections.RBT_add" ### 1.131s elapsed time, 2.268s cpu time, 0.000s GC time Loading theory "Collections.ListSpec" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale list fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" locale list_no_invar fixes \ :: "'a \ 'b list" and invar :: "'a \ bool" assumes "list_no_invar invar" locale list_empty fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and empty :: "unit \ 's" assumes "list_empty \ invar empty" locale list_isEmpty fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and isEmpty :: "'s \ bool" assumes "list_isEmpty \ invar isEmpty" locale poly_list_iteratei fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" locale poly_list_rev_iteratei fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" locale list_size fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and size :: "'s \ nat" assumes "list_size \ invar size" locale list_appendl fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and appendl :: "'x \ 's \ 's" assumes "list_appendl \ invar appendl" locale list_removel fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and removel :: "'s \ 'x \ 's" assumes "list_removel \ invar removel" locale list_leftmost fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and leftmost :: "'s \ 'x" assumes "list_leftmost \ invar leftmost" locale list_appendr fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and appendr :: "'x \ 's \ 's" assumes "list_appendr \ invar appendr" locale list_remover fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and remover :: "'s \ 's \ 'x" assumes "list_remover \ invar remover" locale list_rightmost fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and rightmost :: "'s \ 'x" assumes "list_rightmost \ invar rightmost" locale list_get fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and get :: "'s \ nat \ 'x" assumes "list_get \ invar get" locale list_set fixes \ :: "'s \ 'x list" and invar :: "'s \ bool" and set :: "'s \ nat \ 'x \ 's" assumes "list_set \ invar set" locale StdALDefs fixes ops :: "('e, 'a, 's, 'more) alist_ops_scheme" locale StdAL fixes ops :: "('a, 'b, 'c, 'd) alist_ops_scheme" assumes "StdAL ops" locale StdAL_no_invar fixes ops :: "('a, 'b, 'c, 'd) alist_ops_scheme" assumes "StdAL_no_invar ops" ### theory "Collections.AnnotatedListSpec" ### 2.025s elapsed time, 4.060s cpu time, 0.000s GC time Loading theory "Collections.FTAnnotatedListImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale StdListDefs fixes ops :: "('a, 's, 'more) list_ops_scheme" locale StdList fixes ops :: "('a, 's, 'more) list_ops_scheme" assumes "StdList ops" locale StdList_no_invar fixes ops :: "('a, 'b, 'c) list_ops_scheme" assumes "StdList_no_invar ops" ### theory "Collections.ListSpec" ### 2.008s elapsed time, 3.960s cpu time, 0.828s GC time Loading theory "Collections.ListGA" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ArrayHashSet" via "Collections.ArrayHashMap" via "Collections.ArrayHashMap_Impl") locale idx_iteratei_loc fixes \ :: "'s \ 'a list" and invar :: "'s \ bool" and size :: "'s \ nat" and get :: "'s \ nat \ 'a" assumes "idx_iteratei_loc \ invar size get" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" locale it_size_loc fixes \ :: "'s \ 'a list" and invar :: "'s \ bool" locale rev_it_size_loc fixes \ :: "'s \ 'a list" and invar :: "'s \ bool" locale it_get_loc fixes \ :: "'s \ 'a list" and invar :: "'s \ bool" ### theory "Collections.ListGA" ### 0.574s elapsed time, 1.148s cpu time, 0.000s GC time Loading theory "Collections.Fifo" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") structure Arith : sig type 'a plus val plus : 'a plus -> 'a -> 'a -> 'a type 'a semigroup_add val plus_semigroup_add : 'a semigroup_add -> 'a plus type 'a zero val zero : 'a zero -> 'a type 'a monoid_add val semigroup_add_monoid_add : 'a monoid_add -> 'a semigroup_add val zero_monoid_add : 'a monoid_add -> 'a zero datatype nat = Zero_nat | Suc of nat val one_nat : nat val plus_nat : nat -> nat -> nat end = struct type 'a plus = {plus : 'a -> 'a -> 'a}; val plus = #plus : 'a plus -> 'a -> 'a -> 'a; type 'a semigroup_add = {plus_semigroup_add : 'a plus}; val plus_semigroup_add = #plus_semigroup_add : 'a semigroup_add -> 'a plus; type 'a zero = {zero : 'a}; val zero = #zero : 'a zero -> 'a; type 'a monoid_add = {semigroup_add_monoid_add : 'a semigroup_add, zero_monoid_add : 'a zero}; val semigroup_add_monoid_add = #semigroup_add_monoid_add : 'a monoid_add -> 'a semigroup_add; val zero_monoid_add = #zero_monoid_add : 'a monoid_add -> 'a zero; datatype nat = Zero_nat | Suc of nat; val one_nat : nat = Suc Zero_nat; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; end; (*struct Arith*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure FingerTree : sig type ('a, 'b) fingerTreeStruc type ('b, 'a) splitres type ('b, 'a) fingerTree val app : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree val head : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> 'a * 'b val tail : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree val annot : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> 'b val count : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> Arith.nat val empty : 'b Arith.monoid_add -> ('a, 'b) fingerTree val foldl : 'c Arith.monoid_add -> ('a -> 'b * 'c -> 'a) -> 'a -> ('b, 'c) fingerTree -> 'a val foldr : 'b Arith.monoid_add -> ('a * 'b -> 'c -> 'c) -> ('a, 'b) fingerTree -> 'c -> 'c val headR : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> 'a * 'b val lcons : 'b Arith.monoid_add -> 'a * 'b -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree val rcons : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> 'a * 'b -> ('a, 'b) fingerTree val tailR : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree val isEmpty : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> bool val splitTree : 'a Arith.monoid_add -> ('a -> bool) -> 'a -> ('b, 'a) fingerTree -> ('b, 'a) fingerTree * (('b * 'a) * ('b, 'a) fingerTree) end = struct datatype ('a, 'b) node = Tip of 'a * 'b | Node2 of 'b * ('a, 'b) node * ('a, 'b) node | Node3 of 'b * ('a, 'b) node * ('a, 'b) node * ('a, 'b) node; datatype ('a, 'b) digit = One of ('a, 'b) node | Two of ('a, 'b) node * ('a, 'b) node | Three of ('a, 'b) node * ('a, 'b) node * ('a, 'b) node | Four of ('a, 'b) node * ('a, 'b) node * ('a, 'b) node * ('a, 'b) node; datatype ('a, 'b) fingerTreeStruc = Empty | Single of ('a, 'b) node | Deep of 'b * ('a, 'b) digit * ('a, 'b) fingerTreeStruc * ('a, 'b) digit; datatype ('b, 'a) splitres = Abs_splitres of (('b, 'a) fingerTreeStruc * (('b * 'a) * ('b, 'a) fingerTreeStruc)); datatype ('b, 'a) fingerTree = Abs_FingerTree of ('b, 'a) fingerTreeStruc; fun rep_splitres A_ (Abs_splitres x) = x; fun extract_splitres_r B_ r = Abs_FingerTree let val (_, (_, ra)) = rep_splitres B_ r; in ra end; fun extract_splitres_l B_ r = Abs_FingerTree let val (l, (_, _)) = rep_splitres B_ r; in l end; fun extract_splitres_a B_ r = let val (_, a) = rep_splitres B_ r; val (aa, _) = a; in aa end; fun extract_splitres B_ r = (extract_splitres_l B_ r, (extract_splitres_a B_ r, extract_splitres_r B_ r)); fun rep_FingerTree A_ (Abs_FingerTree x) = x; fun digitToNlist (One a) = [a] | digitToNlist (Two (a, b)) = [a, b] | digitToNlist (Three (a, b, c)) = [a, b, c] | digitToNlist (Four (a, b, c, d)) = [a, b, c, d]; fun gmn B_ (Tip (e, a)) = a | gmn B_ (Node2 (a, uu, uv)) = a | gmn B_ (Node3 (a, uw, ux, uy)) = a; fun node3 B_ nd1 nd2 nd3 = Node3 (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ nd1) (gmn B_ nd2)) (gmn B_ nd3), nd1, nd2, nd3); fun gmft B_ Empty = Arith.zero (Arith.zero_monoid_add B_) | gmft B_ (Single nd) = gmn B_ nd | gmft B_ (Deep (a, uu, uv, uw)) = a; fun gmd B_ (One a) = gmn B_ a | gmd B_ (Two (a, b)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b) | gmd B_ (Three (a, b, c)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b)) (gmn B_ c) | gmd B_ (Four (a, b, c, d)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b)) (gmn B_ c)) (gmn B_ d); fun deep B_ pr m sf = Deep (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmd B_ pr) (gmft B_ m)) (gmd B_ sf), pr, m, sf); fun nrcons B_ Empty a = Single a | nrcons B_ (Single b) a = deep B_ (One b) Empty (One a) | nrcons B_ (Deep (uu, pr, m, One b)) a = deep B_ pr m (Two (b, a)) | nrcons B_ (Deep (uv, pr, m, Two (b, c))) a = deep B_ pr m (Three (b, c, a)) | nrcons B_ (Deep (uw, pr, m, Three (b, c, d))) a = deep B_ pr m (Four (b, c, d, a)) | nrcons B_ (Deep (ux, pr, m, Four (b, c, d, e))) a = deep B_ pr (nrcons B_ m (node3 B_ b c d)) (Two (e, a)); fun rconsNlist B_ t [] = t | rconsNlist B_ t (x :: xs) = rconsNlist B_ (nrcons B_ t x) xs; fun nlcons B_ a Empty = Single a | nlcons B_ a (Single b) = deep B_ (One a) Empty (One b) | nlcons B_ a (Deep (uu, One b, m, sf)) = deep B_ (Two (a, b)) m sf | nlcons B_ a (Deep (uv, Two (b, c), m, sf)) = deep B_ (Three (a, b, c)) m sf | nlcons B_ a (Deep (uw, Three (b, c, d), m, sf)) = deep B_ (Four (a, b, c, d)) m sf | nlcons B_ a (Deep (ux, Four (b, c, d, e), m, sf)) = deep B_ (Two (a, b)) (nlcons B_ (node3 B_ c d e) m) sf; fun lconsNlist B_ [] t = t | lconsNlist B_ (x :: xs) t = nlcons B_ x (lconsNlist B_ xs t); fun node2 B_ nd1 nd2 = Node2 (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ nd1) (gmn B_ nd2), nd1, nd2); fun nodes B_ [a, b] = [node2 B_ a b] | nodes B_ [a, b, c] = [node3 B_ a b c] | nodes B_ [a, b, c, d] = [node2 B_ a b, node2 B_ c d] | nodes B_ (a :: b :: c :: v :: vb :: vc) = node3 B_ a b c :: nodes B_ (v :: vb :: vc); fun app3 B_ Empty xs t = lconsNlist B_ xs t | app3 B_ (Single v) xs Empty = rconsNlist B_ (Single v) xs | app3 B_ (Deep (v, va, vb, vc)) xs Empty = rconsNlist B_ (Deep (v, va, vb, vc)) xs | app3 B_ (Single x) xs (Single v) = nlcons B_ x (lconsNlist B_ xs (Single v)) | app3 B_ (Single x) xs (Deep (v, va, vb, vc)) = nlcons B_ x (lconsNlist B_ xs (Deep (v, va, vb, vc))) | app3 B_ (Deep (v, va, vb, vc)) xs (Single x) = nrcons B_ (rconsNlist B_ (Deep (v, va, vb, vc)) xs) x | app3 B_ (Deep (uu, pr1, m1, sf1)) ts (Deep (uv, pr2, m2, sf2)) = deep B_ pr1 (app3 B_ m1 (nodes B_ (digitToNlist sf1 @ ts @ digitToNlist pr2)) m2) sf2; fun appa B_ t1 t2 = app3 B_ t1 [] t2; fun app B_ s t = Abs_FingerTree (appa B_ (rep_FingerTree B_ s) (rep_FingerTree B_ t)); fun n_unwrap (Tip (e, a)) = (e, a) | n_unwrap (Node2 (uu, a, b)) = (raise Fail "undefined") | n_unwrap (Node3 (uv, a, b, c)) = (raise Fail "undefined"); fun nodeToDigit (Tip (e, a)) = One (Tip (e, a)) | nodeToDigit (Node2 (uu, a, b)) = Two (a, b) | nodeToDigit (Node3 (uv, a, b, c)) = Three (a, b, c); fun digitToTree B_ (One a) = Single a | digitToTree B_ (Two (a, b)) = deep B_ (One a) Empty (One b) | digitToTree B_ (Three (a, b, c)) = deep B_ (Two (a, b)) Empty (One c) | digitToTree B_ (Four (a, b, c, d)) = deep B_ (Two (a, b)) Empty (Two (c, d)); fun viewLn B_ Empty = NONE | viewLn B_ (Single a) = SOME (a, Empty) | viewLn B_ (Deep (uu, Two (a, b), m, sf)) = SOME (a, deep B_ (One b) m sf) | viewLn B_ (Deep (uv, Three (a, b, c), m, sf)) = SOME (a, deep B_ (Two (b, c)) m sf) | viewLn B_ (Deep (uw, Four (a, b, c, d), m, sf)) = SOME (a, deep B_ (Three (b, c, d)) m sf) | viewLn B_ (Deep (ux, One a, m, sf)) = (case viewLn B_ m of NONE => SOME (a, digitToTree B_ sf) | SOME b => let val (ba, m2) = b; in SOME (a, deep B_ (nodeToDigit ba) m2 sf) end); fun viewL B_ t = (case viewLn B_ t of NONE => NONE | SOME a => let val (aa, t2) = a; in SOME (n_unwrap aa, t2) end); fun heada B_ t = let val SOME a = viewL B_ t; val (aa, _) = a; in aa end; fun head B_ t = heada B_ (rep_FingerTree B_ t); fun isEmptya t = (case t of Empty => true | Single _ => false | Deep (_, _, _, _) => false); fun taila B_ t = let val SOME (_, m) = viewL B_ t; in m end; fun tail B_ t = Abs_FingerTree (if isEmptya (rep_FingerTree B_ t) then Empty else taila B_ (rep_FingerTree B_ t)); fun annota B_ t = gmft B_ t; fun annot B_ t = annota B_ (rep_FingerTree B_ t); fun count_node (Tip (uu, a)) = Arith.one_nat | count_node (Node2 (uv, a, b)) = Arith.plus_nat (count_node a) (count_node b) | count_node (Node3 (uw, a, b, c)) = Arith.plus_nat (Arith.plus_nat (count_node a) (count_node b)) (count_node c); fun count_digit (One a) = count_node a | count_digit (Two (a, b)) = Arith.plus_nat (count_node a) (count_node b) | count_digit (Three (a, b, c)) = Arith.plus_nat (Arith.plus_nat (count_node a) (count_node b)) (count_node c) | count_digit (Four (a, b, c, d)) = Arith.plus_nat (Arith.plus_nat (Arith.plus_nat (count_node a) (count_node b)) (count_node c)) (count_node d); fun counta Empty = Arith.Zero_nat | counta (Single a) = count_node a | counta (Deep (uu, pr, m, sf)) = Arith.plus_nat (Arith.plus_nat (count_digit pr) (counta m)) (count_digit sf); fun count B_ t = counta (rep_FingerTree B_ t); fun empty B_ = Abs_FingerTree Empty; fun foldl_node f sigma (Tip (e, a)) = f sigma (e, a) | foldl_node f sigma (Node2 (uu, a, b)) = foldl_node f (foldl_node f sigma a) b | foldl_node f sigma (Node3 (uv, a, b, c)) = foldl_node f (foldl_node f (foldl_node f sigma a) b) c; fun foldl_digit f sigma (One n1) = foldl_node f sigma n1 | foldl_digit f sigma (Two (n1, n2)) = foldl_node f (foldl_node f sigma n1) n2 | foldl_digit f sigma (Three (n1, n2, n3)) = foldl_node f (foldl_node f (foldl_node f sigma n1) n2) n3 | foldl_digit f sigma (Four (n1, n2, n3, n4)) = foldl_node f (foldl_node f (foldl_node f (foldl_node f sigma n1) n2) n3) n4; fun foldla f sigma Empty = sigma | foldla f sigma (Single nd) = foldl_node f sigma nd | foldla f sigma (Deep (uu, d1, m, d2)) = foldl_digit f (foldla f (foldl_digit f sigma d1) m) d2; fun foldl C_ f sigma t = foldla f sigma (rep_FingerTree C_ t); fun foldr_node f (Tip (e, a)) sigma = f (e, a) sigma | foldr_node f (Node2 (uu, a, b)) sigma = foldr_node f a (foldr_node f b sigma) | foldr_node f (Node3 (uv, a, b, c)) sigma = foldr_node f a (foldr_node f b (foldr_node f c sigma)); fun foldr_digit f (One n1) sigma = foldr_node f n1 sigma | foldr_digit f (Two (n1, n2)) sigma = foldr_node f n1 (foldr_node f n2 sigma) | foldr_digit f (Three (n1, n2, n3)) sigma = foldr_node f n1 (foldr_node f n2 (foldr_node f n3 sigma)) | foldr_digit f (Four (n1, n2, n3, n4)) sigma = foldr_node f n1 (foldr_node f n2 (foldr_node f n3 (foldr_node f n4 sigma))); fun foldra f Empty sigma = sigma | foldra f (Single nd) sigma = foldr_node f nd sigma | foldra f (Deep (uu, d1, m, d2)) sigma = foldr_digit f d1 (foldra f m (foldr_digit f d2 sigma)); fun foldr B_ f t sigma = foldra f (rep_FingerTree B_ t) sigma; fun viewRn B_ Empty = NONE | viewRn B_ (Single a) = SOME (a, Empty) | viewRn B_ (Deep (uu, pr, m, Two (a, b))) = SOME (b, deep B_ pr m (One a)) | viewRn B_ (Deep (uv, pr, m, Three (a, b, c))) = SOME (c, deep B_ pr m (Two (a, b))) | viewRn B_ (Deep (uw, pr, m, Four (a, b, c, d))) = SOME (d, deep B_ pr m (Three (a, b, c))) | viewRn B_ (Deep (ux, pr, m, One a)) = (case viewRn B_ m of NONE => SOME (a, digitToTree B_ pr) | SOME b => let val (ba, m2) = b; in SOME (a, deep B_ pr m2 (nodeToDigit ba)) end); fun viewR B_ t = (case viewRn B_ t of NONE => NONE | SOME a => let val (aa, t2) = a; in SOME (n_unwrap aa, t2) end); fun headRa B_ t = let val SOME a = viewR B_ t; val (aa, _) = a; in aa end; fun headR B_ t = headRa B_ (rep_FingerTree B_ t); fun lconsa B_ a t = nlcons B_ (Tip (Product_Type.fst a, Product_Type.snd a)) t; fun lcons B_ a t = Abs_FingerTree (lconsa B_ a (rep_FingerTree B_ t)); fun rconsa B_ t a = nrcons B_ t (Tip (Product_Type.fst a, Product_Type.snd a)); fun rcons B_ t a = Abs_FingerTree (rconsa B_ (rep_FingerTree B_ t) a); fun tailRa B_ t = let val SOME (_, m) = viewR B_ t; in m end; fun tailR B_ t = Abs_FingerTree (if isEmptya (rep_FingerTree B_ t) then Empty else tailRa B_ (rep_FingerTree B_ t)); fun isEmpty B_ t = isEmptya (rep_FingerTree B_ t); fun nlistToTree B_ xs = lconsNlist B_ xs Empty; fun splitNlist A_ p i [a] = ([], (a, [])) | splitNlist A_ p i (a :: v :: va) = let val i2 = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) i (gmn A_ a); in (if p i2 then ([], (a, v :: va)) else let val (l, (x, r)) = splitNlist A_ p i2 (v :: va); in (a :: l, (x, r)) end) end; fun splitDigit A_ p i d = splitNlist A_ p i (digitToNlist d); fun nlistToDigit [a] = One a | nlistToDigit [a, b] = Two (a, b) | nlistToDigit [a, b, c] = Three (a, b, c) | nlistToDigit [a, b, c, d] = Four (a, b, c, d); fun deepR B_ pr m [] = (case viewRn B_ m of NONE => digitToTree B_ pr | SOME a => let val (aa, m2) = a; in deep B_ pr m2 (nodeToDigit aa) end) | deepR B_ pr m (v :: va) = deep B_ pr m (nlistToDigit (v :: va)); fun deepL B_ [] m sf = (case viewLn B_ m of NONE => digitToTree B_ sf | SOME a => let val (aa, m2) = a; in deep B_ (nodeToDigit aa) m2 sf end) | deepL B_ (v :: va) m sf = deep B_ (nlistToDigit (v :: va)) m sf; fun nsplitTree A_ p i Empty = (Empty, (Tip ((raise Fail "undefined"), (raise Fail "undefined")), Empty)) | nsplitTree A_ p i (Single ea) = (Empty, (ea, Empty)) | nsplitTree A_ p i (Deep (uu, pr, m, sf)) = let val vpr = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) i (gmd A_ pr); val vm = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) vpr (gmft A_ m); in (if p vpr then let val (l, (x, r)) = splitDigit A_ p i pr; in (nlistToTree A_ l, (x, deepL A_ r m sf)) end else (if p vm then let val (ml, (xs, mr)) = nsplitTree A_ p vpr m; val (l, (x, r)) = splitDigit A_ p (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) vpr (gmft A_ ml)) (nodeToDigit xs); in (deepR A_ pr ml l, (x, deepL A_ r mr sf)) end else let val (l, (x, r)) = splitDigit A_ p vm sf; in (deepR A_ pr m l, (x, nlistToTree A_ r)) end)) end; fun splitTreea A_ p i t = let val (l, (x, r)) = nsplitTree A_ p i t; in (l, (n_unwrap x, r)) end; fun splitTree_aux B_ p i t = Abs_splitres (if not (p i) andalso p (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) i (annot B_ t)) then splitTreea B_ p i (rep_FingerTree B_ t) else (Empty, ((raise Fail "undefined"), Empty))); fun splitTree A_ p i t = extract_splitres A_ (splitTree_aux A_ p i t); end; (*struct FingerTree*) structure FTAnnotatedListImpl : sig val test_codegen : 'b Arith.monoid_add -> 'd Arith.monoid_add -> 'f Arith.monoid_add -> 'h Arith.monoid_add -> 'j Arith.monoid_add -> 'l Arith.monoid_add -> 'n Arith.monoid_add -> 'p Arith.monoid_add -> 'r Arith.monoid_add -> 't Arith.monoid_add -> 'v Arith.monoid_add -> 'w Arith.monoid_add -> 'aa Arith.monoid_add -> 'ac Arith.monoid_add -> (unit -> ('a, 'b) FingerTree.fingerTree) * ((('c, 'd) FingerTree.fingerTree -> bool) * ((('e, 'f) FingerTree.fingerTree -> Arith.nat) * (('g -> 'h -> ('g, 'h) FingerTree.fingerTree -> ('g, 'h) FingerTree.fingerTree) * ((('i, 'j) FingerTree.fingerTree -> 'i -> 'j -> ('i, 'j) FingerTree.fingerTree) * ((('k, 'l) FingerTree.fingerTree -> 'k * 'l) * ((('m, 'n) FingerTree.fingerTree -> ('m, 'n) FingerTree.fingerTree) * ((('o, 'p) FingerTree.fingerTree -> 'o * 'p) * ((('q, 'r) FingerTree.fingerTree -> ('q, 'r) FingerTree.fingerTree) * ((('s, 't) FingerTree.fingerTree -> ('s, 't) FingerTree.fingerTree -> ('s, 't) FingerTree.fingerTree) * ((('u, 'v) FingerTree.fingerTree -> 'v) * ((('w -> bool) -> 'w -> ('x, 'w) FingerTree.fingerTree -> ('x, 'w) FingerTree.fingerTree * (('x * 'w) * ('x, 'w) FingerTree.fingerTree)) * ((('y -> 'z * 'aa -> 'y) -> 'y -> ('z, 'aa) FingerTree.fingerTree -> 'y) * (('ab * 'ac -> 'ad -> 'ad) -> ('ab, 'ac) FingerTree.fingerTree -> 'ad -> 'ad))))))))))))) end = struct fun ft_app B_ = FingerTree.app B_; fun ft_head B_ = FingerTree.head B_; fun ft_tail B_ = FingerTree.tail B_; fun ft_annot B_ = FingerTree.annot B_; fun ft_consl B_ e a s = FingerTree.lcons B_ (e, a) s; fun ft_consr B_ s e a = FingerTree.rcons B_ s (e, a); fun ft_count B_ = FingerTree.count B_; fun ft_empty B_ = (fn _ => FingerTree.empty B_); fun ft_foldl C_ = FingerTree.foldl C_; fun ft_foldr B_ = FingerTree.foldr B_; fun ft_headR B_ = FingerTree.headR B_; fun ft_tailR B_ = FingerTree.tailR B_; fun ft_splits A_ = FingerTree.splitTree A_; fun ft_isEmpty B_ = FingerTree.isEmpty B_; fun foldr_alist_op_alpha_ft_ops B_ f s sigma = ft_foldr B_ f s sigma; fun foldl_alist_op_alpha_ft_ops C_ f sigma s = ft_foldl C_ f sigma s; fun test_codegen B_ D_ F_ H_ J_ L_ N_ P_ R_ T_ V_ W_ Aa_ Ac_ = (ft_empty B_, (ft_isEmpty D_, (ft_count F_, (ft_consl H_, (ft_consr J_, (ft_head L_, (ft_tail N_, (ft_headR P_, (ft_tailR R_, (ft_app T_, (ft_annot V_, (ft_splits W_, (foldl_alist_op_alpha_ft_ops Aa_, foldr_alist_op_alpha_ft_ops Ac_))))))))))))); end; (*struct FTAnnotatedListImpl*) ### theory "Collections.FTAnnotatedListImpl" ### 1.696s elapsed time, 3.340s cpu time, 0.828s GC time Loading theory "Collections.MapSpec" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale map fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" locale map_no_invar fixes \ :: "'a \ 'b \ 'c option" and invar :: "'a \ bool" assumes "map_no_invar invar" locale map_empty fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and empty :: "unit \ 's" assumes "map_empty \ invar empty" locale map_lookup fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and lookup :: "'u \ 's \ 'v option" assumes "map_lookup \ invar lookup" locale map_update fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and update :: "'u \ 'v \ 's \ 's" assumes "map_update \ invar update" locale map_update_dj fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and update_dj :: "'u \ 'v \ 's \ 's" assumes "map_update_dj \ invar update_dj" locale map_delete fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and delete :: "'u \ 's \ 's" assumes "map_delete \ invar delete" locale map_add fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and add :: "'s \ 's \ 's" assumes "MapSpec.map_add \ invar add" locale map_add_dj fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and add_dj :: "'s \ 's \ 's" assumes "map_add_dj \ invar add_dj" locale map_isEmpty fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and isEmpty :: "'s \ bool" assumes "map_isEmpty \ invar isEmpty" locale map_sng fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and sng :: "'u \ 'v \ 's" assumes "map_sng \ invar sng" locale map_isSng fixes \ :: "'s \ 'k \ 'v option" and invar :: "'s \ bool" and isSng :: "'s \ bool" assumes "map_isSng \ invar isSng" locale finite_map fixes \ :: "'a \ 'b \ 'c option" and invar :: "'a \ bool" assumes "finite_map \ invar" locale map_size fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and size :: "'s \ nat" assumes "map_size \ invar size" locale map_size_abort fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and size_abort :: "nat \ 's \ nat" assumes "map_size_abort \ invar size_abort" locale poly_map_iteratei_defs fixes list_it :: "'s \ (('u \ 'v) list \ bool) \ ('u \ 'v \ ('u \ 'v) list \ ('u \ 'v) list) \ ('u \ 'v) list \ ('u \ 'v) list" locale poly_map_iteratei fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and list_it :: "'s \ (('u \ 'v) list \ bool) \ ('u \ 'v \ ('u \ 'v) list \ ('u \ 'v) list) \ ('u \ 'v) list \ ('u \ 'v) list" assumes "poly_map_iteratei \ invar list_it" structure HOL : sig type 'a equal val equal : 'a equal -> 'a -> 'a -> bool val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b val equal_prod : 'a HOL.equal -> 'b HOL.equal -> 'a * 'b -> 'a * 'b -> bool end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; fun equal_prod A_ B_ (x1, x2) (y1, y2) = HOL.eq A_ x1 y1 andalso HOL.eq B_ x2 y2; end; (*struct Product_Type*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b val foldri : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); fun foldri (x :: l) c f sigma = let val sigmaa = foldri l c f sigma; in (if c sigmaa then f x sigmaa else sigmaa) end | foldri [] c f sigma = sigma; end; (*struct Foldi*) structure Arith : sig datatype nat = Zero_nat | Suc of nat val less_nat : nat -> nat -> bool val plus_nat : nat -> nat -> nat val minus_nat : nat -> nat -> nat end = struct datatype nat = Zero_nat | Suc of nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; fun minus_nat (Suc m) (Suc n) = minus_nat m n | minus_nat Zero_nat n = Zero_nat | minus_nat m Zero_nat = m; end; (*struct Arith*) structure List : sig val equal_list : 'a HOL.equal -> ('a list) HOL.equal val nth : 'a list -> Arith.nat -> 'a val rev : 'a list -> 'a list val last : 'a list -> 'a val hd : 'a list -> 'a val tl : 'a list -> 'a list val list_update : 'a list -> Arith.nat -> 'a -> 'a list val size_list : 'a list -> Arith.nat end = struct fun equal_lista A_ [] (x21 :: x22) = false | equal_lista A_ (x21 :: x22) [] = false | equal_lista A_ (x21 :: x22) (y21 :: y22) = HOL.eq A_ x21 y21 andalso equal_lista A_ x22 y22 | equal_lista A_ [] [] = true; fun equal_list A_ = {equal = equal_lista A_} : ('a list) HOL.equal; fun nth (x :: xs) (Arith.Suc n) = nth xs n | nth (x :: xs) Arith.Zero_nat = x; fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun null [] = true | null (x :: xs) = false; fun last (x :: xs) = (if null xs then x else last xs); fun hd (x21 :: x22) = x21; fun tl [] = [] | tl (x21 :: x22) = x22; fun gen_length n (x :: xs) = gen_length (Arith.Suc n) xs | gen_length n [] = n; fun list_update (x :: xs) (Arith.Suc i) y = x :: list_update xs i y | list_update (x :: xs) Arith.Zero_nat y = y :: xs | list_update [] i y = []; fun size_list x = gen_length Arith.Zero_nat x; end; (*struct List*) structure Fifo : sig val test_codegen : 'b HOL.equal -> (unit -> 'a list * 'a list) * (('b list * 'b list -> bool) * (('c list * 'c list -> Arith.nat) * (('d -> 'd list * 'd list -> 'd list * 'd list) * (('e list * 'e list -> 'e * ('e list * 'e list)) * (('f list * 'f list -> 'f) * (('g -> 'g list * 'g list -> 'g list * 'g list) * (('h list * 'h list -> ('h list * 'h list) * 'h) * (('i list * 'i list -> 'i) * (('j list * 'j list -> Arith.nat -> 'j) * (('k list * 'k list -> Arith.nat -> 'k -> 'k list * 'k list) * (('l list * 'l list -> ('m -> bool) -> ('l -> 'm -> 'm) -> 'm -> 'm) * ('n list * 'n list -> ('o -> bool) -> ('n -> 'o -> 'o) -> 'o -> 'o)))))))))))) end = struct fun fifo_get f i = let val l2 = List.size_list (Product_Type.snd f); in (if Arith.less_nat i l2 then List.nth (Product_Type.snd f) i else List.nth (Product_Type.fst f) (Arith.minus_nat (List.size_list (Product_Type.fst f)) (Arith.Suc (Arith.minus_nat i l2)))) end; fun fifo_set f i a = let val (f1, f2) = f; val l2 = List.size_list f2; in (if Arith.less_nat i l2 then (f1, List.list_update f2 i a) else (List.list_update f1 (Arith.minus_nat (List.size_list (Product_Type.fst f)) (Arith.Suc (Arith.minus_nat i l2))) a, f2)) end; fun fifo_size f = Arith.plus_nat (List.size_list (Product_Type.fst f)) (List.size_list (Product_Type.snd f)); fun fifo_empty x = (fn _ => ([], [])) x; fun fifo_appendl x f = let val (e, d) = f; in (e, x :: d) end; fun fifo_appendr a f = (a :: Product_Type.fst f, Product_Type.snd f); fun fifo_isEmpty A_ f = Product_Type.equal_prod (List.equal_list A_) (List.equal_list A_) f ([], []); fun fifo_removel f = (case Product_Type.snd f of [] => let val rp = List.rev (Product_Type.fst f); in (List.hd rp, ([], List.tl rp)) end | a :: l => (a, (Product_Type.fst f, l))); fun fifo_remover f = (case Product_Type.fst f of [] => let val rp = List.rev (Product_Type.snd f); in ((List.tl rp, []), List.hd rp) end | a :: l => ((l, Product_Type.snd f), a)); fun fifo_alpha f = Product_Type.snd f @ List.rev (Product_Type.fst f); fun rev_iteratei_list_op_alpha_fifo_ops s = Foldi.foldri (fifo_alpha s); fun iteratei_list_op_alpha_fifo_ops s = Foldi.foldli (fifo_alpha s); fun fifo_rightmost f = (case f of ([], xb) => List.last xb | (x :: _, _) => x); fun fifo_leftmost f = (case f of (xa, []) => List.last xa | (_, x :: _) => x); fun test_codegen B_ = (fifo_empty, (fifo_isEmpty B_, (fifo_size, (fifo_appendl, (fifo_removel, (fifo_leftmost, (fifo_appendr, (fifo_remover, (fifo_rightmost, (fifo_get, (fifo_set, (iteratei_list_op_alpha_fifo_ops, rev_iteratei_list_op_alpha_fifo_ops)))))))))))); end; (*struct Fifo*) ### theory "Collections.Fifo" ### 0.574s elapsed time, 1.152s cpu time, 0.000s GC time Loading theory "Collections.PrioSpec" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale prio fixes \ :: "'p \ ('e \ 'a) multiset" and invar :: "'p \ bool" locale prio_no_invar fixes \ :: "'a \ ('b \ 'c) multiset" and invar :: "'a \ bool" assumes "prio_no_invar invar" locale prio_empty fixes \ :: "'p \ ('e \ 'a) multiset" and invar :: "'p \ bool" and empty :: "unit \ 'p" assumes "prio_empty \ invar empty" locale map_ball fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and ball :: "'s \ ('u \ 'v \ bool) \ bool" assumes "map_ball \ invar ball" locale prio_isEmpty fixes \ :: "'p \ ('e \ 'a) multiset" and invar :: "'p \ bool" and isEmpty :: "'p \ bool" assumes "prio_isEmpty \ invar isEmpty" locale map_bex fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and bex :: "'s \ ('u \ 'v \ bool) \ bool" assumes "map_bex \ invar bex" locale prio_find fixes \ :: "'p \ ('e \ 'a) multiset" and invar :: "'p \ bool" and find :: "'p \ 'e \ 'a" assumes "prio_find \ invar find" locale map_sel fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and sel :: "'s \ ('u \ 'v \ 'r option) \ 'r option" assumes "map_sel \ invar sel" locale prio_insert fixes \ :: "'p \ ('e \ 'a) multiset" and invar :: "'p \ bool" and insert :: "'e \ 'a \ 'p \ 'p" assumes "prio_insert \ invar insert" locale prio_meld fixes \ :: "'p \ ('e \ 'a) multiset" and invar :: "'p \ bool" and meld :: "'p \ 'p \ 'p" assumes "prio_meld \ invar meld" locale prio_delete fixes \ :: "'p \ ('e \ 'a) multiset" and invar :: "'p \ bool" and find :: "'p \ 'e \ 'a" and delete :: "'p \ 'p" assumes "prio_delete \ invar find delete" locale map_sel' fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and sel' :: "'s \ ('u \ 'v \ bool) \ ('u \ 'v) option" assumes "map_sel' \ invar sel'" locale map_to_list fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and to_list :: "'s \ ('u \ 'v) list" assumes "map_to_list \ invar to_list" locale list_to_map fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and to_map :: "('u \ 'v) list \ 's" assumes "list_to_map \ invar to_map" locale map_image_filter fixes \1 :: "'m1 \ 'u1 \ 'v1 option" and invar1 :: "'m1 \ bool" and \2 :: "'m2 \ 'u2 \ 'v2 option" and invar2 :: "'m2 \ bool" and map_image_filter :: "('u1 \ 'v1 \ ('u2 \ 'v2) option) \ 'm1 \ 'm2" assumes "map_image_filter \1 invar1 \2 invar2 map_image_filter" locale map_value_image_filter fixes \1 :: "'m1 \ 'u \ 'v1 option" and invar1 :: "'m1 \ bool" and \2 :: "'m2 \ 'u \ 'v2 option" and invar2 :: "'m2 \ bool" and map_value_image_filter :: "('u \ 'v1 \ 'v2 option) \ 'm1 \ 'm2" assumes "map_value_image_filter \1 invar1 \2 invar2 map_value_image_filter" locale map_restrict fixes \1 :: "'m1 \ 'u \ 'v option" and invar1 :: "'m1 \ bool" and \2 :: "'m2 \ 'u \ 'v option" and invar2 :: "'m2 \ bool" and restrict :: "('u \ 'v \ bool) \ 'm1 \ 'm2" assumes "map_restrict \1 invar1 \2 invar2 restrict" locale ordered_map fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" locale ordered_finite_map fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" assumes "ordered_finite_map \ invar" locale poly_map_iterateoi_defs fixes olist_it :: "'s \ (('u \ 'v) list \ bool) \ ('u \ 'v \ ('u \ 'v) list \ ('u \ 'v) list) \ ('u \ 'v) list \ ('u \ 'v) list" locale poly_map_iterateoi fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and list_ordered_it :: "'s \ (('u \ 'v) list \ bool) \ ('u \ 'v \ ('u \ 'v) list \ ('u \ 'v) list) \ ('u \ 'v) list \ ('u \ 'v) list" assumes "poly_map_iterateoi \ invar list_ordered_it" locale poly_map_rev_iterateoi_defs fixes list_rev_it :: "'s \ (('u \ 'v) list \ bool) \ ('u \ 'v \ ('u \ 'v) list \ ('u \ 'v) list) \ ('u \ 'v) list \ ('u \ 'v) list" locale poly_map_rev_iterateoi fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and list_rev_it :: "'s \ (('u \ 'v) list \ bool) \ ('u \ 'v \ ('u \ 'v) list \ ('u \ 'v) list) \ ('u \ 'v) list \ ('u \ 'v) list" assumes "poly_map_rev_iterateoi \ invar list_rev_it" locale map_min fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and min :: "'s \ ('u \ 'v \ bool) \ ('u \ 'v) option" assumes "map_min \ invar min" locale map_max fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and max :: "'s \ ('u \ 'v \ bool) \ ('u \ 'v) option" assumes "map_max \ invar max" locale map_to_sorted_list fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and to_sorted_list :: "'s \ ('u \ 'v) list" assumes "MapSpec.map_to_sorted_list \ invar to_sorted_list" locale map_to_rev_list fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and to_rev_list :: "'s \ ('u \ 'v) list" assumes "map_to_rev_list \ invar to_rev_list" locale StdPrioDefs fixes ops :: "('e, 'a, 'p) prio_ops" locale StdPrio fixes ops :: "('a, 'b, 'c) prio_ops" assumes "StdPrio ops" locale StdPrio_no_invar fixes ops :: "('a, 'b, 'c) prio_ops" assumes "StdPrio_no_invar ops" ### theory "Collections.PrioSpec" ### 1.053s elapsed time, 2.112s cpu time, 0.000s GC time Loading theory "Collections.BinoPrioImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure List : sig val rev : 'a list -> 'a list val null : 'a list -> bool end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun null [] = true | null (x :: xs) = false; end; (*struct List*) structure Arith : sig datatype nat = Zero_nat | Suc of nat val less_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; end; (*struct Arith*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; end; (*struct Orderings*) structure BinomialHeap : sig type ('a, 'b) binomialTree type ('b, 'a) binomialHeap val meld : 'b Orderings.linorder -> ('a, 'b) binomialHeap -> ('a, 'b) binomialHeap -> ('a, 'b) binomialHeap val empty : 'b Orderings.linorder -> ('a, 'b) binomialHeap val insert : 'b Orderings.linorder -> 'a -> 'b -> ('a, 'b) binomialHeap -> ('a, 'b) binomialHeap val findMin : 'b Orderings.linorder -> ('a, 'b) binomialHeap -> 'a * 'b val isEmpty : 'b Orderings.linorder -> ('a, 'b) binomialHeap -> bool val deleteMin : 'b HOL.equal * 'b Orderings.linorder -> ('a, 'b) binomialHeap -> ('a, 'b) binomialHeap end = struct datatype ('a, 'b) binomialTree = Node of 'a * 'b * Arith.nat * ('a, 'b) binomialTree list; datatype ('b, 'a) binomialHeap = Abs_BinomialHeap of ('b, 'a) binomialTree list; fun rep_BinomialHeap A_ (Abs_BinomialHeap x) = x; fun rank B_ (Node (x1, x2, x3, x4)) = x3; fun link B_ (Node (e1, a1, r1, ts1)) (Node (e2, a2, r2, ts2)) = (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) a1 a2 then Node (e1, a1, Arith.Suc r1, Node (e2, a2, r2, ts2) :: ts1) else Node (e2, a2, Arith.Suc r2, Node (e1, a1, r1, ts1) :: ts2)); fun ins B_ t [] = [t] | ins B_ ta (t :: bq) = (if Arith.less_nat (rank B_ ta) (rank B_ t) then ta :: t :: bq else (if Arith.less_nat (rank B_ t) (rank B_ ta) then t :: ins B_ ta bq else ins B_ (link B_ ta t) bq)); fun melda B_ [] bq = bq | melda B_ (v :: va) [] = v :: va | melda B_ (t1 :: bq1) (t2 :: bq2) = (if Arith.less_nat (rank B_ t1) (rank B_ t2) then t1 :: melda B_ bq1 (t2 :: bq2) else (if Arith.less_nat (rank B_ t2) (rank B_ t1) then t2 :: melda B_ (t1 :: bq1) bq2 else ins B_ (link B_ t1 t2) (melda B_ bq1 bq2))); fun meld B_ q1 q2 = Abs_BinomialHeap (melda B_ (rep_BinomialHeap B_ q1) (rep_BinomialHeap B_ q2)); fun empty B_ = Abs_BinomialHeap []; fun inserta B_ e a bq = ins B_ (Node (e, a, Arith.Zero_nat, [])) bq; fun insert B_ e a q = Abs_BinomialHeap (inserta B_ e a (rep_BinomialHeap B_ q)); fun prio B_ (Node (x1, x2, x3, x4)) = x2; fun vala B_ (Node (x1, x2, x3, x4)) = x1; fun getMinTree B_ [t] = t | getMinTree B_ (t :: v :: va) = (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) (prio B_ t) (prio B_ (getMinTree B_ (v :: va))) then t else getMinTree B_ (v :: va)); fun findMina B_ bq = let val min = getMinTree B_ bq; in (vala B_ min, prio B_ min) end; fun findMin B_ q = findMina B_ (rep_BinomialHeap B_ q); fun isEmpty B_ q = List.null (rep_BinomialHeap B_ q); fun children B_ (Node (x1, x2, x3, x4)) = x4; fun remove1Prio (A1_, A2_) a [] = [] | remove1Prio (A1_, A2_) a (t :: bq) = (if HOL.eq A1_ (prio A2_ t) a then bq else t :: remove1Prio (A1_, A2_) a bq); fun deleteMina (B1_, B2_) bq = let val min = getMinTree B2_ bq; in melda B2_ (List.rev (children B2_ min)) (remove1Prio (B1_, B2_) (prio B2_ min) bq) end; fun deleteMin (B1_, B2_) q = Abs_BinomialHeap (case rep_BinomialHeap B2_ q of [] => [] | _ :: _ => deleteMina (B1_, B2_) (rep_BinomialHeap B2_ q)); end; (*struct BinomialHeap*) structure BinoPrioImpl : sig val test_codegen : 'b Orderings.linorder -> 'd Orderings.linorder -> 'f Orderings.linorder -> 'h Orderings.linorder -> 'j Orderings.linorder -> 'l HOL.equal * 'l Orderings.linorder -> (unit -> ('a, 'b) BinomialHeap.binomialHeap) * ((('c, 'd) BinomialHeap.binomialHeap -> bool) * ((('e, 'f) BinomialHeap.binomialHeap -> 'e * 'f) * (('g -> 'h -> ('g, 'h) BinomialHeap.binomialHeap -> ('g, 'h) BinomialHeap.binomialHeap) * ((('i, 'j) BinomialHeap.binomialHeap -> ('i, 'j) BinomialHeap.binomialHeap -> ('i, 'j) BinomialHeap.binomialHeap) * (('k, 'l) BinomialHeap.binomialHeap -> ('k, 'l) BinomialHeap.binomialHeap))))) end = struct fun bino_find B_ = BinomialHeap.findMin B_; fun bino_meld B_ = BinomialHeap.meld B_; fun bino_empty B_ = (fn _ => BinomialHeap.empty B_); fun bino_delete (B1_, B2_) = BinomialHeap.deleteMin (B1_, B2_); fun bino_insert B_ = BinomialHeap.insert B_; fun bino_isEmpty B_ = BinomialHeap.isEmpty B_; fun test_codegen B_ D_ F_ H_ J_ (L1_, L2_) = (bino_empty B_, (bino_isEmpty D_, (bino_find F_, (bino_insert H_, (bino_meld J_, bino_delete (L1_, L2_)))))); end; (*struct BinoPrioImpl*) ### theory "Collections.BinoPrioImpl" ### 1.008s elapsed time, 1.980s cpu time, 0.668s GC time Loading theory "Collections.PrioByAnnotatedList" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.FTPrioImpl") locale StdMapDefs fixes ops :: "('k, 'v, 's, 'more) map_ops_scheme" locale StdMap fixes ops :: "('k, 'v, 's, 'more) map_ops_scheme" assumes "StdMap ops" locale StdMap_no_invar fixes ops :: "('a, 'b, 'c, 'd) map_ops_scheme" assumes "StdMap_no_invar ops" ### Missing patterns in function definition: ### p_unwrap Infty = undefined Found termination order: "{}" locale StdOMapDefs fixes ops :: "('k, 'v, 's, 'more) omap_ops_scheme" Found termination order: "{}" instantiation Prio :: (type, linorder) monoid_add zero_Prio == zero_class.zero :: ('a, 'b) Prio plus_Prio == plus :: ('a, 'b) Prio \ ('a, 'b) Prio \ ('a, 'b) Prio locale StdOMap fixes ops :: "('k, 'v, 's, 'more) omap_ops_scheme" assumes "StdOMap ops" ### theory "Collections.MapSpec" ### 3.860s elapsed time, 7.700s cpu time, 0.668s GC time Loading theory "Collections.SkewPrioImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") Found termination order: "{}" Found termination order: "{}" instantiation Prio :: (type, linorder) preorder less_eq_Prio == less_eq :: ('a, 'b) Prio \ ('a, 'b) Prio \ bool less_Prio == less :: ('a, 'b) Prio \ ('a, 'b) Prio \ bool locale alprio_defs fixes ops :: "(unit, ('e, 'a) Prio, 's) alist_ops" locale alprio fixes ops :: "(unit, ('e, 'a) Prio, 's) alist_ops" assumes "alprio ops" ### theory "Collections.PrioByAnnotatedList" ### 1.870s elapsed time, 3.744s cpu time, 0.000s GC time Loading theory "Collections.FTPrioImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") structure HOL : sig type 'a equal val equal : 'a equal -> 'a -> 'a -> bool val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure List : sig val rev : 'a list -> 'a list val filter : ('a -> bool) -> 'a list -> 'a list val equal_list : 'a HOL.equal -> 'a list -> 'a list -> bool end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun filter p [] = [] | filter p (x :: xs) = (if p x then x :: filter p xs else filter p xs); fun equal_list A_ [] (x21 :: x22) = false | equal_list A_ (x21 :: x22) [] = false | equal_list A_ (x21 :: x22) (y21 :: y22) = HOL.eq A_ x21 y21 andalso equal_list A_ x22 y22 | equal_list A_ [] [] = true; end; (*struct List*) structure Arith : sig datatype nat = Zero_nat | Suc of nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Sum_Type : sig datatype ('a, 'b) sum = Inl of 'a | Inr of 'b val equal_sum : 'a HOL.equal -> 'b HOL.equal -> ('a, 'b) sum -> ('a, 'b) sum -> bool end = struct datatype ('a, 'b) sum = Inl of 'a | Inr of 'b; fun equal_sum A_ B_ (Inl x1) (Inr x2) = false | equal_sum A_ B_ (Inr x2) (Inl x1) = false | equal_sum A_ B_ (Inr x2) (Inr y2) = HOL.eq B_ x2 y2 | equal_sum A_ B_ (Inl x1) (Inl y1) = HOL.eq A_ x1 y1; end; (*struct Sum_Type*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; end; (*struct Orderings*) structure Product_Type : sig val equal_unit : unit HOL.equal end = struct fun equal_unita u v = true; val equal_unit = {equal = equal_unita} : unit HOL.equal; end; (*struct Product_Type*) structure SkewBinomialHeap : sig type ('a, 'b) bsSkewElem type ('a, 'b) bsSkewBinomialTree type ('b, 'a) skewBinomialHeap val meldb : 'b Orderings.linorder -> ('a, 'b) skewBinomialHeap -> ('a, 'b) skewBinomialHeap -> ('a, 'b) skewBinomialHeap val empty : 'b Orderings.linorder -> ('a, 'b) skewBinomialHeap val insertb : 'b Orderings.linorder -> 'a -> 'b -> ('a, 'b) skewBinomialHeap -> ('a, 'b) skewBinomialHeap val findMinb : 'b Orderings.linorder -> ('a, 'b) skewBinomialHeap -> 'a * 'b val isEmpty : 'a HOL.equal -> 'b HOL.equal * 'b Orderings.linorder -> ('a, 'b) skewBinomialHeap -> bool val deleteMinb : 'b HOL.equal * 'b Orderings.linorder -> ('a, 'b) skewBinomialHeap -> ('a, 'b) skewBinomialHeap end = struct datatype ('a, 'b) bsSkewElem = Element of 'a * 'b * ('a, 'b) bsSkewBinomialTree list and ('a, 'b) bsSkewBinomialTree = BsNode of ('a, 'b) bsSkewElem * Arith.nat * ('a, 'b) bsSkewBinomialTree list; fun equal_BsSkewElema A_ (B1_, B2_) (Element (x1, x2, x3)) (Element (y1, y2, y3)) = HOL.eq A_ x1 y1 andalso (HOL.eq B1_ x2 y2 andalso List.equal_list (equal_BsSkewBinomialTree A_ (B1_, B2_)) x3 y3) and equal_BsSkewBinomialTreea A_ (B1_, B2_) (BsNode (x1, x2, x3)) (BsNode (y1, y2, y3)) = equal_BsSkewElema A_ (B1_, B2_) x1 y1 andalso (Arith.equal_nat x2 y2 andalso List.equal_list (equal_BsSkewBinomialTree A_ (B1_, B2_)) x3 y3) and equal_BsSkewBinomialTree A_ (B1_, B2_) = {equal = equal_BsSkewBinomialTreea A_ (B1_, B2_)} : ('a, 'b) bsSkewBinomialTree HOL.equal; fun equal_BsSkewElem A_ (B1_, B2_) = {equal = equal_BsSkewElema A_ (B1_, B2_)} : ('a, 'b) bsSkewElem HOL.equal; datatype ('b, 'a) skewBinomialHeap = Abs_SkewBinomialHeap of (unit, ('b, 'a) bsSkewElem) Sum_Type.sum; fun rank B_ (BsNode (x1, x2, x3)) = x2; fun eprio B_ (Element (x1, x2, x3)) = x2; fun link B_ (BsNode (e1, r1, ts1)) (BsNode (e2, r2, ts2)) = (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) (eprio B_ e1) (eprio B_ e2) then BsNode (e1, Arith.Suc r1, BsNode (e2, r2, ts2) :: ts1) else BsNode (e2, Arith.Suc r2, BsNode (e1, r1, ts1) :: ts2)); fun ins B_ t [] = [t] | ins B_ ta (t :: bq) = (if Arith.less_nat (rank B_ ta) (rank B_ t) then ta :: t :: bq else (if Arith.less_nat (rank B_ t) (rank B_ ta) then t :: ins B_ ta bq else ins B_ (link B_ ta t) bq)); fun meldUniq B_ [] bq = bq | meldUniq B_ (v :: va) [] = v :: va | meldUniq B_ (t1 :: bq1) (t2 :: bq2) = (if Arith.less_nat (rank B_ t1) (rank B_ t2) then t1 :: meldUniq B_ bq1 (t2 :: bq2) else (if Arith.less_nat (rank B_ t2) (rank B_ t1) then t2 :: meldUniq B_ (t1 :: bq1) bq2 else ins B_ (link B_ t1 t2) (meldUniq B_ bq1 bq2))); fun uniqify B_ [] = [] | uniqify B_ (t :: bq) = ins B_ t bq; fun meld B_ bq1 bq2 = meldUniq B_ (uniqify B_ bq1) (uniqify B_ bq2); fun prio B_ (BsNode (e, r, ts)) = eprio B_ e; fun children B_ (BsNode (x1, x2, x3)) = x3; fun vala B_ (BsNode (x1, x2, x3)) = x1; fun skewlink B_ e ta t = (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) (eprio B_ e) (prio B_ ta) andalso Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) (eprio B_ e) (prio B_ t) then BsNode (e, Arith.Suc (rank B_ ta), [ta, t]) else (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) (prio B_ ta) (prio B_ t) then BsNode (vala B_ ta, Arith.Suc (rank B_ ta), BsNode (e, Arith.Zero_nat, []) :: t :: children B_ ta) else BsNode (vala B_ t, Arith.Suc (rank B_ t), BsNode (e, Arith.Zero_nat, []) :: ta :: children B_ t))); fun insert B_ e [] = [BsNode (e, Arith.Zero_nat, [])] | insert B_ e [t] = [BsNode (e, Arith.Zero_nat, []), t] | insert B_ e (ta :: t :: bq) = (if not (Arith.equal_nat (rank B_ ta) (rank B_ t)) then BsNode (e, Arith.Zero_nat, []) :: ta :: t :: bq else skewlink B_ e ta t :: bq); fun melda B_ (Element (e1, a1, q1)) (Element (e2, a2, q2)) = (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) a1 a2 then Element (e1, a1, insert B_ (Element (e2, a2, q2)) q1) else Element (e2, a2, insert B_ (Element (e1, a1, q1)) q2)); fun bs_meld B_ (Sum_Type.Inl uu) x = x | bs_meld B_ (Sum_Type.Inr v) (Sum_Type.Inl uv) = Sum_Type.Inr v | bs_meld B_ (Sum_Type.Inr xa) (Sum_Type.Inr x) = Sum_Type.Inr (melda B_ xa x); fun getMinTree B_ [t] = t | getMinTree B_ (t :: v :: va) = (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) (prio B_ t) (prio B_ (getMinTree B_ (v :: va))) then t else getMinTree B_ (v :: va)); fun findMin B_ bq = vala B_ (getMinTree B_ bq); fun inserta B_ e a q = melda B_ (Element (e, a, [])) q; val bs_empty : (unit, 'a) Sum_Type.sum = Sum_Type.Inl (); fun findMina B_ (Element (e, a, q)) = (e, a); fun bs_insert B_ e a (Sum_Type.Inl uu) = Sum_Type.Inr (Element (e, a, [])) | bs_insert B_ e a (Sum_Type.Inr x) = Sum_Type.Inr (inserta B_ e a x); fun remove1Prio (A1_, A2_) a [] = [] | remove1Prio (A1_, A2_) a (t :: bq) = (if HOL.eq A1_ (prio A2_ t) a then bq else t :: remove1Prio (A1_, A2_) a bq); fun insertList B_ [] tbq = tbq | insertList B_ (t :: bq) tbq = insertList B_ bq (insert B_ (vala B_ t) tbq); fun deleteMin (B1_, B2_) bq = let val min = getMinTree B2_ bq; in insertList B2_ (List.filter (fn t => Arith.equal_nat (rank B2_ t) Arith.Zero_nat) (children B2_ min)) (meld B2_ (List.rev (List.filter (fn t => Arith.less_nat Arith.Zero_nat (rank B2_ t)) (children B2_ min))) (remove1Prio (B1_, B2_) (prio B2_ min) bq)) end; fun bs_findMin C_ (Sum_Type.Inr x) = findMina C_ x; fun deleteMina (B1_, B2_) (Element (e, a, q)) = let val Element (ey, ay, q1) = findMin B2_ q; in Element (ey, ay, meld B2_ q1 (deleteMin (B1_, B2_) q)) end; fun bs_deleteMin (B1_, B2_) (Sum_Type.Inr (Element (e, a, []))) = Sum_Type.Inl () | bs_deleteMin (B1_, B2_) (Sum_Type.Inr (Element (e, a, v :: va))) = Sum_Type.Inr (deleteMina (B1_, B2_) (Element (e, a, v :: va))); fun rep_SkewBinomialHeap A_ (Abs_SkewBinomialHeap x) = x; fun meldb B_ q1 q2 = Abs_SkewBinomialHeap (bs_meld B_ (rep_SkewBinomialHeap B_ q1) (rep_SkewBinomialHeap B_ q2)); fun empty B_ = Abs_SkewBinomialHeap bs_empty; fun insertb B_ e a q = Abs_SkewBinomialHeap (bs_insert B_ e a (rep_SkewBinomialHeap B_ q)); fun findMinb B_ q = bs_findMin B_ (rep_SkewBinomialHeap B_ q); fun isEmpty A_ (B1_, B2_) q = Sum_Type.equal_sum Product_Type.equal_unit (equal_BsSkewElem A_ (B1_, B2_)) (rep_SkewBinomialHeap B2_ q) bs_empty; fun deleteMinb (B1_, B2_) q = Abs_SkewBinomialHeap (case rep_SkewBinomialHeap B2_ q of Sum_Type.Inl _ => bs_empty | Sum_Type.Inr _ => bs_deleteMin (B1_, B2_) (rep_SkewBinomialHeap B2_ q)); end; (*struct SkewBinomialHeap*) structure SkewPrioImpl : sig val test_codegen : 'b Orderings.linorder -> 'c HOL.equal -> 'd HOL.equal * 'd Orderings.linorder -> 'f Orderings.linorder -> 'h Orderings.linorder -> 'j Orderings.linorder -> 'l HOL.equal * 'l Orderings.linorder -> (unit -> ('a, 'b) SkewBinomialHeap.skewBinomialHeap) * ((('c, 'd) SkewBinomialHeap.skewBinomialHeap -> bool) * ((('e, 'f) SkewBinomialHeap.skewBinomialHeap -> 'e * 'f) * (('g -> 'h -> ('g, 'h) SkewBinomialHeap.skewBinomialHeap -> ('g, 'h) SkewBinomialHeap.skewBinomialHeap) * ((('i, 'j) SkewBinomialHeap.skewBinomialHeap -> ('i, 'j) SkewBinomialHeap.skewBinomialHeap -> ('i, 'j) SkewBinomialHeap.skewBinomialHeap) * (('k, 'l) SkewBinomialHeap.skewBinomialHeap -> ('k, 'l) SkewBinomialHeap.skewBinomialHeap))))) end = struct fun skew_find B_ = SkewBinomialHeap.findMinb B_; fun skew_meld B_ = SkewBinomialHeap.meldb B_; fun skew_empty B_ = (fn _ => SkewBinomialHeap.empty B_); fun skew_delete (B1_, B2_) = SkewBinomialHeap.deleteMinb (B1_, B2_); fun skew_insert B_ = SkewBinomialHeap.insertb B_; fun skew_isEmpty A_ (B1_, B2_) = SkewBinomialHeap.isEmpty A_ (B1_, B2_); fun test_codegen B_ C_ (D1_, D2_) F_ H_ J_ (L1_, L2_) = (skew_empty B_, (skew_isEmpty C_ (D1_, D2_), (skew_find F_, (skew_insert H_, (skew_meld J_, skew_delete (L1_, L2_)))))); end; (*struct SkewPrioImpl*) ### theory "Collections.SkewPrioImpl" ### 0.741s elapsed time, 1.480s cpu time, 0.000s GC time Loading theory "Collections.PrioUniqueSpec" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale uprio fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" locale uprio_no_invar fixes \ :: "'a \ 'b \ 'c option" and invar :: "'a \ bool" assumes "uprio_no_invar invar" locale uprio_finite fixes \ :: "'a \ 'b \ 'c option" and invar :: "'a \ bool" assumes "uprio_finite \ invar" locale uprio_empty fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" and empty :: "unit \ 's" assumes "uprio_empty \ invar empty" locale uprio_isEmpty fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" and isEmpty :: "'s \ bool" assumes "uprio_isEmpty \ invar isEmpty" locale uprio_pop fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" and pop :: "'s \ 'e \ 'a \ 's" assumes "uprio_pop \ invar pop" locale uprio_insert fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" and insert :: "'s \ 'e \ 'a \ 's" assumes "uprio_insert \ invar insert" locale uprio_distinct_insert fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" and insert :: "'s \ 'e \ 'a \ 's" assumes "uprio_distinct_insert \ invar insert" locale uprio_prio fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" and prio :: "'s \ 'e \ 'a option" assumes "uprio_prio \ invar prio" structure Arith : sig type 'a plus val plus : 'a plus -> 'a -> 'a -> 'a type 'a semigroup_add val plus_semigroup_add : 'a semigroup_add -> 'a plus type 'a zero val zero : 'a zero -> 'a type 'a monoid_add val semigroup_add_monoid_add : 'a monoid_add -> 'a semigroup_add val zero_monoid_add : 'a monoid_add -> 'a zero end = struct type 'a plus = {plus : 'a -> 'a -> 'a}; val plus = #plus : 'a plus -> 'a -> 'a -> 'a; type 'a semigroup_add = {plus_semigroup_add : 'a plus}; val plus_semigroup_add = #plus_semigroup_add : 'a semigroup_add -> 'a plus; type 'a zero = {zero : 'a}; val zero = #zero : 'a zero -> 'a; type 'a monoid_add = {semigroup_add_monoid_add : 'a semigroup_add, zero_monoid_add : 'a zero}; val semigroup_add_monoid_add = #semigroup_add_monoid_add : 'a monoid_add -> 'a semigroup_add; val zero_monoid_add = #zero_monoid_add : 'a monoid_add -> 'a zero; end; (*struct Arith*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; end; (*struct Orderings*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure PrioByAnnotatedList : sig type ('a, 'b) prio val monoid_add_Prio : 'b Orderings.linorder -> ('a, 'b) prio Arith.monoid_add val alprio_find : 'c Orderings.linorder -> ('a -> ('b, 'c) prio) -> 'a -> 'b * 'c val alprio_meld : 'a -> 'a val alprio_empty : 'a -> 'a val alprio_delete : 'b Orderings.linorder -> ((('a, 'b) prio -> bool) -> ('a, 'b) prio -> 'c -> 'c * ((unit * ('a, 'b) prio) * 'c)) -> ('c -> ('a, 'b) prio) -> ('c -> 'c -> 'c) -> 'c -> 'c val alprio_insert : 'b Orderings.linorder -> (unit -> ('a, 'b) prio -> 'c -> 'c) -> 'a -> 'b -> 'c -> 'c val alprio_isEmpty : 'a -> 'a end = struct datatype ('a, 'b) prio = Infty | Prio of 'a * 'b; fun p_min B_ Infty Infty = Infty | p_min B_ Infty (Prio (e, a)) = Prio (e, a) | p_min B_ (Prio (e, a)) Infty = Prio (e, a) | p_min B_ (Prio (e1, a)) (Prio (e2, b)) = (if Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) a b then Prio (e1, a) else Prio (e2, b)); fun plus_Prioa B_ a b = p_min B_ a b; fun plus_Prio B_ = {plus = plus_Prioa B_} : ('a, 'b) prio Arith.plus; fun zero_Prioa B_ = Infty; fun zero_Prio B_ = {zero = zero_Prioa B_} : ('a, 'b) prio Arith.zero; fun semigroup_add_Prio B_ = {plus_semigroup_add = plus_Prio B_} : ('a, 'b) prio Arith.semigroup_add; fun monoid_add_Prio B_ = {semigroup_add_monoid_add = semigroup_add_Prio B_, zero_monoid_add = zero_Prio B_} : ('a, 'b) prio Arith.monoid_add; fun p_unwrap (Prio (e, a)) = (e, a); fun p_less_eq B_ (Prio (e, a)) (Prio (f, b)) = Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) a b | p_less_eq B_ uu Infty = true | p_less_eq B_ Infty (Prio (e, a)) = false; fun alprio_find C_ annot s = p_unwrap (annot s); fun alprio_meld app = app; fun alprio_empty empt = empt; fun less_eq_Prio B_ = p_less_eq B_; fun alprio_delete B_ splits annot app s = let val a = splits (fn x => less_eq_Prio B_ x (annot s)) Infty s; val (l, aa) = a; val (_, ab) = aa; in app l ab end; fun alprio_insert B_ consl e a s = consl () (Prio (e, a)) s; fun alprio_isEmpty isEmpty = isEmpty; end; (*struct PrioByAnnotatedList*) structure FingerTree : sig type ('a, 'b) fingerTreeStruc type ('b, 'a) splitres type ('b, 'a) fingerTree val app : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree val annot : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> 'b val empty : 'b Arith.monoid_add -> ('a, 'b) fingerTree val lcons : 'b Arith.monoid_add -> 'a * 'b -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree val isEmpty : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> bool val splitTree : 'a Arith.monoid_add -> ('a -> bool) -> 'a -> ('b, 'a) fingerTree -> ('b, 'a) fingerTree * (('b * 'a) * ('b, 'a) fingerTree) end = struct datatype ('a, 'b) node = Tip of 'a * 'b | Node2 of 'b * ('a, 'b) node * ('a, 'b) node | Node3 of 'b * ('a, 'b) node * ('a, 'b) node * ('a, 'b) node; datatype ('a, 'b) digit = One of ('a, 'b) node | Two of ('a, 'b) node * ('a, 'b) node | Three of ('a, 'b) node * ('a, 'b) node * ('a, 'b) node | Four of ('a, 'b) node * ('a, 'b) node * ('a, 'b) node * ('a, 'b) node; datatype ('a, 'b) fingerTreeStruc = Empty | Single of ('a, 'b) node | Deep of 'b * ('a, 'b) digit * ('a, 'b) fingerTreeStruc * ('a, 'b) digit; datatype ('b, 'a) splitres = Abs_splitres of (('b, 'a) fingerTreeStruc * (('b * 'a) * ('b, 'a) fingerTreeStruc)); datatype ('b, 'a) fingerTree = Abs_FingerTree of ('b, 'a) fingerTreeStruc; fun rep_splitres A_ (Abs_splitres x) = x; fun extract_splitres_r B_ r = Abs_FingerTree let val (_, (_, ra)) = rep_splitres B_ r; in ra end; fun extract_splitres_l B_ r = Abs_FingerTree let val (l, (_, _)) = rep_splitres B_ r; in l end; fun extract_splitres_a B_ r = let val (_, a) = rep_splitres B_ r; val (aa, _) = a; in aa end; fun extract_splitres B_ r = (extract_splitres_l B_ r, (extract_splitres_a B_ r, extract_splitres_r B_ r)); fun rep_FingerTree A_ (Abs_FingerTree x) = x; fun digitToNlist (One a) = [a] | digitToNlist (Two (a, b)) = [a, b] | digitToNlist (Three (a, b, c)) = [a, b, c] | digitToNlist (Four (a, b, c, d)) = [a, b, c, d]; fun gmn B_ (Tip (e, a)) = a | gmn B_ (Node2 (a, uu, uv)) = a | gmn B_ (Node3 (a, uw, ux, uy)) = a; fun node3 B_ nd1 nd2 nd3 = Node3 (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ nd1) (gmn B_ nd2)) (gmn B_ nd3), nd1, nd2, nd3); fun gmft B_ Empty = Arith.zero (Arith.zero_monoid_add B_) | gmft B_ (Single nd) = gmn B_ nd | gmft B_ (Deep (a, uu, uv, uw)) = a; fun gmd B_ (One a) = gmn B_ a | gmd B_ (Two (a, b)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b) | gmd B_ (Three (a, b, c)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b)) (gmn B_ c) | gmd B_ (Four (a, b, c, d)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b)) (gmn B_ c)) (gmn B_ d); fun deep B_ pr m sf = Deep (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmd B_ pr) (gmft B_ m)) (gmd B_ sf), pr, m, sf); fun nrcons B_ Empty a = Single a | nrcons B_ (Single b) a = deep B_ (One b) Empty (One a) | nrcons B_ (Deep (uu, pr, m, One b)) a = deep B_ pr m (Two (b, a)) | nrcons B_ (Deep (uv, pr, m, Two (b, c))) a = deep B_ pr m (Three (b, c, a)) | nrcons B_ (Deep (uw, pr, m, Three (b, c, d))) a = deep B_ pr m (Four (b, c, d, a)) | nrcons B_ (Deep (ux, pr, m, Four (b, c, d, e))) a = deep B_ pr (nrcons B_ m (node3 B_ b c d)) (Two (e, a)); fun rconsNlist B_ t [] = t | rconsNlist B_ t (x :: xs) = rconsNlist B_ (nrcons B_ t x) xs; fun nlcons B_ a Empty = Single a | nlcons B_ a (Single b) = deep B_ (One a) Empty (One b) | nlcons B_ a (Deep (uu, One b, m, sf)) = deep B_ (Two (a, b)) m sf | nlcons B_ a (Deep (uv, Two (b, c), m, sf)) = deep B_ (Three (a, b, c)) m sf | nlcons B_ a (Deep (uw, Three (b, c, d), m, sf)) = deep B_ (Four (a, b, c, d)) m sf | nlcons B_ a (Deep (ux, Four (b, c, d, e), m, sf)) = deep B_ (Two (a, b)) (nlcons B_ (node3 B_ c d e) m) sf; fun lconsNlist B_ [] t = t | lconsNlist B_ (x :: xs) t = nlcons B_ x (lconsNlist B_ xs t); fun node2 B_ nd1 nd2 = Node2 (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ nd1) (gmn B_ nd2), nd1, nd2); fun nodes B_ [a, b] = [node2 B_ a b] | nodes B_ [a, b, c] = [node3 B_ a b c] | nodes B_ [a, b, c, d] = [node2 B_ a b, node2 B_ c d] | nodes B_ (a :: b :: c :: v :: vb :: vc) = node3 B_ a b c :: nodes B_ (v :: vb :: vc); fun app3 B_ Empty xs t = lconsNlist B_ xs t | app3 B_ (Single v) xs Empty = rconsNlist B_ (Single v) xs | app3 B_ (Deep (v, va, vb, vc)) xs Empty = rconsNlist B_ (Deep (v, va, vb, vc)) xs | app3 B_ (Single x) xs (Single v) = nlcons B_ x (lconsNlist B_ xs (Single v)) | app3 B_ (Single x) xs (Deep (v, va, vb, vc)) = nlcons B_ x (lconsNlist B_ xs (Deep (v, va, vb, vc))) | app3 B_ (Deep (v, va, vb, vc)) xs (Single x) = nrcons B_ (rconsNlist B_ (Deep (v, va, vb, vc)) xs) x | app3 B_ (Deep (uu, pr1, m1, sf1)) ts (Deep (uv, pr2, m2, sf2)) = deep B_ pr1 (app3 B_ m1 (nodes B_ (digitToNlist sf1 @ ts @ digitToNlist pr2)) m2) sf2; fun appa B_ t1 t2 = app3 B_ t1 [] t2; fun app B_ s t = Abs_FingerTree (appa B_ (rep_FingerTree B_ s) (rep_FingerTree B_ t)); fun annota B_ t = gmft B_ t; fun annot B_ t = annota B_ (rep_FingerTree B_ t); fun empty B_ = Abs_FingerTree Empty; fun lconsa B_ a t = nlcons B_ (Tip (Product_Type.fst a, Product_Type.snd a)) t; fun lcons B_ a t = Abs_FingerTree (lconsa B_ a (rep_FingerTree B_ t)); fun isEmptya t = (case t of Empty => true | Single _ => false | Deep (_, _, _, _) => false); fun isEmpty B_ t = isEmptya (rep_FingerTree B_ t); fun nodeToDigit (Tip (e, a)) = One (Tip (e, a)) | nodeToDigit (Node2 (uu, a, b)) = Two (a, b) | nodeToDigit (Node3 (uv, a, b, c)) = Three (a, b, c); fun nlistToTree B_ xs = lconsNlist B_ xs Empty; fun splitNlist A_ p i [a] = ([], (a, [])) | splitNlist A_ p i (a :: v :: va) = let val i2 = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) i (gmn A_ a); in (if p i2 then ([], (a, v :: va)) else let val (l, (x, r)) = splitNlist A_ p i2 (v :: va); in (a :: l, (x, r)) end) end; fun splitDigit A_ p i d = splitNlist A_ p i (digitToNlist d); fun nlistToDigit [a] = One a | nlistToDigit [a, b] = Two (a, b) | nlistToDigit [a, b, c] = Three (a, b, c) | nlistToDigit [a, b, c, d] = Four (a, b, c, d); fun digitToTree B_ (One a) = Single a | digitToTree B_ (Two (a, b)) = deep B_ (One a) Empty (One b) | digitToTree B_ (Three (a, b, c)) = deep B_ (Two (a, b)) Empty (One c) | digitToTree B_ (Four (a, b, c, d)) = deep B_ (Two (a, b)) Empty (Two (c, d)); fun viewRn B_ Empty = NONE | viewRn B_ (Single a) = SOME (a, Empty) | viewRn B_ (Deep (uu, pr, m, Two (a, b))) = SOME (b, deep B_ pr m (One a)) | viewRn B_ (Deep (uv, pr, m, Three (a, b, c))) = SOME (c, deep B_ pr m (Two (a, b))) | viewRn B_ (Deep (uw, pr, m, Four (a, b, c, d))) = SOME (d, deep B_ pr m (Three (a, b, c))) | viewRn B_ (Deep (ux, pr, m, One a)) = (case viewRn B_ m of NONE => SOME (a, digitToTree B_ pr) | SOME b => let val (ba, m2) = b; in SOME (a, deep B_ pr m2 (nodeToDigit ba)) end); fun deepR B_ pr m [] = (case viewRn B_ m of NONE => digitToTree B_ pr | SOME a => let val (aa, m2) = a; in deep B_ pr m2 (nodeToDigit aa) end) | deepR B_ pr m (v :: va) = deep B_ pr m (nlistToDigit (v :: va)); fun viewLn B_ Empty = NONE | viewLn B_ (Single a) = SOME (a, Empty) | viewLn B_ (Deep (uu, Two (a, b), m, sf)) = SOME (a, deep B_ (One b) m sf) | viewLn B_ (Deep (uv, Three (a, b, c), m, sf)) = SOME (a, deep B_ (Two (b, c)) m sf) | viewLn B_ (Deep (uw, Four (a, b, c, d), m, sf)) = SOME (a, deep B_ (Three (b, c, d)) m sf) | viewLn B_ (Deep (ux, One a, m, sf)) = (case viewLn B_ m of NONE => SOME (a, digitToTree B_ sf) | SOME b => let val (ba, m2) = b; in SOME (a, deep B_ (nodeToDigit ba) m2 sf) end); fun deepL B_ [] m sf = (case viewLn B_ m of NONE => digitToTree B_ sf | SOME a => let val (aa, m2) = a; in deep B_ (nodeToDigit aa) m2 sf end) | deepL B_ (v :: va) m sf = deep B_ (nlistToDigit (v :: va)) m sf; fun nsplitTree A_ p i Empty = (Empty, (Tip ((raise Fail "undefined"), (raise Fail "undefined")), Empty)) | nsplitTree A_ p i (Single ea) = (Empty, (ea, Empty)) | nsplitTree A_ p i (Deep (uu, pr, m, sf)) = let val vpr = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) i (gmd A_ pr); val vm = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) vpr (gmft A_ m); in (if p vpr then let val (l, (x, r)) = splitDigit A_ p i pr; in (nlistToTree A_ l, (x, deepL A_ r m sf)) end else (if p vm then let val (ml, (xs, mr)) = nsplitTree A_ p vpr m; val (l, (x, r)) = splitDigit A_ p (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) vpr (gmft A_ ml)) (nodeToDigit xs); in (deepR A_ pr ml l, (x, deepL A_ r mr sf)) end else let val (l, (x, r)) = splitDigit A_ p vm sf; in (deepR A_ pr m l, (x, nlistToTree A_ r)) end)) end; fun n_unwrap (Tip (e, a)) = (e, a) | n_unwrap (Node2 (uu, a, b)) = (raise Fail "undefined") | n_unwrap (Node3 (uv, a, b, c)) = (raise Fail "undefined"); fun splitTreea A_ p i t = let val (l, (x, r)) = nsplitTree A_ p i t; in (l, (n_unwrap x, r)) end; fun splitTree_aux B_ p i t = Abs_splitres (if not (p i) andalso p (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) i (annot B_ t)) then splitTreea B_ p i (rep_FingerTree B_ t) else (Empty, ((raise Fail "undefined"), Empty))); fun splitTree A_ p i t = extract_splitres A_ (splitTree_aux A_ p i t); end; (*struct FingerTree*) structure FTAnnotatedListImpl : sig val ft_app : 'b Arith.monoid_add -> ('a, 'b) FingerTree.fingerTree -> ('a, 'b) FingerTree.fingerTree -> ('a, 'b) FingerTree.fingerTree val ft_annot : 'b Arith.monoid_add -> ('a, 'b) FingerTree.fingerTree -> 'b val ft_consl : 'b Arith.monoid_add -> 'a -> 'b -> ('a, 'b) FingerTree.fingerTree -> ('a, 'b) FingerTree.fingerTree val ft_empty : 'b Arith.monoid_add -> unit -> ('a, 'b) FingerTree.fingerTree val ft_splits : 'a Arith.monoid_add -> ('a -> bool) -> 'a -> ('b, 'a) FingerTree.fingerTree -> ('b, 'a) FingerTree.fingerTree * (('b * 'a) * ('b, 'a) FingerTree.fingerTree) val ft_isEmpty : 'b Arith.monoid_add -> ('a, 'b) FingerTree.fingerTree -> bool end = struct fun ft_app B_ = FingerTree.app B_; fun ft_annot B_ = FingerTree.annot B_; fun ft_consl B_ e a s = FingerTree.lcons B_ (e, a) s; fun ft_empty B_ = (fn _ => FingerTree.empty B_); fun ft_splits A_ = FingerTree.splitTree A_; fun ft_isEmpty B_ = FingerTree.isEmpty B_; end; (*struct FTAnnotatedListImpl*) structure FTPrioImpl : sig val test_codegen : 'b Orderings.linorder -> 'd Orderings.linorder -> 'f Orderings.linorder -> 'h Orderings.linorder -> 'j Orderings.linorder -> 'l Orderings.linorder -> (unit -> (unit, ('a, 'b) PrioByAnnotatedList.prio) FingerTree.fingerTree) * (((unit, ('c, 'd) PrioByAnnotatedList.prio) FingerTree.fingerTree -> bool) * (('e -> 'f -> (unit, ('e, 'f) PrioByAnnotatedList.prio) FingerTree.fingerTree -> (unit, ('e, 'f) PrioByAnnotatedList.prio) FingerTree.fingerTree) * (((unit, ('g, 'h) PrioByAnnotatedList.prio) FingerTree.fingerTree -> 'g * 'h) * (((unit, ('i, 'j) PrioByAnnotatedList.prio) FingerTree.fingerTree -> (unit, ('i, 'j) PrioByAnnotatedList.prio) FingerTree.fingerTree) * ((unit, ('k, 'l) PrioByAnnotatedList.prio) FingerTree.fingerTree -> (unit, ('k, 'l) PrioByAnnotatedList.prio) FingerTree.fingerTree -> (unit, ('k, 'l) PrioByAnnotatedList.prio) FingerTree.fingerTree))))) end = struct fun test_codegen B_ D_ F_ H_ J_ L_ = (PrioByAnnotatedList.alprio_empty (FTAnnotatedListImpl.ft_empty (PrioByAnnotatedList.monoid_add_Prio B_)), (PrioByAnnotatedList.alprio_isEmpty (FTAnnotatedListImpl.ft_isEmpty (PrioByAnnotatedList.monoid_add_Prio D_)), (PrioByAnnotatedList.alprio_insert F_ (FTAnnotatedListImpl.ft_consl (PrioByAnnotatedList.monoid_add_Prio F_)), (PrioByAnnotatedList.alprio_find H_ (FTAnnotatedListImpl.ft_annot (PrioByAnnotatedList.monoid_add_Prio H_)), (PrioByAnnotatedList.alprio_delete J_ (FTAnnotatedListImpl.ft_splits (PrioByAnnotatedList.monoid_add_Prio J_)) (FTAnnotatedListImpl.ft_annot (PrioByAnnotatedList.monoid_add_Prio J_)) (FTAnnotatedListImpl.ft_app (PrioByAnnotatedList.monoid_add_Prio J_)), PrioByAnnotatedList.alprio_meld (FTAnnotatedListImpl.ft_app (PrioByAnnotatedList.monoid_add_Prio L_))))))); end; (*struct FTPrioImpl*) ### theory "Collections.FTPrioImpl" ### 0.855s elapsed time, 1.708s cpu time, 0.000s GC time Loading theory "Collections.SetSpec" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale set fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" locale set_no_invar fixes \ :: "'a \ 'b set" and invar :: "'a \ bool" assumes "set_no_invar invar" locale set_empty fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and empty :: "unit \ 's" assumes "set_empty \ invar empty" locale set_memb fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and memb :: "'x \ 's \ bool" assumes "set_memb \ invar memb" locale set_ins fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and ins :: "'x \ 's \ 's" assumes "set_ins \ invar ins" locale set_ins_dj fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and ins_dj :: "'x \ 's \ 's" assumes "set_ins_dj \ invar ins_dj" locale set_delete fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and delete :: "'x \ 's \ 's" assumes "set_delete \ invar delete" locale set_isEmpty fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and isEmpty :: "'s \ bool" assumes "set_isEmpty \ invar isEmpty" locale set_ball fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and ball :: "'s \ ('x \ bool) \ bool" assumes "set_ball \ invar ball" locale set_bex fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and bex :: "'s \ ('x \ bool) \ bool" assumes "set_bex \ invar bex" locale finite_set fixes \ :: "'a \ 'b set" and invar :: "'a \ bool" assumes "finite_set \ invar" locale set_size fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and size :: "'s \ nat" assumes "set_size \ invar size" locale set_size_abort fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and size_abort :: "nat \ 's \ nat" assumes "set_size_abort \ invar size_abort" locale set_sng fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and sng :: "'x \ 's" assumes "set_sng \ invar sng" locale set_isSng fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and isSng :: "'s \ bool" assumes "set_isSng \ invar isSng" locale poly_set_iteratei_defs fixes list_it :: "'s \ ('x list \ bool) \ ('x \ 'x list \ 'x list) \ 'x list \ 'x list" locale StdUprioDefs fixes ops :: "('e, 'a, 's, 'more) uprio_ops_scheme" locale poly_set_iteratei fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and list_it :: "'s \ ('x list \ bool) \ ('x \ 'x list \ 'x list) \ 'x list \ 'x list" assumes "poly_set_iteratei \ invar list_it" locale StdUprio fixes ops :: "('a, 'b, 'c, 'd) uprio_ops_scheme" assumes "StdUprio ops" locale set_copy fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and copy :: "'s1 \ 's2" assumes "set_copy \1 invar1 \2 invar2 copy" locale StdUprio_no_invar fixes ops :: "('a, 'b, 'c, 'd) uprio_ops_scheme" assumes "StdUprio_no_invar ops" ### theory "Collections.PrioUniqueSpec" ### 1.515s elapsed time, 2.992s cpu time, 0.996s GC time Loading theory "Collections.PrioUniqueByAnnotatedList" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.FTPrioUniqueImpl") locale set_union fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and \3 :: "'s3 \ 'a set" and invar3 :: "'s3 \ bool" and union :: "'s1 \ 's2 \ 's3" assumes "set_union \1 invar1 \2 invar2 \3 invar3 union" locale set_union_dj fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and \3 :: "'s3 \ 'a set" and invar3 :: "'s3 \ bool" and union_dj :: "'s1 \ 's2 \ 's3" assumes "set_union_dj \1 invar1 \2 invar2 \3 invar3 union_dj" locale set_union_list fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and union_list :: "'s1 list \ 's2" assumes "set_union_list \1 invar1 \2 invar2 union_list" locale set_diff fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and diff :: "'s1 \ 's2 \ 's1" assumes "set_diff \1 invar1 \2 invar2 diff" locale set_inter fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and \3 :: "'s3 \ 'a set" and invar3 :: "'s3 \ bool" and inter :: "'s1 \ 's2 \ 's3" assumes "set_inter \1 invar1 \2 invar2 \3 invar3 inter" locale set_subset fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and subset :: "'s1 \ 's2 \ bool" assumes "set_subset \1 invar1 \2 invar2 subset" locale set_equal fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and equal :: "'s1 \ 's2 \ bool" assumes "set_equal \1 invar1 \2 invar2 equal" locale set_image_filter fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'b set" and invar2 :: "'s2 \ bool" and image_filter :: "('a \ 'b option) \ 's1 \ 's2" assumes "set_image_filter \1 invar1 \2 invar2 image_filter" locale set_inj_image_filter fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'b set" and invar2 :: "'s2 \ bool" and inj_image_filter :: "('a \ 'b option) \ 's1 \ 's2" assumes "set_inj_image_filter \1 invar1 \2 invar2 inj_image_filter" locale set_image fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'b set" and invar2 :: "'s2 \ bool" and image :: "('a \ 'b) \ 's1 \ 's2" assumes "set_image \1 invar1 \2 invar2 image" locale set_inj_image fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'b set" and invar2 :: "'s2 \ bool" and inj_image :: "('a \ 'b) \ 's1 \ 's2" assumes "set_inj_image \1 invar1 \2 invar2 inj_image" locale set_filter fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and filter :: "('a \ bool) \ 's1 \ 's2" assumes "set_filter \1 invar1 \2 invar2 filter" locale set_Union_image fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'b set" and invar2 :: "'s2 \ bool" and \3 :: "'s3 \ 'b set" and invar3 :: "'s3 \ bool" and Union_image :: "('a \ 's2) \ 's1 \ 's3" assumes "set_Union_image \1 invar1 \2 invar2 \3 invar3 Union_image" locale set_disjoint fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and disjoint :: "'s1 \ 's2 \ bool" assumes "set_disjoint \1 invar1 \2 invar2 disjoint" locale set_disjoint_witness fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and disjoint_witness :: "'s1 \ 's2 \ 'a option" assumes "set_disjoint_witness \1 invar1 \2 invar2 disjoint_witness" locale set_sel fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and sel :: "'s \ ('x \ 'r option) \ 'r option" assumes "set_sel \ invar sel" locale set_sel' fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and sel' :: "'s \ ('x \ bool) \ 'x option" assumes "set_sel' \ invar sel'" locale set_to_list fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and to_list :: "'s \ 'x list" assumes "set_to_list \ invar to_list" locale list_to_set fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and to_set :: "'x list \ 's" assumes "list_to_set \ invar to_set" locale ordered_set fixes \ :: "'s \ 'u set" and invar :: "'s \ bool" locale ordered_finite_set fixes \ :: "'s \ 'u set" and invar :: "'s \ bool" assumes "ordered_finite_set \ invar" locale poly_set_iterateoi_defs fixes olist_it :: "'s \ ('x list \ bool) \ ('x \ 'x list \ 'x list) \ 'x list \ 'x list" locale poly_set_iterateoi fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and list_ordered_it :: "'s \ ('x list \ bool) \ ('x \ 'x list \ 'x list) \ 'x list \ 'x list" assumes "poly_set_iterateoi \ invar list_ordered_it" locale poly_set_rev_iterateoi_defs fixes list_rev_it :: "'s \ ('x list \ bool) \ ('x \ 'x list \ 'x list) \ 'x list \ 'x list" locale poly_set_rev_iterateoi fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and list_rev_it :: "'s \ ('x list \ bool) \ ('x \ 'x list \ 'x list) \ 'x list \ 'x list" assumes "poly_set_rev_iterateoi \ invar list_rev_it" locale set_min fixes \ :: "'s \ 'u set" and invar :: "'s \ bool" and min :: "'s \ ('u \ bool) \ 'u option" assumes "set_min \ invar min" locale set_max fixes \ :: "'s \ 'u set" and invar :: "'s \ bool" and max :: "'s \ ('u \ bool) \ 'u option" assumes "set_max \ invar max" locale set_to_sorted_list fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and to_sorted_list :: "'s \ 'x list" assumes "SetSpec.set_to_sorted_list \ invar to_sorted_list" locale set_to_rev_list fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and to_rev_list :: "'s \ 'x list" assumes "set_to_rev_list \ invar to_rev_list" ### Missing patterns in function definition: ### p_unwrap Infty = undefined Found termination order: "{}" Found termination order: "{}" Found termination order: "{}" instantiation LP :: (linorder, linorder) monoid_add zero_LP == zero_class.zero :: ('a, 'b) LP plus_LP == plus :: ('a, 'b) LP \ ('a, 'b) LP \ ('a, 'b) LP Found termination order: "{}" Found termination order: "{}" instantiation LP :: (type, linorder) preorder less_eq_LP == less_eq :: ('a, 'b) LP \ ('a, 'b) LP \ bool less_LP == less :: ('a, 'b) LP \ ('a, 'b) LP \ bool locale StdSetDefs fixes ops :: "('x, 's, 'more) set_ops_scheme" locale aluprio_defs fixes ops :: "(unit, ('e, 'a) LP, 's) alist_ops" locale aluprio fixes ops :: "(unit, ('e, 'a) LP, 's) alist_ops" assumes "aluprio ops" ### theory "Collections.PrioUniqueByAnnotatedList" ### 2.173s elapsed time, 4.352s cpu time, 0.000s GC time Loading theory "Collections.FTPrioUniqueImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale StdSet fixes ops :: "('x, 's, 'more) set_ops_scheme" assumes "StdSet ops" locale StdSet_no_invar fixes ops :: "('a, 'b, 'c) set_ops_scheme" assumes "StdSet_no_invar ops" locale StdOSetDefs fixes ops :: "('x, 's, 'more) oset_ops_scheme" locale StdOSet fixes ops :: "('x, 's, 'more) oset_ops_scheme" assumes "StdOSet ops" structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Arith : sig type 'a plus val plus : 'a plus -> 'a -> 'a -> 'a type 'a semigroup_add val plus_semigroup_add : 'a semigroup_add -> 'a plus type 'a zero val zero : 'a zero -> 'a type 'a monoid_add val semigroup_add_monoid_add : 'a monoid_add -> 'a semigroup_add val zero_monoid_add : 'a monoid_add -> 'a zero end = struct type 'a plus = {plus : 'a -> 'a -> 'a}; val plus = #plus : 'a plus -> 'a -> 'a -> 'a; type 'a semigroup_add = {plus_semigroup_add : 'a plus}; val plus_semigroup_add = #plus_semigroup_add : 'a semigroup_add -> 'a plus; type 'a zero = {zero : 'a}; val zero = #zero : 'a zero -> 'a; type 'a monoid_add = {semigroup_add_monoid_add : 'a semigroup_add, zero_monoid_add : 'a zero}; val semigroup_add_monoid_add = #semigroup_add_monoid_add : 'a monoid_add -> 'a semigroup_add; val zero_monoid_add = #zero_monoid_add : 'a monoid_add -> 'a zero; end; (*struct Arith*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order val max : 'a ord -> 'a -> 'a -> 'a val min : 'a ord -> 'a -> 'a -> 'a end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; fun max A_ a b = (if less_eq A_ a b then b else a); fun min A_ a b = (if less_eq A_ a b then a else b); end; (*struct Orderings*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure FingerTree : sig type ('a, 'b) fingerTreeStruc type ('b, 'a) splitres type ('b, 'a) fingerTree val app : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree -> ('a, 'b) fingerTree val annot : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> 'b val empty : 'b Arith.monoid_add -> ('a, 'b) fingerTree val rcons : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> 'a * 'b -> ('a, 'b) fingerTree val isEmpty : 'b Arith.monoid_add -> ('a, 'b) fingerTree -> bool val splitTree : 'a Arith.monoid_add -> ('a -> bool) -> 'a -> ('b, 'a) fingerTree -> ('b, 'a) fingerTree * (('b * 'a) * ('b, 'a) fingerTree) end = struct datatype ('a, 'b) node = Tip of 'a * 'b | Node2 of 'b * ('a, 'b) node * ('a, 'b) node | Node3 of 'b * ('a, 'b) node * ('a, 'b) node * ('a, 'b) node; datatype ('a, 'b) digit = One of ('a, 'b) node | Two of ('a, 'b) node * ('a, 'b) node | Three of ('a, 'b) node * ('a, 'b) node * ('a, 'b) node | Four of ('a, 'b) node * ('a, 'b) node * ('a, 'b) node * ('a, 'b) node; datatype ('a, 'b) fingerTreeStruc = Empty | Single of ('a, 'b) node | Deep of 'b * ('a, 'b) digit * ('a, 'b) fingerTreeStruc * ('a, 'b) digit; datatype ('b, 'a) splitres = Abs_splitres of (('b, 'a) fingerTreeStruc * (('b * 'a) * ('b, 'a) fingerTreeStruc)); datatype ('b, 'a) fingerTree = Abs_FingerTree of ('b, 'a) fingerTreeStruc; fun rep_splitres A_ (Abs_splitres x) = x; fun extract_splitres_r B_ r = Abs_FingerTree let val (_, (_, ra)) = rep_splitres B_ r; in ra end; fun extract_splitres_l B_ r = Abs_FingerTree let val (l, (_, _)) = rep_splitres B_ r; in l end; fun extract_splitres_a B_ r = let val (_, a) = rep_splitres B_ r; val (aa, _) = a; in aa end; fun extract_splitres B_ r = (extract_splitres_l B_ r, (extract_splitres_a B_ r, extract_splitres_r B_ r)); fun rep_FingerTree A_ (Abs_FingerTree x) = x; fun digitToNlist (One a) = [a] | digitToNlist (Two (a, b)) = [a, b] | digitToNlist (Three (a, b, c)) = [a, b, c] | digitToNlist (Four (a, b, c, d)) = [a, b, c, d]; fun gmn B_ (Tip (e, a)) = a | gmn B_ (Node2 (a, uu, uv)) = a | gmn B_ (Node3 (a, uw, ux, uy)) = a; fun node3 B_ nd1 nd2 nd3 = Node3 (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ nd1) (gmn B_ nd2)) (gmn B_ nd3), nd1, nd2, nd3); fun gmft B_ Empty = Arith.zero (Arith.zero_monoid_add B_) | gmft B_ (Single nd) = gmn B_ nd | gmft B_ (Deep (a, uu, uv, uw)) = a; fun gmd B_ (One a) = gmn B_ a | gmd B_ (Two (a, b)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b) | gmd B_ (Three (a, b, c)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b)) (gmn B_ c) | gmd B_ (Four (a, b, c, d)) = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ a) (gmn B_ b)) (gmn B_ c)) (gmn B_ d); fun deep B_ pr m sf = Deep (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmd B_ pr) (gmft B_ m)) (gmd B_ sf), pr, m, sf); fun nrcons B_ Empty a = Single a | nrcons B_ (Single b) a = deep B_ (One b) Empty (One a) | nrcons B_ (Deep (uu, pr, m, One b)) a = deep B_ pr m (Two (b, a)) | nrcons B_ (Deep (uv, pr, m, Two (b, c))) a = deep B_ pr m (Three (b, c, a)) | nrcons B_ (Deep (uw, pr, m, Three (b, c, d))) a = deep B_ pr m (Four (b, c, d, a)) | nrcons B_ (Deep (ux, pr, m, Four (b, c, d, e))) a = deep B_ pr (nrcons B_ m (node3 B_ b c d)) (Two (e, a)); fun rconsNlist B_ t [] = t | rconsNlist B_ t (x :: xs) = rconsNlist B_ (nrcons B_ t x) xs; fun nlcons B_ a Empty = Single a | nlcons B_ a (Single b) = deep B_ (One a) Empty (One b) | nlcons B_ a (Deep (uu, One b, m, sf)) = deep B_ (Two (a, b)) m sf | nlcons B_ a (Deep (uv, Two (b, c), m, sf)) = deep B_ (Three (a, b, c)) m sf | nlcons B_ a (Deep (uw, Three (b, c, d), m, sf)) = deep B_ (Four (a, b, c, d)) m sf | nlcons B_ a (Deep (ux, Four (b, c, d, e), m, sf)) = deep B_ (Two (a, b)) (nlcons B_ (node3 B_ c d e) m) sf; fun lconsNlist B_ [] t = t | lconsNlist B_ (x :: xs) t = nlcons B_ x (lconsNlist B_ xs t); fun node2 B_ nd1 nd2 = Node2 (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) (gmn B_ nd1) (gmn B_ nd2), nd1, nd2); fun nodes B_ [a, b] = [node2 B_ a b] | nodes B_ [a, b, c] = [node3 B_ a b c] | nodes B_ [a, b, c, d] = [node2 B_ a b, node2 B_ c d] | nodes B_ (a :: b :: c :: v :: vb :: vc) = node3 B_ a b c :: nodes B_ (v :: vb :: vc); fun app3 B_ Empty xs t = lconsNlist B_ xs t | app3 B_ (Single v) xs Empty = rconsNlist B_ (Single v) xs | app3 B_ (Deep (v, va, vb, vc)) xs Empty = rconsNlist B_ (Deep (v, va, vb, vc)) xs | app3 B_ (Single x) xs (Single v) = nlcons B_ x (lconsNlist B_ xs (Single v)) | app3 B_ (Single x) xs (Deep (v, va, vb, vc)) = nlcons B_ x (lconsNlist B_ xs (Deep (v, va, vb, vc))) | app3 B_ (Deep (v, va, vb, vc)) xs (Single x) = nrcons B_ (rconsNlist B_ (Deep (v, va, vb, vc)) xs) x | app3 B_ (Deep (uu, pr1, m1, sf1)) ts (Deep (uv, pr2, m2, sf2)) = deep B_ pr1 (app3 B_ m1 (nodes B_ (digitToNlist sf1 @ ts @ digitToNlist pr2)) m2) sf2; fun appa B_ t1 t2 = app3 B_ t1 [] t2; fun app B_ s t = Abs_FingerTree (appa B_ (rep_FingerTree B_ s) (rep_FingerTree B_ t)); fun annota B_ t = gmft B_ t; fun annot B_ t = annota B_ (rep_FingerTree B_ t); fun empty B_ = Abs_FingerTree Empty; fun rconsa B_ t a = nrcons B_ t (Tip (Product_Type.fst a, Product_Type.snd a)); fun rcons B_ t a = Abs_FingerTree (rconsa B_ (rep_FingerTree B_ t) a); fun isEmptya t = (case t of Empty => true | Single _ => false | Deep (_, _, _, _) => false); fun isEmpty B_ t = isEmptya (rep_FingerTree B_ t); fun nodeToDigit (Tip (e, a)) = One (Tip (e, a)) | nodeToDigit (Node2 (uu, a, b)) = Two (a, b) | nodeToDigit (Node3 (uv, a, b, c)) = Three (a, b, c); fun nlistToTree B_ xs = lconsNlist B_ xs Empty; fun splitNlist A_ p i [a] = ([], (a, [])) | splitNlist A_ p i (a :: v :: va) = let val i2 = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) i (gmn A_ a); in (if p i2 then ([], (a, v :: va)) else let val (l, (x, r)) = splitNlist A_ p i2 (v :: va); in (a :: l, (x, r)) end) end; fun splitDigit A_ p i d = splitNlist A_ p i (digitToNlist d); fun nlistToDigit [a] = One a | nlistToDigit [a, b] = Two (a, b) | nlistToDigit [a, b, c] = Three (a, b, c) | nlistToDigit [a, b, c, d] = Four (a, b, c, d); fun digitToTree B_ (One a) = Single a | digitToTree B_ (Two (a, b)) = deep B_ (One a) Empty (One b) | digitToTree B_ (Three (a, b, c)) = deep B_ (Two (a, b)) Empty (One c) | digitToTree B_ (Four (a, b, c, d)) = deep B_ (Two (a, b)) Empty (Two (c, d)); fun viewRn B_ Empty = NONE | viewRn B_ (Single a) = SOME (a, Empty) | viewRn B_ (Deep (uu, pr, m, Two (a, b))) = SOME (b, deep B_ pr m (One a)) | viewRn B_ (Deep (uv, pr, m, Three (a, b, c))) = SOME (c, deep B_ pr m (Two (a, b))) | viewRn B_ (Deep (uw, pr, m, Four (a, b, c, d))) = SOME (d, deep B_ pr m (Three (a, b, c))) | viewRn B_ (Deep (ux, pr, m, One a)) = (case viewRn B_ m of NONE => SOME (a, digitToTree B_ pr) | SOME b => let val (ba, m2) = b; in SOME (a, deep B_ pr m2 (nodeToDigit ba)) end); fun deepR B_ pr m [] = (case viewRn B_ m of NONE => digitToTree B_ pr | SOME a => let val (aa, m2) = a; in deep B_ pr m2 (nodeToDigit aa) end) | deepR B_ pr m (v :: va) = deep B_ pr m (nlistToDigit (v :: va)); fun viewLn B_ Empty = NONE | viewLn B_ (Single a) = SOME (a, Empty) | viewLn B_ (Deep (uu, Two (a, b), m, sf)) = SOME (a, deep B_ (One b) m sf) | viewLn B_ (Deep (uv, Three (a, b, c), m, sf)) = SOME (a, deep B_ (Two (b, c)) m sf) | viewLn B_ (Deep (uw, Four (a, b, c, d), m, sf)) = SOME (a, deep B_ (Three (b, c, d)) m sf) | viewLn B_ (Deep (ux, One a, m, sf)) = (case viewLn B_ m of NONE => SOME (a, digitToTree B_ sf) | SOME b => let val (ba, m2) = b; in SOME (a, deep B_ (nodeToDigit ba) m2 sf) end); fun deepL B_ [] m sf = (case viewLn B_ m of NONE => digitToTree B_ sf | SOME a => let val (aa, m2) = a; in deep B_ (nodeToDigit aa) m2 sf end) | deepL B_ (v :: va) m sf = deep B_ (nlistToDigit (v :: va)) m sf; fun nsplitTree A_ p i Empty = (Empty, (Tip ((raise Fail "undefined"), (raise Fail "undefined")), Empty)) | nsplitTree A_ p i (Single ea) = (Empty, (ea, Empty)) | nsplitTree A_ p i (Deep (uu, pr, m, sf)) = let val vpr = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) i (gmd A_ pr); val vm = Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) vpr (gmft A_ m); in (if p vpr then let val (l, (x, r)) = splitDigit A_ p i pr; in (nlistToTree A_ l, (x, deepL A_ r m sf)) end else (if p vm then let val (ml, (xs, mr)) = nsplitTree A_ p vpr m; val (l, (x, r)) = splitDigit A_ p (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) A_) vpr (gmft A_ ml)) (nodeToDigit xs); in (deepR A_ pr ml l, (x, deepL A_ r mr sf)) end else let val (l, (x, r)) = splitDigit A_ p vm sf; in (deepR A_ pr m l, (x, nlistToTree A_ r)) end)) end; fun n_unwrap (Tip (e, a)) = (e, a) | n_unwrap (Node2 (uu, a, b)) = (raise Fail "undefined") | n_unwrap (Node3 (uv, a, b, c)) = (raise Fail "undefined"); fun splitTreea A_ p i t = let val (l, (x, r)) = nsplitTree A_ p i t; in (l, (n_unwrap x, r)) end; fun splitTree_aux B_ p i t = Abs_splitres (if not (p i) andalso p (Arith.plus ((Arith.plus_semigroup_add o Arith.semigroup_add_monoid_add) B_) i (annot B_ t)) then splitTreea B_ p i (rep_FingerTree B_ t) else (Empty, ((raise Fail "undefined"), Empty))); fun splitTree A_ p i t = extract_splitres A_ (splitTree_aux A_ p i t); end; (*struct FingerTree*) structure PrioUniqueByAnnotatedList : sig type ('a, 'b) lp val monoid_add_LP : 'a Orderings.linorder -> 'b Orderings.linorder -> ('a, 'b) lp Arith.monoid_add val aluprio_pop : 'a Orderings.linorder -> 'b Orderings.linorder -> ((('a, 'b) lp -> bool) -> ('a, 'b) lp -> 'c -> 'c * ((unit * ('a, 'b) lp) * 'c)) -> ('c -> ('a, 'b) lp) -> ('c -> 'c -> 'c) -> 'c -> 'a * ('b * 'c) val aluprio_prio : 'a HOL.equal * 'a Orderings.linorder -> 'b Orderings.linorder -> ((('a, 'b) lp -> bool) -> ('a, 'b) lp -> 'c -> 'c * ((unit * ('a, 'b) lp) * 'c)) -> ('c -> ('a, 'b) lp) -> ('c -> bool) -> 'c -> 'a -> 'b option val aluprio_empty : 'a -> 'a val aluprio_insert : 'a Orderings.linorder -> 'b Orderings.linorder -> ((('a, 'b) lp -> bool) -> ('a, 'b) lp -> 'c -> 'c * ((unit * ('a, 'b) lp) * 'c)) -> ('c -> ('a, 'b) lp) -> ('c -> bool) -> ('c -> 'c -> 'c) -> ('c -> unit -> ('a, 'b) lp -> 'c) -> 'c -> 'a -> 'b -> 'c val aluprio_isEmpty : 'a -> 'a end = struct datatype ('a, 'b) lp = Infty | LP of 'a * 'b; fun p_min A_ B_ Infty Infty = Infty | p_min A_ B_ Infty (LP (e, a)) = LP (e, a) | p_min A_ B_ (LP (e, a)) Infty = LP (e, a) | p_min A_ B_ (LP (e1, a)) (LP (e2, b)) = LP (Orderings.max ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) e1 e2, Orderings.min ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) a b); fun plus_LPa A_ B_ a b = p_min A_ B_ a b; fun plus_LP A_ B_ = {plus = plus_LPa A_ B_} : ('a, 'b) lp Arith.plus; fun zero_LPa A_ B_ = Infty; fun zero_LP A_ B_ = {zero = zero_LPa A_ B_} : ('a, 'b) lp Arith.zero; fun semigroup_add_LP A_ B_ = {plus_semigroup_add = plus_LP A_ B_} : ('a, 'b) lp Arith.semigroup_add; fun monoid_add_LP A_ B_ = {semigroup_add_monoid_add = semigroup_add_LP A_ B_, zero_monoid_add = zero_LP A_ B_} : ('a, 'b) lp Arith.monoid_add; fun p_unwrap (LP (e, a)) = (e, a); fun e_less_eq A_ B_ e Infty = false | e_less_eq A_ B_ ea (LP (e, uu)) = Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) ea e; fun p_less_eq B_ (LP (e, a)) (LP (f, b)) = Orderings.less_eq ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) B_) a b | p_less_eq B_ uu Infty = true | p_less_eq B_ Infty (LP (e, a)) = false; fun less_eq_LP B_ = p_less_eq B_; fun aluprio_pop A_ B_ splits annot app s = let val a = splits (fn x => less_eq_LP B_ x (annot s)) Infty s; val (l, aa) = a; val (ab, b) = aa; in let val (_, lp) = ab; in (fn r => let val LP (e, ac) = lp; in (e, (ac, app l r)) end) end b end; fun aluprio_prio (A1_, A2_) B_ splits annot isEmpty s e = (if e_less_eq A2_ B_ e (annot s) andalso not (isEmpty s) then let val a = splits (e_less_eq A2_ B_ e) Infty s; val (_, aa) = a; val (ab, b) = aa; in let val (_, lp) = ab; in (fn _ => (if HOL.eq A1_ e (Product_Type.fst (p_unwrap lp)) then SOME (Product_Type.snd (p_unwrap lp)) else NONE)) end b end else NONE); fun aluprio_empty empt = empt; fun aluprio_insert A_ B_ splits annot isEmpty app consr s e a = (if e_less_eq A_ B_ e (annot s) andalso not (isEmpty s) then let val b = splits (e_less_eq A_ B_ e) Infty s; val (l, ba) = b; val (bb, c) = ba; in let val (_, lp) = bb; in (fn r => (if Orderings.less ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) e (Product_Type.fst (p_unwrap lp)) then app (consr (consr l () (LP (e, a))) () lp) r else app (consr l () (LP (e, a))) r)) end c end else consr s () (LP (e, a))); fun aluprio_isEmpty isEmpty = isEmpty; end; (*struct PrioUniqueByAnnotatedList*) structure FTAnnotatedListImpl : sig val ft_app : 'b Arith.monoid_add -> ('a, 'b) FingerTree.fingerTree -> ('a, 'b) FingerTree.fingerTree -> ('a, 'b) FingerTree.fingerTree val ft_annot : 'b Arith.monoid_add -> ('a, 'b) FingerTree.fingerTree -> 'b val ft_consr : 'b Arith.monoid_add -> ('a, 'b) FingerTree.fingerTree -> 'a -> 'b -> ('a, 'b) FingerTree.fingerTree val ft_empty : 'b Arith.monoid_add -> unit -> ('a, 'b) FingerTree.fingerTree val ft_splits : 'a Arith.monoid_add -> ('a -> bool) -> 'a -> ('b, 'a) FingerTree.fingerTree -> ('b, 'a) FingerTree.fingerTree * (('b * 'a) * ('b, 'a) FingerTree.fingerTree) val ft_isEmpty : 'b Arith.monoid_add -> ('a, 'b) FingerTree.fingerTree -> bool end = struct fun ft_app B_ = FingerTree.app B_; fun ft_annot B_ = FingerTree.annot B_; fun ft_consr B_ s e a = FingerTree.rcons B_ s (e, a); fun ft_empty B_ = (fn _ => FingerTree.empty B_); fun ft_splits A_ = FingerTree.splitTree A_; fun ft_isEmpty B_ = FingerTree.isEmpty B_; end; (*struct FTAnnotatedListImpl*) structure FTPrioUniqueImpl : sig val test_codegen : 'a Orderings.linorder -> 'b Orderings.linorder -> 'c Orderings.linorder -> 'd Orderings.linorder -> 'e Orderings.linorder -> 'f Orderings.linorder -> 'g Orderings.linorder -> 'h Orderings.linorder -> 'i HOL.equal * 'i Orderings.linorder -> 'j Orderings.linorder -> (unit -> (unit, ('a, 'b) PrioUniqueByAnnotatedList.lp) FingerTree.fingerTree) * (((unit, ('c, 'd) PrioUniqueByAnnotatedList.lp) FingerTree.fingerTree -> bool) * (((unit, ('e, 'f) PrioUniqueByAnnotatedList.lp) FingerTree.fingerTree -> 'e -> 'f -> (unit, ('e, 'f) PrioUniqueByAnnotatedList.lp) FingerTree.fingerTree) * (((unit, ('g, 'h) PrioUniqueByAnnotatedList.lp) FingerTree.fingerTree -> 'g * ('h * (unit, ('g, 'h) PrioUniqueByAnnotatedList.lp) FingerTree.fingerTree)) * ((unit, ('i, 'j) PrioUniqueByAnnotatedList.lp) FingerTree.fingerTree -> 'i -> 'j option)))) end = struct fun test_codegen A_ B_ C_ D_ E_ F_ G_ H_ (I1_, I2_) J_ = (PrioUniqueByAnnotatedList.aluprio_empty (FTAnnotatedListImpl.ft_empty (PrioUniqueByAnnotatedList.monoid_add_LP A_ B_)), (PrioUniqueByAnnotatedList.aluprio_isEmpty (FTAnnotatedListImpl.ft_isEmpty (PrioUniqueByAnnotatedList.monoid_add_LP C_ D_)), (PrioUniqueByAnnotatedList.aluprio_insert E_ F_ (FTAnnotatedListImpl.ft_splits (PrioUniqueByAnnotatedList.monoid_add_LP E_ F_)) (FTAnnotatedListImpl.ft_annot (PrioUniqueByAnnotatedList.monoid_add_LP E_ F_)) (FTAnnotatedListImpl.ft_isEmpty (PrioUniqueByAnnotatedList.monoid_add_LP E_ F_)) (FTAnnotatedListImpl.ft_app (PrioUniqueByAnnotatedList.monoid_add_LP E_ F_)) (FTAnnotatedListImpl.ft_consr (PrioUniqueByAnnotatedList.monoid_add_LP E_ F_)), (PrioUniqueByAnnotatedList.aluprio_pop G_ H_ (FTAnnotatedListImpl.ft_splits (PrioUniqueByAnnotatedList.monoid_add_LP G_ H_)) (FTAnnotatedListImpl.ft_annot (PrioUniqueByAnnotatedList.monoid_add_LP G_ H_)) (FTAnnotatedListImpl.ft_app (PrioUniqueByAnnotatedList.monoid_add_LP G_ H_)), PrioUniqueByAnnotatedList.aluprio_prio (I1_, I2_) J_ (FTAnnotatedListImpl.ft_splits (PrioUniqueByAnnotatedList.monoid_add_LP I2_ J_)) (FTAnnotatedListImpl.ft_annot (PrioUniqueByAnnotatedList.monoid_add_LP I2_ J_)) (FTAnnotatedListImpl.ft_isEmpty (PrioUniqueByAnnotatedList.monoid_add_LP I2_ J_)))))); end; (*struct FTPrioUniqueImpl*) ### theory "Collections.FTPrioUniqueImpl" ### 1.378s elapsed time, 2.716s cpu time, 0.916s GC time ### theory "Collections.SetSpec" ### 4.602s elapsed time, 9.132s cpu time, 1.912s GC time Loading theory "Collections.Algos" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") ### Introduced fixed type variable(s): 'c, 'd in "a__" or "m__" or "nda__" or "sa__" or "sf__" or "ux__" Loading theory "Collections.SetIndex" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") locale index_loc fixes m_ops :: "('i, 's, 'm, 'more1) map_ops_scheme" and s_ops :: "('x, 's, 'more2) set_ops_scheme" assumes "index_loc m_ops s_ops" locale map_to_nat_loc fixes s_ops :: "('x, 's, 'more1) set_ops_scheme" and m_ops :: "('x, nat, 'm, 'more2) map_ops_scheme" assumes "map_to_nat_loc s_ops m_ops" locale it_dom_fun_to_map_loc fixes s_ops :: "('k, 's, 'more1) set_ops_scheme" and m_ops :: "('k, 'v, 'm, 'more2) map_ops_scheme" assumes "it_dom_fun_to_map_loc s_ops m_ops" locale build_index_loc fixes m_ops :: "('i, 's, 'm, 'more1) map_ops_scheme" and s_ops :: "('x, 's, 'more3) set_ops_scheme" and t_ops :: "('x, 't, 'more2) set_ops_scheme" assumes "build_index_loc m_ops s_ops t_ops" locale set_to_list_defs_loc fixes s_ops :: "('x, 's, 'more1) set_ops_scheme" and l_ops :: "('x, 'l, 'more2) list_ops_scheme" ### theory "Collections.SetIndex" ### 0.578s elapsed time, 1.156s cpu time, 0.000s GC time Loading theory "Collections.SetIteratorCollectionsGA" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ListSetImpl" via "Collections.SetGA") locale set_to_list_loc fixes s_ops :: "('x, 's, 'more1) set_ops_scheme" and l_ops :: "('x, 'l, 'more2) list_ops_scheme" assumes "set_to_list_loc s_ops l_ops" ### theory "Collections.Algos" ### 0.788s elapsed time, 1.532s cpu time, 0.000s GC time ### Introduced fixed type variable(s): 'c, 'd in "a__" or "m__" or "nda__" or "pr__" or "sa__" or "ux__" ### theory "Collections.SetIteratorCollectionsGA" ### 0.433s elapsed time, 0.820s cpu time, 0.000s GC time Loading theory "Collections.MapGA" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.RBTSetImpl" via "Collections.RBTMapImpl") Loading theory "Collections.SetGA" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ListSetImpl") locale g_set_xx_defs_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('x, 's2, 'more2) set_ops_scheme" locale g_set_xx_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('x, 's2, 'more2) set_ops_scheme" assumes "g_set_xx_loc ops1 ops2" locale g_set_xxx_defs_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('x, 's2, 'more2) set_ops_scheme" and ops3 :: "('x, 's3, 'more3) set_ops_scheme" locale g_set_xxx_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('x, 's2, 'more2) set_ops_scheme" and ops3 :: "('x, 's3, 'more3) set_ops_scheme" assumes "g_set_xxx_loc ops1 ops2 ops3" locale g_set_xy_defs_loc fixes ops1 :: "('x1, 's1, 'more1) set_ops_scheme" and ops2 :: "('x2, 's2, 'more2) set_ops_scheme" assumes "g_set_xy_defs_loc ops1 ops2" locale StdBasicMapDefs fixes ops :: "('k, 'v, 's, 'more) map_basic_ops_scheme" locale StdBasicOMapDefs fixes ops :: "('k, 'v, 's, 'more) omap_basic_ops_scheme" locale g_set_xy_loc fixes ops1 :: "('x1, 's1, 'more1) set_ops_scheme" and ops2 :: "('x2, 's2, 'more2) set_ops_scheme" assumes "g_set_xy_loc ops1 ops2" locale StdBasicMap fixes ops :: "('k, 'v, 's, 'more) map_basic_ops_scheme" assumes "StdBasicMap ops" locale StdBasicOMap fixes ops :: "('k, 'v, 's, 'more) omap_basic_ops_scheme" assumes "StdBasicOMap ops" locale StdBasicMapDefs fixes ops :: "('k, 'v, 's, 'more) map_basic_ops_scheme" locale g_set_xyy_defs_loc fixes ops0 :: "('x0, 's0, 'more0) set_ops_scheme" and ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('x, 's2, 'more2) set_ops_scheme" locale g_set_xyy_loc fixes ops0 :: "('x0, 's0, 'more0) set_ops_scheme" and ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('x, 's2, 'more2) set_ops_scheme" assumes "g_set_xyy_loc ops0 ops1 ops2" locale StdBasicMap fixes ops :: "('k, 'v, 's, 'more) map_basic_ops_scheme" assumes "StdBasicMap ops" locale StdBasicOMapDefs fixes ops :: "('k, 'v, 's, 'more) omap_basic_ops_scheme" locale StdBasicOMap fixes ops :: "('k, 'v, 's, 'more) omap_basic_ops_scheme" assumes "StdBasicOMap ops" locale g_image_filter_defs_loc fixes ops1 :: "('k1, 'v1, 's1, 'm1) map_ops_scheme" and ops2 :: "('k2, 'v2, 's2, 'm2) map_ops_scheme" locale StdBasicSetDefs fixes ops :: "('x, 's, 'more) set_basic_ops_scheme" locale g_image_filter_loc fixes ops1 :: "('k1, 'v1, 's1, 'm1) map_ops_scheme" and ops2 :: "('k2, 'v2, 's2, 'm2) map_ops_scheme" assumes "g_image_filter_loc ops1 ops2" locale StdBasicOSetDefs fixes ops :: "('x, 's, 'more) oset_basic_ops_scheme" locale g_value_image_filter_defs_loc fixes ops1 :: "('k, 'v1, 's1, 'm1) map_ops_scheme" and ops2 :: "('k, 'v2, 's2, 'm2) map_ops_scheme" locale StdBasicSet fixes ops :: "('x, 's, 'more) set_basic_ops_scheme" assumes "StdBasicSet ops" locale StdBasicOSet fixes ops :: "('x, 's, 'more) oset_basic_ops_scheme" assumes "StdBasicOSet ops" locale StdBasicSetDefs fixes ops :: "('x, 's, 'more) set_basic_ops_scheme" locale g_value_image_filter_loc fixes ops1 :: "('k, 'v1, 's1, 'm1) map_ops_scheme" and ops2 :: "('k, 'v2, 's2, 'm2) map_ops_scheme" assumes "g_value_image_filter_loc ops1 ops2" ### theory "Collections.MapGA" ### 2.660s elapsed time, 5.272s cpu time, 0.856s GC time Loading theory "Collections.ArrayMapImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ArraySetImpl") Found termination order: "(\p. length (snd p)) <*mlex*> {}" locale StdBasicSet fixes ops :: "('x, 's, 'more) set_basic_ops_scheme" assumes "StdBasicSet ops" Found termination order: "(\p. size (fst p)) <*mlex*> {}" locale StdBasicSet fixes ops :: "('x, 's, 'more) set_basic_ops_scheme" assumes "StdBasicSet ops" locale StdBasicOSetDefs fixes ops :: "('x, 's, 'more) oset_basic_ops_scheme" locale StdBasicOSet fixes ops :: "('x, 's, 'more) oset_basic_ops_scheme" assumes "StdBasicOSet ops" locale image_filter_cp_defs_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('y, 's2, 'more2) set_ops_scheme" and ops3 :: "('z, 's3, 'more3) set_ops_scheme" locale image_filter_cp_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('y, 's2, 'more2) set_ops_scheme" and ops3 :: "('z, 's3, 'more3) set_ops_scheme" assumes "image_filter_cp_loc ops1 ops2 ops3" locale inj_image_filter_cp_defs_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('y, 's2, 'more2) set_ops_scheme" and ops3 :: "('z, 's3, 'more3) set_ops_scheme" locale inj_image_filter_cp_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('y, 's2, 'more2) set_ops_scheme" and ops3 :: "('z, 's3, 'more3) set_ops_scheme" assumes "inj_image_filter_cp_loc ops1 ops2 ops3" locale cart_defs_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('y, 's2, 'more2) set_ops_scheme" and ops3 :: "('x \ 'y, 's3, 'more3) set_ops_scheme" locale cart_loc fixes ops1 :: "('x, 's1, 'more1) set_ops_scheme" and ops2 :: "('y, 's2, 'more2) set_ops_scheme" and ops3 :: "('x \ 'y, 's3, 'more3) set_ops_scheme" assumes "cart_loc ops1 ops2 ops3" ### theory "Collections.SetGA" ### 4.395s elapsed time, 8.752s cpu time, 0.856s GC time Loading theory "Collections.ListMapImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.HashSet" via "Collections.HashMap" via "Collections.HashMap_Impl") structure STArray = struct datatype 'a Cell = Invalid | Value of 'a array; exception AccessedOldVersion; type 'a array = 'a Cell Unsynchronized.ref; fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun array (size, v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun sub (Unsynchronized.ref Invalid, idx) = raise AccessedOldVersion | sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx); fun update (aref,idx,v) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( aref := Invalid; Array.update (a,idx,v); Unsynchronized.ref (Value a) ); fun length (Unsynchronized.ref Invalid) = raise AccessedOldVersion | length (Unsynchronized.ref (Value a)) = Array.length a fun grow (aref, i, x) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+i,x) in aref := Invalid; Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( aref:=Invalid; Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); end; end; structure FArray = struct datatype 'a Cell = Value of 'a Array.array | Upd of (int*'a*'a Cell Unsynchronized.ref); type 'a array = 'a Cell Unsynchronized.ref; fun array (size,v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx) | sub (Unsynchronized.ref (Upd (i,v,cr)),idx) = if i=idx then v else sub (cr,idx); fun length (Unsynchronized.ref (Value a)) = Array.length a | length (Unsynchronized.ref (Upd (i,v,cr))) = length cr; fun realize_aux (aref, v) = case aref of (Unsynchronized.ref (Value a)) => ( let val len = Array.length a; val a' = Array.array (len,v); in Array.copy {src=a, dst=a', di=0}; Unsynchronized.ref (Value a') end ) | (Unsynchronized.ref (Upd (i,v,cr))) => ( let val res=realize_aux (cr,v) in case res of (Unsynchronized.ref (Value a)) => (Array.update (a,i,v); res) end ); fun realize aref = case aref of (Unsynchronized.ref (Value _)) => aref | (Unsynchronized.ref (Upd (i,v,cr))) => realize_aux(aref,v); fun update (aref,idx,v) = case aref of (Unsynchronized.ref (Value a)) => ( let val nref=Unsynchronized.ref (Value a) in aref := Upd (idx,Array.sub(a,idx),nref); Array.update (a,idx,v); nref end ) | (Unsynchronized.ref (Upd _)) => let val ra = realize_aux(aref,v) in case ra of (Unsynchronized.ref (Value a)) => Array.update (a,idx,v); ra end ; fun grow (aref, inc, x) = case aref of (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+inc,x) in Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ) | (Unsynchronized.ref (Upd _)) => ( grow (realize aref, inc, x) ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ) | (Unsynchronized.ref (Upd _)) => ( shrink (realize aref,sz) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); fun array_get_oo (d:'a) (a:'a ArrayType) (i:IntInf.int) = sub (a,IntInf.toInt i) handle Subscript => d fun array_set_oo (d:(unit->'a ArrayType)) (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e) handle Subscript => d () end; end; structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure List : sig val rev : 'a list -> 'a list val foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun foldl f a [] = a | foldl f a (x :: xs) = foldl f (f a x) xs; end; (*struct List*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool val max : 'a ord -> 'a -> 'a -> 'a end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; fun max A_ a b = (if less_eq A_ a b then b else a); end; (*struct Orderings*) structure Arith : sig type nat val integer_of_nat : nat -> IntInf.int val less_eq_nat : nat -> nat -> bool val less_nat : nat -> nat -> bool val ord_nat : nat Orderings.ord datatype num = One | Bit0 of num | Bit1 of num val plus_nat : nat -> nat -> nat val one_nat : nat val suc : nat -> nat val zero_nat : nat val nat_of_integer : IntInf.int -> nat val equal_nat : nat -> nat -> bool val minus_nat : nat -> nat -> nat val times_nat : nat -> nat -> nat end = struct datatype nat = Nat of IntInf.int; fun integer_of_nat (Nat x) = x; fun less_eq_nat m n = IntInf.<= (integer_of_nat m, integer_of_nat n); fun less_nat m n = IntInf.< (integer_of_nat m, integer_of_nat n); val ord_nat = {less_eq = less_eq_nat, less = less_nat} : nat Orderings.ord; val ord_integer = {less_eq = (fn a => fn b => IntInf.<= (a, b)), less = (fn a => fn b => IntInf.< (a, b))} : IntInf.int Orderings.ord; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat m n = Nat (IntInf.+ (integer_of_nat m, integer_of_nat n)); val one_nat : nat = Nat (1 : IntInf.int); fun suc n = plus_nat n one_nat; val zero_nat : nat = Nat (0 : IntInf.int); fun nat_of_integer k = Nat (Orderings.max ord_integer (0 : IntInf.int) k); fun equal_nat m n = (((integer_of_nat m) : IntInf.int) = (integer_of_nat n)); fun minus_nat m n = Nat (Orderings.max ord_integer (0 : IntInf.int) (IntInf.- (integer_of_nat m, integer_of_nat n))); fun times_nat m n = Nat (IntInf.* (integer_of_nat m, integer_of_nat n)); end; (*struct Arith*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Diff_Array : sig val array_get : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a val array_set : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType val array_grow : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType val array_get_oo : 'a -> 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a val array_length : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat val array_set_oo : (unit -> 'a FArray.IsabelleMapping.ArrayType) -> 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType end = struct fun array_get a = FArray.IsabelleMapping.array_get a o Arith.integer_of_nat; fun array_set a = FArray.IsabelleMapping.array_set a o Arith.integer_of_nat; fun array_grow a = FArray.IsabelleMapping.array_grow a o Arith.integer_of_nat; fun array_get_oo x a = FArray.IsabelleMapping.array_get_oo x a o Arith.integer_of_nat; fun array_length x = (Arith.nat_of_integer o FArray.IsabelleMapping.array_length) x; fun array_set_oo f a = FArray.IsabelleMapping.array_set_oo f a o Arith.integer_of_nat; end; (*struct Diff_Array*) structure ArrayMapImpl : sig val test_codegen : (('a option) FArray.IsabelleMapping.ArrayType -> ('a option) FArray.IsabelleMapping.ArrayType -> ('a option) FArray.IsabelleMapping.ArrayType) * ((('b option) FArray.IsabelleMapping.ArrayType -> ('b option) FArray.IsabelleMapping.ArrayType -> ('b option) FArray.IsabelleMapping.ArrayType) * ((('c option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'c -> bool) -> bool) * ((('d option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'd -> bool) -> bool) * ((Arith.nat -> ('e option) FArray.IsabelleMapping.ArrayType -> ('e option) FArray.IsabelleMapping.ArrayType) * ((unit -> ('f option) FArray.IsabelleMapping.ArrayType) * ((('g option) FArray.IsabelleMapping.ArrayType -> bool) * ((('h option) FArray.IsabelleMapping.ArrayType -> bool) * ((('i option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'i -> 'j -> 'j) -> 'j -> 'j) * ((('k option) FArray.IsabelleMapping.ArrayType -> ('l -> bool) -> (Arith.nat * 'k -> 'l -> 'l) -> 'l -> 'l) * ((('m option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'm -> 'n -> 'n) -> 'n -> 'n) * ((('o option) FArray.IsabelleMapping.ArrayType -> ('p -> bool) -> (Arith.nat * 'o -> 'p -> 'p) -> 'p -> 'p) * ((('q option) FArray.IsabelleMapping.ArrayType -> ((Arith.nat * 'q) list -> bool) -> (Arith.nat * 'q -> (Arith.nat * 'q) list -> (Arith.nat * 'q) list) -> (Arith.nat * 'q) list -> (Arith.nat * 'q) list) * ((Arith.nat -> ('r option) FArray.IsabelleMapping.ArrayType -> 'r option) * ((('s option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 's -> bool) -> (Arith.nat * 's) option) * ((('t option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 't -> bool) -> (Arith.nat * 't) option) * (((Arith.nat * 'u -> bool) -> ('u option) FArray.IsabelleMapping.ArrayType -> ('u option) FArray.IsabelleMapping.ArrayType) * ((('v option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'v -> 'w -> 'w) -> 'w -> 'w) * ((('x option) FArray.IsabelleMapping.ArrayType -> ('y -> bool) -> (Arith.nat * 'x -> 'y -> 'y) -> 'y -> 'y) * ((('z option) FArray.IsabelleMapping.ArrayType -> ((Arith.nat * 'z) list -> bool) -> (Arith.nat * 'z -> (Arith.nat * 'z) list -> (Arith.nat * 'z) list) -> (Arith.nat * 'z) list -> (Arith.nat * 'z) list) * ((('aa option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'aa -> 'ab -> 'ab) -> 'ab -> 'ab) * ((('ac option) FArray.IsabelleMapping.ArrayType -> ('ad -> bool) -> (Arith.nat * 'ac -> 'ad -> 'ad) -> 'ad -> 'ad) * ((('ae option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'ae -> bool) -> (Arith.nat * 'ae) option) * ((('af option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * ((Arith.nat -> ('ag option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * ((Arith.nat -> 'ah -> ('ah option) FArray.IsabelleMapping.ArrayType) * ((('ai option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'ai) list) * (((Arith.nat * 'aj) list -> ('aj option) FArray.IsabelleMapping.ArrayType) * ((('ak option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'ak) list) * ((('al option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'al) list) * ((Arith.nat -> 'am -> ('am option) FArray.IsabelleMapping.ArrayType -> ('am option) FArray.IsabelleMapping.ArrayType) * (Arith.nat -> 'an -> ('an option) FArray.IsabelleMapping.ArrayType -> ('an option) FArray.IsabelleMapping.ArrayType))))))))))))))))))))))))))))))) end = struct fun iam_empty x = (fn _ => FArray.IsabelleMapping.array_of_list []) x; fun iam_delete k a = Diff_Array.array_set_oo (fn _ => a) a k NONE; fun iam_alpha a i = Diff_Array.array_get_oo NONE a i; fun iam_lookup k a = iam_alpha a k; fun iam_increment l idx = Orderings.max Arith.ord_nat (Arith.minus_nat (Arith.plus_nat idx Arith.one_nat) l) (Arith.plus_nat (Arith.times_nat (Arith.nat_of_integer (2 : IntInf.int)) l) (Arith.nat_of_integer (3 : IntInf.int))); fun iam_update k v a = Diff_Array.array_set_oo (fn _ => Diff_Array.array_set (Diff_Array.array_grow a (iam_increment (Diff_Array.array_length a) k) NONE) k (SOME v)) a k (SOME v); fun iam_rev_iterateoi_aux v a c f sigma = (if Arith.equal_nat v Arith.zero_nat then sigma else (if c sigma then iam_rev_iterateoi_aux (Arith.minus_nat (Arith.suc (Arith.minus_nat v Arith.one_nat)) Arith.one_nat) a c f (case Diff_Array.array_get a (Arith.minus_nat (Arith.suc (Arith.minus_nat v Arith.one_nat)) Arith.one_nat) of NONE => sigma | SOME x => f (Arith.minus_nat (Arith.suc (Arith.minus_nat v Arith.one_nat)) Arith.one_nat, x) sigma) else sigma)); fun iam_rev_iterateoi a = iam_rev_iterateoi_aux (Diff_Array.array_length a) a; fun rev_iterateoi_map_op_rev_list_it_iam_ops s = iam_rev_iterateoi s; fun iam_iterateoi_aux i len a c f sigma = (if Arith.less_eq_nat len i orelse not (c sigma) then sigma else let val b = (case Diff_Array.array_get a i of NONE => sigma | SOME x => f (i, x) sigma); in iam_iterateoi_aux (Arith.plus_nat i Arith.one_nat) len a c f b end); fun iam_iterateoi a = iam_iterateoi_aux Arith.zero_nat (Diff_Array.array_length a) a; fun iterateoi_map_op_ordered_list_it_iam_ops s = iam_iterateoi s; fun iteratei_map_op_list_it_iam_ops s = iam_rev_iterateoi s; fun rev_iterateoi_bmap_op_rev_list_it_iam_basic_ops s = iam_rev_iterateoi s; fun g_to_sorted_list_iam_basic_ops m = rev_iterateoi_bmap_op_rev_list_it_iam_basic_ops m (fn _ => true) (fn a => fn b => a :: b) []; fun iterateoi_bmap_op_ordered_list_it_iam_basic_ops s = iam_iterateoi s; fun g_to_rev_list_iam_basic_ops m = iterateoi_bmap_op_ordered_list_it_iam_basic_ops m (fn _ => true) (fn a => fn b => a :: b) []; fun g_list_to_map_iam_basic_ops l = List.foldl (fn m => fn (k, v) => iam_update k v m) (iam_empty ()) (List.rev l); fun iteratei_bmap_op_list_it_iam_basic_ops s = iam_rev_iterateoi s; fun g_size_abort_iam_basic_ops b m = iteratei_bmap_op_list_it_iam_basic_ops m (fn s => Arith.less_nat s b) (fn _ => Arith.suc) Arith.zero_nat; fun iam_update_dj x = iam_update x; fun g_restrict_iam_basic_ops p m = iteratei_bmap_op_list_it_iam_basic_ops m (fn _ => true) (fn (k, v) => fn sigma => (if p (k, v) then iam_update_dj k v sigma else sigma)) (iam_empty ()); fun g_to_list_iam_basic_ops m = iteratei_bmap_op_list_it_iam_basic_ops m (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_iam_basic_ops m = Arith.equal_nat (g_size_abort_iam_basic_ops Arith.one_nat m) Arith.zero_nat; fun g_add_dj_iam_basic_ops m1 m2 = iteratei_bmap_op_list_it_iam_basic_ops m2 (fn _ => true) (fn (a, b) => iam_update_dj a b) m1; fun g_isSng_iam_basic_ops m = Arith.equal_nat (g_size_abort_iam_basic_ops (Arith.nat_of_integer (2 : IntInf.int)) m) Arith.one_nat; fun g_size_iam_basic_ops m = iteratei_bmap_op_list_it_iam_basic_ops m (fn _ => true) (fn _ => Arith.suc) Arith.zero_nat; fun g_ball_iam_basic_ops m p = iteratei_bmap_op_list_it_iam_basic_ops m Fun.id (fn kv => fn _ => p kv) true; fun g_sng_iam_basic_ops k v = iam_update k v (iam_empty ()); fun g_sel_iam_basic_ops m p = iteratei_bmap_op_list_it_iam_basic_ops m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_min_iam_basic_ops m p = iterateoi_bmap_op_ordered_list_it_iam_basic_ops m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_max_iam_basic_ops m p = rev_iterateoi_bmap_op_rev_list_it_iam_basic_ops m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_iam_basic_ops m p = iteratei_bmap_op_list_it_iam_basic_ops m not (fn kv => fn _ => p kv) false; fun g_add_iam_basic_ops m1 m2 = iteratei_bmap_op_list_it_iam_basic_ops m2 (fn _ => true) (fn (a, b) => iam_update a b) m1; val test_codegen : (('a option) FArray.IsabelleMapping.ArrayType -> ('a option) FArray.IsabelleMapping.ArrayType -> ('a option) FArray.IsabelleMapping.ArrayType) * ((('b option) FArray.IsabelleMapping.ArrayType -> ('b option) FArray.IsabelleMapping.ArrayType -> ('b option) FArray.IsabelleMapping.ArrayType) * ((('c option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'c -> bool) -> bool) * ((('d option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'd -> bool) -> bool) * ((Arith.nat -> ('e option) FArray.IsabelleMapping.ArrayType -> ('e option) FArray.IsabelleMapping.ArrayType) * ((unit -> ('f option) FArray.IsabelleMapping.ArrayType) * ((('g option) FArray.IsabelleMapping.ArrayType -> bool) * ((('h option) FArray.IsabelleMapping.ArrayType -> bool) * ((('i option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'i -> 'j -> 'j) -> 'j -> 'j) * ((('k option) FArray.IsabelleMapping.ArrayType -> ('l -> bool) -> (Arith.nat * 'k -> 'l -> 'l) -> 'l -> 'l) * ((('m option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'm -> 'n -> 'n) -> 'n -> 'n) * ((('o option) FArray.IsabelleMapping.ArrayType -> ('p -> bool) -> (Arith.nat * 'o -> 'p -> 'p) -> 'p -> 'p) * ((('q option) FArray.IsabelleMapping.ArrayType -> ((Arith.nat * 'q) list -> bool) -> (Arith.nat * 'q -> (Arith.nat * 'q) list -> (Arith.nat * 'q) list) -> (Arith.nat * 'q) list -> (Arith.nat * 'q) list) * ((Arith.nat -> ('r option) FArray.IsabelleMapping.ArrayType -> 'r option) * ((('s option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 's -> bool) -> (Arith.nat * 's) option) * ((('t option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 't -> bool) -> (Arith.nat * 't) option) * (((Arith.nat * 'u -> bool) -> ('u option) FArray.IsabelleMapping.ArrayType -> ('u option) FArray.IsabelleMapping.ArrayType) * ((('v option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'v -> 'w -> 'w) -> 'w -> 'w) * ((('x option) FArray.IsabelleMapping.ArrayType -> ('y -> bool) -> (Arith.nat * 'x -> 'y -> 'y) -> 'y -> 'y) * ((('z option) FArray.IsabelleMapping.ArrayType -> ((Arith.nat * 'z) list -> bool) -> (Arith.nat * 'z -> (Arith.nat * 'z) list -> (Arith.nat * 'z) list) -> (Arith.nat * 'z) list -> (Arith.nat * 'z) list) * ((('aa option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'aa -> 'ab -> 'ab) -> 'ab -> 'ab) * ((('ac option) FArray.IsabelleMapping.ArrayType -> ('ad -> bool) -> (Arith.nat * 'ac -> 'ad -> 'ad) -> 'ad -> 'ad) * ((('ae option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'ae -> bool) -> (Arith.nat * 'ae) option) * ((('af option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * ((Arith.nat -> ('ag option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * ((Arith.nat -> 'ah -> ('ah option) FArray.IsabelleMapping.ArrayType) * ((('ai option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'ai) list) * (((Arith.nat * 'aj) list -> ('aj option) FArray.IsabelleMapping.ArrayType) * ((('ak option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'ak) list) * ((('al option) FArray.IsabelleMapping.ArrayType -> (Arith.nat * 'al) list) * ((Arith.nat -> 'am -> ('am option) FArray.IsabelleMapping.ArrayType -> ('am option) FArray.IsabelleMapping.ArrayType) * (Arith.nat -> 'an -> ('an option) FArray.IsabelleMapping.ArrayType -> ('an option) FArray.IsabelleMapping.ArrayType))))))))))))))))))))))))))))))) = (g_add_iam_basic_ops, (g_add_dj_iam_basic_ops, (g_ball_iam_basic_ops, (g_bex_iam_basic_ops, (iam_delete, (iam_empty, (g_isEmpty_iam_basic_ops, (g_isSng_iam_basic_ops, ((fn m => iteratei_map_op_list_it_iam_ops m (fn _ => true)), (iteratei_map_op_list_it_iam_ops, ((fn m => iterateoi_map_op_ordered_list_it_iam_ops m (fn _ => true)), (iterateoi_map_op_ordered_list_it_iam_ops, (iam_rev_iterateoi, (iam_lookup, (g_max_iam_basic_ops, (g_min_iam_basic_ops, (g_restrict_iam_basic_ops, ((fn m => rev_iterateoi_map_op_rev_list_it_iam_ops m (fn _ => true)), (rev_iterateoi_map_op_rev_list_it_iam_ops, (iam_rev_iterateoi, ((fn m => rev_iterateoi_map_op_rev_list_it_iam_ops m (fn _ => true)), (rev_iterateoi_map_op_rev_list_it_iam_ops, (g_sel_iam_basic_ops, (g_size_iam_basic_ops, (g_size_abort_iam_basic_ops, (g_sng_iam_basic_ops, (g_to_list_iam_basic_ops, (g_list_to_map_iam_basic_ops, (g_to_rev_list_iam_basic_ops, (g_to_sorted_list_iam_basic_ops, (iam_update, iam_update_dj))))))))))))))))))))))))))))))); end; (*struct ArrayMapImpl*) ### theory "Collections.ArrayMapImpl" ### 2.228s elapsed time, 4.468s cpu time, 0.000s GC time Loading theory "Collections.ListMapImpl_Invar" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.MapStdImpl") structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure List : sig val rev : 'a list -> 'a list val foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun foldl f a [] = a | foldl f a (x :: xs) = foldl f (f a x) xs; end; (*struct List*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure AList : sig val delete_aux : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list val update_with_aux : 'b HOL.equal -> 'a -> 'b -> ('a -> 'a) -> ('b * 'a) list -> ('b * 'a) list end = struct fun delete_aux A_ k [] = [] | delete_aux A_ ka ((k, v) :: xs) = (if HOL.eq A_ ka k then xs else (k, v) :: delete_aux A_ ka xs); fun update_with_aux B_ v k f [] = [(k, f v)] | update_with_aux B_ v k f (p :: ps) = (if HOL.eq B_ (Product_Type.fst p) k then (k, f (Product_Type.snd p)) :: ps else p :: update_with_aux B_ v k f ps); end; (*struct AList*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Assoc_List : sig type ('b, 'a) assoc_list val empty : ('a, 'b) assoc_list val delete : 'a HOL.equal -> 'a -> ('a, 'b) assoc_list -> ('a, 'b) assoc_list val lookup : 'a HOL.equal -> ('a, 'b) assoc_list -> 'a -> 'b option val update : 'a HOL.equal -> 'a -> 'b -> ('a, 'b) assoc_list -> ('a, 'b) assoc_list val iteratei : ('a, 'b) assoc_list -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('b, 'a) assoc_list = Assoc_List of ('b * 'a) list; val empty : ('a, 'b) assoc_list = Assoc_List []; fun impl_of (Assoc_List x) = x; fun delete A_ k al = Assoc_List (AList.delete_aux A_ k (impl_of al)); fun lookup A_ al = Map.map_of A_ (impl_of al); fun update_with A_ v k f al = Assoc_List (AList.update_with_aux A_ v k f (impl_of al)); fun update A_ k v = update_with A_ v k (fn _ => v); fun iteratei al c f = Foldi.foldli (impl_of al) c f; end; (*struct Assoc_List*) structure ListMapImpl : sig val test_codegen : 'a HOL.equal -> 'c HOL.equal -> 'i HOL.equal -> 'y HOL.equal -> 'aa HOL.equal -> 'ai HOL.equal -> 'am HOL.equal -> 'ao HOL.equal -> 'aq HOL.equal -> (('a, 'b) Assoc_List.assoc_list -> ('a, 'b) Assoc_List.assoc_list -> ('a, 'b) Assoc_List.assoc_list) * ((('c, 'd) Assoc_List.assoc_list -> ('c, 'd) Assoc_List.assoc_list -> ('c, 'd) Assoc_List.assoc_list) * ((('e, 'f) Assoc_List.assoc_list -> ('e * 'f -> bool) -> bool) * ((('g, 'h) Assoc_List.assoc_list -> ('g * 'h -> bool) -> bool) * (('i -> ('i, 'j) Assoc_List.assoc_list -> ('i, 'j) Assoc_List.assoc_list) * ((unit -> ('k, 'l) Assoc_List.assoc_list) * ((('m, 'n) Assoc_List.assoc_list -> bool) * ((('o, 'p) Assoc_List.assoc_list -> bool) * ((('q, 'r) Assoc_List.assoc_list -> ('q * 'r -> 's -> 's) -> 's -> 's) * ((('t, 'u) Assoc_List.assoc_list -> ('v -> bool) -> ('t * 'u -> 'v -> 'v) -> 'v -> 'v) * ((('w, 'x) Assoc_List.assoc_list -> (('w * 'x) list -> bool) -> ('w * 'x -> ('w * 'x) list -> ('w * 'x) list) -> ('w * 'x) list -> ('w * 'x) list) * (('y -> ('y, 'z) Assoc_List.assoc_list -> 'z option) * ((('aa * 'ab -> bool) -> ('aa, 'ab) Assoc_List.assoc_list -> ('aa, 'ab) Assoc_List.assoc_list) * ((('ac, 'ad) Assoc_List.assoc_list -> ('ac * 'ad -> bool) -> ('ac * 'ad) option) * ((('ae, 'af) Assoc_List.assoc_list -> Arith.nat) * ((Arith.nat -> ('ag, 'ah) Assoc_List.assoc_list -> Arith.nat) * (('ai -> 'aj -> ('ai, 'aj) Assoc_List.assoc_list) * ((('ak, 'al) Assoc_List.assoc_list -> ('ak * 'al) list) * ((('am * 'an) list -> ('am, 'an) Assoc_List.assoc_list) * (('ao -> 'ap -> ('ao, 'ap) Assoc_List.assoc_list -> ('ao, 'ap) Assoc_List.assoc_list) * ('aq -> 'ar -> ('aq, 'ar) Assoc_List.assoc_list -> ('aq, 'ar) Assoc_List.assoc_list)))))))))))))))))))) end = struct fun iteratei_map_op_list_it_lm_ops s = Assoc_List.iteratei s; fun g_list_to_map_lm_basic_ops A_ l = List.foldl (fn m => fn (k, v) => Assoc_List.update A_ k v m) Assoc_List.empty (List.rev l); fun iteratei_bmap_op_list_it_lm_basic_ops s = Assoc_List.iteratei s; fun g_size_abort_lm_basic_ops b m = iteratei_bmap_op_list_it_lm_basic_ops m (fn s => Arith.less_nat s b) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_restrict_lm_basic_ops A_ p m = iteratei_bmap_op_list_it_lm_basic_ops m (fn _ => true) (fn (k, v) => fn sigma => (if p (k, v) then Assoc_List.update A_ k v sigma else sigma)) Assoc_List.empty; fun g_to_list_lm_basic_ops m = iteratei_bmap_op_list_it_lm_basic_ops m (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_lm_basic_ops m = Arith.equal_nat (g_size_abort_lm_basic_ops Arith.one_nat m) Arith.Zero_nat; fun g_add_dj_lm_basic_ops A_ m1 m2 = iteratei_bmap_op_list_it_lm_basic_ops m2 (fn _ => true) (fn (a, b) => Assoc_List.update A_ a b) m1; fun g_isSng_lm_basic_ops m = Arith.equal_nat (g_size_abort_lm_basic_ops (Arith.nat_of_num (Arith.Bit0 Arith.One)) m) Arith.one_nat; fun g_size_lm_basic_ops m = iteratei_bmap_op_list_it_lm_basic_ops m (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_ball_lm_basic_ops m p = iteratei_bmap_op_list_it_lm_basic_ops m Fun.id (fn kv => fn _ => p kv) true; fun g_sng_lm_basic_ops A_ k v = Assoc_List.update A_ k v Assoc_List.empty; fun g_sel_lm_basic_ops m p = iteratei_bmap_op_list_it_lm_basic_ops m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_lm_basic_ops m p = iteratei_bmap_op_list_it_lm_basic_ops m not (fn kv => fn _ => p kv) false; fun g_add_lm_basic_ops A_ m1 m2 = iteratei_bmap_op_list_it_lm_basic_ops m2 (fn _ => true) (fn (a, b) => Assoc_List.update A_ a b) m1; fun test_codegen A_ C_ I_ Y_ Aa_ Ai_ Am_ Ao_ Aq_ = (g_add_lm_basic_ops A_, (g_add_dj_lm_basic_ops C_, (g_ball_lm_basic_ops, (g_bex_lm_basic_ops, (Assoc_List.delete I_, ((fn _ => Assoc_List.empty), (g_isEmpty_lm_basic_ops, (g_isSng_lm_basic_ops, ((fn m => iteratei_map_op_list_it_lm_ops m (fn _ => true)), (iteratei_map_op_list_it_lm_ops, (Assoc_List.iteratei, ((fn k => fn m => Assoc_List.lookup Y_ m k), (g_restrict_lm_basic_ops Aa_, (g_sel_lm_basic_ops, (g_size_lm_basic_ops, (g_size_abort_lm_basic_ops, (g_sng_lm_basic_ops Ai_, (g_to_list_lm_basic_ops, (g_list_to_map_lm_basic_ops Am_, (Assoc_List.update Ao_, Assoc_List.update Aq_)))))))))))))))))))); end; (*struct ListMapImpl*) ### theory "Collections.ListMapImpl" ### 1.548s elapsed time, 3.044s cpu time, 0.720s GC time Loading theory "Collections.ArrayHashMap_Impl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ArrayHashSet" via "Collections.ArrayHashMap") structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure Arith : sig datatype nat = Zero_nat | Suc of nat val less_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; end; (*struct Arith*) structure List : sig val rev : 'a list -> 'a list val foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a val size_list : 'a list -> Arith.nat end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun foldl f a [] = a | foldl f a (x :: xs) = foldl f (f a x) xs; fun gen_length n (x :: xs) = gen_length (Arith.Suc n) xs | gen_length n [] = n; fun size_list x = gen_length Arith.Zero_nat x; end; (*struct List*) structure Misc : sig val revg : 'a list -> 'a list -> 'a list end = struct fun revg [] b = b | revg (a :: asa) b = revg asa (a :: b); end; (*struct Misc*) structure Product_Type : sig val fst : 'a * 'b -> 'a end = struct fun fst (x1, x2) = x1; end; (*struct Product_Type*) structure AList : sig val update : 'a HOL.equal -> 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list val delete_aux : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list end = struct fun update A_ k v [] = [(k, v)] | update A_ k v (p :: ps) = (if HOL.eq A_ (Product_Type.fst p) k then (k, v) :: ps else p :: update A_ k v ps); fun delete_aux A_ k [] = [] | delete_aux A_ ka ((k, v) :: xs) = (if HOL.eq A_ ka k then xs else (k, v) :: delete_aux A_ ka xs); end; (*struct AList*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure ListMapImpl_Invar : sig val test_codegen : 'a HOL.equal -> 'i HOL.equal -> 'y HOL.equal -> 'ai HOL.equal -> 'am HOL.equal -> 'ao HOL.equal -> (('a * 'b) list -> ('a * 'b) list -> ('a * 'b) list) * ((('c * 'd) list -> ('c * 'd) list -> ('c * 'd) list) * ((('e * 'f) list -> ('e * 'f -> bool) -> bool) * ((('g * 'h) list -> ('g * 'h -> bool) -> bool) * (('i -> ('i * 'j) list -> ('i * 'j) list) * ((unit -> ('k * 'l) list) * ((('m * 'n) list -> bool) * ((('o * 'p) list -> bool) * ((('q * 'r) list -> ('q * 'r -> 's -> 's) -> 's -> 's) * ((('t * 'u) list -> ('v -> bool) -> ('t * 'u -> 'v -> 'v) -> 'v -> 'v) * ((('w * 'x) list -> (('w * 'x) list -> bool) -> ('w * 'x -> ('w * 'x) list -> ('w * 'x) list) -> ('w * 'x) list -> ('w * 'x) list) * (('y -> ('y * 'z) list -> 'z option) * ((('aa * 'ab -> bool) -> ('aa * 'ab) list -> ('aa * 'ab) list) * ((('ac * 'ad) list -> ('ac * 'ad -> bool) -> ('ac * 'ad) option) * ((('ae * 'af) list -> Arith.nat) * ((Arith.nat -> ('ag * 'ah) list -> Arith.nat) * (('ai -> 'aj -> ('ai * 'aj) list) * ((('ak * 'al) list -> ('ak * 'al) list) * ((('am * 'an) list -> ('am * 'an) list) * (('ao -> 'ap -> ('ao * 'ap) list -> ('ao * 'ap) list) * (('aq -> 'ar -> ('aq * 'ar) list -> ('aq * 'ar) list) * (('as * 'at) list -> ('as * 'at) list))))))))))))))))))))) end = struct fun iteratei_map_op_list_it_lmi_ops s = Foldi.foldli s; fun g_list_to_map_lmi_basic_ops A_ l = List.foldl (fn m => fn (k, v) => AList.update A_ k v m) [] (List.rev l); fun iteratei_bmap_op_list_it_lmi_basic_ops s = Foldi.foldli s; fun g_size_abort_lmi_basic_ops b m = iteratei_bmap_op_list_it_lmi_basic_ops m (fn s => Arith.less_nat s b) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_restrict_lmi_basic_ops p m = iteratei_bmap_op_list_it_lmi_basic_ops m (fn _ => true) (fn (k, v) => fn sigma => (if p (k, v) then (k, v) :: sigma else sigma)) []; fun g_ball_lmi_basic_ops m p = iteratei_bmap_op_list_it_lmi_basic_ops m Fun.id (fn kv => fn _ => p kv) true; fun g_sng_lmi_basic_ops A_ k v = AList.update A_ k v []; fun g_sel_lmi_basic_ops m p = iteratei_bmap_op_list_it_lmi_basic_ops m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_lmi_basic_ops m p = iteratei_bmap_op_list_it_lmi_basic_ops m not (fn kv => fn _ => p kv) false; fun g_add_lmi_basic_ops A_ m1 m2 = iteratei_bmap_op_list_it_lmi_basic_ops m2 (fn _ => true) (fn (a, b) => AList.update A_ a b) m1; fun lmi_from_list_dj x = Fun.id x; fun test_codegen A_ I_ Y_ Ai_ Am_ Ao_ = (g_add_lmi_basic_ops A_, (Misc.revg, (g_ball_lmi_basic_ops, (g_bex_lmi_basic_ops, (AList.delete_aux I_, ((fn _ => []), ((fn a => (case a of [] => true | _ :: _ => false)), ((fn a => (case a of [] => false | [_] => true | _ :: _ :: _ => false)), ((fn m => iteratei_map_op_list_it_lmi_ops m (fn _ => true)), (iteratei_map_op_list_it_lmi_ops, (Foldi.foldli, ((fn k => fn m => Map.map_of Y_ m k), (g_restrict_lmi_basic_ops, (g_sel_lmi_basic_ops, (List.size_list, (g_size_abort_lmi_basic_ops, (g_sng_lmi_basic_ops Ai_, (Fun.id, (g_list_to_map_lmi_basic_ops Am_, (AList.update Ao_, ((fn k => fn v => (fn a => (k, v) :: a)), lmi_from_list_dj))))))))))))))))))))); end; (*struct ListMapImpl_Invar*) ### theory "Collections.ListMapImpl_Invar" ### 2.269s elapsed time, 4.492s cpu time, 0.720s GC time Loading theory "Collections.TrieMapImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.TrieSetImpl") structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure List : sig val rev : 'a list -> 'a list val null : 'a list -> bool val foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun null [] = true | null (x :: xs) = false; fun foldl f a [] = a | foldl f a (x :: xs) = foldl f (f a x) xs; end; (*struct List*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure AList : sig val update : 'a HOL.equal -> 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list val delete_aux : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list val update_with_aux : 'b HOL.equal -> 'a -> 'b -> ('a -> 'a) -> ('b * 'a) list -> ('b * 'a) list end = struct fun update A_ k v [] = [(k, v)] | update A_ k v (p :: ps) = (if HOL.eq A_ (Product_Type.fst p) k then (k, v) :: ps else p :: update A_ k v ps); fun delete_aux A_ k [] = [] | delete_aux A_ ka ((k, v) :: xs) = (if HOL.eq A_ ka k then xs else (k, v) :: delete_aux A_ ka xs); fun update_with_aux B_ v k f [] = [(k, f v)] | update_with_aux B_ v k f (p :: ps) = (if HOL.eq B_ (Product_Type.fst p) k then (k, f (Product_Type.snd p)) :: ps else p :: update_with_aux B_ v k f ps); end; (*struct AList*) structure Trie : sig datatype ('a, 'b) trie = Trie of 'b option * ('a * ('a, 'b) trie) list val empty_trie : ('a, 'b) trie val delete_trie : 'a HOL.equal -> 'a list -> ('a, 'b) trie -> ('a, 'b) trie val lookup_trie : 'a HOL.equal -> ('a, 'b) trie -> 'a list -> 'b option val update_trie : 'a HOL.equal -> 'a list -> 'b -> ('a, 'b) trie -> ('a, 'b) trie end = struct datatype ('a, 'b) trie = Trie of 'b option * ('a * ('a, 'b) trie) list; val empty_trie : ('a, 'b) trie = Trie (NONE, []); fun is_empty_trie (Trie (v, m)) = Option.is_none v andalso List.null m; fun delete_trie A_ [] (Trie (vo, ts)) = Trie (NONE, ts) | delete_trie A_ (k :: ks) (Trie (vo, ts)) = (case Map.map_of A_ ts k of NONE => Trie (vo, ts) | SOME t => let val ta = delete_trie A_ ks t; in (if is_empty_trie ta then Trie (vo, AList.delete_aux A_ k ts) else Trie (vo, AList.update A_ k ta ts)) end); fun lookup_trie A_ (Trie (v, m)) [] = v | lookup_trie A_ (Trie (v, m)) (k :: ks) = (case Map.map_of A_ m k of NONE => NONE | SOME st => lookup_trie A_ st ks); fun update_with_trie A_ [] f (Trie (v, ps)) = Trie (SOME (f v), ps) | update_with_trie A_ (k :: ks) f (Trie (v, ps)) = Trie (v, AList.update_with_aux A_ empty_trie k (update_with_trie A_ ks f) ps); fun update_trie A_ ks v = update_with_trie A_ ks (fn _ => v); end; (*struct Trie*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Trie_Impl : sig val iteratei : ('a, 'b) Trie.trie -> ('c -> bool) -> ('a list * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun iteratei_postfixed ks (Trie.Trie (vo, ts)) c f sigma = (if c sigma then Foldi.foldli ts c (fn (k, t) => iteratei_postfixed (k :: ks) t c f) (case vo of NONE => sigma | SOME v => f (ks, v) sigma) else sigma); fun iteratei t c f sigma = iteratei_postfixed [] t c f sigma; end; (*struct Trie_Impl*) structure Trie2 : sig type ('b, 'a) trie val empty : ('a, 'b) trie val delete : 'a HOL.equal -> 'a list -> ('a, 'b) trie -> ('a, 'b) trie val lookup : 'a HOL.equal -> ('a, 'b) trie -> 'a list -> 'b option val update : 'a HOL.equal -> 'a list -> 'b -> ('a, 'b) trie -> ('a, 'b) trie val iteratei : ('a, 'b) trie -> ('c -> bool) -> ('a list * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('b, 'a) trie = Trie of ('b, 'a) Trie.trie; val empty : ('a, 'b) trie = Trie Trie.empty_trie; fun impl_of (Trie x) = x; fun delete A_ ks t = Trie (Trie.delete_trie A_ ks (impl_of t)); fun lookup A_ t = Trie.lookup_trie A_ (impl_of t); fun update A_ ks v t = Trie (Trie.update_trie A_ ks v (impl_of t)); fun iteratei t c f = Trie_Impl.iteratei (impl_of t) c (fn (ks, v) => f (List.rev ks, v)); end; (*struct Trie2*) structure TrieMapImpl : sig val test_codegen : 'a HOL.equal -> 'c HOL.equal -> 'i HOL.equal -> 'y HOL.equal -> 'aa HOL.equal -> 'ai HOL.equal -> 'am HOL.equal -> 'ao HOL.equal -> 'aq HOL.equal -> (('a, 'b) Trie2.trie -> ('a, 'b) Trie2.trie -> ('a, 'b) Trie2.trie) * ((('c, 'd) Trie2.trie -> ('c, 'd) Trie2.trie -> ('c, 'd) Trie2.trie) * ((('e, 'f) Trie2.trie -> ('e list * 'f -> bool) -> bool) * ((('g, 'h) Trie2.trie -> ('g list * 'h -> bool) -> bool) * (('i list -> ('i, 'j) Trie2.trie -> ('i, 'j) Trie2.trie) * ((unit -> ('k, 'l) Trie2.trie) * ((('m, 'n) Trie2.trie -> bool) * ((('o, 'p) Trie2.trie -> bool) * ((('q, 'r) Trie2.trie -> ('q list * 'r -> 's -> 's) -> 's -> 's) * ((('t, 'u) Trie2.trie -> ('v -> bool) -> ('t list * 'u -> 'v -> 'v) -> 'v -> 'v) * ((('w, 'x) Trie2.trie -> (('w list * 'x) list -> bool) -> ('w list * 'x -> ('w list * 'x) list -> ('w list * 'x) list) -> ('w list * 'x) list -> ('w list * 'x) list) * (('y list -> ('y, 'z) Trie2.trie -> 'z option) * ((('aa list * 'ab -> bool) -> ('aa, 'ab) Trie2.trie -> ('aa, 'ab) Trie2.trie) * ((('ac, 'ad) Trie2.trie -> ('ac list * 'ad -> bool) -> ('ac list * 'ad) option) * ((('ae, 'af) Trie2.trie -> Arith.nat) * ((Arith.nat -> ('ag, 'ah) Trie2.trie -> Arith.nat) * (('ai list -> 'aj -> ('ai, 'aj) Trie2.trie) * ((('ak, 'al) Trie2.trie -> ('ak list * 'al) list) * ((('am list * 'an) list -> ('am, 'an) Trie2.trie) * (('ao list -> 'ap -> ('ao, 'ap) Trie2.trie -> ('ao, 'ap) Trie2.trie) * ('aq list -> 'ar -> ('aq, 'ar) Trie2.trie -> ('aq, 'ar) Trie2.trie)))))))))))))))))))) end = struct fun iteratei_map_op_list_it_tm_ops s = Trie2.iteratei s; fun g_list_to_map_tm_basic_ops A_ l = List.foldl (fn m => fn (k, v) => Trie2.update A_ k v m) Trie2.empty (List.rev l); fun iteratei_bmap_op_list_it_tm_basic_ops s = Trie2.iteratei s; fun g_size_abort_tm_basic_ops b m = iteratei_bmap_op_list_it_tm_basic_ops m (fn s => Arith.less_nat s b) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_restrict_tm_basic_ops A_ p m = iteratei_bmap_op_list_it_tm_basic_ops m (fn _ => true) (fn (k, v) => fn sigma => (if p (k, v) then Trie2.update A_ k v sigma else sigma)) Trie2.empty; fun g_to_list_tm_basic_ops m = iteratei_bmap_op_list_it_tm_basic_ops m (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_tm_basic_ops m = Arith.equal_nat (g_size_abort_tm_basic_ops Arith.one_nat m) Arith.Zero_nat; fun g_add_dj_tm_basic_ops A_ m1 m2 = iteratei_bmap_op_list_it_tm_basic_ops m2 (fn _ => true) (fn (a, b) => Trie2.update A_ a b) m1; fun g_isSng_tm_basic_ops m = Arith.equal_nat (g_size_abort_tm_basic_ops (Arith.nat_of_num (Arith.Bit0 Arith.One)) m) Arith.one_nat; fun g_size_tm_basic_ops m = iteratei_bmap_op_list_it_tm_basic_ops m (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_ball_tm_basic_ops m p = iteratei_bmap_op_list_it_tm_basic_ops m Fun.id (fn kv => fn _ => p kv) true; fun g_sng_tm_basic_ops A_ k v = Trie2.update A_ k v Trie2.empty; fun g_sel_tm_basic_ops m p = iteratei_bmap_op_list_it_tm_basic_ops m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_tm_basic_ops m p = iteratei_bmap_op_list_it_tm_basic_ops m not (fn kv => fn _ => p kv) false; fun g_add_tm_basic_ops A_ m1 m2 = iteratei_bmap_op_list_it_tm_basic_ops m2 (fn _ => true) (fn (a, b) => Trie2.update A_ a b) m1; fun test_codegen A_ C_ I_ Y_ Aa_ Ai_ Am_ Ao_ Aq_ = (g_add_tm_basic_ops A_, (g_add_dj_tm_basic_ops C_, (g_ball_tm_basic_ops, (g_bex_tm_basic_ops, (Trie2.delete I_, ((fn _ => Trie2.empty), (g_isEmpty_tm_basic_ops, (g_isSng_tm_basic_ops, ((fn m => iteratei_map_op_list_it_tm_ops m (fn _ => true)), (iteratei_map_op_list_it_tm_ops, (Trie2.iteratei, ((fn k => fn m => Trie2.lookup Y_ m k), (g_restrict_tm_basic_ops Aa_, (g_sel_tm_basic_ops, (g_size_tm_basic_ops, (g_size_abort_tm_basic_ops, (g_sng_tm_basic_ops Ai_, (g_to_list_tm_basic_ops, (g_list_to_map_tm_basic_ops Am_, (Trie2.update Ao_, Trie2.update Aq_)))))))))))))))))))); end; (*struct TrieMapImpl*) ### theory "Collections.TrieMapImpl" ### 1.193s elapsed time, 2.400s cpu time, 0.000s GC time Loading theory "Collections.ListSetImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") consts ahm_invar :: "('key, 'val) hashmap \ bool" consts ahm_\ :: "('key, 'val) hashmap \ 'key \ 'val option" consts ahm_iteratei_aux :: "('key \ 'val) list array \ ('\ \ bool) \ ('key \ 'val \ '\ \ '\) \ '\ \ '\" consts ahm_iteratei :: "('key, 'val) hashmap \ ('\ \ bool) \ ('key \ 'val \ '\ \ '\) \ '\ \ '\" consts ahm_rehash :: "('key, 'val) hashmap \ nat \ ('key, 'val) hashmap" consts hm_grow :: "('key, 'val) hashmap \ nat" consts ahm_filled :: "('key, 'val) hashmap \ bool" consts ahm_update_aux :: "('key, 'val) hashmap \ 'key \ 'val \ ('key, 'val) hashmap" consts ahm_delete :: "'key \ ('key, 'val) hashmap \ ('key, 'val) hashmap" ### theory "Collections.ArrayHashMap_Impl" ### 3.046s elapsed time, 6.112s cpu time, 0.000s GC time Loading theory "Collections.ArrayHashMap" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.ArrayHashSet") structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure List : sig val member : 'a HOL.equal -> 'a list -> 'a -> bool val insert : 'a HOL.equal -> 'a -> 'a list -> 'a list end = struct fun member A_ [] y = false | member A_ (x :: xs) y = HOL.eq A_ x y orelse member A_ xs y; fun insert A_ x xs = (if member A_ xs x then xs else x :: xs); end; (*struct List*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Dlist : sig datatype 'a dlist = Dlist of 'a list val empty : 'a dlist val list_of_dlist : 'a dlist -> 'a list val insert : 'a HOL.equal -> 'a -> 'a dlist -> 'a dlist val member : 'a HOL.equal -> 'a dlist -> 'a -> bool end = struct datatype 'a dlist = Dlist of 'a list; val empty : 'a dlist = Dlist []; fun list_of_dlist (Dlist x) = x; fun insert A_ x dxs = Dlist (List.insert A_ x (list_of_dlist dxs)); fun member A_ dxs = List.member A_ (list_of_dlist dxs); end; (*struct Dlist*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Dlist_add : sig val dlist_remove : 'a HOL.equal -> 'a -> 'a Dlist.dlist -> 'a Dlist.dlist val dlist_iteratei : 'a Dlist.dlist -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun dlist_remove1 A_ x z [] = z | dlist_remove1 A_ x z (y :: ys) = (if HOL.eq A_ x y then z @ ys else dlist_remove1 A_ x (y :: z) ys); fun dlist_remove A_ a xs = Dlist.Dlist (dlist_remove1 A_ a [] (Dlist.list_of_dlist xs)); fun dlist_iteratei xs = Foldi.foldli (Dlist.list_of_dlist xs); end; (*struct Dlist_add*) structure ListSetImpl : sig val test_codegen : 'b HOL.equal -> 'c HOL.equal -> 'd HOL.equal -> 'f HOL.equal -> 'm HOL.equal -> 'n HOL.equal -> 'o HOL.equal -> 'p HOL.equal -> 'q HOL.equal -> 'r HOL.equal -> 's HOL.equal -> 't HOL.equal -> 'u HOL.equal -> 'x HOL.equal -> (unit -> 'a Dlist.dlist) * (('b -> 'b Dlist.dlist -> bool) * (('c -> 'c Dlist.dlist -> 'c Dlist.dlist) * (('d -> 'd Dlist.dlist -> 'd Dlist.dlist) * (('e Dlist.dlist -> ('e list -> bool) -> ('e -> 'e list -> 'e list) -> 'e list -> 'e list) * (('f -> 'f Dlist.dlist) * (('g Dlist.dlist -> bool) * (('h Dlist.dlist -> bool) * (('i Dlist.dlist -> ('i -> bool) -> bool) * (('j Dlist.dlist -> ('j -> bool) -> bool) * (('k Dlist.dlist -> Arith.nat) * ((Arith.nat -> 'l Dlist.dlist -> Arith.nat) * (('m Dlist.dlist -> 'm Dlist.dlist -> 'm Dlist.dlist) * (('n Dlist.dlist -> 'n Dlist.dlist -> 'n Dlist.dlist) * (('o Dlist.dlist -> 'o Dlist.dlist -> 'o Dlist.dlist) * ((('p -> bool) -> 'p Dlist.dlist -> 'p Dlist.dlist) * (('q Dlist.dlist -> 'q Dlist.dlist -> 'q Dlist.dlist) * (('r Dlist.dlist -> 'r Dlist.dlist -> bool) * (('s Dlist.dlist -> 's Dlist.dlist -> bool) * (('t Dlist.dlist -> 't Dlist.dlist -> bool) * (('u Dlist.dlist -> 'u Dlist.dlist -> 'u option) * (('v Dlist.dlist -> ('v -> bool) -> 'v option) * (('w Dlist.dlist -> 'w list) * ('x list -> 'x Dlist.dlist))))))))))))))))))))))) end = struct fun iteratei_bset_op_list_it_ls_basic_ops s = Dlist_add.dlist_iteratei s; fun g_sel_ls_basic_ops s p = iteratei_bset_op_list_it_ls_basic_ops s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_disjoint_witness_ls_basic_ops A_ s1 s2 = g_sel_ls_basic_ops s1 (Dlist.member A_ s2); fun g_size_abort_ls_basic_ops m s = iteratei_bset_op_list_it_ls_basic_ops s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_from_list_aux_ls_basic_ops A_ y [] = y | g_from_list_aux_ls_basic_ops A_ accs (x :: l) = g_from_list_aux_ls_basic_ops A_ (Dlist.insert A_ x accs) l; fun g_from_list_ls_basic_ops A_ l = g_from_list_aux_ls_basic_ops A_ Dlist.empty l; fun g_union_dj_ls_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_ls_basic_ops s1 (fn _ => true) (Dlist.insert A_) s2; fun g_ball_ls_basic_ops s p = iteratei_bset_op_list_it_ls_basic_ops s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_ls_basic_ops A_ s1 s2 = g_ball_ls_basic_ops s1 (fn x => not (Dlist.member A_ s2 x)); fun g_isEmpty_ls_basic_ops s = iteratei_bset_op_list_it_ls_basic_ops s (fn c => c) (fn _ => fn _ => false) true; fun g_subset_ls_basic_ops A_ s1 s2 = g_ball_ls_basic_ops s1 (Dlist.member A_ s2); fun g_filter_ls_basic_ops A_ p s = iteratei_bset_op_list_it_ls_basic_ops s (fn _ => true) (fn x => fn sigma => (if p x then Dlist.insert A_ x sigma else sigma)) Dlist.empty; fun g_union_ls_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_ls_basic_ops s1 (fn _ => true) (Dlist.insert A_) s2; fun g_isSng_ls_basic_ops s = Arith.equal_nat (iteratei_bset_op_list_it_ls_basic_ops s (fn sigma => Arith.less_nat sigma (Arith.nat_of_num (Arith.Bit0 Arith.One))) (fn _ => Arith.Suc) Arith.Zero_nat) Arith.one_nat; fun g_inter_ls_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_ls_basic_ops s1 (fn _ => true) (fn x => fn s => (if Dlist.member A_ s2 x then Dlist.insert A_ x s else s)) Dlist.empty; fun g_equal_ls_basic_ops A_ s1 s2 = g_subset_ls_basic_ops A_ s1 s2 andalso g_subset_ls_basic_ops A_ s2 s1; fun g_size_ls_basic_ops s = iteratei_bset_op_list_it_ls_basic_ops s (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_diff_ls_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_ls_basic_ops s2 (fn _ => true) (Dlist_add.dlist_remove A_) s1; fun g_sng_ls_basic_ops A_ x = Dlist.insert A_ x Dlist.empty; fun g_bex_ls_basic_ops s p = iteratei_bset_op_list_it_ls_basic_ops s not (fn x => fn _ => p x) false; fun test_codegen B_ C_ D_ F_ M_ N_ O_ P_ Q_ R_ S_ T_ U_ X_ = ((fn _ => Dlist.empty), ((fn x => fn s => Dlist.member B_ s x), (Dlist.insert C_, (Dlist_add.dlist_remove D_, (Dlist_add.dlist_iteratei, (g_sng_ls_basic_ops F_, (g_isEmpty_ls_basic_ops, (g_isSng_ls_basic_ops, (g_ball_ls_basic_ops, (g_bex_ls_basic_ops, (g_size_ls_basic_ops, (g_size_abort_ls_basic_ops, (g_union_ls_basic_ops M_, (g_union_dj_ls_basic_ops N_, (g_diff_ls_basic_ops O_, (g_filter_ls_basic_ops P_, (g_inter_ls_basic_ops Q_, (g_subset_ls_basic_ops R_, (g_equal_ls_basic_ops S_, (g_disjoint_ls_basic_ops T_, (g_disjoint_witness_ls_basic_ops U_, (g_sel_ls_basic_ops, (Dlist.list_of_dlist, g_from_list_ls_basic_ops X_))))))))))))))))))))))); end; (*struct ListSetImpl*) ### theory "Collections.ListSetImpl" ### 1.172s elapsed time, 2.352s cpu time, 0.000s GC time Loading theory "Collections.ListSetImpl_Invar" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure List : sig val member : 'a HOL.equal -> 'a list -> 'a -> bool end = struct fun member A_ [] y = false | member A_ (x :: xs) y = HOL.eq A_ x y orelse member A_ xs y; end; (*struct List*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Dlist_add : sig val dlist_remove1 : 'a HOL.equal -> 'a -> 'a list -> 'a list -> 'a list end = struct fun dlist_remove1 A_ x z [] = z | dlist_remove1 A_ x z (y :: ys) = (if HOL.eq A_ x y then z @ ys else dlist_remove1 A_ x (y :: z) ys); end; (*struct Dlist_add*) structure ListSetImpl_Invar : sig val test_codegen : 'b HOL.equal -> 'c HOL.equal -> 'd HOL.equal -> 'f HOL.equal -> 'm HOL.equal -> 'o HOL.equal -> 'q HOL.equal -> 'r HOL.equal -> 's HOL.equal -> 't HOL.equal -> 'u HOL.equal -> 'x HOL.equal -> (unit -> 'a list) * (('b -> 'b list -> bool) * (('c -> 'c list -> 'c list) * (('d -> 'd list -> 'd list) * (('e list -> ('e list -> bool) -> ('e -> 'e list -> 'e list) -> 'e list -> 'e list) * (('f -> 'f list) * (('g list -> bool) * (('h list -> bool) * (('i list -> ('i -> bool) -> bool) * (('j list -> ('j -> bool) -> bool) * (('k list -> Arith.nat) * ((Arith.nat -> 'l list -> Arith.nat) * (('m list -> 'm list -> 'm list) * (('n list -> 'n list -> 'n list) * (('o list -> 'o list -> 'o list) * ((('p -> bool) -> 'p list -> 'p list) * (('q list -> 'q list -> 'q list) * (('r list -> 'r list -> bool) * (('s list -> 's list -> bool) * (('t list -> 't list -> bool) * (('u list -> 'u list -> 'u option) * (('v list -> ('v -> bool) -> 'v option) * (('w list -> 'w list) * ('x list -> 'x list))))))))))))))))))))))) end = struct fun lsi_ins A_ x l = (if List.member A_ l x then l else x :: l); fun iteratei_bset_op_list_it_lsi_basic_ops s = Foldi.foldli s; fun g_sel_lsi_basic_ops s p = iteratei_bset_op_list_it_lsi_basic_ops s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_disjoint_witness_lsi_basic_ops A_ s1 s2 = g_sel_lsi_basic_ops s1 (List.member A_ s2); fun g_size_abort_lsi_basic_ops m s = iteratei_bset_op_list_it_lsi_basic_ops s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_from_list_aux_lsi_basic_ops A_ y [] = y | g_from_list_aux_lsi_basic_ops A_ accs (x :: l) = g_from_list_aux_lsi_basic_ops A_ (lsi_ins A_ x accs) l; fun g_from_list_lsi_basic_ops A_ l = g_from_list_aux_lsi_basic_ops A_ [] l; fun g_ball_lsi_basic_ops s p = iteratei_bset_op_list_it_lsi_basic_ops s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_lsi_basic_ops A_ s1 s2 = g_ball_lsi_basic_ops s1 (fn x => not (List.member A_ s2 x)); fun g_isEmpty_lsi_basic_ops s = iteratei_bset_op_list_it_lsi_basic_ops s (fn c => c) (fn _ => fn _ => false) true; fun g_subset_lsi_basic_ops A_ s1 s2 = g_ball_lsi_basic_ops s1 (List.member A_ s2); fun g_filter_lsi_basic_ops p s = iteratei_bset_op_list_it_lsi_basic_ops s (fn _ => true) (fn x => fn sigma => (if p x then x :: sigma else sigma)) []; fun g_union_lsi_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_lsi_basic_ops s1 (fn _ => true) (lsi_ins A_) s2; fun g_isSng_lsi_basic_ops s = Arith.equal_nat (iteratei_bset_op_list_it_lsi_basic_ops s (fn sigma => Arith.less_nat sigma (Arith.nat_of_num (Arith.Bit0 Arith.One))) (fn _ => Arith.Suc) Arith.Zero_nat) Arith.one_nat; fun g_inter_lsi_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_lsi_basic_ops s1 (fn _ => true) (fn x => fn s => (if List.member A_ s2 x then x :: s else s)) []; fun g_equal_lsi_basic_ops A_ s1 s2 = g_subset_lsi_basic_ops A_ s1 s2 andalso g_subset_lsi_basic_ops A_ s2 s1; fun g_size_lsi_basic_ops s = iteratei_bset_op_list_it_lsi_basic_ops s (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_diff_lsi_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_lsi_basic_ops s2 (fn _ => true) (fn x => Dlist_add.dlist_remove1 A_ x []) s1; fun g_sng_lsi_basic_ops A_ x = lsi_ins A_ x []; fun g_bex_lsi_basic_ops s p = iteratei_bset_op_list_it_lsi_basic_ops s not (fn x => fn _ => p x) false; fun test_codegen B_ C_ D_ F_ M_ O_ Q_ R_ S_ T_ U_ X_ = ((fn _ => []), ((fn x => fn s => List.member B_ s x), (lsi_ins C_, ((fn x => Dlist_add.dlist_remove1 D_ x []), (Foldi.foldli, (g_sng_lsi_basic_ops F_, (g_isEmpty_lsi_basic_ops, (g_isSng_lsi_basic_ops, (g_ball_lsi_basic_ops, (g_bex_lsi_basic_ops, (g_size_lsi_basic_ops, (g_size_abort_lsi_basic_ops, (g_union_lsi_basic_ops M_, ((fn a => fn b => a @ b), (g_diff_lsi_basic_ops O_, (g_filter_lsi_basic_ops, (g_inter_lsi_basic_ops Q_, (g_subset_lsi_basic_ops R_, (g_equal_lsi_basic_ops S_, (g_disjoint_lsi_basic_ops T_, (g_disjoint_witness_lsi_basic_ops U_, (g_sel_lsi_basic_ops, (Fun.id, g_from_list_lsi_basic_ops X_))))))))))))))))))))))); end; (*struct ListSetImpl_Invar*) ### theory "Collections.ListSetImpl_Invar" ### 1.653s elapsed time, 3.248s cpu time, 0.784s GC time Loading theory "Collections.ListSetImpl_NotDist" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") (* Test that words can handle numbers between 0 and 31 *) val _ = if 5 <= Word.wordSize then () else raise (Fail ("wordSize less than 5")); structure Uint32 : sig val set_bit : Word32.word -> IntInf.int -> bool -> Word32.word val shiftl : Word32.word -> IntInf.int -> Word32.word val shiftr : Word32.word -> IntInf.int -> Word32.word val shiftr_signed : Word32.word -> IntInf.int -> Word32.word val test_bit : Word32.word -> IntInf.int -> bool end = struct fun set_bit x n b = let val mask = Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n)) in if b then Word32.orb (x, mask) else Word32.andb (x, Word32.notb mask) end fun shiftl x n = Word32.<< (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr x n = Word32.>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr_signed x n = Word32.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun test_bit x n = Word32.andb (x, Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n))) <> Word32.fromInt 0 end; (* struct Uint32 *) structure STArray = struct datatype 'a Cell = Invalid | Value of 'a array; exception AccessedOldVersion; type 'a array = 'a Cell Unsynchronized.ref; fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun array (size, v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun sub (Unsynchronized.ref Invalid, idx) = raise AccessedOldVersion | sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx); fun update (aref,idx,v) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( aref := Invalid; Array.update (a,idx,v); Unsynchronized.ref (Value a) ); fun length (Unsynchronized.ref Invalid) = raise AccessedOldVersion | length (Unsynchronized.ref (Value a)) = Array.length a fun grow (aref, i, x) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+i,x) in aref := Invalid; Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( aref:=Invalid; Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); end; end; structure FArray = struct datatype 'a Cell = Value of 'a Array.array | Upd of (int*'a*'a Cell Unsynchronized.ref); type 'a array = 'a Cell Unsynchronized.ref; fun array (size,v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx) | sub (Unsynchronized.ref (Upd (i,v,cr)),idx) = if i=idx then v else sub (cr,idx); fun length (Unsynchronized.ref (Value a)) = Array.length a | length (Unsynchronized.ref (Upd (i,v,cr))) = length cr; fun realize_aux (aref, v) = case aref of (Unsynchronized.ref (Value a)) => ( let val len = Array.length a; val a' = Array.array (len,v); in Array.copy {src=a, dst=a', di=0}; Unsynchronized.ref (Value a') end ) | (Unsynchronized.ref (Upd (i,v,cr))) => ( let val res=realize_aux (cr,v) in case res of (Unsynchronized.ref (Value a)) => (Array.update (a,i,v); res) end ); fun realize aref = case aref of (Unsynchronized.ref (Value _)) => aref | (Unsynchronized.ref (Upd (i,v,cr))) => realize_aux(aref,v); fun update (aref,idx,v) = case aref of (Unsynchronized.ref (Value a)) => ( let val nref=Unsynchronized.ref (Value a) in aref := Upd (idx,Array.sub(a,idx),nref); Array.update (a,idx,v); nref end ) | (Unsynchronized.ref (Upd _)) => let val ra = realize_aux(aref,v) in case ra of (Unsynchronized.ref (Value a)) => Array.update (a,idx,v); ra end ; fun grow (aref, inc, x) = case aref of (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+inc,x) in Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ) | (Unsynchronized.ref (Upd _)) => ( grow (realize aref, inc, x) ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ) | (Unsynchronized.ref (Upd _)) => ( shrink (realize aref,sz) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); fun array_get_oo (d:'a) (a:'a ArrayType) (i:IntInf.int) = sub (a,IntInf.toInt i) handle Subscript => d fun array_set_oo (d:(unit->'a ArrayType)) (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e) handle Subscript => d () end; end; structure Bits_Integer : sig val set_bit : IntInf.int -> IntInf.int -> bool -> IntInf.int val shiftl : IntInf.int -> IntInf.int -> IntInf.int val shiftr : IntInf.int -> IntInf.int -> IntInf.int val test_bit : IntInf.int -> IntInf.int -> bool end = struct val maxWord = IntInf.pow (2, Word.wordSize); fun set_bit x n b = if n < maxWord then if b then IntInf.orb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) else IntInf.andb (x, IntInf.notb (IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n)))) else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); fun shiftl x n = if n < maxWord then IntInf.<< (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun shiftr x n = if n < maxWord then IntInf.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun test_bit x n = if n < maxWord then IntInf.andb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) <> 0 else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); end; (*struct Bits_Integer*) structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal datatype 'a itself = Type val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; datatype 'a itself = Type; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure List : sig val rev : 'a list -> 'a list val foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a val filter : ('a -> bool) -> 'a list -> 'a list end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun foldl f a [] = a | foldl f a (x :: xs) = foldl f (f a x) xs; fun filter p [] = [] | filter p (x :: xs) = (if p x then x :: filter p xs else filter p xs); end; (*struct List*) structure Product_Type : sig val apsnd : ('a -> 'b) -> 'c * 'a -> 'c * 'b val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun apsnd f (x, y) = (x, f y); fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure AList : sig val delete : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list val update : 'a HOL.equal -> 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list end = struct fun delete A_ k = List.filter (fn (ka, _) => not (HOL.eq A_ k ka)); fun update A_ k v [] = [(k, v)] | update A_ k v (p :: ps) = (if HOL.eq A_ (Product_Type.fst p) k then (k, v) :: ps else p :: update A_ k v ps); end; (*struct AList*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool val max : 'a ord -> 'a -> 'a -> 'a end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; fun max A_ a b = (if less_eq A_ a b then b else a); end; (*struct Orderings*) structure Arith : sig type nat datatype num = One | Bit0 of num | Bit1 of num val integer_of_nat : nat -> IntInf.int val plus_nat : nat -> nat -> nat val one_nat : nat val suc : nat -> nat val less_nat : nat -> nat -> bool val zero_nat : nat val nat_of_integer : IntInf.int -> nat val equal_nat : nat -> nat -> bool val minus_nat : nat -> nat -> nat val less_eq_nat : nat -> nat -> bool val times_nat : nat -> nat -> nat val modulo_nat : nat -> nat -> nat end = struct val ord_integer = {less_eq = (fn a => fn b => IntInf.<= (a, b)), less = (fn a => fn b => IntInf.< (a, b))} : IntInf.int Orderings.ord; datatype nat = Nat of IntInf.int; datatype num = One | Bit0 of num | Bit1 of num; fun integer_of_nat (Nat x) = x; fun plus_nat m n = Nat (IntInf.+ (integer_of_nat m, integer_of_nat n)); val one_nat : nat = Nat (1 : IntInf.int); fun suc n = plus_nat n one_nat; fun less_nat m n = IntInf.< (integer_of_nat m, integer_of_nat n); val zero_nat : nat = Nat (0 : IntInf.int); fun sgn_integer k = (if ((k : IntInf.int) = (0 : IntInf.int)) then (0 : IntInf.int) else (if IntInf.< (k, (0 : IntInf.int)) then (~1 : IntInf.int) else (1 : IntInf.int))); fun divmod_integer k l = (if ((k : IntInf.int) = (0 : IntInf.int)) then ((0 : IntInf.int), (0 : IntInf.int)) else (if ((l : IntInf.int) = (0 : IntInf.int)) then ((0 : IntInf.int), k) else (Product_Type.apsnd o (fn a => fn b => IntInf.* (a, b)) o sgn_integer) l (if (((sgn_integer k) : IntInf.int) = (sgn_integer l)) then IntInf.divMod (IntInf.abs k, IntInf.abs l) else let val (r, s) = IntInf.divMod (IntInf.abs k, IntInf.abs l); in (if ((s : IntInf.int) = (0 : IntInf.int)) then (IntInf.~ r, (0 : IntInf.int)) else (IntInf.- (IntInf.~ r, (1 : IntInf.int)), IntInf.- (IntInf.abs l, s))) end))); fun nat_of_integer k = Nat (Orderings.max ord_integer (0 : IntInf.int) k); fun equal_nat m n = (((integer_of_nat m) : IntInf.int) = (integer_of_nat n)); fun minus_nat m n = Nat (Orderings.max ord_integer (0 : IntInf.int) (IntInf.- (integer_of_nat m, integer_of_nat n))); fun less_eq_nat m n = IntInf.<= (integer_of_nat m, integer_of_nat n); fun times_nat m n = Nat (IntInf.* (integer_of_nat m, integer_of_nat n)); fun modulo_integer k l = Product_Type.snd (divmod_integer k l); fun modulo_nat m n = Nat (modulo_integer (integer_of_nat m) (integer_of_nat n)); end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Uint32a : sig val nat_of_uint32 : Word32.word -> Arith.nat end = struct fun nat_of_uint32 x = Arith.nat_of_integer (IntInf.fromLarge (Word32.toLargeInt x) : IntInf.int); end; (*struct Uint32a*) structure HashCode : sig type 'a hashable val hashcode : 'a hashable -> 'a -> Word32.word val def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat val bounded_hashcode_nat : 'a hashable -> Arith.nat -> 'a -> Arith.nat end = struct type 'a hashable = {hashcode : 'a -> Word32.word, def_hashmap_size : 'a HOL.itself -> Arith.nat}; val hashcode = #hashcode : 'a hashable -> 'a -> Word32.word; val def_hashmap_size = #def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat; fun nat_of_hashcode x = Uint32a.nat_of_uint32 x; fun bounded_hashcode_nat A_ n x = Arith.modulo_nat (nat_of_hashcode (hashcode A_ x)) n; end; (*struct HashCode*) structure Diff_Array : sig val array_get : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a val array_set : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType val new_array : 'a -> Arith.nat -> 'a FArray.IsabelleMapping.ArrayType val array_length : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat end = struct fun array_get a = FArray.IsabelleMapping.array_get a o Arith.integer_of_nat; fun array_set a = FArray.IsabelleMapping.array_set a o Arith.integer_of_nat; fun new_array v = FArray.IsabelleMapping.new_array v o Arith.integer_of_nat; fun array_length x = (Arith.nat_of_integer o FArray.IsabelleMapping.array_length) x; end; (*struct Diff_Array*) structure ArrayHashMap_Impl : sig type ('a, 'b) hashmap val ahm_empty : 'a HashCode.hashable -> unit -> ('a, 'b) hashmap val ahm_delete : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> ('a, 'b) hashmap val ahm_lookup : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> 'b option val ahm_update : 'a HOL.equal * 'a HashCode.hashable -> 'a -> 'b -> ('a, 'b) hashmap -> ('a, 'b) hashmap val ahm_iteratei : 'a HashCode.hashable -> ('a, 'b) hashmap -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('a, 'b) hashmap = HashMap of (('a * 'b) list) FArray.IsabelleMapping.ArrayType * Arith.nat; fun hm_grow A_ (HashMap (a, n)) = Arith.plus_nat (Arith.times_nat (Arith.nat_of_integer (2 : IntInf.int)) (Diff_Array.array_length a)) (Arith.nat_of_integer (3 : IntInf.int)); fun new_hashmap_with A_ size = HashMap (Diff_Array.new_array [] size, Arith.zero_nat); fun ahm_empty A_ = (fn _ => new_hashmap_with A_ (HashCode.def_hashmap_size A_ HOL.Type)); fun ahm_delete (A1_, A2_) k (HashMap (a, n)) = let val h = HashCode.bounded_hashcode_nat A2_ (Diff_Array.array_length a) k; val m = Diff_Array.array_get a h; val deleted = not (Option.is_none (Map.map_of A1_ m k)); in HashMap (Diff_Array.array_set a h (AList.delete A1_ k m), (if deleted then Arith.minus_nat n Arith.one_nat else n)) end; val load_factor : Arith.nat = Arith.nat_of_integer (75 : IntInf.int); fun ahm_filled A_ (HashMap (a, n)) = Arith.less_eq_nat (Arith.times_nat (Diff_Array.array_length a) load_factor) (Arith.times_nat n (Arith.nat_of_integer (100 : IntInf.int))); fun ahm_alpha_aux (A1_, A2_) a k = Map.map_of A1_ (Diff_Array.array_get a (HashCode.bounded_hashcode_nat A2_ (Diff_Array.array_length a) k)) k; fun ahm_alpha (A1_, A2_) (HashMap (a, uu)) = ahm_alpha_aux (A1_, A2_) a; fun ahm_lookup (A1_, A2_) k hm = ahm_alpha (A1_, A2_) hm k; fun idx_iteratei_aux_array_get sz i l c f sigma = (if Arith.equal_nat i Arith.zero_nat orelse not (c sigma) then sigma else idx_iteratei_aux_array_get sz (Arith.minus_nat i Arith.one_nat) l c f (f (Diff_Array.array_get l (Arith.minus_nat sz i)) sigma)); fun idx_iteratei_array_length_array_get l c f sigma = idx_iteratei_aux_array_get (Diff_Array.array_length l) (Diff_Array.array_length l) l c f sigma; fun ahm_iteratei_aux A_ a c f sigma = idx_iteratei_array_length_array_get a c (fn x => Foldi.foldli x c f) sigma; fun ahm_rehash_auxa A_ n kv a = let val h = HashCode.bounded_hashcode_nat A_ n (Product_Type.fst kv); in Diff_Array.array_set a h (kv :: Diff_Array.array_get a h) end; fun ahm_rehash_aux A_ a sz = ahm_iteratei_aux A_ a (fn _ => true) (ahm_rehash_auxa A_ sz) (Diff_Array.new_array [] sz); fun ahm_rehash A_ (HashMap (a, n)) sz = HashMap (ahm_rehash_aux A_ a sz, n); fun ahm_update_aux (A1_, A2_) (HashMap (a, n)) k v = let val h = HashCode.bounded_hashcode_nat A2_ (Diff_Array.array_length a) k; val m = Diff_Array.array_get a h; val insert = Option.is_none (Map.map_of A1_ m k); in HashMap (Diff_Array.array_set a h (AList.update A1_ k v m), (if insert then Arith.plus_nat n Arith.one_nat else n)) end; fun ahm_update (A1_, A2_) k v hm = let val hma = ahm_update_aux (A1_, A2_) hm k v; in (if ahm_filled A2_ hma then ahm_rehash A2_ hma (hm_grow A2_ hma) else hma) end; fun ahm_iteratei A_ (HashMap (a, n)) = ahm_iteratei_aux A_ a; end; (*struct ArrayHashMap_Impl*) structure ArrayHashMap : sig type ('b, 'a) hashmap val test_codegen : 'a HOL.equal * 'a HashCode.hashable -> 'c HOL.equal * 'c HashCode.hashable -> 'e HashCode.hashable -> 'g HashCode.hashable -> 'i HOL.equal * 'i HashCode.hashable -> 'k HashCode.hashable -> 'm HashCode.hashable -> 'o HashCode.hashable -> 'q HashCode.hashable -> 't HashCode.hashable -> 'w HashCode.hashable -> 'y HOL.equal * 'y HashCode.hashable -> 'aa HOL.equal * 'aa HashCode.hashable -> 'ac HashCode.hashable -> 'ae HashCode.hashable -> 'ag HashCode.hashable -> 'ai HOL.equal * 'ai HashCode.hashable -> 'ak HashCode.hashable -> 'am HOL.equal * 'am HashCode.hashable -> 'ao HOL.equal * 'ao HashCode.hashable -> 'aq HOL.equal * 'aq HashCode.hashable -> (('a, 'b) hashmap -> ('a, 'b) hashmap -> ('a, 'b) hashmap) * ((('c, 'd) hashmap -> ('c, 'd) hashmap -> ('c, 'd) hashmap) * ((('e, 'f) hashmap -> ('e * 'f -> bool) -> bool) * ((('g, 'h) hashmap -> ('g * 'h -> bool) -> bool) * (('i -> ('i, 'j) hashmap -> ('i, 'j) hashmap) * ((unit -> ('k, 'l) hashmap) * ((('m, 'n) hashmap -> bool) * ((('o, 'p) hashmap -> bool) * ((('q, 'r) hashmap -> ('q * 'r -> 's -> 's) -> 's -> 's) * ((('t, 'u) hashmap -> ('v -> bool) -> ('t * 'u -> 'v -> 'v) -> 'v -> 'v) * ((('w, 'x) hashmap -> (('w * 'x) list -> bool) -> ('w * 'x -> ('w * 'x) list -> ('w * 'x) list) -> ('w * 'x) list -> ('w * 'x) list) * (('y -> ('y, 'z) hashmap -> 'z option) * ((('aa * 'ab -> bool) -> ('aa, 'ab) hashmap -> ('aa, 'ab) hashmap) * ((('ac, 'ad) hashmap -> ('ac * 'ad -> bool) -> ('ac * 'ad) option) * ((('ae, 'af) hashmap -> Arith.nat) * ((Arith.nat -> ('ag, 'ah) hashmap -> Arith.nat) * (('ai -> 'aj -> ('ai, 'aj) hashmap) * ((('ak, 'al) hashmap -> ('ak * 'al) list) * ((('am * 'an) list -> ('am, 'an) hashmap) * (('ao -> 'ap -> ('ao, 'ap) hashmap -> ('ao, 'ap) hashmap) * ('aq -> 'ar -> ('aq, 'ar) hashmap -> ('aq, 'ar) hashmap)))))))))))))))))))) end = struct datatype ('b, 'a) hashmap = HashMap of ('b, 'a) ArrayHashMap_Impl.hashmap; fun ahm_empty_const A_ = HashMap (ArrayHashMap_Impl.ahm_empty A_ ()); fun ahm_empty A_ = (fn _ => ahm_empty_const A_); fun impl_of B_ (HashMap x) = x; fun ahm_delete (A1_, A2_) k hm = HashMap (ArrayHashMap_Impl.ahm_delete (A1_, A2_) k (impl_of A2_ hm)); fun ahm_lookup (A1_, A2_) k hm = ArrayHashMap_Impl.ahm_lookup (A1_, A2_) k (impl_of A2_ hm); fun ahm_update (A1_, A2_) k v hm = HashMap (ArrayHashMap_Impl.ahm_update (A1_, A2_) k v (impl_of A2_ hm)); fun ahm_iteratei A_ hm = ArrayHashMap_Impl.ahm_iteratei A_ (impl_of A_ hm); fun iteratei_map_op_list_it_ahm_ops A_ s = ahm_iteratei A_ s; fun g_list_to_map_ahm_basic_ops (A1_, A2_) l = List.foldl (fn m => fn (k, v) => ahm_update (A1_, A2_) k v m) (ahm_empty A2_ ()) (List.rev l); fun iteratei_bmap_op_list_it_ahm_basic_ops A_ s = ahm_iteratei A_ s; fun g_size_abort_ahm_basic_ops A_ b m = iteratei_bmap_op_list_it_ahm_basic_ops A_ m (fn s => Arith.less_nat s b) (fn _ => Arith.suc) Arith.zero_nat; fun g_restrict_ahm_basic_ops (A1_, A2_) p m = iteratei_bmap_op_list_it_ahm_basic_ops A2_ m (fn _ => true) (fn (k, v) => fn sigma => (if p (k, v) then ahm_update (A1_, A2_) k v sigma else sigma)) (ahm_empty A2_ ()); fun g_to_list_ahm_basic_ops A_ m = iteratei_bmap_op_list_it_ahm_basic_ops A_ m (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_ahm_basic_ops A_ m = Arith.equal_nat (g_size_abort_ahm_basic_ops A_ Arith.one_nat m) Arith.zero_nat; fun g_add_dj_ahm_basic_ops (A1_, A2_) m1 m2 = iteratei_bmap_op_list_it_ahm_basic_ops A2_ m2 (fn _ => true) (fn (a, b) => ahm_update (A1_, A2_) a b) m1; fun g_isSng_ahm_basic_ops A_ m = Arith.equal_nat (g_size_abort_ahm_basic_ops A_ (Arith.nat_of_integer (2 : IntInf.int)) m) Arith.one_nat; fun g_size_ahm_basic_ops A_ m = iteratei_bmap_op_list_it_ahm_basic_ops A_ m (fn _ => true) (fn _ => Arith.suc) Arith.zero_nat; fun g_ball_ahm_basic_ops A_ m p = iteratei_bmap_op_list_it_ahm_basic_ops A_ m Fun.id (fn kv => fn _ => p kv) true; fun g_sng_ahm_basic_ops (A1_, A2_) k v = ahm_update (A1_, A2_) k v (ahm_empty A2_ ()); fun g_sel_ahm_basic_ops A_ m p = iteratei_bmap_op_list_it_ahm_basic_ops A_ m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_ahm_basic_ops A_ m p = iteratei_bmap_op_list_it_ahm_basic_ops A_ m not (fn kv => fn _ => p kv) false; fun g_add_ahm_basic_ops (A1_, A2_) m1 m2 = iteratei_bmap_op_list_it_ahm_basic_ops A2_ m2 (fn _ => true) (fn (a, b) => ahm_update (A1_, A2_) a b) m1; fun test_codegen (A1_, A2_) (C1_, C2_) E_ G_ (I1_, I2_) K_ M_ O_ Q_ T_ W_ (Y1_, Y2_) (Aa1_, Aa2_) Ac_ Ae_ Ag_ (Ai1_, Ai2_) Ak_ (Am1_, Am2_) (Ao1_, Ao2_) (Aq1_, Aq2_) = (g_add_ahm_basic_ops (A1_, A2_), (g_add_dj_ahm_basic_ops (C1_, C2_), (g_ball_ahm_basic_ops E_, (g_bex_ahm_basic_ops G_, (ahm_delete (I1_, I2_), (ahm_empty K_, (g_isEmpty_ahm_basic_ops M_, (g_isSng_ahm_basic_ops O_, ((fn m => iteratei_map_op_list_it_ahm_ops Q_ m (fn _ => true)), (iteratei_map_op_list_it_ahm_ops T_, (ahm_iteratei W_, (ahm_lookup (Y1_, Y2_), (g_restrict_ahm_basic_ops (Aa1_, Aa2_), (g_sel_ahm_basic_ops Ac_, (g_size_ahm_basic_ops Ae_, (g_size_abort_ahm_basic_ops Ag_, (g_sng_ahm_basic_ops (Ai1_, Ai2_), (g_to_list_ahm_basic_ops Ak_, (g_list_to_map_ahm_basic_ops (Am1_, Am2_), (ahm_update (Ao1_, Ao2_), ahm_update (Aq1_, Aq2_))))))))))))))))))))); end; (*struct ArrayHashMap*) ### theory "Collections.ArrayHashMap" ### 2.256s elapsed time, 4.460s cpu time, 0.784s GC time Loading theory "Collections.ListSetImpl_Sorted" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure List : sig val null : 'a list -> bool val member : 'a HOL.equal -> 'a list -> 'a -> bool val remdups : 'a HOL.equal -> 'a list -> 'a list end = struct fun null [] = true | null (x :: xs) = false; fun member A_ [] y = false | member A_ (x :: xs) y = HOL.eq A_ x y orelse member A_ xs y; fun remdups A_ [] = [] | remdups A_ (x :: xs) = (if member A_ xs x then remdups A_ xs else x :: remdups A_ xs); end; (*struct List*) structure Misc : sig val revg : 'a list -> 'a list -> 'a list val remove_rev : 'a HOL.equal -> 'a -> 'a list -> 'a list end = struct fun revg [] b = b | revg (a :: asa) b = revg asa (a :: b); fun filter_rev_aux a p [] = a | filter_rev_aux a p (x :: xs) = (if p x then filter_rev_aux (x :: a) p xs else filter_rev_aux a p xs); fun filter_rev x = filter_rev_aux [] x; fun remove_rev A_ x = filter_rev (not o HOL.eq A_ x); end; (*struct Misc*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure ListSetImpl_NotDist : sig val test_codegen : 'b HOL.equal -> 'd HOL.equal -> 'e HOL.equal -> 'h HOL.equal -> 'i HOL.equal -> 'j HOL.equal -> 'k HOL.equal -> 'l HOL.equal -> 'o HOL.equal -> 'p HOL.equal -> 'q HOL.equal -> 'r HOL.equal -> 's HOL.equal -> 't HOL.equal -> 'u HOL.equal -> 'v HOL.equal -> 'w HOL.equal -> (unit -> 'a list) * (('b -> 'b list -> bool) * (('c -> 'c list -> 'c list) * (('d -> 'd list -> 'd list) * (('e list -> ('e list -> bool) -> ('e -> 'e list -> 'e list) -> 'e list -> 'e list) * (('f -> 'f list) * (('g list -> bool) * (('h list -> bool) * (('i list -> ('i -> bool) -> bool) * (('j list -> ('j -> bool) -> bool) * (('k list -> Arith.nat) * ((Arith.nat -> 'l list -> Arith.nat) * (('m list -> 'm list -> 'm list) * (('n list -> 'n list -> 'n list) * (('o list -> 'o list -> 'o list) * ((('p -> bool) -> 'p list -> 'p list) * (('q list -> 'q list -> 'q list) * (('r list -> 'r list -> bool) * (('s list -> 's list -> bool) * (('t list -> 't list -> bool) * (('u list -> 'u list -> 'u option) * (('v list -> ('v -> bool) -> 'v option) * (('w list -> 'w list) * ('x list -> 'x list))))))))))))))))))))))) end = struct fun lsnd_ins x l = x :: l; fun lsnd_memb A_ x l = List.member A_ l x; fun lsnd_empty x = (fn _ => []) x; fun lsnd_union s1 s2 = Misc.revg s1 s2; fun lsnd_delete A_ x l = Misc.remove_rev A_ x l; fun lsnd_ins_dj x l = x :: l; fun list_to_lsnd x = Fun.id x; fun lsnd_isEmpty s = List.null s; fun lsnd_to_list A_ = List.remdups A_; fun lsnd_iteratei A_ l = Foldi.foldli (List.remdups A_ l); fun iteratei_bset_op_list_it_lsnd_basic_ops A_ s = lsnd_iteratei A_ s; fun g_sel_lsnd_basic_ops A_ s p = iteratei_bset_op_list_it_lsnd_basic_ops A_ s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_disjoint_witness_lsnd_basic_ops A_ s1 s2 = g_sel_lsnd_basic_ops A_ s1 (fn x => lsnd_memb A_ x s2); fun g_size_abort_lsnd_basic_ops A_ m s = iteratei_bset_op_list_it_lsnd_basic_ops A_ s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_ball_lsnd_basic_ops A_ s p = iteratei_bset_op_list_it_lsnd_basic_ops A_ s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_lsnd_basic_ops A_ s1 s2 = g_ball_lsnd_basic_ops A_ s1 (fn x => not (lsnd_memb A_ x s2)); fun g_subset_lsnd_basic_ops A_ s1 s2 = g_ball_lsnd_basic_ops A_ s1 (fn x => lsnd_memb A_ x s2); fun g_filter_lsnd_basic_ops A_ p s = iteratei_bset_op_list_it_lsnd_basic_ops A_ s (fn _ => true) (fn x => fn sigma => (if p x then lsnd_ins_dj x sigma else sigma)) (lsnd_empty ()); fun g_isSng_lsnd_basic_ops A_ s = Arith.equal_nat (iteratei_bset_op_list_it_lsnd_basic_ops A_ s (fn sigma => Arith.less_nat sigma (Arith.nat_of_num (Arith.Bit0 Arith.One))) (fn _ => Arith.Suc) Arith.Zero_nat) Arith.one_nat; fun g_inter_lsnd_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_lsnd_basic_ops A_ s1 (fn _ => true) (fn x => fn s => (if lsnd_memb A_ x s2 then lsnd_ins_dj x s else s)) (lsnd_empty ()); fun g_equal_lsnd_basic_ops A_ s1 s2 = g_subset_lsnd_basic_ops A_ s1 s2 andalso g_subset_lsnd_basic_ops A_ s2 s1; fun g_size_lsnd_basic_ops A_ s = iteratei_bset_op_list_it_lsnd_basic_ops A_ s (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_diff_lsnd_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_lsnd_basic_ops A_ s2 (fn _ => true) (lsnd_delete A_) s1; fun g_sng_lsnd_basic_ops x = lsnd_ins x (lsnd_empty ()); fun g_bex_lsnd_basic_ops A_ s p = iteratei_bset_op_list_it_lsnd_basic_ops A_ s not (fn x => fn _ => p x) false; fun lsnd_union_dj s1 s2 = Misc.revg s1 s2; fun test_codegen B_ D_ E_ H_ I_ J_ K_ L_ O_ P_ Q_ R_ S_ T_ U_ V_ W_ = (lsnd_empty, (lsnd_memb B_, (lsnd_ins, (lsnd_delete D_, (lsnd_iteratei E_, (g_sng_lsnd_basic_ops, (lsnd_isEmpty, (g_isSng_lsnd_basic_ops H_, (g_ball_lsnd_basic_ops I_, (g_bex_lsnd_basic_ops J_, (g_size_lsnd_basic_ops K_, (g_size_abort_lsnd_basic_ops L_, (lsnd_union, (lsnd_union_dj, (g_diff_lsnd_basic_ops O_, (g_filter_lsnd_basic_ops P_, (g_inter_lsnd_basic_ops Q_, (g_subset_lsnd_basic_ops R_, (g_equal_lsnd_basic_ops S_, (g_disjoint_lsnd_basic_ops T_, (g_disjoint_witness_lsnd_basic_ops U_, (g_sel_lsnd_basic_ops V_, (lsnd_to_list W_, list_to_lsnd))))))))))))))))))))))); end; (*struct ListSetImpl_NotDist*) ### theory "Collections.ListSetImpl_NotDist" ### 1.592s elapsed time, 3.188s cpu time, 0.000s GC time Loading theory "Collections.SetByMap" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.RBTSetImpl") locale SetByMapDefs fixes ops :: "('x, unit, 's, 'more) map_basic_ops_scheme" locale SetByMap fixes ops :: "('x, unit, 's, 'more) map_basic_ops_scheme" assumes "SetByMap ops" locale OSetByOMapDefs fixes ops :: "('x, unit, 's, 'more) omap_basic_ops_scheme" structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure List : sig val null : 'a list -> bool val filter : ('a -> bool) -> 'a list -> 'a list val map : ('a -> 'b) -> 'a list -> 'b list end = struct fun null [] = true | null (x :: xs) = false; fun filter p [] = [] | filter p (x :: xs) = (if p x then x :: filter p xs else filter p xs); fun map f [] = [] | map f (x21 :: x22) = f x21 :: map f x22; end; (*struct List*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; end; (*struct Orderings*) structure Misc : sig val merge : 'a HOL.equal * 'a Orderings.linorder -> 'a list -> 'a list -> 'a list val mergesort_remdups : 'a HOL.equal * 'a Orderings.linorder -> 'a list -> 'a list end = struct fun merge (A1_, A2_) [] l2 = l2 | merge (A1_, A2_) (v :: va) [] = v :: va | merge (A1_, A2_) (x1 :: l1) (x2 :: l2) = (if Orderings.less ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A2_) x1 x2 then x1 :: merge (A1_, A2_) l1 (x2 :: l2) else (if HOL.eq A1_ x1 x2 then x1 :: merge (A1_, A2_) l1 l2 else x2 :: merge (A1_, A2_) (x1 :: l1) l2)); fun merge_list (A1_, A2_) [] [] = [] | merge_list (A1_, A2_) [] [l] = l | merge_list (A1_, A2_) (la :: acc2) [] = merge_list (A1_, A2_) [] (la :: acc2) | merge_list (A1_, A2_) (la :: acc2) [l] = merge_list (A1_, A2_) [] (l :: la :: acc2) | merge_list (A1_, A2_) acc2 (l1 :: l2 :: ls) = merge_list (A1_, A2_) (merge (A1_, A2_) l1 l2 :: acc2) ls; fun mergesort_remdups (A1_, A2_) xs = merge_list (A1_, A2_) [] (List.map (fn x => [x]) xs); end; (*struct Misc*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Sorted_List_Operations : sig val memb_sorted : 'a HOL.equal * 'a Orderings.ord -> 'a list -> 'a -> bool val delete_sorted : 'a HOL.equal * 'a Orderings.ord -> 'a -> 'a list -> 'a list val insertion_sort : 'a HOL.equal * 'a Orderings.ord -> 'a -> 'a list -> 'a list end = struct fun memb_sorted (A1_, A2_) [] x = false | memb_sorted (A1_, A2_) (y :: xs) x = (if Orderings.less A2_ y x then memb_sorted (A1_, A2_) xs x else HOL.eq A1_ x y); fun delete_sorted (A1_, A2_) x [] = [] | delete_sorted (A1_, A2_) x (y :: xs) = (if Orderings.less A2_ y x then y :: delete_sorted (A1_, A2_) x xs else (if HOL.eq A1_ x y then xs else y :: xs)); fun insertion_sort (A1_, A2_) x [] = [x] | insertion_sort (A1_, A2_) x (y :: xs) = (if Orderings.less A2_ y x then y :: insertion_sort (A1_, A2_) x xs else (if HOL.eq A1_ x y then y :: xs else x :: y :: xs)); end; (*struct Sorted_List_Operations*) structure ListSetImpl_Sorted : sig val test_codegen : 'a Orderings.linorder -> 'b HOL.equal * 'b Orderings.linorder -> 'c HOL.equal * 'c Orderings.linorder -> 'd HOL.equal * 'd Orderings.linorder -> 'e Orderings.linorder -> 'f HOL.equal * 'f Orderings.linorder -> 'g Orderings.linorder -> 'h Orderings.linorder -> 'i Orderings.linorder -> 'j Orderings.linorder -> 'k Orderings.linorder -> 'l Orderings.linorder -> 'm HOL.equal * 'm Orderings.linorder -> 'n HOL.equal * 'n Orderings.linorder -> 'o HOL.equal * 'o Orderings.linorder -> 'p Orderings.linorder -> 'q HOL.equal * 'q Orderings.linorder -> 'r HOL.equal * 'r Orderings.linorder -> 's HOL.equal * 's Orderings.linorder -> 't HOL.equal * 't Orderings.linorder -> 'u HOL.equal * 'u Orderings.linorder -> 'v Orderings.linorder -> 'w Orderings.linorder -> 'x HOL.equal * 'x Orderings.linorder -> (unit -> 'a list) * (('b -> 'b list -> bool) * (('c -> 'c list -> 'c list) * (('d -> 'd list -> 'd list) * (('e list -> ('e list -> bool) -> ('e -> 'e list -> 'e list) -> 'e list -> 'e list) * (('f -> 'f list) * (('g list -> bool) * (('h list -> bool) * (('i list -> ('i -> bool) -> bool) * (('j list -> ('j -> bool) -> bool) * (('k list -> Arith.nat) * ((Arith.nat -> 'l list -> Arith.nat) * (('m list -> 'm list -> 'm list) * (('n list -> 'n list -> 'n list) * (('o list -> 'o list -> 'o list) * ((('p -> bool) -> 'p list -> 'p list) * (('q list -> 'q list -> 'q list) * (('r list -> 'r list -> bool) * (('s list -> 's list -> bool) * (('t list -> 't list -> bool) * (('u list -> 'u list -> 'u option) * (('v list -> ('v -> bool) -> 'v option) * (('w list -> 'w list) * ('x list -> 'x list))))))))))))))))))))))) end = struct fun lss_ins (A1_, A2_) x l = Sorted_List_Operations.insertion_sort (A1_, (Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A2_) x l; fun lss_memb (A1_, A2_) x l = Sorted_List_Operations.memb_sorted (A1_, (Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A2_) l x; fun lss_empty x = (fn _ => []) x; fun lss_union (A1_, A2_) s1 s2 = Misc.merge (A1_, A2_) s1 s2; fun lss_delete (A1_, A2_) x l = Sorted_List_Operations.delete_sorted (A1_, (Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A2_) x l; fun lss_ins_dj (A1_, A2_) = lss_ins (A1_, A2_); fun list_to_lss (A1_, A2_) = Misc.mergesort_remdups (A1_, A2_); fun lss_isEmpty s = List.null s; fun lss_to_list x = Fun.id x; fun lss_iteratei l = Foldi.foldli l; fun lss_union_dj (A1_, A2_) = lss_union (A1_, A2_); fun iteratei_bset_op_list_it_lss_basic_ops A_ s = lss_iteratei s; fun g_sel_lss_basic_ops A_ s p = iteratei_bset_op_list_it_lss_basic_ops A_ s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_disjoint_witness_lss_basic_ops (A1_, A2_) s1 s2 = g_sel_lss_basic_ops A2_ s1 (fn x => lss_memb (A1_, A2_) x s2); fun g_size_abort_lss_basic_ops A_ m s = iteratei_bset_op_list_it_lss_basic_ops A_ s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_ball_lss_basic_ops A_ s p = iteratei_bset_op_list_it_lss_basic_ops A_ s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_lss_basic_ops (A1_, A2_) s1 s2 = g_ball_lss_basic_ops A2_ s1 (fn x => not (lss_memb (A1_, A2_) x s2)); fun g_subset_lss_basic_ops (A1_, A2_) s1 s2 = g_ball_lss_basic_ops A2_ s1 (fn x => lss_memb (A1_, A2_) x s2); fun g_isSng_lss_basic_ops A_ s = Arith.equal_nat (iteratei_bset_op_list_it_lss_basic_ops A_ s (fn sigma => Arith.less_nat sigma (Arith.nat_of_num (Arith.Bit0 Arith.One))) (fn _ => Arith.Suc) Arith.Zero_nat) Arith.one_nat; fun g_inter_lss_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_lss_basic_ops A2_ s1 (fn _ => true) (fn x => fn s => (if lss_memb (A1_, A2_) x s2 then lss_ins_dj (A1_, A2_) x s else s)) (lss_empty ()); fun g_equal_lss_basic_ops (A1_, A2_) s1 s2 = g_subset_lss_basic_ops (A1_, A2_) s1 s2 andalso g_subset_lss_basic_ops (A1_, A2_) s2 s1; fun g_size_lss_basic_ops A_ s = iteratei_bset_op_list_it_lss_basic_ops A_ s (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_diff_lss_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_lss_basic_ops A2_ s2 (fn _ => true) (lss_delete (A1_, A2_)) s1; fun g_sng_lss_basic_ops (A1_, A2_) x = lss_ins (A1_, A2_) x (lss_empty ()); fun g_bex_lss_basic_ops A_ s p = iteratei_bset_op_list_it_lss_basic_ops A_ s not (fn x => fn _ => p x) false; fun test_codegen A_ (B1_, B2_) (C1_, C2_) (D1_, D2_) E_ (F1_, F2_) G_ H_ I_ J_ K_ L_ (M1_, M2_) (N1_, N2_) (O1_, O2_) P_ (Q1_, Q2_) (R1_, R2_) (S1_, S2_) (T1_, T2_) (U1_, U2_) V_ W_ (X1_, X2_) = (lss_empty, (lss_memb (B1_, B2_), (lss_ins (C1_, C2_), (lss_delete (D1_, D2_), (lss_iteratei, (g_sng_lss_basic_ops (F1_, F2_), (lss_isEmpty, (g_isSng_lss_basic_ops H_, (g_ball_lss_basic_ops I_, (g_bex_lss_basic_ops J_, (g_size_lss_basic_ops K_, (g_size_abort_lss_basic_ops L_, (lss_union (M1_, M2_), (lss_union_dj (N1_, N2_), (g_diff_lss_basic_ops (O1_, O2_), (List.filter, (g_inter_lss_basic_ops (Q1_, Q2_), (g_subset_lss_basic_ops (R1_, R2_), (g_equal_lss_basic_ops (S1_, S2_), (g_disjoint_lss_basic_ops (T1_, T2_), (g_disjoint_witness_lss_basic_ops (U1_, U2_), (g_sel_lss_basic_ops V_, (lss_to_list, list_to_lss (X1_, X2_)))))))))))))))))))))))); end; (*struct ListSetImpl_Sorted*) ### theory "Collections.ListSetImpl_Sorted" ### 2.451s elapsed time, 4.912s cpu time, 0.000s GC time Loading theory "Collections.RBTMapImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.RBTSetImpl") locale OSetByOMap fixes ops :: "('x, unit, 's, 'more) omap_basic_ops_scheme" assumes "OSetByOMap ops" ### theory "Collections.SetByMap" ### 1.978s elapsed time, 3.900s cpu time, 0.496s GC time Loading theory "Collections.ArrayHashSet" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") ### Ignoring sort constraints in type variables(s): "'a" ### in type abbreviation "ahs" structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; end; (*struct Orderings*) structure Product_Type : sig val apfst : ('a -> 'b) -> 'a * 'c -> 'b * 'c val fst : 'a * 'b -> 'a end = struct fun apfst f (x, y) = (f x, y); fun fst (x1, x2) = x1; end; (*struct Product_Type*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val equal_nat : nat -> nat -> bool val less_nat : nat -> nat -> bool val divmod_nat : nat -> nat -> nat * nat end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun minus_nat (Suc m) (Suc n) = minus_nat m n | minus_nat Zero_nat n = Zero_nat | minus_nat m Zero_nat = m; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun divmod_nat m n = (if equal_nat n Zero_nat orelse less_nat m n then (Zero_nat, m) else let val a = divmod_nat (minus_nat m n) n; val (q, aa) = a; in (Suc q, aa) end); end; (*struct Arith*) structure List : sig val rev : 'a list -> 'a list val foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a val size_list : 'a list -> Arith.nat end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun foldl f a [] = a | foldl f a (x :: xs) = foldl f (f a x) xs; fun gen_length n (x :: xs) = gen_length (Arith.Suc n) xs | gen_length n [] = n; fun size_list x = gen_length Arith.Zero_nat x; end; (*struct List*) structure RBT_Impl : sig type color datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt val rbt_union : 'a Orderings.ord -> ('a, 'b) rbt -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_delete : 'a Orderings.ord -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_insert : 'a Orderings.ord -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_lookup : 'a Orderings.ord -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype color = R | B; datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt; datatype compare = LT | GT | EQ; fun fold f (Branch (c, lt, k, v, rt)) x = fold f rt (f k v (fold f lt x)) | fold f Empty x = x; fun paint c Empty = Empty | paint c (Branch (uu, l, k, v, r)) = Branch (c, l, k, v, r); fun balance (Branch (R, a, w, x, b)) s t (Branch (R, c, y, z, d)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z Empty = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (B, va, vb, vc, vd), w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Branch (B, ve, vf, vg, vh), w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Branch (B, ve, vf, vg, vh), w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance Empty w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, d)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, va, vb, vc, vd))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, ve, vf, vg, vh))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Branch (B, ve, vf, vg, vh))) | balance Empty s t Empty = Branch (B, Empty, s, t, Empty) | balance Empty s t (Branch (B, va, vb, vc, vd)) = Branch (B, Empty, s, t, Branch (B, va, vb, vc, vd)) | balance Empty s t (Branch (v, Empty, vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Empty)) | balance Empty s t (Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) | balance Empty s t (Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) | balance Empty s t (Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) | balance (Branch (B, va, vb, vc, vd)) s t Empty = Branch (B, Branch (B, va, vb, vc, vd), s, t, Empty) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (B, ve, vf, vg, vh)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (B, ve, vf, vg, vh)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (v, Empty, vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Empty), s, t, Empty) | balance (Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh))) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh)), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl))) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl)), s, t, Empty) | balance (Branch (v, Empty, vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl)), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp)), s, t, Branch (B, va, vb, vc, vd)); fun balance_left (Branch (R, a, k, x, b)) s y c = Branch (R, Branch (B, a, k, x, b), s, y, c) | balance_left Empty k x (Branch (B, a, s, y, b)) = balance Empty k x (Branch (R, a, s, y, b)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (B, a, s, y, b)) = balance (Branch (B, va, vb, vc, vd)) k x (Branch (R, a, s, y, b)) | balance_left Empty k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Empty, k, x, a), s, y, balance b t z (paint R c)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), k, x, a), s, y, balance b t z (paint R c)) | balance_left Empty k x Empty = Empty | balance_left Empty k x (Branch (R, Empty, vb, vc, vd)) = Empty | balance_left Empty k x (Branch (R, Branch (R, ve, vf, vg, vh), vb, vc, vd)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x Empty = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Empty, vf, vg, vh)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (R, vi, vj, vk, vl), vf, vg, vh)) = Empty; fun combine Empty x = x | combine (Branch (v, va, vb, vc, vd)) Empty = Branch (v, va, vb, vc, vd) | combine (Branch (R, a, k, x, b)) (Branch (R, c, s, y, d)) = (case combine b c of Empty => Branch (R, a, k, x, Branch (R, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (R, a, k, x, b2), t, z, Branch (R, c2, s, y, d)) | Branch (B, b2, t, z, c2) => Branch (R, a, k, x, Branch (R, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, a, k, x, b)) (Branch (B, c, s, y, d)) = (case combine b c of Empty => balance_left a k x (Branch (B, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (B, a, k, x, b2), t, z, Branch (B, c2, s, y, d)) | Branch (B, b2, t, z, c2) => balance_left a k x (Branch (B, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, va, vb, vc, vd)) (Branch (R, b, k, x, c)) = Branch (R, combine (Branch (B, va, vb, vc, vd)) b, k, x, c) | combine (Branch (R, a, k, x, b)) (Branch (B, va, vb, vc, vd)) = Branch (R, a, k, x, combine b (Branch (B, va, vb, vc, vd))); fun gen_entries kvts (Branch (c, l, k, v, r)) = gen_entries (((k, v), r) :: kvts) l | gen_entries ((kv, t) :: kvts) Empty = kv :: gen_entries kvts t | gen_entries [] Empty = []; fun entries x = gen_entries [] x; fun skip_red (Branch (R, l, k, v, r)) = l | skip_red Empty = Empty | skip_red (Branch (B, va, vb, vc, vd)) = Branch (B, va, vb, vc, vd); fun rbtreeify_g n kvs = (if Arith.equal_nat n Arith.Zero_nat orelse Arith.equal_nat n Arith.one_nat then (Empty, kvs) else let val (na, r) = Arith.divmod_nat n (Arith.nat_of_num (Arith.Bit0 Arith.One)); in (if Arith.equal_nat r Arith.Zero_nat then let val (t1, (k, v) :: kvsa) = rbtreeify_g na kvs; in Product_Type.apfst (fn a => Branch (B, t1, k, v, a)) (rbtreeify_g na kvsa) end else let val (t1, (k, v) :: kvsa) = rbtreeify_f na kvs; in Product_Type.apfst (fn a => Branch (B, t1, k, v, a)) (rbtreeify_g na kvsa) end) end) and rbtreeify_f n kvs = (if Arith.equal_nat n Arith.Zero_nat then (Empty, kvs) else (if Arith.equal_nat n Arith.one_nat then let val (k, v) :: kvsa = kvs; in (Branch (R, Empty, k, v, Empty), kvsa) end else let val (na, r) = Arith.divmod_nat n (Arith.nat_of_num (Arith.Bit0 Arith.One)); in (if Arith.equal_nat r Arith.Zero_nat then let val (t1, (k, v) :: kvsa) = rbtreeify_f na kvs; in Product_Type.apfst (fn a => Branch (B, t1, k, v, a)) (rbtreeify_g na kvsa) end else let val (t1, (k, v) :: kvsa) = rbtreeify_f na kvs; in Product_Type.apfst (fn a => Branch (B, t1, k, v, a)) (rbtreeify_f na kvsa) end) end)); fun rbtreeify kvs = Product_Type.fst (rbtreeify_g (Arith.Suc (List.size_list kvs)) kvs); fun skip_black t = let val ta = skip_red t; in (case ta of Empty => ta | Branch (R, _, _, _, _) => ta | Branch (B, l, _, _, _) => l) end; fun balance_right a k x (Branch (R, b, s, y, c)) = Branch (R, a, k, x, Branch (B, b, s, y, c)) | balance_right (Branch (B, a, k, x, b)) s y Empty = balance (Branch (R, a, k, x, b)) s y Empty | balance_right (Branch (B, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) = balance (Branch (R, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z Empty = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Empty)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z (Branch (B, va, vb, vc, vd)) = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Branch (B, va, vb, vc, vd))) | balance_right Empty k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Empty)) k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Branch (R, ve, vf, vg, vh))) k x Empty = Empty | balance_right Empty k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Empty)) k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Branch (R, vi, vj, vk, vl))) k x (Branch (B, va, vb, vc, vd)) = Empty; fun compare_height sx s t tx = (case (skip_red sx, (skip_red s, (skip_red t, skip_red tx))) of (Empty, (Empty, (_, Empty))) => EQ | (Empty, (Empty, (_, Branch (_, _, _, _, _)))) => LT | (Empty, (Branch (_, _, _, _, _), (Empty, _))) => EQ | (Empty, (Branch (_, _, _, _, _), (Branch (_, _, _, _, _), Empty))) => EQ | (Empty, (Branch (_, sa, _, _, _), (Branch (_, ta, _, _, _), Branch (_, txa, _, _, _)))) => compare_height Empty sa ta (skip_black txa) | (Branch (_, _, _, _, _), (Empty, (Empty, Empty))) => GT | (Branch (_, _, _, _, _), (Empty, (Empty, Branch (_, _, _, _, _)))) => LT | (Branch (_, _, _, _, _), (Empty, (Branch (_, _, _, _, _), Empty))) => EQ | (Branch (_, _, _, _, _), (Empty, (Branch (_, _, _, _, _), Branch (_, _, _, _, _)))) => LT | (Branch (_, _, _, _, _), (Branch (_, _, _, _, _), (Empty, _))) => GT | (Branch (_, sxa, _, _, _), (Branch (_, sa, _, _, _), (Branch (_, ta, _, _, _), Empty))) => compare_height (skip_black sxa) sa ta Empty | (Branch (_, sxa, _, _, _), (Branch (_, sa, _, _, _), (Branch (_, ta, _, _, _), Branch (_, txa, _, _, _)))) => compare_height (skip_black sxa) sa ta (skip_black txa)); fun rbt_del A_ x Empty = Empty | rbt_del A_ x (Branch (c, a, y, s, b)) = (if Orderings.less A_ x y then rbt_del_from_left A_ x a y s b else (if Orderings.less A_ y x then rbt_del_from_right A_ x a y s b else combine a b)) and rbt_del_from_left A_ x (Branch (B, lt, z, v, rt)) y s b = balance_left (rbt_del A_ x (Branch (B, lt, z, v, rt))) y s b | rbt_del_from_left A_ x Empty y s b = Branch (R, rbt_del A_ x Empty, y, s, b) | rbt_del_from_left A_ x (Branch (R, va, vb, vc, vd)) y s b = Branch (R, rbt_del A_ x (Branch (R, va, vb, vc, vd)), y, s, b) and rbt_del_from_right A_ x a y s (Branch (B, lt, z, v, rt)) = balance_right a y s (rbt_del A_ x (Branch (B, lt, z, v, rt))) | rbt_del_from_right A_ x a y s Empty = Branch (R, a, y, s, rbt_del A_ x Empty) | rbt_del_from_right A_ x a y s (Branch (R, va, vb, vc, vd)) = Branch (R, a, y, s, rbt_del A_ x (Branch (R, va, vb, vc, vd))); fun rbt_ins A_ f k v Empty = Branch (R, Empty, k, v, Empty) | rbt_ins A_ f k v (Branch (B, l, x, y, r)) = (if Orderings.less A_ k x then balance (rbt_ins A_ f k v l) x y r else (if Orderings.less A_ x k then balance l x y (rbt_ins A_ f k v r) else Branch (B, l, x, f k y v, r))) | rbt_ins A_ f k v (Branch (R, l, x, y, r)) = (if Orderings.less A_ k x then Branch (R, rbt_ins A_ f k v l, x, y, r) else (if Orderings.less A_ x k then Branch (R, l, x, y, rbt_ins A_ f k v r) else Branch (R, l, x, f k y v, r))); fun rbt_insert_with_key A_ f k v t = paint B (rbt_ins A_ f k v t); fun sunion_with A_ f ((ka, va) :: asa) ((k, v) :: bs) = (if Orderings.less A_ k ka then (k, v) :: sunion_with A_ f ((ka, va) :: asa) bs else (if Orderings.less A_ ka k then (ka, va) :: sunion_with A_ f asa ((k, v) :: bs) else (ka, f ka va v) :: sunion_with A_ f asa bs)) | sunion_with A_ f [] bs = bs | sunion_with A_ f asa [] = asa; fun rbt_union_with_key A_ f t1 t2 = (case compare_height t1 t1 t2 t2 of LT => fold (rbt_insert_with_key A_ (fn k => fn v => fn w => f k w v)) t1 t2 | GT => fold (rbt_insert_with_key A_ f) t2 t1 | EQ => rbtreeify (sunion_with A_ f (entries t1) (entries t2))); fun rbt_union A_ = rbt_union_with_key A_ (fn _ => fn _ => fn rv => rv); fun rbt_delete A_ k t = paint B (rbt_del A_ k t); fun rbt_insert A_ = rbt_insert_with_key A_ (fn _ => fn _ => fn nv => nv); fun rbt_lookup A_ Empty k = NONE | rbt_lookup A_ (Branch (uu, l, x, y, r)) k = (if Orderings.less A_ k x then rbt_lookup A_ l k else (if Orderings.less A_ x k then rbt_lookup A_ r k else SOME y)); end; (*struct RBT_Impl*) structure RBT : sig type ('b, 'a) rbt val empty : 'a Orderings.linorder -> ('a, 'b) rbt val impl_of : 'b Orderings.linorder -> ('b, 'a) rbt -> ('b, 'a) RBT_Impl.rbt val union : 'a Orderings.linorder -> ('a, 'b) rbt -> ('a, 'b) rbt -> ('a, 'b) rbt val delete : 'a Orderings.linorder -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val insert : 'a Orderings.linorder -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val lookup : 'a Orderings.linorder -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype ('b, 'a) rbt = RBT of ('b, 'a) RBT_Impl.rbt; fun empty A_ = RBT RBT_Impl.Empty; fun impl_of B_ (RBT x) = x; fun union A_ xb xc = RBT (RBT_Impl.rbt_union ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) (impl_of A_ xb) (impl_of A_ xc)); fun delete A_ xb xc = RBT (RBT_Impl.rbt_delete ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xb (impl_of A_ xc)); fun insert A_ xc xd xe = RBT (RBT_Impl.rbt_insert ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xc xd (impl_of A_ xe)); fun lookup A_ x = RBT_Impl.rbt_lookup ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) (impl_of A_ x); end; (*struct RBT*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure RBT_add : sig val rm_iterateoi : ('a, 'b) RBT_Impl.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c val rm_reverse_iterateoi : ('a, 'b) RBT_Impl.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun rm_iterateoi RBT_Impl.Empty c f sigma = sigma | rm_iterateoi (RBT_Impl.Branch (col, l, k, v, r)) c f sigma = (if c sigma then let val sigmaa = rm_iterateoi l c f sigma; in (if c sigmaa then rm_iterateoi r c f (f (k, v) sigmaa) else sigmaa) end else sigma); fun rm_reverse_iterateoi RBT_Impl.Empty c f sigma = sigma | rm_reverse_iterateoi (RBT_Impl.Branch (col, l, k, v, r)) c f sigma = (if c sigma then let val sigmaa = rm_reverse_iterateoi r c f sigma; in (if c sigmaa then rm_reverse_iterateoi l c f (f (k, v) sigmaa) else sigmaa) end else sigma); end; (*struct RBT_add*) structure RBTMapImpl : sig val test_codegen : 'a Orderings.linorder -> 'c Orderings.linorder -> 'e Orderings.linorder -> 'g Orderings.linorder -> 'i Orderings.linorder -> 'k Orderings.linorder -> 'm Orderings.linorder -> 'o Orderings.linorder -> 'q Orderings.linorder -> 't Orderings.linorder -> 'w Orderings.linorder -> 'z Orderings.linorder -> 'ac Orderings.linorder -> 'ae Orderings.linorder -> 'ag Orderings.linorder -> 'ai Orderings.linorder -> 'ak Orderings.linorder -> 'am Orderings.linorder -> 'ap Orderings.linorder -> 'as Orderings.linorder -> 'au Orderings.linorder -> 'ax Orderings.linorder -> 'ba Orderings.linorder -> 'bc Orderings.linorder -> 'be Orderings.linorder -> 'bg Orderings.linorder -> 'bi Orderings.linorder -> 'bk Orderings.linorder -> 'bm Orderings.linorder -> 'bo Orderings.linorder -> 'bq Orderings.linorder -> 'bs Orderings.linorder -> (('a, 'b) RBT.rbt -> ('a, 'b) RBT.rbt -> ('a, 'b) RBT.rbt) * ((('c, 'd) RBT.rbt -> ('c, 'd) RBT.rbt -> ('c, 'd) RBT.rbt) * ((('e, 'f) RBT.rbt -> ('e * 'f -> bool) -> bool) * ((('g, 'h) RBT.rbt -> ('g * 'h -> bool) -> bool) * (('i -> ('i, 'j) RBT.rbt -> ('i, 'j) RBT.rbt) * ((unit -> ('k, 'l) RBT.rbt) * ((('m, 'n) RBT.rbt -> bool) * ((('o, 'p) RBT.rbt -> bool) * ((('q, 'r) RBT.rbt -> ('q * 'r -> 's -> 's) -> 's -> 's) * ((('t, 'u) RBT.rbt -> ('v -> bool) -> ('t * 'u -> 'v -> 'v) -> 'v -> 'v) * ((('w, 'x) RBT.rbt -> ('w * 'x -> 'y -> 'y) -> 'y -> 'y) * ((('z, 'aa) RBT.rbt -> ('ab -> bool) -> ('z * 'aa -> 'ab -> 'ab) -> 'ab -> 'ab) * ((('ac, 'ad) RBT.rbt -> (('ac * 'ad) list -> bool) -> ('ac * 'ad -> ('ac * 'ad) list -> ('ac * 'ad) list) -> ('ac * 'ad) list -> ('ac * 'ad) list) * (('ae -> ('ae, 'af) RBT.rbt -> 'af option) * ((('ag, 'ah) RBT.rbt -> ('ag * 'ah -> bool) -> ('ag * 'ah) option) * ((('ai, 'aj) RBT.rbt -> ('ai * 'aj -> bool) -> ('ai * 'aj) option) * ((('ak * 'al -> bool) -> ('ak, 'al) RBT.rbt -> ('ak, 'al) RBT.rbt) * ((('am, 'an) RBT.rbt -> ('am * 'an -> 'ao -> 'ao) -> 'ao -> 'ao) * ((('ap, 'aq) RBT.rbt -> ('ar -> bool) -> ('ap * 'aq -> 'ar -> 'ar) -> 'ar -> 'ar) * ((('as, 'at) RBT.rbt -> (('as * 'at) list -> bool) -> ('as * 'at -> ('as * 'at) list -> ('as * 'at) list) -> ('as * 'at) list -> ('as * 'at) list) * ((('au, 'av) RBT.rbt -> ('au * 'av -> 'aw -> 'aw) -> 'aw -> 'aw) * ((('ax, 'ay) RBT.rbt -> ('az -> bool) -> ('ax * 'ay -> 'az -> 'az) -> 'az -> 'az) * ((('ba, 'bb) RBT.rbt -> ('ba * 'bb -> bool) -> ('ba * 'bb) option) * ((('bc, 'bd) RBT.rbt -> Arith.nat) * ((Arith.nat -> ('be, 'bf) RBT.rbt -> Arith.nat) * (('bg -> 'bh -> ('bg, 'bh) RBT.rbt) * ((('bi, 'bj) RBT.rbt -> ('bi * 'bj) list) * ((('bk * 'bl) list -> ('bk, 'bl) RBT.rbt) * ((('bm, 'bn) RBT.rbt -> ('bm * 'bn) list) * ((('bo, 'bp) RBT.rbt -> ('bo * 'bp) list) * (('bq -> 'br -> ('bq, 'br) RBT.rbt -> ('bq, 'br) RBT.rbt) * ('bs -> 'bt -> ('bs, 'bt) RBT.rbt -> ('bs, 'bt) RBT.rbt))))))))))))))))))))))))))))))) end = struct fun rev_iterateoi_map_op_rev_list_it_rm_ops A_ s = RBT_add.rm_reverse_iterateoi (RBT.impl_of A_ s); fun iterateoi_map_op_ordered_list_it_rm_ops A_ s = RBT_add.rm_iterateoi (RBT.impl_of A_ s); fun iteratei_map_op_list_it_rm_ops A_ s = RBT_add.rm_iterateoi (RBT.impl_of A_ s); fun rev_iterateoi_bmap_op_rev_list_it_rm_basic_ops A_ s = RBT_add.rm_reverse_iterateoi (RBT.impl_of A_ s); fun g_to_sorted_list_rm_basic_ops A_ m = rev_iterateoi_bmap_op_rev_list_it_rm_basic_ops A_ m (fn _ => true) (fn a => fn b => a :: b) []; fun iterateoi_bmap_op_ordered_list_it_rm_basic_ops A_ s = RBT_add.rm_iterateoi (RBT.impl_of A_ s); fun g_to_rev_list_rm_basic_ops A_ m = iterateoi_bmap_op_ordered_list_it_rm_basic_ops A_ m (fn _ => true) (fn a => fn b => a :: b) []; fun g_list_to_map_rm_basic_ops A_ l = List.foldl (fn m => fn (k, v) => RBT.insert A_ k v m) (RBT.empty A_) (List.rev l); fun iteratei_bmap_op_list_it_rm_basic_ops A_ s = RBT_add.rm_iterateoi (RBT.impl_of A_ s); fun g_size_abort_rm_basic_ops A_ b m = iteratei_bmap_op_list_it_rm_basic_ops A_ m (fn s => Arith.less_nat s b) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_restrict_rm_basic_ops A_ p m = iteratei_bmap_op_list_it_rm_basic_ops A_ m (fn _ => true) (fn (k, v) => fn sigma => (if p (k, v) then RBT.insert A_ k v sigma else sigma)) (RBT.empty A_); fun g_to_list_rm_basic_ops A_ m = iteratei_bmap_op_list_it_rm_basic_ops A_ m (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_rm_basic_ops A_ m = Arith.equal_nat (g_size_abort_rm_basic_ops A_ Arith.one_nat m) Arith.Zero_nat; fun g_add_dj_rm_basic_ops A_ m1 m2 = iteratei_bmap_op_list_it_rm_basic_ops A_ m2 (fn _ => true) (fn (a, b) => RBT.insert A_ a b) m1; fun g_isSng_rm_basic_ops A_ m = Arith.equal_nat (g_size_abort_rm_basic_ops A_ (Arith.nat_of_num (Arith.Bit0 Arith.One)) m) Arith.one_nat; fun g_size_rm_basic_ops A_ m = iteratei_bmap_op_list_it_rm_basic_ops A_ m (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun g_ball_rm_basic_ops A_ m p = iteratei_bmap_op_list_it_rm_basic_ops A_ m Fun.id (fn kv => fn _ => p kv) true; fun g_sng_rm_basic_ops A_ k v = RBT.insert A_ k v (RBT.empty A_); fun g_sel_rm_basic_ops A_ m p = iteratei_bmap_op_list_it_rm_basic_ops A_ m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_min_rm_basic_ops A_ m p = iterateoi_bmap_op_ordered_list_it_rm_basic_ops A_ m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_max_rm_basic_ops A_ m p = rev_iterateoi_bmap_op_rev_list_it_rm_basic_ops A_ m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_rm_basic_ops A_ m p = iteratei_bmap_op_list_it_rm_basic_ops A_ m not (fn kv => fn _ => p kv) false; fun test_codegen A_ C_ E_ G_ I_ K_ M_ O_ Q_ T_ W_ Z_ Ac_ Ae_ Ag_ Ai_ Ak_ Am_ Ap_ As_ Au_ Ax_ Ba_ Bc_ Be_ Bg_ Bi_ Bk_ Bm_ Bo_ Bq_ Bs_ = (RBT.union A_, (g_add_dj_rm_basic_ops C_, (g_ball_rm_basic_ops E_, (g_bex_rm_basic_ops G_, (RBT.delete I_, ((fn _ => RBT.empty K_), (g_isEmpty_rm_basic_ops M_, (g_isSng_rm_basic_ops O_, ((fn m => iteratei_map_op_list_it_rm_ops Q_ m (fn _ => true)), (iteratei_map_op_list_it_rm_ops T_, ((fn m => iterateoi_map_op_ordered_list_it_rm_ops W_ m (fn _ => true)), (iterateoi_map_op_ordered_list_it_rm_ops Z_, ((fn r => RBT_add.rm_iterateoi (RBT.impl_of Ac_ r)), ((fn k => fn m => RBT.lookup Ae_ m k), (g_max_rm_basic_ops Ag_, (g_min_rm_basic_ops Ai_, (g_restrict_rm_basic_ops Ak_, ((fn m => rev_iterateoi_map_op_rev_list_it_rm_ops Am_ m (fn _ => true)), (rev_iterateoi_map_op_rev_list_it_rm_ops Ap_, ((fn r => RBT_add.rm_reverse_iterateoi (RBT.impl_of As_ r)), ((fn m => rev_iterateoi_map_op_rev_list_it_rm_ops Au_ m (fn _ => true)), (rev_iterateoi_map_op_rev_list_it_rm_ops Ax_, (g_sel_rm_basic_ops Ba_, (g_size_rm_basic_ops Bc_, (g_size_abort_rm_basic_ops Be_, (g_sng_rm_basic_ops Bg_, (g_to_list_rm_basic_ops Bi_, (g_list_to_map_rm_basic_ops Bk_, (g_to_rev_list_rm_basic_ops Bm_, (g_to_sorted_list_rm_basic_ops Bo_, (RBT.insert Bq_, RBT.insert Bs_))))))))))))))))))))))))))))))); end; (*struct RBTMapImpl*) ### theory "Collections.RBTMapImpl" ### 3.134s elapsed time, 6.216s cpu time, 0.496s GC time Loading theory "Collections.ArraySetImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") (* Test that words can handle numbers between 0 and 31 *) val _ = if 5 <= Word.wordSize then () else raise (Fail ("wordSize less than 5")); structure Uint32 : sig val set_bit : Word32.word -> IntInf.int -> bool -> Word32.word val shiftl : Word32.word -> IntInf.int -> Word32.word val shiftr : Word32.word -> IntInf.int -> Word32.word val shiftr_signed : Word32.word -> IntInf.int -> Word32.word val test_bit : Word32.word -> IntInf.int -> bool end = struct fun set_bit x n b = let val mask = Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n)) in if b then Word32.orb (x, mask) else Word32.andb (x, Word32.notb mask) end fun shiftl x n = Word32.<< (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr x n = Word32.>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr_signed x n = Word32.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun test_bit x n = Word32.andb (x, Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n))) <> Word32.fromInt 0 end; (* struct Uint32 *) structure STArray = struct datatype 'a Cell = Invalid | Value of 'a array; exception AccessedOldVersion; type 'a array = 'a Cell Unsynchronized.ref; fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun array (size, v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun sub (Unsynchronized.ref Invalid, idx) = raise AccessedOldVersion | sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx); fun update (aref,idx,v) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( aref := Invalid; Array.update (a,idx,v); Unsynchronized.ref (Value a) ); fun length (Unsynchronized.ref Invalid) = raise AccessedOldVersion | length (Unsynchronized.ref (Value a)) = Array.length a fun grow (aref, i, x) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+i,x) in aref := Invalid; Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( aref:=Invalid; Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); end; end; structure FArray = struct datatype 'a Cell = Value of 'a Array.array | Upd of (int*'a*'a Cell Unsynchronized.ref); type 'a array = 'a Cell Unsynchronized.ref; fun array (size,v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx) | sub (Unsynchronized.ref (Upd (i,v,cr)),idx) = if i=idx then v else sub (cr,idx); fun length (Unsynchronized.ref (Value a)) = Array.length a | length (Unsynchronized.ref (Upd (i,v,cr))) = length cr; fun realize_aux (aref, v) = case aref of (Unsynchronized.ref (Value a)) => ( let val len = Array.length a; val a' = Array.array (len,v); in Array.copy {src=a, dst=a', di=0}; Unsynchronized.ref (Value a') end ) | (Unsynchronized.ref (Upd (i,v,cr))) => ( let val res=realize_aux (cr,v) in case res of (Unsynchronized.ref (Value a)) => (Array.update (a,i,v); res) end ); fun realize aref = case aref of (Unsynchronized.ref (Value _)) => aref | (Unsynchronized.ref (Upd (i,v,cr))) => realize_aux(aref,v); fun update (aref,idx,v) = case aref of (Unsynchronized.ref (Value a)) => ( let val nref=Unsynchronized.ref (Value a) in aref := Upd (idx,Array.sub(a,idx),nref); Array.update (a,idx,v); nref end ) | (Unsynchronized.ref (Upd _)) => let val ra = realize_aux(aref,v) in case ra of (Unsynchronized.ref (Value a)) => Array.update (a,idx,v); ra end ; fun grow (aref, inc, x) = case aref of (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+inc,x) in Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ) | (Unsynchronized.ref (Upd _)) => ( grow (realize aref, inc, x) ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ) | (Unsynchronized.ref (Upd _)) => ( shrink (realize aref,sz) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); fun array_get_oo (d:'a) (a:'a ArrayType) (i:IntInf.int) = sub (a,IntInf.toInt i) handle Subscript => d fun array_set_oo (d:(unit->'a ArrayType)) (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e) handle Subscript => d () end; end; structure Bits_Integer : sig val set_bit : IntInf.int -> IntInf.int -> bool -> IntInf.int val shiftl : IntInf.int -> IntInf.int -> IntInf.int val shiftr : IntInf.int -> IntInf.int -> IntInf.int val test_bit : IntInf.int -> IntInf.int -> bool end = struct val maxWord = IntInf.pow (2, Word.wordSize); fun set_bit x n b = if n < maxWord then if b then IntInf.orb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) else IntInf.andb (x, IntInf.notb (IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n)))) else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); fun shiftl x n = if n < maxWord then IntInf.<< (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun shiftr x n = if n < maxWord then IntInf.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun test_bit x n = if n < maxWord then IntInf.andb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) <> 0 else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); end; (*struct Bits_Integer*) structure HOL : sig type 'a equal datatype 'a itself = Type val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; datatype 'a itself = Type; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure List : sig val filter : ('a -> bool) -> 'a list -> 'a list end = struct fun filter p [] = [] | filter p (x :: xs) = (if p x then x :: filter p xs else filter p xs); end; (*struct List*) structure Product_Type : sig val apsnd : ('a -> 'b) -> 'c * 'a -> 'c * 'b val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun apsnd f (x, y) = (x, f y); fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure AList : sig val delete : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list val update : 'a HOL.equal -> 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list end = struct fun delete A_ k = List.filter (fn (ka, _) => not (HOL.eq A_ k ka)); fun update A_ k v [] = [(k, v)] | update A_ k v (p :: ps) = (if HOL.eq A_ (Product_Type.fst p) k then (k, v) :: ps else p :: update A_ k v ps); end; (*struct AList*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool val max : 'a ord -> 'a -> 'a -> 'a end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; fun max A_ a b = (if less_eq A_ a b then b else a); end; (*struct Orderings*) structure Arith : sig type nat datatype num = One | Bit0 of num | Bit1 of num val integer_of_nat : nat -> IntInf.int val plus_nat : nat -> nat -> nat val one_nat : nat val suc : nat -> nat val less_nat : nat -> nat -> bool val zero_nat : nat val nat_of_integer : IntInf.int -> nat val equal_nat : nat -> nat -> bool val minus_nat : nat -> nat -> nat val less_eq_nat : nat -> nat -> bool val times_nat : nat -> nat -> nat val modulo_nat : nat -> nat -> nat end = struct val ord_integer = {less_eq = (fn a => fn b => IntInf.<= (a, b)), less = (fn a => fn b => IntInf.< (a, b))} : IntInf.int Orderings.ord; datatype nat = Nat of IntInf.int; datatype num = One | Bit0 of num | Bit1 of num; fun integer_of_nat (Nat x) = x; fun plus_nat m n = Nat (IntInf.+ (integer_of_nat m, integer_of_nat n)); val one_nat : nat = Nat (1 : IntInf.int); fun suc n = plus_nat n one_nat; fun less_nat m n = IntInf.< (integer_of_nat m, integer_of_nat n); val zero_nat : nat = Nat (0 : IntInf.int); fun sgn_integer k = (if ((k : IntInf.int) = (0 : IntInf.int)) then (0 : IntInf.int) else (if IntInf.< (k, (0 : IntInf.int)) then (~1 : IntInf.int) else (1 : IntInf.int))); fun divmod_integer k l = (if ((k : IntInf.int) = (0 : IntInf.int)) then ((0 : IntInf.int), (0 : IntInf.int)) else (if ((l : IntInf.int) = (0 : IntInf.int)) then ((0 : IntInf.int), k) else (Product_Type.apsnd o (fn a => fn b => IntInf.* (a, b)) o sgn_integer) l (if (((sgn_integer k) : IntInf.int) = (sgn_integer l)) then IntInf.divMod (IntInf.abs k, IntInf.abs l) else let val (r, s) = IntInf.divMod (IntInf.abs k, IntInf.abs l); in (if ((s : IntInf.int) = (0 : IntInf.int)) then (IntInf.~ r, (0 : IntInf.int)) else (IntInf.- (IntInf.~ r, (1 : IntInf.int)), IntInf.- (IntInf.abs l, s))) end))); fun nat_of_integer k = Nat (Orderings.max ord_integer (0 : IntInf.int) k); fun equal_nat m n = (((integer_of_nat m) : IntInf.int) = (integer_of_nat n)); fun minus_nat m n = Nat (Orderings.max ord_integer (0 : IntInf.int) (IntInf.- (integer_of_nat m, integer_of_nat n))); fun less_eq_nat m n = IntInf.<= (integer_of_nat m, integer_of_nat n); fun times_nat m n = Nat (IntInf.* (integer_of_nat m, integer_of_nat n)); fun modulo_integer k l = Product_Type.snd (divmod_integer k l); fun modulo_nat m n = Nat (modulo_integer (integer_of_nat m) (integer_of_nat n)); end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Uint32a : sig val nat_of_uint32 : Word32.word -> Arith.nat end = struct fun nat_of_uint32 x = Arith.nat_of_integer (IntInf.fromLarge (Word32.toLargeInt x) : IntInf.int); end; (*struct Uint32a*) structure HashCode : sig type 'a hashable val hashcode : 'a hashable -> 'a -> Word32.word val def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat val bounded_hashcode_nat : 'a hashable -> Arith.nat -> 'a -> Arith.nat end = struct type 'a hashable = {hashcode : 'a -> Word32.word, def_hashmap_size : 'a HOL.itself -> Arith.nat}; val hashcode = #hashcode : 'a hashable -> 'a -> Word32.word; val def_hashmap_size = #def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat; fun nat_of_hashcode x = Uint32a.nat_of_uint32 x; fun bounded_hashcode_nat A_ n x = Arith.modulo_nat (nat_of_hashcode (hashcode A_ x)) n; end; (*struct HashCode*) structure Diff_Array : sig val array_get : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a val array_set : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType val new_array : 'a -> Arith.nat -> 'a FArray.IsabelleMapping.ArrayType val array_length : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat end = struct fun array_get a = FArray.IsabelleMapping.array_get a o Arith.integer_of_nat; fun array_set a = FArray.IsabelleMapping.array_set a o Arith.integer_of_nat; fun new_array v = FArray.IsabelleMapping.new_array v o Arith.integer_of_nat; fun array_length x = (Arith.nat_of_integer o FArray.IsabelleMapping.array_length) x; end; (*struct Diff_Array*) structure ArrayHashMap_Impl : sig type ('a, 'b) hashmap val ahm_empty : 'a HashCode.hashable -> unit -> ('a, 'b) hashmap val ahm_delete : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> ('a, 'b) hashmap val ahm_lookup : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> 'b option val ahm_update : 'a HOL.equal * 'a HashCode.hashable -> 'a -> 'b -> ('a, 'b) hashmap -> ('a, 'b) hashmap val ahm_iteratei : 'a HashCode.hashable -> ('a, 'b) hashmap -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('a, 'b) hashmap = HashMap of (('a * 'b) list) FArray.IsabelleMapping.ArrayType * Arith.nat; fun hm_grow A_ (HashMap (a, n)) = Arith.plus_nat (Arith.times_nat (Arith.nat_of_integer (2 : IntInf.int)) (Diff_Array.array_length a)) (Arith.nat_of_integer (3 : IntInf.int)); fun new_hashmap_with A_ size = HashMap (Diff_Array.new_array [] size, Arith.zero_nat); fun ahm_empty A_ = (fn _ => new_hashmap_with A_ (HashCode.def_hashmap_size A_ HOL.Type)); fun ahm_delete (A1_, A2_) k (HashMap (a, n)) = let val h = HashCode.bounded_hashcode_nat A2_ (Diff_Array.array_length a) k; val m = Diff_Array.array_get a h; val deleted = not (Option.is_none (Map.map_of A1_ m k)); in HashMap (Diff_Array.array_set a h (AList.delete A1_ k m), (if deleted then Arith.minus_nat n Arith.one_nat else n)) end; val load_factor : Arith.nat = Arith.nat_of_integer (75 : IntInf.int); fun ahm_filled A_ (HashMap (a, n)) = Arith.less_eq_nat (Arith.times_nat (Diff_Array.array_length a) load_factor) (Arith.times_nat n (Arith.nat_of_integer (100 : IntInf.int))); fun ahm_alpha_aux (A1_, A2_) a k = Map.map_of A1_ (Diff_Array.array_get a (HashCode.bounded_hashcode_nat A2_ (Diff_Array.array_length a) k)) k; fun ahm_alpha (A1_, A2_) (HashMap (a, uu)) = ahm_alpha_aux (A1_, A2_) a; fun ahm_lookup (A1_, A2_) k hm = ahm_alpha (A1_, A2_) hm k; fun idx_iteratei_aux_array_get sz i l c f sigma = (if Arith.equal_nat i Arith.zero_nat orelse not (c sigma) then sigma else idx_iteratei_aux_array_get sz (Arith.minus_nat i Arith.one_nat) l c f (f (Diff_Array.array_get l (Arith.minus_nat sz i)) sigma)); fun idx_iteratei_array_length_array_get l c f sigma = idx_iteratei_aux_array_get (Diff_Array.array_length l) (Diff_Array.array_length l) l c f sigma; fun ahm_iteratei_aux A_ a c f sigma = idx_iteratei_array_length_array_get a c (fn x => Foldi.foldli x c f) sigma; fun ahm_rehash_auxa A_ n kv a = let val h = HashCode.bounded_hashcode_nat A_ n (Product_Type.fst kv); in Diff_Array.array_set a h (kv :: Diff_Array.array_get a h) end; fun ahm_rehash_aux A_ a sz = ahm_iteratei_aux A_ a (fn _ => true) (ahm_rehash_auxa A_ sz) (Diff_Array.new_array [] sz); fun ahm_rehash A_ (HashMap (a, n)) sz = HashMap (ahm_rehash_aux A_ a sz, n); fun ahm_update_aux (A1_, A2_) (HashMap (a, n)) k v = let val h = HashCode.bounded_hashcode_nat A2_ (Diff_Array.array_length a) k; val m = Diff_Array.array_get a h; val insert = Option.is_none (Map.map_of A1_ m k); in HashMap (Diff_Array.array_set a h (AList.update A1_ k v m), (if insert then Arith.plus_nat n Arith.one_nat else n)) end; fun ahm_update (A1_, A2_) k v hm = let val hma = ahm_update_aux (A1_, A2_) hm k v; in (if ahm_filled A2_ hma then ahm_rehash A2_ hma (hm_grow A2_ hma) else hma) end; fun ahm_iteratei A_ (HashMap (a, n)) = ahm_iteratei_aux A_ a; end; (*struct ArrayHashMap_Impl*) structure ArrayHashMap : sig type ('b, 'a) hashmap val ahm_empty : 'a HashCode.hashable -> unit -> ('a, 'b) hashmap val ahm_delete : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> ('a, 'b) hashmap val ahm_lookup : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> 'b option val ahm_update : 'a HOL.equal * 'a HashCode.hashable -> 'a -> 'b -> ('a, 'b) hashmap -> ('a, 'b) hashmap val ahm_iteratei : 'a HashCode.hashable -> ('a, 'b) hashmap -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('b, 'a) hashmap = HashMap of ('b, 'a) ArrayHashMap_Impl.hashmap; fun ahm_empty_const A_ = HashMap (ArrayHashMap_Impl.ahm_empty A_ ()); fun ahm_empty A_ = (fn _ => ahm_empty_const A_); fun impl_of B_ (HashMap x) = x; fun ahm_delete (A1_, A2_) k hm = HashMap (ArrayHashMap_Impl.ahm_delete (A1_, A2_) k (impl_of A2_ hm)); fun ahm_lookup (A1_, A2_) k hm = ArrayHashMap_Impl.ahm_lookup (A1_, A2_) k (impl_of A2_ hm); fun ahm_update (A1_, A2_) k v hm = HashMap (ArrayHashMap_Impl.ahm_update (A1_, A2_) k v (impl_of A2_ hm)); fun ahm_iteratei A_ hm = ArrayHashMap_Impl.ahm_iteratei A_ (impl_of A_ hm); end; (*struct ArrayHashMap*) structure ArrayHashSet : sig val test_codegen : 'a HashCode.hashable -> 'b HOL.equal * 'b HashCode.hashable -> 'c HOL.equal * 'c HashCode.hashable -> 'd HOL.equal * 'd HashCode.hashable -> 'e HashCode.hashable -> 'f HOL.equal * 'f HashCode.hashable -> 'g HashCode.hashable -> 'h HashCode.hashable -> 'i HashCode.hashable -> 'j HashCode.hashable -> 'k HashCode.hashable -> 'l HashCode.hashable -> 'm HOL.equal * 'm HashCode.hashable -> 'n HOL.equal * 'n HashCode.hashable -> 'o HOL.equal * 'o HashCode.hashable -> 'p HOL.equal * 'p HashCode.hashable -> 'q HOL.equal * 'q HashCode.hashable -> 'r HOL.equal * 'r HashCode.hashable -> 's HOL.equal * 's HashCode.hashable -> 't HOL.equal * 't HashCode.hashable -> 'u HOL.equal * 'u HashCode.hashable -> 'v HashCode.hashable -> 'w HashCode.hashable -> 'x HOL.equal * 'x HashCode.hashable -> (unit -> ('a, unit) ArrayHashMap.hashmap) * (('b -> ('b, unit) ArrayHashMap.hashmap -> bool) * (('c -> ('c, unit) ArrayHashMap.hashmap -> ('c, unit) ArrayHashMap.hashmap) * (('d -> ('d, unit) ArrayHashMap.hashmap -> ('d, unit) ArrayHashMap.hashmap) * ((('e, unit) ArrayHashMap.hashmap -> ('e list -> bool) -> ('e -> 'e list -> 'e list) -> 'e list -> 'e list) * (('f -> ('f, unit) ArrayHashMap.hashmap) * ((('g, unit) ArrayHashMap.hashmap -> bool) * ((('h, unit) ArrayHashMap.hashmap -> bool) * ((('i, unit) ArrayHashMap.hashmap -> ('i -> bool) -> bool) * ((('j, unit) ArrayHashMap.hashmap -> ('j -> bool) -> bool) * ((('k, unit) ArrayHashMap.hashmap -> Arith.nat) * ((Arith.nat -> ('l, unit) ArrayHashMap.hashmap -> Arith.nat) * ((('m, unit) ArrayHashMap.hashmap -> ('m, unit) ArrayHashMap.hashmap -> ('m, unit) ArrayHashMap.hashmap) * ((('n, unit) ArrayHashMap.hashmap -> ('n, unit) ArrayHashMap.hashmap -> ('n, unit) ArrayHashMap.hashmap) * ((('o, unit) ArrayHashMap.hashmap -> ('o, unit) ArrayHashMap.hashmap -> ('o, unit) ArrayHashMap.hashmap) * ((('p -> bool) -> ('p, unit) ArrayHashMap.hashmap -> ('p, unit) ArrayHashMap.hashmap) * ((('q, unit) ArrayHashMap.hashmap -> ('q, unit) ArrayHashMap.hashmap -> ('q, unit) ArrayHashMap.hashmap) * ((('r, unit) ArrayHashMap.hashmap -> ('r, unit) ArrayHashMap.hashmap -> bool) * ((('s, unit) ArrayHashMap.hashmap -> ('s, unit) ArrayHashMap.hashmap -> bool) * ((('t, unit) ArrayHashMap.hashmap -> ('t, unit) ArrayHashMap.hashmap -> bool) * ((('u, unit) ArrayHashMap.hashmap -> ('u, unit) ArrayHashMap.hashmap -> 'u option) * ((('v, unit) ArrayHashMap.hashmap -> ('v -> bool) -> 'v option) * ((('w, unit) ArrayHashMap.hashmap -> 'w list) * ('x list -> ('x, unit) ArrayHashMap.hashmap))))))))))))))))))))))) end = struct fun iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s = (fn c => fn f => ArrayHashMap.ahm_iteratei A_ s c (f o Product_Type.fst)); fun g_sel_dflt_basic_ops_ahm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun memb_ahm_basic_ops (A1_, A2_) x s = not (Option.is_none (ArrayHashMap.ahm_lookup (A1_, A2_) x s)); fun g_disjoint_witness_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = g_sel_dflt_basic_ops_ahm_basic_ops A2_ s1 (fn x => memb_ahm_basic_ops (A1_, A2_) x s2); fun g_size_abort_dflt_basic_ops_ahm_basic_ops A_ m s = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.suc) Arith.zero_nat; fun ins_ahm_basic_ops (A1_, A2_) x s = ArrayHashMap.ahm_update (A1_, A2_) x () s; fun g_from_list_aux_dflt_basic_ops_ahm_basic_ops (A1_, A2_) accs (x :: l) = g_from_list_aux_dflt_basic_ops_ahm_basic_ops (A1_, A2_) (ins_ahm_basic_ops (A1_, A2_) x accs) l | g_from_list_aux_dflt_basic_ops_ahm_basic_ops (A1_, A2_) y [] = y; fun empty_ahm_basic_ops A_ = ArrayHashMap.ahm_empty A_; fun g_from_list_dflt_basic_ops_ahm_basic_ops (A1_, A2_) l = g_from_list_aux_dflt_basic_ops_ahm_basic_ops (A1_, A2_) (empty_ahm_basic_ops A2_ ()) l; fun ins_dj_ahm_basic_ops (A1_, A2_) x s = ArrayHashMap.ahm_update (A1_, A2_) x () s; fun g_union_dj_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A2_ s1 (fn _ => true) (ins_dj_ahm_basic_ops (A1_, A2_)) s2; fun g_ball_dflt_basic_ops_ahm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = g_ball_dflt_basic_ops_ahm_basic_ops A2_ s1 (fn x => not (memb_ahm_basic_ops (A1_, A2_) x s2)); fun g_to_list_dflt_basic_ops_ahm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_dflt_basic_ops_ahm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s (fn c => c) (fn _ => fn _ => false) true; fun g_subset_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = g_ball_dflt_basic_ops_ahm_basic_ops A2_ s1 (fn x => memb_ahm_basic_ops (A1_, A2_) x s2); fun g_filter_dflt_basic_ops_ahm_basic_ops (A1_, A2_) p s = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A2_ s (fn _ => true) (fn x => fn sigma => (if p x then ins_dj_ahm_basic_ops (A1_, A2_) x sigma else sigma)) (empty_ahm_basic_ops A2_ ()); fun g_union_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A2_ s1 (fn _ => true) (ins_ahm_basic_ops (A1_, A2_)) s2; fun g_isSng_dflt_basic_ops_ahm_basic_ops A_ s = Arith.equal_nat (iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s (fn sigma => Arith.less_nat sigma (Arith.nat_of_integer (2 : IntInf.int))) (fn _ => Arith.suc) Arith.zero_nat) Arith.one_nat; fun g_inter_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A2_ s1 (fn _ => true) (fn x => fn s => (if memb_ahm_basic_ops (A1_, A2_) x s2 then ins_dj_ahm_basic_ops (A1_, A2_) x s else s)) (empty_ahm_basic_ops A2_ ()); fun g_equal_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = g_subset_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 andalso g_subset_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s2 s1; fun g_size_dflt_basic_ops_ahm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s (fn _ => true) (fn _ => Arith.suc) Arith.zero_nat; fun delete_ahm_basic_ops (A1_, A2_) x s = ArrayHashMap.ahm_delete (A1_, A2_) x s; fun g_diff_dflt_basic_ops_ahm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A2_ s2 (fn _ => true) (delete_ahm_basic_ops (A1_, A2_)) s1; fun g_sng_dflt_basic_ops_ahm_basic_ops (A1_, A2_) x = ins_ahm_basic_ops (A1_, A2_) x (empty_ahm_basic_ops A2_ ()); fun g_bex_dflt_basic_ops_ahm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_ops_ahm_basic_ops A_ s not (fn x => fn _ => p x) false; fun test_codegen A_ (B1_, B2_) (C1_, C2_) (D1_, D2_) E_ (F1_, F2_) G_ H_ I_ J_ K_ L_ (M1_, M2_) (N1_, N2_) (O1_, O2_) (P1_, P2_) (Q1_, Q2_) (R1_, R2_) (S1_, S2_) (T1_, T2_) (U1_, U2_) V_ W_ (X1_, X2_) = (empty_ahm_basic_ops A_, (memb_ahm_basic_ops (B1_, B2_), (ins_ahm_basic_ops (C1_, C2_), (delete_ahm_basic_ops (D1_, D2_), ((fn s => fn c => fn f => ArrayHashMap.ahm_iteratei E_ s c (f o Product_Type.fst)), (g_sng_dflt_basic_ops_ahm_basic_ops (F1_, F2_), (g_isEmpty_dflt_basic_ops_ahm_basic_ops G_, (g_isSng_dflt_basic_ops_ahm_basic_ops H_, (g_ball_dflt_basic_ops_ahm_basic_ops I_, (g_bex_dflt_basic_ops_ahm_basic_ops J_, (g_size_dflt_basic_ops_ahm_basic_ops K_, (g_size_abort_dflt_basic_ops_ahm_basic_ops L_, (g_union_dflt_basic_ops_ahm_basic_ops (M1_, M2_), (g_union_dj_dflt_basic_ops_ahm_basic_ops (N1_, N2_), (g_diff_dflt_basic_ops_ahm_basic_ops (O1_, O2_), (g_filter_dflt_basic_ops_ahm_basic_ops (P1_, P2_), (g_inter_dflt_basic_ops_ahm_basic_ops (Q1_, Q2_), (g_subset_dflt_basic_ops_ahm_basic_ops (R1_, R2_), (g_equal_dflt_basic_ops_ahm_basic_ops (S1_, S2_), (g_disjoint_dflt_basic_ops_ahm_basic_ops (T1_, T2_), (g_disjoint_witness_dflt_basic_ops_ahm_basic_ops (U1_, U2_), (g_sel_dflt_basic_ops_ahm_basic_ops V_, (g_to_list_dflt_basic_ops_ahm_basic_ops W_, g_from_list_dflt_basic_ops_ahm_basic_ops (X1_, X2_)))))))))))))))))))))))); end; (*struct ArrayHashSet*) ### theory "Collections.ArrayHashSet" ### 2.173s elapsed time, 4.352s cpu time, 0.000s GC time Loading theory "Collections.TrieSetImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") structure HOL : sig type 'a equal val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure List : sig val rev : 'a list -> 'a list val null : 'a list -> bool end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun null [] = true | null (x :: xs) = false; end; (*struct List*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure AList : sig val update : 'a HOL.equal -> 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list val delete_aux : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list val update_with_aux : 'b HOL.equal -> 'a -> 'b -> ('a -> 'a) -> ('b * 'a) list -> ('b * 'a) list end = struct fun update A_ k v [] = [(k, v)] | update A_ k v (p :: ps) = (if HOL.eq A_ (Product_Type.fst p) k then (k, v) :: ps else p :: update A_ k v ps); fun delete_aux A_ k [] = [] | delete_aux A_ ka ((k, v) :: xs) = (if HOL.eq A_ ka k then xs else (k, v) :: delete_aux A_ ka xs); fun update_with_aux B_ v k f [] = [(k, f v)] | update_with_aux B_ v k f (p :: ps) = (if HOL.eq B_ (Product_Type.fst p) k then (k, f (Product_Type.snd p)) :: ps else p :: update_with_aux B_ v k f ps); end; (*struct AList*) structure Trie : sig datatype ('a, 'b) trie = Trie of 'b option * ('a * ('a, 'b) trie) list val empty_trie : ('a, 'b) trie val delete_trie : 'a HOL.equal -> 'a list -> ('a, 'b) trie -> ('a, 'b) trie val lookup_trie : 'a HOL.equal -> ('a, 'b) trie -> 'a list -> 'b option val update_trie : 'a HOL.equal -> 'a list -> 'b -> ('a, 'b) trie -> ('a, 'b) trie end = struct datatype ('a, 'b) trie = Trie of 'b option * ('a * ('a, 'b) trie) list; val empty_trie : ('a, 'b) trie = Trie (NONE, []); fun is_empty_trie (Trie (v, m)) = Option.is_none v andalso List.null m; fun delete_trie A_ [] (Trie (vo, ts)) = Trie (NONE, ts) | delete_trie A_ (k :: ks) (Trie (vo, ts)) = (case Map.map_of A_ ts k of NONE => Trie (vo, ts) | SOME t => let val ta = delete_trie A_ ks t; in (if is_empty_trie ta then Trie (vo, AList.delete_aux A_ k ts) else Trie (vo, AList.update A_ k ta ts)) end); fun lookup_trie A_ (Trie (v, m)) [] = v | lookup_trie A_ (Trie (v, m)) (k :: ks) = (case Map.map_of A_ m k of NONE => NONE | SOME st => lookup_trie A_ st ks); fun update_with_trie A_ [] f (Trie (v, ps)) = Trie (SOME (f v), ps) | update_with_trie A_ (k :: ks) f (Trie (v, ps)) = Trie (v, AList.update_with_aux A_ empty_trie k (update_with_trie A_ ks f) ps); fun update_trie A_ ks v = update_with_trie A_ ks (fn _ => v); end; (*struct Trie*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Trie_Impl : sig val iteratei : ('a, 'b) Trie.trie -> ('c -> bool) -> ('a list * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun iteratei_postfixed ks (Trie.Trie (vo, ts)) c f sigma = (if c sigma then Foldi.foldli ts c (fn (k, t) => iteratei_postfixed (k :: ks) t c f) (case vo of NONE => sigma | SOME v => f (ks, v) sigma) else sigma); fun iteratei t c f sigma = iteratei_postfixed [] t c f sigma; end; (*struct Trie_Impl*) structure Trie2 : sig type ('b, 'a) trie val empty : ('a, 'b) trie val delete : 'a HOL.equal -> 'a list -> ('a, 'b) trie -> ('a, 'b) trie val lookup : 'a HOL.equal -> ('a, 'b) trie -> 'a list -> 'b option val update : 'a HOL.equal -> 'a list -> 'b -> ('a, 'b) trie -> ('a, 'b) trie val iteratei : ('a, 'b) trie -> ('c -> bool) -> ('a list * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('b, 'a) trie = Trie of ('b, 'a) Trie.trie; val empty : ('a, 'b) trie = Trie Trie.empty_trie; fun impl_of (Trie x) = x; fun delete A_ ks t = Trie (Trie.delete_trie A_ ks (impl_of t)); fun lookup A_ t = Trie.lookup_trie A_ (impl_of t); fun update A_ ks v t = Trie (Trie.update_trie A_ ks v (impl_of t)); fun iteratei t c f = Trie_Impl.iteratei (impl_of t) c (fn (ks, v) => f (List.rev ks, v)); end; (*struct Trie2*) structure TrieSetImpl : sig val test_codegen : 'b HOL.equal -> 'c HOL.equal -> 'd HOL.equal -> 'f HOL.equal -> 'm HOL.equal -> 'n HOL.equal -> 'o HOL.equal -> 'p HOL.equal -> 'q HOL.equal -> 'r HOL.equal -> 's HOL.equal -> 't HOL.equal -> 'u HOL.equal -> 'x HOL.equal -> (unit -> ('a, unit) Trie2.trie) * (('b list -> ('b, unit) Trie2.trie -> bool) * (('c list -> ('c, unit) Trie2.trie -> ('c, unit) Trie2.trie) * (('d list -> ('d, unit) Trie2.trie -> ('d, unit) Trie2.trie) * ((('e, unit) Trie2.trie -> (('e list) list -> bool) -> ('e list -> ('e list) list -> ('e list) list) -> ('e list) list -> ('e list) list) * (('f list -> ('f, unit) Trie2.trie) * ((('g, unit) Trie2.trie -> bool) * ((('h, unit) Trie2.trie -> bool) * ((('i, unit) Trie2.trie -> ('i list -> bool) -> bool) * ((('j, unit) Trie2.trie -> ('j list -> bool) -> bool) * ((('k, unit) Trie2.trie -> Arith.nat) * ((Arith.nat -> ('l, unit) Trie2.trie -> Arith.nat) * ((('m, unit) Trie2.trie -> ('m, unit) Trie2.trie -> ('m, unit) Trie2.trie) * ((('n, unit) Trie2.trie -> ('n, unit) Trie2.trie -> ('n, unit) Trie2.trie) * ((('o, unit) Trie2.trie -> ('o, unit) Trie2.trie -> ('o, unit) Trie2.trie) * ((('p list -> bool) -> ('p, unit) Trie2.trie -> ('p, unit) Trie2.trie) * ((('q, unit) Trie2.trie -> ('q, unit) Trie2.trie -> ('q, unit) Trie2.trie) * ((('r, unit) Trie2.trie -> ('r, unit) Trie2.trie -> bool) * ((('s, unit) Trie2.trie -> ('s, unit) Trie2.trie -> bool) * ((('t, unit) Trie2.trie -> ('t, unit) Trie2.trie -> bool) * ((('u, unit) Trie2.trie -> ('u, unit) Trie2.trie -> ('u list) option) * ((('v, unit) Trie2.trie -> ('v list -> bool) -> ('v list) option) * ((('w, unit) Trie2.trie -> ('w list) list) * (('x list) list -> ('x, unit) Trie2.trie))))))))))))))))))))))) end = struct fun iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s = (fn c => fn f => Trie2.iteratei s c (f o Product_Type.fst)); fun g_sel_dflt_basic_ops_tm_basic_ops s p = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun memb_tm_basic_ops A_ x s = not (Option.is_none (Trie2.lookup A_ s x)); fun g_disjoint_witness_dflt_basic_ops_tm_basic_ops A_ s1 s2 = g_sel_dflt_basic_ops_tm_basic_ops s1 (fn x => memb_tm_basic_ops A_ x s2); fun g_size_abort_dflt_basic_ops_tm_basic_ops m s = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.Suc) Arith.Zero_nat; fun ins_tm_basic_ops A_ x s = Trie2.update A_ x () s; fun g_from_list_aux_dflt_basic_ops_tm_basic_ops A_ accs (x :: l) = g_from_list_aux_dflt_basic_ops_tm_basic_ops A_ (ins_tm_basic_ops A_ x accs) l | g_from_list_aux_dflt_basic_ops_tm_basic_ops A_ y [] = y; fun empty_tm_basic_ops x = (fn _ => Trie2.empty) x; fun g_from_list_dflt_basic_ops_tm_basic_ops A_ l = g_from_list_aux_dflt_basic_ops_tm_basic_ops A_ (empty_tm_basic_ops ()) l; fun ins_dj_tm_basic_ops A_ x s = Trie2.update A_ x () s; fun g_union_dj_dflt_basic_ops_tm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s1 (fn _ => true) (ins_dj_tm_basic_ops A_) s2; fun g_ball_dflt_basic_ops_tm_basic_ops s p = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_dflt_basic_ops_tm_basic_ops A_ s1 s2 = g_ball_dflt_basic_ops_tm_basic_ops s1 (fn x => not (memb_tm_basic_ops A_ x s2)); fun g_to_list_dflt_basic_ops_tm_basic_ops s = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_dflt_basic_ops_tm_basic_ops s = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s (fn c => c) (fn _ => fn _ => false) true; fun g_subset_dflt_basic_ops_tm_basic_ops A_ s1 s2 = g_ball_dflt_basic_ops_tm_basic_ops s1 (fn x => memb_tm_basic_ops A_ x s2); fun g_filter_dflt_basic_ops_tm_basic_ops A_ p s = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s (fn _ => true) (fn x => fn sigma => (if p x then ins_dj_tm_basic_ops A_ x sigma else sigma)) (empty_tm_basic_ops ()); fun g_union_dflt_basic_ops_tm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s1 (fn _ => true) (ins_tm_basic_ops A_) s2; fun g_isSng_dflt_basic_ops_tm_basic_ops s = Arith.equal_nat (iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s (fn sigma => Arith.less_nat sigma (Arith.nat_of_num (Arith.Bit0 Arith.One))) (fn _ => Arith.Suc) Arith.Zero_nat) Arith.one_nat; fun g_inter_dflt_basic_ops_tm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s1 (fn _ => true) (fn x => fn s => (if memb_tm_basic_ops A_ x s2 then ins_dj_tm_basic_ops A_ x s else s)) (empty_tm_basic_ops ()); fun g_equal_dflt_basic_ops_tm_basic_ops A_ s1 s2 = g_subset_dflt_basic_ops_tm_basic_ops A_ s1 s2 andalso g_subset_dflt_basic_ops_tm_basic_ops A_ s2 s1; fun g_size_dflt_basic_ops_tm_basic_ops s = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun delete_tm_basic_ops A_ x s = Trie2.delete A_ x s; fun g_diff_dflt_basic_ops_tm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s2 (fn _ => true) (delete_tm_basic_ops A_) s1; fun g_sng_dflt_basic_ops_tm_basic_ops A_ x = ins_tm_basic_ops A_ x (empty_tm_basic_ops ()); fun g_bex_dflt_basic_ops_tm_basic_ops s p = iteratei_bset_op_list_it_dflt_basic_ops_tm_basic_ops s not (fn x => fn _ => p x) false; fun test_codegen B_ C_ D_ F_ M_ N_ O_ P_ Q_ R_ S_ T_ U_ X_ = (empty_tm_basic_ops, (memb_tm_basic_ops B_, (ins_tm_basic_ops C_, (delete_tm_basic_ops D_, ((fn s => fn c => fn f => Trie2.iteratei s c (f o Product_Type.fst)), (g_sng_dflt_basic_ops_tm_basic_ops F_, (g_isEmpty_dflt_basic_ops_tm_basic_ops, (g_isSng_dflt_basic_ops_tm_basic_ops, (g_ball_dflt_basic_ops_tm_basic_ops, (g_bex_dflt_basic_ops_tm_basic_ops, (g_size_dflt_basic_ops_tm_basic_ops, (g_size_abort_dflt_basic_ops_tm_basic_ops, (g_union_dflt_basic_ops_tm_basic_ops M_, (g_union_dj_dflt_basic_ops_tm_basic_ops N_, (g_diff_dflt_basic_ops_tm_basic_ops O_, (g_filter_dflt_basic_ops_tm_basic_ops P_, (g_inter_dflt_basic_ops_tm_basic_ops Q_, (g_subset_dflt_basic_ops_tm_basic_ops R_, (g_equal_dflt_basic_ops_tm_basic_ops S_, (g_disjoint_dflt_basic_ops_tm_basic_ops T_, (g_disjoint_witness_dflt_basic_ops_tm_basic_ops U_, (g_sel_dflt_basic_ops_tm_basic_ops, (g_to_list_dflt_basic_ops_tm_basic_ops, g_from_list_dflt_basic_ops_tm_basic_ops X_))))))))))))))))))))))); end; (*struct TrieSetImpl*) ### theory "Collections.TrieSetImpl" ### 1.226s elapsed time, 2.456s cpu time, 0.000s GC time Loading theory "Collections.HashMap_Impl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.HashSet" via "Collections.HashMap") structure STArray = struct datatype 'a Cell = Invalid | Value of 'a array; exception AccessedOldVersion; type 'a array = 'a Cell Unsynchronized.ref; fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun array (size, v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun sub (Unsynchronized.ref Invalid, idx) = raise AccessedOldVersion | sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx); fun update (aref,idx,v) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( aref := Invalid; Array.update (a,idx,v); Unsynchronized.ref (Value a) ); fun length (Unsynchronized.ref Invalid) = raise AccessedOldVersion | length (Unsynchronized.ref (Value a)) = Array.length a fun grow (aref, i, x) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+i,x) in aref := Invalid; Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref Invalid) => raise AccessedOldVersion | (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( aref:=Invalid; Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); end; end; structure FArray = struct datatype 'a Cell = Value of 'a Array.array | Upd of (int*'a*'a Cell Unsynchronized.ref); type 'a array = 'a Cell Unsynchronized.ref; fun array (size,v) = Unsynchronized.ref (Value (Array.array (size,v))); fun tabulate (size, f) = Unsynchronized.ref (Value (Array.tabulate(size, f))); fun fromList l = Unsynchronized.ref (Value (Array.fromList l)); fun sub (Unsynchronized.ref (Value a), idx) = Array.sub (a,idx) | sub (Unsynchronized.ref (Upd (i,v,cr)),idx) = if i=idx then v else sub (cr,idx); fun length (Unsynchronized.ref (Value a)) = Array.length a | length (Unsynchronized.ref (Upd (i,v,cr))) = length cr; fun realize_aux (aref, v) = case aref of (Unsynchronized.ref (Value a)) => ( let val len = Array.length a; val a' = Array.array (len,v); in Array.copy {src=a, dst=a', di=0}; Unsynchronized.ref (Value a') end ) | (Unsynchronized.ref (Upd (i,v,cr))) => ( let val res=realize_aux (cr,v) in case res of (Unsynchronized.ref (Value a)) => (Array.update (a,i,v); res) end ); fun realize aref = case aref of (Unsynchronized.ref (Value _)) => aref | (Unsynchronized.ref (Upd (i,v,cr))) => realize_aux(aref,v); fun update (aref,idx,v) = case aref of (Unsynchronized.ref (Value a)) => ( let val nref=Unsynchronized.ref (Value a) in aref := Upd (idx,Array.sub(a,idx),nref); Array.update (a,idx,v); nref end ) | (Unsynchronized.ref (Upd _)) => let val ra = realize_aux(aref,v) in case ra of (Unsynchronized.ref (Value a)) => Array.update (a,idx,v); ra end ; fun grow (aref, inc, x) = case aref of (Unsynchronized.ref (Value a)) => ( let val len=Array.length a; val na = Array.array (len+inc,x) in Array.copy {src=a, dst=na, di=0}; Unsynchronized.ref (Value na) end ) | (Unsynchronized.ref (Upd _)) => ( grow (realize aref, inc, x) ); fun shrink (aref, sz) = case aref of (Unsynchronized.ref (Value a)) => ( if sz > Array.length a then raise Size else ( Unsynchronized.ref (Value (Array.tabulate (sz,fn i => Array.sub (a,i)))) ) ) | (Unsynchronized.ref (Upd _)) => ( shrink (realize aref,sz) ); structure IsabelleMapping = struct type 'a ArrayType = 'a array; fun new_array (a:'a) (n:IntInf.int) = array (IntInf.toInt n, a); fun array_length (a:'a ArrayType) = IntInf.fromInt (length a); fun array_get (a:'a ArrayType) (i:IntInf.int) = sub (a, IntInf.toInt i); fun array_set (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e); fun array_of_list (xs:'a list) = fromList xs; fun array_grow (a:'a ArrayType) (i:IntInf.int) (x:'a) = grow (a, IntInf.toInt i, x); fun array_shrink (a:'a ArrayType) (sz:IntInf.int) = shrink (a,IntInf.toInt sz); fun array_get_oo (d:'a) (a:'a ArrayType) (i:IntInf.int) = sub (a,IntInf.toInt i) handle Subscript => d fun array_set_oo (d:(unit->'a ArrayType)) (a:'a ArrayType) (i:IntInf.int) (e:'a) = update (a, IntInf.toInt i, e) handle Subscript => d () end; end; structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool val max : 'a ord -> 'a -> 'a -> 'a end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; fun max A_ a b = (if less_eq A_ a b then b else a); end; (*struct Orderings*) structure Arith : sig type nat val integer_of_nat : nat -> IntInf.int val less_eq_nat : nat -> nat -> bool val less_nat : nat -> nat -> bool val ord_nat : nat Orderings.ord datatype num = One | Bit0 of num | Bit1 of num val plus_nat : nat -> nat -> nat val one_nat : nat val suc : nat -> nat val zero_nat : nat val nat_of_integer : IntInf.int -> nat val equal_nat : nat -> nat -> bool val minus_nat : nat -> nat -> nat val times_nat : nat -> nat -> nat end = struct datatype nat = Nat of IntInf.int; fun integer_of_nat (Nat x) = x; fun less_eq_nat m n = IntInf.<= (integer_of_nat m, integer_of_nat n); fun less_nat m n = IntInf.< (integer_of_nat m, integer_of_nat n); val ord_nat = {less_eq = less_eq_nat, less = less_nat} : nat Orderings.ord; val ord_integer = {less_eq = (fn a => fn b => IntInf.<= (a, b)), less = (fn a => fn b => IntInf.< (a, b))} : IntInf.int Orderings.ord; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat m n = Nat (IntInf.+ (integer_of_nat m, integer_of_nat n)); val one_nat : nat = Nat (1 : IntInf.int); fun suc n = plus_nat n one_nat; val zero_nat : nat = Nat (0 : IntInf.int); fun nat_of_integer k = Nat (Orderings.max ord_integer (0 : IntInf.int) k); fun equal_nat m n = (((integer_of_nat m) : IntInf.int) = (integer_of_nat n)); fun minus_nat m n = Nat (Orderings.max ord_integer (0 : IntInf.int) (IntInf.- (integer_of_nat m, integer_of_nat n))); fun times_nat m n = Nat (IntInf.* (integer_of_nat m, integer_of_nat n)); end; (*struct Arith*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Diff_Array : sig val array_get : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a val array_set : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType val array_grow : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType val array_get_oo : 'a -> 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a val array_length : 'a FArray.IsabelleMapping.ArrayType -> Arith.nat val array_set_oo : (unit -> 'a FArray.IsabelleMapping.ArrayType) -> 'a FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a -> 'a FArray.IsabelleMapping.ArrayType end = struct fun array_get a = FArray.IsabelleMapping.array_get a o Arith.integer_of_nat; fun array_set a = FArray.IsabelleMapping.array_set a o Arith.integer_of_nat; fun array_grow a = FArray.IsabelleMapping.array_grow a o Arith.integer_of_nat; fun array_get_oo x a = FArray.IsabelleMapping.array_get_oo x a o Arith.integer_of_nat; fun array_length x = (Arith.nat_of_integer o FArray.IsabelleMapping.array_length) x; fun array_set_oo f a = FArray.IsabelleMapping.array_set_oo f a o Arith.integer_of_nat; end; (*struct Diff_Array*) structure ArrayMapImpl : sig val iam_empty : unit -> ('a option) FArray.IsabelleMapping.ArrayType val iam_delete : Arith.nat -> ('a option) FArray.IsabelleMapping.ArrayType -> ('a option) FArray.IsabelleMapping.ArrayType val iam_update : Arith.nat -> 'a -> ('a option) FArray.IsabelleMapping.ArrayType -> ('a option) FArray.IsabelleMapping.ArrayType val iam_alpha : ('a option) FArray.IsabelleMapping.ArrayType -> Arith.nat -> 'a option val iam_iterateoi : ('a option) FArray.IsabelleMapping.ArrayType -> ('b -> bool) -> (Arith.nat * 'a -> 'b -> 'b) -> 'b -> 'b val iam_update_dj : Arith.nat -> 'a -> ('a option) FArray.IsabelleMapping.ArrayType -> ('a option) FArray.IsabelleMapping.ArrayType val iam_rev_iterateoi : ('a option) FArray.IsabelleMapping.ArrayType -> ('b -> bool) -> (Arith.nat * 'a -> 'b -> 'b) -> 'b -> 'b end = struct fun iam_empty x = (fn _ => FArray.IsabelleMapping.array_of_list []) x; fun iam_delete k a = Diff_Array.array_set_oo (fn _ => a) a k NONE; fun iam_increment l idx = Orderings.max Arith.ord_nat (Arith.minus_nat (Arith.plus_nat idx Arith.one_nat) l) (Arith.plus_nat (Arith.times_nat (Arith.nat_of_integer (2 : IntInf.int)) l) (Arith.nat_of_integer (3 : IntInf.int))); fun iam_update k v a = Diff_Array.array_set_oo (fn _ => Diff_Array.array_set (Diff_Array.array_grow a (iam_increment (Diff_Array.array_length a) k) NONE) k (SOME v)) a k (SOME v); fun iam_alpha a i = Diff_Array.array_get_oo NONE a i; fun iam_iterateoi_aux i len a c f sigma = (if Arith.less_eq_nat len i orelse not (c sigma) then sigma else let val b = (case Diff_Array.array_get a i of NONE => sigma | SOME x => f (i, x) sigma); in iam_iterateoi_aux (Arith.plus_nat i Arith.one_nat) len a c f b end); fun iam_iterateoi a = iam_iterateoi_aux Arith.zero_nat (Diff_Array.array_length a) a; fun iam_update_dj x = iam_update x; fun iam_rev_iterateoi_aux v a c f sigma = (if Arith.equal_nat v Arith.zero_nat then sigma else (if c sigma then iam_rev_iterateoi_aux (Arith.minus_nat (Arith.suc (Arith.minus_nat v Arith.one_nat)) Arith.one_nat) a c f (case Diff_Array.array_get a (Arith.minus_nat (Arith.suc (Arith.minus_nat v Arith.one_nat)) Arith.one_nat) of NONE => sigma | SOME x => f (Arith.minus_nat (Arith.suc (Arith.minus_nat v Arith.one_nat)) Arith.one_nat, x) sigma) else sigma)); fun iam_rev_iterateoi a = iam_rev_iterateoi_aux (Diff_Array.array_length a) a; end; (*struct ArrayMapImpl*) structure Product_Type : sig val fst : 'a * 'b -> 'a end = struct fun fst (x1, x2) = x1; end; (*struct Product_Type*) structure ArraySetImpl : sig val test_codegen : (unit -> (unit option) FArray.IsabelleMapping.ArrayType) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat list -> bool) -> (Arith.nat -> Arith.nat list -> Arith.nat list) -> Arith.nat list -> Arith.nat list) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((Arith.nat -> bool) -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat list) * ((Arith.nat list -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat list -> bool) -> (Arith.nat -> Arith.nat list -> Arith.nat list) -> Arith.nat list -> Arith.nat list) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat list -> bool) -> (Arith.nat -> Arith.nat list -> Arith.nat list) -> Arith.nat list -> Arith.nat list) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat list) * ((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat list))))))))))))))))))))))))))))) end = struct fun iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s = (fn c => fn f => ArrayMapImpl.iam_rev_iterateoi s c (f o Product_Type.fst)); fun g_sel_dflt_basic_oops_iam_basic_ops s p = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun memb_iam_basic_ops x s = not (Option.is_none (ArrayMapImpl.iam_alpha s x)); fun g_disjoint_witness_dflt_basic_oops_iam_basic_ops s1 s2 = g_sel_dflt_basic_oops_iam_basic_ops s1 (fn x => memb_iam_basic_ops x s2); fun rev_iterateoi_bset_op_rev_list_it_dflt_basic_oops_iam_basic_ops s = (fn c => fn f => ArrayMapImpl.iam_rev_iterateoi s c (f o Product_Type.fst)); fun g_to_sorted_list_dflt_basic_oops_iam_basic_ops s = rev_iterateoi_bset_op_rev_list_it_dflt_basic_oops_iam_basic_ops s (fn _ => true) (fn a => fn b => a :: b) []; fun iterateoi_bset_op_ordered_list_it_dflt_basic_oops_iam_basic_ops s = (fn c => fn f => ArrayMapImpl.iam_iterateoi s c (f o Product_Type.fst)); fun g_to_rev_list_dflt_basic_oops_iam_basic_ops s = iterateoi_bset_op_ordered_list_it_dflt_basic_oops_iam_basic_ops s (fn _ => true) (fn a => fn b => a :: b) []; fun g_size_abort_dflt_basic_oops_iam_basic_ops m s = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.suc) Arith.zero_nat; fun ins_iam_basic_ops x s = ArrayMapImpl.iam_update x () s; fun g_from_list_aux_dflt_basic_oops_iam_basic_ops accs (x :: l) = g_from_list_aux_dflt_basic_oops_iam_basic_ops (ins_iam_basic_ops x accs) l | g_from_list_aux_dflt_basic_oops_iam_basic_ops y [] = y; fun empty_iam_basic_ops x = ArrayMapImpl.iam_empty x; fun g_from_list_dflt_basic_oops_iam_basic_ops l = g_from_list_aux_dflt_basic_oops_iam_basic_ops (empty_iam_basic_ops ()) l; fun ins_dj_iam_basic_ops x s = ArrayMapImpl.iam_update_dj x () s; fun g_union_dj_dflt_basic_oops_iam_basic_ops s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s1 (fn _ => true) ins_dj_iam_basic_ops s2; fun g_ball_dflt_basic_oops_iam_basic_ops s p = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_dflt_basic_oops_iam_basic_ops s1 s2 = g_ball_dflt_basic_oops_iam_basic_ops s1 (fn x => not (memb_iam_basic_ops x s2)); fun g_to_list_dflt_basic_oops_iam_basic_ops s = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_dflt_basic_oops_iam_basic_ops s = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s (fn c => c) (fn _ => fn _ => false) true; fun g_subset_dflt_basic_oops_iam_basic_ops s1 s2 = g_ball_dflt_basic_oops_iam_basic_ops s1 (fn x => memb_iam_basic_ops x s2); fun g_filter_dflt_basic_oops_iam_basic_ops p s = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s (fn _ => true) (fn x => fn sigma => (if p x then ins_dj_iam_basic_ops x sigma else sigma)) (empty_iam_basic_ops ()); fun g_union_dflt_basic_oops_iam_basic_ops s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s1 (fn _ => true) ins_iam_basic_ops s2; fun g_isSng_dflt_basic_oops_iam_basic_ops s = Arith.equal_nat (iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s (fn sigma => Arith.less_nat sigma (Arith.nat_of_integer (2 : IntInf.int))) (fn _ => Arith.suc) Arith.zero_nat) Arith.one_nat; fun g_inter_dflt_basic_oops_iam_basic_ops s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s1 (fn _ => true) (fn x => fn s => (if memb_iam_basic_ops x s2 then ins_dj_iam_basic_ops x s else s)) (empty_iam_basic_ops ()); fun g_equal_dflt_basic_oops_iam_basic_ops s1 s2 = g_subset_dflt_basic_oops_iam_basic_ops s1 s2 andalso g_subset_dflt_basic_oops_iam_basic_ops s2 s1; fun g_size_dflt_basic_oops_iam_basic_ops s = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s (fn _ => true) (fn _ => Arith.suc) Arith.zero_nat; fun delete_iam_basic_ops x s = ArrayMapImpl.iam_delete x s; fun g_diff_dflt_basic_oops_iam_basic_ops s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s2 (fn _ => true) delete_iam_basic_ops s1; fun g_sng_dflt_basic_oops_iam_basic_ops x = ins_iam_basic_ops x (empty_iam_basic_ops ()); fun g_min_dflt_basic_oops_iam_basic_ops s p = iterateoi_bset_op_ordered_list_it_dflt_basic_oops_iam_basic_ops s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_max_dflt_basic_oops_iam_basic_ops s p = rev_iterateoi_bset_op_rev_list_it_dflt_basic_oops_iam_basic_ops s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_dflt_basic_oops_iam_basic_ops s p = iteratei_bset_op_list_it_dflt_basic_oops_iam_basic_ops s not (fn x => fn _ => p x) false; val test_codegen : (unit -> (unit option) FArray.IsabelleMapping.ArrayType) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat list -> bool) -> (Arith.nat -> Arith.nat list -> Arith.nat list) -> Arith.nat list -> Arith.nat list) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * ((Arith.nat -> (unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((Arith.nat -> bool) -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> bool) * (((unit option) FArray.IsabelleMapping.ArrayType -> (unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat list) * ((Arith.nat list -> (unit option) FArray.IsabelleMapping.ArrayType) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat list -> bool) -> (Arith.nat -> Arith.nat list -> Arith.nat list) -> Arith.nat list -> Arith.nat list) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat list -> bool) -> (Arith.nat -> Arith.nat list -> Arith.nat list) -> Arith.nat list -> Arith.nat list) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> (Arith.nat -> bool) -> Arith.nat option) * (((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat list) * ((unit option) FArray.IsabelleMapping.ArrayType -> Arith.nat list))))))))))))))))))))))))))))) = (empty_iam_basic_ops, (memb_iam_basic_ops, (ins_iam_basic_ops, (delete_iam_basic_ops, ((fn s => fn c => fn f => ArrayMapImpl.iam_rev_iterateoi s c (f o Product_Type.fst)), (g_sng_dflt_basic_oops_iam_basic_ops, (g_isEmpty_dflt_basic_oops_iam_basic_ops, (g_isSng_dflt_basic_oops_iam_basic_ops, (g_ball_dflt_basic_oops_iam_basic_ops, (g_bex_dflt_basic_oops_iam_basic_ops, (g_size_dflt_basic_oops_iam_basic_ops, (g_size_abort_dflt_basic_oops_iam_basic_ops, (g_union_dflt_basic_oops_iam_basic_ops, (g_union_dj_dflt_basic_oops_iam_basic_ops, (g_diff_dflt_basic_oops_iam_basic_ops, (g_filter_dflt_basic_oops_iam_basic_ops, (g_inter_dflt_basic_oops_iam_basic_ops, (g_subset_dflt_basic_oops_iam_basic_ops, (g_equal_dflt_basic_oops_iam_basic_ops, (g_disjoint_dflt_basic_oops_iam_basic_ops, (g_disjoint_witness_dflt_basic_oops_iam_basic_ops, (g_sel_dflt_basic_oops_iam_basic_ops, (g_to_list_dflt_basic_oops_iam_basic_ops, (g_from_list_dflt_basic_oops_iam_basic_ops, ((fn s => fn c => fn f => ArrayMapImpl.iam_iterateoi s c (f o Product_Type.fst)), ((fn s => fn c => fn f => ArrayMapImpl.iam_rev_iterateoi s c (f o Product_Type.fst)), (g_min_dflt_basic_oops_iam_basic_ops, (g_max_dflt_basic_oops_iam_basic_ops, (g_to_sorted_list_dflt_basic_oops_iam_basic_ops, g_to_rev_list_dflt_basic_oops_iam_basic_ops))))))))))))))))))))))))))))); end; (*struct ArraySetImpl*) ### theory "Collections.ArraySetImpl" ### 1.861s elapsed time, 3.724s cpu time, 0.000s GC time Loading theory "Collections.RBTSetImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") ### Ignoring sort constraints in type variables(s): "'a" ### in type abbreviation "rs" ### theory "Collections.HashMap_Impl" ### 1.972s elapsed time, 3.876s cpu time, 0.664s GC time Loading theory "Collections.HashMap" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl" via "Collections.HashSet") structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; end; (*struct Orderings*) structure RBT_Impl : sig type color datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt val rbt_delete : 'a Orderings.ord -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_insert : 'a Orderings.ord -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_lookup : 'a Orderings.ord -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype color = R | B; datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt; fun paint c Empty = Empty | paint c (Branch (uu, l, k, v, r)) = Branch (c, l, k, v, r); fun balance (Branch (R, a, w, x, b)) s t (Branch (R, c, y, z, d)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z Empty = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (B, va, vb, vc, vd), w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Branch (B, ve, vf, vg, vh), w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Branch (B, ve, vf, vg, vh), w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance Empty w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, d)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, va, vb, vc, vd))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, ve, vf, vg, vh))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Branch (B, ve, vf, vg, vh))) | balance Empty s t Empty = Branch (B, Empty, s, t, Empty) | balance Empty s t (Branch (B, va, vb, vc, vd)) = Branch (B, Empty, s, t, Branch (B, va, vb, vc, vd)) | balance Empty s t (Branch (v, Empty, vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Empty)) | balance Empty s t (Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) | balance Empty s t (Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) | balance Empty s t (Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) | balance (Branch (B, va, vb, vc, vd)) s t Empty = Branch (B, Branch (B, va, vb, vc, vd), s, t, Empty) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (B, ve, vf, vg, vh)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (B, ve, vf, vg, vh)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (v, Empty, vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Empty), s, t, Empty) | balance (Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh))) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh)), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl))) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl)), s, t, Empty) | balance (Branch (v, Empty, vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl)), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp)), s, t, Branch (B, va, vb, vc, vd)); fun balance_left (Branch (R, a, k, x, b)) s y c = Branch (R, Branch (B, a, k, x, b), s, y, c) | balance_left Empty k x (Branch (B, a, s, y, b)) = balance Empty k x (Branch (R, a, s, y, b)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (B, a, s, y, b)) = balance (Branch (B, va, vb, vc, vd)) k x (Branch (R, a, s, y, b)) | balance_left Empty k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Empty, k, x, a), s, y, balance b t z (paint R c)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), k, x, a), s, y, balance b t z (paint R c)) | balance_left Empty k x Empty = Empty | balance_left Empty k x (Branch (R, Empty, vb, vc, vd)) = Empty | balance_left Empty k x (Branch (R, Branch (R, ve, vf, vg, vh), vb, vc, vd)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x Empty = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Empty, vf, vg, vh)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (R, vi, vj, vk, vl), vf, vg, vh)) = Empty; fun combine Empty x = x | combine (Branch (v, va, vb, vc, vd)) Empty = Branch (v, va, vb, vc, vd) | combine (Branch (R, a, k, x, b)) (Branch (R, c, s, y, d)) = (case combine b c of Empty => Branch (R, a, k, x, Branch (R, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (R, a, k, x, b2), t, z, Branch (R, c2, s, y, d)) | Branch (B, b2, t, z, c2) => Branch (R, a, k, x, Branch (R, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, a, k, x, b)) (Branch (B, c, s, y, d)) = (case combine b c of Empty => balance_left a k x (Branch (B, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (B, a, k, x, b2), t, z, Branch (B, c2, s, y, d)) | Branch (B, b2, t, z, c2) => balance_left a k x (Branch (B, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, va, vb, vc, vd)) (Branch (R, b, k, x, c)) = Branch (R, combine (Branch (B, va, vb, vc, vd)) b, k, x, c) | combine (Branch (R, a, k, x, b)) (Branch (B, va, vb, vc, vd)) = Branch (R, a, k, x, combine b (Branch (B, va, vb, vc, vd))); fun balance_right a k x (Branch (R, b, s, y, c)) = Branch (R, a, k, x, Branch (B, b, s, y, c)) | balance_right (Branch (B, a, k, x, b)) s y Empty = balance (Branch (R, a, k, x, b)) s y Empty | balance_right (Branch (B, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) = balance (Branch (R, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z Empty = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Empty)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z (Branch (B, va, vb, vc, vd)) = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Branch (B, va, vb, vc, vd))) | balance_right Empty k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Empty)) k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Branch (R, ve, vf, vg, vh))) k x Empty = Empty | balance_right Empty k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Empty)) k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Branch (R, vi, vj, vk, vl))) k x (Branch (B, va, vb, vc, vd)) = Empty; fun rbt_del A_ x Empty = Empty | rbt_del A_ x (Branch (c, a, y, s, b)) = (if Orderings.less A_ x y then rbt_del_from_left A_ x a y s b else (if Orderings.less A_ y x then rbt_del_from_right A_ x a y s b else combine a b)) and rbt_del_from_left A_ x (Branch (B, lt, z, v, rt)) y s b = balance_left (rbt_del A_ x (Branch (B, lt, z, v, rt))) y s b | rbt_del_from_left A_ x Empty y s b = Branch (R, rbt_del A_ x Empty, y, s, b) | rbt_del_from_left A_ x (Branch (R, va, vb, vc, vd)) y s b = Branch (R, rbt_del A_ x (Branch (R, va, vb, vc, vd)), y, s, b) and rbt_del_from_right A_ x a y s (Branch (B, lt, z, v, rt)) = balance_right a y s (rbt_del A_ x (Branch (B, lt, z, v, rt))) | rbt_del_from_right A_ x a y s Empty = Branch (R, a, y, s, rbt_del A_ x Empty) | rbt_del_from_right A_ x a y s (Branch (R, va, vb, vc, vd)) = Branch (R, a, y, s, rbt_del A_ x (Branch (R, va, vb, vc, vd))); fun rbt_ins A_ f k v Empty = Branch (R, Empty, k, v, Empty) | rbt_ins A_ f k v (Branch (B, l, x, y, r)) = (if Orderings.less A_ k x then balance (rbt_ins A_ f k v l) x y r else (if Orderings.less A_ x k then balance l x y (rbt_ins A_ f k v r) else Branch (B, l, x, f k y v, r))) | rbt_ins A_ f k v (Branch (R, l, x, y, r)) = (if Orderings.less A_ k x then Branch (R, rbt_ins A_ f k v l, x, y, r) else (if Orderings.less A_ x k then Branch (R, l, x, y, rbt_ins A_ f k v r) else Branch (R, l, x, f k y v, r))); fun rbt_delete A_ k t = paint B (rbt_del A_ k t); fun rbt_insert_with_key A_ f k v t = paint B (rbt_ins A_ f k v t); fun rbt_insert A_ = rbt_insert_with_key A_ (fn _ => fn _ => fn nv => nv); fun rbt_lookup A_ Empty k = NONE | rbt_lookup A_ (Branch (uu, l, x, y, r)) k = (if Orderings.less A_ k x then rbt_lookup A_ l k else (if Orderings.less A_ x k then rbt_lookup A_ r k else SOME y)); end; (*struct RBT_Impl*) structure RBT : sig type ('b, 'a) rbt val empty : 'a Orderings.linorder -> ('a, 'b) rbt val impl_of : 'b Orderings.linorder -> ('b, 'a) rbt -> ('b, 'a) RBT_Impl.rbt val delete : 'a Orderings.linorder -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val insert : 'a Orderings.linorder -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val lookup : 'a Orderings.linorder -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype ('b, 'a) rbt = RBT of ('b, 'a) RBT_Impl.rbt; fun empty A_ = RBT RBT_Impl.Empty; fun impl_of B_ (RBT x) = x; fun delete A_ xb xc = RBT (RBT_Impl.rbt_delete ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xb (impl_of A_ xc)); fun insert A_ xc xd xe = RBT (RBT_Impl.rbt_insert ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xc xd (impl_of A_ xe)); fun lookup A_ x = RBT_Impl.rbt_lookup ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) (impl_of A_ x); end; (*struct RBT*) structure Arith : sig datatype nat = Zero_nat | Suc of nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val nat_of_num : num -> nat val less_nat : nat -> nat -> bool val equal_nat : nat -> nat -> bool end = struct datatype nat = Zero_nat | Suc of nat; datatype num = One | Bit0 of num | Bit1 of num; fun plus_nat (Suc m) n = plus_nat m (Suc n) | plus_nat Zero_nat n = n; val one_nat : nat = Suc Zero_nat; fun nat_of_num (Bit1 n) = let val m = nat_of_num n; in Suc (plus_nat m m) end | nat_of_num (Bit0 n) = let val m = nat_of_num n; in plus_nat m m end | nat_of_num One = one_nat; fun less_nat m (Suc n) = less_eq_nat m n | less_nat n Zero_nat = false and less_eq_nat (Suc m) n = less_nat m n | less_eq_nat Zero_nat n = true; fun equal_nat Zero_nat (Suc x2) = false | equal_nat (Suc x2) Zero_nat = false | equal_nat (Suc x2) (Suc y2) = equal_nat x2 y2 | equal_nat Zero_nat Zero_nat = true; end; (*struct Arith*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure RBT_add : sig val rm_iterateoi : ('a, 'b) RBT_Impl.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c val rm_reverse_iterateoi : ('a, 'b) RBT_Impl.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun rm_iterateoi RBT_Impl.Empty c f sigma = sigma | rm_iterateoi (RBT_Impl.Branch (col, l, k, v, r)) c f sigma = (if c sigma then let val sigmaa = rm_iterateoi l c f sigma; in (if c sigmaa then rm_iterateoi r c f (f (k, v) sigmaa) else sigmaa) end else sigma); fun rm_reverse_iterateoi RBT_Impl.Empty c f sigma = sigma | rm_reverse_iterateoi (RBT_Impl.Branch (col, l, k, v, r)) c f sigma = (if c sigma then let val sigmaa = rm_reverse_iterateoi r c f sigma; in (if c sigmaa then rm_reverse_iterateoi l c f (f (k, v) sigmaa) else sigmaa) end else sigma); end; (*struct RBT_add*) structure Product_Type : sig val fst : 'a * 'b -> 'a end = struct fun fst (x1, x2) = x1; end; (*struct Product_Type*) structure RBTSetImpl : sig val test_codegen : 'a Orderings.linorder -> 'b Orderings.linorder -> 'c Orderings.linorder -> 'd Orderings.linorder -> 'e Orderings.linorder -> 'f Orderings.linorder -> 'g Orderings.linorder -> 'h Orderings.linorder -> 'i Orderings.linorder -> 'j Orderings.linorder -> 'k Orderings.linorder -> 'l Orderings.linorder -> 'm Orderings.linorder -> 'n Orderings.linorder -> 'o Orderings.linorder -> 'p Orderings.linorder -> 'q Orderings.linorder -> 'r Orderings.linorder -> 's Orderings.linorder -> 't Orderings.linorder -> 'u Orderings.linorder -> 'v Orderings.linorder -> 'w Orderings.linorder -> 'x Orderings.linorder -> 'y Orderings.linorder -> 'z Orderings.linorder -> 'aa Orderings.linorder -> 'ab Orderings.linorder -> 'ac Orderings.linorder -> 'ad Orderings.linorder -> (unit -> ('a, unit) RBT.rbt) * (('b -> ('b, unit) RBT.rbt -> bool) * (('c -> ('c, unit) RBT.rbt -> ('c, unit) RBT.rbt) * (('d -> ('d, unit) RBT.rbt -> ('d, unit) RBT.rbt) * ((('e, unit) RBT.rbt -> ('e list -> bool) -> ('e -> 'e list -> 'e list) -> 'e list -> 'e list) * (('f -> ('f, unit) RBT.rbt) * ((('g, unit) RBT.rbt -> bool) * ((('h, unit) RBT.rbt -> bool) * ((('i, unit) RBT.rbt -> ('i -> bool) -> bool) * ((('j, unit) RBT.rbt -> ('j -> bool) -> bool) * ((('k, unit) RBT.rbt -> Arith.nat) * ((Arith.nat -> ('l, unit) RBT.rbt -> Arith.nat) * ((('m, unit) RBT.rbt -> ('m, unit) RBT.rbt -> ('m, unit) RBT.rbt) * ((('n, unit) RBT.rbt -> ('n, unit) RBT.rbt -> ('n, unit) RBT.rbt) * ((('o, unit) RBT.rbt -> ('o, unit) RBT.rbt -> ('o, unit) RBT.rbt) * ((('p -> bool) -> ('p, unit) RBT.rbt -> ('p, unit) RBT.rbt) * ((('q, unit) RBT.rbt -> ('q, unit) RBT.rbt -> ('q, unit) RBT.rbt) * ((('r, unit) RBT.rbt -> ('r, unit) RBT.rbt -> bool) * ((('s, unit) RBT.rbt -> ('s, unit) RBT.rbt -> bool) * ((('t, unit) RBT.rbt -> ('t, unit) RBT.rbt -> bool) * ((('u, unit) RBT.rbt -> ('u, unit) RBT.rbt -> 'u option) * ((('v, unit) RBT.rbt -> ('v -> bool) -> 'v option) * ((('w, unit) RBT.rbt -> 'w list) * (('x list -> ('x, unit) RBT.rbt) * ((('y, unit) RBT.rbt -> ('y list -> bool) -> ('y -> 'y list -> 'y list) -> 'y list -> 'y list) * ((('z, unit) RBT.rbt -> ('z list -> bool) -> ('z -> 'z list -> 'z list) -> 'z list -> 'z list) * ((('aa, unit) RBT.rbt -> ('aa -> bool) -> 'aa option) * ((('ab, unit) RBT.rbt -> ('ab -> bool) -> 'ab option) * ((('ac, unit) RBT.rbt -> 'ac list) * (('ad, unit) RBT.rbt -> 'ad list))))))))))))))))))))))))))))) end = struct fun iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s = (fn c => fn f => RBT_add.rm_iterateoi (RBT.impl_of A_ s) c (f o Product_Type.fst)); fun g_sel_dflt_basic_oops_rm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun memb_rm_basic_ops A_ x s = not (Option.is_none (RBT.lookup A_ s x)); fun g_disjoint_witness_dflt_basic_oops_rm_basic_ops A_ s1 s2 = g_sel_dflt_basic_oops_rm_basic_ops A_ s1 (fn x => memb_rm_basic_ops A_ x s2); fun rev_iterateoi_bset_op_rev_list_it_dflt_basic_oops_rm_basic_ops A_ s = (fn c => fn f => RBT_add.rm_reverse_iterateoi (RBT.impl_of A_ s) c (f o Product_Type.fst)); fun g_to_sorted_list_dflt_basic_oops_rm_basic_ops A_ s = rev_iterateoi_bset_op_rev_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn _ => true) (fn a => fn b => a :: b) []; fun iterateoi_bset_op_ordered_list_it_dflt_basic_oops_rm_basic_ops A_ s = (fn c => fn f => RBT_add.rm_iterateoi (RBT.impl_of A_ s) c (f o Product_Type.fst)); fun g_to_rev_list_dflt_basic_oops_rm_basic_ops A_ s = iterateoi_bset_op_ordered_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn _ => true) (fn a => fn b => a :: b) []; fun g_size_abort_dflt_basic_oops_rm_basic_ops A_ m s = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.Suc) Arith.Zero_nat; fun ins_rm_basic_ops A_ x s = RBT.insert A_ x () s; fun g_from_list_aux_dflt_basic_oops_rm_basic_ops A_ accs (x :: l) = g_from_list_aux_dflt_basic_oops_rm_basic_ops A_ (ins_rm_basic_ops A_ x accs) l | g_from_list_aux_dflt_basic_oops_rm_basic_ops A_ y [] = y; fun empty_rm_basic_ops A_ = (fn _ => RBT.empty A_); fun g_from_list_dflt_basic_oops_rm_basic_ops A_ l = g_from_list_aux_dflt_basic_oops_rm_basic_ops A_ (empty_rm_basic_ops A_ ()) l; fun ins_dj_rm_basic_ops A_ x s = RBT.insert A_ x () s; fun g_union_dj_dflt_basic_oops_rm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s1 (fn _ => true) (ins_dj_rm_basic_ops A_) s2; fun g_ball_dflt_basic_oops_rm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_dflt_basic_oops_rm_basic_ops A_ s1 s2 = g_ball_dflt_basic_oops_rm_basic_ops A_ s1 (fn x => not (memb_rm_basic_ops A_ x s2)); fun g_to_list_dflt_basic_oops_rm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_dflt_basic_oops_rm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn c => c) (fn _ => fn _ => false) true; fun g_subset_dflt_basic_oops_rm_basic_ops A_ s1 s2 = g_ball_dflt_basic_oops_rm_basic_ops A_ s1 (fn x => memb_rm_basic_ops A_ x s2); fun g_filter_dflt_basic_oops_rm_basic_ops A_ p s = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn _ => true) (fn x => fn sigma => (if p x then ins_dj_rm_basic_ops A_ x sigma else sigma)) (empty_rm_basic_ops A_ ()); fun g_union_dflt_basic_oops_rm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s1 (fn _ => true) (ins_rm_basic_ops A_) s2; fun g_isSng_dflt_basic_oops_rm_basic_ops A_ s = Arith.equal_nat (iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn sigma => Arith.less_nat sigma (Arith.nat_of_num (Arith.Bit0 Arith.One))) (fn _ => Arith.Suc) Arith.Zero_nat) Arith.one_nat; fun g_inter_dflt_basic_oops_rm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s1 (fn _ => true) (fn x => fn s => (if memb_rm_basic_ops A_ x s2 then ins_dj_rm_basic_ops A_ x s else s)) (empty_rm_basic_ops A_ ()); fun g_equal_dflt_basic_oops_rm_basic_ops A_ s1 s2 = g_subset_dflt_basic_oops_rm_basic_ops A_ s1 s2 andalso g_subset_dflt_basic_oops_rm_basic_ops A_ s2 s1; fun g_size_dflt_basic_oops_rm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s (fn _ => true) (fn _ => Arith.Suc) Arith.Zero_nat; fun delete_rm_basic_ops A_ x s = RBT.delete A_ x s; fun g_diff_dflt_basic_oops_rm_basic_ops A_ s1 s2 = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s2 (fn _ => true) (delete_rm_basic_ops A_) s1; fun g_sng_dflt_basic_oops_rm_basic_ops A_ x = ins_rm_basic_ops A_ x (empty_rm_basic_ops A_ ()); fun g_min_dflt_basic_oops_rm_basic_ops A_ s p = iterateoi_bset_op_ordered_list_it_dflt_basic_oops_rm_basic_ops A_ s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_max_dflt_basic_oops_rm_basic_ops A_ s p = rev_iterateoi_bset_op_rev_list_it_dflt_basic_oops_rm_basic_ops A_ s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_dflt_basic_oops_rm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_oops_rm_basic_ops A_ s not (fn x => fn _ => p x) false; fun test_codegen A_ B_ C_ D_ E_ F_ G_ H_ I_ J_ K_ L_ M_ N_ O_ P_ Q_ R_ S_ T_ U_ V_ W_ X_ Y_ Z_ Aa_ Ab_ Ac_ Ad_ = (empty_rm_basic_ops A_, (memb_rm_basic_ops B_, (ins_rm_basic_ops C_, (delete_rm_basic_ops D_, ((fn s => fn c => fn f => RBT_add.rm_iterateoi (RBT.impl_of E_ s) c (f o Product_Type.fst)), (g_sng_dflt_basic_oops_rm_basic_ops F_, (g_isEmpty_dflt_basic_oops_rm_basic_ops G_, (g_isSng_dflt_basic_oops_rm_basic_ops H_, (g_ball_dflt_basic_oops_rm_basic_ops I_, (g_bex_dflt_basic_oops_rm_basic_ops J_, (g_size_dflt_basic_oops_rm_basic_ops K_, (g_size_abort_dflt_basic_oops_rm_basic_ops L_, (g_union_dflt_basic_oops_rm_basic_ops M_, (g_union_dj_dflt_basic_oops_rm_basic_ops N_, (g_diff_dflt_basic_oops_rm_basic_ops O_, (g_filter_dflt_basic_oops_rm_basic_ops P_, (g_inter_dflt_basic_oops_rm_basic_ops Q_, (g_subset_dflt_basic_oops_rm_basic_ops R_, (g_equal_dflt_basic_oops_rm_basic_ops S_, (g_disjoint_dflt_basic_oops_rm_basic_ops T_, (g_disjoint_witness_dflt_basic_oops_rm_basic_ops U_, (g_sel_dflt_basic_oops_rm_basic_ops V_, (g_to_list_dflt_basic_oops_rm_basic_ops W_, (g_from_list_dflt_basic_oops_rm_basic_ops X_, ((fn s => fn c => fn f => RBT_add.rm_iterateoi (RBT.impl_of Y_ s) c (f o Product_Type.fst)), ((fn s => fn c => fn f => RBT_add.rm_reverse_iterateoi (RBT.impl_of Z_ s) c (f o Product_Type.fst)), (g_min_dflt_basic_oops_rm_basic_ops Aa_, (g_max_dflt_basic_oops_rm_basic_ops Ab_, (g_to_sorted_list_dflt_basic_oops_rm_basic_ops Ac_, g_to_rev_list_dflt_basic_oops_rm_basic_ops Ad_))))))))))))))))))))))))))))); end; (*struct RBTSetImpl*) ### theory "Collections.RBTSetImpl" ### 2.562s elapsed time, 5.064s cpu time, 0.664s GC time (* Test that words can handle numbers between 0 and 31 *) val _ = if 5 <= Word.wordSize then () else raise (Fail ("wordSize less than 5")); structure Uint32 : sig val set_bit : Word32.word -> IntInf.int -> bool -> Word32.word val shiftl : Word32.word -> IntInf.int -> Word32.word val shiftr : Word32.word -> IntInf.int -> Word32.word val shiftr_signed : Word32.word -> IntInf.int -> Word32.word val test_bit : Word32.word -> IntInf.int -> bool end = struct fun set_bit x n b = let val mask = Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n)) in if b then Word32.orb (x, mask) else Word32.andb (x, Word32.notb mask) end fun shiftl x n = Word32.<< (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr x n = Word32.>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr_signed x n = Word32.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun test_bit x n = Word32.andb (x, Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n))) <> Word32.fromInt 0 end; (* struct Uint32 *) structure Bits_Integer : sig val set_bit : IntInf.int -> IntInf.int -> bool -> IntInf.int val shiftl : IntInf.int -> IntInf.int -> IntInf.int val shiftr : IntInf.int -> IntInf.int -> IntInf.int val test_bit : IntInf.int -> IntInf.int -> bool end = struct val maxWord = IntInf.pow (2, Word.wordSize); fun set_bit x n b = if n < maxWord then if b then IntInf.orb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) else IntInf.andb (x, IntInf.notb (IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n)))) else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); fun shiftl x n = if n < maxWord then IntInf.<< (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun shiftr x n = if n < maxWord then IntInf.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun test_bit x n = if n < maxWord then IntInf.andb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) <> 0 else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); end; (*struct Bits_Integer*) structure Fun : sig val id : 'a -> 'a end = struct fun id x = (fn xa => xa) x; end; (*struct Fun*) structure HOL : sig type 'a equal type 'a itself val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; datatype 'a itself = Type; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order val max : 'a ord -> 'a -> 'a -> 'a end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; fun max A_ a b = (if less_eq A_ a b then b else a); end; (*struct Orderings*) structure RBT_Impl : sig type color datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt val rbt_delete : 'a Orderings.ord -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_insert : 'a Orderings.ord -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_lookup : 'a Orderings.ord -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype color = R | B; datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt; fun paint c Empty = Empty | paint c (Branch (uu, l, k, v, r)) = Branch (c, l, k, v, r); fun balance (Branch (R, a, w, x, b)) s t (Branch (R, c, y, z, d)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z Empty = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (B, va, vb, vc, vd), w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Branch (B, ve, vf, vg, vh), w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Branch (B, ve, vf, vg, vh), w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance Empty w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, d)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, va, vb, vc, vd))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, ve, vf, vg, vh))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Branch (B, ve, vf, vg, vh))) | balance Empty s t Empty = Branch (B, Empty, s, t, Empty) | balance Empty s t (Branch (B, va, vb, vc, vd)) = Branch (B, Empty, s, t, Branch (B, va, vb, vc, vd)) | balance Empty s t (Branch (v, Empty, vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Empty)) | balance Empty s t (Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) | balance Empty s t (Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) | balance Empty s t (Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) | balance (Branch (B, va, vb, vc, vd)) s t Empty = Branch (B, Branch (B, va, vb, vc, vd), s, t, Empty) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (B, ve, vf, vg, vh)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (B, ve, vf, vg, vh)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (v, Empty, vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Empty), s, t, Empty) | balance (Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh))) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh)), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl))) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl)), s, t, Empty) | balance (Branch (v, Empty, vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl)), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp)), s, t, Branch (B, va, vb, vc, vd)); fun balance_left (Branch (R, a, k, x, b)) s y c = Branch (R, Branch (B, a, k, x, b), s, y, c) | balance_left Empty k x (Branch (B, a, s, y, b)) = balance Empty k x (Branch (R, a, s, y, b)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (B, a, s, y, b)) = balance (Branch (B, va, vb, vc, vd)) k x (Branch (R, a, s, y, b)) | balance_left Empty k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Empty, k, x, a), s, y, balance b t z (paint R c)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), k, x, a), s, y, balance b t z (paint R c)) | balance_left Empty k x Empty = Empty | balance_left Empty k x (Branch (R, Empty, vb, vc, vd)) = Empty | balance_left Empty k x (Branch (R, Branch (R, ve, vf, vg, vh), vb, vc, vd)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x Empty = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Empty, vf, vg, vh)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (R, vi, vj, vk, vl), vf, vg, vh)) = Empty; fun combine Empty x = x | combine (Branch (v, va, vb, vc, vd)) Empty = Branch (v, va, vb, vc, vd) | combine (Branch (R, a, k, x, b)) (Branch (R, c, s, y, d)) = (case combine b c of Empty => Branch (R, a, k, x, Branch (R, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (R, a, k, x, b2), t, z, Branch (R, c2, s, y, d)) | Branch (B, b2, t, z, c2) => Branch (R, a, k, x, Branch (R, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, a, k, x, b)) (Branch (B, c, s, y, d)) = (case combine b c of Empty => balance_left a k x (Branch (B, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (B, a, k, x, b2), t, z, Branch (B, c2, s, y, d)) | Branch (B, b2, t, z, c2) => balance_left a k x (Branch (B, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, va, vb, vc, vd)) (Branch (R, b, k, x, c)) = Branch (R, combine (Branch (B, va, vb, vc, vd)) b, k, x, c) | combine (Branch (R, a, k, x, b)) (Branch (B, va, vb, vc, vd)) = Branch (R, a, k, x, combine b (Branch (B, va, vb, vc, vd))); fun balance_right a k x (Branch (R, b, s, y, c)) = Branch (R, a, k, x, Branch (B, b, s, y, c)) | balance_right (Branch (B, a, k, x, b)) s y Empty = balance (Branch (R, a, k, x, b)) s y Empty | balance_right (Branch (B, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) = balance (Branch (R, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z Empty = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Empty)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z (Branch (B, va, vb, vc, vd)) = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Branch (B, va, vb, vc, vd))) | balance_right Empty k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Empty)) k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Branch (R, ve, vf, vg, vh))) k x Empty = Empty | balance_right Empty k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Empty)) k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Branch (R, vi, vj, vk, vl))) k x (Branch (B, va, vb, vc, vd)) = Empty; fun rbt_del A_ x Empty = Empty | rbt_del A_ x (Branch (c, a, y, s, b)) = (if Orderings.less A_ x y then rbt_del_from_left A_ x a y s b else (if Orderings.less A_ y x then rbt_del_from_right A_ x a y s b else combine a b)) and rbt_del_from_left A_ x (Branch (B, lt, z, v, rt)) y s b = balance_left (rbt_del A_ x (Branch (B, lt, z, v, rt))) y s b | rbt_del_from_left A_ x Empty y s b = Branch (R, rbt_del A_ x Empty, y, s, b) | rbt_del_from_left A_ x (Branch (R, va, vb, vc, vd)) y s b = Branch (R, rbt_del A_ x (Branch (R, va, vb, vc, vd)), y, s, b) and rbt_del_from_right A_ x a y s (Branch (B, lt, z, v, rt)) = balance_right a y s (rbt_del A_ x (Branch (B, lt, z, v, rt))) | rbt_del_from_right A_ x a y s Empty = Branch (R, a, y, s, rbt_del A_ x Empty) | rbt_del_from_right A_ x a y s (Branch (R, va, vb, vc, vd)) = Branch (R, a, y, s, rbt_del A_ x (Branch (R, va, vb, vc, vd))); fun rbt_ins A_ f k v Empty = Branch (R, Empty, k, v, Empty) | rbt_ins A_ f k v (Branch (B, l, x, y, r)) = (if Orderings.less A_ k x then balance (rbt_ins A_ f k v l) x y r else (if Orderings.less A_ x k then balance l x y (rbt_ins A_ f k v r) else Branch (B, l, x, f k y v, r))) | rbt_ins A_ f k v (Branch (R, l, x, y, r)) = (if Orderings.less A_ k x then Branch (R, rbt_ins A_ f k v l, x, y, r) else (if Orderings.less A_ x k then Branch (R, l, x, y, rbt_ins A_ f k v r) else Branch (R, l, x, f k y v, r))); fun rbt_delete A_ k t = paint B (rbt_del A_ k t); fun rbt_insert_with_key A_ f k v t = paint B (rbt_ins A_ f k v t); fun rbt_insert A_ = rbt_insert_with_key A_ (fn _ => fn _ => fn nv => nv); fun rbt_lookup A_ Empty k = NONE | rbt_lookup A_ (Branch (uu, l, x, y, r)) k = (if Orderings.less A_ k x then rbt_lookup A_ l k else (if Orderings.less A_ x k then rbt_lookup A_ r k else SOME y)); end; (*struct RBT_Impl*) structure RBT : sig type ('b, 'a) rbt val empty : 'a Orderings.linorder -> ('a, 'b) rbt val impl_of : 'b Orderings.linorder -> ('b, 'a) rbt -> ('b, 'a) RBT_Impl.rbt val delete : 'a Orderings.linorder -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val insert : 'a Orderings.linorder -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val lookup : 'a Orderings.linorder -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype ('b, 'a) rbt = RBT of ('b, 'a) RBT_Impl.rbt; fun empty A_ = RBT RBT_Impl.Empty; fun impl_of B_ (RBT x) = x; fun delete A_ xb xc = RBT (RBT_Impl.rbt_delete ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xb (impl_of A_ xc)); fun insert A_ xc xd xe = RBT (RBT_Impl.rbt_insert ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xc xd (impl_of A_ xe)); fun lookup A_ x = RBT_Impl.rbt_lookup ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) (impl_of A_ x); end; (*struct RBT*) structure List : sig val rev : 'a list -> 'a list val foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a end = struct fun fold f (x :: xs) s = fold f xs (f x s) | fold f [] s = s; fun rev xs = fold (fn a => fn b => a :: b) xs []; fun foldl f a [] = a | foldl f a (x :: xs) = foldl f (f a x) xs; end; (*struct List*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure AList : sig val delete_aux : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list val update_with_aux : 'b HOL.equal -> 'a -> 'b -> ('a -> 'a) -> ('b * 'a) list -> ('b * 'a) list end = struct fun delete_aux A_ k [] = [] | delete_aux A_ ka ((k, v) :: xs) = (if HOL.eq A_ ka k then xs else (k, v) :: delete_aux A_ ka xs); fun update_with_aux B_ v k f [] = [(k, f v)] | update_with_aux B_ v k f (p :: ps) = (if HOL.eq B_ (Product_Type.fst p) k then (k, f (Product_Type.snd p)) :: ps else p :: update_with_aux B_ v k f ps); end; (*struct AList*) structure Arith : sig type nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val suc : nat -> nat val less_nat : nat -> nat -> bool val zero_nat : nat val nat_of_integer : IntInf.int -> nat val equal_nat : nat -> nat -> bool end = struct val ord_integer = {less_eq = (fn a => fn b => IntInf.<= (a, b)), less = (fn a => fn b => IntInf.< (a, b))} : IntInf.int Orderings.ord; datatype nat = Nat of IntInf.int; datatype num = One | Bit0 of num | Bit1 of num; fun integer_of_nat (Nat x) = x; fun plus_nat m n = Nat (IntInf.+ (integer_of_nat m, integer_of_nat n)); val one_nat : nat = Nat (1 : IntInf.int); fun suc n = plus_nat n one_nat; fun less_nat m n = IntInf.< (integer_of_nat m, integer_of_nat n); val zero_nat : nat = Nat (0 : IntInf.int); fun nat_of_integer k = Nat (Orderings.max ord_integer (0 : IntInf.int) k); fun equal_nat m n = (((integer_of_nat m) : IntInf.int) = (integer_of_nat n)); end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Assoc_List : sig type ('b, 'a) assoc_list val empty : ('a, 'b) assoc_list val delete : 'a HOL.equal -> 'a -> ('a, 'b) assoc_list -> ('a, 'b) assoc_list val lookup : 'a HOL.equal -> ('a, 'b) assoc_list -> 'a -> 'b option val update : 'a HOL.equal -> 'a -> 'b -> ('a, 'b) assoc_list -> ('a, 'b) assoc_list val iteratei : ('a, 'b) assoc_list -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('b, 'a) assoc_list = Assoc_List of ('b * 'a) list; val empty : ('a, 'b) assoc_list = Assoc_List []; fun impl_of (Assoc_List x) = x; fun delete A_ k al = Assoc_List (AList.delete_aux A_ k (impl_of al)); fun lookup A_ al = Map.map_of A_ (impl_of al); fun update_with A_ v k f al = Assoc_List (AList.update_with_aux A_ v k f (impl_of al)); fun update A_ k v = update_with A_ v k (fn _ => v); fun iteratei al c f = Foldi.foldli (impl_of al) c f; end; (*struct Assoc_List*) structure ListMapImpl : sig val g_isEmpty_lm_basic_ops : ('a, 'b) Assoc_List.assoc_list -> bool val iteratei_map_op_list_it_lm_ops : ('a, 'b) Assoc_List.assoc_list -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun iteratei_bmap_op_list_it_lm_basic_ops s = Assoc_List.iteratei s; fun g_size_abort_lm_basic_ops b m = iteratei_bmap_op_list_it_lm_basic_ops m (fn s => Arith.less_nat s b) (fn _ => Arith.suc) Arith.zero_nat; fun g_isEmpty_lm_basic_ops m = Arith.equal_nat (g_size_abort_lm_basic_ops Arith.one_nat m) Arith.zero_nat; fun iteratei_map_op_list_it_lm_ops s = Assoc_List.iteratei s; end; (*struct ListMapImpl*) structure RBT_add : sig val rm_iterateoi : ('a, 'b) RBT_Impl.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun rm_iterateoi RBT_Impl.Empty c f sigma = sigma | rm_iterateoi (RBT_Impl.Branch (col, l, k, v, r)) c f sigma = (if c sigma then let val sigmaa = rm_iterateoi l c f sigma; in (if c sigmaa then rm_iterateoi r c f (f (k, v) sigmaa) else sigmaa) end else sigma); end; (*struct RBT_add*) structure RBTMapImpl : sig val iteratei_map_op_list_it_rm_ops : 'a Orderings.linorder -> ('a, 'b) RBT.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun iteratei_map_op_list_it_rm_ops A_ s = RBT_add.rm_iterateoi (RBT.impl_of A_ s); end; (*struct RBTMapImpl*) structure HashCode : sig type 'a hashable val hashcode : 'a hashable -> 'a -> Word32.word val def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat end = struct type 'a hashable = {hashcode : 'a -> Word32.word, def_hashmap_size : 'a HOL.itself -> Arith.nat}; val hashcode = #hashcode : 'a hashable -> 'a -> Word32.word; val def_hashmap_size = #def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat; end; (*struct HashCode*) structure Uint32a : sig val linorder_uint32 : Word32.word Orderings.linorder end = struct val ord_uint32 = {less_eq = (fn a => fn b => Word32.<= (a, b)), less = (fn a => fn b => Word32.< (a, b))} : Word32.word Orderings.ord; val preorder_uint32 = {ord_preorder = ord_uint32} : Word32.word Orderings.preorder; val order_uint32 = {preorder_order = preorder_uint32} : Word32.word Orderings.order; val linorder_uint32 = {order_linorder = order_uint32} : Word32.word Orderings.linorder; end; (*struct Uint32a*) structure HashMap_Impl : sig val empty : 'a HashCode.hashable -> unit -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt val delete : 'a HOL.equal * 'a HashCode.hashable -> 'a -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt val lookup : 'a HOL.equal * 'a HashCode.hashable -> 'a -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt -> 'b option val update : 'a HOL.equal * 'a HashCode.hashable -> 'a -> 'b -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt val iteratei : 'a Orderings.linorder -> ('a, ('b, 'c) Assoc_List.assoc_list) RBT.rbt -> ('d -> bool) -> ('b * 'c -> 'd -> 'd) -> 'd -> 'd end = struct fun empty A_ = (fn _ => RBT.empty Uint32a.linorder_uint32); fun rm_map_entry k f m = (case RBT.lookup Uint32a.linorder_uint32 m k of NONE => (case f NONE of NONE => m | SOME v => RBT.insert Uint32a.linorder_uint32 k v m) | SOME v => (case f (SOME v) of NONE => RBT.delete Uint32a.linorder_uint32 k m | SOME va => RBT.insert Uint32a.linorder_uint32 k va m)); fun delete (A1_, A2_) k m = rm_map_entry (HashCode.hashcode A2_ k) (fn a => (case a of NONE => NONE | SOME lm => let val lma = Assoc_List.delete A1_ k lm; in (if ListMapImpl.g_isEmpty_lm_basic_ops lma then NONE else SOME lma) end)) m; fun lookup (A1_, A2_) k m = (case RBT.lookup Uint32a.linorder_uint32 m (HashCode.hashcode A2_ k) of NONE => NONE | SOME lm => Assoc_List.lookup A1_ lm k); fun update (A1_, A2_) k v m = let val hc = HashCode.hashcode A2_ k; in (case RBT.lookup Uint32a.linorder_uint32 m hc of NONE => RBT.insert Uint32a.linorder_uint32 hc (Assoc_List.update A1_ k v Assoc_List.empty) m | SOME bm => RBT.insert Uint32a.linorder_uint32 hc (Assoc_List.update A1_ k v bm) m) end; fun iteratei A_ m c f sigma_0 = RBTMapImpl.iteratei_map_op_list_it_rm_ops A_ m c (fn (_, lm) => ListMapImpl.iteratei_map_op_list_it_lm_ops lm c f) sigma_0; end; (*struct HashMap_Impl*) structure HashMap : sig type ('b, 'a) hashmap val test_codegen : 'a HOL.equal * 'a HashCode.hashable -> 'c HOL.equal * 'c HashCode.hashable -> 'e HashCode.hashable -> 'g HashCode.hashable -> 'i HOL.equal * 'i HashCode.hashable -> 'k HashCode.hashable -> 'm HashCode.hashable -> 'o HashCode.hashable -> 'q HashCode.hashable -> 't HashCode.hashable -> 'w HashCode.hashable -> 'y HOL.equal * 'y HashCode.hashable -> 'aa HOL.equal * 'aa HashCode.hashable -> 'ac HashCode.hashable -> 'ae HashCode.hashable -> 'ag HashCode.hashable -> 'ai HOL.equal * 'ai HashCode.hashable -> 'ak HashCode.hashable -> 'am HOL.equal * 'am HashCode.hashable -> 'ao HOL.equal * 'ao HashCode.hashable -> 'aq HOL.equal * 'aq HashCode.hashable -> (('a, 'b) hashmap -> ('a, 'b) hashmap -> ('a, 'b) hashmap) * ((('c, 'd) hashmap -> ('c, 'd) hashmap -> ('c, 'd) hashmap) * ((('e, 'f) hashmap -> ('e * 'f -> bool) -> bool) * ((('g, 'h) hashmap -> ('g * 'h -> bool) -> bool) * (('i -> ('i, 'j) hashmap -> ('i, 'j) hashmap) * ((unit -> ('k, 'l) hashmap) * ((('m, 'n) hashmap -> bool) * ((('o, 'p) hashmap -> bool) * ((('q, 'r) hashmap -> ('q * 'r -> 's -> 's) -> 's -> 's) * ((('t, 'u) hashmap -> ('v -> bool) -> ('t * 'u -> 'v -> 'v) -> 'v -> 'v) * ((('w, 'x) hashmap -> (('w * 'x) list -> bool) -> ('w * 'x -> ('w * 'x) list -> ('w * 'x) list) -> ('w * 'x) list -> ('w * 'x) list) * (('y -> ('y, 'z) hashmap -> 'z option) * ((('aa * 'ab -> bool) -> ('aa, 'ab) hashmap -> ('aa, 'ab) hashmap) * ((('ac, 'ad) hashmap -> ('ac * 'ad -> bool) -> ('ac * 'ad) option) * ((('ae, 'af) hashmap -> Arith.nat) * ((Arith.nat -> ('ag, 'ah) hashmap -> Arith.nat) * (('ai -> 'aj -> ('ai, 'aj) hashmap) * ((('ak, 'al) hashmap -> ('ak * 'al) list) * ((('am * 'an) list -> ('am, 'an) hashmap) * (('ao -> 'ap -> ('ao, 'ap) hashmap -> ('ao, 'ap) hashmap) * ('aq -> 'ar -> ('aq, 'ar) hashmap -> ('aq, 'ar) hashmap)))))))))))))))))))) end = struct datatype ('b, 'a) hashmap = RBT_HM of (Word32.word, ('b, 'a) Assoc_List.assoc_list) RBT.rbt; fun hm_empty_const A_ = RBT_HM (HashMap_Impl.empty A_ ()); fun hm_empty A_ = (fn _ => hm_empty_const A_); fun impl_of_RBT_HM B_ (RBT_HM x) = x; fun hm_delete (A1_, A2_) k hm = RBT_HM (HashMap_Impl.delete (A1_, A2_) k (impl_of_RBT_HM A2_ hm)); fun hm_lookup (A1_, A2_) k hm = HashMap_Impl.lookup (A1_, A2_) k (impl_of_RBT_HM A2_ hm); fun hm_update (A1_, A2_) k v hm = RBT_HM (HashMap_Impl.update (A1_, A2_) k v (impl_of_RBT_HM A2_ hm)); fun hm_iteratei A_ hm = HashMap_Impl.iteratei Uint32a.linorder_uint32 (impl_of_RBT_HM A_ hm); fun iteratei_map_op_list_it_hm_ops A_ s = hm_iteratei A_ s; fun g_list_to_map_hm_basic_ops (A1_, A2_) l = List.foldl (fn m => fn (k, v) => hm_update (A1_, A2_) k v m) (hm_empty A2_ ()) (List.rev l); fun iteratei_bmap_op_list_it_hm_basic_ops A_ s = hm_iteratei A_ s; fun g_size_abort_hm_basic_ops A_ b m = iteratei_bmap_op_list_it_hm_basic_ops A_ m (fn s => Arith.less_nat s b) (fn _ => Arith.suc) Arith.zero_nat; fun g_restrict_hm_basic_ops (A1_, A2_) p m = iteratei_bmap_op_list_it_hm_basic_ops A2_ m (fn _ => true) (fn (k, v) => fn sigma => (if p (k, v) then hm_update (A1_, A2_) k v sigma else sigma)) (hm_empty A2_ ()); fun g_to_list_hm_basic_ops A_ m = iteratei_bmap_op_list_it_hm_basic_ops A_ m (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_hm_basic_ops A_ m = Arith.equal_nat (g_size_abort_hm_basic_ops A_ Arith.one_nat m) Arith.zero_nat; fun g_add_dj_hm_basic_ops (A1_, A2_) m1 m2 = iteratei_bmap_op_list_it_hm_basic_ops A2_ m2 (fn _ => true) (fn (a, b) => hm_update (A1_, A2_) a b) m1; fun g_isSng_hm_basic_ops A_ m = Arith.equal_nat (g_size_abort_hm_basic_ops A_ (Arith.nat_of_integer (2 : IntInf.int)) m) Arith.one_nat; fun g_size_hm_basic_ops A_ m = iteratei_bmap_op_list_it_hm_basic_ops A_ m (fn _ => true) (fn _ => Arith.suc) Arith.zero_nat; fun g_ball_hm_basic_ops A_ m p = iteratei_bmap_op_list_it_hm_basic_ops A_ m Fun.id (fn kv => fn _ => p kv) true; fun g_sng_hm_basic_ops (A1_, A2_) k v = hm_update (A1_, A2_) k v (hm_empty A2_ ()); fun g_sel_hm_basic_ops A_ m p = iteratei_bmap_op_list_it_hm_basic_ops A_ m Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun g_bex_hm_basic_ops A_ m p = iteratei_bmap_op_list_it_hm_basic_ops A_ m not (fn kv => fn _ => p kv) false; fun g_add_hm_basic_ops (A1_, A2_) m1 m2 = iteratei_bmap_op_list_it_hm_basic_ops A2_ m2 (fn _ => true) (fn (a, b) => hm_update (A1_, A2_) a b) m1; fun test_codegen (A1_, A2_) (C1_, C2_) E_ G_ (I1_, I2_) K_ M_ O_ Q_ T_ W_ (Y1_, Y2_) (Aa1_, Aa2_) Ac_ Ae_ Ag_ (Ai1_, Ai2_) Ak_ (Am1_, Am2_) (Ao1_, Ao2_) (Aq1_, Aq2_) = (g_add_hm_basic_ops (A1_, A2_), (g_add_dj_hm_basic_ops (C1_, C2_), (g_ball_hm_basic_ops E_, (g_bex_hm_basic_ops G_, (hm_delete (I1_, I2_), (hm_empty K_, (g_isEmpty_hm_basic_ops M_, (g_isSng_hm_basic_ops O_, ((fn m => iteratei_map_op_list_it_hm_ops Q_ m (fn _ => true)), (iteratei_map_op_list_it_hm_ops T_, (hm_iteratei W_, (hm_lookup (Y1_, Y2_), (g_restrict_hm_basic_ops (Aa1_, Aa2_), (g_sel_hm_basic_ops Ac_, (g_size_hm_basic_ops Ae_, (g_size_abort_hm_basic_ops Ag_, (g_sng_hm_basic_ops (Ai1_, Ai2_), (g_to_list_hm_basic_ops Ak_, (g_list_to_map_hm_basic_ops (Am1_, Am2_), (hm_update (Ao1_, Ao2_), hm_update (Aq1_, Aq2_))))))))))))))))))))); end; (*struct HashMap*) ### theory "Collections.HashMap" ### 1.699s elapsed time, 3.408s cpu time, 0.000s GC time Loading theory "Collections.HashSet" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl" via "Collections.SetStdImpl") Loading theory "Collections.MapStdImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") ### Ignoring sort constraints in type variables(s): "'a" ### in type abbreviation "hs" ### theory "Collections.MapStdImpl" ### 2.115s elapsed time, 4.172s cpu time, 0.616s GC time (* Test that words can handle numbers between 0 and 31 *) val _ = if 5 <= Word.wordSize then () else raise (Fail ("wordSize less than 5")); structure Uint32 : sig val set_bit : Word32.word -> IntInf.int -> bool -> Word32.word val shiftl : Word32.word -> IntInf.int -> Word32.word val shiftr : Word32.word -> IntInf.int -> Word32.word val shiftr_signed : Word32.word -> IntInf.int -> Word32.word val test_bit : Word32.word -> IntInf.int -> bool end = struct fun set_bit x n b = let val mask = Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n)) in if b then Word32.orb (x, mask) else Word32.andb (x, Word32.notb mask) end fun shiftl x n = Word32.<< (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr x n = Word32.>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun shiftr_signed x n = Word32.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) fun test_bit x n = Word32.andb (x, Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n))) <> Word32.fromInt 0 end; (* struct Uint32 *) structure Bits_Integer : sig val set_bit : IntInf.int -> IntInf.int -> bool -> IntInf.int val shiftl : IntInf.int -> IntInf.int -> IntInf.int val shiftr : IntInf.int -> IntInf.int -> IntInf.int val test_bit : IntInf.int -> IntInf.int -> bool end = struct val maxWord = IntInf.pow (2, Word.wordSize); fun set_bit x n b = if n < maxWord then if b then IntInf.orb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) else IntInf.andb (x, IntInf.notb (IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n)))) else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); fun shiftl x n = if n < maxWord then IntInf.<< (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun shiftr x n = if n < maxWord then IntInf.~>> (x, Word.fromLargeInt (IntInf.toLarge n)) else raise (Fail ("Shift operand too large: " ^ IntInf.toString n)); fun test_bit x n = if n < maxWord then IntInf.andb (x, IntInf.<< (1, Word.fromLargeInt (IntInf.toLarge n))) <> 0 else raise (Fail ("Bit index too large: " ^ IntInf.toString n)); end; (*struct Bits_Integer*) structure HOL : sig type 'a equal type 'a itself val eq : 'a equal -> 'a -> 'a -> bool end = struct type 'a equal = {equal : 'a -> 'a -> bool}; val equal = #equal : 'a equal -> 'a -> 'a -> bool; datatype 'a itself = Type; fun eq A_ a b = equal A_ a b; end; (*struct HOL*) structure Map : sig val map_of : 'a HOL.equal -> ('a * 'b) list -> 'a -> 'b option end = struct fun map_of A_ ((l, v) :: ps) k = (if HOL.eq A_ l k then SOME v else map_of A_ ps k) | map_of A_ [] k = NONE; end; (*struct Map*) structure Orderings : sig type 'a ord val less_eq : 'a ord -> 'a -> 'a -> bool val less : 'a ord -> 'a -> 'a -> bool type 'a preorder val ord_preorder : 'a preorder -> 'a ord type 'a order val preorder_order : 'a order -> 'a preorder type 'a linorder val order_linorder : 'a linorder -> 'a order val max : 'a ord -> 'a -> 'a -> 'a end = struct type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; val less = #less : 'a ord -> 'a -> 'a -> bool; type 'a preorder = {ord_preorder : 'a ord}; val ord_preorder = #ord_preorder : 'a preorder -> 'a ord; type 'a order = {preorder_order : 'a preorder}; val preorder_order = #preorder_order : 'a order -> 'a preorder; type 'a linorder = {order_linorder : 'a order}; val order_linorder = #order_linorder : 'a linorder -> 'a order; fun max A_ a b = (if less_eq A_ a b then b else a); end; (*struct Orderings*) structure RBT_Impl : sig type color datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt val rbt_delete : 'a Orderings.ord -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_insert : 'a Orderings.ord -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val rbt_lookup : 'a Orderings.ord -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype color = R | B; datatype ('a, 'b) rbt = Empty | Branch of color * ('a, 'b) rbt * 'a * 'b * ('a, 'b) rbt; fun paint c Empty = Empty | paint c (Branch (uu, l, k, v, r)) = Branch (c, l, k, v, r); fun balance (Branch (R, a, w, x, b)) s t (Branch (R, c, y, z, d)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z Empty = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (R, a, w, x, b), s, t, c)) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, a, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Branch (B, va, vb, vc, vd), w, x, Branch (R, b, s, t, c))) y z Empty = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (R, Empty, w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (R, Branch (B, ve, vf, vg, vh), w, x, Branch (R, b, s, t, c))) y z (Branch (B, va, vb, vc, vd)) = Branch (R, Branch (B, Branch (B, ve, vf, vg, vh), w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance Empty w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, d)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, b, s, t, Branch (R, c, y, z, d))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, d)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance Empty w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, va, vb, vc, vd))) = Branch (R, Branch (B, Empty, w, x, b), s, t, Branch (B, c, y, z, Branch (B, va, vb, vc, vd))) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Empty)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Empty)) | balance (Branch (B, va, vb, vc, vd)) w x (Branch (R, Branch (R, b, s, t, c), y, z, Branch (B, ve, vf, vg, vh))) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), w, x, b), s, t, Branch (B, c, y, z, Branch (B, ve, vf, vg, vh))) | balance Empty s t Empty = Branch (B, Empty, s, t, Empty) | balance Empty s t (Branch (B, va, vb, vc, vd)) = Branch (B, Empty, s, t, Branch (B, va, vb, vc, vd)) | balance Empty s t (Branch (v, Empty, vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Empty)) | balance Empty s t (Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vf, vg, vh), vb, vc, Empty)) | balance Empty s t (Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Empty, vb, vc, Branch (B, vf, vg, vh, vi))) | balance Empty s t (Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) = Branch (B, Empty, s, t, Branch (v, Branch (B, ve, vj, vk, vl), vb, vc, Branch (B, vf, vg, vh, vi))) | balance (Branch (B, va, vb, vc, vd)) s t Empty = Branch (B, Branch (B, va, vb, vc, vd), s, t, Empty) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (B, ve, vf, vg, vh)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (B, ve, vf, vg, vh)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vj, vk, vl), vf, vg, Empty)) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Empty, vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (B, va, vb, vc, vd)) s t (Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) = Branch (B, Branch (B, va, vb, vc, vd), s, t, Branch (v, Branch (B, vi, vn, vo, vp), vf, vg, Branch (B, vj, vk, vl, vm))) | balance (Branch (v, Empty, vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Empty), s, t, Empty) | balance (Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh))) s t Empty = Branch (B, Branch (v, Empty, vb, vc, Branch (B, ve, vf, vg, vh)), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty)) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Empty), s, t, Empty) | balance (Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl))) s t Empty = Branch (B, Branch (v, Branch (B, vf, vg, vh, vi), vb, vc, Branch (B, ve, vj, vk, vl)), s, t, Empty) | balance (Branch (v, Empty, vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Empty, vf, vg, Branch (B, vi, vj, vk, vl)), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty)) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Empty), s, t, Branch (B, va, vb, vc, vd)) | balance (Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp))) s t (Branch (B, va, vb, vc, vd)) = Branch (B, Branch (v, Branch (B, vj, vk, vl, vm), vf, vg, Branch (B, vi, vn, vo, vp)), s, t, Branch (B, va, vb, vc, vd)); fun balance_left (Branch (R, a, k, x, b)) s y c = Branch (R, Branch (B, a, k, x, b), s, y, c) | balance_left Empty k x (Branch (B, a, s, y, b)) = balance Empty k x (Branch (R, a, s, y, b)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (B, a, s, y, b)) = balance (Branch (B, va, vb, vc, vd)) k x (Branch (R, a, s, y, b)) | balance_left Empty k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Empty, k, x, a), s, y, balance b t z (paint R c)) | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (B, a, s, y, b), t, z, c)) = Branch (R, Branch (B, Branch (B, va, vb, vc, vd), k, x, a), s, y, balance b t z (paint R c)) | balance_left Empty k x Empty = Empty | balance_left Empty k x (Branch (R, Empty, vb, vc, vd)) = Empty | balance_left Empty k x (Branch (R, Branch (R, ve, vf, vg, vh), vb, vc, vd)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x Empty = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Empty, vf, vg, vh)) = Empty | balance_left (Branch (B, va, vb, vc, vd)) k x (Branch (R, Branch (R, vi, vj, vk, vl), vf, vg, vh)) = Empty; fun combine Empty x = x | combine (Branch (v, va, vb, vc, vd)) Empty = Branch (v, va, vb, vc, vd) | combine (Branch (R, a, k, x, b)) (Branch (R, c, s, y, d)) = (case combine b c of Empty => Branch (R, a, k, x, Branch (R, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (R, a, k, x, b2), t, z, Branch (R, c2, s, y, d)) | Branch (B, b2, t, z, c2) => Branch (R, a, k, x, Branch (R, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, a, k, x, b)) (Branch (B, c, s, y, d)) = (case combine b c of Empty => balance_left a k x (Branch (B, Empty, s, y, d)) | Branch (R, b2, t, z, c2) => Branch (R, Branch (B, a, k, x, b2), t, z, Branch (B, c2, s, y, d)) | Branch (B, b2, t, z, c2) => balance_left a k x (Branch (B, Branch (B, b2, t, z, c2), s, y, d))) | combine (Branch (B, va, vb, vc, vd)) (Branch (R, b, k, x, c)) = Branch (R, combine (Branch (B, va, vb, vc, vd)) b, k, x, c) | combine (Branch (R, a, k, x, b)) (Branch (B, va, vb, vc, vd)) = Branch (R, a, k, x, combine b (Branch (B, va, vb, vc, vd))); fun balance_right a k x (Branch (R, b, s, y, c)) = Branch (R, a, k, x, Branch (B, b, s, y, c)) | balance_right (Branch (B, a, k, x, b)) s y Empty = balance (Branch (R, a, k, x, b)) s y Empty | balance_right (Branch (B, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) = balance (Branch (R, a, k, x, b)) s y (Branch (B, va, vb, vc, vd)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z Empty = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Empty)) | balance_right (Branch (R, a, k, x, Branch (B, b, s, y, c))) t z (Branch (B, va, vb, vc, vd)) = Branch (R, balance (paint R a) k x b, s, y, Branch (B, c, t, z, Branch (B, va, vb, vc, vd))) | balance_right Empty k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Empty)) k x Empty = Empty | balance_right (Branch (R, va, vb, vc, Branch (R, ve, vf, vg, vh))) k x Empty = Empty | balance_right Empty k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Empty)) k x (Branch (B, va, vb, vc, vd)) = Empty | balance_right (Branch (R, ve, vf, vg, Branch (R, vi, vj, vk, vl))) k x (Branch (B, va, vb, vc, vd)) = Empty; fun rbt_del A_ x Empty = Empty | rbt_del A_ x (Branch (c, a, y, s, b)) = (if Orderings.less A_ x y then rbt_del_from_left A_ x a y s b else (if Orderings.less A_ y x then rbt_del_from_right A_ x a y s b else combine a b)) and rbt_del_from_left A_ x (Branch (B, lt, z, v, rt)) y s b = balance_left (rbt_del A_ x (Branch (B, lt, z, v, rt))) y s b | rbt_del_from_left A_ x Empty y s b = Branch (R, rbt_del A_ x Empty, y, s, b) | rbt_del_from_left A_ x (Branch (R, va, vb, vc, vd)) y s b = Branch (R, rbt_del A_ x (Branch (R, va, vb, vc, vd)), y, s, b) and rbt_del_from_right A_ x a y s (Branch (B, lt, z, v, rt)) = balance_right a y s (rbt_del A_ x (Branch (B, lt, z, v, rt))) | rbt_del_from_right A_ x a y s Empty = Branch (R, a, y, s, rbt_del A_ x Empty) | rbt_del_from_right A_ x a y s (Branch (R, va, vb, vc, vd)) = Branch (R, a, y, s, rbt_del A_ x (Branch (R, va, vb, vc, vd))); fun rbt_ins A_ f k v Empty = Branch (R, Empty, k, v, Empty) | rbt_ins A_ f k v (Branch (B, l, x, y, r)) = (if Orderings.less A_ k x then balance (rbt_ins A_ f k v l) x y r else (if Orderings.less A_ x k then balance l x y (rbt_ins A_ f k v r) else Branch (B, l, x, f k y v, r))) | rbt_ins A_ f k v (Branch (R, l, x, y, r)) = (if Orderings.less A_ k x then Branch (R, rbt_ins A_ f k v l, x, y, r) else (if Orderings.less A_ x k then Branch (R, l, x, y, rbt_ins A_ f k v r) else Branch (R, l, x, f k y v, r))); fun rbt_delete A_ k t = paint B (rbt_del A_ k t); fun rbt_insert_with_key A_ f k v t = paint B (rbt_ins A_ f k v t); fun rbt_insert A_ = rbt_insert_with_key A_ (fn _ => fn _ => fn nv => nv); fun rbt_lookup A_ Empty k = NONE | rbt_lookup A_ (Branch (uu, l, x, y, r)) k = (if Orderings.less A_ k x then rbt_lookup A_ l k else (if Orderings.less A_ x k then rbt_lookup A_ r k else SOME y)); end; (*struct RBT_Impl*) structure RBT : sig type ('b, 'a) rbt val empty : 'a Orderings.linorder -> ('a, 'b) rbt val impl_of : 'b Orderings.linorder -> ('b, 'a) rbt -> ('b, 'a) RBT_Impl.rbt val delete : 'a Orderings.linorder -> 'a -> ('a, 'b) rbt -> ('a, 'b) rbt val insert : 'a Orderings.linorder -> 'a -> 'b -> ('a, 'b) rbt -> ('a, 'b) rbt val lookup : 'a Orderings.linorder -> ('a, 'b) rbt -> 'a -> 'b option end = struct datatype ('b, 'a) rbt = RBT of ('b, 'a) RBT_Impl.rbt; fun empty A_ = RBT RBT_Impl.Empty; fun impl_of B_ (RBT x) = x; fun delete A_ xb xc = RBT (RBT_Impl.rbt_delete ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xb (impl_of A_ xc)); fun insert A_ xc xd xe = RBT (RBT_Impl.rbt_insert ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) xc xd (impl_of A_ xe)); fun lookup A_ x = RBT_Impl.rbt_lookup ((Orderings.ord_preorder o Orderings.preorder_order o Orderings.order_linorder) A_) (impl_of A_ x); end; (*struct RBT*) structure Product_Type : sig val fst : 'a * 'b -> 'a val snd : 'a * 'b -> 'b end = struct fun fst (x1, x2) = x1; fun snd (x1, x2) = x2; end; (*struct Product_Type*) structure AList : sig val delete_aux : 'a HOL.equal -> 'a -> ('a * 'b) list -> ('a * 'b) list val update_with_aux : 'b HOL.equal -> 'a -> 'b -> ('a -> 'a) -> ('b * 'a) list -> ('b * 'a) list end = struct fun delete_aux A_ k [] = [] | delete_aux A_ ka ((k, v) :: xs) = (if HOL.eq A_ ka k then xs else (k, v) :: delete_aux A_ ka xs); fun update_with_aux B_ v k f [] = [(k, f v)] | update_with_aux B_ v k f (p :: ps) = (if HOL.eq B_ (Product_Type.fst p) k then (k, f (Product_Type.snd p)) :: ps else p :: update_with_aux B_ v k f ps); end; (*struct AList*) structure Arith : sig type nat datatype num = One | Bit0 of num | Bit1 of num val one_nat : nat val suc : nat -> nat val less_nat : nat -> nat -> bool val zero_nat : nat val nat_of_integer : IntInf.int -> nat val equal_nat : nat -> nat -> bool end = struct val ord_integer = {less_eq = (fn a => fn b => IntInf.<= (a, b)), less = (fn a => fn b => IntInf.< (a, b))} : IntInf.int Orderings.ord; datatype nat = Nat of IntInf.int; datatype num = One | Bit0 of num | Bit1 of num; fun integer_of_nat (Nat x) = x; fun plus_nat m n = Nat (IntInf.+ (integer_of_nat m, integer_of_nat n)); val one_nat : nat = Nat (1 : IntInf.int); fun suc n = plus_nat n one_nat; fun less_nat m n = IntInf.< (integer_of_nat m, integer_of_nat n); val zero_nat : nat = Nat (0 : IntInf.int); fun nat_of_integer k = Nat (Orderings.max ord_integer (0 : IntInf.int) k); fun equal_nat m n = (((integer_of_nat m) : IntInf.int) = (integer_of_nat n)); end; (*struct Arith*) structure Foldi : sig val foldli : 'a list -> ('b -> bool) -> ('a -> 'b -> 'b) -> 'b -> 'b end = struct fun foldli [] c f sigma = sigma | foldli (x :: xs) c f sigma = (if c sigma then foldli xs c f (f x sigma) else sigma); end; (*struct Foldi*) structure Option : sig val is_none : 'a option -> bool end = struct fun is_none (SOME x) = false | is_none NONE = true; end; (*struct Option*) structure Assoc_List : sig type ('b, 'a) assoc_list val empty : ('a, 'b) assoc_list val delete : 'a HOL.equal -> 'a -> ('a, 'b) assoc_list -> ('a, 'b) assoc_list val lookup : 'a HOL.equal -> ('a, 'b) assoc_list -> 'a -> 'b option val update : 'a HOL.equal -> 'a -> 'b -> ('a, 'b) assoc_list -> ('a, 'b) assoc_list val iteratei : ('a, 'b) assoc_list -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('b, 'a) assoc_list = Assoc_List of ('b * 'a) list; val empty : ('a, 'b) assoc_list = Assoc_List []; fun impl_of (Assoc_List x) = x; fun delete A_ k al = Assoc_List (AList.delete_aux A_ k (impl_of al)); fun lookup A_ al = Map.map_of A_ (impl_of al); fun update_with A_ v k f al = Assoc_List (AList.update_with_aux A_ v k f (impl_of al)); fun update A_ k v = update_with A_ v k (fn _ => v); fun iteratei al c f = Foldi.foldli (impl_of al) c f; end; (*struct Assoc_List*) structure ListMapImpl : sig val g_isEmpty_lm_basic_ops : ('a, 'b) Assoc_List.assoc_list -> bool val iteratei_map_op_list_it_lm_ops : ('a, 'b) Assoc_List.assoc_list -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun iteratei_bmap_op_list_it_lm_basic_ops s = Assoc_List.iteratei s; fun g_size_abort_lm_basic_ops b m = iteratei_bmap_op_list_it_lm_basic_ops m (fn s => Arith.less_nat s b) (fn _ => Arith.suc) Arith.zero_nat; fun g_isEmpty_lm_basic_ops m = Arith.equal_nat (g_size_abort_lm_basic_ops Arith.one_nat m) Arith.zero_nat; fun iteratei_map_op_list_it_lm_ops s = Assoc_List.iteratei s; end; (*struct ListMapImpl*) structure RBT_add : sig val rm_iterateoi : ('a, 'b) RBT_Impl.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun rm_iterateoi RBT_Impl.Empty c f sigma = sigma | rm_iterateoi (RBT_Impl.Branch (col, l, k, v, r)) c f sigma = (if c sigma then let val sigmaa = rm_iterateoi l c f sigma; in (if c sigmaa then rm_iterateoi r c f (f (k, v) sigmaa) else sigmaa) end else sigma); end; (*struct RBT_add*) structure RBTMapImpl : sig val iteratei_map_op_list_it_rm_ops : 'a Orderings.linorder -> ('a, 'b) RBT.rbt -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct fun iteratei_map_op_list_it_rm_ops A_ s = RBT_add.rm_iterateoi (RBT.impl_of A_ s); end; (*struct RBTMapImpl*) structure HashCode : sig type 'a hashable val hashcode : 'a hashable -> 'a -> Word32.word val def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat end = struct type 'a hashable = {hashcode : 'a -> Word32.word, def_hashmap_size : 'a HOL.itself -> Arith.nat}; val hashcode = #hashcode : 'a hashable -> 'a -> Word32.word; val def_hashmap_size = #def_hashmap_size : 'a hashable -> 'a HOL.itself -> Arith.nat; end; (*struct HashCode*) structure Uint32a : sig val linorder_uint32 : Word32.word Orderings.linorder end = struct val ord_uint32 = {less_eq = (fn a => fn b => Word32.<= (a, b)), less = (fn a => fn b => Word32.< (a, b))} : Word32.word Orderings.ord; val preorder_uint32 = {ord_preorder = ord_uint32} : Word32.word Orderings.preorder; val order_uint32 = {preorder_order = preorder_uint32} : Word32.word Orderings.order; val linorder_uint32 = {order_linorder = order_uint32} : Word32.word Orderings.linorder; end; (*struct Uint32a*) structure HashMap_Impl : sig val empty : 'a HashCode.hashable -> unit -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt val delete : 'a HOL.equal * 'a HashCode.hashable -> 'a -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt val lookup : 'a HOL.equal * 'a HashCode.hashable -> 'a -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt -> 'b option val update : 'a HOL.equal * 'a HashCode.hashable -> 'a -> 'b -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt -> (Word32.word, ('a, 'b) Assoc_List.assoc_list) RBT.rbt val iteratei : 'a Orderings.linorder -> ('a, ('b, 'c) Assoc_List.assoc_list) RBT.rbt -> ('d -> bool) -> ('b * 'c -> 'd -> 'd) -> 'd -> 'd end = struct fun empty A_ = (fn _ => RBT.empty Uint32a.linorder_uint32); fun rm_map_entry k f m = (case RBT.lookup Uint32a.linorder_uint32 m k of NONE => (case f NONE of NONE => m | SOME v => RBT.insert Uint32a.linorder_uint32 k v m) | SOME v => (case f (SOME v) of NONE => RBT.delete Uint32a.linorder_uint32 k m | SOME va => RBT.insert Uint32a.linorder_uint32 k va m)); fun delete (A1_, A2_) k m = rm_map_entry (HashCode.hashcode A2_ k) (fn a => (case a of NONE => NONE | SOME lm => let val lma = Assoc_List.delete A1_ k lm; in (if ListMapImpl.g_isEmpty_lm_basic_ops lma then NONE else SOME lma) end)) m; fun lookup (A1_, A2_) k m = (case RBT.lookup Uint32a.linorder_uint32 m (HashCode.hashcode A2_ k) of NONE => NONE | SOME lm => Assoc_List.lookup A1_ lm k); fun update (A1_, A2_) k v m = let val hc = HashCode.hashcode A2_ k; in (case RBT.lookup Uint32a.linorder_uint32 m hc of NONE => RBT.insert Uint32a.linorder_uint32 hc (Assoc_List.update A1_ k v Assoc_List.empty) m | SOME bm => RBT.insert Uint32a.linorder_uint32 hc (Assoc_List.update A1_ k v bm) m) end; fun iteratei A_ m c f sigma_0 = RBTMapImpl.iteratei_map_op_list_it_rm_ops A_ m c (fn (_, lm) => ListMapImpl.iteratei_map_op_list_it_lm_ops lm c f) sigma_0; end; (*struct HashMap_Impl*) structure HashMap : sig type ('b, 'a) hashmap val hm_empty : 'a HashCode.hashable -> unit -> ('a, 'b) hashmap val hm_delete : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> ('a, 'b) hashmap val hm_lookup : 'a HOL.equal * 'a HashCode.hashable -> 'a -> ('a, 'b) hashmap -> 'b option val hm_update : 'a HOL.equal * 'a HashCode.hashable -> 'a -> 'b -> ('a, 'b) hashmap -> ('a, 'b) hashmap val hm_iteratei : 'a HashCode.hashable -> ('a, 'b) hashmap -> ('c -> bool) -> ('a * 'b -> 'c -> 'c) -> 'c -> 'c end = struct datatype ('b, 'a) hashmap = RBT_HM of (Word32.word, ('b, 'a) Assoc_List.assoc_list) RBT.rbt; fun hm_empty_const A_ = RBT_HM (HashMap_Impl.empty A_ ()); fun hm_empty A_ = (fn _ => hm_empty_const A_); fun impl_of_RBT_HM B_ (RBT_HM x) = x; fun hm_delete (A1_, A2_) k hm = RBT_HM (HashMap_Impl.delete (A1_, A2_) k (impl_of_RBT_HM A2_ hm)); fun hm_lookup (A1_, A2_) k hm = HashMap_Impl.lookup (A1_, A2_) k (impl_of_RBT_HM A2_ hm); fun hm_update (A1_, A2_) k v hm = RBT_HM (HashMap_Impl.update (A1_, A2_) k v (impl_of_RBT_HM A2_ hm)); fun hm_iteratei A_ hm = HashMap_Impl.iteratei Uint32a.linorder_uint32 (impl_of_RBT_HM A_ hm); end; (*struct HashMap*) structure HashSet : sig val test_codegen : 'a HashCode.hashable -> 'b HOL.equal * 'b HashCode.hashable -> 'c HOL.equal * 'c HashCode.hashable -> 'd HOL.equal * 'd HashCode.hashable -> 'e HashCode.hashable -> 'f HOL.equal * 'f HashCode.hashable -> 'g HashCode.hashable -> 'h HashCode.hashable -> 'i HashCode.hashable -> 'j HashCode.hashable -> 'k HashCode.hashable -> 'l HashCode.hashable -> 'm HOL.equal * 'm HashCode.hashable -> 'n HOL.equal * 'n HashCode.hashable -> 'o HOL.equal * 'o HashCode.hashable -> 'p HOL.equal * 'p HashCode.hashable -> 'q HOL.equal * 'q HashCode.hashable -> 'r HOL.equal * 'r HashCode.hashable -> 's HOL.equal * 's HashCode.hashable -> 't HOL.equal * 't HashCode.hashable -> 'u HOL.equal * 'u HashCode.hashable -> 'v HashCode.hashable -> 'w HashCode.hashable -> 'x HOL.equal * 'x HashCode.hashable -> (unit -> ('a, unit) HashMap.hashmap) * (('b -> ('b, unit) HashMap.hashmap -> bool) * (('c -> ('c, unit) HashMap.hashmap -> ('c, unit) HashMap.hashmap) * (('d -> ('d, unit) HashMap.hashmap -> ('d, unit) HashMap.hashmap) * ((('e, unit) HashMap.hashmap -> ('e list -> bool) -> ('e -> 'e list -> 'e list) -> 'e list -> 'e list) * (('f -> ('f, unit) HashMap.hashmap) * ((('g, unit) HashMap.hashmap -> bool) * ((('h, unit) HashMap.hashmap -> bool) * ((('i, unit) HashMap.hashmap -> ('i -> bool) -> bool) * ((('j, unit) HashMap.hashmap -> ('j -> bool) -> bool) * ((('k, unit) HashMap.hashmap -> Arith.nat) * ((Arith.nat -> ('l, unit) HashMap.hashmap -> Arith.nat) * ((('m, unit) HashMap.hashmap -> ('m, unit) HashMap.hashmap -> ('m, unit) HashMap.hashmap) * ((('n, unit) HashMap.hashmap -> ('n, unit) HashMap.hashmap -> ('n, unit) HashMap.hashmap) * ((('o, unit) HashMap.hashmap -> ('o, unit) HashMap.hashmap -> ('o, unit) HashMap.hashmap) * ((('p -> bool) -> ('p, unit) HashMap.hashmap -> ('p, unit) HashMap.hashmap) * ((('q, unit) HashMap.hashmap -> ('q, unit) HashMap.hashmap -> ('q, unit) HashMap.hashmap) * ((('r, unit) HashMap.hashmap -> ('r, unit) HashMap.hashmap -> bool) * ((('s, unit) HashMap.hashmap -> ('s, unit) HashMap.hashmap -> bool) * ((('t, unit) HashMap.hashmap -> ('t, unit) HashMap.hashmap -> bool) * ((('u, unit) HashMap.hashmap -> ('u, unit) HashMap.hashmap -> 'u option) * ((('v, unit) HashMap.hashmap -> ('v -> bool) -> 'v option) * ((('w, unit) HashMap.hashmap -> 'w list) * ('x list -> ('x, unit) HashMap.hashmap))))))))))))))))))))))) end = struct fun iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s = (fn c => fn f => HashMap.hm_iteratei A_ s c (f o Product_Type.fst)); fun g_sel_dflt_basic_ops_hm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s Option.is_none (fn x => fn _ => (if p x then SOME x else NONE)) NONE; fun memb_hm_basic_ops (A1_, A2_) x s = not (Option.is_none (HashMap.hm_lookup (A1_, A2_) x s)); fun g_disjoint_witness_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = g_sel_dflt_basic_ops_hm_basic_ops A2_ s1 (fn x => memb_hm_basic_ops (A1_, A2_) x s2); fun g_size_abort_dflt_basic_ops_hm_basic_ops A_ m s = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s (fn sigma => Arith.less_nat sigma m) (fn _ => Arith.suc) Arith.zero_nat; fun ins_hm_basic_ops (A1_, A2_) x s = HashMap.hm_update (A1_, A2_) x () s; fun g_from_list_aux_dflt_basic_ops_hm_basic_ops (A1_, A2_) accs (x :: l) = g_from_list_aux_dflt_basic_ops_hm_basic_ops (A1_, A2_) (ins_hm_basic_ops (A1_, A2_) x accs) l | g_from_list_aux_dflt_basic_ops_hm_basic_ops (A1_, A2_) y [] = y; fun empty_hm_basic_ops A_ = HashMap.hm_empty A_; fun g_from_list_dflt_basic_ops_hm_basic_ops (A1_, A2_) l = g_from_list_aux_dflt_basic_ops_hm_basic_ops (A1_, A2_) (empty_hm_basic_ops A2_ ()) l; fun ins_dj_hm_basic_ops (A1_, A2_) x s = HashMap.hm_update (A1_, A2_) x () s; fun g_union_dj_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A2_ s1 (fn _ => true) (ins_dj_hm_basic_ops (A1_, A2_)) s2; fun g_ball_dflt_basic_ops_hm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s (fn c => c) (fn x => fn _ => p x) true; fun g_disjoint_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = g_ball_dflt_basic_ops_hm_basic_ops A2_ s1 (fn x => not (memb_hm_basic_ops (A1_, A2_) x s2)); fun g_to_list_dflt_basic_ops_hm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s (fn _ => true) (fn a => fn b => a :: b) []; fun g_isEmpty_dflt_basic_ops_hm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s (fn c => c) (fn _ => fn _ => false) true; fun g_subset_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = g_ball_dflt_basic_ops_hm_basic_ops A2_ s1 (fn x => memb_hm_basic_ops (A1_, A2_) x s2); fun g_filter_dflt_basic_ops_hm_basic_ops (A1_, A2_) p s = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A2_ s (fn _ => true) (fn x => fn sigma => (if p x then ins_dj_hm_basic_ops (A1_, A2_) x sigma else sigma)) (empty_hm_basic_ops A2_ ()); fun g_union_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A2_ s1 (fn _ => true) (ins_hm_basic_ops (A1_, A2_)) s2; fun g_isSng_dflt_basic_ops_hm_basic_ops A_ s = Arith.equal_nat (iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s (fn sigma => Arith.less_nat sigma (Arith.nat_of_integer (2 : IntInf.int))) (fn _ => Arith.suc) Arith.zero_nat) Arith.one_nat; fun g_inter_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A2_ s1 (fn _ => true) (fn x => fn s => (if memb_hm_basic_ops (A1_, A2_) x s2 then ins_dj_hm_basic_ops (A1_, A2_) x s else s)) (empty_hm_basic_ops A2_ ()); fun g_equal_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = g_subset_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 andalso g_subset_dflt_basic_ops_hm_basic_ops (A1_, A2_) s2 s1; fun g_size_dflt_basic_ops_hm_basic_ops A_ s = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s (fn _ => true) (fn _ => Arith.suc) Arith.zero_nat; fun delete_hm_basic_ops (A1_, A2_) x s = HashMap.hm_delete (A1_, A2_) x s; fun g_diff_dflt_basic_ops_hm_basic_ops (A1_, A2_) s1 s2 = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A2_ s2 (fn _ => true) (delete_hm_basic_ops (A1_, A2_)) s1; fun g_sng_dflt_basic_ops_hm_basic_ops (A1_, A2_) x = ins_hm_basic_ops (A1_, A2_) x (empty_hm_basic_ops A2_ ()); fun g_bex_dflt_basic_ops_hm_basic_ops A_ s p = iteratei_bset_op_list_it_dflt_basic_ops_hm_basic_ops A_ s not (fn x => fn _ => p x) false; fun test_codegen A_ (B1_, B2_) (C1_, C2_) (D1_, D2_) E_ (F1_, F2_) G_ H_ I_ J_ K_ L_ (M1_, M2_) (N1_, N2_) (O1_, O2_) (P1_, P2_) (Q1_, Q2_) (R1_, R2_) (S1_, S2_) (T1_, T2_) (U1_, U2_) V_ W_ (X1_, X2_) = (empty_hm_basic_ops A_, (memb_hm_basic_ops (B1_, B2_), (ins_hm_basic_ops (C1_, C2_), (delete_hm_basic_ops (D1_, D2_), ((fn s => fn c => fn f => HashMap.hm_iteratei E_ s c (f o Product_Type.fst)), (g_sng_dflt_basic_ops_hm_basic_ops (F1_, F2_), (g_isEmpty_dflt_basic_ops_hm_basic_ops G_, (g_isSng_dflt_basic_ops_hm_basic_ops H_, (g_ball_dflt_basic_ops_hm_basic_ops I_, (g_bex_dflt_basic_ops_hm_basic_ops J_, (g_size_dflt_basic_ops_hm_basic_ops K_, (g_size_abort_dflt_basic_ops_hm_basic_ops L_, (g_union_dflt_basic_ops_hm_basic_ops (M1_, M2_), (g_union_dj_dflt_basic_ops_hm_basic_ops (N1_, N2_), (g_diff_dflt_basic_ops_hm_basic_ops (O1_, O2_), (g_filter_dflt_basic_ops_hm_basic_ops (P1_, P2_), (g_inter_dflt_basic_ops_hm_basic_ops (Q1_, Q2_), (g_subset_dflt_basic_ops_hm_basic_ops (R1_, R2_), (g_equal_dflt_basic_ops_hm_basic_ops (S1_, S2_), (g_disjoint_dflt_basic_ops_hm_basic_ops (T1_, T2_), (g_disjoint_witness_dflt_basic_ops_hm_basic_ops (U1_, U2_), (g_sel_dflt_basic_ops_hm_basic_ops V_, (g_to_list_dflt_basic_ops_hm_basic_ops W_, g_from_list_dflt_basic_ops_hm_basic_ops (X1_, X2_)))))))))))))))))))))))); end; (*struct HashSet*) ### theory "Collections.HashSet" ### 2.387s elapsed time, 4.716s cpu time, 0.616s GC time Loading theory "Collections.SetStdImpl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections" via "Collections.ICF_Impl") ### theory "Collections.SetStdImpl" ### 2.848s elapsed time, 5.708s cpu time, 0.000s GC time Loading theory "Collections.ICF_Impl" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections") ### Introduced fixed type variable(s): 'c, 'd, 'e, 'f in "FingerTreeStruc__" or "Node__" or "ma__" or "sfa__" ### Introduced fixed type variable(s): 'c, 'd, 'e, 'f in "FingerTreeStruc__" or "Node__" or "ma__" or "sfa__" ### Introduced fixed type variable(s): 'c, 'd, 'e, 'f in "FingerTreeStruc__" or "Node__" or "ma__" or "pra__" ### Introduced fixed type variable(s): 'c, 'd, 'e, 'f in "FingerTreeStruc__" or "Node__" or "ma__" or "pra__" ### Introduced fixed type variable(s): 'b, 'c in "da__" or "ia__" or "la__" or "nda__" or "pa__" or "ra__" ### Removed duplicate interpretation after retrieving its mixins. ### theory "Collections.ICF_Impl" ### 4.319s elapsed time, 8.568s cpu time, 0.264s GC time Loading theory "Collections.ICF_Refine_Monadic" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections") ### theory "Collections.ICF_Refine_Monadic" ### 0.454s elapsed time, 0.900s cpu time, 0.000s GC time Loading theory "Collections.ICF_Autoref" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1" via "Collections.Collections") locale uprio fixes \ :: "'s \ 'e \ 'a option" and invar :: "'s \ bool" locale set fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" locale map fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" ### revert_abbrevs: No matching constants locale set_ins_dj fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and ins_dj :: "'x \ 's \ 's" assumes "set_ins_dj \ invar ins_dj" locale set_union_dj fixes \1 :: "'s1 \ 'a set" and invar1 :: "'s1 \ bool" and \2 :: "'s2 \ 'a set" and invar2 :: "'s2 \ bool" and \3 :: "'s3 \ 'a set" and invar3 :: "'s3 \ bool" and union_dj :: "'s1 \ 's2 \ 's3" assumes "set_union_dj \1 invar1 \2 invar2 \3 invar3 union_dj" locale set_sel' fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and sel' :: "'s \ ('x \ bool) \ 'x option" assumes "set_sel' \ invar sel'" locale map_update_dj fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and update_dj :: "'u \ 'v \ 's \ 's" assumes "map_update_dj \ invar update_dj" ### Introduced fixed type variable(s): 'c, 'd in "t__" locale map_add_dj fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and add_dj :: "'s \ 's \ 's" assumes "map_add_dj \ invar add_dj" ### Ignoring duplicate rewrite rule: ### key_rel (\_ _. True) \ \_ _. True ### theory "Collections.ICF_Autoref" ### 2.838s elapsed time, 5.640s cpu time, 0.332s GC time Loading theory "Collections.Collections" (required by "Containers-Benchmarks.Benchmark_ICF" via "Collections.CollectionsV1") ### theory "Collections.Collections" ### 0.426s elapsed time, 0.852s cpu time, 0.000s GC time Loading theory "Collections.CollectionsV1" (required by "Containers-Benchmarks.Benchmark_ICF") locale set_iteratei fixes \ :: "'s \ 'x set" and invar :: "'s \ bool" and iteratei :: "'s \ ('\ \ bool) \ ('x \ '\ \ '\) \ '\ \ '\" assumes "set_iteratei \ invar iteratei" locale set_iterateoi fixes \ :: "'s \ 'u set" and invar :: "'s \ bool" and iterateoi :: "'s \ ('\ \ bool) \ ('u \ '\ \ '\) \ '\ \ '\" assumes "set_iterateoi \ invar iterateoi" locale set_reverse_iterateoi fixes \ :: "'s \ 'u set" and invar :: "'s \ bool" and reverse_iterateoi :: "'s \ ('\ \ bool) \ ('u \ '\ \ '\) \ '\ \ '\" assumes "set_reverse_iterateoi \ invar reverse_iterateoi" locale map_iteratei fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and iteratei :: "'s \ ('\ \ bool) \ ('u \ 'v \ '\ \ '\) \ '\ \ '\" assumes "map_iteratei \ invar iteratei" locale map_iterateoi fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and iterateoi :: "'s \ ('\ \ bool) \ ('u \ 'v \ '\ \ '\) \ '\ \ '\" assumes "map_iterateoi \ invar iterateoi" locale map_reverse_iterateoi fixes \ :: "'s \ 'u \ 'v option" and invar :: "'s \ bool" and reverse_iterateoi :: "'s \ ('\ \ bool) \ ('u \ 'v \ '\ \ '\) \ '\ \ '\" assumes "map_reverse_iterateoi \ invar reverse_iterateoi" ### Ignoring duplicate rewrite rule: ### FingerTreeStruc.ft_invar (FingerTreeStruc.toTree ?l1) \ True ### Ignoring duplicate rewrite rule: ### FingerTreeStruc.toList (FingerTreeStruc.toTree ?y) \ ?y ### Ignoring duplicate rewrite rule: ### FingerTreeStruc.count ?t1 \ length (FingerTreeStruc.toList ?t1) (0 < length ?xs) = (?xs \ []) ### Metis: Unused theorems: "Set.Un_upper2" ### Metis: Unused theorems: "Set.Un_upper1" locale list_enqueue fixes \ :: "'a \ 'b list" and invar :: "'a \ bool" and appendr :: "'b \ 'a \ 'a" assumes "list_enqueue \ invar appendr" locale list_dequeue fixes \ :: "'a \ 'b list" and invar :: "'a \ bool" and removel :: "'a \ 'b \ 'a" assumes "list_dequeue \ invar removel" locale list_push fixes \ :: "'a \ 'b list" and invar :: "'a \ bool" and appendl :: "'b \ 'a \ 'a" assumes "list_push \ invar appendl" locale list_pop fixes \ :: "'a \ 'b list" and invar :: "'a \ bool" and remover :: "'a \ 'a \ 'b" assumes "list_pop \ invar remover" locale list_top fixes \ :: "'a \ 'b list" and invar :: "'a \ bool" and leftmost :: "'a \ 'b" assumes "list_top \ invar leftmost" locale list_bot fixes \ :: "'a \ 'b list" and invar :: "'a \ bool" and rightmost :: "'a \ 'b" assumes "list_bot \ invar rightmost" instantiation RBT.rbt :: ({equal,linorder}, equal) equal equal_rbt == equal_class.equal :: ('a, 'b) RBT.rbt \ ('a, 'b) RBT.rbt \ bool ### theory "Collections.CollectionsV1" ### 7.875s elapsed time, 14.616s cpu time, 0.956s GC time Loading theory "Containers-Benchmarks.Benchmark_ICF" ### Metis: Unused theorems: "local.Suc.prems_1", "local.Suc.prems_3", "local.Suc.prems_4" ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### \?b = ?f ?x; ?x \ ?A\ \ ?b \ ?f ` ?A ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g locale benchmark_base fixes empty :: "unit \ 's" and memb :: "natural \ 's \ bool" and ins :: "natural \ 's \ 's" and rem :: "natural \ 's \ 's" and size :: "'s \ nat" and filter :: "(natural \ bool) \ 's \ 's" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" Found termination order: "(\p. size (fst (snd p))) <*mlex*> {}" Found termination order: "(\p. size (fst (snd (snd p)))) <*mlex*> {}" consts lookup :: "nat \ 's \ natural \ natural \ natural \ natural \ natural" locale benchmark fixes \ :: "'s \ natural set" and invar :: "'s \ bool" and empty :: "unit \ 's" and memb :: "natural \ 's \ bool" and ins :: "natural \ 's \ 's" and rem :: "natural \ 's \ 's" and size :: "'s \ nat" and filter :: "(natural \ bool) \ 's \ 's" assumes "benchmark \ invar empty memb ins rem size filter" ### theory "Containers-Benchmarks.Benchmark_ICF" ### 6.522s elapsed time, 13.016s cpu time, 0.496s GC time "merge" :: "'a" ### Rule already declared as safe introduction (intro!) ### (?a, ?a) \ ?r\<^sup>* ### Rule already declared as safe introduction (intro!) ### wf ?r \ wf (inv_image ?r ?f) ### Rule already declared as safe introduction (intro!) ### (?a, ?a) \ ?r\<^sup>* ### Metis: Unused theorems: "Misc.rel_restrict_notR_2" ### Metis: Unused theorems: "Misc.rel_restrict_notR_1" ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g val it = "foo \ ANNOT foo bar": thm val it = "foo \ foo ::: bar": thm "set_rel" :: "('a \ 'b) set \ ('a set \ 'b set) set" val it = "Ra \\<^sub>r \Rb\option_rel": cterm val it = "\Id\option_rel \ \Id\list_rel": cterm ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g "list_update" :: "'a list \ nat \ 'a \ 'a list" ### Ignoring duplicate rewrite rule: ### finite (dom (map_of ?l1)) \ True val it = 4: int val it = "(1::'a) # \ # \": cterm ### Ignoring duplicate rewrite rule: ### finite (dom (map_of ?l1)) \ True val it = [2, 3, 4, 5]: int list "(\)" :: "('a \ 'b) \ ('c \ 'a) \ 'c \ 'b" ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate rewrite rule: ### Autoref_Tagging.ANNOT ?x ?a \ ?x ### Introduced fixed type variable(s): 'd in "l__" ### Introduced fixed type variable(s): 'd in "\__" or "c__" or "f__" ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g val bool_DList = fn: unit -> bool Isabelle5739144.Generated_Code.set val bool_RBT = fn: unit -> bool Isabelle5739144.Generated_Code.set val mem = fn: bool -> bool Isabelle5739144.Generated_Code.set -> bool val test = fn: bool Isabelle5739144.Generated_Code.set -> unit val repeat = fn: (unit -> 'a) -> int -> unit val iters = 1000000: int val it = "0.034s elapsed time, 0.068s cpu time, 0.000s GC time": string val it = "0.048s elapsed time, 0.096s cpu time, 0.000s GC time": string val seed = (Nat 12345, Nat 67889): Code_Numeral.natural * Code_Numeral.natural val n = Nat 30: Isabelle5742696.Generated_Code.nat val m = Nat 40: Isabelle5742696.Generated_Code.nat val c = (Nat 30, Nat 4294967296): Isabelle5742696.Generated_Code.nat * Isabelle5742696.Generated_Code.nat theorem flatf_fp_induct_pointwise: fixes pre :: "'a \ 'b \ bool" and post :: "'a \ 'b \ 'c \ bool" and b :: "'c" and B :: "('b \ 'c) \ 'b \ 'c" and a :: "'a" and x :: "'b" assumes "\a x. pre a x \ post a x b" and "flatf_mono b B" and "pre a x" and "\f a x. \\a' x'. pre a' x' \ post a' x' (f x'); pre a x; flatf_ord b f (flatf_fp b B)\ \ post a x (B f x)" shows "post a x (flatf_fp b B x)" Found termination order: "{}" ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False "False" :: "bool" ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ ?R1 FAIL \ FAIL ### Ignoring duplicate rewrite rule: ### ?X1 \ Domain ?R1 \ ### \ ?R1 (RES ?X1) \ RES (?R1 `` ?X1) ### Ignoring duplicate rewrite rule: ### \ ?X1 \ Domain ?R1 \ ### \ ?R1 (RES ?X1) \ FAIL ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### nres_of dSUCCEED \ SUCCEED ### Ignoring duplicate rewrite rule: ### nres_of dFAIL \ FAIL ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False rank_invar (meld bq1 bq2) \ min (rank (link t1 t2)) (rank (hd (meld bq1 bq2))) \ rank (hd (ins (link t1 t2) (meld bq1 bq2))) ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g \RETURN ?tsl \ ?tsl'; \x \. RETURN (?f x \) \ ?f' x \\ \ RETURN (foldli ?tsl ?c ?f ?\) \ LIST_FOREACH' ?tsl' ?c ?f' ?\ \?\ \ dSUCCEED; \x \. ?f x \ \ dSUCCEED\ \ foldli ?l ?c (\x s. s \ ?f x) ?\ \ dSUCCEED (\x s. nres_of (?f x s) \ ?f' x s) \ nres_of (foldli ?l (case_dres False False ?c) (\x s. s \ ?f x) (dRETURN ?s)) \ nfoldli ?l ?c ?f' ?s (\x s. RETURN (?f x s) \ ?f' x s) \ RETURN (foldli ?l ?c ?f ?s) \ nfoldli ?l ?c ?f' ?s \?\; ?\ \ RETURN ?M \ ?M'\ \ RETURN ?M \ ASSUME ?\ \ (\_. ?M') (?\ \ RETURN ?M \ ?M') \ RETURN ?M \ ASSERT ?\ \ (\_. ?M') \RETURN ?x \ ?M; \x. RETURN (?f x) \ ?F x\ \ RETURN (Let ?x ?f) \ ?M \ ?F RETURN ?a \ RETURN ?a \\x. ?fr x = ?b ?fr x; \F f x. (\x. RETURN (f x) \ F x) \ RETURN (?b f x) \ ?B F x\ \ RETURN (?fr ?x) \ REC\<^sub>T ?B ?x \\s. RETURN (?fn s) \ ?fn' s; \n rec rec' s. (\s. RETURN (rec s) \ rec' s) \ RETURN (?fs n rec s) \ ?fs' n rec' s\ \ RETURN (rec_nat ?fn ?fs ?n ?s) \ rec_nat ?fn' ?fs' ?n ?s \\s. RETURN (?fn s) \ ?fn' s; \x l rec rec' s. (\s. RETURN (rec s) \ rec' s) \ RETURN (?fc x l rec s) \ ?fc' x l rec' s\ \ RETURN (rec_list ?fn ?fc ?l ?s) \ rec_list ?fn' ?fc' ?l ?s \RETURN ?fn \ ?Fn; \x xs. RETURN (?fc x xs) \ ?Fc x xs\ \ RETURN (case ?l of [] \ ?fn | x # xa \ ?fc x xa) \ (case ?l of [] \ ?Fn | x # xa \ ?Fc x xa) \\l. RETURN (?fl l) \ ?Fl l; \r. RETURN (?fr r) \ ?Fr r\ \ RETURN (case ?x of Inl x \ ?fl x | Inr x \ ?fr x) \ (case ?x of Inl x \ ?Fl x | Inr x \ ?Fr x) \RETURN ?fa \ ?Fa; \x. RETURN (?fb x) \ ?Fb x\ \ RETURN (case ?x of None \ ?fa | Some x \ ?fb x) \ (case ?x of None \ ?Fa | Some x \ ?Fb x) (\x. RETURN (?f x) \ ?F x) \ RETURN (Let ?x ?f) \ Let ?x ?F (\a b. RETURN (?f a b) \ ?F a b) \ RETURN (case ?x of (x, xa) \ ?f x xa) \ (case ?x of (x, xa) \ ?F x xa) \?b \ RETURN ?s1.0 \ ?S1.0; \ ?b \ RETURN ?s2.0 \ ?S2.0\ \ RETURN (if ?b then ?s1.0 else ?s2.0) \ (if ?b then ?S1.0 else ?S2.0) (\x. nres_of (?f x) \ ?F x) \ nres_of (dWHILET ?b ?f ?x) \ WHILE\<^sub>T ?b ?F ?x (\x. nres_of (?f x) \ ?F x) \ nres_of (dWHILE ?b ?f ?x) \ WHILE ?b ?F ?x (\x. nres_of (?f x) \ ?F x) \ nres_of (dWHILEI ?I ?b ?f ?x) \ WHILE\<^bsup>?I\<^esup> ?b ?F ?x (\x. nres_of (?f x) \ ?F x) \ nres_of (dWHILEIT ?I ?b ?f ?x) \ WHILE\<^sub>T\<^bsup>?I\<^esup> ?b ?F ?x \?\; ?\ \ nres_of ?M \ ?M'\ \ nres_of ?M \ ASSUME ?\ \ (\_. ?M') (?\ \ nres_of ?M \ ?M') \ nres_of ?M \ ASSERT ?\ \ (\_. ?M') \nres_of ?m \ ?M; \x. nres_of (?f x) \ ?F x\ \ nres_of (?m \ ?f) \ ?M \ ?F nres_of (dRETURN ?x) \ RETURN ?x nres_of dSUCCEED \ SUCCEED nres_of dFAIL \ FAIL nres_of ?x \ nres_of ?x \\F f x. (\x. nres_of (f x) \ F x) \ nres_of (?b f x) \ ?B F x; trimono ?b\ \ nres_of (REC ?b ?x) \ REC ?B ?x \\F f x. (\x. nres_of (f x) \ F x) \ nres_of (?b f x) \ ?B F x; trimono ?b\ \ nres_of (REC\<^sub>T ?b ?x) \ REC\<^sub>T ?B ?x \\x. ?fr x = ?b ?fr x; \F f x. (\x. nres_of (f x) \ F x) \ nres_of (?b f x) \ ?B F x\ \ nres_of (?fr ?x) \ REC\<^sub>T ?B ?x \\s. nres_of (?fn s) \ ?fn' s; \n rec rec' s. (\s. nres_of (rec s) \ rec' s) \ nres_of (?fs n rec s) \ ?fs' n rec' s\ \ nres_of (rec_nat ?fn ?fs ?n ?s) \ rec_nat ?fn' ?fs' ?n ?s \\s. nres_of (?fn s) \ ?fn' s; \x l rec rec' s. (\s. nres_of (rec s) \ rec' s) \ nres_of (?fc x l rec s) \ ?fc' x l rec' s\ \ nres_of (rec_list ?fn ?fc ?l ?s) \ rec_list ?fn' ?fc' ?l ?s \nres_of ?fn \ ?Fn; \x xs. nres_of (?fc x xs) \ ?Fc x xs\ \ nres_of (case ?l of [] \ ?fn | x # xa \ ?fc x xa) \ (case ?l of [] \ ?Fn | x # xa \ ?Fc x xa) \\l. nres_of (?fl l) \ ?Fl l; \r. nres_of (?fr r) \ ?Fr r\ \ nres_of (case ?x of Inl x \ ?fl x | Inr x \ ?fr x) \ (case ?x of Inl x \ ?Fl x | Inr x \ ?Fr x) \nres_of ?fa \ ?Fa; \x. nres_of (?fb x) \ ?Fb x\ \ nres_of (case ?x of None \ ?fa | Some x \ ?fb x) \ (case ?x of None \ ?Fa | Some x \ ?Fb x) (\x. nres_of (?f x) \ ?F x) \ nres_of (Let ?x ?f) \ Let ?x ?F (\a b. nres_of (?f a b) \ ?F a b) \ nres_of (case ?x of (x, xa) \ ?f x xa) \ (case ?x of (x, xa) \ ?F x xa) \?b \ nres_of ?s1.0 \ ?S1.0; \ ?b \ nres_of ?s2.0 \ ?S2.0\ \ nres_of (if ?b then ?s1.0 else ?s2.0) \ (if ?b then ?S1.0 else ?S2.0) (\x. RETURN (?f x) \ ?F x) \ RETURN (while ?b ?f ?x) \ WHILE\<^sub>T ?b ?F ?x (\x. RETURN (?f x) \ ?F x) \ RETURN (while ?b ?f ?x) \ WHILE\<^sub>T\<^bsup>?I\<^esup> ?b ?F ?x (\x. ?f x \ dSUCCEED) \ dWHILET ?b ?f ?s \ dSUCCEED (\x. ?f x \ dSUCCEED) \ dWHILEIT ?I ?b ?f ?s \ dSUCCEED (\f x. (\x. f x \ dSUCCEED) \ ?B f x \ dSUCCEED) \ REC\<^sub>T ?B ?x \ dSUCCEED \?fn \ dSUCCEED; \x xs. ?fc x xs \ dSUCCEED\ \ (case ?x of [] \ ?fn | x # xa \ ?fc x xa) \ dSUCCEED \?fn \ dSUCCEED; \v. ?fs v \ dSUCCEED\ \ (case ?x of None \ ?fn | Some x \ ?fs x) \ dSUCCEED (\x1 x2. ?g x1 x2 \ dSUCCEED) \ (case ?p of (x, xa) \ ?g x xa) \ dSUCCEED (\x. ?f x \ dSUCCEED) \ Let ?x ?f \ dSUCCEED \?m1.0 \ dSUCCEED; ?m2.0 \ dSUCCEED\ \ (if ?b then ?m1.0 else ?m2.0) \ dSUCCEED dASSERT ?\ \ dSUCCEED \?m \ dSUCCEED; \x. ?f x \ dSUCCEED\ \ ?m \ ?f \ dSUCCEED dRETURN ?x \ dSUCCEED dFAIL \ dSUCCEED (\x. dRETURN (?f x) \ ?F x) \ dRETURN (while ?b ?f ?x) \ dWHILET ?b ?F ?x (\x. dRETURN (?f x) \ ?F x) \ dRETURN (while ?b ?f ?x) \ dWHILEIT ?I ?b ?F ?x ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False ### Rule already declared as introduction (intro) ### \(?a, ?b) \ ?r; ?a \ ?A\ ### \ ?b \ ?r `` ?A ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate rewrite rule: ### nofail (SELECT ?P1) \ True ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False "op_map_restrict" :: "('a \ 'b \ bool) \ ('a \ 'b option) \ 'a \ 'b option" ### Metis: Unused theorems: "Set.contra_subsetD" ### Introduced fixed type variable(s): 'c in "l__" ### Introduced fixed type variable(s): 'c in "\__" or "c__" or "f__" ### Introduced fixed type variable(s): 'c in "\__" or "c__" or "f__" ### Metis: Unused theorems: "Relation.DomainE", "Set.contra_subsetD" ### Rule already declared as introduction (intro) ### \?b = ?f ?x; ?x \ ?A\ \ ?b \ ?f ` ?A ### Metis: Unused theorems: "Orderings.preorder_class.order_trans", "PrioByAnnotatedList.prio_selects_one" ### Metis: Unused theorems: "Orderings.preorder_class.order_trans", "PrioByAnnotatedList.p_linear" ### Ignoring duplicate rewrite rule: ### p_min Infty ?y \ ?y ### Ignoring duplicate rewrite rule: ### p_min Infty ?y \ ?y ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Metis: Unused theorems: "Map.restrict_complement_singleton_eq" ### Ignoring duplicate rewrite rule: ### finite (dom (map_of ?l1)) \ True *** Type unification failed: Clash of types "_ set" and "_ \ _" *** *** Type error in application: incompatible operand type *** *** Operator: (=) (aluprio_\ \ s) :: *** ('b \ 'c option) \ bool *** Operand: {} :: ??'a set *** *** Coercion Inference: *** *** Local coercion insertion on the operand failed: *** No coercion known for type constructors: "set" and "fun" *** At command "hence" (line 851 of "~~/afp/thys/Collections/ICF/gen_algo/PrioUniqueByAnnotatedList.thy") *** Type unification failed: Clash of types "_ set" and "_ \ _" *** *** Type error in application: incompatible operand type *** *** Operator: (\) (aluprio_\ \ s) :: *** ('b \ 'c option) \ bool *** Operand: {} :: ??'a set *** *** Coercion Inference: *** *** Local coercion insertion on the operand failed: *** No coercion known for type constructors: "set" and "fun" *** At command "assume" (line 966 of "~~/afp/thys/Collections/ICF/gen_algo/PrioUniqueByAnnotatedList.thy") ### Introduced fixed type variable(s): 'd in "uu__" ### Ignoring duplicate rewrite rule: ### t.invar ?t1 \ ci_invar (idx_build ?f1 ?t1) \ True ### Ignoring duplicate rewrite rule: ### invar ?m1 \ ### \ (update ?k1 ?v1 ?m1) \ \ ?m1(?k1 \ ?v1) ### Ignoring duplicate rewrite rule: ### invar ?m1 \ invar (update ?k1 ?v1 ?m1) \ True ### Ignoring duplicate rewrite rule: ### \ (local.empty ()) \ Map.empty ### Ignoring duplicate rewrite rule: ### invar (local.empty ()) \ True ### Ignoring duplicate rewrite rule: ### invar ?m1 \ ### \ (update ?k1 ?v1 ?m1) \ \ ?m1(?k1 \ ?v1) ### Ignoring duplicate rewrite rule: ### invar ?m1 \ invar (update ?k1 ?v1 ?m1) \ True ### Ignoring duplicate rewrite rule: ### invar ?m1 \ ### \ (update ?k1 ?v1 ?m1) \ \ ?m1(?k1 \ ?v1) ### Ignoring duplicate rewrite rule: ### invar ?m1 \ invar (update ?k1 ?v1 ?m1) \ True ### Ignoring duplicate rewrite rule: ### \ (local.empty ()) \ Map.empty ### Ignoring duplicate rewrite rule: ### invar (local.empty ()) \ True ### Ignoring duplicate rewrite rule: ### \invar ?m1; ?k1 \ dom (\ ?m1)\ ### \ \ (update_dj ?k1 ?v1 ?m1) \ \ ?m1 ### (?k1 \ ?v1) ### Ignoring duplicate rewrite rule: ### \invar ?m1; ?k1 \ dom (\ ?m1)\ ### \ invar (update_dj ?k1 ?v1 ?m1) \ True ### Ignoring duplicate rewrite rule: ### \ (local.empty ()) \ Map.empty ### Ignoring duplicate rewrite rule: ### invar (local.empty ()) \ True ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate rewrite rule: ### invar ?s1 \ ### \ (ins ?x1 ?s1) \ insert ?x1 (\ ?s1) ### Ignoring duplicate rewrite rule: ### invar ?s1 \ invar (ins ?x1 ?s1) \ True ### Ignoring duplicate rewrite rule: ### \ (local.empty ()) \ {} ### Ignoring duplicate rewrite rule: ### invar (local.empty ()) \ True ### Ignoring duplicate rewrite rule: ### invar ?s1 \ ### \ (ins ?x1 ?s1) \ insert ?x1 (\ ?s1) ### Ignoring duplicate rewrite rule: ### invar ?s1 \ invar (ins ?x1 ?s1) \ True ### Ignoring duplicate rewrite rule: ### invar ?s1 \ memb ?x1 ?s1 \ ?x1 \ \ ?s1 ### Ignoring duplicate rewrite rule: ### invar ?s1 \ ### \ (ins ?x1 ?s1) \ insert ?x1 (\ ?s1) ### Ignoring duplicate rewrite rule: ### invar ?s1 \ invar (ins ?x1 ?s1) \ True ### Ignoring duplicate rewrite rule: ### \ (local.empty ()) \ {} ### Ignoring duplicate rewrite rule: ### invar (local.empty ()) \ True ### Ignoring duplicate rewrite rule: ### invar ?s1 \ memb ?x1 ?s1 \ ?x1 \ \ ?s1 ### Ignoring duplicate rewrite rule: ### invar ?s1 \ memb ?x1 ?s1 \ ?x1 \ \ ?s1 ### Ignoring duplicate rewrite rule: ### dom (\x. Some (?f1 x)) \ UNIV ### Ignoring duplicate rewrite rule: ### dom (\x. Some (?f1 x)) \ UNIV "revg" :: "'a list \ 'a list \ 'a list" ### Ignoring duplicate rewrite rule: ### ahm_\_aux ?a1 ?k1 \ ### map_of (array_get ?a1 (bounded_hashcode_nat (array_length ?a1) ?k1)) ?k1 ### Introduced fixed type variable(s): 'c in "j__" ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate rewrite rule: ### ArrayHashMap_Impl.ahm_\ (ArrayHashMap_Impl.ahm_empty ()) \ ### Map.empty ### Ignoring duplicate rewrite rule: ### ArrayHashMap_Impl.ahm_invar (ArrayHashMap_Impl.ahm_empty ()) \ True ### Ignoring duplicate rewrite rule: ### map.\ (map.empty ()) \ Map.empty ### Ignoring duplicate rewrite rule: ### map.invar (map.empty ()) \ True ### Ignoring duplicate rewrite rule: ### map.invar ?m1 \ ### map.lookup ?k1 ?m1 \ map.\ ?m1 ?k1 ### Ignoring duplicate rewrite rule: ### map.invar ?m1 \ ### map.\ (map.update ?k1 ?v1 ?m1) \ map.\ ?m1(?k1 ### \ ?v1) ### Ignoring duplicate rewrite rule: ### map.invar ?m1 \ ### map.invar (map.update ?k1 ?v1 ?m1) \ True ### Ignoring duplicate rewrite rule: ### \map.invar ?m1; ?k1 \ dom (map.\ ?m1)\ ### \ map.\ (map.update_dj ?k1 ?v1 ?m1) \ ### map.\ ?m1(?k1 \ ?v1) ### Ignoring duplicate rewrite rule: ### \map.invar ?m1; ?k1 \ dom (map.\ ?m1)\ ### \ map.invar (map.update_dj ?k1 ?v1 ?m1) \ True ### Ignoring duplicate rewrite rule: ### map.invar ?m1 \ ### map.\ (map.delete ?k1 ?m1) \ map.\ ?m1 |` (- {?k1}) ### Ignoring duplicate rewrite rule: ### map.invar ?m1 \ map.invar (map.delete ?k1 ?m1) \ True ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate rewrite rule: ### nofail (SELECT ?P1) \ True ### Ignoring duplicate rewrite rule: ### \ nofail ?S1 \ inres ?S1 ?x1 \ True ### Ignoring duplicate rewrite rule: ### inres SUCCEED \ \_. False ### Ignoring duplicate rewrite rule: ### inres (RETURN ?x1) \ (=) ?x1 ### Ignoring duplicate rewrite rule: ### inres (RES ?X1) \ \x. x \ ?X1 ### Ignoring duplicate rewrite rule: ### inres FAIL \ \_. True ### Ignoring duplicate rewrite rule: ### nofail SUCCEED \ True ### Ignoring duplicate rewrite rule: ### nofail (RETURN ?x1) \ True ### Ignoring duplicate rewrite rule: ### nofail (RES ?X1) \ True ### Ignoring duplicate rewrite rule: ### nofail FAIL \ False "prio_pop_min" :: "('a \ 'b option) \ ('a \ 'b \ ('a \ 'b option)) nres" ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g Trying solver Relators.relator_props_solver OK (Relators.relator_props_solver) ### Ignoring duplicate rewrite rule: ### op_set_delete ?x ?s \ ?s - {?x} ### Ignoring duplicate rewrite rule: ### op_set_isSng ?s \ card ?s = 1 ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Ignoring duplicate rewrite rule: ### op_set_size_abort ?m ?s \ min ?m (card ?s) ### Ignoring duplicate rewrite rule: ### op_set_filter ?P ?s \ {x \ ?s. ?P x} ### Ignoring duplicate rewrite rule: ### op_set_disjoint ?a ?b \ ?a \ ?b = {} \\t\set (filter (\t. rank t = 0) (children (getMinTree q))). rank t = 0 \ children t = []; queue_invar ?q\ \ queue_to_multiset (insertList (filter (\t. rank t = 0) (children (getMinTree q))) ?q) = queue_to_multiset (filter (\t. rank t = 0) (children (getMinTree q))) + queue_to_multiset ?q ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g ### Rule already declared as introduction (intro) ### (\x. ?f x = ?g x) \ ?f = ?g \\e a r ts. ?Q ts \ ?P (SkewBinomialHeapStruc.Node e a r ts); ?Q []; \t q. \?P t; ?Q q\ \ ?Q (t # q)\ \ ?P ?a0.0 \\e a r ts. ?Q ts \ ?P (SkewBinomialHeapStruc.Node e a r ts); ?Q []; \t q. \?P t; ?Q q\ \ ?Q (t # q)\ \ ?Q ?a1.0 (\i len a c f \. (\x. \\ (len \ i \ \ c \); x = (case array_get a i of None \ \ | Some x \ f (i, x) \)\ \ ?P (i + 1) len a c f x) \ ?P i len a c f \) \ ?P ?a0.0 ?a1.0 ?a2.0 ?a3.0 ?a4.0 ?a5.0 a_idx_it.idx_iteratei ?s = foldli (list_of_array ?s) *** Type unification failed: Clash of types "_ set" and "_ \ _" *** *** Type error in application: incompatible operand type *** *** Operator: (\) (aluprio_\ \ s) :: *** ('b \ 'c option) \ bool *** Operand: {} :: ??'a set *** *** Coercion Inference: *** *** Local coercion insertion on the operand failed: *** No coercion known for type constructors: "set" and "fun" *** At command "assume" (line 966 of "~~/afp/thys/Collections/ICF/gen_algo/PrioUniqueByAnnotatedList.thy") *** Type unification failed: Clash of types "_ set" and "_ \ _" *** *** Type error in application: incompatible operand type *** *** Operator: (=) (aluprio_\ \ s) :: *** ('b \ 'c option) \ bool *** Operand: {} :: ??'a set *** *** Coercion Inference: *** *** Local coercion insertion on the operand failed: *** No coercion known for type constructors: "set" and "fun" *** At command "hence" (line 851 of "~~/afp/thys/Collections/ICF/gen_algo/PrioUniqueByAnnotatedList.thy")