ImageVerifierCode 换一换
格式:DOCX , 页数:26 ,大小:99.81KB ,
资源ID:16773239      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/16773239.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(实现基于谓词逻辑的归结原理Word文档格式.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

实现基于谓词逻辑的归结原理Word文档格式.docx

1、queueusing namespace std;/一些函数的定义void initString(string &ini);/初始化string del_inlclue(string temp);/消去蕴涵符号string dec_neg_rand(string temp);/减少否定符号的辖域string standard_var(string temp);/对变量标准化string del_exists(string temp);/消去存在量词string convert_to_front(string temp);/化为前束形string convert_to_and(string te

2、mp);/把母式化为合取范式string del_all(string temp);/消去全称量词string del_and(string temp);/消去连接符号合取%string change_name(string temp);/更换变量名称/辅助函数定义bool isAlbum(char temp);/是字母string del_null_bracket(string temp);/删除多余的括号string del_blank(string temp);/删除多余的空格void checkLegal(string temp);/检查合法性char numAfectChar(int

3、 temp);/数字显示为字符/主函数void main() coutP)(#x)y(x)(x)x!b(x)(x!y)(a(b) string orign,temp; char command,command0,command1,command2,command3,command4,command5, command6,command7,command8,command9,command10; /=请输入(Y/y)初始化谓词演算公式 cincommand; if(command = y | command = Y) initString(orign); else exit(0); orign

4、请输入(Y/y)减少否定符号的辖域command2; if(command2 = | command2 = do temp = orign; orign = dec_neg_rand(orign); while(temp != orign); cout减少否定符号的辖域后是endl ,全称量词为,存在量词为#,取反为,吸取为!,合取为%,左右括号分别为( 、 ),函数名请用一个字母请输入(y/n)选择是否用户自定义commandb; if(commandb =| commandb= cinini; ini = (x)(P(x)(y)(P(y)P(f(x, y)%(y)(Q(x,y)P(y)原始

5、命题是ini蕴涵项 /ab变为a!b char ctemp100=; string output; int length = temp.length(); int i = 0,right_bracket = 0,falg= 0; stack stack1,stack2,stack3; strcpy(ctemp,temp.c_str(); while(ctempi != 0 & i b则用a!b替代 falg = 1; if(isAlbum(ctempi)/如果是字母则把ctempi弹出 stack1.pop(); stack1.push( stack1.push(ctempi);! i = i

6、 + 1; else if() = ctempi) right_bracket+; do if( = stack1.top() right_bracket-; stack3.push(stack1.top(); stack1.pop(); while(right_bracket != 0); stack3.push(stack1.top(); while(!stack3.empty() stack1.push(stack3.top(); stack3.pop(); i+; while(!stack1.empty() stack2.push(stack1.top(); stack1.pop();

7、stack2.empty() output += stack2.top(); stack2.pop(); if(falg = 1) return output; return temp;string dec_neg_rand(string temp)/减少否定符号的辖域 char ctemp100,tempc; int flag2 = 0; int i = 0,left_bracket = 0,length = temp.length(); stack stack1,stack2; queue =0); queue1.push( while(!queue1.empty() tempc = qu

8、eue1.front(); queue1.pop(); stack1.push(tempc); i +; if(flag2 = 1) temp = output; /*/ char ctemp1100; string output1; stack11,stack22; int falg1 = 0; int times = 0; int length1 = temp.length(),inleftbackets = 1,j = 0; strcpy(ctemp1,temp.c_str(); while(ctemp1j ! j =0 & times = 0) stack11.push(ctemp1j

9、); if(ctemp1j = inleftbackets +; else if(ctemp1j = inleftbackets -; if(inleftbackets = 1 & ctemp1j+1 = ctemp1j+2 ! falg1 =1; stack11.push(/% j = j+1; j = j +1; if(falg1 = 1) stack11.push( stack11.pop();/此处有bug j +;stack11.empty() stack22.push(stack11.top(); stack11.pop();stack22.empty() output1 += stack22.top(); stack22.pop(); if(falg1 = 1) temp = output1; char ctemp3100; string output3; int k = 0,left_bracket3 = 1,length3 = temp.length(); stack13,stack23; int flag = 0,bflag = 0; strcpy(ctemp3,temp.c_str(); while(ctemp3k ! k =0) stack13.push(ctemp3k+1); if(ctemp3k+1 = left_bracket3 +; le

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1