Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Rice Wine
Iris
Commits
f9bc9466
Commit
f9bc9466
authored
Jan 25, 2017
by
Ralf Jung
Browse files
generalize fixpoint from f^2 contractive to f^k contractive
parent
f351a117
Changes
1
Hide whitespace changes
Inline
Side-by-side
theories/algebra/ofe.v
View file @
f9bc9466
...
...
@@ -261,44 +261,46 @@ Section fixpoint.
Qed
.
End
fixpoint
.
(** Fixpoint of f when f^2 is contractive. **)
(* TODO: Generalize 2 to m. *)
Definition
fixpoint2
`
{
Cofe
A
,
Inhabited
A
}
(
f
:
A
→
A
)
`
{!
Contractive
(
Nat
.
iter
2
f
)}
:
=
fixpoint
(
Nat
.
iter
2
f
).
(** Fixpoint of f when f^k is contractive. **)
Definition
fixpointK
`
{
Cofe
A
,
Inhabited
A
}
k
(
f
:
A
→
A
)
`
{!
Contractive
(
Nat
.
iter
k
f
)}
:
=
fixpoint
(
Nat
.
iter
k
f
).
Section
fixpoint
2
.
Section
fixpoint
K
.
Local
Set
Default
Proof
Using
"Type*"
.
Context
`
{
Cofe
A
,
Inhabited
A
}
(
f
:
A
→
A
)
`
{!
Contractive
(
Nat
.
iter
2
f
)}.
Context
`
{
Cofe
A
,
Inhabited
A
}
(
f
:
A
→
A
)
k
`
{!
Contractive
(
Nat
.
iter
k
f
)}.
(* TODO: Can we get rid of this assumption, derive it from contractivity? *)
Context
`
{!
∀
n
,
Proper
(
dist
n
==>
dist
n
)
f
}.
Lemma
fixpoint
2
_unfold
:
fixpoint
2
f
≡
f
(
fixpoint
2
f
).
Lemma
fixpoint
K
_unfold
:
fixpoint
K
k
f
≡
f
(
fixpoint
K
k
f
).
Proof
.
apply
equiv_dist
=>
n
.
rewrite
/
fixpoint
2
fixpoint_eq
/
fixpoint_def
(
conv_compl
n
(
fixpoint_chain
_
))
//.
rewrite
/
fixpoint
K
fixpoint_eq
/
fixpoint_def
(
conv_compl
n
(
fixpoint_chain
_
))
//.
induction
n
as
[|
n
IH
]
;
simpl
.
-
eapply
contractive_0
with
(
f0
:
=
Nat
.
iter
2
f
).
done
.
-
eapply
contractive_S
with
(
f0
:
=
Nat
.
iter
2
f
)
;
first
done
.
eauto
.
-
rewrite
-
Nat_iter_S
Nat_iter_S_r
.
eapply
contractive_0
;
first
done
.
-
rewrite
-[
f
_
]
Nat_iter_S
Nat_iter_S_r
.
eapply
contractive_S
;
first
done
.
eauto
.
Qed
.
Lemma
fixpoint
2
_unique
(
x
:
A
)
:
x
≡
f
x
→
x
≡
fixpoint
2
f
.
Lemma
fixpoint
K
_unique
(
x
:
A
)
:
x
≡
f
x
→
x
≡
fixpoint
K
k
f
.
Proof
.
intros
Hf
.
apply
fixpoint_unique
,
equiv_dist
=>
n
.
eapply
equiv_dist
in
Hf
.
rewrite
2
!{
1
}
Hf
.
done
.
intros
Hf
.
apply
fixpoint_unique
,
equiv_dist
=>
n
.
(* Forward reasoning is so annoying... *)
assert
(
x
≡
{
n
}
≡
f
x
)
by
by
apply
equiv_dist
.
clear
Contractive0
.
induction
k
;
first
done
.
by
rewrite
{
1
}
Hf
{
1
}
IHn0
.
Qed
.
Section
fixpoint
2
_ne
.
Context
(
g
:
A
→
A
)
`
{!
Contractive
(
Nat
.
iter
2
g
),
!
∀
n
,
Proper
(
dist
n
==>
dist
n
)
g
}.
Section
fixpoint
K
_ne
.
Context
(
g
:
A
→
A
)
`
{!
Contractive
(
Nat
.
iter
k
g
),
!
∀
n
,
Proper
(
dist
n
==>
dist
n
)
g
}.
Lemma
fixpoint
2
_ne
n
:
(
∀
z
,
f
z
≡
{
n
}
≡
g
z
)
→
fixpoint
2
f
≡
{
n
}
≡
fixpoint
2
g
.
Lemma
fixpoint
K
_ne
n
:
(
∀
z
,
f
z
≡
{
n
}
≡
g
z
)
→
fixpoint
K
k
f
≡
{
n
}
≡
fixpoint
K
k
g
.
Proof
.
rewrite
/
fixpoint2
=>
Hne
/=.
apply
fixpoint_ne
=>?
/=.
rewrite
!
Hne
.
done
.
rewrite
/
fixpointK
=>
Hne
/=.
apply
fixpoint_ne
=>?
/=.
clear
Contractive0
Contractive1
.
induction
k
;
first
by
auto
.
simpl
.
rewrite
IHn0
.
apply
Hne
.
Qed
.
Lemma
fixpoint
2
_proper
:
(
∀
z
,
f
z
≡
g
z
)
→
fixpoint
2
f
≡
fixpoint
2
g
.
Proof
.
setoid_rewrite
equiv_dist
;
naive_solver
eauto
using
fixpoint
2
_ne
.
Qed
.
End
fixpoint
2
_ne
.
End
fixpoint
2
.
Lemma
fixpoint
K
_proper
:
(
∀
z
,
f
z
≡
g
z
)
→
fixpoint
K
k
f
≡
fixpoint
K
k
g
.
Proof
.
setoid_rewrite
equiv_dist
;
naive_solver
eauto
using
fixpoint
K
_ne
.
Qed
.
End
fixpoint
K
_ne
.
End
fixpoint
K
.
(** Mutual fixpoints *)
Section
fixpointAB
.
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment