Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

11.5 KB
Raw Blame
-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS
-- [oo_boundary]
import Aeneas
open Aeneas Aeneas.Std Result ControlFlow Error
set_option linter.dupNamespace false
set_option linter.hashCommand false
set_option linter.unusedVariables false
set_option linter.style.whitespace false
set_option linter.style.setOption false
set_option linter.style.longLine false

/- You can set the `maxHeartbeats` value with the `-max-heartbeats` CLI option -/
set_option maxHeartbeats 1000000

/- You can set the `maxRecDepth` value with the `-max-recdepth` CLI option -/
set_option maxRecDepth 2048

namespace OOBoundary

/-- [oo_boundary::boundary_core::Position]
    Source: 'src/../../../src/boundary_core.rs', lines 33:0-37:1
    Visibility: public -/
@[discriminant isize]
inductive boundary_core.Position where
| Subject : boundary_core.Position
| Predicate : boundary_core.Position
| Object : boundary_core.Position

/-- [oo_boundary::boundary_core::{impl core::clone::Clone for oo_boundary::boundary_core::Position}::clone]:
    Source: 'src/../../../src/boundary_core.rs', lines 32:9-32:14
    Visibility: public -/
def boundary_core.Position.Insts.CoreCloneClone.clone
  (self : boundary_core.Position) : Result boundary_core.Position := do
  ok self

/-- Trait implementation: [oo_boundary::boundary_core::{impl core::clone::Clone for oo_boundary::boundary_core::Position}]
    Source: 'src/../../../src/boundary_core.rs', lines 32:9-32:14 -/
@[reducible]
def boundary_core.Position.Insts.CoreCloneClone : core.clone.Clone
  boundary_core.Position := {
  clone := boundary_core.Position.Insts.CoreCloneClone.clone
}

/-- Trait implementation: [oo_boundary::boundary_core::{impl core::marker::Copy for oo_boundary::boundary_core::Position}]
    Source: 'src/../../../src/boundary_core.rs', lines 32:16-32:20 -/
@[reducible]
def boundary_core.Position.Insts.CoreMarkerCopy : core.marker.Copy
  boundary_core.Position := {
  cloneInst := boundary_core.Position.Insts.CoreCloneClone
}

/-- [oo_boundary::boundary_core::{impl core::fmt::Debug for oo_boundary::boundary_core::Position}::fmt]:
    Source: 'src/../../../src/boundary_core.rs', lines 32:22-32:27
    Visibility: public -/
def boundary_core.Position.Insts.CoreFmtDebug.fmt
  (self : boundary_core.Position) (f : core.fmt.Formatter) :
  Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter)
  := do
  match self with
  | boundary_core.Position.Subject =>
    core.fmt.Formatter.write_str f (toStr "Subject")
  | boundary_core.Position.Predicate =>
    core.fmt.Formatter.write_str f (toStr "Predicate")
  | boundary_core.Position.Object =>
    core.fmt.Formatter.write_str f (toStr "Object")

/-- Trait implementation: [oo_boundary::boundary_core::{impl core::fmt::Debug for oo_boundary::boundary_core::Position}]
    Source: 'src/../../../src/boundary_core.rs', lines 32:22-32:27 -/
@[reducible]
def boundary_core.Position.Insts.CoreFmtDebug : core.fmt.Debug
  boundary_core.Position := {
  fmt := boundary_core.Position.Insts.CoreFmtDebug.fmt
}

/-- Trait implementation: [oo_boundary::boundary_core::{impl core::marker::StructuralPartialEq for oo_boundary::boundary_core::Position}]
    Source: 'src/../../../src/boundary_core.rs', lines 32:29-32:38 -/
@[reducible]
def boundary_core.Position.Insts.CoreMarkerStructuralPartialEq :
  core.marker.StructuralPartialEq boundary_core.Position := {
}

/-- [oo_boundary::boundary_core::{impl core::cmp::PartialEq<oo_boundary::boundary_core::Position> for oo_boundary::boundary_core::Position}::eq]:
    Source: 'src/../../../src/boundary_core.rs', lines 32:29-32:38
    Visibility: public -/
def boundary_core.Position.Insts.CoreCmpPartialEqPosition.eq
  (self : boundary_core.Position) (other : boundary_core.Position) :
  Result Bool
  := do
  let self1 := read_discriminant self
  let other1 := read_discriminant other
  ok (self1 = other1)

/-- Trait implementation: [oo_boundary::boundary_core::{impl core::cmp::PartialEq<oo_boundary::boundary_core::Position> for oo_boundary::boundary_core::Position}]
    Source: 'src/../../../src/boundary_core.rs', lines 32:29-32:38 -/
@[reducible]
def boundary_core.Position.Insts.CoreCmpPartialEqPosition : core.cmp.PartialEq
  boundary_core.Position boundary_core.Position := {
  eq := boundary_core.Position.Insts.CoreCmpPartialEqPosition.eq
}

/-- [oo_boundary::boundary_core::{impl core::cmp::Eq for oo_boundary::boundary_core::Position}::assert_fields_are_eq]:
    Source: 'src/../../../src/boundary_core.rs', lines 32:40-32:42
    Visibility: public -/
def boundary_core.Position.Insts.CoreCmpEq.assert_fields_are_eq
  (self : boundary_core.Position) : Result Unit := do
  ok ()

/-- Trait implementation: [oo_boundary::boundary_core::{impl core::cmp::Eq for oo_boundary::boundary_core::Position}]
    Source: 'src/../../../src/boundary_core.rs', lines 32:40-32:42 -/
@[reducible]
def boundary_core.Position.Insts.CoreCmpEq : core.cmp.Eq boundary_core.Position
  := {
  partialEqInst := boundary_core.Position.Insts.CoreCmpPartialEqPosition
  assert_fields_are_eq :=
    boundary_core.Position.Insts.CoreCmpEq.assert_fields_are_eq
}

/-- [oo_boundary::boundary_core::starts_with_byte]:
    Source: 'src/../../../src/boundary_core.rs', lines 58:0-60:1
    Visibility: public -/
def boundary_core.starts_with_byte
  (s : Slice Std.U8) (b : Std.U8) : Result Bool := do
  let b1 ← core.slice.Slice.is_empty s
  if b1
  then ok false
  else let i ← Slice.index_usize s 0#usize
       ok (i = b)

/-- [oo_boundary::boundary_core::writable_triple_bytes]:
    Source: 'src/../../../src/boundary_core.rs', lines 53:0-55:1
    Visibility: public -/
def boundary_core.writable_triple_bytes
  (subject : Slice Std.U8) (predicate : Slice Std.U8) : Result Bool := do
  let b ← boundary_core.starts_with_byte subject 34#u8
  if b
  then ok false
  else boundary_core.starts_with_byte predicate 60#u8

/-- [oo_boundary::boundary_core::field_fits_the_format]: loop body 0:
    Source: 'src/../../../src/boundary_core.rs', lines 72:4-79:1
    Visibility: public -/
@[rust_loop_body]
def boundary_core.field_fits_the_format_loop.body
  (f : Slice Std.U8) (i : Std.Usize) :
  Result (ControlFlow Std.Usize Bool)
  := do
  let i1 := Slice.len f
  if i < i1
  then
    let i2 ← Slice.index_usize f i
    if i2 = 9#u8
    then ok (done false)
    else
      if i2 = 10#u8
      then ok (done false)
      else
        if i2 = 13#u8
        then ok (done false)
        else let i3 ← i + 1#usize
             ok (cont i3)
  else ok (done true)

/-- [oo_boundary::boundary_core::field_fits_the_format]: loop 0:
    Source: 'src/../../../src/boundary_core.rs', lines 72:4-79:1
    Visibility: public -/
@[rust_loop]
def boundary_core.field_fits_the_format_loop
  (f : Slice Std.U8) (i : Std.Usize) : Result Bool := do
  loop
    (fun i1 => boundary_core.field_fits_the_format_loop.body f i1)
    i

/-- [oo_boundary::boundary_core::field_fits_the_format]:
    Source: 'src/../../../src/boundary_core.rs', lines 67:0-79:1
    Visibility: public -/
def boundary_core.field_fits_the_format (f : Slice Std.U8) : Result Bool := do
  let b ← core.slice.Slice.is_empty f
  if b
  then ok false
  else boundary_core.field_fits_the_format_loop f 0#usize

/-- [oo_boundary::boundary_core::term_fits_the_format]:
    Source: 'src/../../../src/boundary_core.rs', lines 85:0-90:1
    Visibility: public -/
def boundary_core.term_fits_the_format (t : Slice Std.U8) : Result Bool := do
  let b ← boundary_core.field_fits_the_format t
  if b
  then
    let i ← Slice.index_usize t 0#usize
    if i = 60#u8
    then ok true
    else
      if i = 34#u8
      then ok true
      else
        if i = 95#u8
        then
          let i1 := Slice.len t
          if i1 > 1#usize
          then let i2 ← Slice.index_usize t 1#usize
               ok (i2 = 58#u8)
          else ok false
        else ok false
  else ok false

/-- [oo_boundary::boundary_core::name_is_safe_bytes]: loop body 0:
    Source: 'src/../../../src/boundary_core.rs', lines 104:4-111:1
    Visibility: public -/
@[rust_loop_body]
def boundary_core.name_is_safe_bytes_loop.body
  («name» : Slice Std.U8) (i : Std.Usize) :
  Result (ControlFlow Std.Usize Bool)
  := do
  let i1 := Slice.len «name»
  if i < i1
  then
    let i2 ← Slice.index_usize «name» i
    if i2 = 32#u8
    then ok (done false)
    else
      if i2 = 9#u8
      then ok (done false)
      else
        if i2 = 10#u8
        then ok (done false)
        else
          if i2 = 13#u8
          then ok (done false)
          else let i3 ← i + 1#usize
               ok (cont i3)
  else ok (done true)

/-- [oo_boundary::boundary_core::name_is_safe_bytes]: loop 0:
    Source: 'src/../../../src/boundary_core.rs', lines 104:4-111:1
    Visibility: public -/
@[rust_loop]
def boundary_core.name_is_safe_bytes_loop
  («name» : Slice Std.U8) (i : Std.Usize) : Result Bool := do
  loop
    (fun i1 => boundary_core.name_is_safe_bytes_loop.body «name» i1)
    i

/-- [oo_boundary::boundary_core::name_is_safe_bytes]:
    Source: 'src/../../../src/boundary_core.rs', lines 99:0-111:1
    Visibility: public -/
def boundary_core.name_is_safe_bytes
  («name» : Slice Std.U8) : Result Bool := do
  let b ← core.slice.Slice.is_empty «name»
  if b
  then ok false
  else boundary_core.name_is_safe_bytes_loop «name» 0#usize

/-- [oo_boundary::boundary_core::push_asserted_line_bytes]:
    Source: 'src/../../../src/boundary_core.rs', lines 124:0-146:1
    Visibility: public -/
def boundary_core.push_asserted_line_bytes
  (out : alloc.vec.Vec Std.U8) (s : Slice Std.U8) (p : Slice Std.U8)
  (o : Slice Std.U8) :
  Result ((core.result.Result Unit boundary_core.Position) × (alloc.vec.Vec
    Std.U8))
  := do
  let b ← boundary_core.term_fits_the_format s
  if b
  then
    let b1 ← boundary_core.term_fits_the_format p
    if b1
    then
      let b2 ← boundary_core.term_fits_the_format o
      if b2
      then
        let out1 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out s
        let out2 ← alloc.vec.Vec.push out1 9#u8
        let out3 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out2 p
        let out4 ← alloc.vec.Vec.push out3 9#u8
        let out5 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out4 o
        let out6 ← alloc.vec.Vec.push out5 10#u8
        ok (core.result.Result.Ok (), out6)
      else ok (core.result.Result.Err boundary_core.Position.Object, out)
    else ok (core.result.Result.Err boundary_core.Position.Predicate, out)
  else ok (core.result.Result.Err boundary_core.Position.Subject, out)

/-- [oo_boundary::boundary_core::push_triple_fields_bytes]:
    Source: 'src/../../../src/boundary_core.rs', lines 151:0-173:1
    Visibility: public -/
def boundary_core.push_triple_fields_bytes
  (out : alloc.vec.Vec Std.U8) (s : Slice Std.U8) (p : Slice Std.U8)
  (o : Slice Std.U8) :
  Result ((core.result.Result Unit boundary_core.Position) × (alloc.vec.Vec
    Std.U8))
  := do
  let b ← boundary_core.term_fits_the_format s
  if b
  then
    let b1 ← boundary_core.term_fits_the_format p
    if b1
    then
      let b2 ← boundary_core.term_fits_the_format o
      if b2
      then
        let out1 ← alloc.vec.Vec.push out 9#u8
        let out2 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out1 s
        let out3 ← alloc.vec.Vec.push out2 9#u8
        let out4 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out3 p
        let out5 ← alloc.vec.Vec.push out4 9#u8
        let out6 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out5 o
        ok (core.result.Result.Ok (), out6)
      else ok (core.result.Result.Err boundary_core.Position.Object, out)
    else ok (core.result.Result.Err boundary_core.Position.Predicate, out)
  else ok (core.result.Result.Err boundary_core.Position.Subject, out)

end OOBoundary