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
2 answers

Coq syntax for theorem covering cases of negation of and with three args

Given the following definition of the negation of and with three arguments, I can prove different cases easily, but I'd like to write this proof in one forall statement somehow using Coq. Forall b1 b2 b3 : bool one of them being false returns true…
David Farthing
  • 237
  • 2
  • 13
0
votes
1 answer

How to use a tactic with a hypothesis in Coq?

I'm new in Coq and I have run into a dead end. I have a inductive definition that looks roughly like this (I have defined accept inductively before) : Inductive fun : accepts -> Prop := | fn1 : fun True | fn2 : forall (n : nat )(A : accepts),…
Sara
  • 339
  • 1
  • 8
0
votes
1 answer

How to use apply to "extract" a implication in Coq

I'll illustrate using an example. H : R -> P -> Q H0 : R Subgoal: (Q -> P) \ / (P -> Q) so my question is how do I extract out (P->Q). I have R already, but when I do 'apply H in H0', it evaluates everything and gives me Q.
0
votes
2 answers

How to do case analysis on the length of a list in Coq?

I am in a situation during a proof where I need to do case analysis on the length of a list l. When the length l < 2 it's one case (in which a binary operation like + does not apply) When the length l >= 2 it's the other case (in which the binary…
thor
  • 21,418
  • 31
  • 87
  • 173
0
votes
1 answer

How to automatically introduce symmetries into Coq hypotheses?

I have some equalities (=) and unequalities (<>) in the hypotheses such as: e : x2 = x1 n : x3 <> x1 I want to use tactics like assumption, but sometimes the expected (un)equality in the goal is in the other direction like: x1 = x2 x1 <> x3 My…
thor
  • 21,418
  • 31
  • 87
  • 173
-1
votes
3 answers

coq: Tactic to replace true hypothesis in 'and' statement

Assumptions: l: a < d Goal: (s a /\ a < d) <-> s a Here, I have an /\ with an assumed statement. The goal just needs l to be applied, but I cant seem to figure out the tactic. Apply, rewrite, and replace don't work.
John Targaryen
  • 1,109
  • 1
  • 13
  • 29
-1
votes
2 answers

Coq: How to prove if statements involving strings?

I have a string a and on comparison with string b, if equals has an string c, else has string x. I know in the hypothesis that fun x <= fun c. How do I prove this below statement? fun is some function which takes in string and returns nat. fun (if…
re3el
  • 735
  • 2
  • 12
  • 28
-2
votes
2 answers

How to prove list concatenation is not commutative using coq?

Sorry I am new to coq. I'm wondering how to prove list concatenation is not commutative using coq?
Serene M
  • 17
  • 1
1 2 3
25
26