Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
POTTIER Francois
menhir
Commits
a9857feb
Commit
a9857feb
authored
Jul 03, 2015
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some uses of [lazy] in favor of a more explicit module [Seq].
parent
db9e9e43
Changes
7
Hide whitespace changes
Inline
Sidebyside
Showing
7 changed files
with
57 additions
and
37 deletions
+57
37
src/BooleanWitness.ml
src/BooleanWitness.ml
+5
8
src/BooleanWitness.mli
src/BooleanWitness.mli
+3
7
src/CompletedNatWitness.ml
src/CompletedNatWitness.ml
+7
14
src/CompletedNatWitness.mli
src/CompletedNatWitness.mli
+3
6
src/Seq.ml
src/Seq.ml
+28
0
src/Seq.mli
src/Seq.mli
+9
0
src/grammar.ml
src/grammar.ml
+2
2
No files found.
src/BooleanWitness.ml
View file @
a9857feb
type
'
a
t
=

Reachable
of
'
a
list
Lazy
.
t

Reachable
of
'
a
Seq
.
seq

Unreachable
let
equal
p1
p2
=
...
...
@@ 14,10 +14,10 @@ let bottom =
Unreachable
let
epsilon
=
Reachable
(
lazy
[]
)
Reachable
Seq
.
empty
let
singleton
x
=
Reachable
(
lazy
[
x
]
)
Reachable
(
Seq
.
singleton
x
)
let
is_maximal
p
=
match
p
with
...
...
@@ 43,10 +43,7 @@ let min_lazy p1 p2 =
let
add
p1
p2
=
match
p1
,
p2
with

Reachable
xs1
,
Reachable
xs2
>
Reachable
(
(* The only list operation in the code! *)
lazy
(
Lazy
.
force
xs1
@
Lazy
.
force
xs2
)
)
Reachable
(
Seq
.
append
xs1
xs2
)

_
,
_
>
Unreachable
...
...
@@ 60,6 +57,6 @@ let add_lazy p1 p2 =
let
print
conv
p
=
match
p
with

Reachable
xs
>
String
.
concat
" "
(
List
.
map
conv
(
Lazy
.
force
xs
))
String
.
concat
" "
(
List
.
map
conv
(
Seq
.
elements
xs
))

Unreachable
>
"unreachable"
src/BooleanWitness.mli
View file @
a9857feb
(* This is an enriched version of [Boolean], where we compute not just a
Boolean property, [Unreachable] or [Reachable], but also (in the latter
case) a path (a list). During the fixed point computation, instead of
manipulating actual lists, we manipulate only recipes for constructing
lists. These recipes can be evaluated by the user after the fixed point has
been reached. *)
case) a path (a sequence). *)
(* A property is either [Reachable xs], where [xs] is a (recipe for
constructing a) path; or [Unreachable]. *)
(* A property is either [Reachable xs], where [xs] is a path; or [Unreachable]. *)
type
'
a
t
=

Reachable
of
'
a
list
Lazy
.
t

Reachable
of
'
a
Seq
.
seq

Unreachable
val
bottom
:
'
a
t
...
...
src/CompletedNatWitness.ml
View file @
a9857feb
(* This is an enriched version of [CompletedNat], where we compute not just
numbers, but also lists of matching length. During the fixed point
computation, instead of manipulating actual lists, we manipulate only
recipes for constructing lists. These recipes can be evaluated by the user
after the fixed point has been reached. *)
numbers, but also sequences of matching length. *)
(* A property is either [Finite (n, xs)], where [n] is a natural number and
[xs] is a
(recipe for constructing a) list
of length [n]; or [Infinity]. *)
[xs] is a
sequence
of length [n]; or [Infinity]. *)
type
'
a
t
=

Finite
of
int
*
'
a
list
Lazy
.
t

Finite
of
int
*
'
a
Seq
.
seq

Infinity
let
equal
p1
p2
=
...
...
@@ 24,10 +21,10 @@ let bottom =
Infinity
let
epsilon
=
Finite
(
0
,
lazy
[]
)
Finite
(
0
,
Seq
.
empty
)
let
singleton
x
=
Finite
(
1
,
lazy
[
x
]
)
Finite
(
1
,
Seq
.
singleton
x
)
let
is_maximal
p
=
match
p
with
...
...
@@ 65,11 +62,7 @@ let until_finite p1 p2 =
let
add
p1
p2
=
match
p1
,
p2
with

Finite
(
i1
,
xs1
)
,
Finite
(
i2
,
xs2
)
>
Finite
(
i1
+
i2
,
(* The only list operation in the code! *)
lazy
(
Lazy
.
force
xs1
@
Lazy
.
force
xs2
)
)
Finite
(
i1
+
i2
,
Seq
.
append
xs1
xs2
)

_
,
_
>
Infinity
...
...
@@ 84,6 +77,6 @@ let print conv p =
match
p
with

Finite
(
i
,
xs
)
>
string_of_int
i
^
" "
^
String
.
concat
" "
(
List
.
map
conv
(
Lazy
.
force
xs
))
String
.
concat
" "
(
List
.
map
conv
(
Seq
.
elements
xs
))

Infinity
>
"infinity"
src/CompletedNatWitness.mli
View file @
a9857feb
(* This is an enriched version of [CompletedNat], where we compute not just
numbers, but also lists of matching length. During the fixed point
computation, instead of manipulating actual lists, we manipulate only
recipes for constructing lists. These recipes can be evaluated by the user
after the fixed point has been reached. *)
numbers, but also sequences of matching length. *)
(* A property is either [Finite (n, xs)], where [n] is a natural number and
[xs] is a
(recipe for constructing a) list
of length [n]; or [Infinity]. *)
[xs] is a
sequence
of length [n]; or [Infinity]. *)
type
'
a
t
=

Finite
of
int
*
'
a
list
Lazy
.
t

Finite
of
int
*
'
a
Seq
.
seq

Infinity
val
bottom
:
'
a
t
...
...
src/Seq.ml
0 → 100644
View file @
a9857feb
(* Sequences with constant time concatenation and lineartime conversion
to an ordinary list. *)
type
'
a
seq
=

SZero

SOne
of
'
a

SConcat
of
'
a
seq
*
'
a
seq
let
empty
=
SZero
let
singleton
x
=
SOne
x
let
append
xs
ys
=
SConcat
(
xs
,
ys
)
let
rec
elements
xs
accu
=
match
xs
with

SZero
>
accu

SOne
x
>
x
::
accu

SConcat
(
xs1
,
xs2
)
>
elements
xs1
(
elements
xs2
accu
)
let
elements
xs
=
elements
xs
[]
src/Seq.mli
0 → 100644
View file @
a9857feb
(* Sequences with constant time concatenation and lineartime conversion
to an ordinary list. *)
type
'
a
seq
val
empty
:
'
a
seq
val
singleton
:
'
a
>
'
a
seq
val
append
:
'
a
seq
>
'
a
seq
>
'
a
seq
val
elements
:
'
a
seq
>
'
a
list
src/grammar.ml
View file @
a9857feb
...
...
@@ 1036,13 +1036,13 @@ module MINIMAL =
(
struct
open
CompletedNatWitness
(* A terminal symbol has length 1. *)
let
terminal
t
=
Finite
(
1
,
lazy
[
t
])
let
terminal
=
singleton
(* The length of an alternative is the minimum length of any branch. *)
let
disjunction
=
min_lazy
(* The length of a sequence is the sum of the lengths of the members. *)
let
conjunction
_
=
add_lazy
(* The epsilon sequence has length 0. *)
let
epsilon
=
Finite
(
0
,
lazy
[]
)
let
epsilon
=
epsilon
end
)
(*  *)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment