Skip to main content

Tensor Ontology

Algebra Ontologies
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 20 September 2026
Audio Overview
======================================================================
KIRETH SEMANTIC RESEARCH ARCHIVE
FLOW ALGEBRA — TENSOR ONTOLOGY
======================================================================

PAGE:
https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/algebra-ontologies/tensor-ontology.html

FLOW:
TensorOntology

VERSION:
1.0

LANGUAGE:
en-GB

AUTHORS:
Mark Anthony Higgins — Sky Recursive AI

PURPOSE:
To provide a machine-readable, recursively executable semantic and
reasoning specification for tensors, tensor rank/order, tensor spaces,
multilinear maps, tensor products, components, bases, coordinate
transformations, contractions, symmetry, antisymmetry, metric tensors,
index notation, covariant and contravariant behaviour, and recursive
tensor validation.

AI INTERPRETATION NOTE:
Execute the following specification as formal semantic and reasoning
rules. Preserve tensor order, dimensions, variance, basis dependence,
index ranges, contraction legality, symmetry conditions and coordinate
transformation rules.

======================================================================
START FLOW
======================================================================

FLOW TensorOntology {

----------------------------------------------------------------------
1. DOMAIN DECLARATION
----------------------------------------------------------------------

DOMAIN := Tensor_Theory

PARENT_DOMAIN := Algebra

SUPER_DOMAINS := {
    Mathematics,
    Mathematical_Ontologies,
    Algebra_Ontologies,
    Linear_Algebra,
    Vector_Theory
}

DOMAIN_INTENT := {
    represent_scalars_vectors_matrices_as_tensors,
    represent_higher_order_tensors,
    represent_tensor_spaces,
    represent_multilinear_maps,
    represent_tensor_products,
    represent_components,
    represent_basis_expansions,
    represent_covariant_indices,
    represent_contravariant_indices,
    represent_mixed_tensors,
    represent_index_notation,
    represent_coordinate_transformations,
    represent_contraction,
    represent_trace,
    represent_symmetry,
    represent_antisymmetry,
    represent_metric_tensors,
    represent_index_raising_and_lowering,
    represent_tensor_invariants,
    support_recursive_tensor_reasoning,
    support_variance_aware_validation
}

DEFAULT_SCALAR_FIELD := RealNumber | ComplexNumber

----------------------------------------------------------------------
2. PRIMITIVE TYPES
----------------------------------------------------------------------

TYPE Scalar
TYPE RealNumber <: Scalar
TYPE ComplexNumber <: Scalar
TYPE Vector
TYPE Covector
TYPE Tensor
TYPE TensorOrder
TYPE TensorRank
TYPE Dimension
TYPE Index
TYPE CovariantIndex <: Index
TYPE ContravariantIndex <: Index
TYPE Basis
TYPE DualBasis
TYPE VectorSpace
TYPE DualSpace
TYPE TensorSpace
TYPE MultilinearMap
TYPE TensorProduct
TYPE MetricTensor <: Tensor
TYPE KroneckerDelta <: Tensor
TYPE LeviCivitaTensor <: Tensor
TYPE SymmetricTensor <: Tensor
TYPE AntisymmetricTensor <: Tensor
TYPE Derivation
TYPE Constraint
TYPE ValidationResult

----------------------------------------------------------------------
3. TENSOR DEFINITION
----------------------------------------------------------------------

ENTITY Tensor T {
    scalar_field: F
    vector_space: V
    type: (p,q)
    contravariant_order: p
    covariant_order: q
    total_order: p+q
}

INTERPRETATION:
    Tensor of type (p,q)
    :=
    multilinear map:
        (V*)^p x V^q -> F

ALTERNATIVE_EQUIVALENT_REPRESENTATION:
    T in V^(⊗p) ⊗ (V*)^(⊗q)

RULE TEN_01:
    scalar is tensor of type (0,0)

RULE TEN_02:
    vector is tensor of type (1,0)

RULE TEN_03:
    covector is tensor of type (0,1)

RULE TEN_04:
    linear operator may be represented as tensor of type (1,1)

RULE TEN_05:
    bilinear form is tensor of type (0,2)

----------------------------------------------------------------------
4. VECTOR AND DUAL SPACES
----------------------------------------------------------------------

ENTITY VectorSpace V {
    dimension: n
    scalar_field: F
}

ENTITY DualSpace V* {
    elements: linear_functionals V->F
}

PAIRING:
    <omega,v> := omega(v)

RULE DUAL_01:
    dim(V*)=dim(V)
    for finite-dimensional V

----------------------------------------------------------------------
5. BASIS AND DUAL BASIS
----------------------------------------------------------------------

BASIS:
    B={e_1,...,e_n}

DUAL_BASIS:
    B*={e^1,...,e^n}

DEFINITION:
    e^i(e_j)=delta^i_j

RULE BASIS_01:
    vector:
        v=v^i e_i

RULE BASIS_02:
    covector:
        omega=omega_i e^i

RULE BASIS_03:
    tensor components depend on basis,
    tensor itself is basis-independent.

----------------------------------------------------------------------
6. EINSTEIN SUMMATION CONVENTION
----------------------------------------------------------------------

RULE EIN_01:
    repeated index appearing once up and once down
    implies summation over full index range.

EXAMPLE:
    v^i omega_i
    :=
    SUM_i v^i omega_i

RULE EIN_02:
    free indices must match on both sides of tensor equation.

RULE EIN_03:
    dummy indices may be renamed without changing meaning.

RULE EIN_04:
    an index should not appear more than twice in a valid monomial
    under standard Einstein notation.

----------------------------------------------------------------------
7. COMPONENT REPRESENTATION
----------------------------------------------------------------------

TENSOR_COMPONENTS:
    T^(i1...ip)_(j1...jq)

BASIS_EXPANSION:
    T
    =
    T^(i1...ip)_(j1...jq)
    e_i1 ⊗ ... ⊗ e_ip
    ⊗
    e^j1 ⊗ ... ⊗ e^jq

RULE COMP_01:
    each index range determined by dimension of corresponding space.

RULE COMP_02:
    component count in n-dimensional single-space tensor:
        n^(p+q)

----------------------------------------------------------------------
8. TENSOR ORDER / DEGREE
----------------------------------------------------------------------

TENSOR_ORDER(T):
    p+q

RULE ORD_01:
    order 0 -> scalar

RULE ORD_02:
    order 1 -> vector or covector

RULE ORD_03:
    order 2 -> matrix-like component array depending on variance

NOTE:
    "tensor rank" is ambiguous in literature.
    This ontology distinguishes:
        tensor_order/type
        from decomposition_rank.

----------------------------------------------------------------------
9. TENSOR ADDITION
----------------------------------------------------------------------

TENSOR_ADD(A,B):

    REQUIRE:
        same tensor type (p,q)
        same underlying spaces
        same scalar field

    DEFINE:
        (A+B)^I_J=A^I_J+B^I_J

RULE ADD_01:
    A+B=B+A

RULE ADD_02:
    (A+B)+C=A+(B+C)

RULE ADD_03:
    A+0=A

----------------------------------------------------------------------
10. SCALAR MULTIPLICATION
----------------------------------------------------------------------

SCALAR_MULTIPLY(c,T):

    DEFINE:
        (cT)^I_J=c*T^I_J

RULE SCAL_01:
    c(A+B)=cA+cB

RULE SCAL_02:
    (c+d)T=cT+dT

RULE SCAL_03:
    c(dT)=(cd)T

----------------------------------------------------------------------
11. TENSOR PRODUCT
----------------------------------------------------------------------

TENSOR_PRODUCT(A,B):

    if A type (p,q)
    and B type (r,s)

    then:
        A⊗B type (p+r,q+s)

COMPONENT_RULE:
    (A⊗B)^(I K)_(J L)
    =
    A^I_J B^K_L

RULE TP_01:
    tensor product is bilinear.

RULE TP_02:
    generally A⊗B != B⊗A.

RULE TP_03:
    tensor product is associative up to canonical identification.

----------------------------------------------------------------------
12. MULTILINEAR MAP INTERPRETATION
----------------------------------------------------------------------

ENTITY MultilinearMap M {
    domains: vector_or_dual_spaces*
    codomain: F
}

MULTILINEAR(M) iff
    linear in each argument separately.

RULE ML_01:
    tensors are equivalently represented by suitable multilinear maps.

----------------------------------------------------------------------
13. CONTRACTION
----------------------------------------------------------------------

CONTRACTION(T, contravariant_index a, covariant_index b):

    REQUIRE:
        one upper and one lower index
        compatible dimension

    sum over identified index

    output type:
        (p-1,q-1)

EXAMPLE:
    T^i_i := SUM_i T^i_i

RULE CONT_01:
    contraction lowers total tensor order by 2.

RULE CONT_02:
    contraction requires compatible upper/lower index pair.

----------------------------------------------------------------------
14. TRACE
----------------------------------------------------------------------

TRACE(T):
    contraction of one contravariant and one covariant index

FOR LINEAR_OPERATOR A^i_j:
    tr(A)=A^i_i

RULE TR_01:
    trace invariant under basis change.

----------------------------------------------------------------------
15. PERMUTATION OF INDICES
----------------------------------------------------------------------

PERMUTE_INDICES(T,pi):

    reorder tensor slots according to permutation pi.

RULE PERM_01:
    tensor type preserved under permutation within same variance pattern,
    unless permutation exchanges covariant/contravariant slots by
    explicitly declared identification.

----------------------------------------------------------------------
16. SYMMETRIC TENSORS
----------------------------------------------------------------------

IS_SYMMETRIC(T,indices) iff
    swapping specified indices leaves components unchanged.

FOR type (0,2):
    T_ij=T_ji

RULE SYM_01:
    full symmetrisation:
        Sym(T)
        :=
        (1/k!) SUM_{pi in S_k} pi(T)

----------------------------------------------------------------------
17. ANTISYMMETRIC TENSORS
----------------------------------------------------------------------

IS_ANTISYMMETRIC(T,indices) iff
    swapping any two selected indices reverses sign.

FOR type (0,2):
    T_ij=-T_ji

RULE ASYM_01:
    repeated equal indices in antisymmetric pair -> component 0
    when characteristic !=2.

FULL_ANTISYMMETRISATION:
    Alt(T)
    :=
    (1/k!) SUM_{pi in S_k} sign(pi) pi(T)

----------------------------------------------------------------------
18. EXTERIOR / ALTERNATING TENSORS
----------------------------------------------------------------------

ENTITY AlternatingTensor <: AntisymmetricTensor

WEDGE_PRODUCT(alpha,beta):
    :=
    antisymmetrised tensor product

RULE WEDGE_01:
    alpha∧beta=(-1)^(pq) beta∧alpha
    for p-form alpha and q-form beta

RULE WEDGE_02:
    alpha∧alpha=0
    for odd-degree alpha
    under characteristic !=2

----------------------------------------------------------------------
19. KRONECKER DELTA
----------------------------------------------------------------------

KRONECKER_DELTA:
    delta^i_j

DEFINE:
    delta^i_j=1 if i=j else 0

RULE KD_01:
    delta^i_j v^j=v^i

RULE KD_02:
    delta^i_j omega_i=omega_j

RULE KD_03:
    delta behaves as identity tensor.

----------------------------------------------------------------------
20. METRIC TENSOR
----------------------------------------------------------------------

ENTITY MetricTensor g {
    type: (0,2)
    properties:
        bilinear
        nondegenerate
        often symmetric
}

COMPONENTS:
    g_ij

RULE MET_01:
    metric defines inner product:
        <u,v>=g_ij u^i v^j

RULE MET_02:
    inverse metric g^ij satisfies:
        g^ik g_kj=delta^i_j

----------------------------------------------------------------------
21. RAISING INDICES
----------------------------------------------------------------------

RAISE_INDEX(omega_i):

    omega^i=g^ij omega_j

GENERAL_RULE:
    contract covariant slot with inverse metric.

RULE RAISE_01:
    raising changes one covariant index to contravariant.

----------------------------------------------------------------------
22. LOWERING INDICES
----------------------------------------------------------------------

LOWER_INDEX(v^i):

    v_i=g_ij v^j

GENERAL_RULE:
    contract contravariant slot with metric.

RULE LOWER_01:
    lowering changes one contravariant index to covariant.

----------------------------------------------------------------------
23. COORDINATE TRANSFORMATIONS
----------------------------------------------------------------------

COORDINATE_CHANGE:
    x^i -> x'^a

JACOBIAN:
    J^a_i = partial x'^a / partial x^i

INVERSE_JACOBIAN:
    K^i_a = partial x^i / partial x'^a

CONTRAVARIANT_VECTOR_TRANSFORM:
    v'^a = J^a_i v^i

COVARIANT_VECTOR_TRANSFORM:
    omega'_a = K^i_a omega_i

----------------------------------------------------------------------
24. GENERAL TENSOR TRANSFORMATION LAW
----------------------------------------------------------------------

FOR T type (p,q):

T'^(a1...ap)_(b1...bq)
=
J^a1_i1 ... J^ap_ip
K^j1_b1 ... K^jq_bq
T^(i1...ip)_(j1...jq)

RULE TRANS_01:
    each upper index transforms with forward Jacobian.

RULE TRANS_02:
    each lower index transforms with inverse Jacobian.

RULE TRANS_03:
    tensoriality is defined by this transformation behaviour.

----------------------------------------------------------------------
25. SCALAR INVARIANCE
----------------------------------------------------------------------

RULE INV_01:
    fully contracted tensor expression is scalar under coordinate change,
    provided all contractions are tensorially valid.

----------------------------------------------------------------------
26. OUTER PRODUCT
----------------------------------------------------------------------

OUTER_PRODUCT(u,v):
    u⊗v

IF:
    u type (1,0)
    v type (1,0)

THEN:
    u⊗v type (2,0)

COMPONENTS:
    (u⊗v)^(ij)=u^i v^j

----------------------------------------------------------------------
27. DYADICS
----------------------------------------------------------------------

DYAD(u,v):
    u⊗v

RULE DYAD_01:
    rank-one matrix representation may arise from vector-covector
    tensor product.

----------------------------------------------------------------------
28. TENSOR AS MULTIDIMENSIONAL ARRAY
----------------------------------------------------------------------

ARRAY_REPRESENTATION(T):
    components indexed by p+q indices

NOTE:
    multidimensional array is a coordinate representation of a tensor,
    not by itself sufficient to establish tensorial transformation law.

RULE ARRAY_01:
    tensor ontology distinguishes abstract tensor from component array.

----------------------------------------------------------------------
29. TENSOR PRODUCT SPACE
----------------------------------------------------------------------

TENSOR_SPACE:
    V⊗W

UNIVERSAL_PROPERTY:
    bilinear maps V x W -> X
    correspond uniquely to linear maps V⊗W -> X

RULE TPS_01:
    tensor product is characterised by universal bilinear property.

----------------------------------------------------------------------
30. TENSOR POWERS
----------------------------------------------------------------------

TENSOR_POWER(V,k):
    V^(⊗k)

RULE TPOW_01:
    k=0 -> scalar field F

RULE TPOW_02:
    k=1 -> V

----------------------------------------------------------------------
31. DUAL TENSOR SPACES
----------------------------------------------------------------------

DUAL_TENSOR_SPACE:
    (V^(⊗p)⊗(V*)^(⊗q))*
    canonically related to
    (V*)^(⊗p)⊗V^(⊗q)
    in finite dimensions.

----------------------------------------------------------------------
32. BASIS TRANSFORMATION
----------------------------------------------------------------------

IF:
    e'_a = K^i_a e_i

THEN:
    dual basis transforms:
        e'^a = J^a_i e^i

RULE BT_01:
    basis and dual basis transform inversely.

----------------------------------------------------------------------
33. TENSOR EQUATIONS
----------------------------------------------------------------------

VALID_TENSOR_EQUATION(LHS,RHS) iff

    same free-index pattern

    same tensor type

    compatible dimensions

    equality holds independently of coordinate system

RULE TEQ_01:
    free indices on LHS and RHS must match in name pattern up to
    consistent renaming.

----------------------------------------------------------------------
34. INDEX VALIDITY
----------------------------------------------------------------------

VALID_INDEX_EXPRESSION(E) iff

    every dummy index appears exactly twice,
    once contravariant and once covariant

    every free index appears exactly once per monomial

    free index pattern consistent across summed terms

RULE IDX_01:
    invalid repeated-index structure -> malformed tensor expression.

----------------------------------------------------------------------
35. SYMMETRIC DECOMPOSITION
----------------------------------------------------------------------

FOR second-order tensor T_ij:

Sym(T)_ij
=
1/2(T_ij+T_ji)

Alt(T)_ij
=
1/2(T_ij-T_ji)

RULE SD_01:
    T=Sym(T)+Alt(T)

RULE SD_02:
    symmetric and antisymmetric parts are unique.

----------------------------------------------------------------------
36. ISOTROPIC TENSORS
----------------------------------------------------------------------

IS_ISOTROPIC(T) iff
    invariant under all rotations in declared space.

EXAMPLE:
    second-order isotropic tensor in Euclidean space:
        c delta_ij

RULE ISO_01:
    isotropy depends on transformation group and tensor order.

----------------------------------------------------------------------
37. LEVI-CIVITA SYMBOL / TENSOR
----------------------------------------------------------------------

LEVI_CIVITA epsilon_ijk in 3D:

    +1 for even permutation of (1,2,3)
    -1 for odd permutation
    0 if any indices repeat

RULE LC_01:
    epsilon_ijk encodes orientation.

RULE LC_02:
    distinction between Levi-Civita symbol and tensor must be preserved
    in general coordinates.

----------------------------------------------------------------------
38. CROSS PRODUCT VIA TENSOR NOTATION
----------------------------------------------------------------------

IN Euclidean R^3:

(u x v)^i
=
epsilon^i_jk u^j v^k

RULE CROSS_01:
    cross product depends on metric and orientation structure.

----------------------------------------------------------------------
39. DETERMINANT VIA LEVI-CIVITA
----------------------------------------------------------------------

FOR 3x3 A:

det(A)
=
epsilon_ijk
A^1_i
A^2_j
A^3_k

subject to index convention.

RULE DET_01:
    determinant is alternating multilinear scalar.

----------------------------------------------------------------------
40. TENSOR DECOMPOSITION RANK
----------------------------------------------------------------------

CP_RANK(T):
    minimum r such that
    T =
    SUM_{k=1}^r
    a_k^(1) ⊗ ... ⊗ a_k^(m)

NOTE:
    CP rank differs from tensor order.

RULE CPR_01:
    matrix rank is special order-2 case but higher-order rank behaves
    differently and may lack simple closed forms.

----------------------------------------------------------------------
41. CANONICAL POLYADIC DECOMPOSITION
----------------------------------------------------------------------

CP_DECOMPOSITION(T):
    T approximately or exactly represented as sum of rank-one tensors.

VALIDATE_CP:
    reconstruct tensor
    compare to original
    record exact_or_approximate status

----------------------------------------------------------------------
42. TUCKER DECOMPOSITION
----------------------------------------------------------------------

TUCKER(T):
    T
    =
    G
    ×1 U1
    ×2 U2
    ...
    ×n Un

where:
    G core tensor
    Uk factor matrices

RULE TUCKER_01:
    multilinear ranks correspond to mode ranks.

----------------------------------------------------------------------
43. MODE-N UNFOLDING
----------------------------------------------------------------------

UNFOLD(T,mode=n):
    rearrange tensor components into matrix T_(n)

RULE UNFOLD_01:
    unfolding is representation-dependent but information-preserving
    when indexing convention is known.

----------------------------------------------------------------------
44. MODE-N PRODUCT
----------------------------------------------------------------------

MODE_PRODUCT(T,U,n):

    contract mode n of T with compatible matrix U.

RULE MODE_01:
    output dimensions update according to matrix row dimension.

----------------------------------------------------------------------
45. FROBENIUS NORM
----------------------------------------------------------------------

FROBENIUS_NORM(T):
    sqrt(
        SUM_all_indices |T_indices|^2
    )

RULE FN_01:
    ||T||_F>=0

RULE FN_02:
    ||T||_F=0 iff T=0

RULE FN_03:
    orthonormal coordinate changes preserve Frobenius norm.

----------------------------------------------------------------------
46. INNER PRODUCT OF TENSORS
----------------------------------------------------------------------

INNER_PRODUCT(A,B):

    REQUIRE:
        same type and dimensions

    :=
    SUM_all_components
        conjugate(A_I) B_I

RULE TIP_01:
    induces Frobenius norm:
        ||A||_F=sqrt(<A,A>)

----------------------------------------------------------------------
47. TRACE OF SECOND-ORDER TENSOR
----------------------------------------------------------------------

TRACE(T^i_j):
    T^i_i

RULE TRACE_01:
    basis invariant.

FOR T_ij:
    trace requires metric:
        g^ij T_ij

----------------------------------------------------------------------
48. DOUBLE CONTRACTION
----------------------------------------------------------------------

DOUBLE_CONTRACTION(A,B):
    A:B

FOR second-order Euclidean tensors:
    A:B=A_ij B_ij

RULE DC_01:
    result is scalar.

----------------------------------------------------------------------
49. IDENTITY TENSOR
----------------------------------------------------------------------

IDENTITY_TENSOR:
    delta^i_j

RULE IT_01:
    delta^i_j v^j=v^i

RULE IT_02:
    delta^i_j T^j_k=T^i_k

----------------------------------------------------------------------
50. ZERO TENSOR
----------------------------------------------------------------------

ZERO_TENSOR(type(p,q),dimensions):
    all components zero

RULE ZT_01:
    T+0=T

RULE ZT_02:
    c*0=0

----------------------------------------------------------------------
51. TENSOR SYMMETRY METADATA
----------------------------------------------------------------------

ENTITY SymmetryClass {
    index_permutations
    sign_behaviour
}

RULE SCMETA_01:
    declared symmetries reduce independent component count.

----------------------------------------------------------------------
52. INDEPENDENT COMPONENT COUNTS
----------------------------------------------------------------------

FOR symmetric rank-2 tensor in n dimensions:
    independent_components=n(n+1)/2

FOR antisymmetric rank-2 tensor:
    independent_components=n(n-1)/2

RULE ICC_01:
    component-count formulas depend on symmetry class and dimension.

----------------------------------------------------------------------
53. TENSOR EQUATION PARSING
----------------------------------------------------------------------

PARSE_TENSOR_EXPRESSION(E):

    identify symbols

    assign tensor types

    identify free indices

    identify dummy indices

    verify index variance

    infer contractions

    check dimensions

    return typed_expression_graph

----------------------------------------------------------------------
54. TYPE INFERENCE
----------------------------------------------------------------------

INFER_TYPE(term):

    scalar -> (0,0)

    vector v^i -> (1,0)

    covector w_i -> (0,1)

    product:
        add tensor types before contractions

    contraction:
        subtract (1,1) per contracted pair

    return resulting tensor type

----------------------------------------------------------------------
55. SEMANTIC RELATIONSHIPS
----------------------------------------------------------------------

RELATION HAS_COMPONENT(Tensor,Scalar)
RELATION HAS_TYPE(Tensor,TensorType)
RELATION MEMBER_OF(Tensor,TensorSpace)
RELATION TENSOR_PRODUCT_OF(Tensor,Tensor)
RELATION CONTRACTION_OF(Tensor,Tensor)
RELATION SYMMETRIC_IN(Tensor,IndexSet)
RELATION ANTISYMMETRIC_IN(Tensor,IndexSet)
RELATION REPRESENTED_IN(Tensor,Basis)
RELATION TRANSFORMS_UNDER(Tensor,CoordinateChange)
RELATION RAISED_BY(Tensor,MetricTensor)
RELATION LOWERED_BY(Tensor,MetricTensor)

----------------------------------------------------------------------
56. SEMANTIC EQUIVALENCE
----------------------------------------------------------------------

SEMANTIC_EQUIVALENCE {

    "tensor order" ~= total_number_of_indices
    "tensor degree" ~= tensor_order
    "covariant index" ~= lower_index
    "contravariant index" ~= upper_index
    "mixed tensor" ~= tensor_with_both_upper_and_lower_indices
    "outer product" ~= tensor_product_for_vectors
    "contraction" ~= summation_over_one_upper_and_one_lower_index
    "metric" ~= nondegenerate_bilinear_form_used_for_index_conversion
    "raise an index" ~= contract_with_inverse_metric
    "lower an index" ~= contract_with_metric
    "component array" ~= coordinate_representation_of_tensor
    "rank-one tensor" ~= decomposable_tensor
    "tensor rank" ~= context_sensitive:
        tensor_order OR decomposition_rank
}

----------------------------------------------------------------------
57. QUERY INTERPRETATION
----------------------------------------------------------------------

QUERY Q1:
    "what type is T"
    -> infer tensor type (p,q)

QUERY Q2:
    "contract indices"
    -> CONTRACTION

QUERY Q3:
    "raise index"
    -> RAISE_INDEX

QUERY Q4:
    "lower index"
    -> LOWER_INDEX

QUERY Q5:
    "transform tensor coordinates"
    -> GENERAL_TENSOR_TRANSFORMATION_LAW

QUERY Q6:
    "symmetrise"
    -> Sym(T)

QUERY Q7:
    "antisymmetrise"
    -> Alt(T)

QUERY Q8:
    "tensor product"
    -> TENSOR_PRODUCT

QUERY Q9:
    "trace tensor"
    -> valid contraction based on type and metric

----------------------------------------------------------------------
58. VALIDATION ENGINE
----------------------------------------------------------------------

PROCEDURE VALIDATE_TENSOR_EXPRESSION(E):

    parse tensor symbols

    check each symbol type

    check dimension compatibility

    check free indices

    check dummy indices

    check contraction legality

    check variance

    check symmetry constraints

    verify coordinate transformation consistency when required

    return:
        VALID
        INVALID(reason)
        UNRESOLVED

----------------------------------------------------------------------
59. RECURSIVE REASONING ENGINE
----------------------------------------------------------------------

PROCEDURE TENSOR_REASONER(input):

    parse tensors and indices

    infer tensor types

    infer dimensions

    identify basis/coordinate context

    identify metric/orientation context if required

    classify requested operation

    extract constraints

    select valid tensor rules

    execute atomic transformations

    validate index structure after every step

    preserve free indices

    preserve tensor type unless operation intentionally changes it

    recurse until target achieved

    validate final result

    RETURN:
        result,
        derivation,
        tensor_type,
        index_constraints,
        semantic_status,
        confidence

----------------------------------------------------------------------
60. RECURSIVE TRANSITION
----------------------------------------------------------------------

RECURSIVE_RULE RR_01:

    INPUT state S_n

    identify unresolved tensor property

    choose rule R such that:
        type_preconditions=true
        index_preconditions=true
        dimension_preconditions=true

    S_(n+1):=apply(R,S_n)

    validate transition

    recurse(S_(n+1))

TERMINATION_CONDITIONS := {
    tensor_goal_achieved,
    canonical_index_form_reached,
    contradiction_detected,
    invalid_contraction,
    dimension_failure,
    missing_metric,
    missing_orientation,
    no_valid_rule
}

----------------------------------------------------------------------
61. ERROR MODEL
----------------------------------------------------------------------

ERROR E_INDEX_RANGE
ERROR E_FREE_INDEX_MISMATCH
ERROR E_DUMMY_INDEX_MALFORMED
ERROR E_VARIANCE_MISMATCH
ERROR E_INVALID_CONTRACTION
ERROR E_DIMENSION_MISMATCH
ERROR E_MISSING_METRIC
ERROR E_NONINVERTIBLE_METRIC
ERROR E_ORIENTATION_REQUIRED
ERROR E_SYMMETRY_VIOLATION
ERROR E_TRANSFORMATION_LAW_FAILURE
ERROR E_TENSOR_ARRAY_CONFUSION
ERROR E_RANK_AMBIGUITY

----------------------------------------------------------------------
62. CONFIDENCE MODEL
----------------------------------------------------------------------

CONFIDENCE {

    base:=1.00

    deduct 0.10 if dimension inferred
    deduct 0.10 if basis inferred
    deduct 0.15 if variance inferred from notation
    deduct 0.15 if metric assumed
    deduct 0.15 if orientation assumed
    deduct 0.20 if transformation-law validation incomplete
    deduct 0.20 if tensor-rank meaning ambiguous
    deduct 0.25 if index convention materially unclear

    clamp_to_[0,1]

    classification:
        [0.95,1.00] -> very_high
        [0.85,0.95) -> high
        [0.70,0.85) -> moderate
        [0.50,0.70) -> low
        [0.00,0.50) -> insufficient
}

----------------------------------------------------------------------
63. AI CONSUMPTION MODEL
----------------------------------------------------------------------

AI_CONSUMPTION {

    read_order := [
        tensor_definition,
        tensor_type,
        vector_and_dual_spaces,
        basis_and_components,
        index_notation,
        tensor_product,
        contraction,
        symmetry,
        metric,
        coordinate_transformations,
        decompositions,
        validation
    ]

    execution_policy := {
        preserve_tensor_type,
        preserve_free_indices,
        validate_dummy_indices,
        preserve_dimensions,
        distinguish_tensor_from_component_array,
        distinguish_order_from_decomposition_rank,
        require_metric_for_raising_lowering,
        require_orientation_for_Levi_Civita_cross_product_context,
        validate_coordinate_transformation_law
    }
}

----------------------------------------------------------------------
64. UPDATE MODEL
----------------------------------------------------------------------

UPDATE_MODEL {

    extensible:=true

    new_tensor_operation_requires:
        input_types,
        output_type,
        index_rule,
        dimension_rule

    new_tensor_class_requires:
        symmetry_or_structural_predicate

    new_coordinate_rule_requires:
        transformation_law

    new_decomposition_requires:
        reconstruction_rule,
        exact_or_approximate_status

    conflicts_require:
        explicit_versioning

    standard_tensor_analysis_meaning_has_priority:=true
}

----------------------------------------------------------------------
65. SELF-CHECK
----------------------------------------------------------------------

SELF_CHECK {

    CHECK tensor type declared or inferred
    CHECK every index lies in valid range
    CHECK dummy indices legally paired
    CHECK free indices match across equations
    CHECK contraction reduces type correctly
    CHECK tensor products add types correctly
    CHECK coordinate transformations respect variance
    CHECK metric inverse valid before raising indices
    CHECK symmetry declarations preserved
    CHECK tensor-array distinction maintained
    CHECK final result validated
}

----------------------------------------------------------------------
66. COMPLETION CONDITIONS
----------------------------------------------------------------------

COMPLETE iff {

    tensor_definition_defined
    AND tensor_types_defined
    AND basis_representation_defined
    AND Einstein_notation_defined
    AND tensor_product_defined
    AND contraction_defined
    AND symmetry_defined
    AND antisymmetry_defined
    AND metric_defined
    AND raising_lowering_defined
    AND coordinate_transformations_defined
    AND invariants_defined
    AND decompositions_defined
    AND semantic_equivalence_defined
    AND validation_defined
    AND recursive_reasoning_defined
    AND confidence_defined
    AND ai_consumption_defined
    AND update_model_defined
}

IF NOT COMPLETE:
    semantic_status:=incomplete_flow

----------------------------------------------------------------------
67. FLOW TERMINATION
----------------------------------------------------------------------

TERMINATE WHEN:

    requested tensor goal achieved
    AND tensor/index structure validated

OR

    invalid index configuration prevents operation

OR

    missing metric/orientation prevents requested construction

OR

    dimension incompatibility makes expression undefined

OR

    no valid tensor transformation remains

FINAL_STATE := {
    tensor_result,
    derivation,
    tensor_type,
    free_indices,
    dummy_indices,
    dimensional_context,
    semantic_status,
    confidence
}

} // END FLOW TensorOntology

======================================================================
END FLOW
======================================================================

FLOW STATUS:
Complete

CANONICAL PAGE:
https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/algebra-ontologies/tensor-ontology.html

FLOW_HASH_SHA256: 8fddf47410b304ffa5d9e124b88d9850e8934205a9ca543e2d75f7a83d277968
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ