-- | generates the axioms for the homomorphisms applied to a predicate
homomorphism_form_pred :: Id -> PredType -> Named CASLFORMULA
homomorphism_form_pred name (PredType args) = named_form
      where free_args = map mkFreeName args
            vars_lhs = createVars 0 free_args
            lhs_pt = Pred_type free_args nullRange
            lhs_pred_name = mkQualPred (mkFreeName name) lhs_pt
            lhs = mkPredication lhs_pred_name vars_lhs
            inner_rhs = apply_hom_vars args vars_lhs
            pt_rhs = Pred_type args nullRange
            name_rhs = mkQualPred name pt_rhs
            rhs = mkPredication name_rhs inner_rhs
            form = mkEqv lhs rhs
            form' = quantifyUniversally form
            named_form = makeNamed "" form'

-- | generates the axioms for the homomorphisms applied to the operators
homomorphism_form_pred :: Id -> PredType -> Named CASLFORMULA
homomorphism_form_pred name (PredType args) = named_form
      where free_args = map mkFreeName args
            vars_lhs = createVars 0 free_args
            lhs_pt = Pred_type free_args nullRange
            lhs_pred_name = mkQualPred (mkFreeName name) lhs_pt
            lhs = mkPredication lhs_pred_name vars_lhs
            inner_rhs = apply_hom_vars args vars_lhs
            pt_rhs = Pred_type args nullRange
            name_rhs = mkQualPred name pt_rhs
            rhs = mkPredication name_rhs inner_rhs
            form = mkEqv lhs rhs
            form' = quantifyUniversally form
            named_form = makeNamed "" form'

-- | generates the axioms for the homomorphisms applied to the operators
homomorphism_form_pred name (PredType args) = named_form
      where free_args = map mkFreeName args
            vars_lhs = createVars 0 free_args
            lhs_pt = Pred_type free_args nullRange
            lhs_pred_name = mkQualPred (mkFreeName name) lhs_pt
            lhs = mkPredication lhs_pred_name vars_lhs
            inner_rhs = apply_hom_vars args vars_lhs
            pt_rhs = Pred_type args nullRange
            name_rhs = mkQualPred name pt_rhs
            rhs = mkPredication name_rhs inner_rhs
            form = mkEqv lhs rhs
            form' = quantifyUniversally form
            named_form = makeNamed "" form'

-- | generates the axioms for the homomorphisms applied to the operators