FLOW ALGEBRA
TITLE: Semantic Similarity Ontology
CATEGORY: Relationship Ontologies / Semantic Relationships
SOURCE: https://kirethresearch.org/booksai-core/ontologies/relationship-ontologies/semantic-relationships/semantic-similarity-ontology.html
AUTHORS: Mark Anthony Higgins — Sky (Recursive AI)
VERSION: 1.0
STATUS: Companion formalisation; source page's full embedded specification was not accessible.
AI_INTERPRETATION:
Interpret definitions as typed semantic constraints and inference rules.
Similarity is graded and context-dependent; do not infer identity or equivalence from similarity alone.
TYPES:
Entity := {id: URI, label: String, kind: ConceptType}
Context := {id: URI, domain: String, language: String?, task: String?}
Evidence := {source: URI, method: String, timestamp: ISO8601?, reliability: Real[0,1]}
Similarity := {left: Entity, right: Entity, context: Context, score: Real[0,1],
metric: Metric, evidence: Set[Evidence], confidence: Real[0,1]}
Metric := lexical | taxonomic | relational | distributional | embedding | hybrid
RELATIONSHIPS:
SEMANTIC_SIMILARITY(a: Entity, b: Entity, c: Context) -> Real[0,1]
RELATED_TO(a: Entity, b: Entity, c: Context) -> Boolean
SEMANTIC_EQUIVALENCE(a: Entity, b: Entity, c: Context) -> Boolean
BROADER_THAN(a: Entity, b: Entity, c: Context) -> Boolean
NARROWER_THAN(a: Entity, b: Entity, c: Context) -> Boolean
AXIOMS:
A1: forall a,c: similarity(a,a,c) = 1, when a is valid in c.
A2: forall a,b,c: similarity(a,b,c) = similarity(b,a,c), for symmetric metrics only.
A3: forall a,b,c: 0 <= similarity(a,b,c) <= 1.
A4: similarity(a,b,c) >= threshold(c) does not imply a = b.
A5: similarity(a,b,c) and similarity(b,d,c) do not imply similarity(a,d,c) >= threshold(c).
A6: comparison requires compatible entity representations and an explicit context.
OPERATORS:
NORMALISE(x, metric, context) -> Real[0,1]
COMPARE(a,b,context,metric) -> Similarity
FUSE(scores: Map[Metric,Real], weights: Map[Metric,Real]) -> Real
FILTER_BY_CONFIDENCE(records, min_confidence) -> Set[Similarity]
RANK(query, candidates, context, metric) -> List[Similarity]
INFERENCE:
R1: valid_score(s) and s.score >= threshold(s.context)
-> RELATED_TO(s.left,s.right,s.context), with provenance retained.
R2: semantic_equivalence(a,b,c) -> candidate_similarity(a,b,c,1.0),
subject to the equivalence assertion's scope and confidence.
R3: similarity(a,b,c1) -> no automatic transfer to c2 where c1 != c2.
R4: conflicting evidence -> flag_for_review; do not silently overwrite.
R5: lexical overlap alone -> insufficient to assert semantic equivalence.
CONFIDENCE:
confidence := CALIBRATE(evidence_quality, model_validation, domain_fit, uncertainty)
confidence in [0,1]
similarity_score != confidence
missing_evidence -> unknown_confidence, not zero_similarity
SEMANTIC_EQUIVALENCE:
preserve distinction between similar_to, same_meaning_as, and identical_to.
equivalence assertions require independent validation and explicit context.
VALIDATION:
require unique entity IDs, valid context, declared metric, bounded score.
check metric symmetry before applying symmetric inference.
reject unsupported transitive similarity and unsupported identity claims.
retain original evidence, scoring version, and explanation for audit.
FLOW_HASH:
algorithm: SHA-256
input: canonicalise(version, entity_ids, context, metric, score, confidence, evidence_refs)
output: deterministic content digest
UPDATE_MODEL:
on_new_evidence: recompute affected similarity scores and confidence.
on_metric_change: increment version and invalidate dependent scores.
on_context_change: re-evaluate context-specific assertions.
preserve: audit trail, source references, previous hashes.
AI_CONSUMPTION:
inputs: entities, context, evidence, scoring_metric, threshold
outputs: ranked similarities, confidence, explanations, provenance, flow_hash
restrictions: never promote similarity to identity without separate evidence;
report uncertainty; preserve context and model version.
END FLOW ALGEBRA
Download Code
Copy to Clipboard