text stringlengths 0 601k |
|---|
let combining_char = [ ( 0x0300 , 0x0345 ) 0x0345 ; ( 0x0360 , 0x0361 ) 0x0361 ; ( 0x0483 , 0x0486 ) 0x0486 ; ( 0x0591 , 0x05A1 ) 0x05A1 ; ( 0x05A3 , 0x05B9 ) 0x05B9 ; ( 0x05BB , 0x05BD ) 0x05BD ; ( 0x05BF , 0x05BF ) 0x05BF ; ( 0x05C1 , 0x05C2 ) 0x05C2 ; ( 0x05C4 , 0x05C4 ) 0x05C4 ; ( 0x064B , 0x0652 ) 0x0652 ; ( 0x067... |
let digit = [ ( 0x0030 , 0x0039 ) 0x0039 ; ( 0x0660 , 0x0669 ) 0x0669 ; ( 0x06F0 , 0x06F9 ) 0x06F9 ; ( 0x0966 , 0x096F ) 0x096F ; ( 0x09E6 , 0x09EF ) 0x09EF ; ( 0x0A66 , 0x0A6F ) 0x0A6F ; ( 0x0AE6 , 0x0AEF ) 0x0AEF ; ( 0x0B66 , 0x0B6F ) 0x0B6F ; ( 0x0BE7 , 0x0BEF ) 0x0BEF ; ( 0x0C66 , 0x0C6F ) 0x0C6F ; ( 0x0CE6 , 0x0CE... |
let extender = [ ( 0x00B7 , 0x00B7 ) 0x00B7 ; ( 0x02D0 , 0x02D1 ) 0x02D1 ; ( 0x0387 , 0x0387 ) 0x0387 ; ( 0x0640 , 0x0640 ) 0x0640 ; ( 0x0E46 , 0x0E46 ) 0x0E46 ; ( 0x0EC6 , 0x0EC6 ) 0x0EC6 ; ( 0x3005 , 0x3005 ) 0x3005 ; ( 0x3031 , 0x3035 ) 0x3035 ; ( 0x309D , 0x309E ) 0x309E ; ( 0x30FC , 0x30FE ) 0x30FE ; ] |
let blank = [ ( 0x0009 , 0x000A ) 0x000A ; ( 0x000D , 0x000D ) 0x000D ; ( 0x0020 , 0x0020 ) 0x0020 ] 0x0020 |
let letter = union base_char ideographic |
let tr8876_ident_char = [ ( 0x0041 , 0x005a ) 0x005a ; ( 0x0061 , 0x007a ) 0x007a ; ( 0x00c0 , 0x00d6 ) 0x00d6 ; ( 0x00d8 , 0x00f6 ) 0x00f6 ; ( 0x00f8 , 0x01f5 ) 0x01f5 ; ( 0x01fa , 0x0217 ) 0x0217 ; ( 0x0250 , 0x02a8 ) 0x02a8 ; ( 0x0384 , 0x0384 ) 0x0384 ; ( 0x0388 , 0x038a ) 0x038a ; ( 0x038c , 0x038c ) 0x038c ; ( 0x... |
type seed = B of State_hash . t |
type t = T of State_hash . t |
type sequence = S of State_hash . t |
let nonce_encoding = Data_encoding . Fixed . bytes Constants_repr . nonce_length |
let initial_seed = " Laissez - faire les proprietaires . " |
let zero_bytes = Bytes . make Nonce_hash . size ' \ 000 ' |
let state_hash_encoding = let open Data_encoding in conv State_hash . to_bytes State_hash . of_bytes_exn ( Fixed . bytes Nonce_hash . size ) |
let seed_encoding = let open Data_encoding in conv ( fun ( B b ) -> b ) ( fun b -> B b ) state_hash_encoding |
let empty = B ( State_hash . hash_string [ initial_seed ] ) |
let nonce ( B state ) nonce = B ( State_hash . hash_bytes [ State_hash . to_bytes state ; nonce ] ) |
let initialize_new ( B state ) append = T ( State_hash . hash_bytes ( State_hash . to_bytes state :: zero_bytes :: append ) ) |
let xor_higher_bits i b = let higher = TzEndian . get_int32 b 0 in let r = Int32 . logxor higher i in let res = Bytes . copy b in TzEndian . set_int32 res 0 r ; res |
let sequence ( T state ) n = State_hash . to_bytes state |> xor_higher_bits n |> fun b -> S ( State_hash . hash_bytes [ b ] ) |
let take ( S state ) = let b = State_hash . to_bytes state in let h = State_hash . hash_bytes [ b ] in ( State_hash . to_bytes h , S h ) |
let take_int32 s bound = if Compare . Int32 . ( bound <= 0l ) then invalid_arg " Seed_repr . take_int32 " else let drop_if_over = Int32 . sub Int32 . max_int ( Int32 . rem Int32 . max_int bound ) in let rec loop s = let ( bytes , s ) = take s in let r = Int32 . abs ( TzEndian . get_int32 bytes 0 ) in if Compare . Int32... |
let take_int64 s bound = if Compare . Int64 . ( bound <= 0L ) then invalid_arg " Seed_repr . take_int64 " else let drop_if_over = Int64 . sub Int64 . max_int ( Int64 . rem Int64 . max_int bound ) in let rec loop s = let ( bytes , s ) = take s in let r = Int64 . abs ( TzEndian . get_int64 bytes 0 ) in if Compare . Int64... |
let ( ) = register_error_kind ` Permanent ~ id " : unexpected_nonce_length " ~ title " : Unexpected nonce length " ~ description " : Nonce length is incorrect . " ~ pp ( : fun ppf ( ) -> Format . fprintf ppf " Nonce length is not % i bytes long as it should . " Constants_repr . nonce_length ) Data_encoding . empty ( fu... |
let make_nonce nonce = if Compare . Int . ( Bytes . length nonce <> Constants_repr . nonce_length ) then error Unexpected_nonce_length else ok nonce |
let hash nonce = Nonce_hash . hash_bytes [ nonce ] |
let check_hash nonce hash = Compare . Int . ( Bytes . length nonce = Constants_repr . nonce_length ) && Nonce_hash . equal ( Nonce_hash . hash_bytes [ nonce ] ) hash |
let initial_nonce_hash_0 = hash initial_nonce_0 |
let deterministic_seed seed = nonce seed zero_bytes |
let initial_seeds ? initial_seed n = let [ @ coq_struct " i " ] rec loop acc elt i = if Compare . Int . ( i = 1 ) then List . rev ( elt :: acc ) else loop ( elt :: acc ) ( deterministic_seed elt ) ( i - 1 ) in let first_seed = match initial_seed with | Some initial_seed -> nonce ( B initial_seed ) initial_nonce_0 | Non... |
type error += | Unknown of { oldest : Cycle_repr . t ; cycle : Cycle_repr . t ; latest : Cycle_repr . t ; } |
let ( ) = register_error_kind ` Permanent ~ id " : seed . unknown_seed " ~ title " : Unknown seed " ~ description " : The requested seed is not available " ~ pp ( : fun ppf ( oldest , cycle , latest ) -> if Cycle_repr . ( cycle < oldest ) then Format . fprintf ppf " The seed for cycle % a has been cleared from the cont... |
let compute_for_cycle c ~ revealed cycle = match Cycle_repr . pred cycle with | None -> assert false | Some previous_cycle -> let levels = Level_storage . levels_with_commitments_in_cycle c revealed in let combine ( c , random_seed , unrevealed ) level = Storage . Seed . Nonce . get c level >>=? function | Revealed non... |
let for_cycle ctxt cycle = let preserved = Constants_storage . preserved_cycles ctxt in let current_level = Level_storage . current ctxt in let current_cycle = current_level . cycle in let latest = if Cycle_repr . ( current_cycle = root ) then Cycle_repr . add current_cycle ( preserved + 1 ) else Cycle_repr . add curre... |
let init ? initial_seed ctxt = let preserved = Constants_storage . preserved_cycles ctxt in List . fold_left_es ( fun ( c , ctxt ) seed -> let cycle = Cycle_repr . of_int32_exn ( Int32 . of_int c ) in Storage . Seed . For_cycle . init ctxt cycle seed >|=? fun ctxt -> ( c + 1 , ctxt ) ) ( 0 , ctxt ) ( Seed_repr . initia... |
let cycle_end ctxt last_cycle = let preserved = Constants_storage . preserved_cycles ctxt in match Cycle_repr . pred last_cycle with | None -> return ( ctxt , [ ] ) | Some revealed -> let inited_seed_cycle = Cycle_repr . add last_cycle ( preserved + 1 ) in compute_for_cycle ctxt ~ revealed inited_seed_cycle |
let invalid_arg fmt = Format . ksprintf ( fun s -> invalid_arg s ) fmt |
let load_file filename = let ic = open_in_bin filename in let ln = in_channel_length ic in let rs = Bytes . create ln in let ( ) = really_input ic rs 0 ln in Bytes . unsafe_to_string rs |
let ( ) = let system , output = try match Sys . argv with | [ | _ ; " -- system " ; system ; " - o " ; output ] | -> let system = match system with | " linux " | " elf " -> ` Linux | " windows " | " mingw64 " | " mingw " | " cygwin " -> ` Windows | " freebsd " -> ` FreeBSD | " macosx " -> ` MacOSX | v -> if String . su... |
let other_window = Funcall . Wrap . ( " other - window " <: int @-> return nil ) |
let height = Funcall . Wrap . ( " window - height " <: nullary @-> return int ) |
let width = Funcall . Wrap . ( " window - width " <: nullary @-> return int ) |
let get = Funcall . Wrap . ( " selected - window " <: nullary @-> return Window . t ) |
let select_window = Funcall . Wrap . ( " select - window " <: Window . t @-> bool @-> return nil ) |
let set ( ? move_to_front_of_buffer_list = true ) window = select_window window ( not move_to_front_of_buffer_list ) ; ; |
module Blocking = struct let switch_to_buffer = Funcall . Wrap . ( " switch - to - buffer " <: Buffer . t @-> return nil ) end |
let switch_to_buffer buffer = Value . Private . run_outside_async [ % here ] ( fun ( ) -> Blocking . switch_to_buffer buffer ) ; ; |
let switch_to_buffer_other_window = let switch_to_buffer_other_window = Funcall . Wrap . ( " switch - to - buffer - other - window " <: Buffer . t @-> return nil ) in fun buffer -> Value . Private . run_outside_async [ % here ] ( fun ( ) -> switch_to_buffer_other_window buffer ) ; ; |
let split_horizontally_exn = Funcall . Wrap . ( " split - window - horizontally " <: nullary @-> return nil ) ; ; |
let split_sensibly_exn = Funcall . Wrap . ( " split - window - sensibly " <: nullary @-> return nil ) |
let split_vertically_exn = Funcall . Wrap . ( " split - window - vertically " <: nullary @-> return nil ) ; ; |
let find_file_other_window = Funcall . Wrap . ( " find - file - other - window " <: string @-> return nil ) ; ; |
let quit = let quit = Funcall . Wrap . ( " quit - window " <: nullary @-> return nil ) in fun ( ) -> Value . Private . run_outside_async [ % here ] quit ; ; |
let save_window_excursion sync_or_async f = Save_wrappers . save_window_excursion sync_or_async f ; ; |
let save_selected_window f = Save_wrappers . save_selected_window f |
let set_temporarily sync_or_async window ~ f = Save_wrappers . with_selected_window sync_or_async ( window |> Window . to_value ) f ; ; |
let find_file = let find_file = Funcall . Wrap . ( " find - file " <: string @-> return nil ) in fun path -> Value . Private . run_outside_async [ % here ] ( fun ( ) -> find_file path ) ; ; |
let view_file = let view_file = Funcall . Wrap . ( " view - file " <: string @-> return nil ) in fun path -> Value . Private . run_outside_async [ % here ] ( fun ( ) -> view_file path ) ; ; |
type environment = { vars : ( Reg . t array * Backend_var . Provenance . t option ) V . Map . t ; static_exceptions : Reg . t array list Int . Map . t ; } |
let env_add var regs env = let provenance = VP . provenance var in let var = VP . var var in { env with vars = V . Map . add var ( regs , provenance ) env . vars } |
let env_add_static_exception id v env = { env with static_exceptions = Int . Map . add id v env . static_exceptions } |
let env_find id env = let regs , _provenance = V . Map . find id env . vars in regs |
let env_find_static_exception id env = Int . Map . find id env . static_exceptions |
let env_empty = { vars = V . Map . empty ; static_exceptions = Int . Map . empty ; } |
let oper_result_type = function Capply ty -> ty | Cextcall ( _s , ty , _alloc , _ ) -> ty | Cload ( c , _ ) -> begin match c with | Word_val -> typ_val | Single | Double | Double_u -> typ_float | _ -> typ_int end | Calloc -> typ_val | Cstore ( _c , _ ) -> typ_void | Caddi | Csubi | Cmuli | Cmulhi | Cdivi | Cmodi | Cand... |
let size_component = function | Val | Addr -> Arch . size_addr | Int -> Arch . size_int | Float -> Arch . size_float |
let size_machtype mty = let size = ref 0 in for i = 0 to Array . length mty - 1 do size := ! size + size_component mty . ( i ) done ; ! size |
let size_expr ( env : environment ) exp = let rec size localenv = function Cconst_int _ | Cconst_natint _ -> Arch . size_int | Cconst_symbol _ | Cconst_pointer _ | Cconst_natpointer _ -> Arch . size_addr | Cconst_float _ -> Arch . size_float | Cblockheader _ -> Arch . size_int | Cvar id -> begin try V . Map . find id l... |
let swap_intcomp = function Isigned cmp -> Isigned ( swap_integer_comparison cmp ) | Iunsigned cmp -> Iunsigned ( swap_integer_comparison cmp ) |
let all_regs_anonymous rv = try for i = 0 to Array . length rv - 1 do if not ( Reg . anonymous rv . ( i ) ) then raise Exit done ; true with Exit -> false |
let name_regs id rv = let id = VP . var id in if Array . length rv = 1 then rv . ( 0 ) . raw_name <- Raw_name . create_from_var id else for i = 0 to Array . length rv - 1 do rv . ( i ) . raw_name <- Raw_name . create_from_var id ; rv . ( i ) . part <- Some i done |
let join env opt_r1 seq1 opt_r2 seq2 = match ( opt_r1 , opt_r2 ) with ( None , _ ) -> opt_r2 | ( _ , None ) -> opt_r1 | ( Some r1 , Some r2 ) -> let l1 = Array . length r1 in assert ( l1 = Array . length r2 ) ; let r = Array . make l1 Reg . dummy in for i = 0 to l1 - 1 do if Reg . anonymous r1 . ( i ) && Cmm . ge_compo... |
let join_array env rs = let some_res = ref None in for i = 0 to Array . length rs - 1 do let ( r , _ ) = rs . ( i ) in match r with | None -> ( ) | Some r -> match ! some_res with | None -> some_res := Some ( r , Array . map ( fun r -> r . typ ) r ) | Some ( r ' , types ) -> let types = Array . map2 ( fun r typ -> Cmm ... |
let current_function_name = ref " " |
module Effect = struct type t = | None | Raise | Arbitrary let join t1 t2 = match t1 , t2 with | None , t2 -> t2 | t1 , None -> t1 | Raise , Raise -> Raise | Arbitrary , _ | _ , Arbitrary -> Arbitrary let pure = function | None -> true | Raise | Arbitrary -> false end |
module Coeffect = struct type t = | None | Read_mutable | Arbitrary let join t1 t2 = match t1 , t2 with | None , t2 -> t2 | t1 , None -> t1 | Read_mutable , Read_mutable -> Read_mutable | Arbitrary , _ | _ , Arbitrary -> Arbitrary let copure = function | None -> true | Read_mutable | Arbitrary -> false end |
module Effect_and_coeffect : sig type t val none : t val arbitrary : t val effect : t -> Effect . t val coeffect : t -> Coeffect . t val pure_and_copure : t -> bool val effect_only : Effect . t -> t val coeffect_only : Coeffect . t -> t val join : t -> t -> t val join_list_map : ' a list -> ( ' a -> t ) -> t type t = E... |
let is_tail_call nargs = assert ( Reg . dummy . typ = Int ) ; let args = Array . make ( nargs + 1 ) Reg . dummy in let ( _loc_arg , stack_ofs ) = Proc . loc_arguments args in stack_ofs = 0 |
let _ = Simplif . is_tail_native_heuristic := is_tail_call |
let reset ( ) = current_function_name := " " |
let is_offset chunk n = match chunk with | Byte_unsigned | Byte_signed -> n >= 0 && n <= 255 | Sixteen_unsigned | Sixteen_signed -> n >= 0 && n <= 510 && n mod 2 == 0 | _ -> n >= 0 && n <= 1020 && n mod 4 == 0 Reg . createv ( begin let rec expand = function [ ] -> [ ] | Float :: tyl -> Int :: Int :: expand tyl | ty :: ... |
let fundecl f = ( new selector ) # emit_fundecl f |
let either l r = Arbitrary . either l r |
module Identity_case ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) = let name = " x <*? pure id = Either . case id id <$> x " type input = ( X . t , X . t ) Either . t F . t type output = X . t F . t let arbitrary = A . arbitrary ( either X . arbitrary X . arbitrary... |
module Distributive ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) = let name = " pure x <*? ( y *> z ) = ( pure x <*? y ) *> ( pure x <*? z ) " type input = ( X . t , Y . t ) Either . t * ( X . t -> Y . t ) QCheck . fun_ F . t * ( X . t -> Y . t )... |
module Associative ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) ( Z : Model . T0 ) = let name = " x <*? ( y <*? z ) = ( f <$> x ) <*? ( g <$> y ) <*? ( h <$> z ) " type input = ( Y . t , Z . t ) Either . t F . t * ( X . t , ( Y . t -> Z . t ) QCh... |
module Theorem1 ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) ( Z : Model . T0 ) = let name = " ( f <$> select x y ) = ( select ( Bifunctor . map_snd f <$> x ) ( ( ( ) % f ) <$> y ) ) " ; ; type input = ( X . t -> Z . t ) QCheck . fun_ * ( Y . t ,... |
module Theorem2 ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) ( Z : Model . T0 ) = let name = " ( select ( Bifunctor . map_fst f <$> x ) y ) = ( select x ( ( ) %> f ) <$> y ) ) " ; ; type input = ( X . t -> Y . t ) QCheck . fun_ * ( X . t , Z . t ... |
module Theorem3 ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) ( Z : Model . T0 ) = let name = " ( select x ( f <$> y ) ) = ( select ( Bifunctor . map_fst ( flip f ) <$> x ) ( ( ) |> \ <$> y ) ) " ; ; type input = ( X . t -> Y . t -> Z . t ) QCheck... |
module Theorem4 ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) = let name = " ( x <*? pure y ) = ( Either . case y id <$> x ) " type input = ( X . t , Y . t ) Either . t F . t * ( X . t -> Y . t ) QCheck . fun_ type output = Y . t F . t let arbitra... |
module Pure_right ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) = let name = " ( pure ( Right x ) <*? y ) = pure x " type input = X . t * ( Y . t -> X . t ) QCheck . fun_ F . t type output = X . t F . t let arbitrary = QCheck . ( pair X . arbitrar... |
module Pure_left ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) = let name = " ( pure ( Left x ) <*? y ) = ( ( ) |> x ) <$> y " type input = X . t * ( X . t -> Y . t ) QCheck . fun_ F . t type output = Y . t F . t let arbitrary = QCheck . ( pair X ... |
module Theorem5 ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) = let name = " f <*> g = apply f g " type input = ( X . t -> Y . t ) QCheck . fun_ F . t * X . t F . t type output = Y . t F . t let arbitrary = let open QCheck in pair ( A . arbitrary ... |
module Theorem6 ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( X : Model . T0 ) ( Y : Model . T0 ) ( Z : Model . T0 ) = let name = " ( x *> ( y <*? z ) ) = ( ( x *> y ) <*? z ) " type input = X . t F . t * ( Y . t , Z . t ) Either . t F . t * ( Y . t -> Z . t ) QCheck . fun_ F . t ty... |
module Cases ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( T : Sample . PACKAGE ) = struct module Applicative = Applicative . Cases ( F ) ( A ) ( T ) module Identity_case = Identity_case ( F ) ( A ) ( T . A ) module Distributive = Distributive ( F ) ( A ) ( T . A ) ( T . B ) module ... |
module Rigid_cases ( F : Preface_specs . SELECTIVE ) ( A : Model . T1 with type ' a t = ' a F . t ) ( T : Sample . PACKAGE ) = struct module Base_cases = Cases ( F ) ( A ) ( T ) module Theorem5 = Theorem5 ( F ) ( A ) ( T . A ) ( T . B ) module Theorem6 = Theorem6 ( F ) ( A ) ( T . A ) ( T . B ) ( T . C ) let cases n = ... |
type mode = | ExpandHigherSort | ExpandAll |
type instantiation = parameter option list |
type label = nonterminal * instantiation |
module Label = struct type t = label let equal ( nt1 , inst1 ) ( nt2 , inst2 ) = nt1 = nt2 && List . for_all2 ( Option . equal Parameters . equal ) inst1 inst2 let hash ( nt , inst ) = Hashtbl . hash ( nt , Misc . ListExtras . hash ( Option . hash Parameters . hash ) inst ) end |
let mangle_po ( po : parameter option ) = match po with | None -> " _ " | Some p -> Parameters . print false p |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.