Questions tagged [coq-tactic]

Tactics are programs written in Ltac, the untyped language used in the Coq proof assistant to transform goals and terms. This tag should be used on questions related to the issues in using Coq tactics to derive proofs using the Coq proof assistant.

Tactics are programs written in Ltac, the untyped language used in the Coq proof assistant to transform goals and terms. In general, the aim of using tactics is to construct a proof or proof object for the theorem in question. Initially, the proof object contains a hole corresponding to the goal of the theorem in question. As the proof proceeds, tactics transform the current goal/sub-goal and hypotheses in the local proof context using established theorems in the global context as well as hypotheses in the local context. Some tactics can introduce new sub-goals corresponding to new holes in the proof object. For example, if the goal is a conjunction P /\ Q, can be decomposed into two sub-goals P and Q using the split tactic. Certain tactics can also reduce the number of sub-goals (or holes in the proof object). The theorem is proved when there is no more sub-goals to prove (i.e. no more holes to fill in the proof object).

Strictly speaking, tactics are not necessary to prove theorems in Coq. It is possible to construct a proof object directly. However, tactics provide an interactive way of constructing a proof, which are closer to the manner proofs are developed manually.

For a comprehensive documentation of tactics, see the Coq reference manual: https://coq.inria.fr/refman/tactic-index.html

383 questions
0
votes
1 answer

Compare sums ssreflect

I am aiming to say that if we have sum(a) = sum(b) then a = b. What would be the suitable tactic to do this, if the goal looks like this: \big[Radd_comoid/0]_(i <- fin_img (A:=U) (B:=R_eqType) X) Radd_comoid (Pr P F * (i * Pr P (finset…
Fusen
  • 311
  • 2
  • 3
  • 10
0
votes
2 answers

Cauchy-Schwartz Inequality in Coq?

In the ℝn - n-dimensional Euclidean space R^n with the standard inner product, which is the dot product, the Cauchy–Schwarz inequality becomes: [1]: https://i.stack.imgur.com/ZNBfx.png Is anyone aware of an implementation for sums of Cauchy-Schwartz…
Fusen
  • 311
  • 2
  • 3
  • 10
0
votes
2 answers

Coq infotheo %B is_true

I have hit the wall with a proof (Coq version 8.13.1 , using infotheo), where the context Hypothesis is as the goal, just with a "%B" attached. I understand it indicates 'is_true', but how to proceed the proof? (unfold is_true does not get rid of…
Fusen
  • 311
  • 2
  • 3
  • 10
0
votes
2 answers

What tactic should I use to avoid stucking in endless loop, in Coq?

I cannot solve a Coq Theorem where I should use denotational semantics. If I go forward from this point I am always stucking in an endless loop. What tactic should be used in this case? Where did I go wrong with this one? Should I start…
steve01
  • 1
  • 1
0
votes
1 answer

How to prove the decomposition of implication?

I have to prove the following statement : (A -> B) <-> ~A \/ B which is the decomposition of implication. I can use the ~~A -> A axiom as it is given in the exercise, but I'm stuck pretty early in the demonstration. I start by splitting then…
0
votes
1 answer

Coq proving nonsensical inductive property implication?

In IndProp.v from Logical Foundations we have the following inductive property: Inductive nostutter {X:Type} : list X -> Prop := | nos_nil : nostutter [] | nos_one : forall x, nostutter [x] | nos_cons : forall x h l, nostutter (h :: l) -> (x…
granduser
  • 67
  • 7
0
votes
1 answer

Define list length in recursion in Coq Not sure if my function is wrong and got stuck

So i was trying to define a tail-recursive version of list length function and prove that the function is the same as "length" function Below is my code. Got stuck when prove Fixpoint length_tail (A: Type) (l: list A) (len: nat): nat := match l,…
domino
  • 89
  • 7
0
votes
0 answers

Is it possible to disable the ```auto``` tactic in Coq?

I would like to check student proofs, but I want to disallow higher level automation. I have looked in the documentation for an equivalent to Reset, but could not find it. I tried Ltac auto := fail. However, auto was still usable in a proof after…
Matt Knepley
  • 174
  • 4
0
votes
1 answer

How to specialize nested hypotheses in Coq?

I've already got the idea of specialize in Coq. It works okay with specialize (H1 trm_int). H1 : forall x, value x -> term x. But what about this case H1 : forall x, value x -> forall y, value y -> sub x y. It doesn't work with specialize (H1…
DoubleX
  • 351
  • 3
  • 18
0
votes
1 answer

How could we specify the times of running a tactic

I want to run a tactic several times. For instance, I want to execute apply lemma1 two times but do not like to write like apply lemma1. apply lemma1. Is there a command such that I can apply apply lemma1. for just two times?
ZhangLiao
  • 25
  • 4
0
votes
2 answers

Induction with other base case in Coq

I am trying to proof the pigeonhole problem in Coq. Therefore I have the following lemma that I want to proof: Lemma pigeon_hole : forall m n, m < n -> forall f, (forall i, i < n -> f i < m) -> exists i, i < n /\ exists j, j < n /\ i <> j /\ f i = f…
0
votes
1 answer

`match goal` doesn't match let destructuring expression

I'm trying to prove a theorem involving a function that uses a destructuring let expression, and am trying to use the match goal tactic to destruct the right hand side, but for some reason the pattern doesn't match like I'd expect it to: match goal…
blaineh
  • 2,263
  • 3
  • 28
  • 46
0
votes
1 answer

How to apply a constructor in an hypothesis?

I am trying to prove the following theorem Theorem subseq_subset : forall l1 l2, subseq l1 l2 -> sublist l1 l2. with the inductive type subseq : Inductive subseq {A:Type} : list A -> list A -> Prop := | SubNil : forall (l:list A), subseq nil…
imaneEl
  • 17
  • 3
0
votes
1 answer

Inductive proposition for sublists in Coq

I am struggling with coming up with a notion of sublist of a list, which is created by deleting elements in the list (so that the order is preserved). I need to come up with an inductive proposition that decides if l1 is a sublist of l2. So far: I…
0
votes
1 answer

How to prove that the subsequence of an empty list is empty?

I'm new in coq. i am trying to prove that the subsequence of an empty list is empty This is the lemma i'm working on: Lemma sub_nil : forall l , subseq l nil <-> l=nil. i tried to split so i can have subseq l nil -> l = nil and l = nil -> subseq…
imaneEl
  • 17
  • 3