⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fig23_4.pl

📁 超多的prolog源代码 具体内容见压缩包里面的programs.txt
💻 PL
字号:
%  Figure 23.4  Explanation-based generalization.


%   ebg( Goal, GeneralizedGoal, SufficientCondition) if
%     SufficientCondition in terms of operational predicates
%     guarantees that generalization of Goal, GeneralizedGoal, is true.
%     GeneralizedGoal must not be a variable

ebg( true, true, true)  :-  !.

ebg( Goal, GenGoal, GenGoal)  :-
  operational( GenGoal), 
  call( Goal).

ebg( (Goal1,Goal2), (Gen1,Gen2), Cond)  :- !,
  ebg( Goal1, Gen1, Cond1),
  ebg( Goal2, Gen2, Cond2),
  and( Cond1, Cond2, Cond).     % Cond = (Cond1,Cond2) simplified

ebg( Goal, GenGoal, Cond)  :-
  not operational( Goal),
  clause( GenGoal, GenBody),
  copy_term( (GenGoal,GenBody), (Goal,Body)),    % Fresh copy of (GenGoal,GenBody)
  ebg( Body, GenBody, Cond).

% and( Cond1, Cond2, Cond) if
%  Cond is (possibly simplified) conjunction of Cond1 and Cond2

and( true, Cond, Cond)  :-  !.        % (true and Cond) <==> Cond

and( Cond, true, Cond)  :-  !.        % (Cond and true) <==> Cond

and( Cond1, Cond2, ( Cond1, Cond2)).  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -