Debian Codegraph @

test-suite/ssr/congr.v

raw
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (* (c) Copyright 2006-2016 Microsoft Corporation and Inria. *)
12
13 Require Import ssreflect.
14 Require Import ssrbool TestSuite.ssr_mini_mathcomp.
15
16 Lemma test1 : forall a b : nat, a == b -> a == 0 -> b == 0.
17 Proof. move=> a b Eab Eac; congr (_ == 0) : Eac; exact: eqP Eab. Qed.
18
19 Definition arrow A B := A -> B.
20
21 Lemma test2 : forall a b : nat, a == b -> arrow (a == 0) (b == 0).
22 Proof. move=> a b Eab; congr (_ == 0); exact: eqP Eab. Qed.
23
24 Definition equals T (A B : T) := A = B.
25
26 Lemma test3 : forall a b : nat, a = b -> equals nat (a + b) (b + b).
27 Proof. move=> a b E; congr (_ + _); exact E. Qed.
28
29 Parameter S : eqType.
30 Parameter f : nat -> S.
31 Coercion f : nat >-> Equality.sort.
32
33 Lemma test4 : forall a b : nat, b = a -> @eq S (b + b) (a + a).
34 Proof. move=> a b Eba; congr (_ + _); exact: Eba. Qed.
35
36 Open Scope type_scope.
37
38 Lemma test5 : forall (P Q Q' : Type) (h : Q = Q'), P * Q = P * Q'.
39 Proof. move=>*; by congr (_ * _). Qed.
40
41 Lemma test6 : forall (P Q Q' : Type) (h : Q = Q'), P * Q -> P * Q'.
42 Proof. move=> P Q Q' h; by congr (_ * _). Qed.