typecheck_proof(proof(Id,Global,Local,Goals),Env,proof(Id,DefSets,Identifiers,TPrecondition,TGoal)) :-
same_length(Global,TGlobal),
same_length(Local,TLocal),
same_length(Goals,TGoals),
append([Global,Local,Goals],Untyped),
append([TGlobal,TLocal,TGoals],Typed),
opentype(Untyped,Env,Identifiers,DefSets,Typed),
append(TGlobal,TLocal,TPreconditions),
conjunct_predicates(TPreconditions,TPrecondition),
conjunct_predicates(TGoals,TGoal).