The SSReflect proof language is a set of Coq tactics which allows for small scale reflection. It is the core language used in the Mathematical Components project and has been integrated into vanilla Coq starting from version 8.7.
Questions tagged [ssreflect]
78 questions
2
votes
2 answers
when is the `:` (colon) in necessary in ssreflect/Coq?
I am trying to understand the exact meaning of the : (colon) in Coq/ssreflect proofs in terms of non-ssreflect Coq.
I read that it has something to do with moving things to the goal (like generalize??) and is the opposite of =>, which move things…

thor
- 21,418
- 31
- 87
- 173
2
votes
1 answer
What does the perm_invK lemma in Ssreflect prove?
The following code is from perm.v in the Ssreflect Coq library.
I want to know what this result is.
Lemma perm_invK s : cancel (fun x => iinv (perm_onto s x)) s.
Proof. by move=> x /=; rewrite f_iinv. Qed.

Sai Ganesh Muthuraman
- 111
- 7
2
votes
1 answer
How to do pseudo polynomial divisions in Coq/Ssreflect
Basically, I want to observe the result of pseudo polynomial division on some instances (say 3 x^2+2 x +1 and 2 x +1). Pseudo division between polynomials is implemented in edivp in polydiv.v in Ssreflect 1.4. I would expect the code should be…

Wenda Li
- 33
- 2
1
vote
2 answers
Coq - prove that there exists a maximal element in a non empty sequence
As an exercise I want to prove that there is always exists a maximum element in a non-empty sequence.
Theorem largest_el_in_list (s: seq rat) x : x \in s -> exists y, y \in s /\ forall z, z \in s -> y >= z.
My idea was to go by induction on s, and…

dvr
- 370
- 1
- 9
1
vote
1 answer
Case analysis on max - ssreflect
I have the following in my goal:
maxr x0 x
I would like to do a case analysis, to consider what happens in the case that x0 is greatest, and the case the x is greatest. Is this possible in ssreflect?
Generally it would be something like (for…

dvr
- 370
- 1
- 9
1
vote
1 answer
What does `apply.` tactic on it's own do in Coq -- i.e. without specifying a rule or hypothesis to unify the goal's conclusion with?
I think I understand the main idea of the apply tactic but I can't figure out what it does in this case:
Lemma HilbertS :
forall A B C : Prop,
(A -> B -> C) -> (A -> B) -> A -> C.
(* A ->(B -> C)*)
Proof.
move=> A B C. (* since props A B…

Charlie Parker
- 5,884
- 57
- 198
- 323
1
vote
0 answers
Proof irrelevance of decidable *inequality* in coq
While trying to prove some equality in ssreflect, I got to the following:
WTS: forall (a b: ~ false), a = b
which is basically
WTS: forall (a b: false <> true), a = b.
Knowing that the following holds constructively,
bool_irrelevance (b: bool): (x…

Abastro
- 73
- 1
- 6
1
vote
1 answer
Why unable to perform case analysis in rather simple case
Well, the code
From mathcomp Require Import ssreflect ssrnat ssrbool eqtype.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Inductive nat_rels m n : bool -> bool -> bool -> Set :=
| CompareNatLt of m < n : nat_rels m n true false false
|…

Andrey
- 712
- 6
- 16
1
vote
2 answers
how to simplify basic arithmetic in more complex goals
Here's a minimal example of my problem
Lemma arith: forall T (G: seq T), (size G + 1 + 1).+1 = (size G + 3).
I would like to be able to reduce this to
forall T (G: seq T), (size G + 2).+1 = (size G + 3).
by the simplest possible means. Trying simpl…

push33n
- 398
- 4
- 12
1
vote
1 answer
Coq ssreflect sum of sums
I have been searching for a lemma in ssreflect that represents sum linearity, so that I could transform
sum(a) + sum(b) = sum(c)
into
sum(a+b) =sum(c)
and then derive into
a+b = c.
Which could be suitable in this case?
The goal:
\big[Rplus/0]_(i…

Fusen
- 311
- 2
- 3
- 10
1
vote
1 answer
Translating proof from Nat to Rat
I'm trying to use a CoQ/SSReflect proof using nat to prove a very similar statement in rat. The current proof status, within an Open Scope ring_scope, is
(price bs i - price bs' i <= tnth bs i * ('ctr_ (sOi i) - 'ctr_ (sOi i')))%N
→ (price bs…

Pierre Jouvelot
- 901
- 3
- 13
1
vote
2 answers
Type coercion from nat to rat
I'm stuck with this very simple lemma, and wonder what is the best way to proceed.
From mathcomp Require Import ssrint rat ssralg ssrnum.
Import GRing.Theory.
Import Num.Theory.
Import Num.Def.
Open Scope ring_scope.
Lemma X (n m : nat) : (n <=…

Pierre Jouvelot
- 901
- 3
- 13
1
vote
1 answer
How to index a tuple with ssreflect ordinals
I have written a few projects in Coq but I haven't used ssreflect before and I'm having trouble with it.
I have a data structure with indices into itself. Below is the simplified version.
Record Graph :=
{ size: nat
; nodes : size.-tuple (seq…

Joonazan
- 1,408
- 10
- 18
1
vote
1 answer
no error with assert (goal) but error with cut (goal)
I'm confused as to why assert and cut are behaving differently in this case.
I am trying to prove this lemma with the ssreflect seq library.
Lemma subseq_add_both: forall{A: eqType} (L1 L2: seq A) (a: A),
subseq L1 L2 -> subseq (a:: L1) (a ::…

push33n
- 398
- 4
- 12
1
vote
1 answer
tactical for introducing a hypothesis and then immediately doing another tactic on it
When my proof state is of the form
H -> goal
I often use the pattern
intros H. *some tactic* H.
where some tactic could be "inversion" or "apply _ in", etc. It would be nice if there was some tactical which combined these two steps, ie, something…

push33n
- 398
- 4
- 12