{- | generates a formula of the form make(h(x)) =e= x,
for gn_free_s given the SORT s -}
make_hom_form :: SORT -> Named CASLFORMULA
make_hom_form s = makeNamed ("ga_make_hom_" ++ show s) q_eq
      where free_s = mkFreeName s
            v = newVar free_s
            ot_hom = Op_type Partial [free_s] s nullRange
            os_hom = mkQualOp homId ot_hom
            term_hom = mkAppl os_hom [v]
            ot_mk = Op_type Total [s] free_s nullRange
            os_mk = mkQualOp makeId ot_mk
            term_mk = mkAppl os_mk [term_hom]
            eq = mkExEq term_mk v
            q_eq = quantifyUniversally eq

-- | generates the formulas relating the make functions with the homomorphism
make_hom_form :: SORT -> Named CASLFORMULA
make_hom_form s = makeNamed ("ga_make_hom_" ++ show s) q_eq
      where free_s = mkFreeName s
            v = newVar free_s
            ot_hom = Op_type Partial [free_s] s nullRange
            os_hom = mkQualOp homId ot_hom
            term_hom = mkAppl os_hom [v]
            ot_mk = Op_type Total [s] free_s nullRange
            os_mk = mkQualOp makeId ot_mk
            term_mk = mkAppl os_mk [term_hom]
            eq = mkExEq term_mk v
            q_eq = quantifyUniversally eq

-- | generates the formulas relating the make functions with the homomorphism
make_hom_form s = makeNamed ("ga_make_hom_" ++ show s) q_eq
      where free_s = mkFreeName s
            v = newVar free_s
            ot_hom = Op_type Partial [free_s] s nullRange
            os_hom = mkQualOp homId ot_hom
            term_hom = mkAppl os_hom [v]
            ot_mk = Op_type Total [s] free_s nullRange
            os_mk = mkQualOp makeId ot_mk
            term_mk = mkAppl os_mk [term_hom]
            eq = mkExEq term_mk v
            q_eq = quantifyUniversally eq

-- | generates the formulas relating the make functions with the homomorphism