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

Warning : “Set this option from the IDE menu instead” in coq

I'm studying the Chapter "Imp" of Software foundation. I runned the command Unset Printing Coercions. in Coq Ide, the coq Message warned me that "Set this option from the IDE menu instead" and obviously the command doesn't work. I guess maybe this…
Echo_Zero
  • 15
  • 3
0
votes
1 answer

Why does Coq remove/clear my asserted lemmas in my proof after the base case is proved?

I want to assert some lemmas at the top of the proof and re-use them for every future goal. I did: Theorem add_comm_eauto_using: forall n m: nat, n + m = m + n. Proof. intros. induction n. assert (H: forall n, n + 0 = n)…
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
0
votes
2 answers

What do the consecutive in's in Coq do and eval & red & Idtac do?

I know in OCaml the syntax let x = val in exp means x has the value v when in expression exp. But what does something like let add_left_red := eval red in add_left in (* reduce add_left, but leave goal alone *) idtac add_left_red. I assume it…
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
0
votes
2 answers

Remove useless hypothesis from context

Sometimes I have a hypothesis in my proof context that I've used already, and now I know I won't need it anymore. In order to keep my context tidy while I work on the proof, I'd like to remove this hypothesis. Is there a tactic to do that?
Jo Liss
  • 30,333
  • 19
  • 121
  • 170
0
votes
1 answer

Coq: prove while is equivalent to repeat

I'm new to Coq and to learn formal semantics I'm following the book Software Foundations. Currently I'm in the chapter: https://softwarefoundations.cis.upenn.edu/lf-current/Imp.html. Where it defines the commands for a simple imperative language. As…
0
votes
1 answer

Coq: How are the equality tacticts symmetry and transitivity defined?

I'm interested in how the Coq tactics symmetry and transitivity actually work. I've read the Coq manual but this only describes what they do, not how they operate on a proof and change the proof states. As an example of what I'm looking for, in…
0
votes
0 answers

Coq rewrite tactic can't find subterm

I writing a proof in coq and I'm trying to use the rewrite tactic. I wanted to include a minimal working example but there are quite a lot of things I would have to include (this proof is building on previous work of my own). Let me know if it is…
0
votes
1 answer

Proof of "less equal" transitive law in Coq

I'm very new at coq.(I'm reading now Poly section in Software Foundation) In Basics section, they define ble_nat function that is x <= y, then I want to prove transitive law about this, like: Notation "x =< y" := (ble_nat x y) (at level 50, left…
0
votes
1 answer

How can I write a tactic which works both in a goal and a hypothesis?

I am trying to write a tactic which can work on goals and hypothesis similar to symmetry, but for inequalities as well. Now, there is some documentation on generalized rewriting, but this is very advanced and perhaps should be a different question.…
sdpoll
  • 426
  • 2
  • 12
0
votes
1 answer

Coq's proof #Coq

I try to solve this proof but I don't find how to it. I have two subgoals but I don't even know if it's correct. Here the lemma that I trid to solve with this but I'm stuck : 2 subgoals a, b : Nat H : Equal (leB a b)…
0
votes
1 answer

Supply exist argument COQ

enter image description here Hey guys. So I have H0, I got my x and H1. as far as I understand, if ill show that there is an x for which P x -> False, ill get a False and can discriminate the case. I just dont understand how to provide that x and…
user615297
  • 11
  • 3
0
votes
2 answers

How does one produce types (or theorems) from proof terms (programs or objects) in Coq?

I was curious to learn about type inference in Coq. I wanted a concrete way in Coq to generate types (theorems) given a proof term/object/program. So given a proof term (perhaps with a hole, perhaps with not holes or perhaps a proof sub term) can I…
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
0
votes
2 answers

How to Import Coq library HoTT in CoqIde

I want to use HoTT library in my CoqIde. My environment is Coq_Platform_2021.09.0.8.13-installer-windows-x86_64-signed and I have tried a lot of methods. I tried to write Require Import HoTT. in CoqIde and get the error Unable to locate library…
0
votes
2 answers

How to prove Theorem plus_lt : forall n1 n2 m, n1 + n2 < m -> n1 < m /\ n2 < m

Here I am with another doubt on how to prove theorems in coq. This is as far as I got: Theorem plus_lt : forall n1 n2 m, n1 + n2 < m -> n1 < m /\ n2 < m. Proof. intros n1. induction n2 as [| n2' IHn2']. - intros m H. inversion H. +…
Felipe Balbi
  • 147
  • 7
0
votes
1 answer

How to prove this DeMorgan law without using automation tactics in Coq?

This is the law I'm trying to prove here: Goal forall (X : Type) (p : X -> Prop), (exists x, ~ p x) <-> ~ (forall x, p x). Here's my code up to a point where I don't know in which direction to head: Proof. intros. split. - intros. destruct H…