Refractor: wrap term with shared_ptr.
move is_valid to gentzen_system.
refractor program. add subsitution
Add unifi code. Refracto.