Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tej Chajed
iris
Commits
d26dfb1c
Commit
d26dfb1c
authored
Feb 22, 2016
by
Ralf Jung
Browse files
add a notion of consing a funcion, and notation for it
parent
c305d664
Changes
1
Hide whitespace changes
Inline
Sidebyside
prelude/functions.v
View file @
d26dfb1c
...
@@ 29,3 +29,26 @@ Section functions.
...
@@ 29,3 +29,26 @@ Section functions.
Proof
.
unfold
alter
,
fn_alter
.
by
destruct
(
decide
(
a
=
b
)).
Qed
.
Proof
.
unfold
alter
,
fn_alter
.
by
destruct
(
decide
(
a
=
b
)).
Qed
.
End
functions
.
End
functions
.
(** "Consing" of functions from nat to T *)
Section
fcons
.
Context
{
T
:
Type
}.
Definition
fn_cons
(
t
:
T
)
(
f
:
nat
→
T
)
:
nat
→
T
:
=
λ
n
,
match
n
with

O
=>
t

S
n
=>
f
n
end
.
Definition
fn_mcons
(
ts
:
list
T
)
(
f
:
nat
→
T
)
:
nat
→
T
:
=
fold_right
fn_cons
f
ts
.
End
fcons
.
Infix
".::"
:
=
fn_cons
(
at
level
60
,
right
associativity
)
:
C_scope
.
Infix
".++"
:
=
fn_mcons
(
at
level
60
,
right
associativity
)
:
C_scope
.
Lemma
fn_mcons_app
{
T
:
Type
}
(
ts1
ts2
:
list
T
)
f
:
(
ts1
++
ts2
)
.++
f
=
ts1
.++
(
ts2
.++
f
).
Proof
.
unfold
fn_mcons
.
rewrite
fold_right_app
.
done
.
Qed
.
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