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

Arithmetic expressions and big-step semantic

I am working on a project where i have to define a type for arithmetic expressions and an inductive predicate for big-step operational semantic. First i began with defining a type for valuations and i decided to do a list of string * Z Definition…
imaneEl
  • 17
  • 3
1
vote
1 answer

Unable to satisfy the following constraints: In environment

In proof editing mode, in use of the apply tactic, Coq gives me the following error message: Error: Unable to satisfy the following constraints: In environment: signature : Signature X : gset evar ?MLVariables : "MLVariables" ?H : "FMap (gmap…
Jan Tušil
  • 958
  • 5
  • 16
1
vote
2 answers

Type coercion from nat to rat

I'm stuck with this very simple lemma, and wonder what is the best way to proceed. From mathcomp Require Import ssrint rat ssralg ssrnum. Import GRing.Theory. Import Num.Theory. Import Num.Def. Open Scope ring_scope. Lemma X (n m : nat) : (n <=…
Pierre Jouvelot
  • 901
  • 3
  • 13
1
vote
2 answers

Theorem about vectors and recursive functions

I want to prove aaa below. Kth element of the output of the function for arbitrary natural number k must be same as the kth value of the same vector that has undergone the same processing. Require Import Coq.Vectors.Vector. Require Import…
Daisuke Sugawara
  • 311
  • 4
  • 20
1
vote
1 answer

Can I avoid using Option A when I know that head cannot fail?

I am quite new in the world of the ATP, but definitely very motivated. I am starting to deal with dependent types. I am involved in a project where I have defined the type for (finite and infinite) sequences. Inductive sequence {X : Type} : Type := …
1
vote
1 answer

diffefentiation of (1/2)*(x-y)^2 on x is x - y

I want to prove following. Require Import Coq.Reals.Reals. Require Import Coquelicot.Coquelicot. Goal forall x y:R, is_derive (fun x:R => (1/2)*(x-y)^2) x (x-y). intros x y. evar (e:R). replace (x-y) with e. apply is_derive_scal. apply…
Daisuke Sugawara
  • 311
  • 4
  • 20
1
vote
1 answer

Coq: Syntax error 'Type' or 'Types' expected after 'Implicit'

I'm getting Syntax error 'Type' or 'Types' expected after 'Implicit' when typing in the following from Coq'Art: Set Implicit Arguments. CoInductive LList (A: Set) : Set := LNil : LList A | LCons : A -> LList A -> LList A. Implicit Arguments…
Max Heiber
  • 14,346
  • 12
  • 59
  • 97
1
vote
2 answers

Make two arbitrary variables the same in Coq

I have the following coq code: Theorem filter_exercise : forall (X : Type) (l lf : list X) (test : X -> bool) (x : X), filter test l = x :: lf -> test x = true. Proof. intros X l lf test x eq. induction l…
gust
  • 878
  • 9
  • 23
1
vote
1 answer

Error when defining custom notation for an embedded logic

I'm working on a colleague's embedding of modal logic in Coq and I'm trying to define a custom notation for formulas of said logic, like presented here and also on Volume 2 of the book Software Foundations. So far I have this: Declare Custom Entry…
Miguel N.
  • 29
  • 6
1
vote
1 answer

Coq syntax. Predicate Logic

Can anyone help me out with the coq syntax for the following proof: ~ (exists x:D, ~ R x) |- (forall y:D, R y)
1
vote
1 answer

Can we define recursive definitions in Coq?

I know Coq allows to define mutually recursive inductive types. But is there a way to write the recursive definitions in Coq? For example, I want to write a definition as: Definition myDefinition A := forall B C, (myDefinition B) \/ (A =…
Baber
  • 301
  • 2
  • 6
  • 17
1
vote
1 answer

Dependent functions in Coq

I am very new to Coq, and hope my question is not too basic. I am simply wondering how I define dependent functions in Coq. For example, how could I define a function from Booleans that sends true to true and false to the natural number seven ? I…
1
vote
1 answer

Different arguments, but behavior of function is same

I want to prove lemma RnP_eq. From mathcomp Require Import ssreflect. Require Import Coq.Program.Equality. Definition func {n m l o:nat} (I:t R 0 -> t R m -> t R l)(J:t R n -> t R l -> t R o):= (fun (x:t R n)(a:t R m) => J (snd (splitat 0 x))…
Daisuke Sugawara
  • 311
  • 4
  • 20
1
vote
1 answer

Coq unable to unify -- how to change hypothesis?

Coq beginner here. I have the following silly theorems: Theorem plus_same : forall a b c : nat, a+b=a+c -> b=c. Proof. Admitted. Theorem advanced_commutivity: forall x y z w : nat, x + y + (z+w) = x + z + (y + w). Proof. …
gust
  • 878
  • 9
  • 23
1
vote
1 answer

Coq Z_3 group definition left id theorem

I am trying to prove that Z3 is a group. Class Group G : Type := { e : G; mult : G -> G -> G; inv : G -> G; left_id : forall x:G, mult e x = x; left_inv : forall x:G, mult (inv x) x = e; assoc : forall x y z:G, mult x…
user4035
  • 22,508
  • 11
  • 59
  • 94