Created
October 26, 2013 12:41
-
-
Save yoshihiro503/7169043 to your computer and use it in GitHub Desktop.
第33回 #ProofCafe での練習問題のssreflectを使った解答例。 ref: http://qiita.com/yoshihiro503/items/0bca75e5ab52e40f01f6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment