]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/tests/inversion.ma
0. core_notation.ma splitted into coq.moo and core_notation.moo
[helm.git] / helm / matita / tests / inversion.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/tests/inversion/".
16 include "coq.ma".
17
18 inductive nat : Set \def
19    O : nat
20  | S : nat \to nat.
21  
22 inductive le (n:nat) : nat \to Prop \def
23    leO : le n n
24  | leS : \forall m. le n m \to le n (S m).
25
26 alias symbol "eq" (instance 0) = "Coq's leibnitz's equality".
27
28 theorem test_inversion: \forall n. le n O \to n=O.
29  intros.
30  (* inversion begins *)
31  cut O=O.
32   (* goal 2: 0 = 0 *)
33   goal 7. reflexivity.
34   (* goal 1 *)
35   generalize in match Hcut.
36   apply (le_ind ? (\lambda x. O=x \to n=x) ? ? ? H).
37   (* first goal (left open) *)
38   intro. rewrite < H1.
39   clear Hcut.
40   (* second goal (closed) *)
41   goal 14.
42   simplify. intros.
43   discriminate H3.
44   (* inversion ends *)
45   reflexivity.
46 qed.
47
48 (* Piu' semplice e non lascia l'ipotesi inutile Hcut *)
49 alias id "refl_equal" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)".
50 theorem test_inversion2: \forall n. le n O \to n=O.
51  intros.
52  (* inversion begins *)
53  generalize in match (refl_equal nat O).
54  apply (le_ind ? (\lambda x. O=x \to n=x) ? ? ? H).
55  (* first goal (left open) *)
56  intro. rewrite < H1.
57  (* second goal (closed) *)
58  goal 13.
59  simplify. intros.
60  discriminate H3.
61  (* inversion ends *)
62  reflexivity.
63 qed.