Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adam
stdpp
Commits
9b4ce6dd
Commit
9b4ce6dd
authored
5 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Rename `fin_of_nat` → `nat_to_fin` to follow the conventions.
parent
f0d2b68d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+3
-0
3 additions, 0 deletions
CHANGELOG.md
theories/fin.v
+4
-4
4 additions, 4 deletions
theories/fin.v
theories/finite.v
+2
-2
2 additions, 2 deletions
theories/finite.v
theories/vector.v
+4
-4
4 additions, 4 deletions
theories/vector.v
with
13 additions
and
10 deletions
CHANGELOG.md
+
3
−
0
View file @
9b4ce6dd
...
@@ -16,6 +16,9 @@ API-breaking change is listed.
...
@@ -16,6 +16,9 @@ API-breaking change is listed.
-
Add
`set_solver`
support for
`dom`
.
-
Add
`set_solver`
support for
`dom`
.
-
Rename
`vec_to_list_of_list`
into
`vec_to_list_to_vec`
, and add new lemma
-
Rename
`vec_to_list_of_list`
into
`vec_to_list_to_vec`
, and add new lemma
`list_to_vec_to_list`
for the converse.
`list_to_vec_to_list`
for the converse.
-
Rename
`fin_of_nat`
into
`nat_to_fin`
,
`fin_to_of_nat`
into
`fin_to_nat_to_fin`
, and
`fin_of_to_nat`
into
`nat_to_fin_to_nat`
, to follow
the conventions.
-
Add
`Countable`
instance for
`vec`
.
-
Add
`Countable`
instance for
`vec`
.
-
Introduce
`destruct_or{?,!}`
to repeatedly destruct disjunctions in
-
Introduce
`destruct_or{?,!}`
to repeatedly destruct disjunctions in
assumptions. The tactic can also be provided an explicit assumption name;
assumptions. The tactic can also be provided an explicit assumption name;
...
...
This diff is collapsed.
Click to expand it.
theories/fin.v
+
4
−
4
View file @
9b4ce6dd
...
@@ -31,7 +31,7 @@ Fixpoint fin_to_nat {n} (i : fin n) : nat :=
...
@@ -31,7 +31,7 @@ Fixpoint fin_to_nat {n} (i : fin n) : nat :=
match
i
with
0
%
fin
=>
0
|
FS
i
=>
S
(
fin_to_nat
i
)
end
.
match
i
with
0
%
fin
=>
0
|
FS
i
=>
S
(
fin_to_nat
i
)
end
.
Coercion
fin_to_nat
:
fin
>->
nat
.
Coercion
fin_to_nat
:
fin
>->
nat
.
Notation
fin_of_nat
:=
Fin
.
of_nat_lt
.
Notation
nat_to_fin
:=
Fin
.
of_nat_lt
.
Notation
fin_rect2
:=
Fin
.
rect2
.
Notation
fin_rect2
:=
Fin
.
rect2
.
Instance
fin_dec
{
n
}
:
EqDecision
(
fin
n
)
.
Instance
fin_dec
{
n
}
:
EqDecision
(
fin
n
)
.
...
@@ -81,12 +81,12 @@ Qed.
...
@@ -81,12 +81,12 @@ Qed.
Lemma
fin_to_nat_lt
{
n
}
(
i
:
fin
n
)
:
fin_to_nat
i
<
n
.
Lemma
fin_to_nat_lt
{
n
}
(
i
:
fin
n
)
:
fin_to_nat
i
<
n
.
Proof
.
induction
i
;
simpl
;
lia
.
Qed
.
Proof
.
induction
i
;
simpl
;
lia
.
Qed
.
Lemma
fin_to_
of_
nat
n
m
(
H
:
n
<
m
)
:
fin_to_nat
(
fin_of_nat
H
)
=
n
.
Lemma
fin_to_nat
_to_fin
n
m
(
H
:
n
<
m
)
:
fin_to_nat
(
nat_to_fin
H
)
=
n
.
Proof
.
Proof
.
revert
m
H
.
induction
n
;
intros
[|?];
simpl
;
auto
;
intros
;
exfalso
;
lia
.
revert
m
H
.
induction
n
;
intros
[|?];
simpl
;
auto
;
intros
;
exfalso
;
lia
.
Qed
.
Qed
.
Lemma
fin
_of
_to_nat
{
n
}
(
i
:
fin
n
)
H
:
@
fin_of_nat
(
fin_to_nat
i
)
n
H
=
i
.
Lemma
nat_to_
fin_to_nat
{
n
}
(
i
:
fin
n
)
H
:
@
nat_to_fin
(
fin_to_nat
i
)
n
H
=
i
.
Proof
.
apply
(
inj
fin_to_nat
),
fin_to_
of_
nat
.
Qed
.
Proof
.
apply
(
inj
fin_to_nat
),
fin_to_nat
_to_fin
.
Qed
.
Fixpoint
fin_plus_inv
{
n1
n2
}
:
∀
(
P
:
fin
(
n1
+
n2
)
→
Type
)
Fixpoint
fin_plus_inv
{
n1
n2
}
:
∀
(
P
:
fin
(
n1
+
n2
)
→
Type
)
(
H1
:
∀
i1
:
fin
n1
,
P
(
Fin
.
L
n2
i1
))
(
H1
:
∀
i1
:
fin
n1
,
P
(
Fin
.
L
n2
i1
))
...
...
This diff is collapsed.
Click to expand it.
theories/finite.v
+
2
−
2
View file @
9b4ce6dd
...
@@ -82,8 +82,8 @@ Qed.
...
@@ -82,8 +82,8 @@ Qed.
Lemma
decode_encode_fin
`{
Finite
A
}
(
x
:
A
)
:
decode_fin
(
encode_fin
x
)
=
x
.
Lemma
decode_encode_fin
`{
Finite
A
}
(
x
:
A
)
:
decode_fin
(
encode_fin
x
)
=
x
.
Proof
.
Proof
.
unfold
decode_fin
,
encode_fin
.
destruct
(
Some_dec
_)
as
[[
x'
Hx
]|
Hx
]
.
unfold
decode_fin
,
encode_fin
.
destruct
(
Some_dec
_)
as
[[
x'
Hx
]|
Hx
]
.
{
by
rewrite
fin_to_
of_
nat
,
decode_encode_nat
in
Hx
;
simplify_eq
.
}
{
by
rewrite
fin_to_nat
_to_fin
,
decode_encode_nat
in
Hx
;
simplify_eq
.
}
exfalso
;
by
rewrite
->
fin_to_
of_
nat
,
decode_encode_nat
in
Hx
.
exfalso
;
by
rewrite
->
fin_to_nat
_to_fin
,
decode_encode_nat
in
Hx
.
Qed
.
Qed
.
Lemma
fin_choice
{
n
}
{
B
:
fin
n
→
Type
}
(
P
:
∀
i
,
B
i
→
Prop
)
:
Lemma
fin_choice
{
n
}
{
B
:
fin
n
→
Type
}
(
P
:
∀
i
,
B
i
→
Prop
)
:
...
...
This diff is collapsed.
Click to expand it.
theories/vector.v
+
4
−
4
View file @
9b4ce6dd
...
@@ -181,20 +181,20 @@ Proof.
...
@@ -181,20 +181,20 @@ Proof.
induction
v
as
[|?
?
v
IH
];
inv_fin
i
.
simpl
;
split
;
congruence
.
done
.
induction
v
as
[|?
?
v
IH
];
inv_fin
i
.
simpl
;
split
;
congruence
.
done
.
Qed
.
Qed
.
Lemma
vlookup_lookup'
{
A
n
}
(
v
:
vec
A
n
)
(
i
:
nat
)
x
:
Lemma
vlookup_lookup'
{
A
n
}
(
v
:
vec
A
n
)
(
i
:
nat
)
x
:
(
∃
H
:
i
<
n
,
v
!!!
(
fin_of_nat
H
)
=
x
)
↔
(
v
:
list
A
)
!!
i
=
Some
x
.
(
∃
H
:
i
<
n
,
v
!!!
nat_to_fin
H
=
x
)
↔
(
v
:
list
A
)
!!
i
=
Some
x
.
Proof
.
Proof
.
split
.
split
.
-
intros
[
Hlt
?]
.
rewrite
<-
(
fin_to_
of_
nat
i
n
Hlt
)
.
by
apply
vlookup_lookup
.
-
intros
[
Hlt
?]
.
rewrite
<-
(
fin_to_nat
_to_fin
i
n
Hlt
)
.
by
apply
vlookup_lookup
.
-
intros
Hvix
.
assert
(
Hlt
:=
lookup_lt_Some
_
_
_
Hvix
)
.
-
intros
Hvix
.
assert
(
Hlt
:=
lookup_lt_Some
_
_
_
Hvix
)
.
rewrite
vec_to_list_length
in
Hlt
.
exists
Hlt
.
rewrite
vec_to_list_length
in
Hlt
.
exists
Hlt
.
apply
vlookup_lookup
.
by
rewrite
fin_to_
of_
nat
.
apply
vlookup_lookup
.
by
rewrite
fin_to_nat
_to_fin
.
Qed
.
Qed
.
Lemma
elem_of_vlookup
{
A
n
}
(
v
:
vec
A
n
)
x
:
Lemma
elem_of_vlookup
{
A
n
}
(
v
:
vec
A
n
)
x
:
x
∈
vec_to_list
v
↔
∃
i
,
v
!!!
i
=
x
.
x
∈
vec_to_list
v
↔
∃
i
,
v
!!!
i
=
x
.
Proof
.
Proof
.
rewrite
elem_of_list_lookup
.
setoid_rewrite
<-
vlookup_lookup'
.
rewrite
elem_of_list_lookup
.
setoid_rewrite
<-
vlookup_lookup'
.
split
;
[
by
intros
(?
&
?
&
?);
eauto
|]
.
intros
[
i
Hx
]
.
split
;
[
by
intros
(?
&
?
&
?);
eauto
|]
.
intros
[
i
Hx
]
.
exists
i
,
(
fin_to_nat_lt
_)
.
by
rewrite
fin
_of
_to_nat
.
exists
i
,
(
fin_to_nat_lt
_)
.
by
rewrite
nat_to_
fin_to_nat
.
Qed
.
Qed
.
Lemma
Forall_vlookup
{
A
}
(
P
:
A
→
Prop
)
{
n
}
(
v
:
vec
A
n
)
:
Lemma
Forall_vlookup
{
A
}
(
P
:
A
→
Prop
)
{
n
}
(
v
:
vec
A
n
)
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment