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

Translating Coq Definitions to agda?

I'm wondering if there is a systematic way to interpret Coq Definitions as agda programs. I'm working through translating part of programming foundations and am not able to get the tUpdate function to work below. Why is this failing. The coq…
user5775230
1
vote
1 answer

How to bind notation scope to a type

Consider the following toy development: Declare Scope entails_scope. Bind Scope entails_scope with nat. Reserved Notation "A |- B" (at level 60, no associativity). Inductive entails: nat -> nat -> Prop := | id {A}: A |- A where "A |- B" :=…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
1
vote
1 answer

Show that a term is not equal to a strictly larger term

Consider the following toy development: Require Import Coq.Strings.String. Inductive SingProp: Set := | Var: string -> SingProp | plus: SingProp -> SingProp -> SingProp | amp: SingProp -> SingProp -> SingProp. Goal forall A B, A <> amp A…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
1
vote
1 answer

Coq `ring` tactic with booleans: not a valid ring equation

The Coq docs say that the ring of booleans is predefined, and that all one has to do is Require Ring. The docs also say that the ring tactic works by normalizing w.r.t. associativity and commutativity. However, the ring tactic fails for this trivial…
Max Heiber
  • 14,346
  • 12
  • 59
  • 97
1
vote
0 answers

The termination predicate in Coq

Consider a predicate that models an evaluation relation. The relation will stop with either true or false, so that's why I want the values of my chains to be either a configuration or a boolean: Inductive compile_step : conf_type + bool ->…
user1868607
  • 2,558
  • 1
  • 17
  • 38
1
vote
3 answers

Natural number list in coq

I have a list of natural numbers, elements in the list are in descending order. I want to write lemma about the list ,that first element h is greater than all the elements of list . Let list is [h;h1;t] . 0 h1? Please guide me , how to write h is…
laiba naz
  • 57
  • 4
1
vote
1 answer

Extensionality axiom: why is it not unsound

Axiom of extensionality says that two functions are equal if their actions on each argument of the domain are equal. Axiom func_ext_dep : forall (A : Type) (B : A -> Type) (f g : forall x, B x), (forall x, f x = g x) -> f = g. Equality = on both…
simpadjo
  • 3,947
  • 1
  • 13
  • 38
1
vote
2 answers

Using well founded induction to define factorial

I have spent a lot of time on the notion of well founded induction and thought it was time to apply it to a simple case. So I wanted to use it do define the factorial function and came up with: Definition fac : nat -> nat := Fix LtWellFounded (fun _…
Sven Williamson
  • 1,094
  • 1
  • 10
  • 19
1
vote
1 answer

Strange behavior of semicolon in Coq

I'm having a problem understanding why my Coq code doesn't do what I expect in the code below. I tried to make the example as simplified as possible, but the problem didn't show up anymore when I made it even simpler. It's using CompCert 1.8…
Ptival
  • 9,167
  • 36
  • 53
1
vote
1 answer

Parsing a simple imperative language in Coq

I'm trying to parse the following simple imperative language in Coq: Set Warnings "-notation-overridden,-parsing". From Coq Require Import Bool.Bool. From Coq Require Import Init.Nat. From Coq Require Import Arith.Arith. From Coq Require Import…
user1868607
  • 2,558
  • 1
  • 17
  • 38
1
vote
3 answers

Prove equality on list constructed with a map

I have two lists, one constructed directly by recursion and the other constructed using a map operation. I'm trying to show they are equal, and surprisingly I got stuck. Require Import Coq.Lists.List. Import ListNotations. Fixpoint ls_zeroes n := …
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
1
vote
1 answer

Difficulties in proving equalities using the Coq MSet library

I'm using the Coq MSet library in my development and I'm having some trouble to use the generalised rewriting involving MSet values. Below I have a simplified version of my problem: First, we need to define the modules for MSet. Module NSet := Make…
Rodrigo Ribeiro
  • 3,198
  • 1
  • 18
  • 26
1
vote
1 answer

Back to Coq proof checker after 5-8 years away: how to prove that (forall n, m : N, (n - (S m)) = pred(n - m))?

Somewhere between 5 and 8 years ago (probably 6 or 7) I wrote a full Formalization of Bubble Sort in Coq. One of the earliest Lemmas proven was the one in the title, which I called "sub_succ_r" (or maybe it's the standard name?): forall n m : nat,…
1
vote
1 answer

Automatically specialize forall when the parameters are in scope

Consider the following simple problem: Goal forall (R : relation nat) (a b c d e f g h : nat), (forall m n : nat, R m n -> False) -> (R a b) -> False. Proof. intros ? a b c d e f g h H1 H2. saturate H1. (* <-- TODO implement this *) …
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
1
vote
1 answer

Coq VST Internal structure copying

run into a problem with VST(Verified Software Toolchain) 2.5v library for Coq 8.10.1: Got an error with the latest working commit of VST namely "Internal structure copying is not supported". Minimal example: struct foo {unsigned int a;}; struct foo…
Yarick
  • 326
  • 3
  • 14
1 2 3
99
100