diff --git a/_CoqProject b/_CoqProject index a4ba2f53e8184e5bf83bdeb31472644692bf4a97..4aa82f138d7a7cfd640667214be813777dc2a0d8 100644 --- a/_CoqProject +++ b/_CoqProject @@ -1,3 +1,5 @@ -Q theories GQM -arg -w -arg -notation-overridden -theories/GQM.v \ No newline at end of file +theories/Base.v +theories/GQM.v +theories/GQMDeduction.v \ No newline at end of file diff --git a/theories/Base.v b/theories/Base.v new file mode 100644 index 0000000000000000000000000000000000000000..733e928f0bf5420e2a37a9ef53174572ef8ce1b3 --- /dev/null +++ b/theories/Base.v @@ -0,0 +1,7 @@ +From Coq Require Export ssreflect ssrfun ssrbool. +Require Export Coq.Lists.List. +Export ListNotations. + +Set Implicit Arguments. +Unset Strict Implicit. +Unset Printing Implicit Defensive. diff --git a/theories/GQM.v b/theories/GQM.v index 67b2aec1753c881e40b42fd5f35a80c7346b970c..d7e247914af0b3748b471ffb296847eb5d5308ac 100644 --- a/theories/GQM.v +++ b/theories/GQM.v @@ -1,11 +1,58 @@ Require Import Autosubst.Autosubst. +Require Import GQM.Base. + Inductive form := | Var (x : var) -| App (s t : form) -| Lam (s : {bind form}). +| Neg (f : form) +| And (f g : form) +| Box (f : form) +| SquareAll (f : {bind form}). Instance Ids_form : Ids form. derive. Defined. Instance Rename_form : Rename form. derive. Defined. Instance Subst_form : Subst form. derive. Defined. -Instance SubstLemmas_form : SubstLemmas form. derive. Qed. \ No newline at end of file +Instance SubstLemmas_form : SubstLemmas form. derive. Qed. + +Infix "&" := And (at level 75, right associativity). +Notation "'[A]' B" := (SquareAll B) (at level 74, right associativity). +Notation "|[]| A" := (Box A) (at level 74, right associativity). +Notation "'-!' A" := (Neg A) (at level 73, right associativity). +Definition Or A B := (-! (-! A & -! B)). +Notation "A '|||' B" := (Or A B) (at level 76, right associativity). +Definition Imp A B := ((-! A) ||| B). +Notation "A '->>' B" := (Imp A B) (at level 77, right associativity). +Notation "A '<<->>' B" := ((A ->> B) & (B ->> A)) (at level 78). + +Notation context := (list form). + +(** ** Decidable Equality *) + +Lemma dceq_v : forall n n0, {Var n = Var n0} + {Var n <> Var n0}. +Proof. + elim. + - case; by [ left | right]. + - move => n IH. + case; try by right. + move => n0. + case: (IH n0). + + case => ->. + by left. + + move => Hneq. + right. + move => [Heq]. + apply: Hneq. + by rewrite Heq. +Qed. + +Lemma dceq_f: forall (A B: form), {A = B} + {A <> B}. +Proof. + elim; intros; case: B; try by [right]; + try by [ move => f2; case: (X f2); try by [move => ->; left]; + move => Hneq; + right; + move => [Heq]]. + - apply: dceq_v. + - move => f2 g2. + case: (X f2);case: (X0 g2);move => H1 H2;subst; try by [left]; right; by move => []. +Qed. \ No newline at end of file diff --git a/theories/GQMDeduction.v b/theories/GQMDeduction.v new file mode 100644 index 0000000000000000000000000000000000000000..5666625c7958c72c763130a040aa0513c4b63be7 --- /dev/null +++ b/theories/GQMDeduction.v @@ -0,0 +1,34 @@ +Require Import GQM.Base. +Require Import GQM.GQM. + +Inductive GQMded: context -> form -> Prop := +| gqm_in G f: In f G -> GQMded G f +| gqm_andE1 G f1 f2: GQMded G (f1 & f2) -> GQMded G f1 +| gqm_andE2 G f1 f2: GQMded G (f1 & f2) -> GQMded G f2 +| gqm_andI G f1 f2: GQMded G f1 -> GQMded G f2 -> GQMded G (f1 & f2) +| gqm_negI G f g: GQMded G (f ->> g) -> GQMded G (f ->> -! g) -> GQMded G (-! f) (* TODO neg intro*) +| gqm_negE G f: GQMded G (Neg (Neg f)) -> GQMded G f. (* TODO neg intro*) + +Hint Constructors GQMded : GQMDB. + +Lemma gqm_orE1 : forall G f1 f2, GQMded G f1 -> GQMded G (f1 ||| f2). +Proof. + move => G f1 f2 Hf1. + unfold Or. + apply: (gqm_negI _ _ f1). + - unfold Imp. + unfold Or. + + +Lemma gqm_impE : forall G f1 f2, GQMded G f1 -> GQMded G (f1 ->> f2) -> GQMded G f2. +Proof. + move => G f1. + elim: f1 G. + - move => x G f2 Hvar Himp. + inversion Himp; subst. + elim: Himp. + +Lemma gqm_impI : forall G f1 f2, GQMded (f1 :: G) f2 -> GQMded G (f1 ->> f2). +Proof. + move => G f1 f2. + elim. \ No newline at end of file