-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcpl.v
67 lines (55 loc) · 2.6 KB
/
cpl.v
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
Require Import List.
Import List.ListNotations.
Definition atomic := nat.
Inductive formula : Type :=
| atom : atomic -> formula
| conjunction : formula -> formula -> formula
| disjunction : formula -> formula -> formula
| arrow : formula -> formula -> formula
| negation : formula -> formula
| top : formula
| bot : formula.
Notation "⊥" := bot (at level 95).
Notation "⊤" := top (at level 95).
Infix "→" := arrow (at level 90).
Infix "∨" := disjunction (at level 85).
Infix "∧" := conjunction (at level 85).
Notation "¬" := negation (at level 80).
Definition context : Type := list formula.
Fixpoint eqf (A B : formula) : bool :=
match A, B with
| (atom a), (atom b) => PeanoNat.Nat.eqb a b
| (a ∧ a'), (b ∧ b') => andb (eqf a b) (eqf a' b')
| (a ∨ a'), (b ∨ b') => andb (eqf a b) (eqf a' b')
| (a → a'), (b → b') => andb (eqf a b) (eqf a' b')
| (¬a), (¬b) => (eqf a b)
| ⊤, ⊤ => true
| ⊥, ⊥ => true
| _, _ => false
end.
Fixpoint checkprop (A : formula) (Γ : context) : bool :=
match Γ with
| nil => false
| x :: l => if (eqf A x) then true else (checkprop A l)
end.
Reserved Notation "x ⊢ y" (at level 100).
Inductive NP : context -> formula -> Prop :=
| axiom : forall (Γ : context) (A : formula), (checkprop A Γ = true) -> (Γ ⊢ A)
| ande_left : forall (Γ : context) (A B : formula), (Γ ⊢ (A ∧ B)) -> (Γ ⊢ A)
| ande_right : forall (Γ : context) (A B : formula), (Γ ⊢ (A ∧ B)) -> (Γ ⊢ B)
| andi : forall (Γ : context) (A B : formula), (Γ ⊢ A) -> (Γ ⊢ B) -> (Γ ⊢ (A ∧ B))
| ore : forall (Γ : context) (A B C : formula), ((A :: Γ) ⊢ C) -> ((B :: Γ) ⊢ C) -> (((A ∨ B) :: Γ) ⊢ C)
| ori_left : forall (Γ : context) (A B : formula), (Γ ⊢ A) -> (Γ ⊢ (A ∨ B))
| ori_right : forall (Γ : context) (A B : formula), (Γ ⊢ B) -> (NP Γ (A ∨ B))
| MP : forall (Γ : context) (A B : formula), (Γ ⊢ A) -> (Γ ⊢ (A → B)) -> (Γ ⊢ B)
| arrowi : forall (Γ : context) (A B : formula), ((A :: Γ ) ⊢ B) -> (Γ ⊢ (A → B))
| eneg : forall (Γ : context) (A : formula), (Γ ⊢ A) -> (Γ ⊢ (¬A)) -> (Γ ⊢ (⊥))
| ineg : forall (Γ : context) (A : formula), ((A :: Γ) ⊢ (⊥)) -> (Γ ⊢ (¬A))
| RAA : forall (Γ : context) (A : formula), (((¬A) :: Γ) ⊢ (⊥)) -> (Γ ⊢ A)
| ibot : forall (Γ : context) (A : formula), (Γ ⊢ (⊥)) -> (Γ ⊢ A)
where "x ⊢ y" := (NP x y).
(* Lemma membership_preservation
Lemma weakening : forall (A B: formula) (Γ : context),
(Γ ⊢ A) -> ((B :: Γ) ⊢ A).
Proof. intros A B Γ. intros. induction H.
- apply axiom in H. *)