Skip to content
Snippets Groups Projects
Commit 1b4ded4d authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Prove fixpointK stuff without unfolding the definition of fixpoint.

Also, give names to hypotheses that we refer to.
parent 49fa33d4
No related branches found
No related tags found
No related merge requests found
...@@ -267,34 +267,35 @@ Definition fixpointK `{Cofe A, Inhabited A} k (f : A → A) ...@@ -267,34 +267,35 @@ Definition fixpointK `{Cofe A, Inhabited A} k (f : A → A)
Section fixpointK. Section fixpointK.
Local Set Default Proof Using "Type*". Local Set Default Proof Using "Type*".
Context `{Cofe A, Inhabited A} (f : A A) k `{!Contractive (Nat.iter k f)}. Context `{Cofe A, Inhabited A} (f : A A) (k : nat).
Context `{f_contractive : !Contractive (Nat.iter k f)}.
(* TODO: Can we get rid of this assumption, derive it from contractivity? *) (* TODO: Can we get rid of this assumption, derive it from contractivity? *)
Context `{!∀ n, Proper (dist n ==> dist n) f}. Context `{f_ne : !∀ n, Proper (dist n ==> dist n) f}.
Let f_proper : Proper (() ==> ()) f := ne_proper f.
Existing Instance f_proper.
Lemma fixpointK_unfold : fixpointK k f f (fixpointK k f). Lemma fixpointK_unfold : fixpointK k f f (fixpointK k f).
Proof. Proof.
apply equiv_dist=>n. symmetry. rewrite /fixpointK. apply fixpoint_unique.
rewrite /fixpointK fixpoint_eq /fixpoint_def (conv_compl n (fixpoint_chain _)) //. by rewrite -Nat_iter_S_r Nat_iter_S -fixpoint_unfold.
induction n as [|n IH]; simpl.
- 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. Qed.
Lemma fixpointK_unique (x : A) : x f x x fixpointK k f. Lemma fixpointK_unique (x : A) : x f x x fixpointK k f.
Proof. Proof.
intros Hf. apply fixpoint_unique, equiv_dist=>n. intros Hf. apply fixpoint_unique. clear f_contractive.
(* Forward reasoning is so annoying... *) induction k as [|k' IH]=> //=. by rewrite -IH.
assert (x {n} f x) by by apply equiv_dist.
clear Contractive0. induction k; first done. by rewrite {1}Hf {1}IHn0.
Qed. Qed.
Section fixpointK_ne. Section fixpointK_ne.
Context (g : A A) `{!Contractive (Nat.iter k g), !∀ n, Proper (dist n ==> dist n) g}. Context (g : A A) `{g_contractive : !Contractive (Nat.iter k g)}.
Context {g_ne : n, Proper (dist n ==> dist n) g}.
Lemma fixpointK_ne n : ( z, f z {n} g z) fixpointK k f {n} fixpointK k g. Lemma fixpointK_ne n : ( z, f z {n} g z) fixpointK k f {n} fixpointK k g.
Proof. Proof.
rewrite /fixpointK=>Hne /=. apply fixpoint_ne=>? /=. clear Contractive0 Contractive1. rewrite /fixpointK=> Hfg /=. apply fixpoint_ne=> z.
induction k; first by auto. simpl. rewrite IHn0. apply Hne. clear f_contractive g_contractive.
induction k as [|k' IH]=> //=. by rewrite IH Hfg.
Qed. Qed.
Lemma fixpointK_proper : ( z, f z g z) fixpointK k f fixpointK k g. Lemma fixpointK_proper : ( z, f z g z) fixpointK k f fixpointK k g.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment