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
5dc3468b
Commit
5dc3468b
authored
Jan 20, 2013
by
Adam Chlipala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass through Chapter 6
parent
c9ac2de3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
Subset.v
src/Subset.v
+11
-5
No files found.
src/Subset.v
View file @
5dc3468b
...
@@ -161,8 +161,8 @@ We rewrite [pred_strong1], using some syntactic sugar for subset types. *)
...
@@ -161,8 +161,8 @@ We rewrite [pred_strong1], using some syntactic sugar for subset types. *)
Locate
"{ _ : _ | _ }"
.
Locate
"{ _ : _ | _ }"
.
(
**
%
\
vspace
{-
.15
in
}%
[[
(
**
%
\
vspace
{-
.15
in
}%
[[
Notation
Notation
"{ x : A | P }"
:=
sig
(
fun
x
:
A
=>
P
)
"{ x : A | P }"
:=
sig
(
fun
x
:
A
=>
P
)
]]
]]
*
)
*
)
...
@@ -209,6 +209,12 @@ Definition pred_strong3 (s : {n : nat | n > 0}) : {m : nat | proj1_sig s = S m}
...
@@ -209,6 +209,12 @@ Definition pred_strong3 (s : {n : nat | n > 0}) : {m : nat | proj1_sig s = S m}
|
exist
(
S
n
'
)
pf
=>
exist
_
n
'
(
eq_refl
_
)
|
exist
(
S
n
'
)
pf
=>
exist
_
n
'
(
eq_refl
_
)
end
.
end
.
(
*
begin
hide
*
)
(
*
begin
thide
*
)
Definition
ugh
:=
lt
.
(
*
end
thide
*
)
(
*
end
hide
*
)
Eval
compute
in
pred_strong3
(
exist
_
2
two_gt0
)
.
Eval
compute
in
pred_strong3
(
exist
_
2
two_gt0
)
.
(
**
%
\
vspace
{-
.15
in
}%
[[
(
**
%
\
vspace
{-
.15
in
}%
[[
=
exist
(
fun
m
:
nat
=>
2
=
S
m
)
1
(
eq_refl
2
)
=
exist
(
fun
m
:
nat
=>
2
=
S
m
)
1
(
eq_refl
2
)
...
@@ -370,7 +376,7 @@ Program Definition pred_strong6 (n : nat) (_ : n > 0) : {m : nat | n = S m} :=
...
@@ -370,7 +376,7 @@ Program Definition pred_strong6 (n : nat) (_ : n > 0) : {m : nat | n = S m} :=
|
S
n
'
=>
n
'
|
S
n
'
=>
n
'
end
.
end
.
(
**
Printing
the
resulting
definition
of
[
pred_strong6
]
yields
a
term
very
similar
to
what
we
built
with
[
refine
]
.
[
Program
]
can
save
time
in
writing
programs
that
use
subset
types
.
Nonetheless
,
[
refine
]
is
often
just
as
effective
,
and
[
refine
]
gives
you
more
control
over
the
form
the
final
term
takes
,
which
can
be
useful
when
you
want
to
prove
additional
theorems
about
your
definition
.
[
Program
]
will
sometimes
insert
type
casts
that
can
complicate
theorem
proving
.
*
)
(
**
Printing
the
resulting
definition
of
[
pred_strong6
]
yields
a
term
very
similar
to
what
we
built
with
[
refine
]
.
[
Program
]
can
save
time
in
writing
programs
that
use
subset
types
.
Nonetheless
,
[
refine
]
is
often
just
as
effective
,
and
[
refine
]
gives
more
control
over
the
form
the
final
term
takes
,
which
can
be
useful
when
you
want
to
prove
additional
theorems
about
your
definition
.
[
Program
]
will
sometimes
insert
type
casts
that
can
complicate
theorem
proving
.
*
)
Eval
compute
in
pred_strong6
two_gt0
.
Eval
compute
in
pred_strong6
two_gt0
.
(
**
%
\
vspace
{-
.15
in
}%
[[
(
**
%
\
vspace
{-
.15
in
}%
[[
...
@@ -383,7 +389,7 @@ In this case, we see that the new definition yields the same computational behav
...
@@ -383,7 +389,7 @@ In this case, we see that the new definition yields the same computational behav
(
**
*
Decidable
Proposition
Types
*
)
(
**
*
Decidable
Proposition
Types
*
)
(
**
There
is
another
type
in
the
standard
library
which
captures
the
idea
of
program
values
that
indicate
which
of
two
propositions
is
true
.%
\
index
{
Gallina
terms
!
sumbool
}%
*
)
(
**
There
is
another
type
in
the
standard
library
that
captures
the
idea
of
program
values
that
indicate
which
of
two
propositions
is
true
.%
\
index
{
Gallina
terms
!
sumbool
}%
*
)
Print
sumbool
.
Print
sumbool
.
(
**
%
\
vspace
{-
.15
in
}%
[[
(
**
%
\
vspace
{-
.15
in
}%
[[
...
...
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