strengthening the inversion tactic in coq
play

Strengthening the inversion Tactic in Coq Dependent Types Inversion - PowerPoint PPT Presentation

Strengthening the inversion Tactic in Coq Anne Mulhern Examples Universes Strengthening the inversion Tactic in Coq Dependent Types Inversion Lemmas Implications Anne Mulhern Implementation Conclusion Department of Computer Sciences


  1. Strengthening the inversion Tactic in Coq Anne Mulhern Examples Universes Strengthening the inversion Tactic in Coq Dependent Types Inversion Lemmas Implications Anne Mulhern Implementation Conclusion Department of Computer Sciences University of Wisconsin-Madison July 9, 2010 1 / 23

  2. Strengthening the The inversion Tactic in Coq inversion Tactic in Coq Anne Mulhern Examples Universes Dependent Types Inversion Lemmas Implications Implementation The destruct tactic on steroids. Conclusion 2 / 23

  3. Strengthening the Example : False inversion Tactic in Coq Anne Mulhern Examples Universes Inductive False : Prop := Dependent Types Inversion Lemmas Implications destruct and inversion Implementation Conclusion H : False the goal destruct H � inversion H � 3 / 23

  4. Strengthening the Example: and inversion Tactic in Coq Inductive and (A B : Prop ) : Prop := Anne Mulhern conj : A − > B − > A / \ B Examples Universes destruct and inversion Dependent Types Inversion Lemmas H : A ∧ B Implications the goal Implementation Conclusion destruct H H : A H0 : B the goal H : A ∧ B H0 : A inversion H H1 : B the goal 4 / 23

  5. Strengthening the Example: ex inversion Tactic in Coq Anne Mulhern Inductive ex (A : Type ) (P : A − > Prop ) : Prop := Examples ex_intro : f o r a l l x : A, P x − > ex P Universes Dependent Types destruct and inversion Inversion Lemmas Implications H : ex P H : ex P Implementation goal in Prop goal in {Set, Type} Conclusion H : A destruct H failure H0 : P x goal in Prop H : ex P x : A inversion H failure H0 : P x goal in Prop 5 / 23

  6. Strengthening the Keeping the Universes Separate inversion Tactic in Coq Anne Mulhern Allowed Examples proj1_sig = Universes fun (A : Type ) (P : A − > Prop ) ( e : sig P) => Dependent Types l e t (a , _ ) := e in a Inversion Lemmas : f o r a l l (A : Type ) (P : A − > Prop ) , Implications sig P − > A Implementation Conclusion Forbidden proj1_ex = fun (A : Type ) (P : A − > Prop ) ( e : ex P) => l e t (a , _ ) := e in a : f o r a l l (A : Type ) (P : A − > Prop ) , ex P − > A 6 / 23

  7. Strengthening the Keeping the Universes Separate inversion Tactic in Coq It is always possible to invert an hypothesis under any of Anne Mulhern the following conditions: Examples 1. The type of the hypothesis is in Set or Type or the Universes type of the goal is in Prop . Dependent Types Inversion Lemmas 2. The type of the hypothesis has at most one Implications constructor and the types of the arguments to that Implementation constructor are all in Prop , e.g., and . Conclusion False zero constructors and just one constructor with two arguments in Prop It should also be possible to invert an hypothesis under the following condition: Rule 3 It is possible to construct a function that, when applied to the hypothesis, yields a result that satisfies condition 2. 7 / 23

  8. Strengthening the Rule 3 inversion Tactic in Coq Anne Mulhern Examples Universes Dependent Types Inversion Lemmas It is possible to construct a function that, when applied to Implications the hypothesis, yields a result that satisfies condition 2 Implementation and the result type of the function is strongly related to Conclusion the hypotheses with which the inversion tactic would have supplied the proof context if it had been able to proceed. 8 / 23

  9. Strengthening the Example: Locally Nameless Representation inversion Tactic in Coq Anne Mulhern Examples Inductive exp : Set := Universes var_b : nat − > exp Dependent Types | var_f : expvar − > exp Inversion Lemmas | app : exp − > exp − > exp | abs : exp − > exp Implications Implementation lc_exp : exp − > Prop := Inductive Conclusion lc_var_f : f o r a l l x : expvar , lc_exp ( var_f x ) | lc_app : f o r a l l e1 e2 : exp , lc_exp e1 − > lc_exp e2 − > lc_exp ( app e1 e2 ) | lc_abs : f o r a l l e : exp , ( f o r a l l x : expvar , lc_exp ( open_exp_wrt_exp e ( var_f x ) ) ) − > lc_exp ( abs e ) http://www.cis.upenn.edu/~baydemir/papers/lngen/index.html 9 / 23

  10. Strengthening the Example: Locally Nameless Representation inversion Tactic in Coq Anne Mulhern destruct and inversion Examples Universes e : exp H : lc_exp e Dependent Types goal in Prop Inversion Lemmas e1 : exp Implications e2 : exp destruct H H : lc_exp e1 e : exp Implementation x : expvar H0 : lc_exp e2 H : forall x : expvar, . . . goal in Prop goal in Prop goal in Prop Conclusion e : exp e : exp e : exp H : lc_exp e H : lc_exp e H : lc_exp e e1 : exp e2 : exp inversion H H0 : lc_exp e1 e0 : exp x : expvar H1 : lc_exp e2 H0 : forall x : expvar, . . . H0 : var_f x = e H2 : app e1 e2 = e H1 : abs e0 = e goal in Prop goal in Prop goal in Prop Powerful statement about equality not on, H , the inverted hypothesis, but on e , the value on which it is dependent. 10 / 23

  11. Strengthening the Example: Locally Nameless Representation inversion Tactic in Coq inversion Anne Mulhern Examples simple inversion H inversion H Universes H : lc_exp (abs (var_b 0)) Dependent Types x : expvar � H0 : var_f x = abs (var_b 0) Inversion Lemmas goal in Prop Implications H : lc_exp (abs (var_b 0)) Implementation e1 : exp e2 : exp Conclusion H : lc_exp (abs (var_b 0)) � H0 : lc_exp e1 goal in Prop H1 : lc_exp e2 H2 : app e1 e2 = abs (var_b 0) goal in Prop H : lc_exp (abs (var_b 0)) H : lc_exp (abs (var_b 0)) e0 : exp e0 : exp H0 : forall x : expvar, . . . H0 : forall x : expvar, . . . H1 : abs e0 = abs (var_b 0) H1 : e0 = var_b 0 goal in Prop goal in Prop Equality statements allow the inversion tactic to eliminate all but one of the remaining subgoals, as long as the goal is in Prop . 11 / 23

  12. Strengthening the Example: Locally Nameless Representation inversion Tactic in Coq Anne Mulhern simple inversion H inversion H Examples H : lc_exp (abs (var_b 0)) Universes x : expvar � H0 : var_f x = abs (var_b 0) Dependent Types goal in Prop Inversion Lemmas H : lc_exp (abs (var_b 0)) e1 : exp Implications e2 : exp H : lc_exp (abs (var_b 0)) � Implementation H0 : lc_exp e1 goal in Prop H1 : lc_exp e2 Conclusion H2 : app e1 e2 = abs (var_b 0) goal in Prop H : lc_exp (abs (var_b 0)) H : lc_exp (abs (var_b 0)) e0 : exp e0 : exp H0 : forall x : expvar, . . . H0 : forall x : expvar, . . . H1 : abs e0 = abs (var_b 0) H1 : e0 = var_b 0 goal in Prop goal in Prop It is possible to extract the statement of a lemma from this table, i.e., lc_exp (abs (var_b 0)) → forall x : expvar, lc_exp (open_exp_wrt_exp (var_b 0) (var_f x)) 12 / 23

  13. Strengthening the Example: Locally Nameless Representation inversion Tactic in Coq Anne Mulhern Hypothesis Lemma Examples Universes lc_exp (abs e) lc_exp (abs e ) → Dependent Types forall x : expvar, lc_exp (open_exp_wrt_exp e (var_f x)) Inversion Lemmas lc_exp (app e1 e2) lc_exp (app e 1 e 2) Implications → lc_exp e1 ∧ lc_exp e2 Implementation lc_exp (var_f x ) Conclusion lc_exp (var_f x ) → True lc_exp (var_b x ) lc_exp (var_b x ) → False Rule 3 It is possible to construct a function that, when applied to the hypothesis, yields a result that satisfies condition 2. 13 / 23

  14. Strengthening the General Approach inversion Tactic in Coq Anne Mulhern Examples Universes Dependent Types Inversion Lemmas Within my stronger_inversion tactic, automatically Implications construct the necessary inversion lemma and apply it to Implementation the hypothesis to be inverted, generalizing the result and Conclusion thereby inserting it within the context. 14 / 23

  15. Strengthening the Arguments in Set or Type inversion Tactic in Coq Anne Mulhern Examples Universes ◮ stronger_inversion derives contradictions to Dependent Types Inversion Lemmas eliminate generated subgoals, in the same way as Implications the inversion tactic. Implementation ◮ However, it cannot insert hypotheses with types in Conclusion Set or Type into the context. ◮ If hypotheses with types in Set or Type occur among the constructor’s arguments they must be eliminated somehow. 15 / 23

  16. Strengthening the Non-example: hypothesis is equal to a inversion Tactic in Coq constant Anne Mulhern Examples Universes simple inversion H stronger_inversion H Dependent Types H : lc_exp (abs (var_b 0)) Inversion Lemmas x : expvar � H0 : var_f x = abs (var_b 0) Implications the goal in Prop Implementation H : lc_exp (abs (var_b 0)) e1 : exp Conclusion e2 : exp H : lc_exp (abs (var_b 0)) � H0 : lc_exp e1 the goal in Prop H1 : lc_exp e2 H2 : app e1 e2 = abs (var_b 0) the goal in Prop H : lc_exp (abs (var_b 0)) H : lc_exp (abs (var_b 0)) e0 : exp e0 : exp H0 : forall x : expvar, . . . H0 : forall x : expvar, . . . H1 : abs e0 = abs (var_b 0) H1 : e0 = var_b 0 the goal in Prop the goal in { Set, Type } Substitution eliminates e0 , i.e., it can be replaced everywhere with the right hand side. 16 / 23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend