LoginSignup
1
0

More than 5 years have passed since last update.

第33回 #ProofCafe での練習問題のssreflectを使った解答例。

Posted at

第33回 #ProofCafe での練習問題のssreflectを使った解答例。

Equiv_J.v
Require Import ssreflect.
(* **** Exercise: 3 stars (swap_if_branches) *)
(** **** 練習問題: ★★★ (swap_if_branches) *)
Theorem swap_if_branches: forall b e1 e2,
  cequiv
    (IFB b THEN e1 ELSE e2 FI)
    (IFB BNot b THEN e2 ELSE e1 FI).
Proof.
  move => b e1 e2.
  split => H.
  - inversion H; subst.
    + by apply E_IfFalse; [simpl; rewrite H5 |].
    + by apply E_IfTrue;  [simpl; rewrite H5 |].
  - inversion H; subst.
    + apply E_IfFalse; [| assumption].
      rewrite  (negb_involutive_reverse (beval st b)).
      simpl in H5. by rewrite H5.
    + apply E_IfTrue; [| assumption].
      rewrite (negb_involutive_reverse (beval st b)).
      simpl in H5. by rewrite H5.
Qed. 

ProofCafe: http://proofcafe.org/wiki/

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0