package lambdapi

  1. Overview
  2. Docs
Proof assistant for the λΠ-calculus modulo rewriting

Install

dune-project
 Dependency

Authors

Maintainers

Sources

lambdapi-2.0.0.tbz
sha256=66d7d29f7a0d10493b8178c4c3aeb247971e24fab3eba1c54887e1b9a82fe005
sha512=69ecf2406e4c7225ab7f8ebe11624db5d2ab989c8f30f5b6e5d426fd8ef9102f142a2840af16fb9103bb712ebcf7d314635f8b413a05df66e7b7a38548867032

doc/src/lambdapi.lplib/rangeMap.ml.html

Source file rangeMap.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(************************************************************************)
(* The λΠ-modulo Interactive Proof Assistant *)
(************************************************************************)

(************************************************************************)
(* λΠ-modulo serialization Toplevel *)
(* Copyright Inria -- Dual License LGPL 2.1 / GPL3+                     *)
(* Written by: F. Blanqui, E. J. Gallego Arias, F. Lefoulon             *)
(************************************************************************)
(* Status: Experimental                                                 *)
(************************************************************************)

(* The functor for cursor maps. *)
module Make (Range : Range_intf.S) = struct
  (* A map of which keys are intervals. *)
  module Range = Range
  module RangeMap = Map.Make (Range)

  (* Now we need to transform the map so that : - the keys for "add" are
     intervals - the keys for "find" are points. *)
  type 'a t = (Range.t * 'a) RangeMap.t

  let point_to_interval pt = Range.make_interval pt pt

  let find cursor map =
    let interv = point_to_interval cursor in
    RangeMap.find_opt interv map

  let empty = RangeMap.empty
  let add interv elt map = RangeMap.add interv (interv, elt) map

  let to_string elt_to_string (map : 'a t) =
    let f key elt str =
      let _, e = elt in
      Range.interval_to_string key
      ^ "Token : " ^ elt_to_string e ^ "\n\n" ^ str
    in
    RangeMap.fold f map ""
end

(* The implementation of CursorMap using a functor. *)
include Make (Range)