-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon_objects_kernel-v0.10.sql
More file actions
1079 lines (951 loc) · 65.3 KB
/
Copy pathcommon_objects_kernel-v0.10.sql
File metadata and controls
1079 lines (951 loc) · 65.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- =============================================================
-- Common Knowledge KB — Basis Objects & Statements (v0.10)
-- =============================================================
-- Seeds all non-backbone entity objects, domain context objects,
-- type hierarchy statements, disjointness axioms, FOL rules, and
-- typicality prototypes.
--
-- Run order (mandatory):
-- 1. common_knowledge_schema.sql
-- 2. common_predicates_kernel.sql
-- 3. THIS FILE
--
-- All kernel statements use:
-- belief_alpha = 1000.0, belief_beta = 0.001 (near-certain, ~0.9999)
-- t_kind = 'eternal' (unless stated otherwise)
-- derivation_type = 'axiomatic'
--
-- v0.8 changes affecting this file:
--
-- SENTINEL ENFORCEMENT (Fix 8)
-- Sentinel objects (true, false, unknown, no_scope, no_period)
-- have is_sentinel=true and cannot appear as arguments of is_a,
-- subtype_of, same_as, different_from, or equivalent_to — the
-- BEFORE trigger trg_d_enforce_sentinel_usage rejects such inserts.
-- Consequences for this file:
-- • is_a(true/false/unknown, truth_value) removed from Section 12.
-- Sentinels are inference-opaque; they bypass type_membership
-- and domain checks by design. truth_value is seeded as a type
-- in the hierarchy; the boolean sentinels simply do not acquire
-- formal type memberships.
-- • different_from(true/false/unknown, ...) removed from Section 15.
-- opposite_of(true, false) is retained — opposite_of is not a
-- sentinel-blocked predicate.
--
-- DISJOINTNESS_KIND COLUMN (Fix 9)
-- disjoint_with statements now carry a disjointness_kind column:
-- 'constraint' — hard axiom; trg_za raises an exception if a
-- new is_a statement violates it. Use when the
-- disjointness is logically certain.
-- 'incompatibility' — graded; scales the competition-model
-- denominator in statement_effective_belief.
-- Use when acknowledged edge cases exist.
-- trg_b defaults disjointness_kind to 'constraint' when omitted,
-- but all rows here set it explicitly.
-- Mapping used in Section 14:
-- belief ka/kb (≈1.0) → 'constraint'
-- belief 900/100 (0.9) → 'incompatibility' (edge cases noted)
-- belief 700/300 (0.7) → 'incompatibility' (conventional)
--
-- PROCESS HIERARCHY (fix from prior release)
-- The schema backbone stub process ⊂ entity has been removed from
-- the schema seed. This file establishes the correct chain:
-- process ⊂ event_type ⊂ abstract ⊂ entity
-- via Section 13 subtype_of statements. No migration step needed.
--
-- STATEMENT_KIND ENFORCEMENT (Fix 4)
-- All structural statements use statement_kind='ontological',
-- all typicality statements use 'statistical', all rule statements
-- use 'rule'. These are now enforced at INSERT time by
-- trg_b_enforce_kind_consistency, not just by convention.
--
-- =============================================================
BEGIN;
DO $$
DECLARE
-- ── Fixed IDs from schema seed ────────────────────────────
reality uuid := stable_uuid('reality', 'context');
sys uuid := stable_uuid('system_kernel', 'source');
-- ── Predicate IDs ─────────────────────────────────────────
p_is_a uuid := stable_uuid('is_a', 'predicate');
p_subtype_of uuid := stable_uuid('subtype_of', 'predicate');
p_has_property uuid := stable_uuid('has_property', 'predicate');
p_same_as uuid := stable_uuid('same_as', 'predicate');
p_different_from uuid := stable_uuid('different_from', 'predicate');
p_opposite_of uuid := stable_uuid('opposite_of', 'predicate');
p_implies uuid := stable_uuid('implies', 'predicate');
p_typical_of uuid := stable_uuid('typical_of', 'predicate');
p_disjoint_with uuid := stable_uuid('disjoint_with', 'predicate');
p_has_value uuid := stable_uuid('has_value', 'predicate');
p_equivalent_to uuid := stable_uuid('equivalent_to', 'predicate');
p_part_of uuid := stable_uuid('part_of', 'predicate');
p_member_of uuid := stable_uuid('member_of', 'predicate');
-- ── Kernel belief parameters ──────────────────────────────
ka double precision := 1000.0;
kb double precision := 0.001;
-- ── Object IDs — all stable_uuid(name, 'entity') ─────────
-- Backbone objects (seeded by schema; DO NOTHING on conflict)
o_entity uuid := stable_uuid('entity', 'entity');
o_abstract uuid := stable_uuid('abstract', 'entity');
o_concrete uuid := stable_uuid('concrete', 'entity');
o_living uuid := stable_uuid('living', 'entity');
o_animate uuid := stable_uuid('animate', 'entity');
o_sapient uuid := stable_uuid('sapient', 'entity');
o_artifact uuid := stable_uuid('artifact', 'entity');
o_process uuid := stable_uuid('process', 'entity');
o_group uuid := stable_uuid('group', 'entity');
o_person uuid := stable_uuid('person', 'entity');
o_number uuid := stable_uuid('number', 'entity');
o_relation uuid := stable_uuid('relation', 'entity');
o_agent uuid := stable_uuid('agent', 'entity');
o_institution uuid := stable_uuid('institution', 'entity');
o_government uuid := stable_uuid('government', 'entity');
-- Sentinels (seeded by schema with is_sentinel=true; referenced here)
o_no_scope uuid := stable_uuid('no_scope', 'entity');
o_no_period uuid := stable_uuid('no_period', 'entity');
-- Animate / social (extensions beyond backbone)
o_biological_taxon uuid := stable_uuid('biological_taxon','entity');
o_organism uuid := stable_uuid('organism', 'entity');
o_animal uuid := stable_uuid('animal', 'entity');
o_mammal uuid := stable_uuid('mammal', 'entity');
-- Abstract concept vocabulary
o_concept_type uuid := stable_uuid('concept_type', 'entity');
o_property_c uuid := stable_uuid('property', 'entity');
o_attribute uuid := stable_uuid('attribute', 'entity');
o_relation_type uuid := stable_uuid('relation_type', 'entity');
o_proposition uuid := stable_uuid('proposition', 'entity');
o_information uuid := stable_uuid('information', 'entity');
o_knowledge_st uuid := stable_uuid('knowledge_state', 'entity');
o_norm uuid := stable_uuid('norm', 'entity');
o_rule uuid := stable_uuid('rule', 'entity');
o_goal uuid := stable_uuid('goal', 'entity');
o_role_c uuid := stable_uuid('role', 'entity');
o_symbol uuid := stable_uuid('symbol', 'entity');
o_language uuid := stable_uuid('language', 'entity');
o_word uuid := stable_uuid('word', 'entity');
o_sentence uuid := stable_uuid('sentence', 'entity');
-- Events / processes / states
o_event uuid := stable_uuid('event_type', 'entity');
o_change_event uuid := stable_uuid('change_event', 'entity');
o_state_c uuid := stable_uuid('state', 'entity');
o_action uuid := stable_uuid('action', 'entity');
-- Physical subtypes
o_phys_obj uuid := stable_uuid('physical_object', 'entity');
o_place uuid := stable_uuid('place', 'entity');
o_region uuid := stable_uuid('region', 'entity');
o_location uuid := stable_uuid('location', 'entity');
o_boundary uuid := stable_uuid('boundary', 'entity');
-- Quantities and numbers
o_quantity uuid := stable_uuid('quantity', 'entity');
o_real uuid := stable_uuid('real_number', 'entity');
o_integer uuid := stable_uuid('integer', 'entity');
o_natural uuid := stable_uuid('natural_number', 'entity');
o_unit uuid := stable_uuid('unit_of_measure', 'entity');
o_measurement uuid := stable_uuid('measurement', 'entity');
o_duration uuid := stable_uuid('duration', 'entity');
-- Time
o_time uuid := stable_uuid('time', 'entity');
o_interval_t uuid := stable_uuid('time_interval', 'entity');
o_point_t uuid := stable_uuid('time_point', 'entity');
-- Truth values (seeded by schema as 'entity' kind with is_sentinel=true
-- for true/false/unknown; truth_value itself is a normal entity type)
o_truth_value uuid := stable_uuid('truth_value', 'entity');
o_true_val uuid := stable_uuid('true', 'entity');
o_false_val uuid := stable_uuid('false', 'entity');
o_unknown_val uuid := stable_uuid('unknown', 'entity');
-- Role subtypes: functional occupation / role types.
-- Subtypes of role (abstract entity). Seeded so type reasoning works:
-- has_role(ada_lovelace, mathematician, no_scope) can be type-checked.
o_mathematician uuid := stable_uuid('mathematician', 'entity');
o_programmer uuid := stable_uuid('programmer', 'entity');
o_inventor uuid := stable_uuid('inventor', 'entity');
o_scientist uuid := stable_uuid('scientist', 'entity');
o_engineer uuid := stable_uuid('engineer', 'entity');
o_teacher uuid := stable_uuid('teacher', 'entity');
o_politician uuid := stable_uuid('politician', 'entity');
o_artist uuid := stable_uuid('artist', 'entity');
-- Domain contexts
o_dom_history uuid := stable_uuid('domain_history', 'context');
o_dom_science uuid := stable_uuid('domain_science', 'context');
o_dom_math uuid := stable_uuid('domain_mathematics','context');
o_dom_geography uuid := stable_uuid('domain_geography', 'context');
o_dom_biology uuid := stable_uuid('domain_biology', 'context');
o_dom_physics uuid := stable_uuid('domain_physics', 'context');
o_dom_law uuid := stable_uuid('domain_law', 'context');
o_dom_language uuid := stable_uuid('domain_linguistics','context');
o_dom_social uuid := stable_uuid('domain_social', 'context');
o_dom_tech uuid := stable_uuid('domain_technology', 'context');
BEGIN
-- ═════════════════════════════════════════════════════════════
-- SECTION 1: Sanity checks
-- Verifies that prerequisite files have been applied.
-- ═════════════════════════════════════════════════════════════
IF NOT EXISTS (SELECT 1 FROM objects WHERE id = p_is_a AND kind = 'predicate') THEN
RAISE EXCEPTION
'Basis predicates not found (expected is_a at %). '
'Run common_predicates_kernel.sql before this file.',
p_is_a;
END IF;
IF NOT EXISTS (SELECT 1 FROM objects WHERE id = o_entity AND kind = 'entity') THEN
RAISE EXCEPTION
'Backbone entity objects not found. '
'Run common_knowledge_schema.sql before this file.';
END IF;
IF NOT EXISTS (SELECT 1 FROM objects WHERE id = o_no_scope AND kind = 'entity') THEN
RAISE EXCEPTION
'no_scope sentinel not found (expected at %). '
'Run common_knowledge_schema.sql before this file.',
o_no_scope;
END IF;
IF NOT EXISTS (SELECT 1 FROM objects WHERE id = o_no_period AND kind = 'entity') THEN
RAISE EXCEPTION
'no_period sentinel not found (expected at %). '
'Run common_knowledge_schema.sql before this file.',
o_no_period;
END IF;
-- Verify is_sentinel flag is set correctly by the schema.
IF NOT EXISTS (SELECT 1 FROM objects WHERE id = o_no_scope AND is_sentinel) THEN
RAISE EXCEPTION
'no_scope exists but is_sentinel is false. '
'Ensure common_knowledge_schema.sql (v0.8+) was applied.';
END IF;
-- ═════════════════════════════════════════════════════════════
-- SECTION 2: Backbone objects — enrich descriptions
-- Schema seeds these with minimal descriptions; we enrich here.
-- ═════════════════════════════════════════════════════════════
UPDATE objects SET
display_name = 'Entity',
description = 'Anything that exists or can be referred to. '
'Absolute top of the object hierarchy.'
WHERE id = o_entity;
UPDATE objects SET
display_name = 'Abstract',
description = 'An entity with no direct physical instantiation: '
'concepts, numbers, propositions, rules, relations. '
'Disjoint with concrete (see Section 14).'
WHERE id = o_abstract;
UPDATE objects SET
display_name = 'Concrete',
description = 'An entity that occupies or is located in physical space and time. '
'Disjoint with abstract (see Section 14).'
WHERE id = o_concrete;
-- Enrich Boolean / epistemic sentinel descriptions.
-- true/false/unknown are is_sentinel=true objects (set by schema).
-- They are inference-opaque: they cannot appear in is_a, subtype_of,
-- same_as, different_from, or equivalent_to statements (trg_d enforces this).
-- They do not acquire type_membership entries.
UPDATE objects SET
description = 'Sentinel: the Boolean value true. is_sentinel=true — '
'cannot appear in structural predicates (is_a, subtype_of, etc.).'
WHERE id = o_true_val;
UPDATE objects SET
description = 'Sentinel: the Boolean value false. is_sentinel=true — '
'cannot appear in structural predicates (is_a, subtype_of, etc.).'
WHERE id = o_false_val;
-- unknown is an epistemic state sentinel, not a scope or period placeholder.
UPDATE objects SET
description = 'Sentinel: the identity or value is not known to the asserting agent. '
'NOT a scope placeholder — use no_scope for has_role(X, role, no_scope). '
'NOT a time-period placeholder — use no_period for located_in and '
'similar ternary predicates when no named period is the semantic argument. '
'is_sentinel=true — cannot appear in structural predicates.'
WHERE id = o_unknown_val;
-- Enrich government description.
UPDATE objects SET
display_name = 'Government',
description = 'Functional role: governing body of a polity. '
'Subtype of institution (hence of agent and group). '
'Use has_role(X, government, polity) rather than typing X as government.'
WHERE id = o_government;
-- ═════════════════════════════════════════════════════════════
-- SECTION 3: Animate / social objects (extensions beyond backbone)
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_biological_taxon, 'entity', 'biological_taxon', 'Biological taxon',
'A named group in a biological classification system '
'(species, genus, family, …). Abstract type, not a physical organism.'),
(o_organism, 'entity', 'organism', 'Organism',
'A living entity: plant, animal, fungus, microbe.'),
(o_animal, 'entity', 'animal', 'Animal',
'A multicellular organism of the kingdom Animalia.'),
(o_mammal, 'entity', 'mammal', 'Mammal',
'A warm-blooded vertebrate of class Mammalia; nurses young with milk.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 4: Abstract concept vocabulary
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_concept_type, 'entity', 'concept_type', 'Concept',
'An abstract idea, category, or mental representation.'),
(o_property_c, 'entity', 'property', 'Property',
'An attribute or characteristic that an entity can have; a unary predicate.'),
(o_attribute, 'entity', 'attribute', 'Attribute',
'A named feature of an entity that takes a value. '
'Distinct from property: attributes have values; properties are Boolean.'),
(o_relation_type,'entity', 'relation_type','Relation type',
'A type of relation in the predicate vocabulary '
'(e.g. subtype_of, causes). Subtype of relation.'),
(o_proposition, 'entity', 'proposition', 'Proposition',
'A statement that is either true or false in some context.'),
(o_information, 'entity', 'information', 'Information',
'Structured content that can be communicated or encoded. '
'Distinct from knowledge: information does not require a knowing agent.'),
(o_knowledge_st, 'entity', 'knowledge_state', 'Knowledge state',
'The set of propositions an agent takes to be true at a time. '
'Argument type for knows() and believes().'),
(o_norm, 'entity', 'norm', 'Norm',
'A standard, obligation, or expectation governing behaviour in a context.'),
(o_rule, 'entity', 'rule', 'Rule',
'A formal or informal prescription specifying what should happen '
'under a condition. Subtype of norm.'),
(o_goal, 'entity', 'goal', 'Goal',
'A desired state or outcome that an agent is motivated to bring about.'),
(o_role_c, 'entity', 'role', 'Role',
'A position, function, or capacity that an entity occupies within a scope. '
'Second argument of has_role(entity, role, scope). '
'Specific role subtypes (mathematician, programmer, etc.) are seeded '
'in Section 6 of this file as subtypes via subtype_of.'),
(o_symbol, 'entity', 'symbol', 'Symbol',
'A sign that represents something else by convention. '
'Symbols are abstract; the physical inscription is a concrete object.'),
(o_language, 'entity', 'language', 'Language',
'A system of communication using symbols according to a grammar.'),
(o_word, 'entity', 'word', 'Word',
'A minimal free-standing linguistic unit in a language.'),
(o_sentence, 'entity', 'sentence', 'Sentence',
'A grammatical unit expressing a complete thought or proposition.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 5: Event / process / state objects
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_event, 'entity', 'event_type', 'Event',
'A change or occurrence at a time, involving participants. '
'Abstract type; not a physical object. '
'Correct chain: process ⊂ event_type ⊂ abstract ⊂ entity.'),
(o_change_event,'entity', 'change_event', 'Change event',
'An event in which some property or state transitions from one value to another. '
'Core to Event Calculus: initiates() and terminates() apply to change_events.'),
(o_state_c, 'entity', 'state', 'State',
'A condition that persists over a time interval without requiring ongoing action.'),
(o_action, 'entity', 'action', 'Action',
'An event intentionally performed by an agent.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 6: Role subtype objects
-- These entity objects acquire their type hierarchy position via
-- subtype_of(X, role) in Section 13. is_a statements for these objects
-- are NOT inserted in Section 12 — subtype_of + the recursive CTE in
-- trg_z_soft_domain_check is sufficient for domain enforcement, and
-- inserting is_a would create type/instance punning.
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_mathematician,'entity', 'mathematician', 'Mathematician',
'Role: one who practises or studies mathematics. Subtype of role.'),
(o_programmer, 'entity', 'programmer', 'Programmer',
'Role: one who writes software. Subtype of role.'),
(o_inventor, 'entity', 'inventor', 'Inventor',
'Role: one who creates novel devices, processes, or compositions. '
'Subtype of role.'),
(o_scientist, 'entity', 'scientist', 'Scientist',
'Role: one who conducts systematic empirical inquiry. Subtype of role.'),
(o_engineer, 'entity', 'engineer', 'Engineer',
'Role: one who applies scientific knowledge to design and build systems. '
'Subtype of role.'),
(o_teacher, 'entity', 'teacher', 'Teacher',
'Role: one who instructs or facilitates learning. Subtype of role.'),
(o_politician, 'entity', 'politician', 'Politician',
'Role: one who participates in organised political activity. Subtype of role.'),
(o_artist, 'entity', 'artist', 'Artist',
'Role: one who creates aesthetic works. Subtype of role.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 7: Physical / spatial objects
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_phys_obj, 'entity', 'physical_object', 'Physical object',
'A bounded physical entity: tool, artifact, natural body.'),
(o_place, 'entity', 'place', 'Place',
'A location or region in physical space.'),
(o_region, 'entity', 'region', 'Region',
'An extended area of space, possibly with administrative or natural boundaries.'),
(o_location, 'entity', 'location', 'Location',
'A specific point or area used to describe where something is.'),
(o_boundary, 'entity', 'boundary', 'Boundary',
'The interface or limit between two regions or entities. '
'Part of a region without being a region itself. '
'Classified as abstract: a boundary has no volume; it is a limit.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 8: Quantities and measurement
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_quantity, 'entity', 'quantity', 'Quantity',
'A measurable or countable amount.'),
(o_real, 'entity', 'real_number', 'Real number',
'A number on the continuous number line, including irrationals.'),
(o_integer, 'entity', 'integer', 'Integer',
'A whole number: …−2, −1, 0, 1, 2… Subtype of real_number.'),
(o_natural, 'entity', 'natural_number', 'Natural number',
'A non-negative integer: 0, 1, 2, 3… Convention here includes 0.'),
(o_unit, 'entity', 'unit_of_measure','Unit of measure',
'A standard quantity used to express a measurement '
'(metre, kilogram, second, …).'),
(o_measurement,'entity', 'measurement', 'Measurement',
'A quantity expressed in a specific unit; a pairing of number and unit.'),
(o_duration, 'entity', 'duration', 'Duration',
'The length of a time interval, expressed as a quantity. '
'A duration is NOT a time interval — it is a measure of one. '
'Classified as quantity (abstract); disjoint with time (see Section 14).')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 9: Time objects
-- These are named TIME PERIOD / TIME ENTITY objects used as semantic
-- arguments of predicates (e.g. the third arg of located_in when a
-- named period is the intended argument, or the time args of EC
-- predicates happens_at / holds_at_ec).
-- They are NOT a mechanism for encoding temporal scope on statements.
-- Temporal scope (when a fact holds) MUST use the statement's t_start /
-- t_end fuzzy_time fields (schema canonical policy #3).
-- For located_in when no named period is the argument, use the
-- no_period sentinel (seeded by schema). duration measures time
-- and is a quantity, not a subtype of time.
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_time, 'entity', 'time', 'Time',
'The dimension along which events are ordered; '
'the abstract type for temporal entities. '
'NOT a mechanism for encoding when a statement holds — use '
'fuzzy_time fields on statements for that (schema policy #3).'),
(o_interval_t, 'entity', 'time_interval', 'Time interval',
'A bounded span of time with a start and an end. '
'As a named object, used for named periods (e.g. "the Jurassic"). '
'As temporal scope on a statement, use t_start/t_end fuzzy_time fields.'),
(o_point_t, 'entity', 'time_point', 'Time point',
'An instantaneous moment in time. '
'Used as the time arg in Event Calculus predicates (happens_at, holds_at_ec). '
'For birth/death dates, encode in statement fuzzy_time fields, not here.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 10: Truth value supertype
-- true / false / unknown are already seeded by the schema as sentinels
-- (is_sentinel=true). truth_value is a normal entity type.
-- Note: is_a statements for sentinels (true/false/unknown → truth_value)
-- are NOT inserted — trg_d would reject them. Sentinels are
-- inference-opaque and do not acquire type_membership entries.
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_truth_value, 'entity', 'truth_value', 'Truth value',
'The type whose instances are the Boolean values. Abstract; '
'disjoint with person and physical_object (see Section 14). '
'Note: the sentinel objects true/false/unknown do not formally '
'acquire type_membership for truth_value — they are inference-opaque.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 11: Domain context objects
-- ═════════════════════════════════════════════════════════════
INSERT INTO objects (id, kind, canonical_name, display_name, description) VALUES
(o_dom_history, 'context', 'domain_history', 'History',
'Historical facts, events, persons, dates.'),
(o_dom_science, 'context', 'domain_science', 'Science (general)',
'Scientific facts not specific to one discipline.'),
(o_dom_math, 'context', 'domain_mathematics','Mathematics',
'Mathematical definitions, theorems, structures.'),
(o_dom_geography,'context', 'domain_geography', 'Geography',
'Geographical facts: locations, borders, populations.'),
(o_dom_biology, 'context', 'domain_biology', 'Biology',
'Biological facts: taxonomy, anatomy, physiology, ecology.'),
(o_dom_physics, 'context', 'domain_physics', 'Physics',
'Physical laws, constants, and phenomena.'),
(o_dom_law, 'context', 'domain_law', 'Law',
'Legal facts, statutes, decisions — jurisdiction-sensitive.'),
(o_dom_language, 'context', 'domain_linguistics','Linguistics',
'Facts about language, grammar, and meaning.'),
(o_dom_social, 'context', 'domain_social', 'Social science',
'Facts about society, culture, economics, politics.'),
(o_dom_tech, 'context', 'domain_technology', 'Technology',
'Facts about technology, engineering, computing.')
ON CONFLICT (canonical_name, kind) DO NOTHING;
-- Register domain contexts (orphan-guard requires a contexts row)
INSERT INTO contexts (id, kind, parent_id) VALUES
(o_dom_history, 'domain', reality),
(o_dom_science, 'domain', reality),
(o_dom_math, 'domain', reality),
(o_dom_geography, 'domain', reality),
(o_dom_biology, 'domain', reality),
(o_dom_physics, 'domain', reality),
(o_dom_law, 'domain', reality),
(o_dom_language, 'domain', reality),
(o_dom_social, 'domain', reality),
(o_dom_tech, 'domain', reality)
ON CONFLICT (id) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 12: is_a statements — seed type_membership cache
--
-- These is_a statements fire trg_sync_type_membership and populate
-- the type_membership cache. They cover genuinely cross-hierarchy
-- memberships — cases where an entity belongs to a type not reachable
-- by a single-step subtype_of from its primary type chain.
--
-- Role subtype is_a rows are NOT inserted here. The subtype_of rows
-- in Section 13 combined with the recursive CTE in trg_z_soft_domain_check
-- are sufficient for domain enforcement. Inserting is_a alongside
-- subtype_of would create type/instance punning.
--
-- Sentinel is_a rows (true/false/unknown → truth_value) are NOT inserted.
-- trg_d_enforce_sentinel_usage rejects sentinels in is_a args by design.
-- Sentinels are inference-opaque and bypass the type system.
--
-- Do NOT insert directly into type_membership.
-- trg_sync_type_membership is the sole write path.
-- ═════════════════════════════════════════════════════════════
INSERT INTO statements
(predicate_id, object_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES
-- Cross-hierarchy: person is both a biological organism and a functional agent.
-- person ⊂ sapient is in the backbone; these add the biological and agentive axes.
(p_is_a, ARRAY[o_person, o_agent], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_person, o_organism], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Institutions are agents (confirmed) and are usually groups (soft).
(p_is_a, ARRAY[o_institution, o_agent], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_institution, o_group], 70.0, 30.0, 'ontological','ontological','always', reality,'axiomatic',0),
-- Government is an institution (and by chain: agent, group).
(p_is_a, ARRAY[o_government, o_institution], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Biological hierarchy cross-membership.
(p_is_a, ARRAY[o_mammal, o_animal], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_animal, o_organism], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Number subtypes.
(p_is_a, ARRAY[o_integer, o_real], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_natural, o_integer], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Event subtypes.
(p_is_a, ARRAY[o_action, o_event], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_process, o_event], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_change_event,o_event], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Physical subtypes.
(p_is_a, ARRAY[o_artifact, o_phys_obj], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Spatial subtypes.
(p_is_a, ARRAY[o_region, o_place], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_location, o_place], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Linguistic subtypes.
(p_is_a, ARRAY[o_word, o_symbol], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_sentence, o_symbol], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
(p_is_a, ARRAY[o_language, o_symbol], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0),
-- Normative subtypes.
(p_is_a, ARRAY[o_rule, o_norm], ka, kb, 'ontological','ontological','eternal',reality,'axiomatic',0)
ON CONFLICT DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 13: Type hierarchy — subtype_of statements
--
-- The backbone already seeds:
-- concrete ⊂ entity, abstract ⊂ entity,
-- living ⊂ concrete, animate ⊂ living, sapient ⊂ animate,
-- person ⊂ sapient, artifact ⊂ concrete,
-- group ⊂ entity, number ⊂ abstract, relation ⊂ abstract.
-- We DO NOT repeat those here. We extend downward and sideways.
--
-- process ⊂ entity stub: removed from the schema seed. The correct
-- chain process ⊂ event_type ⊂ abstract ⊂ entity is established here.
--
-- All subtype_of statements use statement_kind='ontological', enforced
-- by trg_b. Cycles are rejected by trg_e_enforce_subtype_acyclicity.
-- ═════════════════════════════════════════════════════════════
INSERT INTO statements
(predicate_id, object_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES
-- ── Concrete subtypes (beyond backbone) ──────────────────────
(p_subtype_of, ARRAY[o_organism, o_concrete], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_phys_obj, o_concrete], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- artifact ⊂ concrete already in backbone; here we add artifact ⊂ phys_obj (more specific)
(p_subtype_of, ARRAY[o_artifact, o_phys_obj], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_place, o_concrete], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_region, o_place], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_location, o_place], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- boundary is abstract: it has no volume; it is a limit, not a region
(p_subtype_of, ARRAY[o_boundary, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- ── Animate hierarchy ─────────────────────────────────────────
(p_subtype_of, ARRAY[o_biological_taxon, o_concept_type], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_animal, o_organism], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_mammal, o_animal], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- person ⊂ mammal (more specific than backbone's person ⊂ sapient)
(p_subtype_of, ARRAY[o_person, o_mammal], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- person ⊂ agent (person is both a biological kind and a functional role type)
(p_subtype_of, ARRAY[o_person, o_agent], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- agent ⊂ entity (functional layer above the biological hierarchy)
(p_subtype_of, ARRAY[o_agent, o_entity], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_institution, o_agent], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_government, o_institution],ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- ── Abstract subtypes ─────────────────────────────────────────
(p_subtype_of, ARRAY[o_concept_type, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_property_c, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_attribute, o_property_c],ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_relation_type, o_relation], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_proposition, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_information, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_knowledge_st, o_information],ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_norm, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_rule, o_norm], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_goal, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_role_c, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_symbol, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_language, o_symbol], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_word, o_symbol], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_sentence, o_symbol], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_truth_value, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- ── Event / process / state ───────────────────────────────────
-- event_type ⊂ abstract (events are not physical objects)
(p_subtype_of, ARRAY[o_event, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_change_event, o_event], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- Correct chain: process ⊂ event_type ⊂ abstract ⊂ entity.
(p_subtype_of, ARRAY[o_process, o_event], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_action, o_event], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_state_c, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- ── Quantity / number hierarchy ───────────────────────────────
(p_subtype_of, ARRAY[o_quantity, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- backbone seeds number ⊂ abstract; here we refine: number ⊂ quantity
(p_subtype_of, ARRAY[o_number, o_quantity], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_real, o_number], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_integer, o_real], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_natural, o_integer], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_measurement, o_quantity], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- duration ⊂ quantity: a measurement of time, NOT a subtype of time
(p_subtype_of, ARRAY[o_duration, o_quantity], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_unit, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- ── Time hierarchy ────────────────────────────────────────────
(p_subtype_of, ARRAY[o_time, o_abstract], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_interval_t, o_time], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_point_t, o_time], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
-- ── Role subtypes ─────────────────────────────────────────────
-- Occupation / functional role types as subtypes of role.
-- These subtype_of statements are sufficient for domain enforcement
-- via the recursive CTE in trg_z_soft_domain_check. The corresponding
-- is_a rows are NOT in Section 12 (would cause type/instance punning).
(p_subtype_of, ARRAY[o_mathematician, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_programmer, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_inventor, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_scientist, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_engineer, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_teacher, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_politician, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0),
(p_subtype_of, ARRAY[o_artist, o_role_c], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0)
ON CONFLICT DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 14: Disjointness axioms
-- Full principled lattice covering the abstract ⊥ concrete split
-- and the cross-domain disjointness of their immediate children.
--
-- DISJOINTNESS_KIND (Fix 9):
-- 'constraint' — logically certain disjointness; trg_za raises
-- an exception if a new is_a statement violates it.
-- Used for all ka/kb (≈1.0) belief pairs.
-- 'incompatibility' — graded evidence with acknowledged edge cases;
-- scales the competition-model denominator in
-- statement_effective_belief rather than blocking
-- the is_a insert. Used for 900/100 and 700/300 pairs.
--
-- STATEMENT_KIND = 'ontological' enforced by trg_b.
-- ═════════════════════════════════════════════════════════════
-- ── Hard constraint disjointness (logically certain, ka/kb) ───
-- trg_za will reject any is_a that violates these at insertion time.
INSERT INTO statements
(predicate_id, object_args, belief_alpha, belief_beta,
interpretation, statement_kind, disjointness_kind,
t_kind, context_id, derivation_type, derivation_depth)
VALUES
-- LEVEL 1: The foundational split
(p_disjoint_with, ARRAY[o_abstract, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- LEVEL 2a: Abstract children ⊥ concrete (seeded explicitly so
-- the domain trigger fires without requiring a reasoner).
(p_disjoint_with, ARRAY[o_event, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_proposition, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_number, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_time, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_norm, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_role_c, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_truth_value, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- symbol ⊥ concrete: symbols are abstract; physical inscriptions are separate objects
(p_disjoint_with, ARRAY[o_symbol, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_goal, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_quantity, o_concrete], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- LEVEL 2b: Concrete children ⊥ abstract
(p_disjoint_with, ARRAY[o_organism, o_abstract], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_phys_obj, o_abstract], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_place, o_abstract], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- LEVEL 2c: Cross-domain within-abstract disjointness
-- Time is not a number, proposition, or symbol (commonly confused).
(p_disjoint_with, ARRAY[o_time, o_number], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_time, o_proposition], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_time, o_symbol], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- Numbers are not events or propositions.
(p_disjoint_with, ARRAY[o_number, o_event], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
(p_disjoint_with, ARRAY[o_number, o_proposition], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- Events are not propositions (events happen; propositions are stated about them).
(p_disjoint_with, ARRAY[o_event, o_proposition], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- duration ⊥ time: duration measures time; it is not a temporal entity
(p_disjoint_with, ARRAY[o_duration, o_time], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- LEVEL 2d: Within-concrete disjointness (certain pairs)
-- Places are not organisms (places are stable loci; organisms move).
(p_disjoint_with, ARRAY[o_place, o_organism], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- Specific cross-kind pairs (certain)
-- physical_object ⊥ time: a rock is not an interval
(p_disjoint_with, ARRAY[o_time, o_phys_obj], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- number ⊥ organism: no number is alive
(p_disjoint_with, ARRAY[o_number, o_organism], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- truth_value ⊥ person: true and false are not persons
(p_disjoint_with, ARRAY[o_truth_value, o_person], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- place ⊥ number: Paris is not a number
(p_disjoint_with, ARRAY[o_place, o_number], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0),
-- proposition ⊥ physical_object: propositions are not physical
(p_disjoint_with, ARRAY[o_proposition, o_phys_obj], ka,kb,'ontological','ontological','constraint','eternal',reality,'axiomatic',0)
ON CONFLICT DO NOTHING;
-- ── Graded incompatibility disjointness (edge cases acknowledged) ─
-- These scale the competition-model denominator without hard-blocking
-- is_a inserts, allowing the belief system to reason about edge cases.
INSERT INTO statements
(predicate_id, object_args, belief_alpha, belief_beta,
interpretation, statement_kind, disjointness_kind,
t_kind, context_id, derivation_type, derivation_depth)
VALUES
-- person ⊥ institution: soft — sole-trader edge case in some legal systems
(p_disjoint_with, ARRAY[o_person, o_institution], 900.0, 100.0, 'ontological','ontological','incompatibility','eternal',reality,'axiomatic',0),
-- organism ⊥ artifact: soft — GMO / synthetic biology edge cases
(p_disjoint_with, ARRAY[o_organism, o_artifact], 900.0, 100.0, 'ontological','ontological','incompatibility','eternal',reality,'axiomatic',0),
-- truth_value ⊥ number: soft — in Boolean arithmetic, true=1 and false=0
(p_disjoint_with, ARRAY[o_truth_value, o_number], 700.0, 300.0, 'ontological','ontological','incompatibility','eternal',reality,'axiomatic',0)
ON CONFLICT DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 15: Logical / modal eternal statements
-- opposite_of and different_from use statement_kind='ontological',
-- enforced by trg_b. FOL rule statements use statement_kind='rule',
-- also enforced by trg_b.
--
-- Note on sentinels: different_from(true/false/unknown, ...) statements
-- are NOT inserted here. trg_d_enforce_sentinel_usage rejects sentinels
-- as args of different_from. opposite_of(true, false) is retained —
-- opposite_of is not in the sentinel-blocked predicate list.
-- ═════════════════════════════════════════════════════════════
INSERT INTO statements
(predicate_id, object_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES
(p_opposite_of, ARRAY[o_true_val, o_false_val], ka,kb,'ontological','ontological','eternal',reality,'axiomatic',0)
ON CONFLICT DO NOTHING;
-- ── FOL rule statements ───────────────────────────────────────
-- Inference rules encoded as implies(antecedent, consequent) with
-- both args as string literals. object_args = '{}' satisfies the
-- args_nonempty check via literal_args.
-- statement_kind = 'rule' is enforced by trg_b.
-- Rule statements are excluded from holds_at() and tell_about().
-- derivation_type = 'axiomatic'; no statement_dependencies needed
-- (provenance enforcement applies only to forward_chained / abduced).
-- Modal axiom T: necessary(P) → possible(P)
INSERT INTO statements
(predicate_id, object_args, literal_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES (p_implies, '{}'::uuid[],
'[{"pos":0,"type":"string","value":"necessary(P)"},
{"pos":1,"type":"string","value":"possible(P)"}]'::jsonb,
ka,kb,'ontological','rule','eternal',reality,'axiomatic',0)
-- [Fix 16] content_hash arbiter: idempotent re-application.
ON CONFLICT (content_hash) DO NOTHING;
-- Type rule: is_a(X, integer) → is_a(X, real_number)
INSERT INTO statements
(predicate_id, object_args, literal_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES (p_implies, '{}'::uuid[],
'[{"pos":0,"type":"string","value":"is_a(X, integer)"},
{"pos":1,"type":"string","value":"is_a(X, real_number)"}]'::jsonb,
ka,kb,'ontological','rule','eternal',reality,'axiomatic',0)
-- [Fix 16] content_hash arbiter: idempotent re-application.
ON CONFLICT (content_hash) DO NOTHING;
-- Type rule: is_a(X, mammal) → is_a(X, animal)
INSERT INTO statements
(predicate_id, object_args, literal_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES (p_implies, '{}'::uuid[],
'[{"pos":0,"type":"string","value":"is_a(X, mammal)"},
{"pos":1,"type":"string","value":"is_a(X, animal)"}]'::jsonb,
ka,kb,'ontological','rule','eternal',reality,'axiomatic',0)
-- [Fix 16] content_hash arbiter: idempotent re-application.
ON CONFLICT (content_hash) DO NOTHING;
-- Type rule: is_a(X, animal) → is_a(X, organism)
INSERT INTO statements
(predicate_id, object_args, literal_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES (p_implies, '{}'::uuid[],
'[{"pos":0,"type":"string","value":"is_a(X, animal)"},
{"pos":1,"type":"string","value":"is_a(X, organism)"}]'::jsonb,
ka,kb,'ontological','rule','eternal',reality,'axiomatic',0)
-- [Fix 16] content_hash arbiter: idempotent re-application.
ON CONFLICT (content_hash) DO NOTHING;
-- Mortal rule: is_a(X, person) → mortal(X)
-- NOT eternal: strong empirical generalisation, revisable.
-- alpha=95, beta=5 (mean 0.95). Philosophical edge cases prevent
-- treating this as a logical truth.
INSERT INTO statements
(predicate_id, object_args, literal_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES (p_implies, '{}'::uuid[],
'[{"pos":0,"type":"string","value":"is_a(X, person)"},
{"pos":1,"type":"string","value":"mortal(X)"}]'::jsonb,
95.0,5.0,'ontological','rule','always',reality,'axiomatic',0)
-- [Fix 16] content_hash arbiter: idempotent re-application.
ON CONFLICT (content_hash) DO NOTHING;
-- Agent rule: is_a(X, person) → capable_of(X, intentional_action)
INSERT INTO statements
(predicate_id, object_args, literal_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES (p_implies, '{}'::uuid[],
'[{"pos":0,"type":"string","value":"is_a(X, person)"},
{"pos":1,"type":"string","value":"capable_of(X, intentional_action)"}]'::jsonb,
90.0,10.0,'ontological','rule','always',reality,'axiomatic',0)
-- [Fix 16] content_hash arbiter: idempotent re-application.
ON CONFLICT (content_hash) DO NOTHING;
-- Disjoint rule: disjoint_with(A,B) ∧ is_a(X,A) → ¬is_a(X,B)
-- This FOL rule documents the logical consequence of constraint disjointness.
-- The database-level enforcement (trg_za) handles the constraint case at
-- INSERT time; this rule makes the inference explicit for the reasoning layer.
-- type_violation = structural constraint failure (not direct_negation).
INSERT INTO statements
(predicate_id, object_args, literal_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES (p_implies, '{}'::uuid[],
'[{"pos":0,"type":"string","value":"disjoint_with(A,B) ∧ is_a(X,A)"},
{"pos":1,"type":"string","value":"¬is_a(X,B) [type_violation conflict, not direct_negation]"}]'::jsonb,
ka,kb,'ontological','rule','eternal',reality,'axiomatic',0)
-- [Fix 16] content_hash arbiter: idempotent re-application.
ON CONFLICT (content_hash) DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 16: Typicality statements (prototype knowledge)
-- belief < 1.0 by design; typicality is inherently graded.
-- t_kind = 'always' (not eternal: prototypes are revisable).
-- All typical_of statements use statement_kind='statistical', enforced
-- by trg_b. Statistical statements are excluded from logical inference
-- chains (holds_at open_world mode, compute_derived_belief raises a
-- hard exception if statistical parents are supplied). They are
-- queryable directly by statement_kind='statistical'.
-- ═════════════════════════════════════════════════════════════
INSERT INTO statements
(predicate_id, object_args, belief_alpha, belief_beta,
interpretation, statement_kind, t_kind, context_id, derivation_type, derivation_depth)
VALUES
(p_typical_of, ARRAY[o_person, o_agent], 90.0,10.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_institution, o_agent], 60.0,40.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_action, o_event], 85.0,15.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_process, o_event], 65.0,35.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_change_event, o_event], 75.0,25.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_region, o_place], 75.0,25.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_location, o_place], 70.0,30.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_artifact, o_phys_obj], 70.0,30.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_rule, o_norm], 80.0,20.0,'ontological','statistical','always',reality,'axiomatic',0),
(p_typical_of, ARRAY[o_word, o_symbol], 80.0,20.0,'ontological','statistical','always',reality,'axiomatic',0)
ON CONFLICT DO NOTHING;
-- ═════════════════════════════════════════════════════════════
-- SECTION 17: Bulk attestation
-- Link all axiomatic statements to system_kernel.
-- axiomatic statements do not require statement_dependencies rows —
-- provenance enforcement applies only to forward_chained and abduced
-- derivation types.
-- ═════════════════════════════════════════════════════════════
INSERT INTO attestations (statement_id, source_id)
SELECT s.id, sys
FROM statements s
WHERE s.derivation_type = 'axiomatic'
AND NOT EXISTS (
SELECT 1 FROM attestations a WHERE a.statement_id = s.id
);
-- ═════════════════════════════════════════════════════════════
-- SECTION 18: Diagnostic counts
-- ═════════════════════════════════════════════════════════════
RAISE NOTICE 'Basis objects & statements load complete (v0.8).';
RAISE NOTICE ' entity objects : %',
(SELECT count(*) FROM objects WHERE kind = 'entity');
RAISE NOTICE ' context objects : %',
(SELECT count(*) FROM objects WHERE kind = 'context');
RAISE NOTICE ' sentinel objects : %',
(SELECT count(*) FROM objects WHERE is_sentinel);
RAISE NOTICE ' axiomatic stmts : %',
(SELECT count(*) FROM statements WHERE derivation_type = 'axiomatic');
RAISE NOTICE ' ontological stmts : %',
(SELECT count(*) FROM statements WHERE statement_kind = 'ontological');
RAISE NOTICE ' statistical stmts : %',
(SELECT count(*) FROM statements WHERE statement_kind = 'statistical');
RAISE NOTICE ' rule stmts : %',
(SELECT count(*) FROM statements WHERE statement_kind = 'rule');
RAISE NOTICE ' subtype_of stmts : %',
(SELECT count(*) FROM statements s
WHERE s.predicate_id = stable_uuid('subtype_of','predicate'));
RAISE NOTICE ' is_a stmts : %',
(SELECT count(*) FROM statements s
WHERE s.predicate_id = stable_uuid('is_a','predicate'));
RAISE NOTICE ' disjoint axioms : %',