Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pierre Letouzey
prog-lmfi
Commits
dd4c99da
Commit
dd4c99da
authored
Nov 19, 2019
by
Pierre Letouzey
Browse files
amelioration seance4
parent
5ac8bfba
Changes
1
Hide whitespace changes
Inline
Side-by-side
seance4.v
View file @
dd4c99da
...
...
@@ -91,7 +91,7 @@ Check ((1,2),(3,4)) : bintree nat 2.
Fixpoint
sumtree
n
:
bintree
nat
n
->
nat
:=
match
n
with
|
0
=>
fun
a
=>
a
|
S
n
=>
fun
a
=>
let
(
g
,
d
)
:=
a
in
sumtree
n
g
+
sumtree
n
d
|
S
n
=>
fun
'
(
g
,
d
)
=>
sumtree
n
g
+
sumtree
n
d
end
.
(
**
Et
pour
mettre
les
donn
é
es
aux
noeuds
au
lieu
des
feuilles
:
*
)
...
...
@@ -102,9 +102,15 @@ Inductive unit : Type := Tt. (* Un type singleton pour les feuilles *)
Fixpoint
bintree
'
(
A
:
Type
)
n
:=
match
n
with
|
0
=>
unit
|
S
n
=>
(
bintree
A
n
*
A
*
bintree
A
n
)
%
type
|
S
n
=>
(
bintree
'
A
n
*
A
*
bintree
'
A
n
)
%
type
end
.
Fixpoint
sumtree
'
n
:
bintree
'
nat
n
->
nat
:=
match
n
with
|
0
=>
fun
Tt
=>
0
|
S
n
=>
fun
'
(
g
,
a
,
d
)
=>
sumtree
'
n
g
+
a
+
sumtree
'
n
d
end
.
(
**
NB
:
on
a
utilis
é
ici
des
triplets
Coq
,
qui
ne
sont
pas
primitifs
(
paires
de
paires
).
On
aurait
plus
aussi
d
é
finir
un
type
inductif
ad
-
hoc
.
*
)
...
...
@@ -213,6 +219,7 @@ Check (Vcons 0 (Vcons 2 (Vcons 3 Vnil))).
(
**
Mais
cet
argument
[
n
]
est
toujours
l
à
en
interne
:
*
)
Set
Printing
All
.
Check
(
Vcons
0
(
Vcons
2
(
Vcons
3
Vnil
))).
Check
(
cons
0
(
cons
2
(
cons
3
nil
))).
Unset
Printing
All
.
...
...
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