text
stringlengths
0
601k
let xml ( ) = let export_controls = Widget_export . inline_content ( configuration ( ) ) in [ % html { | < div class " = navcontent - view flex - content " id " } =| div_display_id { " |></ div > < div class " = navcontent - controls " > < form class " = form - inline " id } =| export_id { |> } | export_controls { | < ...
let content ( ) : [ > Html_types . div ] Html . elt list = [ Ui_common . toggle_element ( fun s -> has_plot s ) ( xml ( ) ) ]
let simulation_info_offset_max ( simulation_info : Api_types_j . simulation_info ) : int = let plot_size = simulation_info . Api_types_j . simulation_info_output . Api_types_j . simulation_output_plot in max 0 ( plot_size - ( React . S . value point ) )
let update_offset ( update_offset_input : bool ) : unit = let simulation_model = React . S . value State_simulation . model in let simulation_info = State_simulation . t_simulation_info simulation_model in match simulation_info with | None -> ( ) | Some simulation_info -> if simulation_info . Api_types_j . simulation_i...
let plot_parameter ( ) : Api_types_j . plot_parameter = let point = React . S . value point in { Api_types_j . plot_limit_offset = Option_util . map ( fun x -> x . offset_current ) ( React . S . value offset ) ; Api_types_j . plot_limit_points = Some point ; }
let update_plot ( js_plot : Js_plot . observable_plot Js . t ) : unit = State_simulation . when_ready ~ label : __LOC__ ( fun manager -> let ( ) = update_offset true in ( manager # simulation_detail_plot ( plot_parameter ( ) ) ) >>= ( Api_common . result_bind_lwt ~ ok ( : fun ( plot : Api_types_t . plot ) -> let data =...
let onload_plot_points_input ( js_plot : Js_plot . observable_plot Js . t ) : unit = let plot_points_input_dom : Dom_html . inputElement Js . t = Tyxml_js . To_dom . of_input plot_points_input in let js_point : Js . js_string Js . t = Js . string ( string_of_int ( React . S . value point ) ) in let ( ) = plot_points_in...
let plot_ref = ref None
let tab_is_active , set_tab_is_active = React . S . create false
let onload ( ) = let plot_offset_input_dom = Tyxml_js . To_dom . of_input plot_offset_input in let ( ) = Widget_export . onload ( configuration ( ) ) in let plot : Js_plot . observable_plot Js . t = Js_plot . create_observable_plot div_display_id in let ( ) = onload_plot_points_input plot in let ( ) = plot_ref := Some ...
let plot_count = function | None -> 0 | Some state -> let open Api_types_t in state . simulation_info_output . simulation_output_plot
let navli ( ) = Ui_common . label_news tab_is_active ( fun state -> ( plot_count state ) )
let onresize ( ) = let ( ) = match ! plot_ref with | None -> ( ) | Some plot -> ( let model = React . S . value State_simulation . model in match State_simulation . model_simulation_info model with | None -> ( ) | Some _ -> update_plot plot ) in ( )
let navli ( ) = ReactiveData . RList . empty
let tab_is_active , set_tab_is_active = React . S . create false
let tab_was_active = ref false
let site a = [ a , None , Some ( Public_data . Bound_to 1 ) , None ]
let print_edge ( ( a , b ) , ( c , d ) ) list = Utility . print_newline ( Utility . print_site_graph [ a , site b ; c , site d ] list )
let content ( ) = let scc = State_project . on_project_change_async ~ on : tab_is_active ( ) ( React . S . const ( ) ) [ ] ( fun ( manager : Api . concrete_manager ) ( ) -> manager # get_potential_polymers ( Some Public_data . High ) ( Some Public_data . High ) >|= Result_util . fold ~ ok ( : fun ( _ , _ , scc ) -> let...
let parent_hide ( ) = set_tab_is_active false
let parent_shown ( ) = set_tab_is_active ! tab_was_active
let onload ( ) = let ( ) = Common . jquery_on " # navpolymers " " hide . bs . tab " ( fun _ -> let ( ) = tab_was_active := false in set_tab_is_active false ) in let ( ) = Common . jquery_on " # navpolymers " " shown . bs . tab " ( fun _ -> let ( ) = tab_was_active := true in set_tab_is_active true ) in ( )
let onresize ( ) : unit = ( )
let tab_is_active , set_tab_is_active = React . S . create false
let current_snapshot , set_current_snapshot = React . S . create ( None : ( string * Data . snapshot ) option )
type display_format = Kappa | Graph
let string_to_display_format = function | " Kappa " -> Some Kappa | " Graph " -> Some Graph | _ -> None
let display_format , set_display_format = React . S . create Kappa
let snapshot_count ( state : Api_types_j . simulation_info option ) : int = match state with | None -> 0 | Some state -> state . Api_types_j . simulation_info_output . Api_types_j . simulation_output_snapshots
let navli ( ) = Ui_common . badge ( fun state -> snapshot_count state )
let configuration_template id additional_handlers : Widget_export . configuration = let json_handler = Widget_export . export_json ~ serialize_json ( : fun ( ) -> ( match React . S . value current_snapshot with | None -> " null " | Some ( _ , s ) -> Data . string_of_snapshot s ) ) in let kappa_handler = { Widget_export...
let configuration_kappa ( ) : Widget_export . configuration = configuration_template " snapshot_kappa " [ ]
let configuration_graph ( ) : Widget_export . configuration = configuration_template " snapshot_graph " [ Widget_export . export_svg ~ svg_div_id : display_id ( ) ; Widget_export . export_png ~ svg_div_id : display_id ( ) ]
let render_snapshot_graph ( snapshot_js : Js_snapshot . snapshot Js . t ) ( snapshot : Data . snapshot ) : unit = let ( ) = Common . debug ( Js . string ( Data . string_of_snapshot snapshot ) ) in match React . S . value display_format with | Graph -> let json : string = Data . string_of_snapshot snapshot in let contac...
let select_snapshot snapshot_js = let index = Js . Opt . bind ( Ui_common . document ## getElementById ( Js . string select_id ) ) ( fun dom -> let snapshot_select_dom : Dom_html . inputElement Js . t = Js . Unsafe . coerce dom in let fileindex = Js . to_string ( snapshot_select_dom . ## value ) in try Js . some ( int_...
let select ( snapshots : Api_types_j . snapshot_id list ) = List . mapi ( fun i snapshot_id -> Html . option ~ a ( [ : Html . a_value ( string_of_int i ) ] @ if ( match ( React . S . value current_snapshot ) with | None -> false | Some ( filename , _ ) -> filename = snapshot_id ) then [ Html . a_selected ( ) ] else [ ]...
let snapshot_class : empty ( : unit -> ' a ) -> single ( : unit -> ' a ) -> multiple ( : unit -> ' a ) -> ' a React . signal = fun ~ empty ~ single ~ multiple -> React . S . map ( fun model -> let simulation_info = State_simulation . model_simulation_info model in match snapshot_count simulation_info with | 0 -> empty ...
let snapshot_js : Js_snapshot . snapshot Js . t = Js_snapshot . create_snapshot display_id State_settings . agent_coloring
let xml ( ) = let list , handle = ReactiveData . RList . create [ ] in let _ = React . S . map ( fun _ -> State_simulation . when_ready ~ label : __LOC__ ( fun manager -> manager # simulation_catalog_snapshot >>= ( Api_common . result_bind_lwt ~ ok ( : fun snapshot_ids -> let ( ) = ReactiveData . RList . set handle ( s...
let content ( ) = [ Ui_common . toggle_element ( fun state -> snapshot_count state > 0 ) ( xml ( ) ) ]
let onload ( ) : unit = let snapshot_select_dom : Dom_html . inputElement Js . t = Ui_common . id_dom select_id in let format_select_dom : Dom_html . inputElement Js . t = Ui_common . id_dom format_select_id in let ( ) = snapshot_select_dom . ## onchange := Dom_html . handler ( fun _ -> let ( ) = Common . debug ( " onc...
let onresize ( ) : unit = if React . S . value tab_is_active then snapshot_js ## redraw
let tab_is_active , set_tab_is_active = React . S . create false
let tab_was_active = ref false
let navli ( ) = ReactiveData . RList . empty
let none_checkbox = Html . input ~ a [ : Html . a_input_type ` Checkbox ] ( )
let weak_checkbox = Html . input ~ a [ : Html . a_input_type ` Checkbox ; Html . a_checked ( ) ] ( )
let strong_checkbox = Html . input ~ a [ : Html . a_input_type ` Checkbox ] ( )
let none_box = Tyxml_js . To_dom . of_input none_checkbox
let weak_box = Tyxml_js . To_dom . of_input weak_checkbox
let strong_box = Tyxml_js . To_dom . of_input strong_checkbox
let launch_button = Html . button ~ a [ : Html . a_class [ " btn " ; " btn - default " ] ; Html . a_button_type ` Submit ] [ Html . txt " Launch " ]
let story_list , list_control = React . S . create [ ]
let story_list_html = ReactiveData . RList . map ( fun ( id , cm ) -> Html . option ~ a [ : Html . a_value ( string_of_int id ) ] ( Html . txt ( Format . asprintf " [ @% i ( % a ) ] " @ id Kastor_client . print_compression_modes cm ) ) ) ( ReactiveData . RList . from_signal story_list )
let select_stories = Tyxml_js . R . Html5 . select story_list_html
let select_stories_dom = Tyxml_js . To_dom . of_select select_stories { |< form class " = form - inline " > < div class " = form - group " > < label > Compression level </ label > < div class " = checkbox " >< label } [ >| none_checkbox ] { | Causal </ label ></ div > < div class " = checkbox " >< label } [ >| weak_che...
let story_log , log_control = React . S . create [ ]
let current_info , set_info = React . S . create " "
let story_log_html = ReactiveData . RList . map ( fun line -> Html . txt ( line " ^\ n " ) ) ( ReactiveData . RList . rev ( ReactiveData . RList . from_signal story_log ) )
let log_div = Tyxml_js . R . Html5 . div ~ a [ : Html . a_class [ " panel - pre " ] ] story_log_html
let log_panel = [ Ui_common . navtabs " storylognavtab " [ " story_computation_log " , None , ReactiveData . RList . empty ; " story_info_log " , None , ReactiveData . RList . empty ] ; Ui_common . navcontent [ " panel - scroll " ] [ " story_computation_log " , [ ] , [ log_div ] ; " story_info_log " , [ " panel - pre "...
let story_graph = Js_story . create_story_rendering graph_display_id
let content ( ) = [ Html . div ~ a [ : Html . a_class [ " col - md - 5 " ; " flex - content " ] ] ( setup_form :: log_panel ) ; Html . div ~ a [ : Html . a_id graph_display_id ; Html . a_class [ " col - md - 7 " ; " flex - content " ] ] [ ] ]
let lift_result = function | Result . Ok x -> Result_util . ok x | Result . Error e -> Api_common . result_error_msg e
let do_update_compression_level ( ) = State_project . with_project ~ label " : Config compression " ( fun manager -> let causal = Js . to_bool none_box . ## checked in let weak = Js . to_bool weak_box . ## checked in let strong = Js . to_bool strong_box . ## checked in manager # config_story_computation { Api . causal ...
let update_compression_level = Dom_html . handler ( fun _ -> let _ = do_update_compression_level ( ) in Js . _false )
let set_a_story = let pred_id = ref max_int in fun ( ) -> let va = ( Js . to_string select_stories_dom . ## value ) in if va = " " then let ( ) = pred_id := max_int in Lwt . return ( Result_util . ok ( ) ) else let id = int_of_string va in if ! pred_id <> id then let ( ) = pred_id := id in State_project . with_project ...
let rec inspect_stories ( ) = State_project . with_project ~ label " : Stories list " ( fun manager -> let ( ) = list_control ( Mods . IntMap . fold ( fun id ( cm , _ , _ ) acc -> ( id , cm ) :: acc ) manager # story_list [ ] ) in let ( ) = log_control manager # story_log in set_a_story ( ) ) >>= fun _ -> State_project...
let parent_hide ( ) = set_tab_is_active false
let parent_shown ( ) = set_tab_is_active ! tab_was_active
let onload ( ) = let ( ) = Common . jquery_on " # navstories " " hide . bs . tab " ( fun _ -> let ( ) = tab_was_active := false in set_tab_is_active false ) in let ( ) = Common . jquery_on " # navstories " " shown . bs . tab " ( fun _ -> let ( ) = tab_was_active := true in let ( ) = set_tab_is_active true in let _ = do...
let onresize ( ) : unit = ( )
let debug_tactic name = if String . length name = 0 then ( ) else Debug . print " Tactic : % s . " @ name
module type Tactic = sig type tac val update_span : LexingUtil . span option -> tac -> tac val whnf : style : Semantics . whnf_style -> tac -> tac end
module Tp : sig include Tactic val rule : ? name : string -> S . tp RM . m -> tac val virtual_rule : ? name : string -> S . tp RM . m -> tac val run : tac -> S . tp RM . m val run_virtual : tac -> S . tp RM . m val map : ( S . tp RM . m -> S . tp RM . m ) -> tac -> tac end = struct type tac = | Virtual of string * S . ...
module rec Var : sig type tac val prf : D . cof -> tac val con : tac -> D . con val syn : tac -> Syn . tac val abstract : ? ident : Ident . t -> D . tp -> ( tac -> ' a RM . m ) -> ' a RM . m struct type tac = { tp : D . tp ; con : D . con } let prf phi = { tp = D . TpPrf phi ; con = D . Prf } let con { tp = _ ; con } =...
let is_total ( sign : D . sign ) = let rec go acc = function | D . Field ( ` User [ " fib " ] , _ , D . Clo ( [ ] , _ ) ) -> RM . ret @@ acc | D . Field ( lbl , ( D . ElStable ( ` Ext ( 0 , _ , ` Global ( Cof cof ) , _ ) ) as tp ) , sign_clo ) -> let * cof = RM . lift_cmp @@ Sem . cof_con_to_cof cof in RM . abstract ( ...
let elab_err err = let * env = RM . read in RM . throw @@ ElabError . ElabError ( err , RefineEnv . location env )
let match_goal ( tac : _ -> T . Chk . tac RM . m ) : T . Chk . tac = T . Chk . brule @@ fun goal -> let * tac = tac goal in T . Chk . brun tac goal
let rec elim_implicit_connectives : T . Syn . tac -> T . Syn . tac = fun tac -> T . Syn . rule @@ let * tm , tp = T . Syn . run @@ T . Syn . whnf ~ style ` : UnfoldAll tac in match tp with | D . Sub _ -> T . Syn . run @@ elim_implicit_connectives @@ R . Sub . elim @@ T . Syn . rule @@ RM . ret ( tm , tp ) | D . ElStabl...
let rec elim_implicit_connectives_and_total : T . Syn . tac -> T . Syn . tac = fun tac -> T . Syn . rule @@ let * tm , tp = T . Syn . run @@ T . Syn . whnf ~ style ` : UnfoldAll tac in match tp with | D . Sub _ -> T . Syn . run @@ elim_implicit_connectives_and_total @@ R . Sub . elim @@ T . Syn . rule @@ RM . ret ( tm ...
let rec intro_implicit_connectives : T . Chk . tac -> T . Chk . tac = fun tac -> T . Chk . whnf ~ style ` : UnfoldAll @@ match_goal @@ function | D . Sub _ , _ , _ -> RM . ret @@ R . Sub . intro @@ intro_implicit_connectives tac | D . ElStable _ , _ , _ -> RM . ret @@ R . El . intro @@ intro_implicit_connectives tac | ...
let rec intro_subtypes_and_total : T . Chk . tac -> T . Chk . tac = fun tac -> T . Chk . whnf ~ style ` : UnfoldNone @@ match_goal @@ function | D . Sub _ , _ , _ -> RM . ret @@ R . Sub . intro @@ intro_subtypes_and_total tac | ElStable ( ` Signature sign_code ) , _ , _ -> begin RM . lift_cmp @@ Sem . unfold_el ( ` Sig...
let intro_conversions ( tac : T . Syn . tac ) : T . Chk . tac = T . Chk . rule ~ name " : intro_conversions " @@ function | D . Univ | D . ElStable ` Univ as tp -> let * tm , tp ' = T . Syn . run tac in let * vtm = RM . lift_ev @@ Sem . eval tm in begin match tp ' with | D . Pi ( D . ElStable ( ` Signature vsign ) as b...
let rec tac_nary_quantifier ( quant : ( ' a , ' b ) R . quantifier ) cells body = match cells with | [ ] -> body | ( nm , tac ) :: cells -> quant tac ( nm , fun _ -> tac_nary_quantifier quant cells body )
module Elim = struct type case_tac = CS . pat * T . Chk . tac let rec find_case ( lbl : string list ) ( cases : case_tac list ) : ( CS . pat_arg list * T . Chk . tac ) option = match cases with | ( CS . Pat pat , tac ) :: _ when pat . lbl = lbl -> Some ( pat . args , tac ) | _ :: cases -> find_case lbl cases | [ ] -> N...
module Equations = struct let step ( code_tac : T . Chk . tac ) ( lhs_tac : T . Chk . tac ) ( mid_tac : T . Chk . tac ) ( rhs_tac : T . Chk . tac ) ( p_tac : T . Chk . tac ) ( q_tac : T . Chk . tac ) : T . Syn . tac = T . Syn . rule ~ name " : Equations . step " @@ let * code = RM . eval @<< T . Chk . run code_tac D . ...
let main ( ) = let top = opentk ( ) in let en1 = Entry . create top [ TextWidth 6 ; Relief Sunken ] in let lab1 = Label . create top [ Text " plus " ] in let en2 = Entry . create top [ TextWidth 6 ; Relief Sunken ] in let lab2 = Label . create top [ Text " " ] = in let result_display = Label . create top [ ] in let n1 ...
let _ = Printexc . catch main ( ) ; ;
module Dream = struct include Dream_pure include Dream_pure . Formats end
let csrf_tag ~ now request = let token = Csrf . csrf_token ~ now request in < input name " =<% s ! Csrf . field_name " %> type " = hidden " value " =<% s ! token " %>>
let form_tag ~ now ? method_ ? target ? enctype ? csrf_token ~ action request = let method_ = match method_ with | None -> Method . method_to_string ` POST | Some method_ -> Method . method_to_string method_ in let target = match target with | Some target -> " target " " =\ ^ Dream . html_escape target ^ " " " \ | None...
type _ selector = . .
module type DEF_ARG = sig val name : string type t val doc : string val pp : Format . formatter -> t -> unit end
module type DEF = sig include DEF_ARG type id val id : id type _ selector += Me : t selector val uid : int end
module Def ( X : DEF_ARG ) : DEF with type t = X . t = struct include X type id = Id let id = Id type _ selector += Me : t selector let uid = Obj . Extension_constructor . ( id @@ of_val @@ Me ) end
type ' a def = ( module DEF with type t = ' a )
let def ( type a ) ( ? doc = " undocumented " ) name pp = ( module Def ( struct let name = name type t = a let doc = doc let pp = pp end ) : DEF with type t = a )
type ( _ , _ ) eq = Refl : ( ' a , ' a ) eq
let maybe_eq : type a b . a def -> b def -> ( a , b ) eq option = fun s t -> let module S = ( val s ) in let module T = ( val t ) in match S . Me with T . Me -> Some Refl | _ -> None