coq


Problems with dependent types in Coq proof assistant

狂风中的少年 提交于 2020-01-14 15:01:27
问题 Consider the following simple expression language: Inductive Exp : Set := | EConst : nat -> Exp | EVar : nat -> Exp | EFun : nat -> list Exp -> Exp. and its wellformedness predicate: Definition Env := list nat. Inductive WF (env : Env) : Exp -> Prop := | WFConst : forall n, WF env (EConst n) | WFVar : forall n, In n env -> WF env (EVar n) | WFFun : forall n es, In n env -> Forall (WF env) es -> WF env (EFun n es). which basically states that every variable and function symbols must be defined

Consistent formulations of sets in Coq?

元气小坏坏 提交于 2020-01-12 14:24:33
问题 I'm quite new at Coq and trying to develop a framework based on my research. My work is quite definition-heavy and I'm having trouble encoding it because of how Coq seems to treat sets. There are Type and Set , which they call 'sorts', and I can use them to define a new set: Variable X: Type. And then there's a library encoding (sub)sets as 'Ensembles', which are functions from some Type to a Prop . In other words, they are predicates on a Type : Variable Y: Ensemble X. Ensemble s feel more

Overloading notation for different types in Coq

爷,独闯天下 提交于 2020-01-12 07:58:27
问题 I would like to be able to define the same Coq notations for different inductive definitions, and distinguish the notations based on the types of their arguments. Here is a minimal example: Inductive type : Type := | TBool : type. Inductive term1 : Type := | tvar1 : term1. Inductive term2 : Type := | tvar2 : term2. Definition context := nat -> (option type). Reserved Notation "G '⊢' t '::' T" (at level 40, t at level 59). Inductive typing1 : context -> term1 -> type -> Prop := | T_Var1 :

Overloading notation for different types in Coq

試著忘記壹切 提交于 2020-01-12 07:58:05
问题 I would like to be able to define the same Coq notations for different inductive definitions, and distinguish the notations based on the types of their arguments. Here is a minimal example: Inductive type : Type := | TBool : type. Inductive term1 : Type := | tvar1 : term1. Inductive term2 : Type := | tvar2 : term2. Definition context := nat -> (option type). Reserved Notation "G '⊢' t '::' T" (at level 40, t at level 59). Inductive typing1 : context -> term1 -> type -> Prop := | T_Var1 :

Why Coq doesn't allow inversion, destruct, etc. when the goal is a Type?

流过昼夜 提交于 2020-01-10 19:32:28
问题 When refine ing a program, I tried to end proof by inversion on a False hypothesis when the goal was a Type . Here is a reduced version of the proof I tried to do. Lemma strange1: forall T:Type, 0>0 -> T. intros T H. inversion H. (* Coq refuses inversion on 'H : 0 > 0' *) Coq complained Error: Inversion would require case analysis on sort Type which is not allowed for inductive definition le However, since I do nothing with T , it shouldn't matter, ... or ? I got rid of the T like this, and

Why Coq doesn't allow inversion, destruct, etc. when the goal is a Type?

末鹿安然 提交于 2020-01-10 19:31:31
问题 When refine ing a program, I tried to end proof by inversion on a False hypothesis when the goal was a Type . Here is a reduced version of the proof I tried to do. Lemma strange1: forall T:Type, 0>0 -> T. intros T H. inversion H. (* Coq refuses inversion on 'H : 0 > 0' *) Coq complained Error: Inversion would require case analysis on sort Type which is not allowed for inductive definition le However, since I do nothing with T , it shouldn't matter, ... or ? I got rid of the T like this, and

Universal qauntification hypothesis in Coq

[亡魂溺海] 提交于 2020-01-07 04:37:46
问题 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

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

工具导航Map