(* * Copyright (c) 2009-2011, Andrew Appel, Robert Dockins and Aquinas Hobor. * *)
(** The prototypical example of a psepalg is the positive shares, which are just the lifted basic shares. *)
Definition pshare : Type := lifted Share.Join_ba.
Instance Join_pshare: Join pshare := @Join_lift _ _.
Instance Perm_pshare : Perm_alg pshare := Perm_lift Share.pa.
Instance Canc_pshare : Canc_alg pshare := @Canc_lift _ _ Share.ca.
Instance Disj_pshare : Disj_alg pshare := @Disj_lift _ _ Share.da.
Instance Pos_pshare : Pos_alg pshare := @Pos_lift _ _.
Definition pshare_sh : pshare -> share := @lifted_obj share Share.Join_ba.
Coercion pshare_sh : pshare >-> share.
Instance EqDec_pshare : EqDec pshare := pshare_eq_dec.
Definition pfullshare : pshare :=
mk_lifted fullshare top_share_nonunit.
Proof with auto.
unfold pshare.
apply lifted_full. auto with typeclass_instances.
apply fullshare_full.
Qed.
Ltac pfullshare_join :=
elimtype False;
solve [ eapply pshare_join_full_false1; eauto
| eapply pshare_join_full_false2; eauto
| eapply pshare_join_full_false3; eauto
| eapply pshare_join_full_false4; eauto
| eapply pshare_pjoin_full_false3; eauto
| eapply pshare_pjoin_full_false4; eauto
].
Program Definition split_pshare (sh: pshare) : pshare * pshare :=
(mk_lifted (fst (Share.split sh)) _, mk_lifted (snd (Share.split sh)) _).
Next Obligation.
Next Obligation.

Lemma psplit_pjoin: forall psh psha pshb,
split_pshare psh = (psha, pshb) ->
join psha pshb psh.