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


when refineing program, tried end proof inversion on false hypothesis when the goal type. here reduced version of proof tried 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 require case analysis on sort  type not allowed inductive definition le 

however, since nothing t, shouldn't matter, ... or ?

i got rid of t this, , proof went through:

lemma ex_falso: forall t:type, false -> t.   inversion 1. qed.    lemma strange2: forall t:type, 0>0 -> t.   intros t h.   apply ex_falso.  (* changes goal 'false' *)   inversion h. qed. 

what reason coq complained? deficiency in inversion, destruct, etc. ?

i had never seen issue before, makes sense, although 1 argue bug in inversion.

this problem due fact inversion implemented case analysis. in coq's logic, 1 cannot in general perform case analysis on logical hypothesis (i.e., type prop) if result of computational nature (i.e., if sort of type of thing being returned type). 1 reason designers of coq wanted make possible erase proof arguments programs when extracting them code in sound way: thus, 1 allowed case analysis on hypothesis produce computational if thing being destructed cannot alter result. includes:

  1. propositions no constructors, such false.
  2. propositions 1 constructor, long constructor takes no arguments of computational nature. includes true, acc (the accessibility predicated used doing well-founded recursion), excludes existential quantifier ex.

as noticed, however, possible circumvent rule converting proposition want use producing result 1 can case analysis on directly. thus, if have contradictory assumption, in case, can first use prove false (which allowed, since false prop), , then eliminating false produce result (which allowed above rules).

in example, inversion being conservative giving because cannot case analysis on of type 0 < 0 in context. true can't case analysis on directly rules of logic, explained above; however, 1 think of making smarter implementation of inversion recognizes eliminating contradictory hypothesis , adds false intermediate step, did. unfortunately, seems need trick hand make work.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -