package coq-core

  1. Overview
  2. Docs
The Coq Proof Assistant -- Core Binaries and Tools

Install

Dune Dependency

Authors

Maintainers

Sources

coq-8.19.1.tar.gz
md5=13d2793fc6413aac5168822313e4864e
sha512=ec8379df34ba6e72bcf0218c66fef248b0e4c5c436fb3f2d7dd83a2c5f349dd0874a67484fcf9c0df3e5d5937d7ae2b2a79274725595b4b0065a381f70769b42

doc/coq-core.lib/Rtree/index.html

Module RtreeSource

Sourcetype 'a t

Type of regular tree with nodes labelled by values of type 'a The implementation uses de Bruijn indices, so binding capture is avoided by the lift operator (see example below).

Note that it differs from standard regular trees by accepting vectors of vectors in nodes, which is useful for encoding disjunctive-conjunctive recursive trees such as inductive types. Standard regular trees can however easily be simulated by using singletons of vectors

Building trees

Sourceval mk_node : 'a -> 'a t array array -> 'a t

Build a node given a label and a vector of vectors of sons

Sourceval mk_rec_calls : int -> 'a t array

Build mutually recursive trees: X_1 = f_1(X_1,..,X_n) ... X_n = f_n(X_1,..,X_n) is obtained by the following pseudo-code let vx = mk_rec_calls n in let |x_1;..;x_n| = mk_rec|f_1(vx.(0),..,vx.(n-1);..;f_n(vx.(0),..,vx.(n-1))|

First example: build rec X = a(X,Y) and Y = b(X,Y,Y) let |vx;vy| = mk_rec_calls 2 in let |x;y| = mk_rec |mk_node a [|[|vx;vy|]|]; mk_node b [|[|vx;vy;vy|]|]|

Another example: nested recursive trees rec Y = b(rec X = a(X,Y),Y,Y) let |vy| = mk_rec_calls 1 in let |vx| = mk_rec_calls 1 in let |x| = mk_rec|mk_node a [|[|vx;lift 1 vy|]|]| let |y| = mk_rec|mk_node b [|[|x;vy;vy|]|]| (note the lift so that Y links to the "rec Y" skipping the "rec X")

Sourceval mk_rec : 'a t array -> 'a t array
Sourceval lift : int -> 'a t -> 'a t

lift k t increases of k the free parameters of t. Needed to avoid captures when a tree appears under mk_rec

Sourceval is_node : 'a t -> bool
Sourceval dest_node : 'a t -> 'a * 'a t array array

Destructors (recursive calls are expanded)

Sourceval dest_var : 'a t -> int * int

dest_var is not needed for closed trees (i.e. with no free variable)

Sourceval is_infinite : ('a -> 'a -> bool) -> 'a t -> bool

Tells if a tree has an infinite branch. The first arg is a comparison used to detect already seen elements, hence loops

Sourceval equiv : ('a -> 'a -> bool) -> ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

Rtree.equiv eq eqlab t1 t2 compares t1 t2 (top-down). If t1 and t2 are both nodes, eqlab is called on their labels, in case of success deeper nodes are examined. In case of loop (detected via structural equality parametrized by eq), then the comparison is successful.

Sourceval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

Rtree.equal eq t1 t2 compares t1 and t2, first via physical equality, then by structural equality (using eq on elements), then by logical equivalence Rtree.equiv eq eq

Sourceval inter : ('a -> 'a -> bool) -> ('a -> 'a -> 'a option) -> 'a -> 'a t -> 'a t -> 'a t
Sourceval incl : ('a -> 'a -> bool) -> ('a -> 'a -> 'a option) -> 'a -> 'a t -> 'a t -> bool

Iterators

Sourceval map : ('a -> 'b) -> 'a t -> 'b t

See also Smart.map

Sourceval pr_tree : ('a -> Pp.t) -> 'a t -> Pp.t

Pretty-printer

Sourcemodule Smart : sig ... end
OCaml

Innovation. Community. Security.