Questions tagged [coq]

Coq is a formal proof management system, semi-interactive theorem prover and functional programming language. Coq is used for software verification, the formalization of programming languages, the formalization of mathematical theorems, teaching, and more. Due to the interactive nature of Coq, we recommend questions to link to executable examples at https://x80.org/collacoq/ if deemed appropriate.

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

Resources

2862 questions
1
vote
1 answer

Understanding how to prove some lemmas on the regular expressions from Software Foundations

I am working through Software Foundations, and am currently on the IndProp section. Note: I'm doing this alone, this isn't homework. I am still struggling to get my mind around how to work with these inductive types. In the process of proving the…
A Question Asker
  • 3,339
  • 7
  • 31
  • 39
1
vote
1 answer

How to find value at different indexes

I have defined a function, which finds the greatest value from the natural number list and move this value to head position of the list. I am sure, all the elements in the list are less or equal to the value at head location. Then I defined…
rosi javi
  • 35
  • 4
1
vote
1 answer

rules on instantiation of existential variables in coq

I'm working through programming language foundations and am confused by this line: "Existential variables cannot be instantiated with terms containing ordinary variables that did not exist at the time the existential variable was created.…
push33n
  • 398
  • 4
  • 12
1
vote
1 answer

Understanding and working with nested inductive definitons in coq

I'm trying to prove insert_SearchTree, a theorem about the preservation of a binary search tree after an insertion relation, below. I'm not sure how to use the induction hypothesis which relies on the nested Inductive definitions, namely…
user5775230
1
vote
1 answer

How to prove a*b*c=a*(b*c) in Coq?

Im trying to prove the above question. I have been given a definition of an induction: Definition nat_ind (p : nat -> Prop) (basis : p 0) (step : forall n, p n -> p (S n)) : forall n, p n := fix f n := match n return p n with …
1
vote
1 answer

Searching Coq libraries

I'm trying to prove that n <= 2^n in Coq, and I'm missing a simple lemma that must exist somewhere: a <= b /\ c <= d -> a+c <= b+d Even more generally, how can I search Coq libraries for lemmas like this one? Here is my code for…
OrenIshShalom
  • 5,974
  • 9
  • 37
  • 87
1
vote
1 answer

Implementing/specifying permutation groups in coq

I am trying to implement/specify the permutation groups (symmetric groups) in coq. This went well for a bit, until I tried to prove that the identity is actually the identity. My proof gets stuck on proving that the proposition "x is invertible" is…
Tempestas Ludi
  • 1,113
  • 9
  • 24
1
vote
1 answer

Modifying, working with, and applying let expressions in Coq

I'm not sure how to apply the let expression in coq. This is from the selection sort example in PF. Once the select function is defined, this lemma is proved. Lemma select_perm: forall x l, let (y,r) := select x l in Permutation (x::l)…
user5775230
1
vote
1 answer

Applying a dependent type to an arguement to assert a goal in Coq?

If I have a general setup like the following, how can I prove I assert (f a)? A : Type f : A -> Prop a : A ... ============================ f a Specifically, why can't I use any of these tactics, and what do the errors mean? specialize (f…
user5775230
1
vote
1 answer

comparable.vo contains library Top.comparable and not library comparable

I am very new to Coq. In our project, we switched to using the coq_makefile utility and came across the following problem. Stepping through a proof script would result in this error: Require Import comparable. Error: The file…
1
vote
1 answer

Why the `Omega' tactic can't solve a simple problem like this

I have two theorems tst4 and tst3, why `omega' can solve tst4 but not tst3? This just does not make sense to me. Theorem tst4 : forall (a b c : nat), (a = b + 1 /\ b = 0) -> (False \/ a >= 1). Proof. intros. omega. Qed. …
yrZhang
  • 55
  • 3
1
vote
0 answers

Proof by Contradiction in Coq (NOT Elimtype False)

I am in the process of proving a Lemma in Coq. One of my hypotheses is: H0: ~p -> False for some proposition p. The only subgoal I have left is p One would suppose there is a tactic that lets me prove p using H0 in one step. However I can't seem to…
1
vote
1 answer

Prove two inhabitants in Prop are not equal?

Is it possible to have some A, B : Prop such that we can provide a proof of: Section QUESTION. A: Prop := . B : Prop := . Theorem ANeqB: A <> B. Proof. Qed. Intuitively, I think not,…
Siddharth Bhat
  • 823
  • 5
  • 15
1
vote
1 answer

How to set all occurrence of a Variable in Section implicit

Let's think of something like this Section as an example Section myList. Variable X : Type. Definition myListApp2 (l1 l2 : list X) := app l1 l2. Definition myListApp3 (l1 l2 l3 : list X) := app (app l1 l2) l3. Definition NoXUse n :=…
1
vote
1 answer

I can't solve an error "Universes are unbound"

I'm developing a library for googology in Coq. I ran into a problem. Set Universe Polymorphism. Set Polymorphic Inductive Cumulativity. Inductive Sum@{i j} (A : Type@{i}) (B : Type@{j}) : Type@{max(i,j)} := left : A -> Sum A B | right : B -> Sum…
Hexirp
  • 410
  • 2
  • 11
1 2 3
99
100