Skip to main content

Questions tagged [tactic]

A tactic is a command or instruction for constructing a formal proof by applying a common proof technique. For questions about high-level techniques for constructing proofs, use the tag (strategy).

1 vote
1 answer
32 views

Feeding rewrites and other hints into an omnibus tactic

How do I feed rewrites that I've marked as safe into a custom tactic? I'm trying to write shorter Coq proofs with more of the easy stuff hidden. To that end, in the script below I proved that ...
7 votes
2 answers
163 views

When is the lean 4 "by" required?

I am reading an introductory math/lean course here, and got confused about when the tactic/keyword by is required. It is used most of the time, but is occasionally ...
0 votes
1 answer
60 views

Coq equivalent of Lean's `nth_rewrite`

Does Coq have an equivalent of Lean's nth_rewrite? rewrite ... at ... appears to specialize at its first unification site ...
2 votes
1 answer
43 views

Coq cannot `simple apply reflexivity` in custom tactic

The fast reflexivity tactic shown below is very interesting. It exposes some of the unification machinery by disabling it. I'm planning on going back and using it in the first part of Software ...
2 votes
1 answer
154 views

Debug autorewrite in Coq

I often meet proofs using autorewrite which Coq takes a while to process for some reason. (Setoid rewriting) I then manually figure out which rewrite rules were ...
3 votes
1 answer
66 views

What's the idiomatic way to instantiate a tuple of evars in Ltac2?

Suppose that I have a local definition of a type ty in the context, and ty can be any nested tuple, e.g.: ...
0 votes
1 answer
61 views

Ltac, How to intro a fresh variable which may already have a good estiblished name given by a universal quantifier?

Context I am currently self studying Coq following the Software Foundations book series which I am finding very approachable. I have finally gotten round to ...
2 votes
1 answer
100 views

What does `induction ... in ...` do in Coq?

I'm self-studying the Semantics course, and met the following proof script in the warmup directory: ...
3 votes
2 answers
138 views

Lean4: How to construct an HEq between dependent functions?

I have an extremely simple goal to prove: HEq (fun px rd => match px, rd with | Sum.inr _ppos, dir => dir) fun x => id The reason the match ...
0 votes
1 answer
39 views

Tactic to Propify a bool expression

Let's say I have bool expressions <bexp> consisting of true, false, variables, ...
3 votes
2 answers
74 views

Creating a tactic for 'destructing' a list by last element?

Sometimes, I have a context in which I have some l : list X, and I want to prove the goal by proving that (1) If l = [], the ...
2 votes
1 answer
99 views

Proving that equality is decidable on an ``Inductive Set``

I've managed to prove that equality within a type is indeed decidable. ...
4 votes
2 answers
187 views

Which proof assistants implement Church's rule?

Church's rule (CR) is one of the hallmarks of constructive mathematics, and is an admissible rule in a wide variety of constructive theories (you might consider CR to be a requirement for constructive ...
3 votes
1 answer
200 views

Selecting both a hypothesis and Goal while applying a tactic

I have a hypothesis H and some function foo. I want to simplify foo in both H and the ...
8 votes
1 answer
386 views

How does Lean `simp` tactic work?

The doc at https://leanprover-community.github.io/extras/simp.html says about simp: all it does is repeatedly replace (or rewrite) subterms of the form A by B, for ...
7 votes
1 answer
557 views

Examples of theories where tactic language is required for simple proofs

I was always under the impression, that separate tactic languages were generally considered to be vital for writing long proofs. I see tactic languages as a kind of interpreted DSL to generate ...
0 votes
1 answer
119 views

Specializing forall quantifiers in Coq

I have an inductively defined type of expressions: ...
4 votes
0 answers
65 views

Using CoqHammer from Ltac2

As it seems most likely to me, due to the special way arguments are evaluated in CoqHammer tactics (I tried to read the source code in OCaml but unfortunately I didn't understand much of it), it is ...
1 vote
1 answer
128 views

Rewriting inside quantified propositions in Coq?

Is there a simple way to use rewrites inside quantified Props? As an example, consider the following: ...
20 votes
2 answers
1k views

What's the difference between reflection and tactics?

Agda has a reflection mechanism (not equality reflection or reflexivity, but something related to metaprogramming based on goals and contexts to generate terms) and people have developed some ...
1 vote
1 answer
106 views

Question about the tactic "obtain"

I am having difficulty activating the tactic obtain. Is it part of mathlib and where is its exact location?
3 votes
3 answers
213 views

In Coq, is there a simpler tactic for introducing a disjunction and immediately destructing it?

Very often, I find myself writing some tactics like these: assert (delta = 1 \/ delta <> 1) as Hd by lia. destruct Hd. ...(proceed to work with two cases)... ...
4 votes
1 answer
2k views

Doing case-by-case proofs about match statements in Lean4

In Lean4, I am stuck in a proof with a goal like this: ...
5 votes
1 answer
475 views

Tactics for Array/List simplification in lean4

Because there are both Arrays and Lists in Lean4, sometimes you end up with code that has a mixture of Lists and Arrays interspersed with basic operations and conversions between the two. For example,...
5 votes
1 answer
493 views

Simple Proof about `String.split`

I am new to lean, working on proving a simple lemma in lean4. lemma String.split_empty (c): String.split "" c = [""] I tried looking for ...
3 votes
1 answer
156 views

Applying custom tactic in hypothesis

To avoid tedious repetition I have a tactic that looks something like this: Ltac unfolds := try unfold foo; try unfold bar; try unfold baz; apply some_lemma. ...
3 votes
2 answers
232 views

Coq: can `tauto` be used to prove classical tautologies?

When I experiment, I get inconsistent results. Running the following code (with a proof included to double-check that it's provable) ...
1 vote
1 answer
107 views

Proving that applicative functors compose

For simplicity, here an applicative functor means (in a proof assistant based on dependent type theory) the Haskellian applicative functor, bundled with its equational laws. This I can of course brute ...
3 votes
0 answers
93 views

Where is the discriminate tactic defined in Coq?

One can read the Coq documentation about discriminate tactic here. Were is this tactic actually defined?
6 votes
1 answer
405 views

How to evaluate proof terms through opaque definitions?

Is there is a way to force computation over opaque terms, for the purposes of debugging/meta-analysis of proof scripts. I understand why Coq doesn’t do this by default, and guess it would probably ...

15 30 50 per page