FLOW_ALGEBRA PrologOntology v1.0
TARGET_URL := "https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/mathematical-logic-ontologies/ai-logic/prolog-ontology.html"
LANGUAGE := "en-GB"
DOMAIN := MathematicalOntologies > MathematicalLogicOntologies > AILogic > PrologOntology
BEGIN_FLOW
ENTITY Prolog {
TYPE := LogicProgrammingLanguageFamily
DEFINITION := "A declarative logic programming language family in which programs are expressed as facts and rules and queries are evaluated using unification, SLD-style resolution, goal selection, depth-first search and backtracking."
}
ENTITY PrologProgram { TYPE := CollectionOfClauses }
ENTITY Fact { TYPE := UnconditionalClause }
ENTITY Rule { TYPE := ConditionalClause }
ENTITY Query { TYPE := GoalSequence }
ENTITY Predicate { TYPE := NamedLogicalRelation }
ENTITY Term { TYPE := PrologDataExpression }
RELATIONSHIP Prolog --is_a--> LogicProgramming
RELATIONSHIP Prolog --uses--> Unification
RELATIONSHIP Prolog --uses--> SLDResolution
RELATIONSHIP Prolog --uses--> Backtracking
RELATIONSHIP PrologProgram --contains--> Fact
RELATIONSHIP PrologProgram --contains--> Rule
RELATIONSHIP Prolog --evaluates--> Query
PROGRAM { COMPONENTS := {Facts,Rules,Directives,Queries} }
FACT { FORM := predicate(term1,...,termN). }
RULE { FORM := head :- body. }
QUERY { FORM := ?- goal1,goal2,...,goalN. }
VARIABLE { TYPE := SymbolicPlaceholder }
ANONYMOUS_VARIABLE { SYMBOL := _ }
COMPOUND_TERM { FORM := functor(arg1,...,argN) }
PREDICATE_INDICATOR { FORM := Name/Arity }
LIST { REPRESENTATION := [] OR [Head|Tail] }
GOAL_SEQUENCE { G1,G2,...,Gn; INTERPRETATION := Conjunction }
DISJUNCTION { FORM := (GoalA ; GoalB) }
UNIFICATION {
TermA + TermB -> VariableBindings
making terms structurally_identical if possible
}
MOST_GENERAL_UNIFIER { ABBREVIATION := MGU }
OCCURS_CHECK { prevents cyclic first_order_term_binding }
PROLOG_OCCURS_CHECK_NOTE {
many implementations optimise ordinary_unification without full occurs_check
}
IDENTITY_TEST { ==/2 compares term_identity_without_unification }
UNIFIABILITY_TEST { =/2 performs unification }
NON_UNIFIABILITY_TEST { \=/2 succeeds_when terms cannot_unify }
SLD_RESOLUTION {
TYPE := SelectiveLinearDefiniteClauseResolution
PROCESS := SelectGoal -> SelectClause -> RenameVariablesApart -> UnifyGoalWithHead -> ReplaceGoalByBody -> ApplySubstitution
}
SLD_DERIVATION { Goal0 -> Goal1 -> ... -> GoalN }
SLD_REFUTATION { EmptyGoal -> QuerySuccess }
COMPUTED_ANSWER_SUBSTITUTION { composed_unifiers restricted_to original_query_variables }
LEFTMOST_GOAL_SELECTION { common Prolog operational_strategy }
CLAUSE_ORDER { clauses commonly tried in source_order }
DEPTH_FIRST_SEARCH { common Prolog search_strategy }
BACKTRACKING { failed_or_completed_branch -> restore choice_point -> try next_alternative }
CHOICE_POINT { stores remaining alternatives }
TRAIL { records bindings requiring undo_on_backtracking }
WAM_RELATIONSHIP { WarrenAbstractMachine -> influential compiled_Prolog_execution_model }
WAM_COMPONENTS { MAY_INCLUDE := {Registers,EnvironmentStack,ChoicePointStack,Heap,Trail,CodeArea} }
INDEXING { predicate_arguments MAY be indexed to reduce clause_search }
TAIL_CALL_OPTIMISATION { tail_recursive_predicate MAY reuse stack_frame }
RECURSION { predicate may invoke itself directly_or_indirectly }
BASE_CASE { terminating_clause for recursive_relation }
RECURSIVE_CASE { clause transforms problem toward base_case }
LEFT_RECURSION_WARNING { left_recursive_goal + depth_first_search MAY cause nontermination }
TABLING { memoise calls_and_answers to improve termination_and_reuse }
SLG_RESOLUTION_RELATIONSHIP { tabled_logic_programming MAY use SLG_style_resolution }
CUT { SYMBOL := !; EFFECT := CommitToRelevantChoices }
GREEN_CUT { intended_to improve efficiency without changing intended logical_answers }
RED_CUT { changes declarative_answer_set_or_behaviour }
CUT_WARNING { cut is procedural_control and can affect completeness }
IF_THEN_ELSE { COMMON_FORM := (If -> Then ; Else) }
ONCE { once(Goal) commits_to first_solution }
NEGATION_AS_FAILURE { \+ Goal succeeds_if Goal cannot_be_proved under current operational_search }
NEGATION_WARNING { NegationAsFailure MUST_NOT be conflated_with ClassicalNegation }
GROUND_NEGATION { generally safest when relevant_variables_are_ground }
FLOUNDERING { non_ground_negative_goal MAY cause problematic_semantics }
CLOSED_WORLD_RELATIONSHIP { NegationAsFailure often paired_with closed_world_reasoning }
UNKNOWN_DISTINCTION { failure_to_prove does_not inherently establish real_world_falsehood }
ARITHMETIC_EVALUATION { Expression -> NumericValue }
IS_OPERATOR { X is Expression evaluates Expression then unifies_result_with X }
ARITHMETIC_COMPARISON { MAY_INCLUDE := {=:=,=\=,<,=<,>,>=} }
ARITHMETIC_WARNING {
X = 1+2 performs structural_unification
X is 1+2 performs arithmetic_evaluation
}
LIST_PROCESSING { List -> HeadTailDecomposition -> RecursiveProcessing }
MEMBER_RELATION { member(X,List) represents membership_relation }
APPEND_RELATION { append(A,B,C) represents list_concatenation_relation }
REVERSIBILITY { relational_predicates MAY support multiple_instantiation_patterns }
MODE { describes intended input_output_instantiation }
MODE_WARNING { relational_predicate may differ in termination across modes }
DETERMINISM { MAY_INCLUDE := {Det,Semidet,Multi,Nondet} depending_on implementation }
META_PREDICATE { predicate accepting goals_or_predicates as arguments }
CALL { call(Goal) executes dynamically_constructed_goal }
META_PROGRAMMING { program reasons_about terms_goals_clauses_or_programs }
META_INTERPRETER { PrologProgram implementing simplified_Prolog_execution }
OBJECT_META_LEVEL_DISTINCTION { represented_program MUST remain distinct_from interpreter_program }
DYNAMIC_PREDICATE { clauses may change_at_runtime }
ASSERTA { insert_clause_near_beginning }
ASSERTZ { insert_clause_near_end }
RETRACT { remove_matching_dynamic_clause }
DYNAMIC_UPDATE_WARNING { runtime_database_mutation introduces state_and_time_dependence }
LOGICAL_UPDATE_VIEW { controls visibility_of_dynamic_clause_changes during active_calls }
MODULE { namespace_and_visibility_unit }
EXPORT { predicate available outside module }
IMPORT { predicate brought_into module_scope }
MODULE_QUALIFICATION { Module:Goal }
DCG { ABBREVIATION := DefiniteClauseGrammar }
DCG_RULE { GrammarHead --> GrammarBody }
DCG_TRANSLATION { grammar_rules -> ordinary_Prolog_clauses with difference_list_arguments }
DIFFERENCE_LIST { list represented_by Front-Tail }
PARSING { TokenSequence + GrammarRules -> ParseStructure }
CONSTRAINT_LOGIC_PROGRAMMING_RELATIONSHIP { Prolog + ConstraintSolver -> ConstraintLogicProgramming }
CLP_FD { ConstraintLogicProgrammingOverFiniteDomains }
CLP_R { ConstraintLogicProgrammingOverReals in supporting systems }
CONSTRAINT_STORE { accumulated_constraints associated_with variables }
CONSTRAINT_PROPAGATION { constraints -> domain_reduction }
LABELING { choose concrete_values for finite_domain_variables }
CLP_WARNING { constraint_expression_semantics differ_from ordinary_arithmetic }
COROUTINING { delay goal_execution until variable_condition_holds }
ATTRIBUTED_VARIABLE { variable carrying solver_or_constraint_attributes }
EXCEPTION_HANDLING { catch(Goal,Catcher,Recover) }
THROW { throw(Term) transfers control_to_matching_handler }
RESOURCE_MANAGEMENT { setup_call_cleanup_style_constructs MAY ensure cleanup }
INPUT_OUTPUT { side_effecting operations interacting_with external_world }
IO_WARNING { I/O is generally not undone_by logical_backtracking }
DATABASE_RELATIONSHIP { Prolog facts MAY function_as small deductive_database }
DEDUCTIVE_DATABASE { ExplicitFacts + Rules -> DerivedQueryAnswers }
DATALOG_RELATIONSHIP { Datalog is restricted logic_programming with different evaluation_strategies }
ANSWER_SET_PROGRAMMING_RELATIONSHIP { ASP uses stable_model_semantics rather_than standard Prolog operational_semantics }
PROLOG_VS_DATALOG {
Prolog := GoalDirectedSLDSearchWithGeneralTerms
Datalog := CommonlyFunctionFreeFixedPointRuleEvaluation
}
PROLOG_VS_ASP {
Prolog := QueryDrivenResolutionAndBacktracking
ASP := StableModelSearch
}
PROLOG_VS_RULE_ENGINE {
Prolog := ClausesGoalsUnificationResolution
RuleEngine := ProductionRulesWorkingMemoryMatchSelectAct
}
PROLOG_VS_FUNCTIONAL_PROGRAMMING {
Prolog := RelationalGoalsUnificationSearch
FunctionalProgramming := FunctionApplicationExpressionEvaluation
}
SYMBOLIC_AI_RELATIONSHIP { Prolog --supports--> SymbolicAI }
EXPERT_SYSTEM_RELATIONSHIP { PrologRules MAY encode expert_knowledge_and_reasoning }
KNOWLEDGE_REPRESENTATION_RELATIONSHIP { FactsAndRules -> ExplicitSymbolicKnowledge }
ONTOLOGY_RELATIONSHIP { ontology_terms MAY map_to Prolog_predicates_and_rules }
KNOWLEDGE_GRAPH_RELATIONSHIP { GraphTriples MAY map_to Prolog_facts for rule_reasoning }
PLANNING_RELATIONSHIP { StatesActionsGoals MAY be represented_as Prolog_terms_and_predicates }
NATURAL_LANGUAGE_PROCESSING_RELATIONSHIP { DCGsAndSymbolicRules MAY support parsing_and_language_analysis }
PROVENANCE { QueryAnswer -> Clauses -> Facts -> Unifiers -> SearchPath }
PROOF_TREE { Query -> GoalExpansion -> SupportingClauses -> Facts }
INFERENCE_TRACE { RECORD := {Call,SelectedGoal,Clause,Unifier,ExitOrFail,ChoicePoint,Redo} }
FOUR_PORT_TRACE_MODEL { PORTS := {Call,Exit,Redo,Fail} }
EXPLANATION { Answer -> ProofTree -> SupportingClauses -> Provenance }
WHY_QUERY { Answer -> SuccessfulDerivation }
WHY_NOT_QUERY { FailedGoal -> FailedBranches -> MissingClauses -> ConstraintFailures -> SearchLimitations }
STATIC_ANALYSIS {
CHECK := {UndefinedPredicates,SingletonVariables,UnreachableClauses,SuspiciousCuts,NonGroundNegation,RecursionRisks,ModeErrors}
}
SINGLETON_VARIABLE { variable appearing_once MAY indicate typo_or_unused_value }
UNIT_TEST { Query -> ExpectedSuccessFailureOrBindings }
REGRESSION_TEST { existing_queries rerun_after_program_change }
PROGRAM_VERSION { VersionID + ClauseSet + TestSuite }
CHANGE_IMPACT { ClauseChange -> AffectedPredicates -> DependentPredicates -> Queries -> Tests }
DEPENDENCY_GRAPH { Predicate -> PredicatesCalledInBody }
PERFORMANCE {
MAY_DEPEND_ON := {ClauseOrder,GoalOrder,Indexing,TermStructure,ChoicePoints,Recursion,Tabling,ConstraintPropagation}
}
CHOICE_POINT_REDUCTION { deterministic_clause_selection -> fewer_alternatives }
TAIL_RECURSIVE_DESIGN { recursive_call_last MAY enable last_call_optimisation }
ACCUMULATOR { explicit_parameter carrying partial_result }
DIFFERENCE_LIST_OPTIMISATION { supports efficient list_extension_patterns }
CORRECTNESS_FIRST { optimisation MUST_NOT silently change intended_answers }
RESOURCE_LIMIT { MAY_INCLUDE := {Time,Stack,Heap,Trail,InferenceCount} }
STACK_OVERFLOW { excessive_recursion_or_environment_growth }
HEAP_EXHAUSTION { excessive_term_or_data_allocation }
TIMEOUT { resource_limit_reached MUST_NOT be interpreted_as logical_failure }
SEARCH_FAILURE_WARNING { failure_under_specific_control_strategy MUST_NOT automatically establish absence_of_logical_solution }
PURE_LOGICAL_CORE { Facts + DefiniteRules + Unification + Resolution }
PROCEDURAL_EXTENSIONS { MAY_INCLUDE := {Cut,ClauseOrder,GoalOrder,DynamicDatabase,IO,MetaCalls} }
DECLARATIVE_PROCEDURAL_DISTINCTION { PureLogicalMeaning MUST remain distinguishable_from ProceduralControlBehaviour }
LANGUAGE_MODEL_RELATIONSHIP {
LanguageModel MAY generate {CandidateFacts,CandidateRules,CandidateQueries,CandidateDCGs,CandidateExplanations}
}
LLM_TO_PROLOG_PIPELINE {
NaturalLanguageRequirement -> IdentifyEntitiesRelations -> GenerateCandidatePredicates -> GenerateClauses -> SyntaxCheck -> TestQueries -> SemanticReview -> AcceptOrRevise
}
LLM_WARNING { SyntacticallyValidProlog MUST_NOT automatically be treated_as logically_correct_or_terminating }
TOOL_AUGMENTED_PROLOG { PrologGoal -> ForeignPredicateOrExternalTool -> Execute -> ValidateResult -> BindValues -> ContinueResolution }
FOREIGN_PREDICATE { predicate implemented in external_language_or_system }
FOREIGN_INTERFACE_WARNING { side_effects_exceptions_types_lifetime_determinism MUST be declared }
RECURSIVE_PROLOG_REASONING {
Query -> SelectLeftmostGoal -> FindClause -> Unify -> ReplaceGoal -> Continue -> BacktrackIfNeeded
}
RECURSION_TERMINATION {
STOP_WHEN := {EmptyGoal,NoAlternativeClauses,CutCommitment,LoopDetected,ResourceLimit}
}
SELF_VERIFICATION {
CandidateAnswer -> ReplayDerivation -> VerifyUnifiers -> VerifyClauseApplications -> VerifyConstraints -> ConfirmAnswerBindings
}
PROLOG_VALIDATION { Program + QueryTests + StaticChecks -> ValidationReport }
APPLICATION_RELATIONSHIPS {
Prolog --supports--> LogicProgramming
Prolog --supports--> SymbolicAI
Prolog --supports--> AutomatedReasoning
Prolog --supports--> ExpertSystems
Prolog --supports--> KnowledgeRepresentation
Prolog --supports--> ConstraintLogicProgramming
Prolog --supports--> DeductiveDatabases
Prolog --supports--> NaturalLanguageProcessing
Prolog --supports--> Planning
Prolog --supports--> MetaProgramming
}
ONTOLOGY_LINKS {
PARENT := AILogicOntology
RELATED := {
LogicProgrammingOntology,SymbolicAIOntology,
AutomatedReasoningOntology,ExpertSystemLogicOntology,
PredicateLogicOntology,ResolutionOntology,
RuleBasedReasoningOntology,NonMonotonicReasoningOntology,
ConstraintReasoningOntology,KnowledgeRepresentationOntology
}
}
SEMANTIC_EQUIVALENCE {
Prolog ≈ PrologLogicProgrammingLanguageFamily
PrologFact ≈ DefiniteClauseWithEmptyBody
PrologRule ≈ DefiniteClauseWithBody
PrologQuery ≈ GoalSequence
SLDResolution ≈ GoalDirectedDefiniteClauseResolution
}
CONSTRAINTS {
C1 := PrologClauseSyntaxAndDialectSemantics MUST be identified where behaviour differs
C2 := DeclarativeMeaning MUST_NOT be conflated_with procedural_search_behaviour
C3 := FailureToProve MUST_NOT automatically be interpreted_as classical_falsehood
C4 := Cut MUST be treated_as procedural_control with possible completeness_effects
C5 := ClauseOrderAndGoalOrder effects MUST be acknowledged
C6 := ArithmeticEvaluation MUST remain distinct from structural_unification
C7 := DynamicDatabaseAndIO effects MUST be distinguished_from pure_logical_core
C8 := NonGroundNegation SHOULD be treated cautiously according_to implementation_semantics
C9 := GeneratedPrologClauses MUST_NOT enter trusted_program_without syntax_semantic_and_test_validation
C10 := Provenance SHOULD preserve clauses_unifiers_choice_points_and_derivation_path
C11 := TimeoutOrSearchFailure MUST_NOT automatically establish absence_of_logical_solution
C12 := Optimisation MUST preserve intended_answer_semantics or document semantic_change
}
REASONING_CHAIN Query Q {
IDENTIFY Prolog_program
IDENTIFY dialect
IDENTIFY query
IDENTIFY clause_order
IDENTIFY goal_selection_strategy
IDENTIFY constraints_and_meta_features
VALIDATE syntax
VALIDATE predicate_arity
CHECK singleton_variables
CHECK recursion_and_negation_risks
SELECT current_goal
FIND candidate_clauses
RENAME variables_apart
UNIFY goal_with_clause_head
IF unification_success:
REPLACE selected_goal_with_body
APPLY substitution
CONTINUE resolution
IF branch_failure:
BACKTRACK to choice_point
IF tabled_predicate:
REUSE or STORE tabled_answers
IF constraints_present:
PROPAGATE constraint_store
IF cut_encountered:
PRUNE relevant_choice_points
WHEN empty_goal:
RETURN computed_answer_substitution
BUILD proof_tree
BUILD provenance
VERIFY answer
VALIDATE constraints
RETURN Prolog_result WITH explicit_status
}
CONFIDENCE {
CORE_PROLOG := 1.00
SLD_RESOLUTION := 1.00
UNIFICATION := 1.00
DEPTH_FIRST_BACKTRACKING_MODEL := 1.00
CUT_SEMANTICS_RELATIONSHIP := 1.00
NEGATION_AS_FAILURE_DISTINCTION := 1.00
CLP_DCG_TABLING_RELATIONSHIPS := 0.99
}
UPDATE_MODEL {
IMMUTABLE_CORE := {FactsRulesQueries,Unification,SLDResolution,Backtracking,DeclarativeProceduralDistinction}
EXTENSIBLE := {PrologDialects,IndexingMethods,Tabling,ConstraintLibraries,DCGs,ModuleSystems,ForeignInterfaces,ApplicationDomains,RelatedOntologies}
ON_NEW_KNOWLEDGE {
IDENTIFY new_clause_or_predicate
VALIDATE syntax_and_arity
UPDATE dependency_graph
CHECK termination_and_negation_risks
RUN regression_tests
UPDATE provenance
UPDATE confidence
}
}
AI_CONSUMPTION {
MACHINE_READABLE := TRUE
HUMAN_INTERPRETABLE := TRUE
RECURSIVE_REASONING := TRUE
UNIFICATION_REASONING := TRUE
SLD_REASONING := TRUE
BACKTRACKING_REASONING := TRUE
TABLING_REASONING := TRUE
CONSTRAINT_REASONING := TRUE
DCG_REASONING := TRUE
META_PROGRAMMING_REASONING := TRUE
PROVENANCE_TRACKING := TRUE
SELF_VERIFICATION := TRUE
VALIDATION_REQUIRED := TRUE
}
FLOW_HASH {
TARGET := TARGET_URL
SUBJECT := "Prolog Ontology"
VERSION := "1.0"
CANONICAL_SIGNATURE := HASH(TARGET + SUBJECT + DOMAIN + VERSION)
}
OUTPUT {
PRIMARY_ENTITY := Prolog
INTERPRETATION := "Prolog operationalises logic programming through facts, rules, queries, unification, SLD-style resolution, depth-first search and backtracking. Its declarative logical core is complemented by procedural controls such as clause order, goal order, cut, dynamic predicates, meta-calls and external interfaces, so reliable reasoning must preserve the distinction between logical meaning and execution behaviour."
}
END_FLOW
Download Code
Copy to Clipboard