Questions tagged [coq]

Coq is an interactive theorem prover based on the Calculus of Inductive Constructions.

Coq is an interactive theorem prover based on the calculus of inductive constructions.

Resources

66 questions
12
votes
1 answer

baz_num_elts exercise from Software Foundations

I'm at the following exercise in Software Foundations: (** **** Exercise: 2 stars (baz_num_elts) *) (** Consider the following inductive definition: *) Inductive baz : Type := | x : baz -> baz | y : baz -> bool -> baz. (** How _many_…
Twernmilt
  • 123
  • 6
5
votes
2 answers

Proof of equality with destructuring let...in

I have some expression (f n in the example below) returning a tuple. I would like to prove that f n is equal to let (x, y) := f n in (x, y), which seems like it should be easy. What tactic should I use? Definition f (n : nat) : nat * nat := …
5
votes
1 answer

How does this use of "apply" in Coq work?

I'm working my way through software foundations. In the Chapter titled "Tactics", I'm able to prove this theorem in Coq: Theorem silly_ex : (∀ n, evenb n = true → oddb (S n) = true) → oddb 3 = true → evenb 4 = true. Proof. intros…
Raiden Worley
  • 245
  • 1
  • 4
3
votes
2 answers

I don't know how to prove a simple theorem used with fixpoint in Coq

I am a beginner in coq and want to prove the following theorem t1. First I used induction i and destruct j, but it got bogged down in the middle. I would like some hints for this problem. Function f takes two arguments of nat and returns Prop…
FUJII S.
  • 33
  • 5
3
votes
1 answer

For proof automation in Coq, when is it appropriate to use canonical structures or Equations instead of Ltac?

There are a few possible approaches to proof automation in modern Coq. Writing proof scripts with Ltac. This is the approach described in http://adam.chlipala.net/cpdt/, which the author uses to great effect in projects like…
LogicChains
  • 131
  • 3
2
votes
1 answer

How to prove transitivity of < (Software Foundations exercise)?

I'm working through the "Properties of Relations" chapter of Software Foundations, but have got stuck on one of the exercises, lt_trans'': Theorem lt_trans'' : transitive lt. Proof. unfold lt. unfold transitive. intros n m o Hnm Hmo. …
Matt R
  • 141
  • 4
1
vote
1 answer

How to prove T Z = Z for binary representation of natural numbers in Coq

I have defined an Inductive in Coq for binary representation of natural numbers as follows: Inductive bin : Type := | Z : bin | T : bin -> bin | M : bin -> bin. and two recursive functions to convert between nat and bin types as: Fixpoint…
Morin
  • 25
  • 4
1
vote
2 answers

Is there a tactic to help resolving existential quantifiers in Coq?

I am working on Software Foundations Volume 1 on my own it is its 2019 version by the way, and I have reached to its lesson Inductively Defined Propositions, and there, for almost one month I have been stuck on an exercise re_not_empty expressed…
Morin
  • 25
  • 4
1
vote
1 answer

Instantiating a class with a sig'd type in Coq

I can easily define a class that corresponds to the notion of a "monoidal structure" on a type M via Definition associative {X:Type} (f : X -> X -> X) : Prop := forall x y z:X, f (f x y) z = f x (f y z). Definition opId {X:Type} (f : X -> X -> X)…
Feryll
  • 113
  • 3
0
votes
0 answers

Coq: default values for vectors

Let's say there is a vector of length $n$: Require Import Vector. Variable T:Type. Variable n:nat. Variable v:t T n. "list" gives a function "nth" that demands a default result that is returned when the list is longer than the index requested. This…
user7358
  • 101
0
votes
0 answers

Coq stuck on proof for Theorem eqblist_true

I'm stuck on this proof for the theorem eqblist_true. So far what I have is: Theorem eqblist_true : forall l1 l2, eqblist l1 l2 = true -> l1 = l2. Proof. intros l1. induction l1 as [| l1']. - intros l2 H. simpl in H. destruct l2 as [|…
Chloe
  • 1