defpred S1[ Element of (Free (S,X))] means ($1,[x,s]) <- t is Element of the Sorts of (Free (S,X)) . (the_sort_of $1);
( ((x -term),[x,s]) <- t = t & the_sort_of (x -term) = s )
by SORT;
then A0:
S1[x -term ]
by A, SORT;
A1:
for o being OperSymbol of S
for p being Element of Args (o,(Free (S,X))) st p is x -context_including & S1[x -context_in p] holds
for C being context of x st C = o -term p holds
S1[C]
proof
let o be
OperSymbol of
S;
for p being Element of Args (o,(Free (S,X))) st p is x -context_including & S1[x -context_in p] holds
for C being context of x st C = o -term p holds
S1[C]let p be
Element of
Args (
o,
(Free (S,X)));
( p is x -context_including & S1[x -context_in p] implies for C being context of x st C = o -term p holds
S1[C] )
assume that A2:
p is
x -context_including
and A3:
S1[
x -context_in p]
;
for C being context of x st C = o -term p holds
S1[C]
deffunc H1(
Nat)
-> set = (
(p /. $1),
[x,s])
<- t;
consider q being
FinSequence such that A4:
(
len q = len p & ( for
i being
Nat st
i in dom q holds
q . i = H1(
i) ) )
from FINSEQ_1:sch 2();
A5:
(
dom q = dom p &
dom p <> {} )
by A2, A4, FINSEQ_3:29;
A6:
( not
p is
empty & not
q is
empty )
by A2, A4;
A8:
dom p = dom (the_arity_of o)
by MSUALG_6:2;
then A9:
len q = len (the_arity_of o)
by A4, FINSEQ_3:29;
now for i being Nat st i in dom q holds
q . i in the Sorts of (Free (S,X)) . ((the_arity_of o) /. i)let i be
Nat;
( i in dom q implies q . b1 in the Sorts of (Free (S,X)) . ((the_arity_of o) /. b1) )assume B1:
i in dom q
;
q . b1 in the Sorts of (Free (S,X)) . ((the_arity_of o) /. b1)then B2:
p /. i = p . i
by A5, PARTFUN1:def 6;
per cases
( x -context_pos_in p = i or x -context_pos_in p <> i )
;
suppose
x -context_pos_in p = i
;
q . b1 in the Sorts of (Free (S,X)) . ((the_arity_of o) /. b1)then B3:
(
x -context_in p = p . i &
q . i = H1(
i) )
by B1, A4, A2, Th71;
p . i in the
Sorts of
(Free (S,X)) . ((the_arity_of o) /. i)
by B1, A5, A8, MSUALG_6:2;
then
the_sort_of (x -context_in p) = (the_arity_of o) /. i
by B3, SORT;
hence
q . i in the
Sorts of
(Free (S,X)) . ((the_arity_of o) /. i)
by B2, B3, A3;
verum end; suppose
x -context_pos_in p <> i
;
q . b1 in the Sorts of (Free (S,X)) . ((the_arity_of o) /. b1)then
(
q . i = H1(
i) &
H1(
i)
= p . i )
by A4, B1, B2, A2, A5, Th72, Th23;
hence
q . i in the
Sorts of
(Free (S,X)) . ((the_arity_of o) /. i)
by B1, A5, A8, MSUALG_6:2;
verum end; end; end;
then reconsider q =
q as
Element of
Args (
o,
(Free (S,X)))
by A9, MSAFREE2:5;
now for i being Nat
for d1 being DecoratedTree st i in dom p & d1 = p . i holds
q . i = (d1,[x,s]) <- tlet i be
Nat;
for d1 being DecoratedTree st i in dom p & d1 = p . i holds
q . i = (d1,[x,s]) <- tlet d1 be
DecoratedTree;
( i in dom p & d1 = p . i implies q . i = (d1,[x,s]) <- t )assume
(
i in dom p &
d1 = p . i )
;
q . i = (d1,[x,s]) <- tthen
(
q . i = H1(
i) &
p /. i = d1 )
by A4, A5, PARTFUN1:def 6;
hence
q . i = (
d1,
[x,s])
<- t
;
verum end;
then
(
(o -term p),
[x,s])
<- t = o -term q
by A6, ThL8, A4, FINSEQ_3:29;
hence
for
C being
context of
x st
C = o -term p holds
S1[
C]
by Th8;
verum
end;
thus
S1[C]
from MSAFREE5:sch 4(A0, A1); verum