Theory Naproche

section ‹Isabelle Prover IDE and logic support for NaProChe / ForTheL›

theory Naproche
  imports Main ZFC_Rudiments
  keywords "forthel" "forthel_tex" :: thy_decl
    and "forthel_file" :: thy_load
    and "naproche_problem" :: thy_goal
    and "naproche_problems" :: diag
begin


section ‹Logic›

text ‹See also 🗏‹$NAPROCHE_HOME/src/SAD/ForTheL/Base.hs›


axiomatization
  ― ‹primitive notions›
  Map :: V  bool  ― ‹maps› and
  Fun :: V  bool  ― ‹functions› and
  Set :: V  bool  ― ‹sets› and
  Class :: V  bool  ― ‹classes› and
  Elem :: V  V  bool  ― ‹set membership / elements of a set› and
  Obj :: V  bool  ― ‹mathematical objects› and

  ― ‹primitive predicates›
  Less :: V  V  bool  ― ‹relation for induction› and

  ― ‹primitive operations›
  Dom :: V  V and
  Pair :: V  V  V and
  App :: V  V  V and

  Thesis :: bool and
  This :: 'a

notation (output)
  Elem (infix  50) and
  Less (infix  50) and
  Pair (_,/ _ [0, 0] 1000) and
  App (infix  90)

abbreviation Not_Elem :: V  V  bool
  where Not_Elem x A  ¬ Elem x A

abbreviation All_Elem :: "V  (V  bool)  bool"
  where All_Elem A B  (x. Elem x A  B x)

abbreviation Ex_Elem :: "V  (V  bool)  bool"
  where Ex_Elem A B  (x. Elem x A  B x)

syntax (output)
  "_All_Elem" :: pttrn  V  bool  bool  ((3(_/_)./ _) [0, 0, 10] 10)
  "_Ex_Elem" :: pttrn  V  bool  bool  ((3(_/_)./ _) [0, 0, 10] 10)
  "_Not_Ex_Elem" :: pttrn  V  bool  bool  ((3(_/_)./ _) [0, 0, 10] 10)
translations
  "_All_Elem x A B"  "CONST All_Elem A (λx. B)"
  "_Ex_Elem x A B"  "CONST Ex_Elem A (λx. B)"
  "_Not_Ex_Elem x A B"  "CONST Not (CONST Ex_Elem A (λx. B))"


section ‹Isabelle/ML›

ML_file ‹naproche.ML›


section ‹Isabelle/Haskell›

generate_file "Isabelle/Naproche.hs" = ‹
{-
Authors: Makarius (2021)

Constants for Isabelle/Naproche.
-}

{-# LANGUAGE OverloadedStrings #-}

module Isabelle.Naproche (
  naproche_prove, naproche_check, naproche_skipfail,
  naproche_pos_id, naproche_pos_file, naproche_pos_shift,
  naproche_isabelle,

  cancel_program, forthel_program,

  threads_command, serials_command, cert_terms_command, print_terms_command,
  print_sequents_command, define_problems_command,

  output_state_command, output_writeln_command, output_information_command,
  output_tracing_command, output_warning_command, output_legacy_feature_command,
  output_error_command, output_report_command,

  iT, is_iT, mk_this, dest_this,

  map_const, fun_const, set_const, class_const, elem_const, obj_const,
  less_const, dom_const, pair_const, app_const, thesis_const
)
where

import Isabelle.Term
import Isabelle.Bytes (Bytes)


-- options

naproche_prove, naproche_check, naproche_skipfail :: Bytes
naproche_prove = system_optionnaproche_prove
naproche_check = system_optionnaproche_check
naproche_skipfail = system_optionnaproche_skipfail

naproche_pos_id, naproche_pos_file, naproche_pos_shift :: Bytes
naproche_pos_id = system_optionnaproche_pos_id
naproche_pos_file = system_optionnaproche_pos_file
naproche_pos_shift = system_optionnaproche_pos_shift

naproche_isabelle :: Bytes
naproche_isabelle = system_optionnaproche_isabelle


-- programs in Haskell
-- (see 🗏‹$NAPROCHE_HOME/src/SAD/Main.hs›)

cancel_program :: Bytes
cancel_program = Naproche.cancel_program

forthel_program :: Bytes
forthel_program = Naproche.forthel_program


-- commands in ML

threads_command, serials_command, cert_terms_command, print_terms_command,
  print_sequents_command, define_problems_command :: Bytes
threads_command = naproche_commandthreads
serials_command = naproche_commandserials
cert_terms_command = naproche_commandcert_terms
print_terms_command = naproche_commandprint_terms
print_sequents_command = naproche_commandprint_sequents
define_problems_command = naproche_commanddefine_problems

output_state_command, output_writeln_command, output_information_command,
  output_tracing_command, output_warning_command, output_legacy_feature_command,
  output_error_command, output_report_command :: Bytes
output_state_command = naproche_commandoutput_state
output_writeln_command = naproche_commandoutput_writeln
output_information_command = naproche_commandoutput_information
output_tracing_command = naproche_commandoutput_tracing
output_warning_command = naproche_commandoutput_warning
output_legacy_feature_command = naproche_commandoutput_legacy_feature
output_error_command = naproche_commandoutput_error
output_report_command = naproche_commandoutput_report


-- logic

iT :: Typ; is_iT :: Typ -> Bool
(iT, is_iT) = type_op0 type_nameV

mk_this :: Typ -> Term; dest_this :: Term -> Maybe Typ
(mk_this, dest_this) = typed_op0 const_nameThis

map_const, fun_const, set_const, class_const, elem_const, obj_const,
  less_const, dom_const, pair_const, app_const, thesis_const :: Bytes
map_const = const_nameMap
fun_const = const_nameFun
set_const = const_nameSet
class_const = const_nameClass
elem_const = const_nameElem
obj_const = const_nameObj
less_const = const_nameLess
dom_const = const_nameDom
pair_const = const_namePair
app_const = const_nameApp
thesis_const = const_nameThesis

end