Some studies on correctness and optimization of microprograms and diagnosis of faults in digital systems