File ProofSystem

From Ltac2 Require Import Ltac2.
From MatchingLogic Require Export Syntax
                                  DerivedOperators_Syntax.

Import MatchingLogic.Syntax.Notations.
Import MatchingLogic.Substitution.Notations.
Import MatchingLogic.DerivedOperators_Syntax.Notations.


Section ml_proof_system.
  Open Scope ml_scope.

  Context {Σ : Signature}.

  (* Proof system for AML ref. snapshot: Section 3 *)

  Reserved Notation "theory ⊢H pattern" (at level 76).
  Inductive ML_proof_system (theory : Theory) :
    PatternSet :=

  (* Hypothesis *)
  | ML_hypothesis (axiom : Pattern) :
      well_formed axiom
      (axiomtheory) → theoryH axiom

  (* FOL reasoning *)
  (* Propositional tautology *)
  | ML_P1 (phi psi : Pattern) :
      well_formed phiwell_formed psi
      theoryH (phi ---> (psi ---> phi))
  | ML_P2 (phi psi xi : Pattern) :
      well_formed phiwell_formed psiwell_formed xi
      theoryH ((phi ---> (psi ---> xi)) ---> ((phi ---> psi) ---> (phi ---> xi)))
  | ML_P3 (phi : Pattern) :
      well_formed phi
      theoryH (((phi ---> ⊥) ---> ⊥) ---> phi)

  (* Modus ponens *)
  | ML_Modus_ponens (phi1 phi2 : Pattern) :
      theoryH phi1
      theoryH (phi1 ---> phi2) →
      theoryH phi2

  (* Existential quantifier *)
  | ML_Ex_quan (phi : Pattern) (y : evar) :
      well_formed (patt_exists phi) →
      theoryH (instantiate (patt_exists phi) (patt_free_evar y) ---> (patt_exists phi))

  (* Existential generalization *)
  | ML_Ex_gen (phi1 phi2 : Pattern) (x : evar) :
      well_formed phi1well_formed phi2
      theoryH (phi1 ---> phi2) →
      x ∉ (free_evars phi2) →
      theoryH (exists_quantify x phi1 ---> phi2)

  (* Frame reasoning *)
  (* Propagation bottom *)
  | ML_Prop_bott_left (phi : Pattern) :
      well_formed phi
      theoryH (⊥ ⋅ phi ---> ⊥)

  | ML_Prop_bott_right (phi : Pattern) :
      well_formed phi
      theoryH (phi ⋅ ⊥ ---> ⊥)

  (* Propagation disjunction *)
  | ML_Prop_disj_left (phi1 phi2 psi : Pattern) :
      well_formed phi1well_formed phi2well_formed psi
      theoryH (((phi1 or phi2) ⋅ psi) ---> ((phi1psi) or (phi2psi)))

  | ML_Prop_disj_right (phi1 phi2 psi : Pattern) :
      well_formed phi1well_formed phi2well_formed psi
      theoryH ((psi ⋅ (phi1 or phi2)) ---> ((psiphi1) or (psiphi2)))

  (* Propagation exist *)
  | ML_Prop_ex_left (phi psi : Pattern) :
      well_formed (ex , phi) → well_formed psi
      theoryH (((ex , phi) ⋅ psi) ---> (ex , phipsi))

  | ML_Prop_ex_right (phi psi : Pattern) :
      well_formed (ex , phi) → well_formed psi
      theoryH ((psi ⋅ (ex , phi)) ---> (ex , psiphi))

  (* Framing *)
  | ML_Framing_left (phi1 phi2 psi : Pattern) :
      well_formed psi
      theoryH (phi1 ---> phi2) →
      theoryH ((phi1psi) ---> (phi2psi))

  | ML_Framing_right (phi1 phi2 psi : Pattern) :
      well_formed psi
      theoryH (phi1 ---> phi2) →
      theoryH ((psiphi1) ---> (psiphi2))

  (* Fixpoint reasoning *)
  (* Set Variable Substitution *)
  | ML_Svar_subst (phi psi : Pattern) (X : svar) :
      well_formed phiwell_formed psi
      theoryH phitheoryH (phi^[[svar: Xpsi]])

  (* Pre-Fixpoint *)
  | ML_Pre_fixp (phi : Pattern) :
      well_formed (patt_mu phi) →
      theoryH (instantiate (patt_mu phi) (patt_mu phi) ---> (patt_mu phi))

  (* Knaster-Tarski *)
  | ML_Knaster_tarski (phi psi : Pattern) :
      well_formed (patt_mu phi) →
      theoryH ((instantiate (patt_mu phi) psi) ---> psi) →
      theoryH ((@patt_mu Σ phi) ---> psi)

  (* Technical rules *)
  (* Existence *)
  | ML_Existence : theoryH (ex , patt_bound_evar 0)

  (* Singleton *)
  | ML_Singleton_ctx (C1 C2 : Application_context) (phi : Pattern) (x : evar) :
      well_formed phi
      theoryH (! ((subst_ctx C1 (patt_free_evar x and phi)) and
                   (subst_ctx C2 (patt_free_evar x and (! phi)))))

  where "theory ⊢H pattern" := (ML_proof_system theory pattern).

  Instance ML_proof_system_eqdec: gamma phi, EqDecision (ML_proof_system gamma phi).

  Lemma proved_impl_wf Γ ϕ:
    ΓH ϕwell_formed ϕ.

  Lemma cast_proof {Γ} {ϕ} {ψ} (e : ψ = ϕ) : ML_proof_system Γ ϕML_proof_system Γ ψ.

  Theorem Private_extend_theory (Γ Γ' : Theory) φ :
    ΓΓ'
    ΓH φ →
    Γ'H φ.

End ml_proof_system.

Module Notations_private.

  Notation "theory ⊢H pattern" := (ML_proof_system theory pattern) (at level 95, no associativity).

End Notations_private.

This page has been generated by coqdoc