[A,As,B,Bs,R,Rs,a,as,b,bs] Reln_apply (fol.cons_type A As) (fol.cons_type B Bs) (cons_Reln _ _ _ _ R Rs) (fol.cons_term _ a _ as) (fol.cons_term _ b _ bs) --> fol.and (R a b) (Reln_apply As Bs Rs as bs).
def Reln_apply : As : fol.sorts -> Bs : fol.sorts -> Rs : Reln As Bs -> fol.terms As -> fol.terms Bs -> fol.prop.
[A,As,B,Bs,R,Rs,a,as,b,bs] Reln_apply (fol.cons_sort A As) (fol.cons_sort B Bs) (cons_Reln _ _ _ _ R Rs) (fol.cons_term _ a _ as) (fol.cons_term _ b _ bs) --> fol.and (R a b) (Reln_apply As Bs Rs as bs).
def Rarrs : As : fol.types -> Bs : fol.types -> A : fol.type -> B : fol.type ->
def Rarrs : As : fol.sorts -> Bs : fol.sorts -> A : fol.sort -> B : fol.sort ->
Reln As Bs -> Rel A B -> (fol.terms As -> fol.term A) -> (fol.terms Bs -> fol.term B) -> fol.prop.
[A,B,R,f,g] Rarrs fol.nil_type fol.nil_type A B nil_Reln R f g -->
[A,B,R,f,g] Rarrs fol.nil_sort fol.nil_sort A B nil_Reln R f g -->
R (f fol.nil_term) (g fol.nil_term)
[A,As,B,Bs,A',B',R,Rs,R',f,g] Rarrs (fol.cons_type A As) (fol.cons_type B Bs) A' B' (cons_Reln _ _ _ _ R Rs) R' f g -->
[A,As,B,Bs,A',B',R,Rs,R',f,g] Rarrs (fol.cons_sort A As) (fol.cons_sort B Bs) A' B' (cons_Reln _ _ _ _ R Rs) R' f g -->
fol.all A (a => fol.all B (b => fol.imp (R a b) (Rarrs As Bs A' B' Rs R' (l => f (fol.cons_term A a As l)) (l => g (fol.cons_term B b Bs l))))).
def Rpred : As : fol.types -> Bs : fol.types -> Reln As Bs -> (fol.terms As -> fol.prop) -> (fol.terms Bs -> fol.prop) -> fol.prop.
[f,g] Rpred fol.nil_type fol.nil_type nil_Reln f g --> fol.imp (f fol.nil_term) (g fol.nil_term)
[A,As,B,Bs,R,Rs,f,g] Rpred (fol.cons_type A As) (fol.cons_type B Bs) (cons_Reln _ _ _ _ R Rs) f g
def Rpred : As : fol.sorts -> Bs : fol.sorts -> Reln As Bs -> (fol.terms As -> fol.prop) -> (fol.terms Bs -> fol.prop) -> fol.prop.
[f,g] Rpred fol.nil_sort fol.nil_sort nil_Reln f g --> fol.imp (f fol.nil_term) (g fol.nil_term)
[A,As,B,Bs,R,Rs,f,g] Rpred (fol.cons_sort A As) (fol.cons_sort B Bs) (cons_Reln _ _ _ _ R Rs) f g
-->
fol.all A (a => fol.all B (b => fol.imp (R a b) (Rpred As Bs Rs (l => f (fol.cons_term A a As l)) (l => g (fol.cons_term B b Bs l))))).
fun_increase (fol.cons_type A As) A' (fol.cons_type B Bs) B' (cons_Reln _ _ _ _ R Rs) R' f g (fol.cons_term _ a _ as) (fol.cons_term _ b _ bs) H1 H2 -->
fun_increase (fol.cons_sort A As) A' (fol.cons_sort B Bs) B' (cons_Reln _ _ _ _ R Rs) R' f g (fol.cons_term _ a _ as) (fol.cons_term _ b _ bs) H1 H2 -->
H2 (R' (f (fol.cons_term A a As as)) (g (fol.cons_term B b Bs bs)))
(HR : fol.proof (R a b) =>
HRs : fol.proof (Reln_apply As Bs Rs as bs) =>
fun_increase As A' Bs B' Rs R' (l => f (fol.cons_term A a As l)) (l => g (fol.cons_term B b Bs l)) as bs (H1 a b HR) HRs).
def Rel1 (A : fol.sort) (B : fol.sort) (R : fol.term A -> fol.term B -> fol.prop) :
Reln (fol.cons_sort A fol.nil_sort) (fol.cons_sort B fol.nil_sort) :=
cons_Reln A B fol.nil_sort fol.nil_sort R nil_Reln.
def Rel2 (A : fol.sort) (B : fol.sort) (R : fol.term A -> fol.term B -> fol.prop) :
Reln (fol.cons_sort A (fol.cons_sort A fol.nil_sort)) (fol.cons_sort B (fol.cons_sort B fol.nil_sort)) :=
cons_Reln A B (fol.cons_sort A fol.nil_sort) (fol.cons_sort B fol.nil_sort) R (Rel1 A B R).