Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rtproofs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sergey Bozhko
rtproofs
Commits
a4d57101
Commit
a4d57101
authored
Aug 30, 2019
by
Sergey Bozhko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lemmas about ex_minn
parent
80bd79d5
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
36 additions
and
2 deletions
+36
2
util/search_arg.v
util/search_arg.v
+36
2
No files found.
util/search_arg.v
View file @
a4d57101
...
...
@@ 15,8 +15,9 @@ From rt.util Require Import tactics.
*)
Section
ArgSearch
.
(* Given a function [f] that maps the naturals to elements of type [T]... *)
Context
{
T
:
Type
}.
Context
{
T
:
Type
}.
Variable
f
:
nat
>
T
.
(* ... a predicate [P] on [T] ... *)
...
...
@@ 28,7 +29,7 @@ Section ArgSearch.
(* ... we define the procedure [search_arg] to iterate a given search space
[a, b), while checking each element whether [f] satisfies [P] at that
point and returning the extremum as defined by [R]. *)
Fixpoint
search_arg
(
a
b
:
nat
)
:
option
nat
:
=
Fixpoint
search_arg
(
a
b
:
nat
)
:
option
nat
:
=
if
a
<
b
then
match
b
with

0
=>
None
...
...
@@ 202,3 +203,36 @@ Section ArgSearch.
Qed
.
End
ArgSearch
.
Section
ExMinn
.
(* We show that the fact that the minimal satisfying argument [ex_minn ex] of
a predicate [pred] satisfies another predicate [P] implies the existence
of a minimal element that satisfies both [pred] and [P]. *)
Lemma
prop_on_ex_minn
:
forall
(
P
:
nat
>
Prop
)
(
pred
:
nat
>
bool
)
(
ex
:
exists
n
,
pred
n
),
P
(
ex_minn
ex
)
>
exists
n
,
P
n
/\
pred
n
/\
(
forall
n'
,
pred
n'
>
n
<=
n'
).
Proof
.
intros
.
exists
(
ex_minn
ex
)
;
repeat
split
;
auto
.
all
:
have
MIN
:
=
ex_minnP
ex
;
move
:
MIN
=>
[
n
Pn
MIN
]
;
auto
.
Qed
.
(* As a corollary, we show that if there is a constant [c] such
that [P c], then the minimal satisfying argument [ex_minn ex]
of a predicate [P] is less than or equal to [c]. *)
Corollary
ex_minn_le_ex
:
forall
(
P
:
nat
>
bool
)
(
exP
:
exists
n
,
P
n
)
(
c
:
nat
),
P
c
>
ex_minn
exP
<=
c
.
Proof
.
intros
?
?
?
EX
.
rewrite
leqNgt
;
apply
/
negP
;
intros
GT
.
pattern
(
ex_minn
(
P
:
=
P
)
exP
)
in
GT
;
apply
prop_on_ex_minn
in
GT
;
move
:
GT
=>
[
n
[
LT
[
Pn
MIN
]]].
specialize
(
MIN
c
EX
).
by
move
:
MIN
;
rewrite
leqNgt
;
move
=>
/
negP
MIN
;
apply
:
MIN
.
Qed
.
End
ExMinn
.
\ No newline at end of file
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