ssreflect


Part of coq stdlib. No need of mathcomp

General

Multipliers

n! Exactly n times
n? Upto n times
! As many times as possible and at least once
? As many times as possible (can even be zero times)

ssrfun

https://coq.inria.fr/doc/V8.18.0/stdlib/Coq.ssr.ssrfun.html

ssrbool

Clear switch

Introduction with curly braces means at the end of that tactic, the introduced variable will disappear from the set of hypotheses.

rewrite

Probably the most useful tactic.

Tips:

Occurrence selection

Some 'reflecting' examples

andP

Require Import ssreflect ssrbool.

Goal
  True -> true && true.
Proof.
  move => H.
(*
1 subgoal

H : True

========================= (1 / 1)

true && true
*)
  apply/andP.
(*
1 subgoal

H : True

========================= (1 / 1)

true /\ true
*)

exists_inP (move)

One with mathcomp:

Check exists_inP.
(*
exists_inP
     : reflect (exists2 x : ?T, ?D x & ?P x) [exists (x | ?D x), ?P x]
where
?T : [ |- finType]
?D : [ |- pred ?T]
?P : [ |- pred ?T]
*)

Goal forall (x:'I_3) (P1 P2: 'I_3 -> bool),
  [exists (x | P2 x), P1 x] -> True.
Proof.
  move => x P1 P2.
(*
1 subgoal

x : 'I_3
P1, P2 : 'I_3 -> bool

========================= (1 / 1)

[exists (x0 | P2 x0), P1 x0] -> True
*)
  move/exists_inP.
(*
1 subgoal

x : 'I_3
P1, P2 : 'I_3 -> bool

========================= (1 / 1)

(exists2 x0 : fintype_ordinal__canonical__fintype_Finite 3, P2 x0 & P1 x0) ->
True
*)

exists_inP (case)

[exists (dst | true), accept eps dst l] -> s :: l \in nilp (T:=A)
case/exists_inP.
forall x : unit, true -> accept eps x l -> s :: l \in nilp (T:=A)

Misc