Skip to content

Commit

Permalink
Prove some countable instances for commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtassarotti committed Dec 2, 2024
1 parent bf70d57 commit 132517b
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions src/program_proof/tulip/base.v
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,19 @@ Proof. solve_decision. Qed.
#[global]
Instance ccommand_countable :
Countable ccommand.
Admitted.
Proof.
refine (inj_countable'
(λ x, match x with
| CmdCommit tid pwrs => inl (tid, pwrs)
| CmdAbort tid => inr tid
end)
(λ x, match x with
| inl (tid, pwrs) => CmdCommit tid pwrs
| inr tid => CmdAbort tid
end)
_).
intros [|] => //=.
Qed.

#[global]
Instance icommand_eq_decision :
Expand All @@ -101,7 +113,23 @@ Proof. solve_decision. Qed.
#[global]
Instance icommand_countable :
Countable icommand.
Admitted.
Proof.
refine (inj_countable'
(λ x, match x with
| CmdAcquire tid pwrs ptgs => inl (tid, pwrs, ptgs)
| CmdRead tid key => inr (inl (tid, key))
| CmdAdvance tid rank => inr (inr (inl (tid, rank)))
| CmdAccept tid rank pdec => inr (inr (inr (tid, rank, pdec)))
end)
(λ x, match x with
| inl (tid, pwrs, ptgs) => CmdAcquire tid pwrs ptgs
| inr (inl (tid, key)) => CmdRead tid key
| inr (inr (inl (tid, rank))) => CmdAdvance tid rank
| inr (inr (inr (tid, rank, pdec))) => CmdAccept tid rank pdec
end)
_).
intros [| | |] => //=.
Qed.

#[global]
Instance command_eq_decision :
Expand All @@ -111,7 +139,19 @@ Proof. solve_decision. Qed.
#[global]
Instance command_countable :
Countable command.
Admitted.
Proof.
refine (inj_countable'
(λ x, match x with
| CCmd cmd => inl cmd
| ICmd cmd => inr cmd
end)
(λ x, match x with
| inl cmd => CCmd cmd
| inr cmd => ICmd cmd
end)
_).
intros [|] => //=.
Qed.

(** State-machine log. *)
Definition dblog := list ccommand.
Expand Down

0 comments on commit 132517b

Please sign in to comment.