From a988acd688af61aa25e7024abb91760ed15dadc5 Mon Sep 17 00:00:00 2001
From: Robbert Krebbers <mail@robbertkrebbers.nl>
Date: Tue, 31 Mar 2020 23:52:46 +0200
Subject: [PATCH] Make use of OFE isomorphisms in COFE solver.

---
 theories/algebra/cofe_solver.v  | 9 ++-------
 theories/base_logic/lib/iprop.v | 9 +++++----
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/theories/algebra/cofe_solver.v b/theories/algebra/cofe_solver.v
index eb85e3900..2cb91a39a 100644
--- a/theories/algebra/cofe_solver.v
+++ b/theories/algebra/cofe_solver.v
@@ -4,13 +4,8 @@ Set Default Proof Using "Type".
 Record solution (F : oFunctor) := Solution {
   solution_car :> ofeT;
   solution_cofe : Cofe solution_car;
-  solution_unfold : solution_car -n> F solution_car _;
-  solution_fold : F solution_car _ -n> solution_car;
-  solution_fold_unfold X : solution_fold (solution_unfold X) ≡ X;
-  solution_unfold_fold X : solution_unfold (solution_fold X) ≡ X
+  solution_iso :> ofe_iso (F solution_car _) solution_car;
 }.
-Arguments solution_unfold {_} _.
-Arguments solution_fold {_} _.
 Existing Instance solution_cofe.
 
 Module solver. Section solver.
@@ -210,7 +205,7 @@ Proof. by intros n X Y HXY k; rewrite /fold /= HXY. Qed.
 
 Theorem result : solution F.
 Proof using Type*.
-  apply (Solution F T _ (OfeMor unfold) (OfeMor fold)).
+  refine (Solution F T _ (OfeIso (OfeMor fold) (OfeMor unfold) _ _)).
   - move=> X /=. rewrite equiv_dist=> n k; rewrite /unfold /fold /=.
     rewrite -g_tower -(gg_tower _ n); apply (_ : Proper (_ ==> _) (g _)).
     trans (map (ff n, gg n) (X (S (n + k)))).
diff --git a/theories/base_logic/lib/iprop.v b/theories/base_logic/lib/iprop.v
index 5439c7df9..50169bddc 100644
--- a/theories/base_logic/lib/iprop.v
+++ b/theories/base_logic/lib/iprop.v
@@ -147,12 +147,13 @@ Module Export iProp_solution : iProp_solution_sig.
   Notation iPropO Σ := (uPredO (iResUR Σ)).
 
   Definition iProp_unfold {Σ} : iPropO Σ -n> iPrePropO Σ :=
-    solution_fold (iProp_result Σ).
-  Definition iProp_fold {Σ} : iPrePropO Σ -n> iPropO Σ := solution_unfold _.
+    ofe_iso_1 (iProp_result Σ).
+  Definition iProp_fold {Σ} : iPrePropO Σ -n> iPropO Σ :=
+    ofe_iso_2 (iProp_result Σ).
   Lemma iProp_fold_unfold {Σ} (P : iProp Σ) : iProp_fold (iProp_unfold P) ≡ P.
-  Proof. apply solution_unfold_fold. Qed.
+  Proof. apply ofe_iso_21. Qed.
   Lemma iProp_unfold_fold {Σ} (P : iPrePropO Σ) : iProp_unfold (iProp_fold P) ≡ P.
-  Proof. apply solution_fold_unfold. Qed.
+  Proof. apply ofe_iso_12. Qed.
 End iProp_solution.
 
 
-- 
GitLab