Subversion Repositories wimsdev

Rev

Rev 16135 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!set methtit=Contrapose
2
!set methparmtype=parm predicate nocomma >
3
!set methparmrelax=1
4
!set methhelp=Contrapose a hypothesis and a goal:\
16209 bpr 5
  rewrite A \(=>) B to not(A) \(=>) not(B)).\
6
  <p>\
7
  One can also use this method to make a proof by contradiction.
20 reyssat 8
 
9
!if $wims_read_parm iswordof form check
16120 bpr 10
  !goto $wims_read_parm
20 reyssat 11
!endif
12
 
13
!if fixedgoal iswordof $m_options
16120 bpr 14
  !set error1=fixedgoal
15
  !exit
20 reyssat 16
!endif
17
 
18
!set n_=!linecnt $m_goal
19
!if $n_>1
16120 bpr 20
  !set error1=You have several goals in the current situation!\
21
  The contraposition can only be done with a unique goal. Please first\
22
  separate the goals.
23
  !exit
20 reyssat 24
!endif
25
!if $n_<1
16120 bpr 26
  !set error1=You have no object to contrapose.
27
  !exit
20 reyssat 28
!endif
29
 
30
!exit
31
:form
16120 bpr 32
!set i_=!linecnt $mtobj1
33
!if $i_>0
20 reyssat 34
  Contrapose the hypothesis
35
  !set ch_optional=None
16120 bpr 36
  !read deduc/methparm.phtml 1
20 reyssat 37
  and the goal \($m_goal).
38
  !set methremark=Choose "hypothesis=None" to make a reasoning by contradiction.
16120 bpr 39
!else
20 reyssat 40
  Contrapose the goal \($m_goal)&nbsp;: raisonning by contradiction.
16120 bpr 41
!endif
20 reyssat 42
!exit
43
:check
16120 bpr 44
!if contradiction notwordof $m_goal
20 reyssat 45
  newobject0=!exec mathexp not\
46
$m_goal
47
  oldobject=0
16120 bpr 48
!else
20 reyssat 49
  !reset newobject, newobject0
16120 bpr 50
!endif
51
!if $methparm1=$empty or $methparm1<1
20 reyssat 52
  !if contradiction iswordof $m_goal
16120 bpr 53
    error=Contrapose a contradiction without hypotheses does not make sense!
54
    !exit
20 reyssat 55
  !endif
56
  newgoal=contradiction
57
  methexp=Contrapose
16120 bpr 58
!else
20 reyssat 59
  obj=!line $methparm1 of $mtobj1
60
  d=!item 1 of $obj
61
  l=!word 1 of $d
62
  obj=!item 2 to -1 of $obj
63
  m_context=!replace line number $l by $ in $m_context
64
  m_context=!nonempty lines $m_context
65
  newgoal=!exec mathexp not\
66
$obj
67
  methexp=Contrapose with \($obj)
16120 bpr 68
!endif
69
m_goal=$newgoal
70
!read deduc/objects.combine
20 reyssat 71
!exit