1
Set Implicit Arguments.
5
Inductive One : Set := inOne: One.
7
Definition maybe: forall A B:Set,(A -> B) -> One + A -> One + B.
12
right; apply f; assumption.
15
Definition id (A:Set)(a:A):=a.
17
Definition LamF (X: Set -> Set)(A:Set) :Set :=
18
A + (X A)*(X A) + X(One + A).
20
Definition LamF' (X: Set -> Set)(A:Set) :Set :=
26
Definition index := list bool.
28
Inductive L (A:Set) : index -> Set :=
30
| pluslL: forall l:index, One -> L A (false::l)
31
| plusrL: forall l:index, L A l -> L A (false::l)
32
| varL: forall l:index, L A l -> L A (true::l)
33
| appL: forall l:index, L A (true::l) -> L A (true::l) -> L A (true::l)
34
| absL: forall l:index, L A (true::false::l) -> L A (true::l).
36
Scheme L_rec_simp := Minimality for L Sort Set.
38
Definition Lam' (A:Set) := L A (true::nil).
40
Definition aczelapp: forall (l1 l2: index)(A:Set), L (L A l2) l1 -> L A
46
(* Check (fun i:index => L A (i++l2)). *)
47
apply (L_rec_simp (A:=L A l2) (fun i:index => L A (i++l2))).
51
apply pluslL; assumption.
54
apply plusrL; assumption.
57
apply varL; assumption.
61
apply appL; [exact t1| exact t2].
65
apply absL; assumption.
68
Definition monL: forall (l:index)(A:Set)(B:Set), (A->B) -> L A l -> L B l.
87
Definition lam': forall (A B:Set), (A -> B) -> Lam' A -> Lam' B.
95
Definition inLam': forall A:Set, LamF' Lam' A -> Lam' A.
97
intros A [[a|[t1 t2]]|r].
99
exact (varL (initL a)).
101
unfold Lam' in * |- *.
104
change (L A ((true::nil) ++ (false::nil))).
106
(* Check (fun x:One + A => (match (maybe (fun a:A => initL a) x) with
107
| inl u => pluslL _ _ u
108
| inr t' => plusrL t' end)). *)
109
exact (monL (fun x:One + A =>
110
(match (maybe (fun a:A => initL a) x) with
111
| inl u => pluslL _ _ u
112
| inr t' => plusrL t' end)) r).
117
Definition sub1 (F G: Set -> Set):= forall A:Set, F A->G A.
118
Hypothesis G: Set -> Set.
119
Hypothesis step: sub1 (LamF' G) G.
121
Fixpoint L'(A:Set)(i:index){struct i} : Set :=
124
| false::l => One + L' A l
125
| true::l => G (L' A l)
128
Definition LinL': forall (A:Set)(i:index), L A i -> L' A i.
140
apply (step (A:=L' A l)).
141
exact (inl _ (inl _ r)).
143
apply (step (A:=L' A l)).
144
(* unfold L' in * |- *.
146
exact (inl _ (inr _ (pair r1 r2))).
148
apply (step (A:=L' A l)).
152
Definition L'inG: forall A: Set, L' A (true::nil) -> G A.
159
Definition Itbasic: sub1 Lam' G.
169
Definition recid := Itbasic inLam'.
171
Definition L'Lam'inL: forall (i:index)(A:Set), L' Lam' A i -> L A i.
180
apply (aczelapp (l1:=true::nil) (l2:=i)).
184
exact (pluslL _ _ a).
185
exact (plusrL (IHi b)).
189
Lemma recidgen: forall(A:Set)(i:index)(t:L A i), L'Lam'inL i A (LinL' inLam' t)
203
simpl L'Lam'inL in IHt1.
205
simpl L'Lam'inL in IHt2.
208
(* going on. This fails for the original solution. *)
212
Abort. (* one goal still left *)