Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cpdt
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
research
cpdt
Commits
cd2d77eb
Commit
cd2d77eb
authored
Oct 14, 2008
by
Adam Chlipala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DepList
parent
f5213d37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
1 deletion
+77
-1
Makefile
Makefile
+1
-1
DepList.v
src/DepList.v
+76
-0
No files found.
Makefile
View file @
cd2d77eb
MODULES_NODOC
:=
Tactics MoreSpecif
MODULES_NODOC
:=
Tactics MoreSpecif
DepList
MODULES_PROSE
:=
Intro
MODULES_CODE
:=
StackMachine InductiveTypes Predicates Coinductive Subset
\
MoreDep DataStruct
...
...
src/DepList.v
0 → 100644
View file @
cd2d77eb
(
*
Copyright
(
c
)
2008
,
Adam
Chlipala
*
*
This
work
is
licensed
under
a
*
Creative
Commons
Attribution
-
Noncommercial
-
No
Derivative
Works
3.0
*
Unported
License
.
*
The
license
text
is
available
at
:
*
http
:
//creativecommons.org/licenses/by-nc-nd/3.0/
*
)
(
*
Dependent
list
types
presented
in
Chapter
8
*
)
Require
Import
List
.
Set
Implicit
Arguments
.
Section
ilist
.
Variable
A
:
Set
.
Fixpoint
ilist
(
n
:
nat
)
:
Set
:=
match
n
with
|
O
=>
unit
|
S
n
'
=>
A
*
ilist
n
'
end
%
type
.
Fixpoint
index
(
n
:
nat
)
:
Set
:=
match
n
with
|
O
=>
Empty_set
|
S
n
'
=>
option
(
index
n
'
)
end
.
Fixpoint
get
(
n
:
nat
)
:
ilist
n
->
index
n
->
A
:=
match
n
return
ilist
n
->
index
n
->
A
with
|
O
=>
fun
_
idx
=>
match
idx
with
end
|
S
n
'
=>
fun
ls
idx
=>
match
idx
with
|
None
=>
fst
ls
|
Some
idx
'
=>
get
n
'
(
snd
ls
)
idx
'
end
end
.
End
ilist
.
Implicit
Arguments
get
[
A
n
]
.
Section
hlist
.
Variable
A
:
Type
.
Variable
B
:
A
->
Type
.
Fixpoint
hlist
(
ls
:
list
A
)
:
Type
:=
match
ls
with
|
nil
=>
unit
|
x
::
ls
'
=>
B
x
*
hlist
ls
'
end
%
type
.
Variable
elm
:
A
.
Fixpoint
member
(
ls
:
list
A
)
:
Type
:=
match
ls
with
|
nil
=>
Empty_set
|
x
::
ls
'
=>
(
x
=
elm
)
+
member
ls
'
end
%
type
.
Fixpoint
hget
(
ls
:
list
A
)
:
hlist
ls
->
member
ls
->
B
elm
:=
match
ls
return
hlist
ls
->
member
ls
->
B
elm
with
|
nil
=>
fun
_
idx
=>
match
idx
with
end
|
_
::
ls
'
=>
fun
mls
idx
=>
match
idx
with
|
inl
pf
=>
match
pf
with
|
refl_equal
=>
fst
mls
end
|
inr
idx
'
=>
hget
ls
'
(
snd
mls
)
idx
'
end
end
.
End
hlist
.
Implicit
Arguments
hget
[
A
B
elm
ls
]
.
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