coq

coq field tactic fails to simplify, yeilds “m <> 0%R”

冷暖自知 提交于 2020-07-23 06:14:09
问题 I'm new to Coq. I've been working through Pierce's Logical Foundations. I'm stepping into new ground. I'm trying use of the field tactic for the first time. I use it thrice in the below theorem. Twice it fails, yielding m <> 0%R where m is a term in context. I'm sure I just fail to understand proper use. May someone enlighten me? (I tried reading this doc page but didn't gain much understanding!) From Coq Require Import Reals.Reals. Require Import Field. Definition simple_compound (A r n m :

How to switch the current goal in Coq?

烂漫一生 提交于 2020-07-18 09:02:16
问题 Is it possible to switch the current goal or subgoal to prove in Coq? For example, I have a goal like this (from an eexists): ______________________________________(1/1) ?s > 0 /\ r1 * (r1 + s1) + ?s = r3 * (r3 + s2) What I want to do is to split and prove the right conjunct first. This I think will give the value of the existential variable ?s , and the left conjunct should be just a simplification away. But split by default set the left conjunct ?s > 0 as the current goal. _________________

Is this relationship between forall and exists provable in Coq/intuitionistic logic?

梦想的初衷 提交于 2020-07-15 07:22:28
问题 Is the following theorem provable in Coq? And if not, is there a way to prove it isn't provable? Theorem not_for_all_is_exists: forall (X : Set) (P : X -> Prop), ~(forall x : X, ~ P x) -> (exists x: X, P x). I know this related relationship is true: Theorem forall_is_not_exists : (forall (X : Set) (P : X -> Prop), (forall x, ~(P x)) -> ~(exists x, P x)). Proof. (* This could probably be shortened, but I'm just starting out. *) intros X P. intros forall_x_not_Px. unfold not. intros exists_x_Px

How to solve goals with invalid type equalities in Coq?

时光怂恿深爱的人放手 提交于 2020-06-14 05:04:30
问题 My proof scripts are giving me stupid type equalities like nat = bool or nat = list unit which I need to use to solve contradictory goals. In normal math, this would be trivial. Given sets bool := { true, false } and nat := { 0, 1, 2, ... } I know that true ∈ bool , but true ∉ nat , hence bool ≠ nat . In Coq, I don't even know how to state that true :̸ nat . Question Is there a way to show that these equalities are false? Or maybe, is it impossible? (Ed.: Removed long list of failed attemts,

How to solve goals with invalid type equalities in Coq?

烂漫一生 提交于 2020-06-14 05:03:11
问题 My proof scripts are giving me stupid type equalities like nat = bool or nat = list unit which I need to use to solve contradictory goals. In normal math, this would be trivial. Given sets bool := { true, false } and nat := { 0, 1, 2, ... } I know that true ∈ bool , but true ∉ nat , hence bool ≠ nat . In Coq, I don't even know how to state that true :̸ nat . Question Is there a way to show that these equalities are false? Or maybe, is it impossible? (Ed.: Removed long list of failed attemts,

How to explicitly use an induction principle in coq?

三世轮回 提交于 2020-05-16 22:06:15
问题 I'm trying to prove symmetry of propositional identity with the induction principal explicitly in Coq, but can't do it with the induction principle like I can in agda. I don't know how to locally declare a variable in Coq, nor do I know how to unfold a definition, as you can see below. How can I get a proof that resembles the agda one below? Inductive Id (A : Type) (x : A) : A -> Type := | refl : Id A x x. (* trivial with induction *) Theorem symId {A} {x y} : Id A x y -> Id A y x. Proof.

How to explicitly use an induction principle in coq?

我的梦境 提交于 2020-05-16 22:05:20
问题 I'm trying to prove symmetry of propositional identity with the induction principal explicitly in Coq, but can't do it with the induction principle like I can in agda. I don't know how to locally declare a variable in Coq, nor do I know how to unfold a definition, as you can see below. How can I get a proof that resembles the agda one below? Inductive Id (A : Type) (x : A) : A -> Type := | refl : Id A x x. (* trivial with induction *) Theorem symId {A} {x y} : Id A x y -> Id A y x. Proof.

How to explicitly use an induction principle in coq?

陌路散爱 提交于 2020-05-16 22:05:03
问题 I'm trying to prove symmetry of propositional identity with the induction principal explicitly in Coq, but can't do it with the induction principle like I can in agda. I don't know how to locally declare a variable in Coq, nor do I know how to unfold a definition, as you can see below. How can I get a proof that resembles the agda one below? Inductive Id (A : Type) (x : A) : A -> Type := | refl : Id A x x. (* trivial with induction *) Theorem symId {A} {x y} : Id A x y -> Id A y x. Proof.

Example uses of MSets in Coq

只谈情不闲聊 提交于 2020-05-14 19:07:55
问题 MSets appear to be the way to go for OCaml-style finite sets. Sadly, I can't find example uses. How can I define an empty MSet or a singleton MSet ? How can I union two MSets together? 回答1: Let me show a simple example for finite sets of natural numbers: From Coq Require Import MSets Arith. (* We can make a set out of an ordered type *) Module S := Make Nat_as_OT. Definition test := S.union (S.singleton 42) (S.empty). (* membership *) Compute S.mem 0 test. (* evaluates to `false` *) Compute S

Provide example in Coq where (A B: Prop), P: Prop -> Type, such that A <-> B, but one cannot replace P A with P B

痞子三分冷 提交于 2020-04-17 19:15:43
问题 As the title asks, I wish for an example where: Section Question: Definition A: Prop := <whatever you like>. Definition B:Prop := <whatever you like>. Definition/Inductive/Fixpoint P: Prop -> Type := <whatever you like>. Theorem AEquivB: A <-> B. Proof. <supply proof here>. Qed. (* Question 1. can we pick a P, A, B to prove this? *) Theorem PA_not_equals_Pb: P A <> P B. Proof. <supply proof here>. Qed. (* Question 1.5. can we pick a P, A, B to prove this? *) Theorem PA_not_equiv_PB: ~(P A <->