coq

Universal qauntification hypothesis in Coq

南笙酒味 提交于 2020-01-07 04:37:01
问题 I want to change the hypothesis H from the form below mL : Map mR : Map H : forall (k : RecType) (e : String.string), MapsTo k e (filter (is_vis_cookie l) mL) <-> MapsTo k e (filter (is_vis_cookie l) mR) ------------------------------------------------------- Goal to mL : Map mR : Map k : RecType e : String.string H : MapsTo k e (filter (is_vis_cookie l) mL) <-> MapsTo k e (filter (is_vis_cookie l) mR) ------------------------------------------------------- Goal I think, they can both solve

In Coq, how to define a set like A = {x | f(x) = 0}?

雨燕双飞 提交于 2020-01-05 04:08:06
问题 I am a newbie in using Coq. I want to ask if I want to define a set like A = {x | f(x) = 0} , how could I do that? I write something like: Definition f0 := nat->nat. Definition A : Set := forall x, f0 x -> 0. They are not working as expected. Thanks a lot. 回答1: More or less like you wrote. First, you have to have some function f0 : nat -> nat that you want to apply this definition to. What you did here Definition f0 := nat -> nat. was to name the type nat -> nat of functions from naturals to

In Coq, how to define a set like A = {x | f(x) = 0}?

99封情书 提交于 2020-01-05 04:08:03
问题 I am a newbie in using Coq. I want to ask if I want to define a set like A = {x | f(x) = 0} , how could I do that? I write something like: Definition f0 := nat->nat. Definition A : Set := forall x, f0 x -> 0. They are not working as expected. Thanks a lot. 回答1: More or less like you wrote. First, you have to have some function f0 : nat -> nat that you want to apply this definition to. What you did here Definition f0 := nat -> nat. was to name the type nat -> nat of functions from naturals to

Induction on predicates with product type arguments

倾然丶 夕夏残阳落幕 提交于 2020-01-04 13:26:13
问题 If I have a predicate like this: Inductive foo : nat -> nat -> Prop := | Foo : forall n, foo n n. then I can trivially use induction to prove some dummy lemmas: Lemma foo_refl : forall n n', foo n n' -> n = n'. Proof. intros. induction H. reflexivity. Qed. However, for a predicate with product type arguments: Inductive bar : (nat * nat) -> (nat * nat) -> Prop := | Bar : forall n m, bar (n, m) (n, m). a similar proof for nearly identical lemma gets stuck because all assumptions about variables

Rewriting with John Major's equality

一笑奈何 提交于 2020-01-04 05:56:08
问题 John Major's equality comes with the following lemma for rewriting: Check JMeq_ind_r. (* JMeq_ind_r : forall (A : Type) (x : A) (P : A -> Prop), P x -> forall y : A, JMeq y x -> P y *) It is easy to generalize it like that: Lemma JMeq_ind2_r : forall (A:Type)(x:A)(P:forall C,C->Prop), P A x -> forall (B:Type)(y:B), @JMeq B y A x -> P B y. Proof. intros. destruct H0. assumption. Qed. However I need something a bit different: Lemma JMeq_ind3_r : forall (A:Type)(x:A*A) (P:forall C,C*C->Prop), P

Equality between functional and inductive definitions

拟墨画扇 提交于 2020-01-04 04:15:08
问题 I have an inductive definition of the proposition P (or repeats l ) that a lists contains repeating elements , and a functional definition of it's negation Q (or no_repeats l ). I want to show that P <-> ~ Q and ~ P <-> Q . I have been able to show three of the four implications, but ~ Q -> P seems to be different, because I'm unable to extract data from ~Q . Require Import List. Variable A : Type. Inductive repeats : list A -> Prop := (* repeats *) repeats_hd l x : In x l -> repeats (x::l) |

How can I make Coq accept the following Fixpoint?

牧云@^-^@ 提交于 2020-01-04 02:19:28
问题 I am trying to write a substitution function for lambda calculus and in case of lambda abstraction (\x.e) before recursively calling substitution on e, I have to rename variables in e. How can I represent this kind of logic in Coq? Following is a bare minimum example for which Coq gives the error that it can not guess the decreasing argument. In the simplified replace why can Coq not get that e remains of same Inductive size? Fixpoint replace (x: nat) (y: nat) (e: exp): exp := e. Fixpoint

Making and comparing Sets in Coq

若如初见. 提交于 2020-01-03 13:06:52
问题 I'm having trouble understanding whether it is possible to prove that two sets (in this case regular languages) are identical and thus interchangeable. From what I understand, sets can be equivalent even if they are not constructively equal. Regular languages are sets of strings, but I don't see how to say that r1 = r2 so that something like symmetry can be used in a proof. Here is my RegularLanguage declaration: Inductive RegularLanguage (A : Set) : Set := | EmptyLang : RegularLanguage A |

Apply a function to both sides of an equality in Coq?

一个人想着一个人 提交于 2020-01-03 09:02:53
问题 I'm in Coq trying to prove that Theorem evenb_n__oddb_Sn : ∀n : nat, evenb n = negb (evenb (S n)). I'm using induction on n . The base case is trivial, so I'm at the inductive case and my goal looks like: k : nat IHk : evenb k = negb (evenb (S k)) ============================ evenb (S k) = negb (evenb (S (S k))) Now of course there's a fundamental axiom of functions that asserts a = b -> f a = f b For all functions f : A -> B . So I could apply negb to both sides, which would give me k : nat

Apply a function to both sides of an equality in Coq?

浪尽此生 提交于 2020-01-03 09:01:06
问题 I'm in Coq trying to prove that Theorem evenb_n__oddb_Sn : ∀n : nat, evenb n = negb (evenb (S n)). I'm using induction on n . The base case is trivial, so I'm at the inductive case and my goal looks like: k : nat IHk : evenb k = negb (evenb (S k)) ============================ evenb (S k) = negb (evenb (S (S k))) Now of course there's a fundamental axiom of functions that asserts a = b -> f a = f b For all functions f : A -> B . So I could apply negb to both sides, which would give me k : nat