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

Decomposing equality of constructors with match expressions in Coq

I have a question similar to Decomposing equality of constructors coq, however, my equality contains a match expression. Consider the example (which is nonsensical, but just used for clarification): Fixpoint positive (n : nat) := match n with |…
user1544337
0
votes
1 answer

What is the EvalOp in Coq CompCert

The definition of EvalOp is in compcert.backend.SplitLongproof: Ltac EvalOp := eauto; match goal with | [ |- eval_exprlist _ _ _ _ _ Enil _ ] => constructor | [ |- eval_exprlist _ _ _ _ _ (_:::_) _ ] => econstructor; EvalOp | [ |-…
Jian Wang
  • 103
  • 5
0
votes
2 answers

How to prove theorem about list of pairs

I tried to continue proving this practice example that is about list of pairs, but it seems impossible. How should I continue to solve this theorem? Require Import List. Fixpoint split (A B:Set)(x:list (A*B)) : (list A)*(list B) := match x with …
Jeffrey
  • 23
  • 6
0
votes
1 answer

Using ` in ` pattern for user defined tactics

There are many tactics in the standard library, such as the simpl_list, simpl_map, etc. which do not have a in form. This is awkward, because many a times, I'd like to run simpl_list within the context of a hypothesis. Is there some way to enable…
Siddharth Bhat
  • 823
  • 5
  • 15
0
votes
2 answers

what is the "editId" in Coq's XML Protocol document?

In Coq's XML Protocol document (for the Add operation), a line reads ${editId}. What is the editID here? I asked this because I failed to interact with coqtop in the ideslave mode. Using coq-8.6.1/theories/FSets/FSetCompat.v as an…
Jian Wang
  • 103
  • 5
0
votes
1 answer

How can I break `forall i: nat i < S k -> H` in Coq into `i < k and i=k`?

I have to prove: i < Datatypes.length (l0 ++ f :: nil) -> H I have a separate hypothesis for i < Datatypes.length l0 and i = Datatypes.length l0.
abhishek
  • 850
  • 6
  • 14
0
votes
1 answer

prove that a list returned from a recursively defined function is fixed length in Coq

How do I prove a lemma like the following: Require Import Coq.Lists.List. Lemma len_seq_n : forall start n, length (seq start n)=n. I tried Proof. induction n. simpl. auto. simpl. and at this point Coq gives me 1 subgoal start, n : nat IHn :…
D. Huang
  • 445
  • 1
  • 4
  • 5
0
votes
1 answer

Coq: rewrite preserving input hypothesis

I would like to rewrite a hypothesis while keeping the old version, and saving the result of the rewrite under a new name. How should I do that?
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
0
votes
0 answers

Ltac : instantiate forall hypothesis

I am working on a tactic that would create two new hypothesis x0 : D x0_Linked : P x0 from an hypothesis of that form H : forall x : D, P x Here is my Ltac code : Ltac mytactic h t x := match type of h with | (forall (_: ?X1), _) => evar…
L. Soret
  • 169
  • 10
0
votes
1 answer

how to use hypothesis which includes universal quantifier in Coq?

I'm new to Coq. I'm confused about the proof below: Lemma nth_eq : forall {A} (l1 l2 : list A), length l1 = length l2 -> (forall d k, nth k l1 d = nth k l2 d) ->l1 = l2. Proof. intros. The result shows: 1 subgoal A : Type l1, l2 : list A H :…
Coneain
  • 198
  • 12
0
votes
1 answer

What tactic should I use to derive a contradiction from an absurd equality?

Let's say that I have H: 0 = 1 in scope. How can I use this to conclude False?
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
0
votes
2 answers

Proof involving unfolding two recursive functions in COQ

I've began learning Coq, and am trying to prove something that seems fairly simple: if a list contains x, then the number of instances of x in that list will be > 0. I've defined the contains and count functions as follows: Fixpoint contains (n:…
LogicChains
  • 4,332
  • 2
  • 18
  • 27
0
votes
1 answer

Re-writing without using symmetry tactic

This is the coq version I'm using: sibi { ~ }-> coqc --version The Coq Proof Assistant, version 8.4pl4 (November 2015) compiled on Nov 04 2015 12:56:53 with OCaml 4.02.3 This is the theorem I'm trying to prove: Require Import Coq.Lists.List. Import…
Sibi
  • 47,472
  • 16
  • 95
  • 163
0
votes
1 answer

Coq - undocumented error on induction with eqn:

Using Coq 8.4pl3, I'm getting an error on induction with the eqn: variant that is not listed under induction in the reference manual. (* Export below requires Software Foundations 4.0. *) Require Export Logic. Inductive disjoint (X : Type) (l1 l2 :…
0
votes
1 answer

Coq - disj_conj_intro_patterns for inductive propositions

Given an arbitrary Inductive proposition definition in Coq, is there a general formula for deriving a reasonable disj_conj_intro_pattern to use when calling the induction tactic on the inductive proposition? In general, a complete intro_pattern for…
1 2 3
25
26