\ /
V_______________________________________________________________ *)
-include "lambda/subterms.ma".
+include "lambdaN/subterms.ma".
(*
inductive T : Type[0] ≝
| App: T → T → T
| Lambda: T → T → T (* type, body *)
| Prod: T → T → T (* type, body *)
- | D: T →T
+ | D: T →T →T
. *)
(*
theorem is_lambda_to_exists: ∀M. is_lambda M = true →
∃P,N. M = Lambda P N.
#M (cases M) normalize
- [1,2,6: #n #H destruct|3,5: #P #Q #H destruct
+ [1,2: #n #H destruct|3,5,6: #P #Q #H destruct
|#P #N #_ @(ex_intro … P) @(ex_intro … N) //
]
qed.
pr (Lambda P M) (Lambda P1 M1)
| prod: ∀P,P1,M,M1. pr P P1 → pr M M1 →
pr (Prod P M) (Prod P1 M1)
- | d: ∀M,M1. pr M M1 → pr (D M) (D M1).
+ | d: ∀M,M1,N,N1. pr M M1 → pr N N1 → pr (D M N) (D M1 N1).
lemma prSort: ∀M,n. pr (Sort n) M → M = Sort n.
#M #n #prH (inversion prH)
[#P #M #N #M1 #N1 #_ #_ #_ #_ #H destruct
|//
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #N #_ #_ #H destruct
+ |3,4,5,6: #M #M1 #N #N1 #_ #_ #_ #_ #H destruct
]
qed.
#M #n #prH (inversion prH)
[#P #M #N #M1 #N1 #_ #_ #_ #_ #H destruct
|//
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #N #_ #_ #H destruct
+ |3,4,5,6: #M #M1 #N #N1 #_ #_ #_ #_ #H destruct
]
qed.
-lemma prD: ∀M,N. pr (D N) M → ∃P.M = D P ∧ pr N P.
-#M #N #prH (inversion prH)
+lemma prD: ∀M,N,P. pr (D M N) P →
+ ∃M1,N1.P = D M1 N1 ∧ pr M M1 ∧ pr N N1.
+#M #N #P #prH (inversion prH)
[#P #M #N #M1 #N1 #_ #_ #_ #_ #H destruct
- |#M #eqM #_ @(ex_intro … N) /2/
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M1 #N1 #pr #_ #H destruct #eqM @(ex_intro … N1) /2/
+ |#Q #eqQ #_ @(ex_intro … M) @(ex_intro … N) /3/
+ |3,4,5: #M #M1 #N #N1 #_ #_ #_ #_ #H destruct
+ |#M1 #M2 #N1 #N2 #pr1 #pr2 #_ #_ #H destruct #eqP
+ @(ex_intro … M2) @(ex_intro … N2) /3/
]
qed.
|#M1 #eqM1 #_ #_ @(ex_intro … M) @(ex_intro … N) /3/
|#M1 #N1 #M2 #N2 #pr1 #pr2 #_ #_ #H #H1 #_ destruct
@(ex_intro … N1) @(ex_intro … N2) /3/
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #N #_ #_ #H destruct
+ |4,5,6: #M #M1 #N #N1 #_ #_ #_ #_ #H destruct
]
qed.
|#M1 #eqM1 #_ @(ex_intro … (Lambda Q M)) @(ex_intro … N) /4/
|#M1 #N1 #M2 #N2 #pr1 #pr2 #_ #_ #H destruct #_
@(ex_intro … N1) @(ex_intro … N2) /4/
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #N #_ #_ #H destruct
+ |4,5,6: #M #M1 #N #N1 #_ #_ #_ #_ #H destruct
]
qed.
#M #N #P #prH (inversion prH)
[#P #M #N #M1 #N1 #_ #_ #_ #_ #H destruct
|#Q #eqQ #_ @(ex_intro … M) @(ex_intro … N) /3/
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
+ |3,5,6: #M #M1 #N #N1 #_ #_ #_ #_ #H destruct
|#Q #Q1 #S #S1 #pr1 #pr2 #_ #_ #H #H1 destruct
@(ex_intro … Q1) @(ex_intro … S1) /3/
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #N #_ #_ #H destruct
]
qed.
#M #N #P #prH (inversion prH)
[#P #M #N #M1 #N1 #_ #_ #_ #_ #H destruct
|#Q #eqQ #_ @(ex_intro … M) @(ex_intro … N) /3/
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
- |#M #M1 #N #N1 #_ #_ #_ #_ #H destruct
+ |3,4,6: #M #M1 #N #N1 #_ #_ #_ #_ #H destruct
|#Q #Q1 #S #S1 #pr1 #pr2 #_ #_ #H #H1 destruct
@(ex_intro … Q1) @(ex_intro … S1) /3/
- |#M #N #_ #_ #H destruct
]
qed.
| App P Q ⇒ full_app P (full Q)
| Lambda P Q ⇒ Lambda (full P) (full Q)
| Prod P Q ⇒ Prod (full P) (full Q)
- | D P ⇒ D (full P)
+ | D P Q ⇒ D (full P) (full Q)
]
and full_app M N ≝
match M with
| App P Q ⇒ App (full_app P (full Q)) N
| Lambda P Q ⇒ (full Q) [0 ≝ N]
| Prod P Q ⇒ App (Prod (full P) (full Q)) N
- | D P ⇒ App (D (full P)) N
+ | D P Q ⇒ App (D (full P) (full Q)) N
]
.
normalize @lam; [@Hind1 |@Hind2]
|#M1 #N1 #M2 #N2 #pr2 #pr3 #Hind1 #Hind2 #k
normalize @prod; [@Hind1 |@Hind2]
- |#M1 #M2 #pr2 #Hind #k normalize @d //
+ |#M1 #N1 #M2 #N2 #pr2 #pr3 #Hind1 #Hind2 #k
+ normalize @d; [@Hind1 |@Hind2]
]
qed.
#M3 * #N3 *
[* * #eqM1 #pr4 #pr5 >eqM1
>(plus_n_O n) in ⊢ (??%) >subst_lemma @beta;
- [<plus_n_Sm <plus_n_O @Hind // >eqQ
+ [<plus_n_O @Hind // >eqQ
@(transitive_lt ? (size (Lambda M2 N2))) normalize //
|@Hind // normalize //
]
|#Q #M #Hind #M1 #N #N1 #n #pr1 #pr2
(cases (prProd … pr1)) #M2 * #N2 * * #eqM1 #pr3 #pr4 >eqM1
@prod; [@Hind // normalize // | @Hind // normalize // ]
- |#Q #Hind #M1 #N #N1 #n #pr1 #pr2 (cases (prD … pr1))
- #M2 * #eqM1 #pr1 >eqM1 @d @Hind // normalize //
+ |#Q #M #Hind #M1 #N #N1 #n #pr1 #pr2
+ (cases (prD … pr1)) #M2 * #N2 * * #eqM1 #pr3 #pr4 >eqM1
+ @d; [@Hind // normalize // | @Hind // normalize // ]
]
qed.
[#P #Q #Hind1 #Hind2 #N1 #N2 #prN #H @appl // @Hind1 /3/
|#P #Q #Hind1 #Hind2 #N1 #N2 #prN #H @beta /2/
|#P #Q #Hind1 #Hind2 #N1 #N2 #prN #H @appl // @prod /2/
- |#P #Hind #N1 #N2 #prN #H @appl // @d /2/
+ |#P #Q #Hind1 #Hind2 #N1 #N2 #prN #H @appl // @d /2/
]
qed.
|#M1 #N1 #H @pr_full_app /3/
|#M1 #N1 #H normalize /3/
|#M1 #N1 #H @prod /2/
- |#P #H @d /2/
+ |#M1 #N1 #H @d /2/
]
qed.
cases (prApp_not_lambda … prH ?) //
#M2 * #N2 * * #eqQ #pr1 #pr2 >eqQ @appl;
[@(subH (Prod P Q)) // |@subH //]
- |#P #Hind #N1 #N2 #subH #pr1
+ |#P #Q #Hind1 #Hind2 #N1 #N2 #subH #pr1
cases (prApp_not_lambda … pr1 ?) //
#M1 * #N1 * * #eqQ #pr2 #pr3 >eqQ @appl;
- [@(subH (D P) M1) // |@subH //]
+ [@(subH (D P Q) M1) // |@subH //]
]
qed.
(cases (prLambda …Hpr)) #M1 * #N1 * * #eqN >eqN normalize /3/
|#P #P1 #Hind #N #Hpr
(cases (prProd …Hpr)) #M1 * #N1 * * #eqN >eqN normalize /3/
- |#N #Hind #P #prH normalize cases (prD … prH)
- #Q * #eqP >eqP #prN @d @Hind //
+ |#P #P1 #Hind #N #Hpr
+ (cases (prD …Hpr)) #M1 * #N1 * * #eqN >eqN normalize /3/
]
qed.