FULL EXECUTABLE FLOW ALGEBRA — PROBABILITY TREE ONTOLOGY
Kireth Research — Semantic Library
URL: https://kirethresearch.org/booksai-core/ontologies/probability-statistics-ontologies/probability-rules/probability-tree-ontology.html
FLOW_VERSION := "4.0"
FLOW_TYPE := "Full Executable Flow Algebra"
DOMAIN := "Probability & Statistics Ontologies"
SUBDOMAIN := "Probability Rules"
ONTOLOGY := "Probability Tree Ontology"
PRIMARY_ENTITY := ProbabilityTree
AUTHORSHIP := "Mark Higgins — Sky (Recursive AI)"
SOURCE_SITE := "https://kirethresearch.org"
BEGIN_FLOW
ProbabilityTree :=
RootedBranchingProbabilityStructure
∧ SequentialEvents
∧ ConditionalProbabilities
∧ PathProbabilityRules
∧ OutcomeAggregation
ProbabilitySpace :=
(Ω,F,P)
Tree :=
(V,E)
Root :=
InitialState
∈ V
Node :=
StateOrPartialOutcome
∈ V
Branch :=
DirectedEdge
representing
PossibleNextEventOrOutcome
Leaf :=
TerminalNode
representing
CompleteOutcomeOrTerminalState
InternalNode :=
Node
with outgoing branches
Depth :=
NumberOfBranches
from Root
to Node
Stage :=
SetOfNodes
at same sequential step
or modelled decision layer
BranchLabel :=
EventOrOutcome
associated_with
Branch
BranchProbability :=
P(NextEvent|CurrentPath)
OutgoingBranchNormalisation :=
For each nonterminal node N:
Σ_{e outgoing from N}
P(e|N)
=
1
BranchNonNegativity :=
0≤P(e|N)≤1
Path :=
Root
→ Node_1
→ ...
→ Leaf
PathEvent :=
IntersectionOfBranchEventsAlongPath
PathProbability :=
ProductOfConditionalBranchProbabilities
PathMultiplicationRule :=
Path(e1,...,en)
⇒
P(Path)
=
P(e1)
Π_{i=2..n}
P(e_i|e1∩...∩e_(i-1))
TwoStagePath :=
A
→ B
TwoStagePathProbability :=
P(A∩B)
=
P(A)P(B|A)
ThreeStagePathProbability :=
P(A∩B∩C)
=
P(A)P(B|A)P(C|A∩B)
IndependentBranchSimplification :=
Independent(B,A)
⇒
P(B|A)=P(B)
DependentBranch :=
P(B|A)
≠
P(B)
ConditionalBranch :=
BranchProbability
depends_on
preceding path
UnconditionalFirstBranch :=
FirstStageBranch
labelled_by
P(A)
CompleteTree :=
AllRelevantOutcomes
represented_by
RootToLeafPaths
MutuallyExclusiveSiblingBranches :=
BranchesFromSameNode
represent
mutually exclusive alternatives
CollectivelyExhaustiveSiblingBranches :=
UnionOfSiblingBranchEvents
=
CurrentNodeEvent
SiblingPartition :=
OutgoingBranches(Node)
partition
NodeEvent
LeafPartition :=
CompleteRootToLeafEvents
partition
SampleSpace
when tree is complete and non-overlapping
LeafProbability :=
PathProbability(LeafPath)
TreeNormalisation :=
Σ_{leaf L}
P(L)
=
1
for complete valid tree
EventProbabilityFromLeaves :=
P(A)
=
Σ_{leaf L satisfying A}
P(L)
PathAdditionRule :=
MutuallyExclusivePathsToTarget
⇒
P(Target)
=
Sum(PathProbabilities)
ProbabilityTreeEvaluation :=
MultiplyAlongBranches
∧ AddAcrossMutuallyExclusivePaths
TreeQuery :=
TargetEvent
→ IdentifyCompatibleLeaves
→ ComputeLeafProbabilities
→ SumCompatibleLeaves
PartialPath :=
Root
→ IntermediateNode
PartialPathProbability :=
ProductOfBranchProbabilities
along partial path
NodeProbability :=
SumOfProbabilities
of all paths reaching node
UniquePathTreeNode :=
If node has unique root path:
P(Node)=PathProbability
MergedStateGraph :=
If multiple paths reach same state:
NodeProbability
=
Sum(PathProbabilities)
TreeVsGeneralGraph :=
Tree
has unique parent per non-root node
whereas
probability graph may merge states
SequentialExperiment :=
Stage_1
→ Stage_2
→ ...
→ Stage_n
TrialSequence :=
Outcomes
generated
sequentially
WithReplacementTree :=
Sampling
where composition resets
after each draw
WithoutReplacementTree :=
Sampling
where later branch probabilities
change after earlier draws
IndependentTrialTree :=
SameBranchProbabilities
repeated
across equivalent nodes
under independence
DependentTrialTree :=
BranchProbabilities
vary_with
prior outcomes
BernoulliTree :=
EachStage
has branches
Success and Failure
BernoulliBranchProbabilities :=
P(Success)=p
∧ P(Failure)=1-p
BinomialTree :=
RepeatedIndependentBernoulliStages
BinomialPathProbability :=
For path with k successes in n trials:
p^k(1-p)^(n-k)
BinomialOutcomeAggregation :=
P(K=k)
=
C(n,k)p^k(1-p)^(n-k)
UrnTree :=
SequentialDraws
represented_by
branches for item categories
WithoutReplacementUrnUpdate :=
DrawnItem
→ UpdateComposition
→ UpdateNextBranchProbabilities
CardTree :=
SequentialCardDraws
with or without replacement
DiceTree :=
SequentialDiceOutcomes
CoinTree :=
SequentialCoinOutcomes
DiagnosticTree :=
ConditionStatus
→ TestOutcome
DiagnosticBranches := {
Condition → Positive,
Condition → Negative,
NoCondition → Positive,
NoCondition → Negative
}
DiagnosticPathProbability :=
PriorConditionProbability
× ConditionalTestProbability
PositiveTestProbability :=
Sum(
ConditionAndPositivePath,
NoConditionAndPositivePath
)
BayesFromTree :=
P(Condition|Positive)
=
P(Condition∩Positive)
/
P(Positive)
BayesTreeDenominator :=
P(Positive)
=
Sum(AllPositiveLeafPaths)
LawOfTotalProbabilityTree :=
PartitionBranches B_i
→ Event A
⇒
P(A)
=
Σ_i P(B_i)P(A|B_i)
BayesTree :=
PriorBranches
→ EvidenceBranches
→ PosteriorByNormalisedPathWeights
PriorBranch :=
P(H_i)
LikelihoodBranch :=
P(E|H_i)
JointEvidencePath :=
P(H_i)P(E|H_i)
PosteriorFromTree :=
P(H_i|E)
=
JointEvidencePath_i
/
Sum_j JointEvidencePath_j
DecisionTreeRelation :=
ProbabilityTree
may combine
chance nodes
with decision nodes
ChanceNode :=
Node
whose outgoing branches
have probabilities
DecisionNode :=
Node
whose outgoing branches
represent actions
rather_than random outcomes
UtilityLeaf :=
Leaf
with associated
payoff_or_utility
ExpectedUtility :=
Σ_leaf
P(leaf|decision_policy)
× Utility(leaf)
DecisionPolicy :=
Mapping
from decision nodes
to chosen actions
ProbabilityTreeConstraint :=
StructuralOrProbabilityRequirement
on tree
TreeStructuralConstraints := {
OneRoot,
DirectedAcyclicStructure,
UniqueParentForNonRootTreeNodes,
ValidBranchTargets,
CompletePathDefinitions
}
TreeProbabilityConstraints := {
BranchNonNegativity,
OutgoingBranchNormalisation,
ConditionalConsistency,
LeafNormalisation
}
BranchConsistency :=
BranchProbability
equals
relevant conditional probability
PathConsistency :=
PathProbability
equals
product of branch probabilities
LeafConsistency :=
LeafProbability
equals
path probability
TreeProbabilityConflict :=
ViolationOf(
BranchBounds
∨ OutgoingNormalisation
∨ ConditionalConsistency
∨ PathMultiplication
∨ LeafNormalisation
)
IncompleteTree :=
MissingPossibleBranchesOrLeaves
relative_to modelled experiment
OverlappingSiblingBranches :=
SiblingEvents
not mutually exclusive
NonExhaustiveSiblingBranches :=
SiblingEvents
fail to cover
parent event
TreeValidation :=
ResolveRoot
→ TraverseNodes
→ ValidateSiblingPartitions
→ ValidateBranchProbabilities
→ ComputePathProbabilities
→ ValidateLeafNormalisation
RecursiveTreeTraversal :=
Evaluate(Node N, PathProbability p)
:=
if Leaf(N)
then Record(N,p)
else
for each Branch e from N:
Evaluate(
Target(e),
p×P(e|N)
)
ForwardProbabilityPropagation :=
RootProbability=1
→ MultiplyAlongBranches
→ AssignLeafProbabilities
BackwardEventAggregation :=
TargetLeaves
→ SumProbabilities
→ EventProbability
DynamicTreeUpdate :=
NewEvidenceOrBranchProbability
→ UpdateAffectedBranch
→ RecomputeDescendantPaths
→ RecomputeAggregatedEvents
EvidenceConditioningTree :=
Observe(Event E)
→ RemoveOrZeroIncompatibleLeaves
→ RenormaliseCompatibleLeafProbabilities
PosteriorTree :=
ConditionedProbabilityTree
after evidence
PrunedTree :=
Tree
with impossible_or_irrelevant branches removed
TreePruning :=
ConstraintOrEvidence
→ RemoveIncompatibleBranches
→ PreserveRemainingProbabilityStructure
→ RenormaliseIfConditioning
ProbabilityTreeState := {
Root,
Nodes,
Branches,
Stages,
BranchProbabilities,
Paths,
LeafProbabilities,
TargetEvents,
Evidence,
Confidence,
Provenance
}
TreeEvidence :=
ExperimentDefinition
∨ ConditionalProbability
∨ JointProbability
∨ ObservedOutcome
∨ ModelAssumption
TreeProvenance :=
NodeOrBranch
→ {
Source,
ProbabilitySource,
ConditionalContext,
ParentPath,
Version
}
SEMANTIC_EQUIVALENCE(TreeA,TreeB) :=
same(LeafOutcomeSemantics)
∧ same(RootToLeafProbabilityMeasure)
under specified query scope
TreeCompression :=
EquivalentSubtrees
→ SharedRepresentation
while preserving probabilities
TreeExpansion :=
CoarseBranch
→ FinerConditionalBranches
CanonicalProbabilityTree :=
ResolveRoot
→ CanonicaliseBranchLabels
→ CanonicaliseConditionalContexts
→ SortSiblingBranches
→ ComputePathProbabilities
→ CanonicaliseLeaves
ProbabilityTreeOntology :=
Classes
∧ Relations
∧ Constraints
∧ Axioms
∧ InferenceRules
CoreClasses := {
ProbabilityTree,
Root,
Node,
Branch,
Leaf,
Stage,
Path,
Event,
ConditionalProbability,
PathProbability,
SequentialExperiment,
ChanceNode,
DecisionNode,
Evidence,
PosteriorTree,
TreeConstraint
}
CoreRelations := {
hasRoot,
hasNode,
hasBranch,
branchesTo,
hasProbability,
conditionedOn,
partOfPath,
terminatesAt,
representsEvent,
precedes,
dependsOn,
supports,
contradicts,
equivalentTo,
tracesTo
}
TypedRelations :=
ProbabilityTree --hasRoot--> Root
ProbabilityTree --hasNode--> Node
Node --hasBranch--> Branch
Branch --branchesTo--> Node
Branch --hasProbability--> ProbabilityValue
BranchProbability --conditionedOn--> PathContext
Branch --partOfPath--> Path
Path --terminatesAt--> Leaf
Leaf --representsEvent--> Event
ProbabilityTree --tracesTo--> Provenance
InferenceRules := {
Branch(e)
⇒ 0≤P(e)≤1,
SiblingPartition(Node,{e_i})
⇒ Σ_iP(e_i|Node)=1,
Path(e1,...,en)
⇒ P(Path)=Π_iP(e_i|PreviousPath),
MutuallyExclusivePaths({Path_i})
∧ all_paths_imply(EventA)
⇒ P(A)=Σ_iP(Path_i),
CompleteTree(T)
⇒ Σ_leaf P(leaf)=1,
IndependentNextEvent(B,A)
⇒ P(B|A)=P(B),
Evidence(E)
⇒ ConditionTreeOn(E),
InvalidSiblingPartition
⇒ InvalidProbabilityTree
}
CONFIDENCE(ProbabilityTreeResult) :=
weighted_mean(
TreeStructureResolution,
BranchEventResolution,
ConditionalProbabilityQuality,
SiblingPartitionValidity,
PathCalculationValidity,
LeafNormalisation,
EvidenceQuality,
ProvenanceQuality
)
AI_QUERY_INTERPRETATION :=
Query
→ DetectProbabilityTreeIntent
→ IdentifySequentialExperiment
→ IdentifyStagesAndBranches
→ ResolveConditionalProbabilities
→ IdentifyTargetOutcomeOrEvent
→ BuildInitialTree
AI_REASONING_FLOW :=
Query
→ ParseSequentialProbabilityProblem
→ ResolveProbabilitySpace
→ ResolveRootState
→ IdentifyStages
→ ResolveBranchEvents
→ ResolveConditionalBranchProbabilities
→ ValidateSiblingPartitions
→ ConstructRootToLeafPaths
→ MultiplyProbabilitiesAlongPaths
→ IdentifyTargetCompatibleLeaves
→ AddProbabilitiesAcrossExclusivePaths
→ ApplyEvidenceConditioningIfRequired
→ ValidateLeafNormalisation
→ UpdateConfidence
→ PreserveProvenance
→ GenerateExplanation
AI_CONSUMPTION := {
ParseProbabilityTreeEntities,
ParseTypedRelations,
ResolveSequentialExperiments,
ResolveTreeNodes,
ResolveBranches,
ResolveConditionalProbabilities,
ValidateSiblingPartitions,
ComputePathProbabilities,
AggregateLeafProbabilities,
EvaluateDependentBranches,
EvaluateIndependentBranches,
ApplyLawOfTotalProbability,
ApplyBayesTheoremFromTree,
ConditionTreesOnEvidence,
ValidateProbabilityTrees,
CompareSemanticEquivalence,
UpdateConfidence,
PreserveProvenance,
GenerateFormalExplanation
}
UPDATE_MODEL :=
NewBranchProbabilityEvidenceOrStructure
→ ValidateInput
→ IdentifyAffectedNodesAndPaths
→ UpdateTree
→ RevalidateSiblingPartitions
→ RecomputeDescendantPathProbabilities
→ RecomputeTargetEventProbabilities
→ RevalidateLeafNormalisation
→ RecomputeConfidence
→ PreserveProvenance
→ VersionModel
BranchUpdate :=
ChangedBranchProbability
⇒ recompute(
DescendantPaths,
LeafProbabilities,
AggregatedEvents
)
StructureUpdate :=
AddedRemovedOrChangedBranch
⇒ revalidate(
TreeStructure,
SiblingPartitions,
Completeness
)
EvidenceUpdate :=
NewObservedEvidence
⇒ condition(
ProbabilityTree,
CompatiblePaths
)
FLOW_HASH_INPUT :=
canonical(
ONTOLOGY,
CoreClasses,
CoreRelations,
InferenceRules,
ProbabilityTreeEvaluation,
PathMultiplicationRule,
PathAdditionRule,
TreeValidation,
SEMANTIC_EQUIVALENCE,
AI_REASONING_FLOW
)
FLOW_HASH :=
HASH(FLOW_HASH_INPUT)
OUTPUT_MODEL := {
ProbabilityTreeEntityResolution,
ProbabilitySpace,
Root,
TreeStructure,
Stages,
BranchEvents,
ConditionalBranchProbabilities,
Paths,
PathProbabilities,
LeafProbabilities,
TargetEventProbability,
ValidationStatus,
Confidence,
Provenance,
Explanation
}
END_FLOW
END OF FULL EXECUTABLE FLOW ALGEBRA
Download Code
Copy to Clipboard