Debian Codegraph @

test-suite/success/setoid_test_function_space.v

raw
1 Require Export Setoid.
2 Set Implicit Arguments.
3 Section feq.
4 Variables A B:Type.
5 Definition feq (f g: A -> B):=forall a, (f a)=(g a).
6 Infix "=f":= feq (at level 80, right associativity).
7 Hint Unfold feq.
8
9 Lemma feq_refl: forall f, f =f f.
10 intuition.
11 Qed.
12
13 Lemma feq_sym: forall f g, f =f g-> g =f f.
14 intuition.
15 Qed.
16
17 Lemma feq_trans: forall f g h, f =f g-> g =f h -> f =f h.
18 unfold feq. intuition.
19 rewrite H.
20 auto.
21 Qed.
22 End feq.
23 Infix "=f":= feq (at level 80, right associativity).
24 #[export] Hint Unfold feq. #[export] Hint Resolve feq_refl feq_sym feq_trans.
25
26 Parameter K:(nat -> nat)->Prop.
27 Parameter K_ext:forall a b, (K a)->(a =f b)->(K b).
28
29 Add Parametric Relation (A B : Type) : (A -> B) (@feq A B)
30 reflexivity proved by (@feq_refl A B)
31 symmetry proved by (@feq_sym A B)
32 transitivity proved by (@feq_trans A B) as funsetoid.
33
34 Add Morphism K with signature (@feq nat nat) ==> iff as K_ext1.
35 intuition. apply (K_ext H0 H).
36 intuition. assert (y =f x);auto. apply (K_ext H0 H1).
37 Qed.
38
39 Lemma three:forall n, forall a, (K a)->(a =f (fun m => (a (n+m))))-> (K (fun m
40 => (a (n+m)))).
41 intuition.
42 setoid_rewrite <- H0.
43 assumption.
44 Qed.
45