Debian Codegraph @

test-suite/ssr/predRewrite.v

raw
1 Require Import ssreflect ssrfun ssrbool.
2
3 (** Test the various idioms that control rewriting in boolean predicate. **)
4
5 Definition simpl_P := [pred a | ~~ a].
6 Definition nosimpl_P : pred bool := [pred a | ~~ a].
7 Definition coll_P : collective_pred bool := [pred a | ~~ a].
8 Definition appl_P : applicative_pred bool := [pred a | ~~ a].
9 Definition can_appl_P : pred bool := [pred a | ~~ a].
10 Canonical register_can_appl_P := ApplicativePred can_appl_P.
11 Ltac see_neg := (let x := fresh "x" in set x := {-}(~~ _); clear x).
12
13 Lemma test_pred_rewrite (f := false) : True.
14 Proof.
15 have _: f \in simpl_P by rewrite inE; see_neg.
16 have _ a: simpl_P (a && f) by simpl; see_neg; rewrite andbF.
17 have _ a: simpl_P (a && f) by rewrite inE; see_neg; rewrite andbF.
18 have _: f \in nosimpl_P by rewrite inE; see_neg.
19 have _: nosimpl_P f. simpl. Fail see_neg. Fail rewrite inE. done.
20 have _: f \in coll_P. Fail rewrite inE. by rewrite in_collective; see_neg.
21 have _: f \in appl_P.
22 rewrite inE. Fail see_neg. Fail rewrite inE. simpl. Fail see_neg.
23 Fail rewrite app_predE. done.
24 have _: f \in can_appl_P.
25 rewrite inE. Fail see_neg. Fail rewrite inE. simpl. Fail see_neg.
26 by rewrite app_predE in_simpl; see_neg.
27 done.
28 Qed.