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

Reasoning with pattern matchings in Coq

If I have a hypothesis of the form H: match G with | C x => e | _ => None end = Some T How can I deduce G = C x ? Thanks!
Nicolás
  • 303
  • 2
  • 6
0
votes
2 answers

How do destruct list in Coq (nil or not nil)

I want to destruct my object of type list on two cases like: H: lst = nil. H: lst <> nil
he11boy
  • 71
  • 3
0
votes
1 answer

How to show injectivity of a function?

Here's what I'm trying to prove: Theorem add_n_injective : forall n m p, n + m = n + p -> m = p. The + is notation for plus, defined as in https://softwarefoundations.cis.upenn.edu/lf-current/Basics.html: Fixpoint plus (n : nat) (m : nat) : nat := …
Max Heiber
  • 14,346
  • 12
  • 59
  • 97
0
votes
1 answer

How can I close this demonstration about opt_c in coq?

I'm reading Logical Foundation book. It introduces this Fixpoint and this Theorem: Fixpoint optimize_0plus (a:aexp) : aexp := match a with | APlus (ANum 0) e2 => optimize_0plus e2 | APlus e1 e2 => APlus (optimize_0plus e1)…
Marco Mantovani
  • 111
  • 2
  • 7
0
votes
3 answers

get field from Record Types in Coq

I am new to Coq. I have a record type and one definition: Record t : Type := T { width : nat; }. Definition indent shift f := match f with | T w => T (w + shift) end. I want to proof a trivial lemma: Lemma lemma : forall…
he11boy
  • 71
  • 3
0
votes
1 answer

Coq: Why rewrite of lemma in theorem create two subgoal?

I'm trying to proof that my function nonzeros' distribute over concat of list. I wrote nonzeros' with a filter in this way: Definition nonzeros' (l : list nat) : list nat := filter (fun x => match x with | O => false | _ => true end) l. I've…
Marco Mantovani
  • 111
  • 2
  • 7
0
votes
1 answer

Merging hint databases into core

Is there a way to add all lemmas in a hint database into core so that I don't have to keep writing auto with foo everywhere in a file?
Ifaz Kabir
  • 134
  • 8
0
votes
1 answer

How to prove by contradicting the goal?

Require Import Arith. Goal forall a b c: nat, nat_eq a b -> nat_eq b c -> nat_eq a c. Proof. intros a b c H0 H1. 1 subgoal a, b, c : nat H0 : eq_nat a b H1 : eq_nat b c ______________________________________(1/1) eq_nat a c This is just an…
Boooooo
  • 157
  • 3
  • 12
0
votes
1 answer

What is the difference between Notation and Definition from the point of view of the auto tactic?

In the STLC chapter of Programming Language Foundations, we find the following: (** [idB = \x:Bool. x] *) Notation idB := (abs x Bool (var x)). (** [idBB = \x:Bool->Bool. x] *) Notation idBB := (abs x (Arrow Bool Bool) (var x)). [...] (**…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
0
votes
1 answer

proof Lemma which based on Fixpoint definitions

Trying to prove following Lemma: I have tried unfold nth_error and nth in the goal but I cannot figure out a way to tell Coq to break the Fixpoint definition of these two functions. I have also tried to induction on n and the lists but none of them…
Boooooo
  • 157
  • 3
  • 12
0
votes
0 answers

Check disjoint lists in coq

I have a different groups of natural numbers(sn1 ,sn2… snn). I pass/give this group to a function ,which convert this group to a list.I want to prove these lists are disjoint.I have defined theorems about disjoint list.But I have a problem…
sana
  • 1
  • 2
0
votes
1 answer

Understanding the induction on evidence in coq

I am working on the theorem ev_ev__ev in IndProp.v of Software Foundations (Vol 1: Logical Foundations). Theorem ev_ev__ev : forall n m, even (n+m) -> even n -> even m. Proof. intros n m Enm En. induction En as [| n' Hn' IHn']. - (* En: ev_0…
hengxin
  • 1,867
  • 2
  • 21
  • 42
0
votes
2 answers

Prove inequality of complex objects

I have a pair of maps that are trivially incompatible. I'm wondering what's the graceful/automatized way to get a proof of it. Require Import Coq.Strings.String. (* Prelude: the total_map data structure from Software Foundations, slightly modified…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
0
votes
2 answers

How to automatically leverage hypotheses of the form x <> y?

Goal forall (w x y z: string), w <> x -> (if (eqb_string w x) then y else z) = z. Proof. intros. rewrite false_eqb_string by trivial. reflexivity. Qed. false_eqb_string is a rather trivial proof principle. I'd like to use it implicitly, via…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
0
votes
1 answer

Using "omega" for type "N"

For my research, I wrote a bunch of functions in Coq for the type nat and proved they are correct. Now I need to write the same functions for the type N but proving their correctness seems like a pain since the omega tactic does not work for this…
thbl2012
  • 27
  • 5