我想用Coq中的以下Ltac编写具有相同功能的Eisbach方法

时间:2019-05-03 10:31:07

标签: isabelle coq-tactic

我不知道如何使用用户定义的函数作为Eisbach方法代码的一部分来评估术语,也不知道如何与术语匹配。以下是Coq Ltac的(简化)定义,我想将其作为Isabelle / HOL中的Eisbach方法编写:

class CustomSerializer(Serializer):
    def end_object(self, obj):
        for field in self.selected_fields:
            if field in self._current.keys():
                continue
            else:
                if field.find('__') > -1:
                    try:
                        fks = field.split('__')
                        curr_value = obj
                        while(len(fks)>0):
                            current_key = fks.pop(0)
                            curr_value = getattr(curr_value, current_key)
                        self._current[field] = curr_value
                    except AttributeError:
                        pass
        super(CustomSerializer, self).end_object(obj)
# usage
data = CustomSerializer().serialize(
          Comment.objects.all(),
          fields = (
            'pk',
            # other fields in Comment Object
            'author__username'  # it belongs to Author Model
          )

0 个答案:

没有答案