Questions tagged [ltac]

The Ltac language, Coq's domain-specific language for proof search procedures. Use this tag on questions about the language and questions about proof automation using Ltac.

Here are some references on Ltac:

  • The Coq Reference Manual, sect. 9;
  • Certified Programming with Dependent Types by A. Chlipala, the Proof Search in Ltac chapter;
  • The original paper: A Tactic Language for the System Coq by D. Delahaye (‎2000).
72 questions
0
votes
1 answer

apply ltac to subexpression of a goal

Here is a short example of what I am trying to do. Let's say I have a relation Inductive divisible: nat -> nat -> Type := | one : forall n, divisible n 1. ..etc... I have also the following ltac Ltac simplify := autorewrite with blah I would like…
push33n
  • 398
  • 4
  • 12
0
votes
1 answer

Is it possible to turn a context pattern into a Gallina function?

In Ltac, a context pattern can be used to build an Ltac-level function which accepts a Gallina term and constructs a Gallina term by filling in a hole. I would like to reify this function and use it at the level of Gallina, rather than Ltac. E.g.,…
dunnl
  • 55
  • 6
0
votes
1 answer

Does Isabelle/HOL have its tactic language?

Coq has tactic language Ltac with match facilities and so on. Does Isabelle/HOL have some programming language for tactics with the services for parsing, pattern matching and so on? I skimmed through Isabelle's Isar reference manual and the old…
TomR
  • 2,696
  • 6
  • 34
  • 87
0
votes
1 answer

Coq tactic for applying a concrete hypothesis to an existential goal

Consider the following example: Theorem example: forall (P: nat->Prop), P (1+2+3) -> (exists x, P x). Proof. intros. apply H The apply H fails with Unable to unify "P (1 + 2 + 3)" with "exists x : nat, P x". So I know that I could use the…
Jeremy Salwen
  • 8,061
  • 5
  • 50
  • 73
0
votes
1 answer

Pattern-matching a hypothesis obtained from a pattern-match on goal

Consider the following development: Definition done {T : Type} (x : T) := True. Goal Test. pose 1 as n. assert (done n) by constructor. Fail ltac:( match goal with | [ H : done _ |- _ ] => fail | [ H : _ |- _ ] => match…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
0
votes
1 answer

Can the injection tactic modify the end goal, or add extraneous assumptions?

Consider the following development, an isolated part of Adam Chlipala's simplHyp: (** Fail if H is in context *) Ltac notInCtx H := assert H; [ assumption | fail 1 ] || idtac. Ltac injectionInCtx := match goal with (* Is matching on G strictly…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
0
votes
1 answer

Ltac: Matching goal with type that depends on name of previous goal

I'm trying to write Ltac code that looks like this: match goal with | [ e : expr, H : (is_v_of_expr e = true) |- _ ] => idtac end. (* The reference e was not found in the current environment *) The problem is, trying to match a case where…
jmite
  • 8,171
  • 6
  • 40
  • 81
0
votes
1 answer

Using backtracking to find value for existential in Coq

I'm in a situation where I have a goal of the following form: exists x : T1, f x = y. where y : T2 and f : T1 -> T2. The trick is that I've defined T1 and T2 in such a way that their constructors correspond, so for a human, it's easy to see what…
jmite
  • 8,171
  • 6
  • 40
  • 81
0
votes
2 answers

Interaction between type classes and auto tactic

Consider this simple development. I have two trivial data types: Inductive A := | A1 | A2. Inductive B := | B1 : A -> B | B2. Now I introduce a concept of relation and define ordering on data types A and B expressed as an inductive data…
Jan Stolarek
  • 1,409
  • 1
  • 11
  • 21
0
votes
2 answers

Matching expression context under `forall` with Ltac

Say I have the following definitions in Coq: Inductive Compare := Lt | Eq | Gt. Fixpoint compare (x y : nat) : Compare := match x, y with | 0, 0 => Eq | 0, S _ => Lt | S _, 0 => Gt | S x', S y' => compare x' y' end. Now consider this…
Jan Stolarek
  • 1,409
  • 1
  • 11
  • 21
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

Smart modification of Coq environment

Ltac is used for automating proofs and modifying proof environment, outputting strings and defining complex notations. Can it be also used for "smart" modifications of Coq environment? Here are two failed attempts: Variable Phy: Set. Fail Let pp…
jaam
  • 900
  • 4
  • 23
1 2 3 4
5