Section FinitePartialMap.
Variable A:Type.
Variable dec_A : EqDec A.
Variable B:Type.
Variable PJ_B: Join B.
Variable Perm_B : Perm_alg B.
Variable Pos_B : Pos_alg B.
Let Rng := option B.
Let Join_Rng := Join_lower PJ_B.
Let Sep_Rng := Sep_lower B.
Let Perm_Rng := Perm_lower B.
Definition finMap (f:A -> Rng) : Prop :=
exists l, forall a:A, ~In a l -> f a = None.
Definition fpm := sig finMap.
Instance Join_fpm : Join fpm :=
Join_prop (A -> option B)  (Join_fun A (option B) Join_Rng) finMap.
Definition PAF: (@Perm_alg (A -> Rng)  (Join_fun A Rng Join_Rng))
:= Perm_fun _ _ _ Perm_Rng.
Instance Perm_fpm : @Perm_alg fpm Join_fpm :=
Perm_prop (A -> Rng) _ _ finMap finMap_join.
Instance Disj_fpm {DA_B: Disj_alg B}: Disj_alg fpm.
End FinitePartialMap.
Definition fpm_bij (A B B': Type) (bij: bijection B B') : bijection (fpm A B) (fpm A B').
destruct bij as [f g fg gf].
unfold fpm.
apply (Bijection _ _
(fun x: sig (@finMap A B) => exist (@finMap A B') _ (fpm_bij_aux f (proj2_sig x)))
(fun x: sig (@finMap A B') => exist (@finMap A B) _ (fpm_bij_aux g (proj2_sig x)))).
intros [x Hx]. simpl in *. apply exist_ext. extensionality i. destruct (x i); auto.
rewrite fg; auto.
intros [x Hx]. simpl in *. apply exist_ext. extensionality i. destruct (x i); auto.
rewrite gf; auto.
Defined.

Lemma lift_prod_aux1 {A}{JA: Join A}{B}:
forall x,   @nonunit (A * B) (Join_prod A JA B (Join_equiv B)) x -> nonunit (fst x).