diff options
| author | msozeau | 2008-01-15 01:02:48 +0000 |
|---|---|---|
| committer | msozeau | 2008-01-15 01:02:48 +0000 |
| commit | 6cd832e28c48382cc9321825cc83db36f96ff8d5 (patch) | |
| tree | 51905b3dd36672bf17eeb6e82d45d26402800d7d /theories | |
| parent | d581efa789d7239b61d7c71f58fc980c350b2de1 (diff) | |
Generalize instance declarations to any context, better name handling. Add hole kind info for topconstrs.
Derive eta_expansion from functional extensionality axiom.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10439 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'theories')
| -rw-r--r-- | theories/Classes/SetoidClass.v | 14 | ||||
| -rw-r--r-- | theories/Program/FunctionalExtensionality.v | 28 |
2 files changed, 22 insertions, 20 deletions
diff --git a/theories/Classes/SetoidClass.v b/theories/Classes/SetoidClass.v index 000cf70a35..c3f2413073 100644 --- a/theories/Classes/SetoidClass.v +++ b/theories/Classes/SetoidClass.v @@ -90,10 +90,6 @@ Ltac setoid_refl := match goal with | [ |- @equiv ?A ?R ?s ?X _ ] => apply (equiv_refl (A:=A) (R:=R) (s:=s) X) | [ H : ?X =!= ?X |- _ ] => elim H ; setoid_refl - | [ |- ?R ?X _ ] => apply (equiv_refl (R:=R) X) - | [ |- ?R ?A ?X _ ] => apply (equiv_refl (R:=R A) X) - | [ |- ?R ?A ?B ?X _ ] => apply (equiv_refl (R:=R A B) X) - | [ |- ?R ?A ?B ?C ?X _ ] => apply (equiv_refl (R:=R A B C) X) end. Ltac setoid_sym := @@ -161,7 +157,7 @@ Ltac setoidify := repeat setoidify_tac. Definition respectful [ sa : Setoid a eqa, sb : Setoid b eqb ] (m : a -> b) : Prop := forall x y, eqa x y -> eqb (m x) (m y). -Class [ Setoid a eqa, Setoid b eqb ] => Morphism (m : a -> b) := +Class [ sa : Setoid a eqa, sb : Setoid b eqb ] => Morphism (m : a -> b) := respect : respectful m. (** Here we build a setoid instance for functions which relates respectful ones only. *) @@ -209,7 +205,7 @@ Class [ sa : Setoid a eqa, sb : Setoid b eqb, sc : Setoid c eqc, sd : Setoid d e Program Instance iff_setoid : Setoid Prop iff := equiv_prf := @Build_equivalence _ _ iff_refl iff_trans iff_sym. -(* Program Instance not_morphism : Morphism Prop iff Prop iff not. *) +Program Instance not_morphism : Morphism Prop iff Prop iff not. Program Instance and_morphism : ? BinaryMorphism iff_setoid iff_setoid iff_setoid and. @@ -272,13 +268,13 @@ Proof. Qed. Program Instance [ sa : Setoid a eqa, sb : Setoid b eqb, sc : Setoid c eqc, - ? Morphism sb sc g, ? Morphism sa sb f ] => + mg : ? Morphism sb sc g, mf : ? Morphism sa sb f ] => compose_morphism : ? Morphism sa sc (fun x => g (f x)). Next Obligation. Proof. - apply (respect (m0:=m)). - apply (respect (m0:=m0)). + apply (respect (m0:=mg)). + apply (respect (m0:=mf)). assumption. Qed. diff --git a/theories/Program/FunctionalExtensionality.v b/theories/Program/FunctionalExtensionality.v index 81bb5390b1..e890261e12 100644 --- a/theories/Program/FunctionalExtensionality.v +++ b/theories/Program/FunctionalExtensionality.v @@ -1,3 +1,4 @@ +(* -*- coq-prog-args: ("-emacs-U" "-nois") -*- *) (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *) @@ -30,17 +31,6 @@ Proof. auto. Qed. -(** Eta expansion *) - -Axiom eta_expansion_dep : forall A (B : A -> Type) (f : forall x : A, B x), - f = fun x => f x. - -Lemma eta_expansion : forall A B (f : A -> B), - f = fun x => f x. -Proof. - intros ; apply eta_expansion_dep. -Qed. - (** Statements of functional equality for simple and dependent functions. *) Axiom fun_extensionality_dep : forall A, forall B : (A -> Type), @@ -63,6 +53,22 @@ Tactic Notation "extensionality" ident(x) := [ |- ?X = ?Y ] => apply (@fun_extensionality _ _ X Y) || apply (@fun_extensionality_dep _ _ X Y) ; intro x end. +(** Eta expansion follows from extensionality. *) + +Lemma eta_expansion_dep : forall A (B : A -> Type) (f : forall x : A, B x), + f = fun x => f x. +Proof. + intros. + extensionality x. + reflexivity. +Qed. + +Lemma eta_expansion : forall A B (f : A -> B), + f = fun x => f x. +Proof. + intros ; apply eta_expansion_dep. +Qed. + (** The two following lemmas allow to unfold a well-founded fixpoint definition without restriction using the functional extensionality axiom. *) |
